diff --git a/.gitignore b/.gitignore index 1915aed8b23..5e1bff92ff9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ +#bower deps +**/wwwroot/lib/ bin/ obj/ .idea/ latest/ +node_modules/ /env-vars.bat *.suo #ignore thumbnails created by windows @@ -38,17 +41,20 @@ build/*.dll *.user *.userprefs packages/ +.vs/ +.vscode/ +*.lock.json +*.nuget.props +*.nuget.targets release/latest/ *.nupkg release/* +requestlogs/ *.DS_Store NuGet/ -NuGet.Pcl/ -NuGet.Signed/ -*.pfx build/ diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a95a4a6066e..5e9b96594eb 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -276,7 +276,7 @@ - [kaza](https://github.com/kaza) - [mishfit](https://github.com/mishfit) - [rfvgyhn](https://github.com/rfvgyhn) (Chris) - - [caiopoiete](https://github.com/caiopoiete) (Caio Proiete) + - [augustoproiete](https://github.com/augustoproiete) (C. Augusto Proiete) - [sjuxax](https://github.com/sjuxax) (Jeff Cook) - [madaleno](https://github.com/madaleno) (Luis Madaleno) - [yavosh](https://github.com/yavosh) (Yavor Shahpasov) @@ -302,6 +302,7 @@ - [barambani](https://github.com/barambani) - [nhalm](https://github.com/et1975) - [scottmcarthur](https://github.com/scottmcarthur) (Scott McArthur) + - [siliconrob](https://github.com/Siliconrob) (Robin Michael) diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 00000000000..8c1ce21b6f6 --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/NuGet.Pcl/ServiceStack.Client.Pcl/servicestack.client.pcl.nuspec b/NuGet.Pcl/ServiceStack.Client.Pcl/servicestack.client.pcl.nuspec deleted file mode 100644 index 918ac68f7e1..00000000000 --- a/NuGet.Pcl/ServiceStack.Client.Pcl/servicestack.client.pcl.nuspec +++ /dev/null @@ -1,33 +0,0 @@ - - - - ServiceStack.Client.Pcl - PCL Service Clients for ServiceStack - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - JSON, XML, JSV, SOAP and MQ Generic Service Clients. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - ServiceStack Common Framework Clients ServiceClients Gateway - en-US - Copyright 2014 Service Stack - - - - - - - - - - - - - - diff --git a/NuGet.Pcl/ServiceStack.Interfaces.Pcl/servicestack.interfaces.pcl.nuspec b/NuGet.Pcl/ServiceStack.Interfaces.Pcl/servicestack.interfaces.pcl.nuspec deleted file mode 100644 index bcd3ac1dbc2..00000000000 --- a/NuGet.Pcl/ServiceStack.Interfaces.Pcl/servicestack.interfaces.pcl.nuspec +++ /dev/null @@ -1,26 +0,0 @@ - - - - ServiceStack.Interfaces.Pcl - PCL Lightweight and implementation-free interfaces for ServiceStack - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - Lightweight and implementation-free interfaces for DTO's, providers and adapters. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - Fast JSON XML CSV HTML SOAP JSV REST Web Service Framework MONO ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - \ No newline at end of file diff --git a/NuGet.Signed/ServiceStack.Api.Swagger.Signed/servicestack.api.swagger.signed.nuspec b/NuGet.Signed/ServiceStack.Api.Swagger.Signed/servicestack.api.swagger.signed.nuspec deleted file mode 100644 index 9317b1d556b..00000000000 --- a/NuGet.Signed/ServiceStack.Api.Swagger.Signed/servicestack.api.swagger.signed.nuspec +++ /dev/null @@ -1,33 +0,0 @@ - - - - ServiceStack.Api.Swagger.Signed - ServiceStack.Api.Swagger.Signed - 4.0.0 - Service Stack - Service Stack - ServiceStack integration with Swagger - - Provides a set of services to be discovered by Swagger (http://swagger.wordnik.com/) - Swagger is a specification and complete framework implementation for describing, producing, consuming, and visualizing RESTful web services. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - Swagger API REST Docs ServiceStack - en-US - StackExpress.net 2012 and contributors - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet.Signed/ServiceStack.Client.Signed/servicestack.client.signed.nuspec b/NuGet.Signed/ServiceStack.Client.Signed/servicestack.client.signed.nuspec deleted file mode 100644 index 24f45d28fd1..00000000000 --- a/NuGet.Signed/ServiceStack.Client.Signed/servicestack.client.signed.nuspec +++ /dev/null @@ -1,29 +0,0 @@ - - - - ServiceStack.Client.Signed - ServiceStack.Client.Signed - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - JSON, XML, JSV, SOAP and MQ Generic Service Clients. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - ServiceStack Common Framework Clients ServiceClients Gateway - en-US - Copyright 2014 Service Stack - - - - - - - - - - diff --git a/NuGet.Signed/ServiceStack.Common.Signed/servicestack.common.signed.nuspec b/NuGet.Signed/ServiceStack.Common.Signed/servicestack.common.signed.nuspec deleted file mode 100644 index a8c8af4ed2c..00000000000 --- a/NuGet.Signed/ServiceStack.Common.Signed/servicestack.common.signed.nuspec +++ /dev/null @@ -1,28 +0,0 @@ - - - - ServiceStack.Common.Signed - ServiceStack.Common.Signed - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - Common base library for ServiceStack projects. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ServiceStack Common Framework Clients ServiceClients Gateway - en-US - Copyright 2014 Service Stack - - - - - - - - - - diff --git a/NuGet.Signed/ServiceStack.ProtoBuf.Signed/servicestack.protobuf.signed.nuspec b/NuGet.Signed/ServiceStack.ProtoBuf.Signed/servicestack.protobuf.signed.nuspec deleted file mode 100644 index 96d2fe35d15..00000000000 --- a/NuGet.Signed/ServiceStack.ProtoBuf.Signed/servicestack.protobuf.signed.nuspec +++ /dev/null @@ -1,28 +0,0 @@ - - - - ServiceStack.ProtoBuf.Signed - Protocol Buffers support for ServiceStack. Includes typed ProtoBuf Client - 4.0.0 - Service Stack - Service Stack - ProtoBuf Format Serializer ContentType ServiceClients for ServiceStack - - Add the ProtoBuf binary format and endpoint to a ServiceStack web service host. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ProtoBuf Fast Binary Serializer Format ContentType REST Web Services ServiceStack - en-US - Copyright 2013 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet.Signed/ServiceStack.Razor.Signed/content/web.config.transform b/NuGet.Signed/ServiceStack.Razor.Signed/content/web.config.transform deleted file mode 100644 index 5546d322a18..00000000000 --- a/NuGet.Signed/ServiceStack.Razor.Signed/content/web.config.transform +++ /dev/null @@ -1,33 +0,0 @@ - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet.Signed/ServiceStack.Razor.Signed/servicestack.razor.signed.nuspec b/NuGet.Signed/ServiceStack.Razor.Signed/servicestack.razor.signed.nuspec deleted file mode 100644 index 24d87589168..00000000000 --- a/NuGet.Signed/ServiceStack.Razor.Signed/servicestack.razor.signed.nuspec +++ /dev/null @@ -1,41 +0,0 @@ - - - - ServiceStack.Razor.Signed - ServiceStack.Razor.Signed - 4.0.0 - Service Stack - Service Stack - Provides ServiceStack's HTML Story including integrated support for MVC Razor's ViewEngine - - ServiceStack Razor Documentation: http://razor.servicestack.net - - - Turns ServiceStack into a Complete Web + REST Services Stack. Replaces need for ASP.NET MVC. - - Runs In ASP.NET or Self-host, first-class cross-platform support on .NET / Mono runtimes. - - Add HTML views to existing services. - - Change Views and Layout templates at runtime. - - No Ceremony development options - Pages without controllers, with typed and dynamic View Models. - - Include Partial Markdown views in Razor pages. - - Cascading Layout templates. - - Pretty urls by default (no custom Routes needed). - - Keep all views and assets together. - - Smart View Pages. - - http://razor.servicestack.net - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - Razor ViewEngine View Templates Controllers Mono ASP.NET Self-Host ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet.Signed/ServiceStack.Server.Signed/servicestack.server.signed.nuspec b/NuGet.Signed/ServiceStack.Server.Signed/servicestack.server.signed.nuspec deleted file mode 100644 index d846ad9e9d5..00000000000 --- a/NuGet.Signed/ServiceStack.Server.Signed/servicestack.server.signed.nuspec +++ /dev/null @@ -1,31 +0,0 @@ - - - - ServiceStack.Server.Signed - ServiceStack.Server.Signed - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - Integration libraries and adapters with other major ServiceStack server components. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - Fast JSON XML CSV HTML SOAP JSV REST Web Service Framework MONO ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet.Signed/ServiceStack.Signed/servicestack.signed.nuspec b/NuGet.Signed/ServiceStack.Signed/servicestack.signed.nuspec deleted file mode 100644 index 18765b9d9c9..00000000000 --- a/NuGet.Signed/ServiceStack.Signed/servicestack.signed.nuspec +++ /dev/null @@ -1,36 +0,0 @@ - - - - ServiceStack.Signed - ServiceStack.Signed - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - Binaries for the ServiceStack web framework. - Visit https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project - and https://github.com/ServiceStack/ServiceStack/wiki/Create-your-first-webservice - for walk throughs and docs on creating your first web service. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - Fast JSON XML CSV HTML SOAP JSV REST Web Service Framework MONO ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/NuGetPack.cmd b/NuGet/NuGetPack.cmd deleted file mode 100644 index 565594c3646..00000000000 --- a/NuGet/NuGetPack.cmd +++ /dev/null @@ -1,33 +0,0 @@ -SET NUGET=..\src\.nuget\nuget -%NUGET% pack ServiceStack\servicestack.nuspec -symbols -%NUGET% pack ServiceStack.Server\servicestack.server.nuspec -symbols -%NUGET% pack ServiceStack.Interfaces\servicestack.interfaces.nuspec -symbols -%NUGET% pack ServiceStack.Client\servicestack.client.nuspec -symbols -%NUGET% pack ServiceStack.Common\servicestack.common.nuspec -symbols -%NUGET% pack ServiceStack.Mvc\servicestack.mvc.nuspec -symbols -%NUGET% pack ServiceStack.Api.Swagger\servicestack.api.swagger.nuspec -symbols -%NUGET% pack ServiceStack.Razor\servicestack.razor.nuspec -symbols - -%NUGET% pack ServiceStack.Host.AspNet\servicestack.host.aspnet.nuspec -%NUGET% pack ServiceStack.Host.Mvc\servicestack.host.mvc.nuspec - -%NUGET% pack ServiceStack.Authentication.OpenId\servicestack.authentication.openid.nuspec -symbols -%NUGET% pack ServiceStack.Authentication.OAuth2\servicestack.authentication.oauth2.nuspec -symbols - -%NUGET% pack ServiceStack.Authentication.MongoDb\servicestack.authentication.mongodb.nuspec -symbols -%NUGET% pack ServiceStack.Authentication.NHibernate\servicestack.authentication.nhibernate.nuspec -symbols -%NUGET% pack ServiceStack.Authentication.RavenDb\servicestack.authentication.ravendb.nuspec -symbols - -%NUGET% pack ServiceStack.Caching.AwsDynamoDb\servicestack.caching.awsdynamodb.nuspec -symbols -%NUGET% pack ServiceStack.Caching.Azure\servicestack.caching.azure.nuspec -symbols -%NUGET% pack ServiceStack.Caching.Memcached\servicestack.caching.memcached.nuspec -symbols - -%NUGET% pack ServiceStack.Logging.Elmah\servicestack.logging.elmah.nuspec -symbols -%NUGET% pack ServiceStack.Logging.EntLib5\servicestack.logging.entlib5.nuspec -symbols -%NUGET% pack ServiceStack.Logging.EventLog\servicestack.logging.eventlog.nuspec -symbols -%NUGET% pack ServiceStack.Logging.Log4Net\servicestack.logging.log4net.nuspec -symbols -%NUGET% pack ServiceStack.Logging.NLog\servicestack.logging.nlog.nuspec -symbols - -%NUGET% pack ServiceStack.ProtoBuf\servicestack.protobuf.nuspec -symbols -%NUGET% pack ServiceStack.MsgPack\servicestack.msgpack.nuspec -symbols - diff --git a/NuGet/NuGetPush.cmd b/NuGet/NuGetPush.cmd deleted file mode 100644 index eca3f99e164..00000000000 --- a/NuGet/NuGetPush.cmd +++ /dev/null @@ -1,22 +0,0 @@ -SET NUGET=..\src\.nuget\nuget -%NUGET% push ServiceStack.3.9.60.nupkg -%NUGET% push ServiceStack.3.9.60.symbols.nupkg -%NUGET% push ServiceStack.Api.Swagger.3.9.60.nupkg -%NUGET% push ServiceStack.Api.Swagger.3.9.60.symbols.nupkg -%NUGET% push ServiceStack.Authentication.OAuth2.3.9.60.nupkg -%NUGET% push ServiceStack.Authentication.OAuth2.3.9.60.symbols.nupkg -%NUGET% push ServiceStack.Authentication.OpenId.3.9.60.nupkg -%NUGET% push ServiceStack.Authentication.OpenId.3.9.60.symbols.nupkg -%NUGET% push ServiceStack.Client.Silverlight.3.9.60.nupkg -%NUGET% push ServiceStack.Common.3.9.60.nupkg -%NUGET% push ServiceStack.Common.3.9.60.symbols.nupkg -%NUGET% push ServiceStack.Host.AspNet.3.9.60.nupkg -%NUGET% push ServiceStack.Host.Mvc.3.9.60.nupkg -%NUGET% push ServiceStack.Mvc.3.9.60.nupkg -%NUGET% push ServiceStack.Mvc.3.9.60.symbols.nupkg -%NUGET% push ServiceStack.Plugins.MsgPack.3.9.60.nupkg -%NUGET% push ServiceStack.Plugins.MsgPack.3.9.60.symbols.nupkg -%NUGET% push ServiceStack.Plugins.ProtoBuf.3.9.60.nupkg -%NUGET% push ServiceStack.Plugins.ProtoBuf.3.9.60.symbols.nupkg -%NUGET% push ServiceStack.Razor.3.9.60.nupkg -%NUGET% push ServiceStack.Razor.3.9.60.symbols.nupkg diff --git a/NuGet/ServiceStack.Api.Swagger/servicestack.api.swagger.nuspec b/NuGet/ServiceStack.Api.Swagger/servicestack.api.swagger.nuspec deleted file mode 100644 index fb341402e26..00000000000 --- a/NuGet/ServiceStack.Api.Swagger/servicestack.api.swagger.nuspec +++ /dev/null @@ -1,33 +0,0 @@ - - - - ServiceStack.Api.Swagger - ServiceStack additional API for integration with Swagger - 4.0.0 - Service Stack - Service Stack - ServiceStack integration with Swagger - - Provides a set of services to be discovered by Swagger (http://swagger.wordnik.com/) - Swagger is a specification and complete framework implementation for describing, producing, consuming, and visualizing RESTful web services. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - Swagger API REST Docs ServiceStack - en-US - StackExpress.net 2012 and contributors - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Authentication.MongoDb/servicestack.authentication.mongodb.nuspec b/NuGet/ServiceStack.Authentication.MongoDb/servicestack.authentication.mongodb.nuspec deleted file mode 100644 index 7f182c5640d..00000000000 --- a/NuGet/ServiceStack.Authentication.MongoDb/servicestack.authentication.mongodb.nuspec +++ /dev/null @@ -1,30 +0,0 @@ - - - - ServiceStack.Authentication.MongoDB - 4.0.0 - Assaf Raman, ServiceStack contributors - Assaf Raman, ServiceStack contributors - A MongoDB IUserAuthRepository to persist User registration and auth info in a NoSQL Mongo DB - - A MongoDB IUserAuthRepository to persist User registration and auth info in a NoSQL Mongo DB. - Implements ServiceStack's built-in AuthProvider Model: - https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization - inc. Twitter, Facebook, Basic, Digest, Credentials Auth modes out-of-the-box. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ServiceStack Authentication Authorization MongoDB NoSQL POCO Code-First - en-US - ServiceStack 2014 and contributors - - - - - - - - - - diff --git a/NuGet/ServiceStack.Authentication.NHibernate/servicestack.authentication.nhibernate.nuspec b/NuGet/ServiceStack.Authentication.NHibernate/servicestack.authentication.nhibernate.nuspec deleted file mode 100644 index da5c04de190..00000000000 --- a/NuGet/ServiceStack.Authentication.NHibernate/servicestack.authentication.nhibernate.nuspec +++ /dev/null @@ -1,32 +0,0 @@ - - - - ServiceStack.Authentication.NHibernate - 4.0.0 - Joshua Lewis, ServiceStack contributors - Joshua Lewis, ServiceStack contributors - An NHibernate IUserAuthRepository to persist User registration and auth info in any RDBMS NHibernate supports - - An NHibernate IUserAuthRepository to persist User registration and authentication info in any RDBMS NHibernate supports. - Implements ServiceStack's built-in AuthProvider Model: - https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization - inc. Twitter, Facebook, Basic, Digest, Credentials Auth modes out-of-the-box. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ServiceStack Authentication Authorization NHibernate SQLServer Sqlite Oracle MySql PostgreSQL POCO Code-First - en-US - ServiceStack 2014 and contributors - - - - - - - - - - - - diff --git a/NuGet/ServiceStack.Authentication.OAuth2/servicestack.authentication.oauth2.nuspec b/NuGet/ServiceStack.Authentication.OAuth2/servicestack.authentication.oauth2.nuspec deleted file mode 100644 index f64e357e6fc..00000000000 --- a/NuGet/ServiceStack.Authentication.OAuth2/servicestack.authentication.oauth2.nuspec +++ /dev/null @@ -1,32 +0,0 @@ - - - - ServiceStack.Authentication.OAuth2 - OAuth2 Providers for ServiceStack - inc. Google, LinkedIn - 4.0.0 - Service Stack - Service Stack - OpenId Auth Providers for ServiceStack - inc. Google, LinkedIn - - Adds OAuth2 Providers for use in ServiceStack Web and REST Services. - Includes built-in support for Google and LinkedIn OAuth2 providers. - - More Info on Auth Providers: - https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - OAuth OAuth2 Google LinkedIn Authentication Auth Provider ServiceStack Web Services - en-US - Copyright 2014 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Authentication.OpenId/servicestack.authentication.openid.nuspec b/NuGet/ServiceStack.Authentication.OpenId/servicestack.authentication.openid.nuspec deleted file mode 100644 index 4edabaaf6d6..00000000000 --- a/NuGet/ServiceStack.Authentication.OpenId/servicestack.authentication.openid.nuspec +++ /dev/null @@ -1,32 +0,0 @@ - - - - ServiceStack.Authentication.OpenId - OpenId Auth Providers for ServiceStack - inc. Google, Yahoo, MyOpenId - 4.0.0 - Service Stack - Service Stack - OpenId Auth Providers for ServiceStack - inc. Google, Yahoo, MyOpenId - - Adds OpenId Auth Providers for use in ServiceStack Web and REST Services. - Includes built-in support for Google, Yahoo, MyOpenId and Custom OpenId providers. - - More Info on Auth Providers: - https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - OpenId Google Yahoo MyOpenId Authentication Auth Provider ServiceStack REST Web Services ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Authentication.RavenDb/servicestack.authentication.ravendb.nuspec b/NuGet/ServiceStack.Authentication.RavenDb/servicestack.authentication.ravendb.nuspec deleted file mode 100644 index 7e55a943865..00000000000 --- a/NuGet/ServiceStack.Authentication.RavenDb/servicestack.authentication.ravendb.nuspec +++ /dev/null @@ -1,30 +0,0 @@ - - - - ServiceStack.Authentication.RavenDB - 4.0.0 - ServiceStack contributors - ServiceStack contributors - A RavenDB IUserAuthRepository to persist User registration and auth info in a NoSQL Raven DB - - A RavenDB IUserAuthRepository to persist User registration and auth info in a NoSQL Raven DB. - Implements ServiceStack's built-in AuthProvider Model: - https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization - inc. Twitter, Facebook, Basic, Digest, Credentials Auth modes out-of-the-box. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ServiceStack Authentication Authorization RavenDB Raven NoSQL POCO Code-First - en-US - ServiceStack 2014 and contributors - - - - - - - - - - diff --git a/NuGet/ServiceStack.Caching.AwsDynamoDb/servicestack.caching.awsdynamodb.nuspec b/NuGet/ServiceStack.Caching.AwsDynamoDb/servicestack.caching.awsdynamodb.nuspec deleted file mode 100644 index f22877a0997..00000000000 --- a/NuGet/ServiceStack.Caching.AwsDynamoDb/servicestack.caching.awsdynamodb.nuspec +++ /dev/null @@ -1,27 +0,0 @@ - - - - ServiceStack.Caching.AwsDynamoDb - 4.0.0 - ServiceStack contributors - ServiceStack contributors - - An Amazon Web Services In-Memory DynamoDb DataCache implementing ServiceStack's ICacheClient: - https://github.com/ServiceStack/ServiceStack/wiki/Caching - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ServiceStack Caching AwsDynamoDb Amazon WebServices AWS DynamoDb Cache CacheClient - en-US - ServiceStack 2014 and contributors - - - - - - - - - - diff --git a/NuGet/ServiceStack.Caching.Azure/servicestack.caching.azure.nuspec b/NuGet/ServiceStack.Caching.Azure/servicestack.caching.azure.nuspec deleted file mode 100644 index 864f224bd2f..00000000000 --- a/NuGet/ServiceStack.Caching.Azure/servicestack.caching.azure.nuspec +++ /dev/null @@ -1,27 +0,0 @@ - - - - ServiceStack.Caching.Azure - 4.0.0 - Manuel Nelson, ServiceStack contributors - Manuel Nelson, ServiceStack contributors - - An Azure In-Memory DataCache implementing ServiceStack's ICacheClient: - https://github.com/ServiceStack/ServiceStack/wiki/Caching - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ServiceStack Caching Windows Azure Cache CacheClient POCO Code-First - en-US - ServiceStack 2014 and contributors - - - - - - - - - - diff --git a/NuGet/ServiceStack.Caching.Memcached/servicestack.caching.memcached.nuspec b/NuGet/ServiceStack.Caching.Memcached/servicestack.caching.memcached.nuspec deleted file mode 100644 index a74f1160798..00000000000 --- a/NuGet/ServiceStack.Caching.Memcached/servicestack.caching.memcached.nuspec +++ /dev/null @@ -1,27 +0,0 @@ - - - - ServiceStack.Caching.Memcached - 4.0.0 - Service Stack, Thomas Grassauer and ServiceStack contributors - Service Stack, Thomas Grassauer and ServiceStack contributors - - An Memcached cache client implementing ServiceStack's ICacheClient: - https://github.com/ServiceStack/ServiceStack/wiki/Caching - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ServiceStack Caching Memcached Cache CacheClient POCO Code-First - en-US - ServiceStack 2014 and contributors - - - - - - - - - - diff --git a/NuGet/ServiceStack.Client/servicestack.client.nuspec b/NuGet/ServiceStack.Client/servicestack.client.nuspec deleted file mode 100644 index da4c59f41b9..00000000000 --- a/NuGet/ServiceStack.Client/servicestack.client.nuspec +++ /dev/null @@ -1,33 +0,0 @@ - - - - ServiceStack.Client - Service Clients for ServiceStack - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - JSON, XML, JSV, SOAP and MQ Generic Service Clients. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - ServiceStack Common Framework Clients ServiceClients Gateway - en-US - Copyright 2014 Service Stack - - - - - - - - - - - - - - diff --git a/NuGet/ServiceStack.Common/servicestack.common.nuspec b/NuGet/ServiceStack.Common/servicestack.common.nuspec deleted file mode 100644 index 3bf81813e1d..00000000000 --- a/NuGet/ServiceStack.Common/servicestack.common.nuspec +++ /dev/null @@ -1,28 +0,0 @@ - - - - ServiceStack.Common - Common libs for ServiceStack projects - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - Common base library for ServiceStack projects. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ServiceStack Common Framework Clients ServiceClients Gateway - en-US - Copyright 2014 Service Stack - - - - - - - - - - diff --git a/NuGet/ServiceStack.Gap/build/ServiceStack.Gap.targets b/NuGet/ServiceStack.Gap/build/ServiceStack.Gap.targets deleted file mode 100644 index 799dc3c07d9..00000000000 --- a/NuGet/ServiceStack.Gap/build/ServiceStack.Gap.targets +++ /dev/null @@ -1,25 +0,0 @@ - - - $(CoreCompileDependsOn);RazorGeneratorOutput - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Gap/servicestack.gap.nuspec b/NuGet/ServiceStack.Gap/servicestack.gap.nuspec deleted file mode 100644 index 481222083b6..00000000000 --- a/NuGet/ServiceStack.Gap/servicestack.gap.nuspec +++ /dev/null @@ -1,32 +0,0 @@ - - - - ServiceStack.Gap - ServiceStack.Gap - Tools to help create embedded versions of ServiceStack - 4.0.0 - Service Stack - Service Stack - Tools to help create embedded versions of ServiceStack - - MSBuild Tasks to help creating self-contained embedded versions of ServiceStack that can be ILMerged into a single cross-platform .exe accessed by the users perferred browser or hosted inside a Native Desktop App shell containing a Web Browser widget. - - Once added to a project the install.ps1 script will set the BuildAction to all Razor *.cshtml pages to 'Content' so they get pre-compiled and change all html/img/css assets to Embedded Resources so they get bundled inside the dll. - - This package also includes a copy of ILMerge.exe under \tools that can be used to merge all ServiceStack .dlls into a single exe. See the https://github.com/ServiceStack/ServiceStack.Gap project for more info. - - https://github.com/ServiceStack/ServiceStack.Gap - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - Embed Resources Razor ViewEngine View Templates Mono ASP.NET Self-Host ServiceStack - en-US - Copyright 2013 Service Stack - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Gap/tools/ILMerge License.rtf b/NuGet/ServiceStack.Gap/tools/ILMerge License.rtf deleted file mode 100644 index e8001515e64..00000000000 --- a/NuGet/ServiceStack.Gap/tools/ILMerge License.rtf +++ /dev/null @@ -1,104 +0,0 @@ -{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f37\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;} -{\f39\froman\fcharset0\fprq2{\*\panose 02040602050305030304}Book Antiqua;}{\f40\fswiss\fcharset0\fprq2{\*\panose 020b0706030402020204}Franklin Gothic Demi Cond;}{\f41\fswiss\fcharset0\fprq2{\*\panose 020b0503020102020204}Franklin Gothic Book;} -{\f42\froman\fcharset238\fprq2 Times New Roman CE;}{\f43\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f45\froman\fcharset161\fprq2 Times New Roman Greek;}{\f46\froman\fcharset162\fprq2 Times New Roman Tur;} -{\f47\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f48\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f49\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f50\froman\fcharset163\fprq2 Times New Roman (Vietnamese);} -{\f412\fswiss\fcharset238\fprq2 Tahoma CE;}{\f413\fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f415\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f416\fswiss\fcharset162\fprq2 Tahoma Tur;}{\f417\fswiss\fcharset177\fprq2 Tahoma (Hebrew);} -{\f418\fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f419\fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f420\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f421\fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f432\froman\fcharset238\fprq2 Book Antiqua CE;} -{\f433\froman\fcharset204\fprq2 Book Antiqua Cyr;}{\f435\froman\fcharset161\fprq2 Book Antiqua Greek;}{\f436\froman\fcharset162\fprq2 Book Antiqua Tur;}{\f439\froman\fcharset186\fprq2 Book Antiqua Baltic;} -{\f442\fswiss\fcharset238\fprq2 Franklin Gothic Demi Cond CE;}{\f443\fswiss\fcharset204\fprq2 Franklin Gothic Demi Cond Cyr;}{\f445\fswiss\fcharset161\fprq2 Franklin Gothic Demi Cond Greek;}{\f446\fswiss\fcharset162\fprq2 Franklin Gothic Demi Cond Tur;} -{\f449\fswiss\fcharset186\fprq2 Franklin Gothic Demi Cond Baltic;}{\f452\fswiss\fcharset238\fprq2 Franklin Gothic Book CE;}{\f453\fswiss\fcharset204\fprq2 Franklin Gothic Book Cyr;}{\f455\fswiss\fcharset161\fprq2 Franklin Gothic Book Greek;} -{\f456\fswiss\fcharset162\fprq2 Franklin Gothic Book Tur;}{\f459\fswiss\fcharset186\fprq2 Franklin Gothic Book Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255; -\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} -{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* -\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv -\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\s15\ql \fi-274\li274\ri0\sb120\sl460\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin274\itap0 \f40\fs44\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 \styrsid9786739 1sectionhead;}{\s16\ql \li0\ri0\sb120\sl200\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \caps\f40\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext16 \styrsid9786739 4laparahead;}{\s17\ql \li0\ri-18\sb120\sl240\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin-18\lin0\itap0 \f40\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext17 \styrsid9786739 2lasubhead;}{\s18\ql \fi-187\li187\ri0\sb60\sl180\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin187\itap0 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext18 \styrsid9786739 3cnumbered;}{\s19\ql \fi-340\li624\ri0\sb60\sl160\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin624\itap0 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext19 \styrsid9786739 3inumbered2ndlevel;}{\s20\ql \li0\ri0\sb240\sl240\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \f40\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext20 \styrsid9786739 2afrenchsubhead;}{\s21\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 -\cbpat9 \f37\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext21 \ssemihidden \styrsid7154712 Document Map;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\pgptbl {\pgp\ipgp2\itap0\li0\ri0\sb0\sa0\brdrt\brdrs\brdrw20 }{\pgp\ipgp0 -\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid2099452\rsid4207571\rsid5465292\rsid5510097\rsid5510644\rsid7154712\rsid7241305\rsid7672529\rsid7735936\rsid9179139\rsid9786739\rsid10440675\rsid11303133\rsid13130884\rsid14028235\rsid14100361\rsid14113652 -\rsid15276140\rsid16213514}{\*\generator Microsoft Word 11.0.6359;}{\info{\title ILMerge EULA}{\author Ken Leppert}{\operator mbarnett}{\creatim\yr2005\mo3\dy16\hr15\min43}{\revtim\yr2005\mo3\dy16\hr15\min43}{\printim\yr2004\mo4\dy30\hr13\min9}{\version2} -{\edmins0}{\nofpages3}{\nofwords1188}{\nofchars6775}{\*\company Microsoft Corporation}{\nofcharsws7948}{\vern24703}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180 -\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1\jexpand\viewkind1\viewscale68\viewzk2\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel -\wrppunct\asianbrkrule\rsidroot9786739\newtblstyruls\nogrowautofit \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang -{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang -{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain -\s15\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0\pararsid7154712 \f40\fs44\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\f39\fs28\insrsid9786739 MICROSOFT }{ -\b\f39\fs28\insrsid5465292 ILMerge}{\insrsid9786739 -\par }{\b\f39\fs22\insrsid9786739 END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE}{\insrsid9786739 -\par }\pard\plain \s17\qj \li0\ri-17\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin-17\lin0\itap0\pararsid14100361 \f40\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\f39\insrsid9786739 IMPORTANT\emdash -READ CAREFULLY: }{\f39\insrsid9786739 This End-User License Agreement (\'93EULA\'94) is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation (\'93Microsoft\'94) for th -e Microsoft software that accompanies this EULA, which includes computer software and may include associated media, printed materials, \'93online\'94 or electronic documentation, and Internet-based services (\'93Software\'94).\~ - An amendment or addendum to this EULA may accompany the Software.\~ }{\b\f39\insrsid9786739 -YOU AGREE TO BE BOUND BY THE TERMS OF THIS EULA BY INSTALLING, COPYING, OR OTHERWISE USING THE SOFTWARE. IF YOU DO NOT AGREE, DO NOT INSTALL, COPY, OR USE THE SOFTWARE.}{\insrsid9786739 -\par }\pard\plain \qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid9786739 1.\~\~\~\~\~\~\~\~ }{ -\b\f39\fs22\insrsid9786739 GRANTS OF LICENSE}{\f39\fs22\insrsid9786739 . Microsoft grants you the rights described in this EULA provided that you comply with all terms and conditions of this EULA.\~ }{\insrsid9786739 -\par }\pard\plain \s19\qj \fi720\li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\cf0\insrsid9786739 1.1\~\~\~\~\~\~ }{ -\b\i\f39\fs22\cf0\insrsid9786739 License Grant}{\f39\fs22\cf0\insrsid9786739 . Microsoft grants to you a personal, nonexclusive, nontransferable, limited license to }{\f39\fs22\insrsid9786739 install and use a reasonable number of copies of -the Software on computers residing on your premises }{\f39\fs22\cf0\insrsid9786739 for the purposes of designing, developing, and testing, your software product(s), provided that you are the only individual using the Software.\~ }{\insrsid9786739 -\par }\pard\plain \s18\qj \fi720\li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid9786739 1.2\~\~\~\~\~\~ }{ -\b\i\f39\fs22\insrsid9786739 Documentation}{\f39\fs22\insrsid9786739 .}{\b\f39\fs22\insrsid9786739 \~ }{\f39\fs22\insrsid9786739 You may make and use a reasonabl -e number of copies of any documentation, provided that such copies shall be used only for your personal purposes and are not to be republished or distributed (either in hard copy or electronic form) beyond your premises.}{\insrsid9786739 -\par }\pard \s18\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 {\f39\fs22\insrsid9786739 2.\~\~\~\~\~\~\~\~ }{\b\f39\fs22\insrsid9786739 RESERVATION OF RIGHTS AND OWNERSHIP.\~ }{ -\f39\fs22\insrsid9786739 The Software is licensed as a single product.\~ Its component parts may not be separated. Microsoft reserves all rights not expressly granted to you in this EULA.\~ - The Software is protected by copyright and other intellectual property laws and treaties}{\f39\fs22\insrsid14028235 , and}{\f39\fs22\insrsid9786739 Microsoft }{\f39\fs22\insrsid14028235 (}{\f39\fs22\insrsid9786739 or its suppliers}{ -\f39\fs22\insrsid14028235 , where applicable)}{\f39\fs22\insrsid9786739 own }{\f39\fs22\insrsid14028235 all right, }{\f39\fs22\insrsid9786739 title, }{\f39\fs22\insrsid14028235 and interest in all }{\f39\fs22\insrsid9786739 -intellectual property rights in the Software.\~ }{\b\f39\fs22\insrsid9786739 The Software is licensed, not sold.}{\insrsid9786739 -\par }\pard\plain \s19\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\cf0\insrsid9786739 3.\~\~\~\~\~\~\~\~ }{ -\b\f39\fs22\cf0\insrsid9786739 LIMITATIONS ON REVERSE ENGINEERING, DECOMPILATION, AND DISASSEMBLY}{\b\i\f39\fs22\cf0\insrsid9786739 .}{\f39\fs22\cf0\insrsid9786739 \~ - You may not reverse engineer, decompile, or disassemble the Software, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.}{\insrsid9786739 -\par }\pard\plain \s18\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\sl220\slmult0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid9786739 4.\~\~\~\~\~\~\~\~ -}{\b\f39\fs22\insrsid9786739 NO RENTAL/COMMERCIAL HOSTING.}{\b\i\f39\fs22\insrsid9786739 }{\f39\fs22\insrsid9786739 You may not rent, lease, lend or provide commercial hosting services with the Software.}{\insrsid9786739 -\par }\pard\plain \s19\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\cf0\insrsid9786739 5.\~\~\~\~\~\~\~\~ }{ -\b\f39\fs22\cf0\insrsid9786739 NO SOFTWARE TRANSFER.\~ }{\f39\fs22\cf0\insrsid9786739 You may not assign or otherwise transfer the SOFTWARE or any of your rights hereunder to any third party.}{\insrsid9786739 -\par }{\f39\fs22\cf0\insrsid9786739 6.\~\~\~\~\~\~\~\~ }{\b\f39\fs22\cf0\insrsid9786739 CONSENT TO USE OF DATA.\~ }{\f39\fs22\cf0\insrsid9786739 You - agree that Microsoft and its affiliates may collect and use technical information gathered as part of the product support services provided to you, if any, related to the Software.\~ - Microsoft may use this information solely to improve our products or to provide customized services or technologies to you and will not disclose this information in a form that personally identifies you.\~\~ }{\insrsid9786739 -\par }{\f39\fs22\cf0\insrsid5510644 7}{\f39\fs22\cf0\insrsid9786739 .\~\~\~\~\~\~\~\~ }{\b\f39\fs22\cf0\insrsid9786739 ADDITIONAL SOFTWARE/SERVICES.\~ }{\f39\fs22\insrsid9786739 Microsoft is not obligated to provide maintenance, technical supplements}{ -\f39\fs22\insrsid14028235 , updates,}{\f39\fs22\insrsid9786739 or other support to you for the Software licensed under this EULA. }{\f39\fs22\insrsid7241305 }{\f39\fs22\insrsid9786739 In the event that Microsoft does provide such supplements or updates} -{\b\f39\fs22\insrsid9786739 , }{\f39\fs22\insrsid9786739 this EULA applies to such updates, supplements, or add-on components of the Software that Microsoft may provide to -you or make available to you after the date you obtain your initial copy of the Software, unless we provide other terms along with the update, supplement, or add-on component}{\f39\fs22\cf0\insrsid9786739 .\~ - Microsoft reserves the right to discontinue any Internet-based services provided to you or made available to you through the use of the Software.\~ }{\insrsid9786739 -\par }\pard\plain \s18\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\sl220\slmult0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid5510644 8}{ -\f39\fs22\insrsid9786739 .\~\~\~\~\~\~\~\~ }{\b\f39\fs22\insrsid9786739 EXPORT RESTRICTIONS}{\f39\fs22\insrsid9786739 .\~ }{\f39\fs22\cgrid0\insrsid9786739 You acknowledge that the Software is subject to U.S. export jurisdiction.\~ - You agree to comply with all applicable international and national laws that apply to the Software, including the U.S. Export Administration Regulations, as well as end-user, end-use, and destination restrictions issued by U.S. and other governments.\~\~ - For additional information see }{\f39\fs22\ul\cgrid0\insrsid9786739 http://www.microsoft.com/exporting/}{\f39\fs22\cgrid0\insrsid9786739 .}{\insrsid9786739 -\par }\pard\plain \s19\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\cf0\insrsid14113652 9}{ -\f39\fs22\cf0\insrsid9786739 .\~\~\~\~\~\~ }{\b\f39\fs22\cf0\insrsid9786739 TERMINATION.}{\f39\fs22\cf0\insrsid9786739 \~ Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with }{\f39\fs22\cf0\insrsid7241305 -any }{\f39\fs22\cf0\insrsid9786739 term}{\f39\fs22\cf0\insrsid7241305 or}{\f39\fs22\cf0\insrsid9786739 condition of this EULA. }{\f39\fs22\cf0\insrsid7241305 }{\f39\fs22\cf0\insrsid9786739 -In such event, you must destroy all copies of the Software and all of its component parts.}{\insrsid9786739 -\par }\pard\plain \s18\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\sl220\slmult0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid9786739 1}{ -\f39\fs22\insrsid14113652 0}{\f39\fs22\insrsid9786739 .\~\~\~\~\~\~ }{\b\f39\fs22\ul\insrsid9786739 DISCLAIMER OF WARRANTIES}{\b\f39\fs22\insrsid9786739 .\~ - TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND ITS SUPPLIERS PROVIDE THE SOFTWARE}{\f39\fs22\insrsid9786739 }{\b\f39\fs22\insrsid9786739 AND SUPPORT SERVICES (IF ANY) }{\b\i\f39\fs22\insrsid9786739 AS IS AND WITH ALL FAULTS}{ -\b\f39\fs22\insrsid9786739 , AND HEREBY DISCLAIM ALL OTHER WARRANTIES AND CONDITIONS, WHETHER EXPRESS, IMPLIED - OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF RELIABILITY OR AVAILABILITY, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF WORKMANLI -K -E EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE, ALL WITH REGARD TO THE SOFTWARE, AND THE PROVISION OF OR FAILURE TO PROVIDE SUPPORT OR OTHER SERVICES, INFORMATION, SOFTWARE, AND RELATED CONTENT THROUGH THE SOFTWARE OR OTHERWISE ARISING OUT OF THE - USE OF THE SOFTWARE.\~ ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT WITH REGARD TO THE SOFTWARE.}{\insrsid9786739 -\par }{\f39\fs22\insrsid9786739 1}{\f39\fs22\insrsid14113652 1}{\f39\fs22\insrsid9786739 .}{\b\f39\fs22\insrsid9786739 \~\~\~\~\~\~ }{\b\f39\fs22\ul\insrsid9786739 EXCLUSION OF INCIDENTAL, CONSEQUENTIAL AND CERTAIN OTHER DAMAGES}{\b\f39\fs22\insrsid9786739 .\~ - }{\b\caps\f39\fs22\insrsid9786739 -To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any special, incidental, punitive, indirect, or consequential damages whatsoever (including, but not limited to, damages for loss of profit -s, LOSS OF DATA, or confidential or other information}{\b\f39\fs22\insrsid9786739 , }{\b\caps\f39\fs22\insrsid9786739 -for business interruption, for personal injury, for loss of privacy, for failure to meet any duty including of good faith or of reasonable care, for negligence, and}{\b\f39\fs22\insrsid9786739 }{\b\caps\f39\fs22\insrsid9786739 -for any other pecuniary or other los -s whatsoever) arising out of or in any way related to the use of or inability to use the SOFTWARE, the provision of or failure to provide Support OR OTHER Services, informatIon, software, and related CONTENT through the software or otherwise arising out o -f - the use of the software, or otherwise under or in connection with any provision of this EULA, even in the event of the fault, tort (including negligence), misrepresentation, strict liability, breach of contract or breach of warranty of Microsoft or any s -upplier, and even if Microsoft or any supplier has been advised of the possibility of such damages. }{\insrsid9786739 -\par }{\f39\fs22\insrsid9786739 1}{\f39\fs22\insrsid14113652 2}{\f39\fs22\insrsid9786739 .}{\b\f39\fs22\insrsid9786739 \~\~\~\~\~\~ }{\b\f39\fs22\ul\insrsid9786739 LIMITATION OF LIABILITY AND REMEDIES}{\b\f39\fs22\insrsid9786739 -. NOTWITHSTANDING ANY DAMAGES THAT YOU MIGHT INCUR FOR ANY REASON WHATSOEVER (INCLUDING, WITHOUT LIMITATION, A -LL DAMAGES REFERENCED HEREIN AND ALL DIRECT OR GENERAL DAMAGES IN CONTRACT OR ANYTHING ELSE), THE ENTIRE LIABILITY OF MICROSOFT AND ANY OF ITS SUPPLIERS UNDER ANY PROVISION OF THIS EULA AND YOUR EXCLUSIVE REMEDY HEREUNDER SHALL BE LIMITED TO THE GREATER O -F THE ACTUAL DAMAGES YOU INCUR IN REASONABLE RELIANCE ON THE SOFTWARE UP TO THE AMOUNT ACTUALLY PAID BY YOU FOR THE SOFTWARE}{\f39\fs22\insrsid9786739 }{\b\f39\fs22\insrsid9786739 OR US$5.00.\~ - THE FOREGOING LIMITATIONS, EXCLUSIONS AND DISCLAIMERS SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, EVEN IF ANY REMEDY FAILS ITS ESSENTIAL PURPOSE.}{\insrsid9786739 -\par }{\f39\fs22\insrsid9786739 1}{\f39\fs22\insrsid14113652 3}{\f39\fs22\insrsid9786739 .\~\~\~\~\~\~ }{\b\f39\fs22\insrsid9786739 APPLICABLE LAW.\~ }{\f39\fs22\insrsid7735936 T}{\f39\fs22\insrsid9786739 his EULA }{\f39\fs22\insrsid7735936 -shall be construed under and }{\f39\fs22\insrsid9786739 governed by the laws of the State of Washington}{\f39\fs22\insrsid7735936 , without regard to conflicts of law principles}{\f39\fs22\insrsid9786739 .\~ }{\insrsid9786739 -\par }\pard\plain \s20\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\sl240\slmult0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f40\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\insrsid9786739 1}{\f39\insrsid14113652 -4}{\f39\insrsid9786739 .\~\~\~\~ }{\b\f39\insrsid9786739 ENTIRE AGREEMENT; SEVERABILITY.\~ }{\f39\insrsid9786739 This -EULA (including any addendum or amendment to this EULA which is included with the Software) are the entire agreement between you and Microsoft relating to the Software and the support services (if any) and they supersede all prior or contemporaneous oral -or written communications,\~proposals and representations with respect to the Software or any other subject matter covered by this EULA.\~ - If any provision of this EULA is held to be void, invalid, unenforceable or illegal, the other provisions shall continue in full force and effect}{\insrsid9786739 -\par }\pard\plain \qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid10440675 -\par }} \ No newline at end of file diff --git a/NuGet/ServiceStack.Gap/tools/ILMerge.exe b/NuGet/ServiceStack.Gap/tools/ILMerge.exe deleted file mode 100644 index 9667425b396..00000000000 Binary files a/NuGet/ServiceStack.Gap/tools/ILMerge.exe and /dev/null differ diff --git a/NuGet/ServiceStack.Gap/tools/install.ps1 b/NuGet/ServiceStack.Gap/tools/install.ps1 deleted file mode 100644 index 401c3fd39b5..00000000000 --- a/NuGet/ServiceStack.Gap/tools/install.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -param($installPath, $toolsPath, $package, $project) - -# Set BuildAction of Razor Views to Content -function CompileRazorViews($projectItems) { - $projectItems | %{ - $x = $_.Name.ToLower() - if ($x -like "*.cshtml") { - $_.Properties.Item("BuildAction").Value = [int]2 # Content - } - - # Recursively - if ($_.ProjectItems) { - CompileRazorViews $_.ProjectItems - } - } -} - -# Embed Resource Files -function EmbedResources($projectItems) { - $projectItems | %{ - $ext = [System.IO.Path]::GetExtension($_.Name.ToLower()) - $embedExts = ".js",".css",".md",".html",".htm",".png",".gif",".jpg",".jpeg",".bmp",".ico",".svg",".tiff",".webp",".webm",".xap",".xaml",".flv",".swf",".xml",".csv",".pdf",".mp3",".wav",".mpg",".ttf",".woff",".eot",".map" - - if ($embedExts -contains $ext) { - $_.Properties.Item("BuildAction").Value = [int]3 # Embed - } - - # Recursively - if ($_.ProjectItems) { - EmbedResources $_.ProjectItems - } - } -} - -CompileRazorViews $project.ProjectItems -EmbedResources $project.ProjectItems - diff --git a/NuGet/ServiceStack.Host.AspNet/content/App_Start/AppHost.cs.pp b/NuGet/ServiceStack.Host.AspNet/content/App_Start/AppHost.cs.pp deleted file mode 100644 index 078740d9cde..00000000000 --- a/NuGet/ServiceStack.Host.AspNet/content/App_Start/AppHost.cs.pp +++ /dev/null @@ -1,79 +0,0 @@ -using System.Configuration; -using ServiceStack; -using ServiceStack.Auth; -using ServiceStack.Configuration; -using ServiceStack.Data; -using ServiceStack.OrmLite; - -[assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.App_Start.AppHost), "Start")] - - -/** - * Entire ServiceStack Starter Template configured with a 'Hello' Web Service and a 'Todo' Rest Service. - * - * Auto-Generated Metadata API page at: /metadata - * See other complete web service examples at: https://github.com/ServiceStack/ServiceStack.Examples - */ - -namespace $rootnamespace$.App_Start -{ - public class AppHost : AppHostBase - { - public AppHost() //Tell ServiceStack the name and where to find your web services - : base("StarterTemplate ASP.NET Host", typeof(HelloService).Assembly) { } - - public override void Configure(Funq.Container container) - { - //Set JSON web services to return idiomatic JSON camelCase properties - ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; - - //Configure User Defined REST Paths - Routes - .Add("/hello") - .Add("/hello/{Name*}"); - - //Uncomment to change the default ServiceStack configuration - //SetConfig(new HostConfig { - //}); - - //Enable Authentication - //ConfigureAuth(container); - - //Register all your dependencies - container.Register(new TodoRepository()); - } - - /* Example ServiceStack Authentication and CustomUserSession */ - private void ConfigureAuth(Funq.Container container) - { - var appSettings = new AppSettings(); - - //Default route: /auth/{provider} - Plugins.Add(new AuthFeature(() => new CustomUserSession(), - new IAuthProvider[] { - new CredentialsAuthProvider(appSettings), - new FacebookAuthProvider(appSettings), - new TwitterAuthProvider(appSettings), - new BasicAuthProvider(appSettings), - })); - - //Default route: /register - Plugins.Add(new RegistrationFeature()); - - //Requires ConnectionString configured in Web.Config - var connectionString = ConfigurationManager.ConnectionStrings["AppDb"].ConnectionString; - container.Register(c => - new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider)); - - container.Register(c => - new OrmLiteAuthRepository(c.Resolve())); - - container.Resolve().InitSchema(); - } - - public static void Start() - { - new AppHost().Init(); - } - } -} diff --git a/NuGet/ServiceStack.Host.AspNet/content/App_Start/PageBase.cs.pp b/NuGet/ServiceStack.Host.AspNet/content/App_Start/PageBase.cs.pp deleted file mode 100644 index 446f4be9a2c..00000000000 --- a/NuGet/ServiceStack.Host.AspNet/content/App_Start/PageBase.cs.pp +++ /dev/null @@ -1,66 +0,0 @@ -using System.Web.UI; -using ServiceStack; -using ServiceStack.Caching; - - -/** - * Base ASP.NET WebForms page using ServiceStack's Compontents, see: http://www.servicestack.net/mvc-powerpack/ - */ - -namespace $rootnamespace$.App_Start -{ - //A customizeable typed UserSession that can be extended with your own properties - public class CustomUserSession : AuthUserSession - { - public string CustomProperty { get; set; } - } - - public class PageBase : Page - { - /// - /// Typed UserSession - /// - private object userSession; - protected virtual TUserSession SessionAs() - { - return (TUserSession)(userSession ?? (userSession = Cache.SessionAs())); - } - - protected CustomUserSession UserSession - { - get - { - return SessionAs(); - } - } - - public new ICacheClient Cache - { - get { return HostContext.Resolve(); } - } - - private ISessionFactory sessionFactory; - public virtual ISessionFactory SessionFactory - { - get { return sessionFactory ?? (sessionFactory = HostContext.Resolve()) ?? new SessionFactory(Cache); } - } - - /// - /// Dynamic SessionBag Bag - /// - private ISession sessionBag; - public new ISession SessionBag - { - get - { - return sessionBag ?? (sessionBag = SessionFactory.GetOrCreateSession()); - } - } - - public void ClearSession() - { - userSession = null; - this.Cache.Remove(SessionFeature.GetSessionKey()); - } - } -} diff --git a/NuGet/ServiceStack.Host.AspNet/content/App_Start/WebServiceExamples.cs.pp b/NuGet/ServiceStack.Host.AspNet/content/App_Start/WebServiceExamples.cs.pp deleted file mode 100644 index b997f3b88c1..00000000000 --- a/NuGet/ServiceStack.Host.AspNet/content/App_Start/WebServiceExamples.cs.pp +++ /dev/null @@ -1,133 +0,0 @@ -using System.Linq; -using System.Collections.Generic; -using ServiceStack; - -namespace $rootnamespace$ -{ - //Request DTO - public class Hello - { - public string Name { get; set; } - } - - //Response DTO - public class HelloResponse - { - public string Result { get; set; } - public ResponseStatus ResponseStatus { get; set; } //Where Exceptions get auto-serialized - } - - //Can be called via any endpoint or format, see: http://mono.servicestack.net/ServiceStack.Hello/ - public class HelloService : Service - { - public object Any(Hello request) - { - return new HelloResponse { Result = "Hello, " + request.Name }; - } - } - - //REST Resource DTO - [Route("/todos")] - [Route("/todos/{Ids}")] - public class Todos : IReturn> - { - public long[] Ids { get; set; } - public Todos(params long[] ids) - { - this.Ids = ids; - } - } - - [Route("/todos", "POST")] - [Route("/todos/{Id}", "PUT")] - public class Todo : IReturn - { - public long Id { get; set; } - public string Content { get; set; } - public int Order { get; set; } - public bool Done { get; set; } - } - - public class TodosService : Service - { - public TodoRepository Repository { get; set; } //Injected by IOC - - public object Get(Todos request) - { - return request.Ids.IsEmpty() - ? Repository.GetAll() - : Repository.GetByIds(request.Ids); - } - - public object Post(Todo todo) - { - return Repository.Store(todo); - } - - public object Put(Todo todo) - { - return Repository.Store(todo); - } - - public void Delete(Todos request) - { - Repository.DeleteByIds(request.Ids); - } - } - - public class TodoRepository - { - List todos = new List(); - - public List GetByIds(long[] ids) - { - return todos.Where(x => ids.Contains(x.Id)).ToList(); - } - - public List GetAll() - { - return todos; - } - - public Todo Store(Todo todo) - { - var existing = todos.FirstOrDefault(x => x.Id == todo.Id); - if (existing == null) - { - var newId = todos.Count > 0 ? todos.Max(x => x.Id) + 1 : 1; - todo.Id = newId; - todos.Add(todo); - } - else - { - existing.PopulateWith(todo); - } - return todo; - } - - public void DeleteByIds(params long[] ids) - { - todos.RemoveAll(x => ids.Contains(x.Id)); - } - } - - -/* Example calling above Service with ServiceStack's C# clients: - - var client = new JsonServiceClient(BaseUri); - List all = client.Get(new Todos()); // Count = 0 - - var todo = client.Post( - new Todo { Content = "New TODO", Order = 1 }); // todo.Id = 1 - all = client.Get(new Todos()); // Count = 1 - - todo.Content = "Updated TODO"; - todo = client.Put(todo); // todo.Content = Updated TODO - - client.Delete(new Todos(todo.Id)); - all = client.Get(new Todos()); // Count = 0 - -*/ - -} - diff --git a/NuGet/ServiceStack.Host.AspNet/content/README.txt b/NuGet/ServiceStack.Host.AspNet/content/README.txt deleted file mode 100644 index a75aa9feab6..00000000000 --- a/NuGet/ServiceStack.Host.AspNet/content/README.txt +++ /dev/null @@ -1,36 +0,0 @@ -To enable the Mini Profiler add the following lines in to Global class in Global.asax.cs: - - - protected void Application_BeginRequest(object src, EventArgs e) - { - if (Request.IsLocal) - ServiceStack.MiniProfiler.Profiler.Start(); - } - - protected void Application_EndRequest(object src, EventArgs e) - { - ServiceStack.MiniProfiler.Profiler.Stop(); - } - - -For more info on the MiniProfiler see v3.09 of the https://github.com/ServiceStack/ServiceStack/wiki/Release-Notes - - -The Urls for metadata page and included Services: - - * /metadata - Auto generated metadata pages - * /hello - Simple Hello World Service. see: http://www.servicestack.net/ServiceStack.Hello/ - * /todos - Simple REST Service. see: http://www.servicestack.net/Backbone.Todos/ - - * /default.htm - Backbone.js TODO application talking to the TODO REST service at /todos - - -For more info about ServiceStack please visit: http://www.servicestack.net - -Feel free to ask questions about ServiceStack on: -http://stackoverflow.com/ - -or on the mailing Group at: -http://groups.google.com/group/servicestack - -Enjoy! \ No newline at end of file diff --git a/NuGet/ServiceStack.Host.AspNet/content/default.htm b/NuGet/ServiceStack.Host.AspNet/content/default.htm deleted file mode 100644 index 78c2a89314c..00000000000 --- a/NuGet/ServiceStack.Host.AspNet/content/default.htm +++ /dev/null @@ -1,685 +0,0 @@ - - - - - Backbone Demo: Todos - - - - - - - - - - - - -
- -
-

Todos

-
- -
- -
- - -
- -
-
    -
    - -
    - -
    - -
    - - - -
    - Created by -
    - Jérôme Gravel-Niquet -
    -
    - Powered By Open Source -
    - servicestack.net - | redis - | mono -
    - - - - - - - - - - - - - - diff --git a/NuGet/ServiceStack.Host.AspNet/content/jqunback-1.51.min.js b/NuGet/ServiceStack.Host.AspNet/content/jqunback-1.51.min.js deleted file mode 100644 index 97da2a076f8..00000000000 --- a/NuGet/ServiceStack.Host.AspNet/content/jqunback-1.51.min.js +++ /dev/null @@ -1,68 +0,0 @@ -/*! - * jQuery JavaScript Library v1.5.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Wed Feb 23 13:55:29 2011 -0500 - */ -(function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU)bU[a](0,1)})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;ic)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return!0}function v(){return!1}function g(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--)a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g;g||c.resolveWith(e,f)}else c!==a&&c.resolve(a);return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="
    a";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
    ",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
    t
    ";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j])return;if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k))return}}if(e){delete i[j][f];if(!g(i[j]))return}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var k=i?f:0,l=i?f+1:h.length;k=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=v;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="
    ";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(var g=c;g0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div
    ","
    "]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1>");try{for(var c=0,e=this.length;c1&&l0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h)$(f[h],g[h])}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]===""&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bk)return bk(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG)return bG.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("
    ").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bO(g,a[g],c,f);return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials"in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(cc("show",3),a,b,c);for(var g=0,h=this.length;g=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b
    ";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=cg(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window);// Underscore.js 1.1.5 -// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc. -// Underscore is freely distributable under the MIT license. -// Portions of Underscore are inspired or borrowed from Prototype, -// Oliver Steele's Functional, and John Resig's Micro-Templating. -// For all details and documentation: -// http://documentcloud.github.com/underscore -(function(){var q=this,D=q._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,E=k.unshift,F=o.toString,m=o.hasOwnProperty,s=k.forEach,t=k.map,u=k.reduce,v=k.reduceRight,w=k.filter,x=k.every,y=k.some,p=k.indexOf,z=k.lastIndexOf;o=Array.isArray;var G=Object.keys,A=Function.prototype.bind,c=function(a){return new l(a)};if(typeof module!=="undefined"&&module.exports){module.exports=c;c._=c}else q._=c;c.VERSION="1.1.5";var j=c.each=c.forEach=function(a,b,d){if(a!=null)if(s&&a.forEach===s)a.forEach(b, -d);else if(c.isNumber(a.length))for(var e=0,f=a.length;e=e.computed&&(e={value:f,computed:g})});return e.value};c.min=function(a,b,d){if(!b&&c.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};j(a,function(f,g,h){g=b?b.call(d,f,g,h):f;gh?1:0}),"value")};c.sortedIndex= -function(a,b,d){d=d||c.identity;for(var e=0,f=a.length;e>1;d(a[g])=0})})};c.zip=function(){for(var a=i.call(arguments),b=c.max(c.pluck(a,"length")),d=Array(b),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};c.keys=G||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)if(m.call(a, -d))b[b.length]=d;return b};c.values=function(a){return c.map(a,c.identity)};c.functions=c.methods=function(a){return c.filter(c.keys(a),function(b){return c.isFunction(a[b])}).sort()};c.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};c.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)if(a[d]==null)a[d]=b[d]});return a};c.clone=function(a){return c.isArray(a)?a.slice():c.extend({},a)};c.tap=function(a,b){b(a);return a};c.isEqual=function(a, -b){if(a===b)return true;var d=typeof a;if(d!=typeof b)return false;if(a==b)return true;if(!a&&b||a&&!b)return false;if(a._chain)a=a._wrapped;if(b._chain)b=b._wrapped;if(a.isEqual)return a.isEqual(b);if(c.isDate(a)&&c.isDate(b))return a.getTime()===b.getTime();if(c.isNaN(a)&&c.isNaN(b))return false;if(c.isRegExp(a)&&c.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(d!=="object")return false;if(a.length&&a.length!==b.length)return false; -d=c.keys(a);var e=c.keys(b);if(d.length!=e.length)return false;for(var f in a)if(!(f in b)||!c.isEqual(a[f],b[f]))return false;return true};c.isEmpty=function(a){if(c.isArray(a)||c.isString(a))return a.length===0;for(var b in a)if(m.call(a,b))return false;return true};c.isElement=function(a){return!!(a&&a.nodeType==1)};c.isArray=o||function(a){return F.call(a)==="[object Array]"};c.isArguments=function(a){return!!(a&&m.call(a,"callee"))};c.isFunction=function(a){return!!(a&&a.constructor&&a.call&& -a.apply)};c.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};c.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};c.isNaN=function(a){return a!==a};c.isBoolean=function(a){return a===true||a===false};c.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)};c.isRegExp=function(a){return!!(a&&a.test&&a.exec&&(a.ignoreCase||a.ignoreCase===false))};c.isNull=function(a){return a===null};c.isUndefined=function(a){return a===void 0};c.noConflict=function(){q._= -D;return this};c.identity=function(a){return a};c.times=function(a,b,d){for(var e=0;e/g,interpolate:/<%=([\s\S]+?)%>/g};c.template=function(a,b){var d=c.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate, -function(e,f){return"',"+f.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||null,function(e,f){return"');"+f.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return b?d(b):d};var l=function(a){this._wrapped=a};c.prototype=l.prototype;var r=function(a,b){return b?c(a).chain():a},I=function(a,b){l.prototype[a]=function(){var d=i.call(arguments);E.call(d,this._wrapped);return r(b.apply(c, -d),this._chain)}};c.mixin(c);j(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=k[a];l.prototype[a]=function(){b.apply(this._wrapped,arguments);return r(this._wrapped,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];l.prototype[a]=function(){return r(b.apply(this._wrapped,arguments),this._chain)}});l.prototype.chain=function(){this._chain=true;return this};l.prototype.value=function(){return this._wrapped}})(); -// Backbone.js 0.3.3 -// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc. -// Backbone may be freely distributed under the MIT license. -// For all details and documentation: -// http://documentcloud.github.com/backbone -(function(){var e;e=typeof exports!=="undefined"?exports:this.Backbone={};e.VERSION="0.3.3";var f=this._;if(!f&&typeof require!=="undefined")f=require("underscore")._;var h=this.jQuery||this.Zepto;e.emulateHTTP=false;e.emulateJSON=false;e.Events={bind:function(a,b){this._callbacks||(this._callbacks={});(this._callbacks[a]||(this._callbacks[a]=[])).push(b);return this},unbind:function(a,b){var c;if(a){if(c=this._callbacks)if(b){c=c[a];if(!c)return this;for(var d=0,g=c.length;d/g,">").replace(/"/g, -""")},set:function(a,b){b||(b={});if(!a)return this;if(a.attributes)a=a.attributes;var c=this.attributes,d=this._escapedAttributes;if(!b.silent&&this.validate&&!this._performValidation(a,b))return false;if("id"in a)this.id=a.id;for(var g in a){var i=a[g];if(!f.isEqual(c[g],i)){c[g]=i;delete d[g];if(!b.silent){this._changed=true;this.trigger("change:"+g,this,i,b)}}}!b.silent&&this._changed&&this.change(b);return this},unset:function(a,b){b||(b={});var c={};c[a]=void 0;if(!b.silent&&this.validate&& -!this._performValidation(c,b))return false;delete this.attributes[a];delete this._escapedAttributes[a];if(!b.silent){this._changed=true;this.trigger("change:"+a,this,void 0,b);this.change(b)}return this},clear:function(a){a||(a={});var b=this.attributes,c={};for(attr in b)c[attr]=void 0;if(!a.silent&&this.validate&&!this._performValidation(c,a))return false;this.attributes={};this._escapedAttributes={};if(!a.silent){this._changed=true;for(attr in b)this.trigger("change:"+attr,this,void 0,a);this.change(a)}return this}, -fetch:function(a){a||(a={});var b=this,c=j(a.error,b,a);(this.sync||e.sync)("read",this,function(d){if(!b.set(b.parse(d),a))return false;a.success&&a.success(b,d)},c);return this},save:function(a,b){b||(b={});if(a&&!this.set(a,b))return false;var c=this,d=j(b.error,c,b),g=this.isNew()?"create":"update";(this.sync||e.sync)(g,this,function(i){if(!c.set(c.parse(i),b))return false;b.success&&b.success(c,i)},d);return this},destroy:function(a){a||(a={});var b=this,c=j(a.error,b,a);(this.sync||e.sync)("delete", -this,function(d){b.collection&&b.collection.remove(b);a.success&&a.success(b,d)},c);return this},url:function(){var a=k(this.collection);if(this.isNew())return a;return a+(a.charAt(a.length-1)=="/"?"":"/")+this.id},parse:function(a){return a},clone:function(){return new this.constructor(this)},isNew:function(){return!this.id},change:function(a){this.trigger("change",this,a);this._previousAttributes=f.clone(this.attributes);this._changed=false},hasChanged:function(a){if(a)return this._previousAttributes[a]!= -this.attributes[a];return this._changed},changedAttributes:function(a){a||(a=this.attributes);var b=this._previousAttributes,c=false,d;for(d in a)if(!f.isEqual(b[d],a[d])){c=c||{};c[d]=a[d]}return c},previous:function(a){if(!a||!this._previousAttributes)return null;return this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},_performValidation:function(a,b){var c=this.validate(a);if(c){b.error?b.error(this,c):this.trigger("error",this,c,b);return false}return true}}); -e.Collection=function(a,b){b||(b={});if(b.comparator){this.comparator=b.comparator;delete b.comparator}this._boundOnModelEvent=f.bind(this._onModelEvent,this);this._reset();a&&this.refresh(a,{silent:true});this.initialize(a,b)};f.extend(e.Collection.prototype,e.Events,{model:e.Model,initialize:function(){},toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){if(f.isArray(a))for(var c=0,d=a.length;c').hide().appendTo("body")[0].contentWindow; -"onhashchange"in window&&!a?h(window).bind("hashchange",this.checkUrl):setInterval(this.checkUrl,this.interval);return this.loadUrl()},route:function(a,b){this.handlers.push({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();if(a==this.fragment&&this.iframe)a=this.getFragment(this.iframe.location);if(a==this.fragment||a==decodeURIComponent(this.fragment))return false;if(this.iframe)window.location.hash=this.iframe.location.hash=a;this.loadUrl()},loadUrl:function(){var a=this.fragment= -this.getFragment();return f.any(this.handlers,function(b){if(b.route.test(a)){b.callback(a);return true}})},saveLocation:function(a){a=(a||"").replace(l,"");if(this.fragment!=a){window.location.hash=this.fragment=a;if(this.iframe&&a!=this.getFragment(this.iframe.location)){this.iframe.document.open().close();this.iframe.location.hash=a}}}});e.View=function(a){this._configure(a||{});this._ensureElement();this.delegateEvents();this.initialize(a)};var q=/^(\w+)\s*(.*)$/;f.extend(e.View.prototype,e.Events, -{tagName:"div",$:function(a){return h(a,this.el)},initialize:function(){},render:function(){return this},remove:function(){h(this.el).remove();return this},make:function(a,b,c){a=document.createElement(a);b&&h(a).attr(b);c&&h(a).html(c);return a},delegateEvents:function(a){if(a||(a=this.events)){h(this.el).unbind();for(var b in a){var c=a[b],d=b.match(q),g=d[1];d=d[2];c=f.bind(this[c],this);d===""?h(this.el).bind(g,c):h(this.el).delegate(d,g,c)}}},_configure:function(a){if(this.options)a=f.extend({}, -this.options,a);if(a.model)this.model=a.model;if(a.collection)this.collection=a.collection;if(a.el)this.el=a.el;if(a.id)this.id=a.id;if(a.className)this.className=a.className;if(a.tagName)this.tagName=a.tagName;this.options=a},_ensureElement:function(){if(!this.el){var a={};if(this.id)a.id=this.id;if(this.className)a["class"]=this.className;this.el=this.make(this.tagName,a)}}});var m=function(a,b){var c=r(this,a,b);c.extend=m;return c};e.Model.extend=e.Collection.extend=e.Controller.extend=e.View.extend= -m;var s={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};e.sync=function(a,b,c,d){var g=s[a];a=a==="create"||a==="update"?JSON.stringify(b.toJSON()):null;b={url:k(b),type:g,contentType:"application/json",data:a,dataType:"json",processData:false,success:c,error:d};if(e.emulateJSON){b.contentType="application/x-www-form-urlencoded";b.processData=true;b.data=a?{model:a}:{}}if(e.emulateHTTP)if(g==="PUT"||g==="DELETE"){if(e.emulateJSON)b.data._method=g;b.type="POST";b.beforeSend=function(i){i.setRequestHeader("X-HTTP-Method-Override", -g)}}h.ajax(b)};var n=function(){},r=function(a,b,c){var d;d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){return a.apply(this,arguments)};n.prototype=a.prototype;d.prototype=new n;b&&f.extend(d.prototype,b);c&&f.extend(d,c);d.prototype.constructor=d;d.__super__=a.prototype;return d},k=function(a){if(!(a&&a.url))throw Error("A 'url' property or function must be specified");return f.isFunction(a.url)?a.url():a.url},j=function(a,b,c){return function(d){a?a(b,d):b.trigger("error",b,d,c)}}})(); diff --git a/NuGet/ServiceStack.Host.AspNet/content/web.config.transform b/NuGet/ServiceStack.Host.AspNet/content/web.config.transform deleted file mode 100644 index 0b4a8586dc0..00000000000 --- a/NuGet/ServiceStack.Host.AspNet/content/web.config.transform +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/NuGet/ServiceStack.Host.AspNet/servicestack.host.aspnet.nuspec b/NuGet/ServiceStack.Host.AspNet/servicestack.host.aspnet.nuspec deleted file mode 100644 index 320a473e39c..00000000000 --- a/NuGet/ServiceStack.Host.AspNet/servicestack.host.aspnet.nuspec +++ /dev/null @@ -1,26 +0,0 @@ - - - - ServiceStack.Host.AspNet - Starter ASP.NET Website Template - ServiceStack at / - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - -Host ServiceStack in an existing ASP.NET web application at the root path '/'. -ServiceStack is a modern, high-performance, code-first web service framework promoting code and web services best practices. Simple, Fast, Elegant. Website: https://servicestack.net - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - Fast JSON XML CSV HTML SOAP JSV REST Web Service Framework MONO ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Host.Mvc/content/App_Start/AppHost.cs.pp b/NuGet/ServiceStack.Host.Mvc/content/App_Start/AppHost.cs.pp deleted file mode 100644 index 3db30ad0502..00000000000 --- a/NuGet/ServiceStack.Host.Mvc/content/App_Start/AppHost.cs.pp +++ /dev/null @@ -1,96 +0,0 @@ -using System.Configuration; -using System.Web.Mvc; -using ServiceStack; -using ServiceStack.Auth; -using ServiceStack.Configuration; -using ServiceStack.Data; -using ServiceStack.Mvc; -using ServiceStack.OrmLite; - -[assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.App_Start.AppHost), "Start")] - -//IMPORTANT: Add the line below to RouteConfig.RegisterRoutes(RouteCollection) in the Global.asax: -//routes.IgnoreRoute("api/{*pathInfo}"); -//More info on how to integrate with MVC: https://github.com/ServiceStack/ServiceStack/wiki/Mvc-integration - -/** - * Entire ServiceStack Starter Template configured with a 'Hello' Web Service and a 'Todo' Rest Service. - * - * Auto-Generated Metadata API page at: /metadata - * See other complete web service examples at: https://github.com/ServiceStack/ServiceStack.Examples - */ - -namespace $rootnamespace$.App_Start -{ - //A customizeable typed UserSession that can be extended with your own properties - //To access ServiceStack's Session, Cache, etc from MVC Controllers inherit from ControllerBase - public class CustomUserSession : AuthUserSession - { - public string CustomProperty { get; set; } - } - - public class AppHost - : AppHostBase - { - public AppHost() //Tell ServiceStack the name and where to find your web services - : base("StarterTemplate ASP.NET Host", typeof(HelloService).Assembly) { } - - public override void Configure(Funq.Container container) - { - //Set JSON web services to return idiomatic JSON camelCase properties - ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; - - //Configure User Defined REST Paths - Routes - .Add("/hello") - .Add("/hello/{Name*}"); - - //Uncomment to change the default ServiceStack configuration - //SetConfig(new HostConfig - //{ - //}); - - //Enable Authentication - //ConfigureAuth(container); - - //Register all your dependencies - container.Register(new TodoRepository()); - - //Set MVC to use the same Funq IOC as ServiceStack - ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); - } - - /* Uncomment to enable ServiceStack Authentication and CustomUserSession */ - private void ConfigureAuth(Funq.Container container) - { - var appSettings = new AppSettings(); - - //Default route: /auth/{provider} - Plugins.Add(new AuthFeature(() => new CustomUserSession(), - new IAuthProvider[] { - new CredentialsAuthProvider(appSettings), - new FacebookAuthProvider(appSettings), - new TwitterAuthProvider(appSettings), - new BasicAuthProvider(appSettings), - })); - - //Default route: /register - Plugins.Add(new RegistrationFeature()); - - //Requires ConnectionString configured in Web.Config - var connectionString = ConfigurationManager.ConnectionStrings["AppDb"].ConnectionString; - container.Register(c => - new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider)); - - container.Register(c => - new OrmLiteAuthRepository(c.Resolve())); - - container.Resolve().InitSchema(); - } - - public static void Start() - { - new AppHost().Init(); - } - } -} diff --git a/NuGet/ServiceStack.Host.Mvc/content/README.txt b/NuGet/ServiceStack.Host.Mvc/content/README.txt deleted file mode 100644 index a02de2a60bd..00000000000 --- a/NuGet/ServiceStack.Host.Mvc/content/README.txt +++ /dev/null @@ -1,48 +0,0 @@ -You *MUST* register ServiceStacks '/api' path by adding the lines below to MvcApplication.RegisterRoutes(RouteCollection) in the Global.asax: - - routes.IgnoreRoute("api/{*pathInfo}"); - routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" }); //Prevent exceptions for favicon - -Place them before the current entries the method. - -For MVC4 applications you also need to unregister WebApi, by commenting out this line: - - //WebApiConfig.Register(GlobalConfiguration.Configuration); - - -To enable the Mini Profiler add the following lines in to MvcApplication in Global.asax.cs: - - protected void Application_BeginRequest(object src, EventArgs e) - { - if (Request.IsLocal) - ServiceStack.MiniProfiler.Profiler.Start(); - } - - protected void Application_EndRequest(object src, EventArgs e) - { - ServiceStack.MiniProfiler.Profiler.Stop(); - } - - -For more info on the MiniProfiler see v3.09 of the https://github.com/ServiceStack/ServiceStack/wiki/Release-Notes - - -The Urls for metadata page and included Services: - - * /api/metadata - Auto generated metadata pages - * /api/hello - Simple Hello World Service see: http://www.servicestack.net/ServiceStack.Hello/ - * /api/todos - Simple REST Service see: http://www.servicestack.net/Backbone.Todos/ - - * /default.htm - Backbone.js TODO application talking to the TODO REST service at /api/todos - - - -For more info about ServiceStack please visit: http://www.servicestack.net - -Feel free to ask questions about ServiceStack on: -http://stackoverflow.com/ - -or on the mailing Group at: -http://groups.google.com/group/servicestack - -Enjoy! \ No newline at end of file diff --git a/NuGet/ServiceStack.Host.Mvc/content/WebServiceExamples.cs.pp b/NuGet/ServiceStack.Host.Mvc/content/WebServiceExamples.cs.pp deleted file mode 100644 index 9f16bcd8c63..00000000000 --- a/NuGet/ServiceStack.Host.Mvc/content/WebServiceExamples.cs.pp +++ /dev/null @@ -1,132 +0,0 @@ -using System.Linq; -using System.Collections.Generic; -using ServiceStack; - -namespace $rootnamespace$ -{ - //Request DTO - public class Hello - { - public string Name { get; set; } - } - - //Response DTO - public class HelloResponse - { - public string Result { get; set; } - public ResponseStatus ResponseStatus { get; set; } //Where Exceptions get auto-serialized - } - - //Can be called via any endpoint or format, see: http://mono.servicestack.net/ServiceStack.Hello/ - public class HelloService : Service - { - public object Any(Hello request) - { - return new HelloResponse { Result = "Hello, " + request.Name }; - } - } - - //REST Resource DTO - [Route("/todos")] - [Route("/todos/{Ids}")] - public class Todos : IReturn> - { - public long[] Ids { get; set; } - public Todos(params long[] ids) - { - this.Ids = ids; - } - } - - [Route("/todos", "POST")] - [Route("/todos/{Id}", "PUT")] - public class Todo : IReturn - { - public long Id { get; set; } - public string Content { get; set; } - public int Order { get; set; } - public bool Done { get; set; } - } - - public class TodosService : Service - { - public TodoRepository Repository { get; set; } //Injected by IOC - - public object Get(Todos request) - { - return request.Ids.IsEmpty() - ? Repository.GetAll() - : Repository.GetByIds(request.Ids); - } - - public object Post(Todo todo) - { - return Repository.Store(todo); - } - - public object Put(Todo todo) - { - return Repository.Store(todo); - } - - public void Delete(Todos request) - { - Repository.DeleteByIds(request.Ids); - } - } - - public class TodoRepository - { - List todos = new List(); - - public List GetByIds(long[] ids) - { - return todos.Where(x => ids.Contains(x.Id)).ToList(); - } - - public List GetAll() - { - return todos; - } - - public Todo Store(Todo todo) - { - var existing = todos.FirstOrDefault(x => x.Id == todo.Id); - if (existing == null) - { - var newId = todos.Count > 0 ? todos.Max(x => x.Id) + 1 : 1; - todo.Id = newId; - todos.Add(todo); - } - else - { - existing.PopulateWith(todo); - } - return todo; - } - - public void DeleteByIds(params long[] ids) - { - todos.RemoveAll(x => ids.Contains(x.Id)); - } - } - - -/* Example calling above Service with ServiceStack's C# clients: - - var client = new JsonServiceClient(BaseUri); - List all = client.Get(new Todos()); // Count = 0 - - var todo = client.Post( - new Todo { Content = "New TODO", Order = 1 }); // todo.Id = 1 - all = client.Get(new Todos()); // Count = 1 - - todo.Content = "Updated TODO"; - todo = client.Put(todo); // todo.Content = Updated TODO - - client.Delete(new Todos(todo.Id)); - all = client.Get(new Todos()); // Count = 0 - -*/ - -} diff --git a/NuGet/ServiceStack.Host.Mvc/content/default.htm b/NuGet/ServiceStack.Host.Mvc/content/default.htm deleted file mode 100644 index a451c4f026a..00000000000 --- a/NuGet/ServiceStack.Host.Mvc/content/default.htm +++ /dev/null @@ -1,685 +0,0 @@ - - - - - Backbone Demo: Todos - - - - - - - - - - - - -
    - -
    -

    Todos

    -
    - -
    - -
    - - -
    - -
    -
      -
      - -
      - -
      - -
      - - - -
      - Created by -
      - Jérôme Gravel-Niquet -
      -
      - Powered By Open Source -
      - servicestack.net - | redis - | mono -
      - - - - - - - - - - - - - - diff --git a/NuGet/ServiceStack.Host.Mvc/content/jqunback-1.51.min.js b/NuGet/ServiceStack.Host.Mvc/content/jqunback-1.51.min.js deleted file mode 100644 index 97da2a076f8..00000000000 --- a/NuGet/ServiceStack.Host.Mvc/content/jqunback-1.51.min.js +++ /dev/null @@ -1,68 +0,0 @@ -/*! - * jQuery JavaScript Library v1.5.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Wed Feb 23 13:55:29 2011 -0500 - */ -(function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU)bU[a](0,1)})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;ic)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return!0}function v(){return!1}function g(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--)a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g;g||c.resolveWith(e,f)}else c!==a&&c.resolve(a);return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="
      a";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
      ",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
      t
      ";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j])return;if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k))return}}if(e){delete i[j][f];if(!g(i[j]))return}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var k=i?f:0,l=i?f+1:h.length;k=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=v;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

      ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="
      ";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(var g=c;g0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/",""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div
      ","
      "]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1>");try{for(var c=0,e=this.length;c1&&l0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h)$(f[h],g[h])}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]===""&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bk)return bk(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG)return bG.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("
      ").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bO(g,a[g],c,f);return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials"in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(cc("show",3),a,b,c);for(var g=0,h=this.length;g=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b
      ";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=cg(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window);// Underscore.js 1.1.5 -// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc. -// Underscore is freely distributable under the MIT license. -// Portions of Underscore are inspired or borrowed from Prototype, -// Oliver Steele's Functional, and John Resig's Micro-Templating. -// For all details and documentation: -// http://documentcloud.github.com/underscore -(function(){var q=this,D=q._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,E=k.unshift,F=o.toString,m=o.hasOwnProperty,s=k.forEach,t=k.map,u=k.reduce,v=k.reduceRight,w=k.filter,x=k.every,y=k.some,p=k.indexOf,z=k.lastIndexOf;o=Array.isArray;var G=Object.keys,A=Function.prototype.bind,c=function(a){return new l(a)};if(typeof module!=="undefined"&&module.exports){module.exports=c;c._=c}else q._=c;c.VERSION="1.1.5";var j=c.each=c.forEach=function(a,b,d){if(a!=null)if(s&&a.forEach===s)a.forEach(b, -d);else if(c.isNumber(a.length))for(var e=0,f=a.length;e=e.computed&&(e={value:f,computed:g})});return e.value};c.min=function(a,b,d){if(!b&&c.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};j(a,function(f,g,h){g=b?b.call(d,f,g,h):f;gh?1:0}),"value")};c.sortedIndex= -function(a,b,d){d=d||c.identity;for(var e=0,f=a.length;e>1;d(a[g])=0})})};c.zip=function(){for(var a=i.call(arguments),b=c.max(c.pluck(a,"length")),d=Array(b),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};c.keys=G||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)if(m.call(a, -d))b[b.length]=d;return b};c.values=function(a){return c.map(a,c.identity)};c.functions=c.methods=function(a){return c.filter(c.keys(a),function(b){return c.isFunction(a[b])}).sort()};c.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};c.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)if(a[d]==null)a[d]=b[d]});return a};c.clone=function(a){return c.isArray(a)?a.slice():c.extend({},a)};c.tap=function(a,b){b(a);return a};c.isEqual=function(a, -b){if(a===b)return true;var d=typeof a;if(d!=typeof b)return false;if(a==b)return true;if(!a&&b||a&&!b)return false;if(a._chain)a=a._wrapped;if(b._chain)b=b._wrapped;if(a.isEqual)return a.isEqual(b);if(c.isDate(a)&&c.isDate(b))return a.getTime()===b.getTime();if(c.isNaN(a)&&c.isNaN(b))return false;if(c.isRegExp(a)&&c.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(d!=="object")return false;if(a.length&&a.length!==b.length)return false; -d=c.keys(a);var e=c.keys(b);if(d.length!=e.length)return false;for(var f in a)if(!(f in b)||!c.isEqual(a[f],b[f]))return false;return true};c.isEmpty=function(a){if(c.isArray(a)||c.isString(a))return a.length===0;for(var b in a)if(m.call(a,b))return false;return true};c.isElement=function(a){return!!(a&&a.nodeType==1)};c.isArray=o||function(a){return F.call(a)==="[object Array]"};c.isArguments=function(a){return!!(a&&m.call(a,"callee"))};c.isFunction=function(a){return!!(a&&a.constructor&&a.call&& -a.apply)};c.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};c.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};c.isNaN=function(a){return a!==a};c.isBoolean=function(a){return a===true||a===false};c.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)};c.isRegExp=function(a){return!!(a&&a.test&&a.exec&&(a.ignoreCase||a.ignoreCase===false))};c.isNull=function(a){return a===null};c.isUndefined=function(a){return a===void 0};c.noConflict=function(){q._= -D;return this};c.identity=function(a){return a};c.times=function(a,b,d){for(var e=0;e/g,interpolate:/<%=([\s\S]+?)%>/g};c.template=function(a,b){var d=c.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate, -function(e,f){return"',"+f.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||null,function(e,f){return"');"+f.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return b?d(b):d};var l=function(a){this._wrapped=a};c.prototype=l.prototype;var r=function(a,b){return b?c(a).chain():a},I=function(a,b){l.prototype[a]=function(){var d=i.call(arguments);E.call(d,this._wrapped);return r(b.apply(c, -d),this._chain)}};c.mixin(c);j(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=k[a];l.prototype[a]=function(){b.apply(this._wrapped,arguments);return r(this._wrapped,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];l.prototype[a]=function(){return r(b.apply(this._wrapped,arguments),this._chain)}});l.prototype.chain=function(){this._chain=true;return this};l.prototype.value=function(){return this._wrapped}})(); -// Backbone.js 0.3.3 -// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc. -// Backbone may be freely distributed under the MIT license. -// For all details and documentation: -// http://documentcloud.github.com/backbone -(function(){var e;e=typeof exports!=="undefined"?exports:this.Backbone={};e.VERSION="0.3.3";var f=this._;if(!f&&typeof require!=="undefined")f=require("underscore")._;var h=this.jQuery||this.Zepto;e.emulateHTTP=false;e.emulateJSON=false;e.Events={bind:function(a,b){this._callbacks||(this._callbacks={});(this._callbacks[a]||(this._callbacks[a]=[])).push(b);return this},unbind:function(a,b){var c;if(a){if(c=this._callbacks)if(b){c=c[a];if(!c)return this;for(var d=0,g=c.length;d/g,">").replace(/"/g, -""")},set:function(a,b){b||(b={});if(!a)return this;if(a.attributes)a=a.attributes;var c=this.attributes,d=this._escapedAttributes;if(!b.silent&&this.validate&&!this._performValidation(a,b))return false;if("id"in a)this.id=a.id;for(var g in a){var i=a[g];if(!f.isEqual(c[g],i)){c[g]=i;delete d[g];if(!b.silent){this._changed=true;this.trigger("change:"+g,this,i,b)}}}!b.silent&&this._changed&&this.change(b);return this},unset:function(a,b){b||(b={});var c={};c[a]=void 0;if(!b.silent&&this.validate&& -!this._performValidation(c,b))return false;delete this.attributes[a];delete this._escapedAttributes[a];if(!b.silent){this._changed=true;this.trigger("change:"+a,this,void 0,b);this.change(b)}return this},clear:function(a){a||(a={});var b=this.attributes,c={};for(attr in b)c[attr]=void 0;if(!a.silent&&this.validate&&!this._performValidation(c,a))return false;this.attributes={};this._escapedAttributes={};if(!a.silent){this._changed=true;for(attr in b)this.trigger("change:"+attr,this,void 0,a);this.change(a)}return this}, -fetch:function(a){a||(a={});var b=this,c=j(a.error,b,a);(this.sync||e.sync)("read",this,function(d){if(!b.set(b.parse(d),a))return false;a.success&&a.success(b,d)},c);return this},save:function(a,b){b||(b={});if(a&&!this.set(a,b))return false;var c=this,d=j(b.error,c,b),g=this.isNew()?"create":"update";(this.sync||e.sync)(g,this,function(i){if(!c.set(c.parse(i),b))return false;b.success&&b.success(c,i)},d);return this},destroy:function(a){a||(a={});var b=this,c=j(a.error,b,a);(this.sync||e.sync)("delete", -this,function(d){b.collection&&b.collection.remove(b);a.success&&a.success(b,d)},c);return this},url:function(){var a=k(this.collection);if(this.isNew())return a;return a+(a.charAt(a.length-1)=="/"?"":"/")+this.id},parse:function(a){return a},clone:function(){return new this.constructor(this)},isNew:function(){return!this.id},change:function(a){this.trigger("change",this,a);this._previousAttributes=f.clone(this.attributes);this._changed=false},hasChanged:function(a){if(a)return this._previousAttributes[a]!= -this.attributes[a];return this._changed},changedAttributes:function(a){a||(a=this.attributes);var b=this._previousAttributes,c=false,d;for(d in a)if(!f.isEqual(b[d],a[d])){c=c||{};c[d]=a[d]}return c},previous:function(a){if(!a||!this._previousAttributes)return null;return this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},_performValidation:function(a,b){var c=this.validate(a);if(c){b.error?b.error(this,c):this.trigger("error",this,c,b);return false}return true}}); -e.Collection=function(a,b){b||(b={});if(b.comparator){this.comparator=b.comparator;delete b.comparator}this._boundOnModelEvent=f.bind(this._onModelEvent,this);this._reset();a&&this.refresh(a,{silent:true});this.initialize(a,b)};f.extend(e.Collection.prototype,e.Events,{model:e.Model,initialize:function(){},toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){if(f.isArray(a))for(var c=0,d=a.length;c').hide().appendTo("body")[0].contentWindow; -"onhashchange"in window&&!a?h(window).bind("hashchange",this.checkUrl):setInterval(this.checkUrl,this.interval);return this.loadUrl()},route:function(a,b){this.handlers.push({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();if(a==this.fragment&&this.iframe)a=this.getFragment(this.iframe.location);if(a==this.fragment||a==decodeURIComponent(this.fragment))return false;if(this.iframe)window.location.hash=this.iframe.location.hash=a;this.loadUrl()},loadUrl:function(){var a=this.fragment= -this.getFragment();return f.any(this.handlers,function(b){if(b.route.test(a)){b.callback(a);return true}})},saveLocation:function(a){a=(a||"").replace(l,"");if(this.fragment!=a){window.location.hash=this.fragment=a;if(this.iframe&&a!=this.getFragment(this.iframe.location)){this.iframe.document.open().close();this.iframe.location.hash=a}}}});e.View=function(a){this._configure(a||{});this._ensureElement();this.delegateEvents();this.initialize(a)};var q=/^(\w+)\s*(.*)$/;f.extend(e.View.prototype,e.Events, -{tagName:"div",$:function(a){return h(a,this.el)},initialize:function(){},render:function(){return this},remove:function(){h(this.el).remove();return this},make:function(a,b,c){a=document.createElement(a);b&&h(a).attr(b);c&&h(a).html(c);return a},delegateEvents:function(a){if(a||(a=this.events)){h(this.el).unbind();for(var b in a){var c=a[b],d=b.match(q),g=d[1];d=d[2];c=f.bind(this[c],this);d===""?h(this.el).bind(g,c):h(this.el).delegate(d,g,c)}}},_configure:function(a){if(this.options)a=f.extend({}, -this.options,a);if(a.model)this.model=a.model;if(a.collection)this.collection=a.collection;if(a.el)this.el=a.el;if(a.id)this.id=a.id;if(a.className)this.className=a.className;if(a.tagName)this.tagName=a.tagName;this.options=a},_ensureElement:function(){if(!this.el){var a={};if(this.id)a.id=this.id;if(this.className)a["class"]=this.className;this.el=this.make(this.tagName,a)}}});var m=function(a,b){var c=r(this,a,b);c.extend=m;return c};e.Model.extend=e.Collection.extend=e.Controller.extend=e.View.extend= -m;var s={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};e.sync=function(a,b,c,d){var g=s[a];a=a==="create"||a==="update"?JSON.stringify(b.toJSON()):null;b={url:k(b),type:g,contentType:"application/json",data:a,dataType:"json",processData:false,success:c,error:d};if(e.emulateJSON){b.contentType="application/x-www-form-urlencoded";b.processData=true;b.data=a?{model:a}:{}}if(e.emulateHTTP)if(g==="PUT"||g==="DELETE"){if(e.emulateJSON)b.data._method=g;b.type="POST";b.beforeSend=function(i){i.setRequestHeader("X-HTTP-Method-Override", -g)}}h.ajax(b)};var n=function(){},r=function(a,b,c){var d;d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){return a.apply(this,arguments)};n.prototype=a.prototype;d.prototype=new n;b&&f.extend(d.prototype,b);c&&f.extend(d,c);d.prototype.constructor=d;d.__super__=a.prototype;return d},k=function(a){if(!(a&&a.url))throw Error("A 'url' property or function must be specified");return f.isFunction(a.url)?a.url():a.url},j=function(a,b,c){return function(d){a?a(b,d):b.trigger("error",b,d,c)}}})(); diff --git a/NuGet/ServiceStack.Host.Mvc/content/web.config.transform b/NuGet/ServiceStack.Host.Mvc/content/web.config.transform deleted file mode 100644 index bf9e6a08ec6..00000000000 --- a/NuGet/ServiceStack.Host.Mvc/content/web.config.transform +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/NuGet/ServiceStack.Host.Mvc/servicestack.host.mvc.nuspec b/NuGet/ServiceStack.Host.Mvc/servicestack.host.mvc.nuspec deleted file mode 100644 index 7d7a2ed5376..00000000000 --- a/NuGet/ServiceStack.Host.Mvc/servicestack.host.mvc.nuspec +++ /dev/null @@ -1,27 +0,0 @@ - - - - ServiceStack.Host.Mvc - Starter ASP.NET MVC Website Template - ServiceStack at /api - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - -Host ServiceStack side-by-side with an existing ASP.NET MVC application at the path '/api'. -ServiceStack is a modern, high-performance, code-first web service framework promoting code and web services best practices. Simple, Fast, Elegant. Website: https://servicestack.net - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - Fast JSON XML CSV HTML SOAP JSV REST Web Service Framework MONO ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Interfaces/servicestack.interfaces.nuspec b/NuGet/ServiceStack.Interfaces/servicestack.interfaces.nuspec deleted file mode 100644 index 169475d2256..00000000000 --- a/NuGet/ServiceStack.Interfaces/servicestack.interfaces.nuspec +++ /dev/null @@ -1,26 +0,0 @@ - - - - ServiceStack.Interfaces - Lightweight and implementation-free interfaces for ServiceStack - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - Lightweight and implementation-free interfaces for DTO's, providers and adapters. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - Fast JSON XML CSV HTML SOAP JSV REST Web Service Framework MONO ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Logging.Elmah/servicestack.logging.elmah.nuspec b/NuGet/ServiceStack.Logging.Elmah/servicestack.logging.elmah.nuspec deleted file mode 100644 index 2d878f9867b..00000000000 --- a/NuGet/ServiceStack.Logging.Elmah/servicestack.logging.elmah.nuspec +++ /dev/null @@ -1,29 +0,0 @@ - - - - ServiceStack.Logging.Elmah - 4.0.0 - ServiceStack.Logging.Elmah - Service Stack - Service Stack - Elmah logging integration for ServiceStack, the Opensource .NET and Mono REST Web Services Framework - false - - Provides Elmah logging integration for other ServiceStack projects - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - servicestack log logging elmah - en-US - Copyright 2014 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Logging.EntLib5/servicestack.logging.entlib5.nuspec b/NuGet/ServiceStack.Logging.EntLib5/servicestack.logging.entlib5.nuspec deleted file mode 100644 index eb4e49de869..00000000000 --- a/NuGet/ServiceStack.Logging.EntLib5/servicestack.logging.entlib5.nuspec +++ /dev/null @@ -1,29 +0,0 @@ - - - - ServiceStack.Logging.EntLib5 - 4.0.0 - ServiceStack.Logging.EntLib5 - Service Stack - Service Stack - Enterprise Library 5.0 Logging Application Block integration for ServiceStack, the Opensource .NET and Mono REST Web Services Framework - false - - Provides Enterprise Library 5.0 Logging Application Block logging integration for other ServiceStack projects - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - servicestack log logging nlog - en-US - Copyright 2014 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Logging.EventLog/servicestack.logging.eventlog.nuspec b/NuGet/ServiceStack.Logging.EventLog/servicestack.logging.eventlog.nuspec deleted file mode 100644 index 6a1d3ec55ff..00000000000 --- a/NuGet/ServiceStack.Logging.EventLog/servicestack.logging.eventlog.nuspec +++ /dev/null @@ -1,28 +0,0 @@ - - - - ServiceStack.Logging.EventLog - 4.0.0 - ServiceStack.Logging.EventLog - Service Stack - Service Stack - Windows Event Log integration for ServiceStack, the Opensource .NET and Mono REST Web Services Framework - false - - Provides EventLog logging integration for other ServiceStack projects - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - servicestack log logging eventlog - en-US - Copyright 2014 Service Stack - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Logging.Log4Net/servicestack.logging.log4net.nuspec b/NuGet/ServiceStack.Logging.Log4Net/servicestack.logging.log4net.nuspec deleted file mode 100644 index 853979d5ee5..00000000000 --- a/NuGet/ServiceStack.Logging.Log4Net/servicestack.logging.log4net.nuspec +++ /dev/null @@ -1,29 +0,0 @@ - - - - ServiceStack.Logging.Log4Net - 4.0.0 - ServiceStack.Logging.Log4Net - Service Stack - Service Stack - log4Net logging integration for ServiceStack, the Opensource .NET and Mono REST Web Services Framework - false - - Provides log4net logging integration for other ServiceStack projects - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - servicestack log logging log4net - en-US - Copyright 2014 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Logging.NLog/servicestack.logging.nlog.nuspec b/NuGet/ServiceStack.Logging.NLog/servicestack.logging.nlog.nuspec deleted file mode 100644 index af657729465..00000000000 --- a/NuGet/ServiceStack.Logging.NLog/servicestack.logging.nlog.nuspec +++ /dev/null @@ -1,29 +0,0 @@ - - - - ServiceStack.Logging.NLog - 4.0.0 - ServiceStack.Logging.NLog - Service Stack - Service Stack - NLog logging integration for ServiceStack, the Opensource .NET and Mono REST Web Services Framework - false - - Provides NLog logging integration for other ServiceStack projects - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - servicestack log logging nlog - en-US - Copyright 2014 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.MsgPack/servicestack.msgpack.nuspec b/NuGet/ServiceStack.MsgPack/servicestack.msgpack.nuspec deleted file mode 100644 index 105111058ac..00000000000 --- a/NuGet/ServiceStack.MsgPack/servicestack.msgpack.nuspec +++ /dev/null @@ -1,28 +0,0 @@ - - - - ServiceStack.MsgPack - Message Pack support for ServiceStack. Includes typed MsgPack Client - 4.0.0 - Service Stack - Service Stack - MsgPack Format Serializer ContentType ServiceClients for ServiceStack - - Add the MsgPack binary format and endpoint to a ServiceStack web service host. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - MsgPack MessagePack Message Pack Fast Binary Serializer Format ContentType REST Web Services ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Mvc/servicestack.mvc.nuspec b/NuGet/ServiceStack.Mvc/servicestack.mvc.nuspec deleted file mode 100644 index 48a29051cbc..00000000000 --- a/NuGet/ServiceStack.Mvc/servicestack.mvc.nuspec +++ /dev/null @@ -1,30 +0,0 @@ - - - - ServiceStack.Mvc - MVC Adapters for integrating with ServiceStack webservices - 4.0.0 - Service Stack - Service Stack - .NET 4.0 project Integration of ServiceStack with MVC3 - - Full details in Mvc PowerPack: http://servicestack.net/mvc-powerpack/ - Adapter classes to provide tight integration and re-usable functionality between ServiceStack and MVC3. - Including adapters for: MiniProfiler, FluentValidation, Funq IOC Controller Factory, Funq Validator Factory - ControllerBase (configured with access to ServiceStack's ICacheClient, ISession, typed UserSession dependencies). - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - MiniProfiler FluentValidation MVC Controller ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.ProtoBuf/servicestack.protobuf.nuspec b/NuGet/ServiceStack.ProtoBuf/servicestack.protobuf.nuspec deleted file mode 100644 index 9eec3599b92..00000000000 --- a/NuGet/ServiceStack.ProtoBuf/servicestack.protobuf.nuspec +++ /dev/null @@ -1,28 +0,0 @@ - - - - ServiceStack.ProtoBuf - Protocol Buffers support for ServiceStack. Includes typed ProtoBuf Client - 4.0.0 - Service Stack - Service Stack - ProtoBuf Format Serializer ContentType ServiceClients for ServiceStack - - Add the ProtoBuf binary format and endpoint to a ServiceStack web service host. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - https://servicestack.net/img/logo-32.png - ProtoBuf Fast Binary Serializer Format ContentType REST Web Services ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.RabbitMq/servicestack.rabbitmq.nuspec b/NuGet/ServiceStack.RabbitMq/servicestack.rabbitmq.nuspec deleted file mode 100644 index b2a380d79bb..00000000000 --- a/NuGet/ServiceStack.RabbitMq/servicestack.rabbitmq.nuspec +++ /dev/null @@ -1,30 +0,0 @@ - - - - ServiceStack.RabbitMq - ServiceStack.RabbitMq - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - Rabbit MQ client and server adapters for the ServiceStack web services framework. - This library enables consuming and publishing to ServiceStack services when hosted within a Rabbit MQ Server Host. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - MQ Message Queue Web Service Framework Fast JSON MONO ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Razor.BuildTask/build/ServiceStack.Razor.BuildTask.targets b/NuGet/ServiceStack.Razor.BuildTask/build/ServiceStack.Razor.BuildTask.targets deleted file mode 100644 index 799dc3c07d9..00000000000 --- a/NuGet/ServiceStack.Razor.BuildTask/build/ServiceStack.Razor.BuildTask.targets +++ /dev/null @@ -1,25 +0,0 @@ - - - $(CoreCompileDependsOn);RazorGeneratorOutput - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Razor.BuildTask/servicestack.razor.buildtask.nuspec b/NuGet/ServiceStack.Razor.BuildTask/servicestack.razor.buildtask.nuspec deleted file mode 100644 index 0923c282ad7..00000000000 --- a/NuGet/ServiceStack.Razor.BuildTask/servicestack.razor.buildtask.nuspec +++ /dev/null @@ -1,30 +0,0 @@ - - - - ServiceStack.Razor.BuildTask - ServiceStack.Razor.BuildTask - MSBuild Task to compile Razor Views as a build-step - 4.0.0 - Service Stack - Service Stack - MSBuild Task to generate and compile Service Stack Razor Views as a build-step, ready for instant use at run-time - - ServiceStack Razor Documentation: http://razor.servicestack.net - - Compile Razor Views into a compiled .dll you can use in ServiceStack hosts to eliminate Razor View compilation at runtime for instant start-up times. - - http://razor.servicestack.net - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - Razor ViewEngine View Templates Controllers Mono ASP.NET Self-Host ServiceStack - en-US - Copyright 2013 Service Stack - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Razor.BuildTask/tools/uninstall.ps1 b/NuGet/ServiceStack.Razor.BuildTask/tools/uninstall.ps1 deleted file mode 100644 index 750d3ccbfc0..00000000000 --- a/NuGet/ServiceStack.Razor.BuildTask/tools/uninstall.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -param($installPath, $toolsPath, $package, $project) - -<# -$targetsFileName = 'ServiceStack.Razor.BuildTask.targets'; - -# Need to load MSBuild assembly if it's not loaded yet. -Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' - -# Grab the loaded MSBuild project for the project -$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1 - -# Remove imports to .targets -$msbuild.Xml.Imports | Where-Object {$_.Project.ToLowerInvariant().EndsWith($targetsFileName.ToLowerInvariant()) } | Foreach { - $_.Parent.RemoveChild( $_ ) - [string]::Format( "Removed import of '{0}'" , $_.Project ) -} -#> \ No newline at end of file diff --git a/NuGet/ServiceStack.Razor/content/web.config.transform b/NuGet/ServiceStack.Razor/content/web.config.transform deleted file mode 100644 index 5546d322a18..00000000000 --- a/NuGet/ServiceStack.Razor/content/web.config.transform +++ /dev/null @@ -1,33 +0,0 @@ - - - - -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Razor/servicestack.razor.nuspec b/NuGet/ServiceStack.Razor/servicestack.razor.nuspec deleted file mode 100644 index 18495cd54a2..00000000000 --- a/NuGet/ServiceStack.Razor/servicestack.razor.nuspec +++ /dev/null @@ -1,41 +0,0 @@ - - - - ServiceStack.Razor - ServiceStack.Razor - ServiceStack's HTML story including MVC Razor - 4.0.0 - Service Stack - Service Stack - Provides ServiceStack's HTML Story including integrated support for MVC Razor's ViewEngine - - ServiceStack Razor Documentation: http://razor.servicestack.net - - - Turns ServiceStack into a Complete Web + REST Services Stack. Replaces need for ASP.NET MVC. - - Runs In ASP.NET or Self-host, first-class cross-platform support on .NET / Mono runtimes. - - Add HTML views to existing services. - - Change Views and Layout templates at runtime. - - No Ceremony development options - Pages without controllers, with typed and dynamic View Models. - - Include Partial Markdown views in Razor pages. - - Cascading Layout templates. - - Pretty urls by default (no custom Routes needed). - - Keep all views and assets together. - - Smart View Pages. - - http://razor.servicestack.net - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - Razor ViewEngine View Templates Controllers Mono ASP.NET Self-Host ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack.Server/servicestack.server.nuspec b/NuGet/ServiceStack.Server/servicestack.server.nuspec deleted file mode 100644 index a459fcd81e7..00000000000 --- a/NuGet/ServiceStack.Server/servicestack.server.nuspec +++ /dev/null @@ -1,30 +0,0 @@ - - - - ServiceStack.Server - ServiceStack Server integration with Redis and OrmLite - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - Integration libraries and adapters with other major ServiceStack server components. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - Fast JSON XML CSV HTML SOAP JSV REST Web Service Framework MONO ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/ServiceStack/servicestack.nuspec b/NuGet/ServiceStack/servicestack.nuspec deleted file mode 100644 index 4aec8778dd3..00000000000 --- a/NuGet/ServiceStack/servicestack.nuspec +++ /dev/null @@ -1,36 +0,0 @@ - - - - ServiceStack - ServiceStack webservice framework: Faster, Cleaner, Modern WCF alternative - 4.0.0 - Service Stack - Service Stack - Opensource .NET and Mono REST Web Services framework - - Binaries for the ServiceStack web framework. - Visit https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project - and https://github.com/ServiceStack/ServiceStack/wiki/Create-your-first-webservice - for walk throughs and docs on creating your first web service. - - https://github.com/ServiceStack/ServiceStack - https://servicestack.net/terms - true - https://servicestack.net/img/logo-32.png - Fast JSON XML CSV HTML SOAP JSV REST Web Service Framework MONO ServiceStack - en-US - Copyright 2014 Service Stack - - - - - - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 46a7b468f8d..7e2b1b27335 100644 --- a/README.md +++ b/README.md @@ -1,153 +1,349 @@ -See [servicestack.net/features](http://servicestack.net/features) for an overview. - -Join the [ServiceStack Google+ Community](https://plus.google.com/u/0/communities/112445368900682590445) or -follow [@ServiceStack](http://twitter.com/servicestack) for project updates. -You can catch some community members hanging out on [JabbR](http://jabbr.net/#/rooms/servicestack). - -Service Stack is a high-performance .NET web services platform that simplifies the development of high-performance -REST (JSON, XML, JSV, HTML, MsgPack, ProtoBuf, CSV) and WCF SOAP [Web Services](https://github.com/ServiceStack/ServiceStack/wiki/Service-Stack-Web-Services). - - -Simple REST service example -=========================== - -This example is also available as a [stand-alone integration test](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/NewApiTodos.cs): +Follow [@ServiceStack](https://twitter.com/servicestack) or [view the docs](https://docs.servicestack.net), use [StackOverflow](http://stackoverflow.com/questions/ask) or the [Customer Forums](https://forums.servicestack.net/) for support. + +> View the [Release Notes](https://docs.servicestack.net/release-notes-history) for latest features or see [servicestack.net/features](https://servicestack.net/features) for an overview. + +### Simple, Fast, Versatile and full-featured Services Framework + +ServiceStack is a simple, fast, versatile and highly-productive full-featured [Web](http://razor.servicestack.net) and +[Web Services](https://docs.servicestack.net/web-services.html) Framework that's +thoughtfully-architected to [reduce artificial complexity](https://docs.servicestack.net/why-not-odata.html#why-not-complexity) and promote +[remote services best-practices](https://docs.servicestack.net/advantages-of-message-based-web-services.html) +with a [message-based design](https://docs.servicestack.net/what-is-a-message-based-web-service.html) +that allows for maximum re-use that can leverage an integrated +[Service Gateway](https://docs.servicestack.net/service-gateway.html) +for the creation of loosely-coupled +[Modularized Service](https://docs.servicestack.net/modularizing-services.html) Architectures. +ServiceStack Services are consumable via an array of built-in fast data formats (inc. +[JSON](https://github.com/ServiceStack/ServiceStack.Text), +XML, +[CSV](https://docs.servicestack.net/csv-format.html), +[JSV](https://docs.servicestack.net/json-jsv-and-xml.html), +[ProtoBuf](https://docs.servicestack.net/protobuf-format.html), +[Wire](https://docs.servicestack.net/wire-format.html) and +[MsgPack](https://docs.servicestack.net/messagepack-format.html)) +as well as XSD/WSDL for [SOAP endpoints](https://docs.servicestack.net/soap-support.html) and +[Rabbit MQ](https://docs.servicestack.net/rabbit-mq.html), +[Redis MQ](https://docs.servicestack.net/messaging-and-redis.html) and +[Amazon SQS](https://github.com/ServiceStack/ServiceStack.Aws#sqsmqserver) MQ hosts. + +Its design and simplicity focus offers an unparalleled suite of productivity features that can be declaratively enabled +without code, from creating fully queryable Web API's with just a single Typed Request DTO with +[Auto Query](https://docs.servicestack.net/autoquery.html) supporting +[every major RDBMS](https://github.com/ServiceStack/ServiceStack.OrmLite#8-flavours-of-ormlite-is-on-nuget) +to the built-in support for +[Auto Batched Requests](https://docs.servicestack.net/auto-batched-requests.html) +or effortlessly enabling rich [HTTP Caching](https://docs.servicestack.net/http-caching.html) and +[Encrypted Messaging](https://docs.servicestack.net/encrypted-messaging.html) +for all your existing services via [Plugins](https://docs.servicestack.net/plugins.html). + +Your same Services also serve as the Controller in ServiceStack's [Smart Razor Views](http://razor.servicestack.net/) +reducing the effort to serve both +[Web and Single Page Apps](https://github.com/ServiceStackApps/LiveDemos) as well as +[Rich Desktop and Mobile Clients](https://github.com/ServiceStackApps/HelloMobile) that are able to deliver instant interactive +experiences using ServiceStack's real-time [Server Events](https://docs.servicestack.net/server-events.html). + +ServiceStack Services also maximize productivity for consumers providing an +[instant end-to-end typed API without code-gen](https://docs.servicestack.net/csharp-client.html) enabling +the most productive development experience for developing .NET to .NET Web Services. + +### [Generate Instant Typed APIs from within all Major IDEs!](https://docs.servicestack.net/add-servicestack-reference.html) + +ServiceStack now integrates with all Major IDE's used for creating the best native experiences on the most popular platforms +to enable a highly productive dev workflow for consuming Web Services, making ServiceStack the ideal back-end choice for powering +rich, native iPhone and iPad Apps on iOS with Swift, Mobile and Tablet Apps on the Android platform with Java, OSX Desktop Applications +as well as targeting the most popular .NET PCL platforms including Xamarin.iOS, Xamarin.Android, Windows Store, WPF, WinForms and Silverlight: + + + +#### [VS.NET integration with ServiceStackVS](https://visualstudiogallery.msdn.microsoft.com/5bd40817-0986-444d-a77d-482e43a48da7) + +Providing instant Native Typed API's for +[C#](https://docs.servicestack.net/csharp-add-servicestack-reference.html), +[TypeScript](https://docs.servicestack.net/typescript-add-servicestack-reference.html), +[F#](https://docs.servicestack.net/fsharp-add-servicestack-reference.html) and +[VB.NET](https://docs.servicestack.net/vbnet-add-servicestack-reference.html) +directly in Visual Studio for the +[most popular .NET platforms](https://github.com/ServiceStackApps/HelloMobile) including iOS and Android using +[Xamarin.iOS](https://github.com/ServiceStackApps/HelloMobile#xamarinios-client) and +[Xamarin.Android](https://github.com/ServiceStackApps/HelloMobile#xamarinandroid-client) on Windows. + +#### [Xamarin Studio integration with ServiceStackXS](https://docs.servicestack.net/csharp-add-servicestack-reference.html#xamarin-studio) + +Providing [C# Native Types](https://docs.servicestack.net/csharp-add-servicestack-reference.html) +support for developing iOS and Android mobile Apps using +[Xamarin.iOS](https://github.com/ServiceStackApps/HelloMobile#xamarinios-client) and +[Xamarin.Android](https://github.com/ServiceStackApps/HelloMobile#xamarinandroid-client) with +[Xamarin Studio](https://www.xamarin.com/studio) on OSX. The **ServiceStackXS** plugin also provides a rich web service +development experience developing Client applications with +[Mono Develop on Linux](https://docs.servicestack.net/csharp-add-servicestack-reference.html#xamarin-studio-for-linux) + +#### [Xcode integration with ServiceStackXC Plugin](https://docs.servicestack.net/swift-add-servicestack-reference.html) + +Providing [an instant Native Typed API in Swift](https://docs.servicestack.net/swift-add-servicestack-reference.html) +including generic Service Clients enabling a highly-productive workflow and effortless consumption of Web Services from +native iOS and OSX Applications - directly from within Xcode! + +#### [Android Studio integration with ServiceStackIDEA](https://docs.servicestack.net/java-add-servicestack-reference.html) + +Providing [an instant Native Typed API in Java](https://docs.servicestack.net/java-add-servicestack-reference.html) +and [Kotlin](https://docs.servicestack.net/kotlin-add-servicestack-reference.html) +including idiomatic Java Generic Service Clients supporting Sync and Async Requests by leveraging Android's AsyncTasks to enable the creation of services-rich and responsive native Java or Kotlin Mobile Apps on the Android platform - directly from within Android Studio! + +#### [IntelliJ integration with ServiceStackIDEA](https://docs.servicestack.net/java-add-servicestack-reference.html#install-servicestack-idea-from-the-plugin-repository) + +The ServiceStack IDEA plugin is installable directly from IntelliJ's Plugin repository and enables seamless integration with IntelliJ Java Maven projects for generating a Typed API to quickly and effortlessly consume remote ServiceStack Web Services from pure cross-platform Java or Kotlin Clients. + +#### [Eclipse integration with ServiceStackEclipse](https://github.com/ServiceStack/ServiceStack.Java/tree/master/src/ServiceStackEclipse#eclipse-integration-with-servicestack) + +The unmatched productivity offered by [Java Add ServiceStack Reference](https://docs.servicestack.net/java-add-servicestack-reference.html) is also available in the +[ServiceStackEclipse IDE Plugin](https://github.com/ServiceStack/ServiceStack.Java/tree/master/src/ServiceStackEclipse#eclipse-integration-with-servicestack) that's installable +from the [Eclipse MarketPlace](https://marketplace.eclipse.org/content/servicestackeclipse) to provide deep integration of Add ServiceStack Reference with Eclipse Java Maven Projects +enabling Java Developers to effortlessly Add and Update the references of their evolving remote ServiceStack Web Services. + +#### [servicestack-cli - Simple command-line utilities for ServiceStack](https://docs.servicestack.net/add-servicestack-reference.html#simple-command-line-utilities-for-servicestack) + +In addition to our growing list of supported IDE's, the [servicestack-cli](https://github.com/ServiceStack/servicestack-cli) +cross-platform command-line npm scripts makes it easy for build servers, automated tasks and command-line runners of your +favorite text editors to easily Add and Update ServiceStack References! + +## Simple Customer Database REST Services Example + +This example is also available as a [stand-alone integration test](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/CustomerRestExample.cs): ```csharp //Web Service Host Configuration public class AppHost : AppSelfHostBase { - public AppHost() : base("TODOs Tests", typeof(Todo).Assembly) {} + public AppHost() + : base("Customer REST Example", typeof(CustomerService).Assembly) {} public override void Configure(Container container) { - container.Register(new TodoRepository()); + //Register which RDBMS provider to use + container.Register(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + using (var db = container.Resolve().Open()) + { + //Create the Customer POCO table if it doesn't already exist + db.CreateTableIfNotExists(); + } } } -//REST Resource DTO -[Route("/todos")] -[Route("/todos/{Ids}")] -public class Todos : IReturn> +//Web Service DTO's +[Route("/customers", "GET")] +public class GetCustomers : IReturn {} + +public class GetCustomersResponse { - public long[] Ids { get; set; } - public Todos(params long[] ids) - { - this.Ids = ids; - } + public List Results { get; set; } +} + +[Route("/customers/{Id}", "GET")] +public class GetCustomer : IReturn +{ + public int Id { get; set; } } -[Route("/todos", "POST")] -[Route("/todos/{Id}", "PUT")] -public class Todo : IReturn +[Route("/customers", "POST")] +public class CreateCustomer : IReturn { - public long Id { get; set; } - public string Content { get; set; } - public int Order { get; set; } - public bool Done { get; set; } + public string Name { get; set; } } -public class TodosService : Service +[Route("/customers/{Id}", "PUT")] +public class UpdateCustomer : IReturn { - public TodoRepository Repository { get; set; } //Injected by IOC + public int Id { get; set; } - public object Get(Todos request) + public string Name { get; set; } +} + +[Route("/customers/{Id}", "DELETE")] +public class DeleteCustomer : IReturnVoid +{ + public int Id { get; set; } +} + +// POCO DB Model +public class Customer +{ + [AutoIncrement] + public int Id { get; set; } + + public string Name { get; set; } +} + +//Web Services Implementation +public class CustomerService : Service +{ + public object Get(GetCustomers request) { - return request.Ids.IsEmpty() - ? Repository.GetAll() - : Repository.GetByIds(request.Ids); + return new GetCustomersResponse { Results = Db.Select() }; } - public object Post(Todo todo) + public object Get(GetCustomer request) { - return Repository.Store(todo); + return Db.SingleById(request.Id); } - public object Put(Todo todo) + public object Post(CreateCustomer request) { - return Repository.Store(todo); + var customer = new Customer { Name = request.Name }; + Db.Save(customer); + return customer; } - public void Delete(Todos request) + public object Put(UpdateCustomer request) { - Repository.DeleteByIds(request.Ids); + var customer = Db.SingleById(request.Id); + if (customer == null) + throw HttpError.NotFound("Customer '{0}' does not exist".Fmt(request.Id)); + + customer.Name = request.Name; + Db.Update(customer); + + return customer; + } + + public void Delete(DeleteCustomer request) + { + Db.DeleteById(request.Id); } } + ``` -### [Calling the above TODO REST service from any C#/.NET Client](https://github.com/ServiceStack/ServiceStack/wiki/C%23-client) +### [Calling the above REST Service from any C#/.NET Client](https://docs.servicestack.net/csharp-add-servicestack-reference.html) + +> No code-gen required, can re-use above Server DTOs: ```csharp -//no code-gen required, can re-use above DTO's +var client = new JsonServiceClient(BaseUri); + +//GET /customers +var all = client.Get(new GetCustomers()); // Count = 0 + +//POST /customers +var customer = client.Post(new CreateCustomer { Name = "Foo" }); + +//GET /customer/1 +customer = client.Get(new GetCustomer { Id = customer.Id }); // Name = Foo + +//GET /customers +all = client.Get(new GetCustomers()); // Count = 1 + +//PUT /customers/1 +customer = client.Put( + new UpdateCustomer { Id = customer.Id, Name = "Bar" }); // Name = Bar + +//DELETE /customers/1 +client.Delete(new DeleteCustomer { Id = customer.Id }); + +//GET /customers +all = client.Get(new GetCustomers()); // Count = 0 +``` + +Same code also works with [Android, iOS, Xamarin.Forms, UWP and WPF clients](https://github.com/ServiceStackApps/HelloMobile). + +> [F#](https://docs.servicestack.net/fsharp-add-servicestack-reference.html) and +[VB.NET](https://docs.servicestack.net/vbnet-add-servicestack-reference.html) can re-use same +[.NET Service Clients](https://docs.servicestack.net/csharp-client.html) and DTO's + +### [Calling from TypeScript](https://docs.servicestack.net/typescript-add-servicestack-reference.html#ideal-typed-message-based-api) + +```ts +const client = new JsonServiceClient(baseUrl); +const { results } = await client.get(new GetCustomers()); +``` + +### [Calling from Swift](https://docs.servicestack.net/swift-add-servicestack-reference.html#jsonserviceclientswift) + +```swift +let client = JsonServiceClient(baseUrl: BaseUri) + +client.getAsync(GetCustomers()) + .then { + let results = $0.results; + } +``` + +### [Calling from Java](https://docs.servicestack.net/java-add-servicestack-reference.html#jsonserviceclient-usage) + +```java +JsonServiceClient client = new JsonServiceClient(BaseUri); + +GetCustomersResponse response = client.get(new GetCustomers()); +List results = response.results; +``` + +### [Calling from Kotlin](https://docs.servicestack.net/kotlin-add-servicestack-reference.html#jsonserviceclient-usage) +```kotlin +val client = JsonServiceClient(BaseUri) + +val response = client.get(GetCustomers()) +val results = response.results +``` + +### [Calling from Dart](https://docs.servicestack.net/dart-add-servicestack-reference) + +```dart var client = new JsonServiceClient(BaseUri); -List all = client.Get(new Todos()); // Count = 0 -var todo = client.Post( - new Todo { Content = "New TODO", Order = 1 }); // todo.Id = 1 -all = client.Get(new Todos()); // Count = 1 +var response = await client.get(GetCustomers()); +var results = client.results; +``` -todo.Content = "Updated TODO"; -todo = client.Put(todo); // todo.Content = Updated TODO +### [Calling from jQuery using TypeScript Definitions](https://docs.servicestack.net/typescript-add-servicestack-reference.html#typescript-interface-definitions) -client.Delete(new Todos(todo.Id)); -all = client.Get(new Todos()); // Count = 0 +```js +$.getJSON($.ss.createUrl("/customers", request), request, (r: GetCustomersResponse) => { + var results = r.results; +}); ``` -### Calling the TODO REST service from jQuery +Using TypeScript Definitions with Angular HTTP Client: - $.getJSON(baseUri + "/todos", function(todos) { - alert(todos.length == 1); - }); +```ts +this.http.get(createUrl('/customers', request)).subscribe(r => { + this.results = r.results; +}); +``` -### Calling the TODO REST service from [Dart JsonClient](https://github.com/mythz/DartJsonClient) +### Calling from jQuery - var client = new JsonClient(baseUri); - client.todos() - .then((todos) => alert(todos.length == 1)); +```js +$.getJSON(baseUri + "/customers", function(r) { + var results = r.results; +}); +``` -That's all the application code required to create a simple REST web service. +That's all the application code required to create and consume a simple database-enabled REST Web Service! ## Getting Started - * [Start with the **Getting Started** section on the Wiki](https://github.com/ServiceStack/ServiceStack/wiki) - * [Example Apps and Demos](http://stackoverflow.com/questions/15862634/in-what-order-are-the-servicestack-examples-supposed-to-be-grokked/15869816#15869816) - * [Community resources](https://github.com/ServiceStack/ServiceStack/wiki/Community-Resources) + * [Start with the **Getting Started** section](https://docs.servicestack.net/create-your-first-webservice.html) + * [Example Apps and Demos](https://github.com/ServiceStackApps/LiveDemos) + * [Community resources](https://docs.servicestack.net/community-resources.html) -### [Release Notes](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md) +### [Release Notes](https://servicestack.net/release-notes) ## Download -If you have [NuGet](http://nuget.org) installed, the easiest way to get started is to: +If you have [NuGet](http://www.nuget.org/) installed, the easiest way to get started is to: ### [Install ServiceStack via NuGet](https://servicestack.net/download). -_Latest v4+ on NuGet is a commercial release with [free quotas](https://servicestack.net/download#free-quotas)._ +_Latest v4+ on NuGet is a [commercial release](https://servicestack.net/pricing) with [free quotas](https://servicestack.net/download#free-quotas)._ ### [Docs and Downloads for older v3 BSD releases](https://github.com/ServiceStackV3/ServiceStackV3) -### Examples - -**The [Definitive list of Example Projects, Use-Cases, Demos, Starter Templates](http://stackoverflow.com/a/15869816)** - -## Download published NuGet binaries without NuGet - -GitHub has disabled its download feature so currently NuGet is the best way to get ServiceStack published releases. -For environments that don't have NuGet installed (e.g. OSX/Linux) you can still download the published binaries by -extracting them from the published NuGet packages. The url to download a nuget package is: +### [Live Demos](https://github.com/ServiceStackApps/LiveDemos) - http://packages.nuget.org/api/v1/package/{PackageName}/{Version} +**The [Definitive list of Example Projects, Use-Cases, Demos, Starter Templates](https://github.com/ServiceStackApps/LiveDemos)** - So to get the core ServiceStack and ServiceStack.Text libs in OSX/Linux (or using gnu tools for Windows) you can just do: - - wget -O ServiceStack http://packages.nuget.org/api/v1/package/ServiceStack/3.9.71 - unzip ServiceStack 'lib/*' - - wget -O ServiceStack.Text http://packages.nuget.org/api/v1/package/ServiceStack.Text/3.9.71 - unzip ServiceStack.Text 'lib/*' - -which will download and extract the dlls into your local local `lib/` folder. - ## Copying Since September 2013, ServiceStack source code is available under GNU Affero General Public License/FOSS License Exception, see license.txt in the source. @@ -155,33 +351,30 @@ Alternative commercial licensing is also available, see https://servicestack.net ## Contributing -Contributors need to approve the [Contributor License Agreement](https://docs.google.com/forms/d/16Op0fmKaqYtxGL4sg7w_g-cXXyCoWjzppgkuqzOeKyk/viewform) before any code will be reviewed, see the [Contributing wiki](https://github.com/ServiceStack/ServiceStack/wiki/Contributing) for more details. All contributions must include tests verifying the desired behavior. +Contributors need to approve the [Contributor License Agreement](https://docs.google.com/forms/d/16Op0fmKaqYtxGL4sg7w_g-cXXyCoWjzppgkuqzOeKyk/viewform) before any code will be reviewed, see the [Contributing docs](https://docs.servicestack.net/contributing.html) for more details. All contributions must include tests verifying the desired behavior. ## OSS Libraries used ServiceStack includes source code of the great libraries below for some of its core functionality. Each library is released under its respective licence: - - [Mono](https://github.com/mono/mono) [(License)](https://github.com/mono/mono/blob/master/LICENSE) - - [Funq IOC](http://funq.codeplex.com) [(License)](http://funq.codeplex.com/license) - - [Fluent Validation](http://fluentvalidation.codeplex.com) [(License)](http://fluentvalidation.codeplex.com/license) - - [Mini Profiler](http://code.google.com/p/mvc-mini-profiler/) [(License)](http://www.apache.org/licenses/LICENSE-2.0) - - [Dapper](http://code.google.com/p/dapper-dot-net/) [(License)](http://www.apache.org/licenses/LICENSE-2.0) - - [TweetStation's OAuth library](https://github.com/migueldeicaza/TweetStation) [(License)](https://github.com/migueldeicaza/TweetStation/blob/master/LICENSE) - - [MarkdownSharp](http://code.google.com/p/markdownsharp/) [(License)](http://opensource.org/licenses/mit-license.php) - - [MarkdownDeep](https://github.com/toptensoftware/markdowndeep) [(License)](http://www.toptensoftware.com/markdowndeep/license) - -## Similar open source projects - -Similar Open source .NET projects for developing or accessing web services include: - - * [Nancy Fx](http://nancyfx.org) - A Sinatra-inspired lightweight Web Framework for .NET: - * [Fubu MVC](http://mvc.fubu-project.org) - A "Front Controller" pattern-style MVC framework designed for use in web applications built on ASP.NET: - * [Rest Sharp](http://restsharp.org) - An open source REST client for .NET + - [Mono](https://github.com/mono/mono) [(MIT License)](https://github.com/mono/mono/blob/master/LICENSE) + - [Funq IOC](http://funq.codeplex.com) [(MS-PL License)](https://opensource.org/licenses/MS-PL) + - [Fluent Validation](https://github.com/JeremySkinner/FluentValidation) [(Apache License 2.0)](https://github.com/JeremySkinner/FluentValidation/blob/master/License.txt) + - [Mini Profiler](https://github.com/MiniProfiler/dotnet) [(MIT License)](https://github.com/MiniProfiler/dotnet/blob/master/LICENSE.txt) + - [Dapper](https://github.com/StackExchange/Dapper) [(Apache License 2.0)](http://www.apache.org/licenses/LICENSE-2.0) + - [TweetStation's OAuth library](https://github.com/migueldeicaza/TweetStation) [(MIT License)](https://github.com/migueldeicaza/TweetStation/blob/master/LICENSE) + - [MarkdownSharp](https://code.google.com/archive/p/markdownsharp) [(MIT License)](https://opensource.org/licenses/mit-license.php) + - [MarkdownDeep](https://github.com/toptensoftware/markdowndeep) [(Apache License 2.0)](http://www.toptensoftware.com/markdowndeep/license) + - [HtmlCompressor](https://code.google.com/archive/p/htmlcompressor) [(Apache License 2.0)](http://www.apache.org/licenses/LICENSE-2.0) + - [JSMin](https://github.com/douglascrockford/JSMin/blob/master/jsmin.c) [(Apache License 2.0)](http://www.apache.org/licenses/LICENSE-2.0) + - [RecyclableMemoryStream](https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream) [(MIT License)](https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream/blob/master/LICENSE) + - [ASP.NET MVC](https://github.com/aspnet/Mvc) [(Apache License 2.0)](https://github.com/aspnet/Mvc/blob/release/2.2/LICENSE.txt) + - [CoreFX](https://github.com/dotnet/corefx) [(MIT License)](https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) ## Find out More -Follow [@ServiceStack](http://twitter.com/ServiceStack) and +Follow [@ServiceStack](https://twitter.com/ServiceStack) and [+ServiceStack](https://plus.google.com/u/0/communities/112445368900682590445) for project updates. ----- @@ -189,10 +382,13 @@ Follow [@ServiceStack](http://twitter.com/ServiceStack) and ## Core Team - [mythz](https://github.com/mythz) (Demis Bellot) - - [arxisos](https://github.com/arxisos) (Steffen Müller) / [@arxisos](https://twitter.com/arxisos) + - [layoric](https://github.com/layoric) (Darren Reid) / [@layoric](https://twitter.com/layoric) + - [xplicit](https://github.com/xplicit) (Sergey Zhukov) / [@quantumcalc](https://twitter.com/quantumcalc) - [desunit](https://github.com/desunit) (Sergey Bogdanov) / [@desunit](https://twitter.com/desunit) + - [arxisos](https://github.com/arxisos) (Steffen Müller) / [@arxisos](https://twitter.com/arxisos) ## Contributors + A big thanks to GitHub and all of ServiceStack's contributors: - [bman654](https://github.com/bman654) (Brandon Wallace) @@ -468,7 +664,7 @@ A big thanks to GitHub and all of ServiceStack's contributors: - [kaza](https://github.com/kaza) - [mishfit](https://github.com/mishfit) - [rfvgyhn](https://github.com/rfvgyhn) (Chris) - - [caioproiete](https://github.com/caioproiete) (Caio Proiete) + - [augustoproiete](https://github.com/augustoproiete) (C. Augusto Proiete) - [sjuxax](https://github.com/sjuxax) (Jeff Cook) - [madaleno](https://github.com/madaleno) (Luis Madaleno) - [yavosh](https://github.com/yavosh) (Yavor Shahpasov) @@ -498,4 +694,10 @@ A big thanks to GitHub and all of ServiceStack's contributors: *** -Runs on both Mono and .NET _(Live preview hosted on Mono / Ubuntu)_ +## Similar open source projects + +Similar Open source .NET projects for developing or accessing web services include: + + * [Nancy Fx](http://nancyfx.org) - A Sinatra-inspired lightweight Web Framework for .NET: + * [Fubu MVC](https://fubumvc.github.io/) - A "Front Controller" pattern-style MVC framework designed for use in web applications built on ASP.NET: + * [Rest Sharp](http://restsharp.org) - An open source REST client for .NET diff --git a/build/7za.exe b/build/7za.exe deleted file mode 100644 index 06e8b434f73..00000000000 Binary files a/build/7za.exe and /dev/null differ diff --git a/build/appsettings.license.txt b/build/appsettings.license.txt deleted file mode 100644 index 1e498b17527..00000000000 --- a/build/appsettings.license.txt +++ /dev/null @@ -1 +0,0 @@ -1001-e1JlZjoxMDAxLE5hbWU6VGVzdCBCdXNpbmVzcyxUeXBlOkJ1c2luZXNzLEhhc2g6UHVNTVRPclhvT2ZIbjQ5MG5LZE1mUTd5RUMzQnBucTFEbTE3TDczVEF4QUNMT1FhNXJMOWkzVjFGL2ZkVTE3Q2pDNENqTkQyUktRWmhvUVBhYTBiekJGUUZ3ZE5aZHFDYm9hL3lydGlwUHI5K1JsaTBYbzNsUC85cjVJNHE5QVhldDN6QkE4aTlvdldrdTgyTk1relY2eis2dFFqTThYN2lmc0JveHgycFdjPSxFeHBpcnk6MjAxMy0wMS0wMX0= \ No newline at end of file diff --git a/build/build-common-core.proj b/build/build-common-core.proj new file mode 100644 index 00000000000..5197ad42469 --- /dev/null +++ b/build/build-common-core.proj @@ -0,0 +1,105 @@ + + + + + + 5 + 0 + $(BUILD_NUMBER) + + + + $(MSBuildProjectDirectory)/.. + $(BuildSolutionDir)/src + Release + $(BuildSolutionDir)/NuGet/ + $(MajorVersion).$(MinorVersion).$(PatchVersion) + + + + + BeforeBuildSolutions; + BuildSolutions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <Version>[^<]* + <Version>$(PackageVersion) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/build-common.proj b/build/build-common.proj new file mode 100644 index 00000000000..d93eb2f341b --- /dev/null +++ b/build/build-common.proj @@ -0,0 +1,108 @@ + + + + + + 5 + 0 + $(BUILD_NUMBER) + + + + $(MSBuildProjectDirectory)/.. + $(BuildSolutionDir)/src + Release + $(BuildSolutionDir)/NuGet/ + $(MajorVersion).$(MinorVersion).$(PatchVersion) + + + + + BeforeBuildSolutions; + BuildSolutions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <Version>[^<]* + <Version>$(PackageVersion) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/build-core.proj b/build/build-core.proj new file mode 100644 index 00000000000..c8c1df59d36 --- /dev/null +++ b/build/build-core.proj @@ -0,0 +1,175 @@ + + + + + + 5 + 0 + $(BUILD_NUMBER) + + + + $(MSBuildProjectDirectory)/.. + $(BuildSolutionDir)/src + Release + $(BuildSolutionDir)/NuGet/ + $(MajorVersion).$(MinorVersion).$(PatchVersion) + + + + + BeforeBuildSolutions; + BuildSolutions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <Version>[^<]* + <Version>$(PackageVersion) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/build-pcl.proj b/build/build-pcl.proj deleted file mode 100644 index 52f52818ad5..00000000000 --- a/build/build-pcl.proj +++ /dev/null @@ -1,176 +0,0 @@ - - - - - 4 - 0 - $(BUILD_NUMBER) - - - - $(MSBuildProjectDirectory)/.. - $(BuildSolutionDir)/src - Release - /noshadow - $(SrcDir)/.nuget/nuget.exe - $(BuildSolutionDir)/NuGet.Pcl/ - $(MajorVersion).$(MinorVersion).$(PatchVersion).0 - -unstable - $(MajorVersion).$(MinorVersion).$(PatchVersion)$(UnstableTag) - $(MajorVersion).$(MinorVersion)$(PatchVersion) - - - - - BuildSolutions - - - - - - - - - - - - - - - - - - - - - - - - - - - - AssemblyFileVersion\(\"\d+\.\d+\.\d+\.\d+\"\) - AssemblyFileVersion("$(Version)") - - - - - AssemblyVersion\(\"\d+\.\d+\.\d+\.\d+\"\) - AssemblyVersion("4.0.0.0") - - - - - version="4\.0[^"]*" - version="$(PackageVersion)" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-remote.proj b/build/build-remote.proj deleted file mode 100644 index 01e6b2eccf0..00000000000 --- a/build/build-remote.proj +++ /dev/null @@ -1,223 +0,0 @@ - - - - - 3 - 9 - $(BUILD_NUMBER) - - - - $(MSBuildProjectDirectory)/.. - $(BuildSolutionDir)/src - Release - /noshadow - $(BuildSolutionDir)/src/.nuget/nuget.exe - $(BuildSolutionDir)/NuGet/ - $(MSBuildProjectDirectory) - $(MajorVersion).$(MinorVersion).$(PatchVersion).0 - -unstable - $(MajorVersion).$(MinorVersion).$(PatchVersion)$(UnstableTag) - $(MajorVersion).$(MinorVersion)$(PatchVersion) - - - - - BuildSolutions - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \d+\.\d+\.\d+\.\d+ - $(Version) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-sn.proj b/build/build-sn.proj deleted file mode 100644 index 67de6a8bca4..00000000000 --- a/build/build-sn.proj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - 4 - 0 - $(BUILD_NUMBER) - - - - $(MSBuildProjectDirectory)/.. - $(BuildSolutionDir)/src - Signed - /noshadow - $(SrcDir)/.nuget/nuget.exe - $(BuildSolutionDir)/NuGet.Signed/ - $(MajorVersion).$(MinorVersion).$(PatchVersion).0 - -unstable - $(MajorVersion).$(MinorVersion).$(PatchVersion)$(UnstableTag) - $(MajorVersion).$(MinorVersion)$(PatchVersion) - - - - - BuildSolutions - - - - - - - - - - - - - - - - - - - - - - - - - - AssemblyFileVersion\(\"\d+\.\d+\.\d+\.\d+\"\) - AssemblyFileVersion("$(Version)") - - - - - AssemblyVersion\(\"\d+\.\d+\.\d+\.\d+\"\) - AssemblyVersion("4.0.0.0") - - - - - version="4\.0[^"]*" - version="$(PackageVersion)" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build.bat b/build/build.bat index 07cc97dc034..7cd0981c96d 100644 --- a/build/build.bat +++ b/build/build.bat @@ -1,8 +1,4 @@ -SET MSBUILD=C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe - -%MSBUILD% build.proj /target:TeamCityBuild;NuGetPack /property:Configuration=Release;RELEASE=true;PatchVersion=0 -REM %MSBUILD% build-sn.proj /target:TeamCityBuild;NuGetPack /property:Configuration=Signed;RELEASE=true;PatchVersion=0 -REM %MSBUILD% build-pcl.proj /target:TeamCityBuild;NuGetPack /property:Configuration=Release;RELEASE=true;PatchVersion=0 - -REM Debug Task -REM C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /t:rebuild /debug C:\src\ServiceStack\tests\RazorRockstars.BuildTask\RazorRockstars.BuildTask.csproj +for /f "usebackq tokens=*" %%i in (`vswhere.exe -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do ( + SET MSBUILD="%%i" +) +%MSBUILD% build.proj /property:Configuration=Release;MinorVersion=8;PatchVersion=1 diff --git a/build/build.proj b/build/build.proj index edc9e30a488..09b5df954d7 100644 --- a/build/build.proj +++ b/build/build.proj @@ -1,8 +1,10 @@ - + + - 4 + 5 0 $(BUILD_NUMBER) @@ -11,503 +13,247 @@ $(MSBuildProjectDirectory)/.. $(BuildSolutionDir)/src Release - /noshadow - $(SrcDir)/.nuget/nuget.exe $(BuildSolutionDir)/NuGet/ - $(MajorVersion).$(MinorVersion).$(PatchVersion).0 - -unstable - $(MajorVersion).$(MinorVersion).$(PatchVersion)$(UnstableTag) - $(MajorVersion).$(MinorVersion)$(PatchVersion) + $(MajorVersion).$(MinorVersion).$(PatchVersion) + BeforeBuildSolutions; BuildSolutions - - - - - - - - - + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - AssemblyFileVersion\(\"\d+\.\d+\.\d+\.\d+\"\) - AssemblyFileVersion("$(Version)") - - - AssemblyVersion\(\"\d+\.\d+\.\d+\.\d+\"\) - AssemblyVersion("$(Version)") - - - key="servicestack:license".* - key="servicestack:license" value="$([System.IO.File]::ReadAllText($(MSBuildProjectDirectory)/appsettings.license.txt))" /> - - - - version="4\.0[^"]*" - version="$(PackageVersion)" + + <Version>[^<]* + <Version>$(PackageVersion) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - + + - - - + + + - - - - - + + + - + + - + + - - + + + + - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - - + + - - - - - - - - - - + + - - + + - - + + - + + - + + - - + + - + + + - - - - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - - - + + + + - - - - - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - - - - - - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - - - - - - - - - - - - - - - - - - - - - - - - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> + - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - - + + + - + + + + + - - - - - - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - - - - - - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - - - - - - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - - - - - - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Targets="Build;Pack" + Properties="Configuration=$(Configuration)" /> - + + - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - + + diff --git a/build/build.sh b/build/build.sh deleted file mode 100755 index 23f055432b6..00000000000 --- a/build/build.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/bash - -MODO=Debug -LIB_DIR=lib -MONO_DIR=lib -#MODO=Release - -CURRENT_DIR=`pwd` -cd ../.. - -function makeMonoDir { - echo "$1/$MONO_DIR" - if [ ! -d "$1/$MONO_DIR" ] - then - mkdir -p "$1/$MONO_DIR"/tests - fi -} - -if [ ! -d "$LIB_DIR" ] -then - mkdir "$LIB_DIR" -fi - -function buildComponentAndCopyToServiceStack { - xbuild /p:Configuration="$MODO" "$1"/src/"$2"/"$2".csproj - cp "$1"/src/"$2"/bin/"$MODO"/"$2".dll "$LIB_DIR" - cp "$LIB_DIR"/"$2".dll ServiceStack/"$MONO_DIR" -} - -function buildComponent { - xbuild /p:Configuration="$MODO" "$1"/src/"$2"/"$2".csproj - cp "$1"/src/"$2"/bin/"$MODO"/"$2".dll "$LIB_DIR" -} - -function buildTestComponent { - xbuild /p:Configuration="$MODO" "$1"/tests/"$2"/"$2".csproj - cp "$1"/tests/"$2"/bin/"$MODO"/"$2".dll "$LIB_DIR" -} - -function buildServiceStackBenchmarks { - xbuild /p:Configuration="$MODO" "$1"/src/"$2"/"$3"/"$3".csproj - cp "$1"/src/"$2"/"$3"/bin/"$MODO"/"$3".dll "$LIB_DIR" -} - -makeMonoDir ServiceStack -makeMonoDir ServiceStack.OrmLite -makeMonoDir ServiceStack.Redis -makeMonoDir ServiceStack.Text - - -buildComponentAndCopyToServiceStack ServiceStack.Text ServiceStack.Text -cp "$LIB_DIR"/ServiceStack.Text.dll ServiceStack.OrmLite/"$MONO_DIR" -cp "$LIB_DIR"/ServiceStack.Text.dll ServiceStack.Redis/"$MONO_DIR" -cp "$LIB_DIR"/ServiceStack.Text.dll ServiceStack.Redis/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.Text.dll ServiceStack.Text/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.Text.dll ServiceStack.Logging/"$MONO_DIR" - -buildComponentAndCopyToServiceStack ServiceStack ServiceStack.Interfaces -cp "$LIB_DIR"/ServiceStack.Interfaces.dll ServiceStack.OrmLite/"$MONO_DIR" -cp "$LIB_DIR"/ServiceStack.Interfaces.dll ServiceStack.Redis/"$MONO_DIR" -cp "$LIB_DIR"/ServiceStack.Interfaces.dll ServiceStack.Redis/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.Interfaces.dll ServiceStack.Text/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.Interfaces.dll ServiceStack.Logging/"$MONO_DIR" - -buildComponentAndCopyToServiceStack ServiceStack ServiceStack.Common -cp "$LIB_DIR"/ServiceStack.Common.dll ServiceStack.OrmLite/"$MONO_DIR" -cp "$LIB_DIR"/ServiceStack.Common.dll ServiceStack.Redis/"$MONO_DIR" -cp "$LIB_DIR"/ServiceStack.Common.dll ServiceStack.Redis/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.Common.dll ServiceStack.Text/"$MONO_DIR"/tests/ -cp "$LIB_DIR"/ServiceStack.Common.dll ServiceStack.Logging/"$MONO_DIR" - -buildComponent ServiceStack ServiceStack -cp "$LIB_DIR"/ServiceStack.dll ServiceStack.Redis/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.dll ServiceStack.Text/"$MONO_DIR"/tests - -buildComponentAndCopyToServiceStack ServiceStack.OrmLite ServiceStack.OrmLite -buildComponentAndCopyToServiceStack ServiceStack.OrmLite ServiceStack.OrmLite.Sqlite -buildComponentAndCopyToServiceStack ServiceStack.OrmLite ServiceStack.OrmLite.SqlServer -buildComponent ServiceStack.OrmLite ServiceStack.OrmLite.MySql -buildComponent ServiceStack.OrmLite ServiceStack.OrmLite.PostgreSQL -buildComponent ServiceStack.OrmLite ServiceStack.OrmLite.Firebird -buildComponent ServiceStack.OrmLite ServiceStack.OrmLite.Oracle - -cp "$LIB_DIR"/ServiceStack.OrmLite.dll ServiceStack.Text/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.OrmLite.SqlServer.dll ServiceStack.Text/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.OrmLite.Sqlite.dll ServiceStack.Text/"$MONO_DIR"/tests - -#ServiceStack again -buildComponent ServiceStack ServiceStack.Authentication.OpenId -buildComponent ServiceStack ServiceStack.Plugins.MsgPack -buildComponent ServiceStack ServiceStack.ServiceInterface -buildComponent ServiceStack ServiceStack.Plugins.ProtoBuf -buildComponent ServiceStack ServiceStack.FluentValidation.Mvc3 -buildComponent ServiceStack ServiceStack.Razor2 -cp "$LIB_DIR"/ServiceStack.Razor2.dll ServiceStack.Redis/"$MONO_DIR"/tests/ -cp "$LIB_DIR"/ServiceStack.ServiceInterface.dll ServiceStack.Redis/"$MONO_DIR"/tests/ -cp "$LIB_DIR"/ServiceStack.ServiceInterface.dll ServiceStack.Text/"$MONO_DIR"/tests/ - - -buildComponentAndCopyToServiceStack ServiceStack.Redis ServiceStack.Redis -cp "$LIB_DIR"/ServiceStack.Redis.dll ServiceStack.Redis/"$LIB_DIR"/tests -cp "$LIB_DIR"/ServiceStack.Redis.dll ServiceStack.Text/"$LIB_DIR"/tests - -#ServiceStack.Benchmarks -cp "$LIB_DIR"/ServiceStack.dll ServiceStack.Benchmarks/lib -cp "$LIB_DIR"/ServiceStack.Interfaces.dll ServiceStack.Benchmarks/lib - -cp "$LIB_DIR"/ServiceStack.Text.dll ServiceStack.Benchmarks/src/Northwind.Benchmarks/Lib -cp "$LIB_DIR"/ServiceStack.Interfaces.dll ServiceStack.Benchmarks/src/Northwind.Benchmarks/Lib - -buildServiceStackBenchmarks ServiceStack.Benchmarks Northwind.Benchmarks Northwind.Common -buildServiceStackBenchmarks ServiceStack.Benchmarks Northwind.Benchmarks Northwind.Perf -buildServiceStackBenchmarks ServiceStack.Benchmarks Northwind.Benchmarks Northwind.Benchmarks -buildServiceStackBenchmarks ServiceStack.Benchmarks Northwind.Benchmarks Northwind.Benchmarks.Console - -cp "$LIB_DIR"/Northwind.Common.dll ServiceStack/"$MONO_DIR"/tests/ -cp "$LIB_DIR"/Northwind.Common.dll ServiceStack.OrmLite/"$MONO_DIR"/tests/ -cp "$LIB_DIR"/Northwind.Common.dll ServiceStack.Redis/"$MONO_DIR"/tests/ -cp "$LIB_DIR"/Northwind.Common.dll ServiceStack.Text/"$MONO_DIR"/tests/ -cp "$LIB_DIR"/Northwind.Perf.dll ServiceStack.OrmLite/"$MONO_DIR"/tests/ - - -buildTestComponent ServiceStack ServiceStack.Common.Tests -cp "$LIB_DIR"/ServiceStack.Common.Tests.dll ServiceStack.OrmLite/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.Common.Tests.dll ServiceStack.Redis/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.Common.Tests.dll ServiceStack.Text/"$MONO_DIR"/tests -buildTestComponent ServiceStack ServiceStack.Messaging.Tests -cp "$LIB_DIR"/ServiceStack.Messaging.Tests.dll ServiceStack.Redis/"$MONO_DIR"/tests -cp "$LIB_DIR"/ServiceStack.Messaging.Tests.dll ServiceStack.Text/"$MONO_DIR"/tests - - -#ServiceStack.RazorHostTests : xbuild can not build it, but monodevelop does it! - -#xbuild ServiceStack/tests/ServiceStack.RazorHostTests/ServiceStack.RazorHostTests.csproj - -#Imported project: -#"/usr/local/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets" does not exist. -# there is v9.0 - -#ServiceStack.RazorNancyTests : xbuild can not build it, but monodevelop does it! -#xbuild ServiceStack/tests/ServiceStack.RazorNancyTests/ServiceStack.RazorNancyTests.csproj - -buildTestComponent ServiceStack ServiceStack.ServiceHost.Tests -buildTestComponent ServiceStack ServiceStack.ServiceModel.Tests -#ServiceStack.WebHost.Endpoints.Tests: warning as error -buildTestComponent ServiceStack ServiceStack.WebHost.Endpoints.Tests -#ServiceStack.WebHost.IntegrationTests -# execute once : -#sudo ln -s /usr/local/lib/mono/xbuild/Microsoft/VisualStudio/v9.0 /usr/local/lib/mono/xbuild/Microsoft/VisualStudio/v10.0 -buildTestComponent ServiceStack ServiceStack.WebHost.IntegrationTests -cp ServiceStack/tests/ServiceStack.WebHost.IntegrationTests/bin/ServiceStack.WebHost.IntegrationTests.dll "$LIB_DIR" - - -buildTestComponent ServiceStack.Redis ServiceStack.Redis.Tests -buildTestComponent ServiceStack.Text ServiceStack.Text.Tests -#ServiceStack.Text.Tests // comment public void #Can_Serialize_User_OAuthSession_list() and public void #Doesnt_serialize_TypeInfo_when_set() - - -#ServiceStack.Logging.EventLog - -#fail: ../../src//.nuget/nuget.targets: Project file could not be imported -#use monodevelop -#xbuild ServiceStack.Logging/src/ServiceStack.Logging.EventLog/ServiceStack.Logging.EventLog.csproj - -#ServiceStack.Logging.Log4Net -#fail: ../../src//.nuget/nuget.targets: Project file could not be imported -#use monodevelop -#xbuild #ServiceStack.Logging/src/ServiceStack.Logging.Log4Net/ServiceStack.Logging.Log4Net.csproj - -cd "$CURRENT_DIR" diff --git a/build/codegen-projs.js b/build/codegen-projs.js deleted file mode 100644 index 8182ff757f6..00000000000 --- a/build/codegen-projs.js +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. -// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt - - -var fs = require('fs'); -var path = require('path'); -var sax = require("sax"); - -var log = console.log; -log("Generating .Signed.csprojs..."); - -function stripBOM(content) { - if (content.charCodeAt(0) === 0xFEFF) { - content = content.slice(1); - } - return content; -} - -String.prototype.lines = function() { - return this.replace(/\r/g, '').split('\n'); -}; - -var SIGN_PROJS = [ - '../../ServiceStack.Text/src/ServiceStack.Text/ServiceStack.Text.csproj', - '../../ServiceStack.Redis/src/ServiceStack.Redis/ServiceStack.Redis.csproj', - '../../ServiceStack.OrmLite/src/ServiceStack.OrmLite/ServiceStack.OrmLite.csproj', - '../../ServiceStack.OrmLite/src/ServiceStack.OrmLiteV45/ServiceStack.OrmLiteV45.csproj', - '../../ServiceStack.OrmLite/src/ServiceStack.OrmLite.SqlServer/ServiceStack.OrmLite.SqlServer.csproj', - '../../ServiceStack.OrmLite/src/ServiceStack.OrmLite.SqlServerV45/ServiceStack.OrmLite.SqlServerV45.csproj', - '../../ServiceStack.OrmLite/src/ServiceStack.OrmLite.Oracle/ServiceStack.OrmLite.Oracle.csproj', - '../../ServiceStack.OrmLite/src/ServiceStack.OrmLite.Sqlite.Windows/ServiceStack.OrmLite.Sqlite.Windows.csproj', - '../src/ServiceStack.Common/ServiceStack.Common.csproj', - '../src/ServiceStack.Client/ServiceStack.Client.csproj', - '../src/ServiceStack.Server/ServiceStack.Server.csproj', - '../src/ServiceStack.ServerV45/ServiceStack.ServerV45.csproj', - '../src/ServiceStack.Razor/ServiceStack.Razor.csproj', - '../src/ServiceStack.ProtoBuf/ServiceStack.ProtoBuf.csproj', - '../src/ServiceStack.Api.Swagger/ServiceStack.Api.Swagger.csproj', - '../src/ServiceStack/ServiceStack.csproj' -]; -var SIGN_REPLACE_TEXTS = { - '..\\..\\lib\\ServiceStack.Text.dll': '..\\..\\lib\\signed\\ServiceStack.Text.dll', - '..\\..\\lib\\ServiceStack.Common.dll': '..\\..\\lib\\signed\\ServiceStack.Common.dll', - '..\\..\\lib\\ServiceStack.Redis.dll': '..\\..\\lib\\signed\\ServiceStack.Redis.dll', - '..\\..\\lib\\ServiceStack.OrmLite.dll': '..\\..\\lib\\signed\\ServiceStack.OrmLite.dll', - '..\\..\\lib\\net45\\ServiceStack.OrmLite.dll': '..\\..\\lib\\net45\\signed\\ServiceStack.OrmLite.dll', - '..\\..\\lib\\ServiceStack.OrmLite.SqlServer.dll': '..\\..\\lib\\signed\\ServiceStack.OrmLite.SqlServer.dll', - '': '', - '': '', - '': '' -}; - -var injectSignedElements = [ - { - PropertyGroup: { - SignAssembly: "true", - } - }, - { - PropertyGroup: { - AssemblyOriginatorKeyFile: "servicestack-sn.pfx" - } - } -]; - -var readTextFile = function (path) { - return stripBOM(fs.readFileSync(path, { encoding: 'UTF-8' })); -}; - -var mergeElements = function (xml, els) { - els.forEach(function(elSeek) { - Object.keys(elSeek).forEach(function(tag) { - var tagToMatch = tag.toUpperCase(); - - var strict = false; - var parser = sax.parser(strict); - - var matches = []; - var open = { line: 0, coloumn: 0, startTagPosition: 0 }; - - parser.onopentag = function (el) { - if (el.name == tagToMatch) { - log("found <" + tag + "> at: ", this.line + ":" + this.column); - open = { line: this.line, column: this.column, startTagPosition: this.startTagPosition }; - } - }; - parser.onclosetag = function (name) { - if (name == tagToMatch) { - log("found at: ", this.line + ":" + this.column); - matches.push({ start: open, end: { line: this.line, column: this.column, startTagPosition: this.startTagPosition } }); - } - }; - - parser.write(xml); - - log("results for " + tag); - log(matches); - - var props = elSeek[tag]; - var out = []; - var lastPos = 0; - var found = false; - - matches.forEach(function(match) { - var startPos = match.start.startTagPosition + match.start.column; - var endPos = match.end.startTagPosition - 1; - - out.push(xml.substring(lastPos, startPos)); - - var fragment = xml.substring(startPos, endPos); - - if (!found) { - var missing = []; - Object.keys(props).forEach(function (elName) { - var elValue = props[elName]; - var seekTag = "<" + elName + ">"; - var seekEndTag = ""; - var injectXml = seekTag + elValue + seekEndTag; - - var startPos; - if ((startPos = fragment.indexOf(seekTag)) >= 0) { - var endPos = fragment.indexOf(seekEndTag) + seekEndTag.length; - if (endPos == -1) - throw "Couldn't find matching end tag: " + seekEndTag; - - fragment = fragment.substring(0, startPos) - + injectXml - + fragment.substring(endPos); - - found = true; - } else { - missing.push(injectXml); - } - }); - - //If one was found, add the missing at the end fragment - if (found) { - missing.forEach(function(injectXml) { - fragment += " " + injectXml + "\n"; - }); - fragment += " "; - } - } - - out.push(fragment); - - lastPos = endPos; - }); - - //If we can't merge, append - if (!found) { - //Close open end tag first, then open new tag: - out.push("\n "); - out.push("<" + tag + ">\n"); - Object.keys(props).forEach(function (elName) { - var injectXml = " <" + elName + ">" + props[elName] + "\n"; - out.push(injectXml); - }); - //remaining fragment starts with closing tag - } - - out.push(" "); - out.push(xml.substring(lastPos)); - - xml = out.join(''); - }); - }); - - return xml; -}; - -SIGN_PROJS.forEach(function(proj) { - log("file: " + proj); - var xml = readTextFile(proj); - log(xml); - - var transformedXml = mergeElements(xml, injectSignedElements); - - Object.keys(SIGN_REPLACE_TEXTS).forEach(function (find) { - log("replacing: " + find + ", with: " + SIGN_REPLACE_TEXTS[find]); - transformedXml = transformedXml.replace(find, SIGN_REPLACE_TEXTS[find]); - }); - - var signedProjPath = path.join(path.dirname(proj), path.basename(proj).replace(".csproj", ".Signed.csproj")); - log("writing transformedXml to: " + signedProjPath); - log(transformedXml); - - fs.writeFileSync(signedProjPath, transformedXml); -}); - - -log("Generating Custom build .csprojs..."); - -var CUSTOM_TEMPLATES = [{ - Code: 'PCL', - Path: '../src/Templates/PclTemplate.csproj', - ProjectGuid: '{BF5EEDF0-594C-4660-AFF5-AF3423F3602D}', - RootNamespace: 'PclTemplate', - AssemblyName: 'PclTemplate', -}, -{ - Code: 'SL5', - Path: '../src/Templates/SilverlightTemplate.csproj', - ProjectGuid: '{12B8CB9F-E397-4B5F-89AF-B6998296BFE6}', - RootNamespace: 'SilverlightTemplate', - AssemblyName: 'SilverlightTemplate', -} -/*,{ - Code: 'Android', - Path: '../src/Templates/AndroidTemplate.csproj', - ProjectGuid: '{BEA92E9F-00B1-4923-BD81-7F3A9CA24408}', - RootNamespace: 'AndroidTemplate', - AssemblyName: 'AndroidTemplate', -}, -{ - Code: 'AndroidIndie', - Path: '../src/Templates/AndroidIndieTemplate.csproj', - ProjectGuid: '{BEA92E9F-00B1-4923-BD81-7F3A9CA24408}', - RootNamespace: 'AndroidIndieTemplate', - AssemblyName: 'AndroidIndieTemplate', -}*/ -]; - -var CUSTOM_PROJS = [ -//{ -// Path: '../src/ServiceStack.Interfaces/ServiceStack.Interfaces.csproj', -// ReplaceElements: { -// ProjectGuid: '{42E1C8C0-A163-44CC-92B1-8F416F2C0B01}', -// RootNamespace: 'ServiceStack', -// AssemblyName: 'ServiceStack.Interfaces', -// }, -// ReplaceTemplate: function (code, tmpl) { -// var replaceTexts = { -// '11.0': '10.0', -// 'v4.5': 'v4.0', -// 'Profile7': 'Profile136' -// }; -// if (code == 'PCL') { -// for (var needle in replaceTexts) { -// var replaceText = replaceTexts[needle]; -// tmpl = tmpl.replace(needle, replaceText); -// } -// } -// return tmpl; -// } -//}, -{ - Path: '../../ServiceStack.Text/src/ServiceStack.Text/ServiceStack.Text.csproj', - ReplaceElements: { - ProjectGuid: '{579B3FDB-CDAD-44E1-8417-885C38E49A0E}', - RootNamespace: 'ServiceStack.Text', - AssemblyName: 'ServiceStack.Text', - } -}, -{ - Path: '../src/ServiceStack.Client/ServiceStack.Client.csproj', - ReplaceElements: { - ProjectGuid: '{42E1C8C0-A163-44CC-92B1-8F416F2C0B01}', - RootNamespace: 'ServiceStack', - AssemblyName: 'ServiceStack.Client' - }, - ReplaceTexts: { - '': [ - '', - ' ', - ' {55942102-033A-4DA8-A6AF-1DB7B2F34A2D}', - ' ServiceStack.Interfaces', - ' ', - '', - '', - ' ', - ' ..\\..\\lib\\ServiceStack.Text.dll', - ' ', - '' - ].join('\n') - }, - ReplaceTemplate: function (code, tmpl) { - if (code == 'SL5') { - //tmpl = tmpl.replace(/ServiceStack.Interfaces.SL5/g, 'ServiceStack.Interfaces'); - tmpl = tmpl.replace('..\\..\\lib\\ServiceStack.Text.dll', '..\\..\\lib\\sl5\\ServiceStack.Text.dll'); - } - else if (code == 'PCL') { - tmpl = tmpl.replace('..\\..\\lib\\ServiceStack.Text.dll', '..\\..\\lib\\pcl\\ServiceStack.Text.dll'); - } - return tmpl; - } -}]; - -var CUSTOM_MERGE_FRAGMENTS = [ - ["ItemGroup", "Compile"], - ["ItemGroup", "Content"], - ["ItemGroup", "None"] -]; - -CUSTOM_TEMPLATES.forEach(function(tmpl) { - log(tmpl.Path); - var originalTemplateXml = readTextFile(tmpl.Path); - log(originalTemplateXml); - - CUSTOM_PROJS.forEach(function (proj) { - var tmplXml = originalTemplateXml; - - Object.keys(proj.ReplaceElements || {}).forEach(function (elName) { - var from = '<' + elName + '>' + tmpl[elName] + ''; - var to = '<' + elName + '>' + proj.ReplaceElements[elName] + ''; - log('\nReplaceElements(' + from + ',' + to + ')\n'); - tmplXml = tmplXml.replace(from, to); - }); - - Object.keys(proj.ReplaceTexts || {}).forEach(function (from) { - var code = tmpl.getCode ? tmpl.getCode(proj) : tmpl.Code; - var to = proj.ReplaceTexts[from].replace(/\$Code/g, code); - log('\nReplaceTexts(' + from + ',' + to + ')\n'); - tmplXml = tmplXml.replace(new RegExp(from,'g'), to); - }); - - var xml = readTextFile(proj.Path); - log(proj.Path); - //log(xml); - - CUSTOM_MERGE_FRAGMENTS.forEach(function (seekCombo) { - var strict = false; - var parser = sax.parser(strict); - - var matches = []; - var root; - var found = false; - var comboFound = []; - - parser.onopentag = function (el) { - var tag = seekCombo[0] || ''; - var tagToMatch = tag.toUpperCase(); - - if (el.name == tagToMatch) { - - var isRoot = comboFound.length == 0; - if (isRoot) { - log("found open root <" + tag + "> at: ", this.line + ":" + this.column + ", " + this.startTagPosition); - root = { line: this.line, column: this.column, startTagPosition: this.startTagPosition }; - } - - comboFound.unshift(seekCombo.shift()); - - if (seekCombo.length == 0 && !found) { - log("found open match <" + tag + "> at: ", this.line + ":" + this.column + ", " + this.startTagPosition); - found = true; - } - } - }; - - parser.onclosetag = function (name) { - if (comboFound.length > 0) { - var tag = comboFound[0]; - var tagToMatch = tag.toUpperCase(); - - if (name == tagToMatch) { - - seekCombo.unshift(comboFound.shift()); - - if (comboFound.length == 0 && found) { - log("found close at: ", this.line + ":" + this.column + ", " + this.startTagPosition); - var match = { start: root, end: { line: this.line, column: this.column, startTagPosition: this.startTagPosition } }; - matches.push(match); - found = false; - - var startPos = match.start.startTagPosition + match.start.column; - var endPos = match.end.startTagPosition - 1; - var fragment = xml.substring(startPos, endPos); - log("fragment for " + seekCombo); - log(match); - //log(fragment); - var placeholder = ""; - var withFragment = "<" + seekCombo[0] + ">\n " + fragment + ""; - tmplXml = tmplXml.replace(placeholder, withFragment); - } - } - } - }; - - parser.write(xml); - }); - - if (proj.ReplaceTemplate) { - tmplXml = proj.ReplaceTemplate(tmpl.Code, tmplXml); - } - - var customProjPath = path.join(path.dirname(proj.Path), path.basename(proj.Path).replace(".csproj", "." + tmpl.Code + ".csproj")); - log("\nwriting transformedXml to: " + customProjPath); - log(tmplXml); - - fs.writeFileSync(customProjPath, tmplXml); - }); -}); \ No newline at end of file diff --git a/build/copy-pcl.bat b/build/copy-pcl.bat deleted file mode 100644 index b32ed042dcd..00000000000 --- a/build/copy-pcl.bat +++ /dev/null @@ -1,26 +0,0 @@ -SET MSBUILD=C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe - -REM SET BUILD=Debug -SET BUILD=Release - -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\bin\Pcl\ServiceStack.Text.* ..\lib\pcl -COPY ..\src\ServiceStack.Client\bin\Pcl\ServiceStack.Client.* ..\lib\pcl - -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\PclExport.Net40.cs ..\src\ServiceStack.Pcl.Android -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\PclExport.Net40.cs ..\src\ServiceStack.Pcl.Ios -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\PclExport.Net40.cs ..\src\ServiceStack.Pcl.Net45 -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\PclExport.WinStore.cs ..\src\ServiceStack.Pcl.WinStore - -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\Pcl.* ..\src\ServiceStack.Pcl.Android -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\Pcl.* ..\src\ServiceStack.Pcl.Ios -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\Pcl.* ..\src\ServiceStack.Pcl.Net45 -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\Pcl.* ..\src\ServiceStack.Pcl.WinStore - -COPY ..\src\ServiceStack.Client\Pcl.NameValueCollectionWrapper.cs ..\src\ServiceStack.Pcl.Android -COPY ..\src\ServiceStack.Client\PclExportClient.Android.cs ..\src\ServiceStack.Pcl.Android -COPY ..\src\ServiceStack.Client\Pcl.NameValueCollectionWrapper.cs ..\src\ServiceStack.Pcl.iOS -COPY ..\src\ServiceStack.Client\PclExportClient.iOS.cs ..\src\ServiceStack.Pcl.iOS -COPY ..\src\ServiceStack.Client\Pcl.NameValueCollectionWrapper.cs ..\src\ServiceStack.Pcl.Net45 -COPY ..\src\ServiceStack.Client\PclExportClient.Net40.cs ..\src\ServiceStack.Pcl.Net45 -REM COPY ..\src\ServiceStack.Client\Pcl.NameValueCollectionWrapper.cs ..\src\ServiceStack.Pcl.WinStore //Not Required -COPY ..\src\ServiceStack.Client\PclExportClient.WinStore.cs ..\src\ServiceStack.Pcl.WinStore diff --git a/build/copy-sn.bat b/build/copy-sn.bat deleted file mode 100644 index 9d32a6c520f..00000000000 --- a/build/copy-sn.bat +++ /dev/null @@ -1,20 +0,0 @@ -SET BUILD=Signed - -COPY ..\src\ServiceStack.Common\bin\%BUILD%\ServiceStack.Common.dll ..\lib\signed -COPY ..\src\ServiceStack.Common\bin\%BUILD%\ServiceStack.Common.dll ..\..\ServiceStack.Redis\lib\signed -COPY ..\src\ServiceStack.Common\bin\%BUILD%\ServiceStack.Common.dll ..\..\ServiceStack.OrmLite\lib\signed - -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\bin\%BUILD%\ServiceStack.Text.dll ..\lib\signed -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\bin\%BUILD%\ServiceStack.Text.dll ..\..\ServiceStack.Redis\lib\signed -COPY ..\..\ServiceStack.Text\src\ServiceStack.Text\bin\%BUILD%\ServiceStack.Text.dll ..\..\ServiceStack.OrmLite\lib\signed - -COPY ..\src\ServiceStack.Client\bin\%BUILD%\ServiceStack.Client.dll ..\lib\signed - -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.dll ..\lib\signed - -COPY ..\..\ServiceStack.OrmLite\src\ServiceStack.OrmLite\bin\%BUILD%\ServiceStack.OrmLite.dll ..\lib\signed -COPY ..\..\ServiceStack.OrmLite\src\ServiceStack.OrmLite\bin\%BUILD%\ServiceStack.OrmLite.dll ..\..\ServiceStack.OrmLite\lib\signed - -COPY ..\..\ServiceStack.Redis\src\ServiceStack.Redis\bin\%BUILD%\ServiceStack.Redis.dll ..\lib\signed -COPY ..\..\ServiceStack.OrmLite\src\ServiceStack.OrmLite.SqlServer\bin\%BUILD%\ServiceStack.OrmLite.SqlServer.dll ..\lib\signed - diff --git a/build/copy.bat b/build/copy.bat deleted file mode 100644 index 15191b35ab1..00000000000 --- a/build/copy.bat +++ /dev/null @@ -1,82 +0,0 @@ -SET MSBUILD=C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe - -REM SET BUILD=Debug -SET BUILD=Release - -REM %MSBUILD% build.msbuild - -MD ..\NuGet\ServiceStack\lib\net40 -MD ..\NuGet\ServiceStack.Api.Swagger\lib\net40 -MD ..\NuGet\ServiceStack.Common\lib\net40 -MD ..\NuGet\ServiceStack.Mvc\lib\net40 -MD ..\NuGet\ServiceStack.Razor\lib\net40 -MD ..\NuGet\ServiceStack.Authentication.OpenId\lib\net40 -MD ..\NuGet\ServiceStack.Authentication.OAuth2\lib\net40 -MD ..\NuGet\ServiceStack.ProtoBuf\lib\net40 -MD ..\NuGet\ServiceStack.MsgPack\lib\net40 - -COPY ..\src\ServiceStack.Razor\bin\%BUILD%\ServiceStack.Razor.* ..\NuGet\ServiceStack.Razor\lib\net40 - -COPY ..\src\ServiceStack.Mvc\bin\%BUILD%\ServiceStack.Mvc.* ..\NuGet\ServiceStack.Mvc\lib\net40 -COPY ..\src\ServiceStack.Mvc\bin\%BUILD%\ServiceStack.Mvc.* ..\NuGet\ServiceStack.Mvc\lib\net40 - -COPY ..\src\ServiceStack.Authentication.OpenId\bin\%BUILD%\ServiceStack.Authentication.OpenId.* ..\NuGet\ServiceStack.Authentication.OpenId\lib\net40 - -COPY ..\src\ServiceStack.Authentication.OAuth2\bin\%BUILD%\ServiceStack.Authentication.OAuth2.* ..\NuGet\ServiceStack.Authentication.OAuth2\lib\net40 - -COPY ..\src\ServiceStack.ProtoBuf\bin\%BUILD%\ServiceStack.ProtoBuf.* ..\NuGet\ServiceStack.ProtoBuf\lib\net40 - -COPY ..\lib\MsgPack.dll ..\NuGet\ServiceStack.MsgPack\lib\net40 -COPY ..\src\ServiceStack.MsgPack\bin\%BUILD%\ServiceStack.MsgPack.* ..\NuGet\ServiceStack.MsgPack\lib\net40 - -IF EXIST ..\..\swagger-ui\dist-disable ( - RMDIR ..\NuGet\ServiceStack.Api.Swagger\content\swagger-ui /s /q - MD ..\NuGet\ServiceStack.Api.Swagger\content\swagger-ui - - RMDIR ..\src\ServiceStack.Api.Swagger\swagger-ui /s /q - MD ..\src\ServiceStack.Api.Swagger\swagger-ui - - XCOPY /E ..\..\swagger-ui\dist ..\src\ServiceStack.Api.Swagger\swagger-ui -) - -COPY ..\src\ServiceStack.Api.Swagger\bin\%BUILD%\ServiceStack.Api.Swagger.* ..\NuGet\ServiceStack.Api.Swagger\lib\net35 - -COPY ..\src\ServiceStack\bin\%BUILD%\*.* ..\..\ServiceStack.Contrib\lib -COPY ..\src\ServiceStack\bin\%BUILD%\*.* ..\..\ServiceStack.RedisWebServices\lib -COPY ..\src\ServiceStack.Server\bin\%BUILD%\ServiceStack.Server.* ..\..\ServiceStack.RedisWebServices\lib - -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.Text.* ..\..\ServiceStack.Redis\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.Common.* ..\..\ServiceStack.Redis\lib -COPY ..\src\ServiceStack.Server\bin\%BUILD%\ServiceStack.* ..\..\ServiceStack.Redis\lib\tests -COPY ..\tests\ServiceStack.Messaging.Tests\bin\%BUILD%\ServiceStack.Messaging.Tests.* ..\..\ServiceStack.Redis\lib\tests - -COPY ..\tests\ServiceStack.Common.Tests\bin\%BUILD%\ServiceStack.Common.Tests.* ..\..\ServiceStack.Text\lib\tests -COPY ..\tests\ServiceStack.Common.Tests\bin\%BUILD%\ServiceStack.Common.Tests.* ..\..\ServiceStack.Redis\lib\tests -COPY ..\tests\ServiceStack.Common.Tests\bin\%BUILD%\ServiceStack.Common.Tests.* ..\..\ServiceStack.OrmLite\lib\tests -COPY ..\src\ServiceStack.Server\bin\%BUILD%\ServiceStack.* ..\..\ServiceStack.Text\lib\tests -COPY ..\src\ServiceStack.Server\bin\%BUILD%\ServiceStack.* ..\..\ServiceStack.Rediss\lib\tests -COPY ..\src\ServiceStack.Server\bin\%BUILD%\ServiceStack.* ..\..\ServiceStack.OrmLite\lib\tests - -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.dll ..\..\ServiceStack.OrmLite\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.pdb ..\..\ServiceStack.OrmLite\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.Text.dll ..\..\ServiceStack.OrmLite\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.Text.pdb ..\..\ServiceStack.OrmLite\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.Common.dll ..\..\ServiceStack.OrmLite\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.Common.pdb ..\..\ServiceStack.OrmLite\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.Client.dll ..\..\ServiceStack.OrmLite\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.Client.pdb ..\..\ServiceStack.OrmLite\lib -COPY ..\tests\ServiceStack.Common.Tests\bin\%BUILD%\ServiceStack.Common.Tests.* ..\..\ServiceStack.OrmLite\lib\tests - -COPY ..\src\ServiceStack.Interfaces\bin\Pcl\ServiceStack.Interfaces.* ..\lib -COPY ..\src\ServiceStack.Common\bin\%BUILD%\ServiceStack.Common.* ..\lib -COPY ..\src\ServiceStack.Client\bin\%BUILD%\ServiceStack.Client.* ..\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.dll ..\lib -COPY ..\src\ServiceStack\bin\%BUILD%\ServiceStack.pdb ..\lib - -COPY ..\lib\ServiceStack.Interfaces.dll ..\..\ServiceStack.Text\lib -COPY ..\lib\ServiceStack.Interfaces.dll ..\..\ServiceStack.Redis\lib -COPY ..\lib\ServiceStack.Interfaces.dll ..\..\ServiceStack.OrmLite\lib - -COPY ..\src\ServiceStack.Razor.BuildTask\bin\%BUILD%\ServiceStack.Razor.BuildTask.dll ..\lib - -REM COPY ..\src\ServiceStack.DtoGen\*.cs ..\src\ServiceStack\DtoGen diff --git a/build/node.exe b/build/node.exe deleted file mode 100644 index a139fd213e8..00000000000 Binary files a/build/node.exe and /dev/null differ diff --git a/build/node_modules/sax/AUTHORS b/build/node_modules/sax/AUTHORS deleted file mode 100644 index 7145cbcd99c..00000000000 --- a/build/node_modules/sax/AUTHORS +++ /dev/null @@ -1,10 +0,0 @@ -# contributors sorted by whether or not they're me. -Isaac Z. Schlueter -Stein Martin Hustad -Mikeal Rogers -Laurie Harper -Jann Horn -Elijah Insua -Henry Rawas -Justin Makeig -Mike Schilling diff --git a/build/node_modules/sax/LICENSE b/build/node_modules/sax/LICENSE deleted file mode 100644 index 62e4ccf916e..00000000000 --- a/build/node_modules/sax/LICENSE +++ /dev/null @@ -1,32 +0,0 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. - -The BSD License - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -The file "examples/strict.dtd" is licensed by the W3C and used according -to the terms of the W3C SOFTWARE NOTICE AND LICENSE. See LICENSE-W3C.html -for details. diff --git a/build/node_modules/sax/LICENSE-W3C.html b/build/node_modules/sax/LICENSE-W3C.html deleted file mode 100644 index a611e3f907f..00000000000 --- a/build/node_modules/sax/LICENSE-W3C.html +++ /dev/null @@ -1,188 +0,0 @@ - -W3C Software Notice and License
      - - - -
      -

      - W3C - -

      - -
      - - - -
      -
      - -
      - - -
      -
      - -
      - - -
      -
      -
      - -
      -
      -

      W3C Software Notice and License

      -
      -
      -

      This work (and included software, documentation such as READMEs, or other -related items) is being provided by the copyright holders under the following -license.

      -

      License

      - -

      -By obtaining, using and/or copying this work, you (the licensee) -agree that you have read, understood, and will comply with the following -terms and conditions.

      - -

      Permission to copy, modify, and distribute this software and its -documentation, with or without modification, for any purpose and without -fee or royalty is hereby granted, provided that you include the following on -ALL copies of the software and documentation or portions thereof, including -modifications:

      - -
      • The full text of this NOTICE in a location viewable to users of the - redistributed or derivative work.
      • Any pre-existing intellectual property disclaimers, notices, or terms - and conditions. If none exist, the W3C Software Short - Notice should be included (hypertext is preferred, text is permitted) - within the body of any redistributed or derivative code.
      • Notice of any changes or modifications to the files, including the date - changes were made. (We recommend you provide URIs to the location from - which the code is derived.)
      - -

      Disclaimers

      - -

      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS -MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR -PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE -ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

      - -

      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR -DOCUMENTATION.

      - -

      The name and trademarks of copyright holders may NOT be used in -advertising or publicity pertaining to the software without specific, written -prior permission. Title to copyright in this software and any associated -documentation will at all times remain with copyright holders.

      - -

      Notes

      - -

      This version: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231

      - -

      This formulation of W3C's notice and license became active on December 31 -2002. This version removes the copyright ownership notice such that this -license can be used with materials other than those owned by the W3C, -reflects that ERCIM is now a host of the W3C, includes references to this -specific dated version of the license, and removes the ambiguous grant of -"use". Otherwise, this version is the same as the previous -version and is written so as to preserve the Free -Software Foundation's assessment of GPL compatibility and OSI's certification -under the Open Source -Definition.

      -
      -
      -
      -
      - - - -
      - -
      diff --git a/build/node_modules/sax/README.md b/build/node_modules/sax/README.md deleted file mode 100644 index c9652420c1a..00000000000 --- a/build/node_modules/sax/README.md +++ /dev/null @@ -1,216 +0,0 @@ -# sax js - -A sax-style parser for XML and HTML. - -Designed with [node](http://nodejs.org/) in mind, but should work fine in -the browser or other CommonJS implementations. - -## What This Is - -* A very simple tool to parse through an XML string. -* A stepping stone to a streaming HTML parser. -* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML - docs. - -## What This Is (probably) Not - -* An HTML Parser - That's a fine goal, but this isn't it. It's just - XML. -* A DOM Builder - You can use it to build an object model out of XML, - but it doesn't do that out of the box. -* XSLT - No DOM = no querying. -* 100% Compliant with (some other SAX implementation) - Most SAX - implementations are in Java and do a lot more than this does. -* An XML Validator - It does a little validation when in strict mode, but - not much. -* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic - masochism. -* A DTD-aware Thing - Fetching DTDs is a much bigger job. - -## Regarding `Hello, world!').close(); - - // stream usage - // takes the same options as the parser - var saxStream = require("sax").createStream(strict, options) - saxStream.on("error", function (e) { - // unhandled errors will throw, since this is a proper node - // event emitter. - console.error("error!", e) - // clear the error - this._parser.error = null - this._parser.resume() - }) - saxStream.on("opentag", function (node) { - // same object as above - }) - // pipe is supported, and it's readable/writable - // same chunks coming in also go out. - fs.createReadStream("file.xml") - .pipe(saxStream) - .pipe(fs.createWriteStream("file-copy.xml")) - - - -## Arguments - -Pass the following arguments to the parser function. All are optional. - -`strict` - Boolean. Whether or not to be a jerk. Default: `false`. - -`opt` - Object bag of settings regarding string formatting. All default to `false`. - -Settings supported: - -* `trim` - Boolean. Whether or not to trim text and comment nodes. -* `normalize` - Boolean. If true, then turn any whitespace into a single - space. -* `lowercase` - Boolean. If true, then lowercase tag names and attribute names - in loose mode, rather than uppercasing them. -* `xmlns` - Boolean. If true, then namespaces are supported. -* `position` - Boolean. If false, then don't track line/col/position. - -## Methods - -`write` - Write bytes onto the stream. You don't have to do this all at -once. You can keep writing as much as you want. - -`close` - Close the stream. Once closed, no more data may be written until -it is done processing the buffer, which is signaled by the `end` event. - -`resume` - To gracefully handle errors, assign a listener to the `error` -event. Then, when the error is taken care of, you can call `resume` to -continue parsing. Otherwise, the parser will not continue while in an error -state. - -## Members - -At all times, the parser object will have the following members: - -`line`, `column`, `position` - Indications of the position in the XML -document where the parser currently is looking. - -`startTagPosition` - Indicates the position where the current tag starts. - -`closed` - Boolean indicating whether or not the parser can be written to. -If it's `true`, then wait for the `ready` event to write again. - -`strict` - Boolean indicating whether or not the parser is a jerk. - -`opt` - Any options passed into the constructor. - -`tag` - The current tag being dealt with. - -And a bunch of other stuff that you probably shouldn't touch. - -## Events - -All events emit with a single argument. To listen to an event, assign a -function to `on`. Functions get executed in the this-context of -the parser object. The list of supported events are also in the exported -`EVENTS` array. - -When using the stream interface, assign handlers using the EventEmitter -`on` function in the normal fashion. - -`error` - Indication that something bad happened. The error will be hanging -out on `parser.error`, and must be deleted before parsing can continue. By -listening to this event, you can keep an eye on that kind of stuff. Note: -this happens *much* more in strict mode. Argument: instance of `Error`. - -`text` - Text node. Argument: string of text. - -`doctype` - The ``. Argument: -object with `name` and `body` members. Attributes are not parsed, as -processing instructions have implementation dependent semantics. - -`sgmldeclaration` - Random SGML declarations. Stuff like `` -would trigger this kind of event. This is a weird thing to support, so it -might go away at some point. SAX isn't intended to be used to parse SGML, -after all. - -`opentag` - An opening tag. Argument: object with `name` and `attributes`. -In non-strict mode, tag names are uppercased, unless the `lowercase` -option is set. If the `xmlns` option is set, then it will contain -namespace binding information on the `ns` member, and will have a -`local`, `prefix`, and `uri` member. - -`closetag` - A closing tag. In loose mode, tags are auto-closed if their -parent closes. In strict mode, well-formedness is enforced. Note that -self-closing tags will have `closeTag` emitted immediately after `openTag`. -Argument: tag name. - -`attribute` - An attribute node. Argument: object with `name` and `value`. -In non-strict mode, attribute names are uppercased, unless the `lowercase` -option is set. If the `xmlns` option is set, it will also contains namespace -information. - -`comment` - A comment node. Argument: the string of the comment. - -`opencdata` - The opening tag of a ``) of a `` tags trigger a `"script"` -event, and their contents are not checked for special xml characters. -If you pass `noscript: true`, then this behavior is suppressed. - -## Reporting Problems - -It's best to write a failing test if you find an issue. I will always -accept pull requests with failing tests if they demonstrate intended -behavior, but it is very hard to figure out what issue you're describing -without a test. Writing a test is also the best way for you yourself -to figure out if you really understand the issue you think you have with -sax-js. diff --git a/build/node_modules/sax/component.json b/build/node_modules/sax/component.json deleted file mode 100644 index 96b5d731d09..00000000000 --- a/build/node_modules/sax/component.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "sax", - "description": "An evented streaming XML parser in JavaScript", - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "version": "0.5.2", - "main": "lib/sax.js", - "license": "BSD", - "scripts": [ - "lib/sax.js" - ], - "repository": "git://github.com/isaacs/sax-js.git" -} diff --git a/build/node_modules/sax/examples/big-not-pretty.xml b/build/node_modules/sax/examples/big-not-pretty.xml deleted file mode 100644 index fb5265dde1a..00000000000 --- a/build/node_modules/sax/examples/big-not-pretty.xml +++ /dev/null @@ -1,8002 +0,0 @@ - - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - - something blerm a bit down here - diff --git a/build/node_modules/sax/examples/example.js b/build/node_modules/sax/examples/example.js deleted file mode 100644 index 7b0246e9ab5..00000000000 --- a/build/node_modules/sax/examples/example.js +++ /dev/null @@ -1,29 +0,0 @@ - -var fs = require("fs"), - util = require("util"), - path = require("path"), - xml = fs.readFileSync(path.join(__dirname, "test.xml"), "utf8"), - sax = require("../lib/sax"), - strict = sax.parser(true), - loose = sax.parser(false, {trim:true}), - inspector = function (ev) { return function (data) { - console.error("%s %s %j", this.line+":"+this.column, ev, data); - }}; - -sax.EVENTS.forEach(function (ev) { - loose["on"+ev] = inspector(ev); -}); -loose.onend = function () { - console.error("end"); - console.error(loose); -}; - -// do this in random bits at a time to verify that it works. -(function () { - if (xml) { - var c = Math.ceil(Math.random() * 1000) - loose.write(xml.substr(0,c)); - xml = xml.substr(c); - process.nextTick(arguments.callee); - } else loose.close(); -})(); diff --git a/build/node_modules/sax/examples/get-products.js b/build/node_modules/sax/examples/get-products.js deleted file mode 100644 index 9e8d74aacd0..00000000000 --- a/build/node_modules/sax/examples/get-products.js +++ /dev/null @@ -1,58 +0,0 @@ -// pull out /GeneralSearchResponse/categories/category/items/product tags -// the rest we don't care about. - -var sax = require("../lib/sax.js") -var fs = require("fs") -var path = require("path") -var xmlFile = path.resolve(__dirname, "shopping.xml") -var util = require("util") -var http = require("http") - -fs.readFile(xmlFile, function (er, d) { - http.createServer(function (req, res) { - if (er) throw er - var xmlstr = d.toString("utf8") - - var parser = sax.parser(true) - var products = [] - var product = null - var currentTag = null - - parser.onclosetag = function (tagName) { - if (tagName === "product") { - products.push(product) - currentTag = product = null - return - } - if (currentTag && currentTag.parent) { - var p = currentTag.parent - delete currentTag.parent - currentTag = p - } - } - - parser.onopentag = function (tag) { - if (tag.name !== "product" && !product) return - if (tag.name === "product") { - product = tag - } - tag.parent = currentTag - tag.children = [] - tag.parent && tag.parent.children.push(tag) - currentTag = tag - } - - parser.ontext = function (text) { - if (currentTag) currentTag.children.push(text) - } - - parser.onend = function () { - var out = util.inspect(products, false, 3, true) - res.writeHead(200, {"content-type":"application/json"}) - res.end("{\"ok\":true}") - // res.end(JSON.stringify(products)) - } - - parser.write(xmlstr).end() - }).listen(1337) -}) diff --git a/build/node_modules/sax/examples/hello-world.js b/build/node_modules/sax/examples/hello-world.js deleted file mode 100644 index cbfa5184ecd..00000000000 --- a/build/node_modules/sax/examples/hello-world.js +++ /dev/null @@ -1,4 +0,0 @@ -require("http").createServer(function (req, res) { - res.writeHead(200, {"content-type":"application/json"}) - res.end(JSON.stringify({ok: true})) -}).listen(1337) diff --git a/build/node_modules/sax/examples/not-pretty.xml b/build/node_modules/sax/examples/not-pretty.xml deleted file mode 100644 index 9592852d0c0..00000000000 --- a/build/node_modules/sax/examples/not-pretty.xml +++ /dev/null @@ -1,8 +0,0 @@ - - something blerm a bit down here diff --git a/build/node_modules/sax/examples/pretty-print.js b/build/node_modules/sax/examples/pretty-print.js deleted file mode 100644 index cd6aca9e1cb..00000000000 --- a/build/node_modules/sax/examples/pretty-print.js +++ /dev/null @@ -1,74 +0,0 @@ -var sax = require("../lib/sax") - , printer = sax.createStream(false, {lowercasetags:true, trim:true}) - , fs = require("fs") - -function entity (str) { - return str.replace('"', '"') -} - -printer.tabstop = 2 -printer.level = 0 -printer.indent = function () { - print("\n") - for (var i = this.level; i > 0; i --) { - for (var j = this.tabstop; j > 0; j --) { - print(" ") - } - } -} -printer.on("opentag", function (tag) { - this.indent() - this.level ++ - print("<"+tag.name) - for (var i in tag.attributes) { - print(" "+i+"=\""+entity(tag.attributes[i])+"\"") - } - print(">") -}) - -printer.on("text", ontext) -printer.on("doctype", ontext) -function ontext (text) { - this.indent() - print(text) -} - -printer.on("closetag", function (tag) { - this.level -- - this.indent() - print("") -}) - -printer.on("cdata", function (data) { - this.indent() - print("") -}) - -printer.on("comment", function (comment) { - this.indent() - print("") -}) - -printer.on("error", function (error) { - console.error(error) - throw error -}) - -if (!process.argv[2]) { - throw new Error("Please provide an xml file to prettify\n"+ - "TODO: read from stdin or take a file") -} -var xmlfile = require("path").join(process.cwd(), process.argv[2]) -var fstr = fs.createReadStream(xmlfile, { encoding: "utf8" }) - -function print (c) { - if (!process.stdout.write(c)) { - fstr.pause() - } -} - -process.stdout.on("drain", function () { - fstr.resume() -}) - -fstr.pipe(printer) diff --git a/build/node_modules/sax/examples/shopping.xml b/build/node_modules/sax/examples/shopping.xml deleted file mode 100644 index 223c6c66562..00000000000 --- a/build/node_modules/sax/examples/shopping.xml +++ /dev/null @@ -1,2 +0,0 @@ - -sandbox3.1 r31.Kadu4DC.phase357782011.10.06 15:37:23 PSTp2.a121bc2aaf029435dce62011-10-21T18:38:45.982-04:00P0Y0M0DT0H0M0.169S1112You are currently using the SDC API sandbox environment! No clicks to merchant URLs from this response will be paid. Please change the host of your API requests to 'publisher.api.shopping.com' when you have finished development and testinghttp://statTest.dealtime.com/pixel/noscript?PV_EvnTyp=APPV&APPV_APITSP=10%2F21%2F11_06%3A38%3A45_PM&APPV_DSPRQSID=p2.a121bc2aaf029435dce6&APPV_IMGURL=http://img.shopping.com/sc/glb/sdc_logo_106x19.gif&APPV_LI_LNKINID=7000610&APPV_LI_SBMKYW=nikon&APPV_MTCTYP=1000&APPV_PRTID=2002&APPV_BrnID=14804http://www.shopping.com/digital-cameras/productsDigital CamerasDigital CamerasElectronicshttp://www.shopping.com/xCH-electronics-nikon~linkin_id-7000610?oq=nikonCameras and Photographyhttp://www.shopping.com/xCH-cameras_and_photography-nikon~linkin_id-7000610?oq=nikonDigital Camerashttp://www.shopping.com/digital-cameras/nikon/products?oq=nikon&linkin_id=7000610nikonnikonDigital Camerashttp://www.shopping.com/digital-cameras/nikon/products?oq=nikon&linkin_id=7000610Nikon D3100 Digital Camera14.2 Megapixel, SLR Camera, 3 in. LCD Screen, With High Definition Video, Weight: 1 lb.The Nikon D3100 digital SLR camera speaks to the growing ranks of enthusiastic D-SLR users and aspiring photographers by providing an easy-to-use and affordable entrance to the world of Nikon D-SLR’s. The 14.2-megapixel D3100 has powerful features, such as the enhanced Guide Mode that makes it easy to unleash creative potential and capture memories with still images and full HD video. Like having a personal photo tutor at your fingertips, this unique feature provides a simple graphical interface on the camera’s LCD that guides users by suggesting and/or adjusting camera settings to achieve the desired end result images. The D3100 is also the world’s first D-SLR to introduce full time auto focus (AF) in Live View and D-Movie mode to effortlessly achieve the critical focus needed when shooting Full HD 1080p video.http://di1.shopping.com/images/pi/93/bc/04/101677489-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=1http://di1.shopping.com/images/pi/93/bc/04/101677489-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=1http://di1.shopping.com/images/pi/93/bc/04/101677489-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=1http://di1.shopping.com/images/pi/93/bc/04/101677489-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=1http://di1.shopping.com/images/pi/93/bc/04/101677489-606x500-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=194.56http://img.shopping.com/sc/pr/sdc_stars_sm_4.5.gifhttp://www.shopping.com/Nikon-D3100/reviews~linkin_id-7000610429.001360.00http://www.shopping.com/Nikon-D3100/prices~linkin_id-7000610http://www.shopping.com/Nikon-D3100/info~linkin_id-7000610Nikon D3100 Digital SLR Camera with 18-55mm NIKKOR VR LensThe Nikon D3100 Digital SLR Camera is an affordable compact and lightweight photographic power-house. It features the all-purpose 18-55mm VR lens a high-resolution 14.2 MP CMOS sensor along with a feature set that's comprehensive yet easy to navigate - the intuitive onboard learn-as-you grow guide mode allows the photographer to understand what the 3100 can do quickly and easily. Capture beautiful pictures and amazing Full HD 1080p movies with sound and full-time autofocus. Availabilty: In Stock!7185Nikonhttp://di102.shopping.com/images/di/2d/5a/57/36424d5a717a366662532d61554c7767615f67-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di102.shopping.com/images/di/2d/5a/57/36424d5a717a366662532d61554c7767615f67-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di102.shopping.com/images/di/2d/5a/57/36424d5a717a366662532d61554c7767615f67-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di102.shopping.com/images/di/2d/5a/57/36424d5a717a366662532d61554c7767615f67-350x350-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1in-stockFree Shipping with Any Purchase!529.000.00799.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=647&BEFID=7185&aon=%5E1&MerchantID=475674&crawler_id=475674&dealId=-ZW6BMZqz6fbS-aULwga_g%3D%3D&url=http%3A%2F%2Fwww.fumfie.com%2Fproduct%2F343.5%2Fshopping-com%3F&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D3100+Digital+SLR+Camera+with+18-55mm+NIKKOR+VR+Lens&dlprc=529.0&crn=&istrsmrc=1&isathrsl=0&AR=1&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=101677489&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=1&cid=&semid1=&semid2=&IsLps=0&CC=1&SL=1&FS=1&code=&acode=658&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=FumFiehttp://img.shopping.com/cctool/merch_logos/475674.gif866 666 91985604.27http://img.shopping.com/sc/mr/sdc_checks_45.gifhttp://www.shopping.com/xMR-store_fumfie~MRD-475674~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUSF343C5Nikon Nikon D3100 14.2MP Digital SLR Camera with 18-55mm f/3.5-5.6 AF-S DX VR, CamerasNikon D3100 14.2MP Digital SLR Camera with 18-55mm f/3.5-5.6 AF-S DX VR7185Nikonhttp://di109.shopping.com/images/di/6d/64/31/65396c443876644f7534464851664a714b6e67-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di109.shopping.com/images/di/6d/64/31/65396c443876644f7534464851664a714b6e67-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di109.shopping.com/images/di/6d/64/31/65396c443876644f7534464851664a714b6e67-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di109.shopping.com/images/di/6d/64/31/65396c443876644f7534464851664a714b6e67-385x352-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2in-stock549.000.00549.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=779&BEFID=7185&aon=%5E1&MerchantID=305814&crawler_id=305814&dealId=md1e9lD8vdOu4FHQfJqKng%3D%3D&url=http%3A%2F%2Fwww.electronics-expo.com%2Findex.php%3Fpage%3Ditem%26id%3DNIKD3100%26source%3DSideCar%26scpid%3D8%26scid%3Dscsho318727%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+Nikon+D3100+14.2MP+Digital+SLR+Camera+with+18-55mm+f%2F3.5-5.6+AF-S+DX+VR%2C+Cameras&dlprc=549.0&crn=&istrsmrc=1&isathrsl=0&AR=9&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=101677489&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=9&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=1&code=&acode=771&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=Electronics Expohttp://img.shopping.com/cctool/merch_logos/305814.gif1-888-707-EXPO3713.90http://img.shopping.com/sc/mr/sdc_checks_4.gifhttp://www.shopping.com/xMR-store_electronics_expo~MRD-305814~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUSNIKD3100Nikon D3100 14.2-Megapixel Digital SLR Camera With 18-55mm Zoom-Nikkor Lens, BlackSplit-second shutter response captures shots other cameras may have missed Helps eliminate the frustration of shutter delay! 14.2-megapixels for enlargements worth framing and hanging. Takes breathtaking 1080p HD movies. ISO sensitivity from 100-1600 for bright or dimly lit settings. 3.0in. color LCD for beautiful, wide-angle framing and viewing. In-camera image editing lets you retouch with no PC. Automatic scene modes include Child, Sports, Night Portrait and more. Accepts SDHC memory cards. Nikon D3100 14.2-Megapixel Digital SLR Camera With 18-55mm Zoom-Nikkor Lens, Black is one of many Digital SLR Cameras available through Office Depot. Made by Nikon.7185Nikonhttp://di109.shopping.com/images/di/79/59/75/61586e4446744359377244556a6b5932616177-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di109.shopping.com/images/di/79/59/75/61586e4446744359377244556a6b5932616177-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di109.shopping.com/images/di/79/59/75/61586e4446744359377244556a6b5932616177-250x250-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3in-stock549.990.00699.99http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=698&BEFID=7185&aon=%5E1&MerchantID=467671&crawler_id=467671&dealId=yYuaXnDFtCY7rDUjkY2aaw%3D%3D&url=http%3A%2F%2Flink.mercent.com%2Fredirect.ashx%3Fmr%3AmerchantID%3DOfficeDepot%26mr%3AtrackingCode%3DCEC9669E-6ABC-E011-9F24-0019B9C043EB%26mr%3AtargetUrl%3Dhttp%3A%2F%2Fwww.officedepot.com%2Fa%2Fproducts%2F486292%2FNikon-D3100-142-Megapixel-Digital-SLR%2F%253fcm_mmc%253dMercent-_-Shopping-_-Cameras_and_Camcorders-_-486292&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D3100+14.2-Megapixel+Digital+SLR+Camera+With+18-55mm+Zoom-Nikkor+Lens%2C+Black&dlprc=549.99&crn=&istrsmrc=1&isathrsl=0&AR=10&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=101677489&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=10&cid=&semid1=&semid2=&IsLps=0&CC=1&SL=1&FS=1&code=&acode=690&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=Office Depothttp://img.shopping.com/cctool/merch_logos/467671.gif1-800-GO-DEPOT1352.37http://img.shopping.com/sc/mr/sdc_checks_25.gifhttp://www.shopping.com/xMR-store_office_depot_4158555~MRD-467671~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS486292Nikon® D3100™ 14.2MP Digital SLR with 18-55mm LensThe Nikon D3100 DSLR will surprise you with its simplicity and impress you with superb results.7185Nikonhttp://di103.shopping.com/images/di/52/6c/35/36553743756954597348344d475a30326c7851-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://di103.shopping.com/images/di/52/6c/35/36553743756954597348344d475a30326c7851-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://di103.shopping.com/images/di/52/6c/35/36553743756954597348344d475a30326c7851-220x220-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4in-stock549.996.05549.99http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=504&BEFID=7185&aon=%5E1&MerchantID=332477&crawler_id=332477&dealId=Rl56U7CuiTYsH4MGZ02lxQ%3D%3D&url=http%3A%2F%2Ftracking.searchmarketing.com%2Fgsic.asp%3Faid%3D903483107%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon%C2%AE+D3100%E2%84%A2+14.2MP+Digital+SLR+with+18-55mm+Lens&dlprc=549.99&crn=&istrsmrc=0&isathrsl=0&AR=11&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=101677489&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=11&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=0&code=&acode=496&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=RadioShackhttp://img.shopping.com/cctool/merch_logos/332477.gif242.25http://img.shopping.com/sc/mr/sdc_checks_25.gifhttp://www.shopping.com/xMR-store_radioshack_9689~MRD-332477~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS9614867Nikon D3100 SLR w/Nikon 18-55mm VR & 55-200mm VR Lenses14.2 Megapixels3" LCDLive ViewHD 1080p Video w/ Sound & Autofocus11-point Autofocus3 Frames per Second ShootingISO 100 to 3200 (Expand to 12800-Hi2)Self Cleaning SensorEXPEED 2, Image Processing EngineScene Recognition System7185Nikonhttp://di105.shopping.com/images/di/68/75/53/36785a4b444b614b4d544d5037316549364441-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di105.shopping.com/images/di/68/75/53/36785a4b444b614b4d544d5037316549364441-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di105.shopping.com/images/di/68/75/53/36785a4b444b614b4d544d5037316549364441-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di105.shopping.com/images/di/68/75/53/36785a4b444b614b4d544d5037316549364441-345x345-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5in-stock695.000.00695.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=371&BEFID=7185&aon=%5E1&MerchantID=487342&crawler_id=487342&dealId=huS6xZKDKaKMTMP71eI6DA%3D%3D&url=http%3A%2F%2Fwww.rythercamera.com%2Fcatalog%2Fproduct_info.php%3Fcsv%3Dsh%26products_id%3D32983%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D3100+SLR+w%2FNikon+18-55mm+VR+%26+55-200mm+VR+Lenses&dlprc=695.0&crn=&istrsmrc=0&isathrsl=0&AR=15&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=101677489&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=15&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=1&code=&acode=379&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=RytherCamera.comhttp://img.shopping.com/cctool/merch_logos/487342.gif1-877-644-75930http://img.shopping.com/sc/glb/flag/US.gifUS32983Nikon COOLPIX S203 Digital Camera10 Megapixel, Ultra-Compact Camera, 2.5 in. LCD Screen, 3x Optical Zoom, With Video Capability, Weight: 0.23 lb.With 10.34 mega pixel, electronic VR vibration reduction, 5-level brightness adjustment, 3x optical zoom, and TFT LCD, Nikon Coolpix s203 fulfills all the demands of any photographer. The digital camera has an inbuilt memory of 44MB and an external memory slot made for all kinds of SD (Secure Digital) cards.http://di1.shopping.com/images/pi/c4/ef/1b/95397883-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=2http://di1.shopping.com/images/pi/c4/ef/1b/95397883-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=2http://di1.shopping.com/images/pi/c4/ef/1b/95397883-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=2http://di1.shopping.com/images/pi/c4/ef/1b/95397883-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=2http://di1.shopping.com/images/pi/c4/ef/1b/95397883-500x499-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=20139.00139.00http://www.shopping.com/Nikon-Coolpix-S203/prices~linkin_id-7000610http://www.shopping.com/Nikon-Coolpix-S203/info~linkin_id-7000610Nikon Coolpix S203 Digital Camera (Red)With 10.34 mega pixel, electronic VR vibration reduction, 5-level brightness adjustment, 3x optical zoom, and TFT LCD, Nikon Coolpix s203 fulfills all the demands of any photographer. The digital camera has an inbuilt memory of 44MB and an external memory slot made for all kinds of SD (Secure Digital) cards.7185Nikonhttp://di108.shopping.com/images/di/73/42/64/324a6e4945504d2d415f6c42414d31525a6751-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di108.shopping.com/images/di/73/42/64/324a6e4945504d2d415f6c42414d31525a6751-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di108.shopping.com/images/di/73/42/64/324a6e4945504d2d415f6c42414d31525a6751-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di108.shopping.com/images/di/73/42/64/324a6e4945504d2d415f6c42414d31525a6751-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di108.shopping.com/images/di/73/42/64/324a6e4945504d2d415f6c42414d31525a6751-500x500-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1in-stockFantastic prices with ease & comfort of Amazon.com!139.009.50139.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=566&BEFID=7185&aon=%5E1&MerchantID=301531&crawler_id=1903313&dealId=sBd2JnIEPM-A_lBAM1RZgQ%3D%3D&url=http%3A%2F%2Fwww.amazon.com%2Fdp%2FB002T964IM%2Fref%3Dasc_df_B002T964IM1751618%3Fsmid%3DA22UHVNXG98FAT%26tag%3Ddealtime-ce-mp01feed-20%26linkCode%3Dasn%26creative%3D395105%26creativeASIN%3DB002T964IM&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+Coolpix+S203+Digital+Camera+%28Red%29&dlprc=139.0&crn=&istrsmrc=0&isathrsl=0&AR=63&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=95397883&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=63&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=0&code=&acode=518&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=Amazon Marketplacehttp://img.shopping.com/cctool/merch_logos/301531.gif2132.73http://img.shopping.com/sc/mr/sdc_checks_25.gifhttp://www.shopping.com/xMR-store_amazon_marketplace_9689~MRD-301531~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUSB002T964IMNikon S3100 Digital Camera14.5 Megapixel, Compact Camera, 2.7 in. LCD Screen, 5x Optical Zoom, With High Definition Video, Weight: 0.23 lb.This digital camera features a wide-angle optical Zoom-NIKKOR glass lens that allows you to capture anything from landscapes to portraits to action shots. The high-definition movie mode with one-touch recording makes it easy to capture video clips.http://di1.shopping.com/images/pi/66/2d/33/106834268-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=3http://di1.shopping.com/images/pi/66/2d/33/106834268-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=3http://di1.shopping.com/images/pi/66/2d/33/106834268-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=3http://di1.shopping.com/images/pi/66/2d/33/106834268-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=3http://di1.shopping.com/images/pi/66/2d/33/106834268-507x387-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=312.00http://img.shopping.com/sc/pr/sdc_stars_sm_2.gifhttp://www.shopping.com/nikon-s3100/reviews~linkin_id-700061099.95134.95http://www.shopping.com/nikon-s3100/prices~linkin_id-7000610http://www.shopping.com/nikon-s3100/info~linkin_id-7000610CoolPix S3100 14 Megapixel Compact Digital Camera- RedNikon Coolpix S3100 - Digital camera - compact - 14.0 Mpix - optical zoom: 5 x - supported memory: SD, SDXC, SDHC - red7185Nikonhttp://di111.shopping.com/images/di/55/55/79/476f71563872302d78726b6e2d726e474e6267-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di111.shopping.com/images/di/55/55/79/476f71563872302d78726b6e2d726e474e6267-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di111.shopping.com/images/di/55/55/79/476f71563872302d78726b6e2d726e474e6267-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di111.shopping.com/images/di/55/55/79/476f71563872302d78726b6e2d726e474e6267-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1in-stockGet 30 days FREE SHIPPING w/ ShipVantage119.956.95139.95http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=578&BEFID=7185&aon=%5E1&MerchantID=485615&crawler_id=485615&dealId=UUyGoqV8r0-xrkn-rnGNbg%3D%3D&url=http%3A%2F%2Fsears.rdr.channelintelligence.com%2Fgo.asp%3FfVhzOGNRAAQIASNiE1NbQBJpFHJ3Yx0CTAICI2BbH1lEFmgKP3QvUVpEREdlfUAUHAQPLVpFTVdtJzxAHUNYW3AhQBM0QhFvEXAbYh8EAAVmDAJeU1oyGG0GcBdhGwUGCAVqYF9SO0xSN1sZdmA7dmMdBQAJB24qX1NbQxI6AjA2ME5dVFULPDsGPFcQTTdaLTA6SR0OFlQvPAwMDxYcYlxIVkcoLTcCDA%3D%3D%26nAID%3D13736960%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=CoolPix+S3100+14+Megapixel+Compact+Digital+Camera-+Red&dlprc=119.95&crn=&istrsmrc=1&isathrsl=0&AR=28&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=106834268&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=28&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=1&FS=0&code=&acode=583&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=Searshttp://img.shopping.com/cctool/merch_logos/485615.gif1-800-349-43588882.85http://img.shopping.com/sc/mr/sdc_checks_3.gifhttp://www.shopping.com/xMR-store_sears_4189479~MRD-485615~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS00337013000COOLPIX S3100 PinkNikon Coolpix S3100 - Digital camera - compact - 14.0 Mpix - optical zoom: 5 x - supported memory: SD, SDXC, SDHC - pink7185Nikonhttp://di111.shopping.com/images/di/58/38/37/4177586c573164586f4d586b34515144546f51-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di111.shopping.com/images/di/58/38/37/4177586c573164586f4d586b34515144546f51-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di111.shopping.com/images/di/58/38/37/4177586c573164586f4d586b34515144546f51-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di111.shopping.com/images/di/58/38/37/4177586c573164586f4d586b34515144546f51-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2in-stockGet 30 days FREE SHIPPING w/ ShipVantage119.956.95139.95http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=578&BEFID=7185&aon=%5E1&MerchantID=485615&crawler_id=485615&dealId=X87AwXlW1dXoMXk4QQDToQ%3D%3D&url=http%3A%2F%2Fsears.rdr.channelintelligence.com%2Fgo.asp%3FfVhzOGNRAAQIASNiE1NbQBJpFHJxYx0CTAICI2BbH1lEFmgKP3QvUVpEREdlfUAUHAQPLVpFTVdtJzxAHUNYW3AhQBM0QhFvEXAbYh8EAAVmb2JcUFxDEGsPc3QDEkFZVQ0WFhdRW0MWbgYWDlxzdGMdAVQWRi0xDAwPFhw9TSobb05eWVVYKzsLTFVVQi5RICs3SA8MU1s2MQQKD1wf%26nAID%3D13736960%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=COOLPIX+S3100+Pink&dlprc=119.95&crn=&istrsmrc=1&isathrsl=0&AR=31&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=106834268&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=31&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=1&FS=0&code=&acode=583&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=Searshttp://img.shopping.com/cctool/merch_logos/485615.gif1-800-349-43588882.85http://img.shopping.com/sc/mr/sdc_checks_3.gifhttp://www.shopping.com/xMR-store_sears_4189479~MRD-485615~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS00337015000Nikon Coolpix S3100 14.0 MP Digital Camera - SilverNikon Coolpix S3100 14.0 MP Digital Camera - Silver7185Nikonhttp://di109.shopping.com/images/di/6e/76/46/776e70664134726c413144626b736473613077-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di109.shopping.com/images/di/6e/76/46/776e70664134726c413144626b736473613077-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di109.shopping.com/images/di/6e/76/46/776e70664134726c413144626b736473613077-270x270-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3in-stock109.970.00109.97http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=803&BEFID=7185&aon=%5E&MerchantID=475774&crawler_id=475774&dealId=nvFwnpfA4rlA1Dbksdsa0w%3D%3D&url=http%3A%2F%2Fwww.thewiz.com%2Fcatalog%2Fproduct.jsp%3FmodelNo%3DS3100SILVER%26gdftrk%3DgdfV2677_a_7c996_a_7c4049_a_7c26262&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+Coolpix+S3100+14.0+MP+Digital+Camera+-+Silver&dlprc=109.97&crn=&istrsmrc=0&isathrsl=0&AR=33&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=106834268&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=33&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=1&code=&acode=797&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=TheWiz.comhttp://img.shopping.com/cctool/merch_logos/475774.gif877-542-69880http://img.shopping.com/sc/glb/flag/US.gifUS26262Nikon� COOLPIX� S3100 14MP Digital Camera (Silver)The Nikon COOLPIX S3100 is the easy way to share your life and stay connected.7185Nikonhttp://di102.shopping.com/images/di/35/47/74/614e324e6572794b7770732d5365326c2d3467-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://di102.shopping.com/images/di/35/47/74/614e324e6572794b7770732d5365326c2d3467-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://di102.shopping.com/images/di/35/47/74/614e324e6572794b7770732d5365326c2d3467-220x220-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4in-stock119.996.05119.99http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=504&BEFID=7185&aon=%5E1&MerchantID=332477&crawler_id=332477&dealId=5GtaN2NeryKwps-Se2l-4g%3D%3D&url=http%3A%2F%2Ftracking.searchmarketing.com%2Fgsic.asp%3Faid%3D848064082%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon%C3%AF%C2%BF%C2%BD+COOLPIX%C3%AF%C2%BF%C2%BD+S3100+14MP+Digital+Camera+%28Silver%29&dlprc=119.99&crn=&istrsmrc=0&isathrsl=0&AR=37&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=106834268&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=37&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=0&code=&acode=509&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=RadioShackhttp://img.shopping.com/cctool/merch_logos/332477.gif242.25http://img.shopping.com/sc/mr/sdc_checks_25.gifhttp://www.shopping.com/xMR-store_radioshack_9689~MRD-332477~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS10101095COOLPIX S3100 YellowNikon Coolpix S3100 - Digital camera - compact - 14.0 Mpix - optical zoom: 5 x - supported memory: SD, SDXC, SDHC - yellow7185Nikonhttp://di107.shopping.com/images/di/61/34/33/6d305258756c5833387a436e516a5535396a77-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di107.shopping.com/images/di/61/34/33/6d305258756c5833387a436e516a5535396a77-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di107.shopping.com/images/di/61/34/33/6d305258756c5833387a436e516a5535396a77-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di107.shopping.com/images/di/61/34/33/6d305258756c5833387a436e516a5535396a77-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5in-stockGet 30 days FREE SHIPPING w/ ShipVantage119.956.95139.95http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=578&BEFID=7185&aon=%5E1&MerchantID=485615&crawler_id=485615&dealId=a43m0RXulX38zCnQjU59jw%3D%3D&url=http%3A%2F%2Fsears.rdr.channelintelligence.com%2Fgo.asp%3FfVhzOGNRAAQIASNiE1NbQBJpFHJwYx0CTAICI2BbH1lEFmgKP3QvUVpEREdlfUAUHAQPLVpFTVdtJzxAHUNYW3AhQBM0QhFvEXAbYh8EAAVmb2JcUFxDEGoPc3QDEkFZVQ0WFhdRW0MWbgYWDlxzdGMdAVQWRi0xDAwPFhw9TSobb05eWVVYKzsLTFVVQi5RICs3SA8MU1s2MQQKD1wf%26nAID%3D13736960%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=COOLPIX+S3100+Yellow&dlprc=119.95&crn=&istrsmrc=1&isathrsl=0&AR=38&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=106834268&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=38&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=1&FS=0&code=&acode=583&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=Searshttp://img.shopping.com/cctool/merch_logos/485615.gif1-800-349-43588882.85http://img.shopping.com/sc/mr/sdc_checks_3.gifhttp://www.shopping.com/xMR-store_sears_4189479~MRD-485615~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS00337014000Nikon D90 Digital Camera12.3 Megapixel, Point and Shoot Camera, 3 in. LCD Screen, With Video Capability, Weight: 1.36 lb.Untitled Document Nikon D90 SLR Digital Camera With 28-80mm 75-300mm Lens Kit The Nikon D90 SLR Digital Camera, with its 12.3-megapixel DX-format CMOS, 3" High resolution LCD display, Scene Recognition System, Picture Control, Active D-Lighting, and one-button Live View, provides photo enthusiasts with the image quality and performance they need to pursue their own vision while still being intuitive enough for use as an everyday camera.http://di1.shopping.com/images/pi/52/fb/d3/99671132-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=4http://di1.shopping.com/images/pi/52/fb/d3/99671132-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=4http://di1.shopping.com/images/pi/52/fb/d3/99671132-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=4http://di1.shopping.com/images/pi/52/fb/d3/99671132-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=4http://di1.shopping.com/images/pi/52/fb/d3/99671132-499x255-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=475.00http://img.shopping.com/sc/pr/sdc_stars_sm_5.gifhttp://www.shopping.com/Nikon-D90-with-18-270mm-Lens/reviews~linkin_id-7000610689.002299.00http://www.shopping.com/Nikon-D90-with-18-270mm-Lens/prices~linkin_id-7000610http://www.shopping.com/Nikon-D90-with-18-270mm-Lens/info~linkin_id-7000610Nikon® D90 12.3MP Digital SLR Camera (Body Only)The Nikon D90 will make you rethink what a digital SLR camera can achieve.7185Nikonhttp://di106.shopping.com/images/di/47/55/35/4a4a6b70554178653548756a4237666b774141-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di106.shopping.com/images/di/47/55/35/4a4a6b70554178653548756a4237666b774141-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di106.shopping.com/images/di/47/55/35/4a4a6b70554178653548756a4237666b774141-220x220-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1in-stock1015.996.051015.99http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=504&BEFID=7185&aon=%5E1&MerchantID=332477&crawler_id=332477&dealId=GU5JJkpUAxe5HujB7fkwAA%3D%3D&url=http%3A%2F%2Ftracking.searchmarketing.com%2Fgsic.asp%3Faid%3D851830266%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon%C2%AE+D90+12.3MP+Digital+SLR+Camera+%28Body+Only%29&dlprc=1015.99&crn=&istrsmrc=0&isathrsl=0&AR=14&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=99671132&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=14&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=0&code=&acode=496&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=RadioShackhttp://img.shopping.com/cctool/merch_logos/332477.gif242.25http://img.shopping.com/sc/mr/sdc_checks_25.gifhttp://www.shopping.com/xMR-store_radioshack_9689~MRD-332477~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS10148659Nikon D90 SLR Digital Camera (Camera Body)The Nikon D90 SLR Digital Camera with its 12.3-megapixel DX-format CCD 3" High resolution LCD display Scene Recognition System Picture Control Active D-Lighting and one-button Live View provides photo enthusiasts with the image quality and performance they need to pursue their own vision while still being intuitive enough for use as an everyday camera. In addition the D90 introduces the D-Movie mode allowing for the first time an interchangeable lens SLR camera that is capable of recording 720p HD movie clips. Availabilty: In Stock7185Nikonhttp://di109.shopping.com/images/di/58/68/55/527553432d73704262544944666f3471667a51-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di109.shopping.com/images/di/58/68/55/527553432d73704262544944666f3471667a51-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di109.shopping.com/images/di/58/68/55/527553432d73704262544944666f3471667a51-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di109.shopping.com/images/di/58/68/55/527553432d73704262544944666f3471667a51-350x350-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2in-stockFree Shipping with Any Purchase!689.000.00900.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=647&BEFID=7185&aon=%5E1&MerchantID=475674&crawler_id=475674&dealId=XhURuSC-spBbTIDfo4qfzQ%3D%3D&url=http%3A%2F%2Fwww.fumfie.com%2Fproduct%2F169.5%2Fshopping-com%3F&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D90+SLR+Digital+Camera+%28Camera+Body%29&dlprc=689.0&crn=&istrsmrc=1&isathrsl=0&AR=16&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=99671132&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=16&cid=&semid1=&semid2=&IsLps=0&CC=1&SL=1&FS=1&code=&acode=658&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=FumFiehttp://img.shopping.com/cctool/merch_logos/475674.gif866 666 91985604.27http://img.shopping.com/sc/mr/sdc_checks_45.gifhttp://www.shopping.com/xMR-store_fumfie~MRD-475674~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUSF169C5Nikon D90 SLR w/Nikon 18-105mm VR & 55-200mm VR Lenses12.3 MegapixelDX Format CMOS Sensor3" VGA LCD DisplayLive ViewSelf Cleaning SensorD-Movie ModeHigh Sensitivity (ISO 3200)4.5 fps BurstIn-Camera Image Editing7185Nikonhttp://di101.shopping.com/images/di/6f/30/50/785f584c5744627278415952793372436d7951-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di101.shopping.com/images/di/6f/30/50/785f584c5744627278415952793372436d7951-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di101.shopping.com/images/di/6f/30/50/785f584c5744627278415952793372436d7951-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di101.shopping.com/images/di/6f/30/50/785f584c5744627278415952793372436d7951-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di101.shopping.com/images/di/6f/30/50/785f584c5744627278415952793372436d7951-500x500-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3in-stock1189.000.001189.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=371&BEFID=7185&aon=%5E1&MerchantID=487342&crawler_id=487342&dealId=o0Px_XLWDbrxAYRy3rCmyQ%3D%3D&url=http%3A%2F%2Fwww.rythercamera.com%2Fcatalog%2Fproduct_info.php%3Fcsv%3Dsh%26products_id%3D30619%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D90+SLR+w%2FNikon+18-105mm+VR+%26+55-200mm+VR+Lenses&dlprc=1189.0&crn=&istrsmrc=0&isathrsl=0&AR=20&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=99671132&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=20&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=1&code=&acode=379&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=RytherCamera.comhttp://img.shopping.com/cctool/merch_logos/487342.gif1-877-644-75930http://img.shopping.com/sc/glb/flag/US.gifUS30619Nikon D90 12.3 Megapixel Digital SLR Camera (Body Only)Fusing 12.3 megapixel image quality and a cinematic 24fps D-Movie Mode, the Nikon D90 exceeds the demands of passionate photographers. Coupled with Nikon's EXPEED image processing technologies and NIKKOR optics, breathtaking image fidelity is assured. Combined with fast 0.15ms power-up and split-second 65ms shooting lag, dramatic action and decisive moments are captured easily. Effective 4-frequency, ultrasonic sensor cleaning frees image degrading dust particles from the sensor's optical low pass filter.7185Nikonhttp://di110.shopping.com/images/di/34/48/67/62574a534a3873736749663842304d58497741-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://di110.shopping.com/images/di/34/48/67/62574a534a3873736749663842304d58497741-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://di110.shopping.com/images/di/34/48/67/62574a534a3873736749663842304d58497741-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4in-stockFREE FEDEX 2-3 DAY DELIVERY899.950.00899.95http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=269&BEFID=7185&aon=%5E&MerchantID=9296&crawler_id=811558&dealId=4HgbWJSJ8ssgIf8B0MXIwA%3D%3D&url=http%3A%2F%2Fwww.pcnation.com%2Foptics-gallery%2Fdetails.asp%3Faffid%3D305%26item%3D2N145P&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D90+12.3+Megapixel+Digital+SLR+Camera+%28Body+Only%29&dlprc=899.95&crn=&istrsmrc=1&isathrsl=0&AR=21&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=99671132&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=21&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=1&code=&acode=257&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=PCNationhttp://img.shopping.com/cctool/merch_logos/9296.gif800-470-707916224.43http://img.shopping.com/sc/mr/sdc_checks_45.gifhttp://www.shopping.com/xMR-store_pcnation_9689~MRD-9296~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS2N145PNikon D90 12.3MP Digital SLR Camera (Body Only)Fusing 12.3-megapixel image quality inherited from the award-winning D300 with groundbreaking features, the D90's breathtaking, low-noise image quality is further advanced with EXPEED image processing. Split-second shutter response and continuous shooting at up to 4.5 frames-per-second provide the power to capture fast action and precise moments perfectly, while Nikon's exclusive Scene Recognition System contributes to faster 11-area autofocus performance, finer white balance detection and more. The D90 delivers the control passionate photographers demand, utilizing comprehensive exposure functions and the intelligence of 3D Color Matrix Metering II. Stunning results come to life on a 3-inch 920,000-dot color LCD monitor, providing accurate image review, Live View composition and brilliant playback of the D90's cinematic-quality 24-fps HD D-Movie mode.7185Nikonhttp://di102.shopping.com/images/di/55/4e/44/6133754d445a584f6e76445f377354494c5967-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di102.shopping.com/images/di/55/4e/44/6133754d445a584f6e76445f377354494c5967-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di102.shopping.com/images/di/55/4e/44/6133754d445a584f6e76445f377354494c5967-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di102.shopping.com/images/di/55/4e/44/6133754d445a584f6e76445f377354494c5967-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di102.shopping.com/images/di/55/4e/44/6133754d445a584f6e76445f377354494c5967-500x500-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5in-stockFantastic prices with ease & comfort of Amazon.com!780.000.00780.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=566&BEFID=7185&aon=%5E1&MerchantID=301531&crawler_id=1903313&dealId=UNDa3uMDZXOnvD_7sTILYg%3D%3D&url=http%3A%2F%2Fwww.amazon.com%2Fdp%2FB001ET5U92%2Fref%3Dasc_df_B001ET5U921751618%3Fsmid%3DAHF4SYKP09WBH%26tag%3Ddealtime-ce-mp01feed-20%26linkCode%3Dasn%26creative%3D395105%26creativeASIN%3DB001ET5U92&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D90+12.3MP+Digital+SLR+Camera+%28Body+Only%29&dlprc=780.0&crn=&istrsmrc=0&isathrsl=0&AR=29&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=99671132&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=29&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=1&code=&acode=520&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=Amazon Marketplacehttp://img.shopping.com/cctool/merch_logos/301531.gif2132.73http://img.shopping.com/sc/mr/sdc_checks_25.gifhttp://www.shopping.com/xMR-store_amazon_marketplace_9689~MRD-301531~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUSB001ET5U92Nikon D90 Digital Camera with 18-105mm lens12.9 Megapixel, SLR Camera, 3 in. LCD Screen, 5.8x Optical Zoom, With Video Capability, Weight: 2.3 lb.Its 12.3 megapixel DX-format CMOS image sensor and EXPEED image processing system offer outstanding image quality across a wide ISO light sensitivity range. Live View mode lets you compose and shoot via the high-resolution 3-inch LCD monitor, and an advanced Scene Recognition System and autofocus performance help capture images with astounding accuracy. Movies can be shot in Motion JPEG format using the D-Movie function. The camera’s large image sensor ensures exceptional movie image quality and you can create dramatic effects by shooting with a wide range of interchangeable NIKKOR lenses, from wide-angle to macro to fisheye, or by adjusting the lens aperture and experimenting with depth-of-field. The D90 – designed to fuel your passion for photography.http://di1.shopping.com/images/pi/57/6a/4f/70621646-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=5http://di1.shopping.com/images/pi/57/6a/4f/70621646-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=5http://di1.shopping.com/images/pi/57/6a/4f/70621646-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=5http://di1.shopping.com/images/pi/57/6a/4f/70621646-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=5http://di1.shopping.com/images/pi/57/6a/4f/70621646-490x489-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=2&c=1&l=7000610&t=111021183845&r=5324.81http://img.shopping.com/sc/pr/sdc_stars_sm_5.gifhttp://www.shopping.com/Nikon-D90-with-18-105mm-lens/reviews~linkin_id-7000610849.951599.95http://www.shopping.com/Nikon-D90-with-18-105mm-lens/prices~linkin_id-7000610http://www.shopping.com/Nikon-D90-with-18-105mm-lens/info~linkin_id-7000610Nikon D90 18-105mm VR LensThe Nikon D90 SLR Digital Camera with its 12.3-megapixel DX-format CMOS 3" High resolution LCD display Scene Recognition System Picture Control Active D-Lighting and one-button Live View prov7185Nikonhttp://di111.shopping.com/images/di/33/6f/35/6531566768674a5066684c7654314a464b5441-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di111.shopping.com/images/di/33/6f/35/6531566768674a5066684c7654314a464b5441-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1http://di111.shopping.com/images/di/33/6f/35/6531566768674a5066684c7654314a464b5441-260x260-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=1in-stock849.950.00849.95http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=419&BEFID=7185&aon=%5E1&MerchantID=9390&crawler_id=1905054&dealId=3o5e1VghgJPfhLvT1JFKTA%3D%3D&url=http%3A%2F%2Fwww.ajrichard.com%2FNikon-D90-18-105mm-VR-Lens%2Fp-292%3Frefid%3DShopping%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D90+18-105mm+VR+Lens&dlprc=849.95&crn=&istrsmrc=0&isathrsl=0&AR=2&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=70621646&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=2&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=1&code=&acode=425&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=AJRichardhttp://img.shopping.com/cctool/merch_logos/9390.gif1-888-871-125631244.48http://img.shopping.com/sc/mr/sdc_checks_45.gifhttp://www.shopping.com/xMR-store_ajrichard~MRD-9390~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS292Nikon D90 SLR w/Nikon 18-105mm VR Lens12.3 MegapixelDX Format CMOS Sensor3" VGA LCD DisplayLive ViewSelf Cleaning SensorD-Movie ModeHigh Sensitivity (ISO 3200)4.5 fps BurstIn-Camera Image Editing7185Nikonhttp://di108.shopping.com/images/di/5f/6c/59/576a5f6a62776673536b666377556344757777-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di108.shopping.com/images/di/5f/6c/59/576a5f6a62776673536b666377556344757777-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di108.shopping.com/images/di/5f/6c/59/576a5f6a62776673536b666377556344757777-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di108.shopping.com/images/di/5f/6c/59/576a5f6a62776673536b666377556344757777-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2http://di108.shopping.com/images/di/5f/6c/59/576a5f6a62776673536b666377556344757777-500x500-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=2in-stock909.000.00909.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=371&BEFID=7185&aon=%5E1&MerchantID=487342&crawler_id=487342&dealId=_lYWj_jbwfsSkfcwUcDuww%3D%3D&url=http%3A%2F%2Fwww.rythercamera.com%2Fcatalog%2Fproduct_info.php%3Fcsv%3Dsh%26products_id%3D30971%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D90+SLR+w%2FNikon+18-105mm+VR+Lens&dlprc=909.0&crn=&istrsmrc=0&isathrsl=0&AR=3&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=70621646&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=3&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=1&code=&acode=379&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=RytherCamera.comhttp://img.shopping.com/cctool/merch_logos/487342.gif1-877-644-75930http://img.shopping.com/sc/glb/flag/US.gifUS3097125448/D90 12.3 Megapixel Digital Camera 18-105mm Zoom Lens w/ 3" Screen - BlackNikon D90 - Digital camera - SLR - 12.3 Mpix - Nikon AF-S DX 18-105mm lens - optical zoom: 5.8 x - supported memory: SD, SDHC7185Nikonhttp://di110.shopping.com/images/di/31/4b/43/636c4347755776747932584b5539736b616467-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di110.shopping.com/images/di/31/4b/43/636c4347755776747932584b5539736b616467-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di110.shopping.com/images/di/31/4b/43/636c4347755776747932584b5539736b616467-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3http://di110.shopping.com/images/di/31/4b/43/636c4347755776747932584b5539736b616467-400x400-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=3in-stockGet 30 days FREE SHIPPING w/ ShipVantage1199.008.201199.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=578&BEFID=7185&aon=%5E1&MerchantID=485615&crawler_id=485615&dealId=1KCclCGuWvty2XKU9skadg%3D%3D&url=http%3A%2F%2Fsears.rdr.channelintelligence.com%2Fgo.asp%3FfVhzOGNRAAQIASNiE1NbQBRtFXpzYx0CTAICI2BbH1lEFmgKP3QvUVpEREdlfUAUHAQPLVpFTVdtJzxAHUNYW3AhQBM0QhFvEXAbYh8EAAVmb2JcVlhCGGkPc3QDEkFZVQ0WFhdRW0MWbgYWDlxzdGMdAVQWRi0xDAwPFhw9TSobb05eWVVYKzsLTFVVQi5RICs3SA8MU1s2MQQKD1wf%26nAID%3D13736960%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=25448%2FD90+12.3+Megapixel+Digital+Camera+18-105mm+Zoom+Lens+w%2F+3%22+Screen+-+Black&dlprc=1199.0&crn=&istrsmrc=1&isathrsl=0&AR=4&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=70621646&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=4&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=0&code=&acode=586&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=Searshttp://img.shopping.com/cctool/merch_logos/485615.gif1-800-349-43588882.85http://img.shopping.com/sc/mr/sdc_checks_3.gifhttp://www.shopping.com/xMR-store_sears_4189479~MRD-485615~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS00353197000Nikon® D90 12.3MP Digital SLR with 18-105mm LensThe Nikon D90 will make you rethink what a digital SLR camera can achieve.7185Nikonhttp://di101.shopping.com/images/di/33/2d/56/4f53665656354a6f37486c41346b4a74616e41-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://di101.shopping.com/images/di/33/2d/56/4f53665656354a6f37486c41346b4a74616e41-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4http://di101.shopping.com/images/di/33/2d/56/4f53665656354a6f37486c41346b4a74616e41-220x220-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=4in-stock1350.996.051350.99http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=504&BEFID=7185&aon=%5E1&MerchantID=332477&crawler_id=332477&dealId=3-VOSfVV5Jo7HlA4kJtanA%3D%3D&url=http%3A%2F%2Ftracking.searchmarketing.com%2Fgsic.asp%3Faid%3D982673361%26&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon%C2%AE+D90+12.3MP+Digital+SLR+with+18-105mm+Lens&dlprc=1350.99&crn=&istrsmrc=0&isathrsl=0&AR=5&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=70621646&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=5&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=0&code=&acode=496&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=RadioShackhttp://img.shopping.com/cctool/merch_logos/332477.gif242.25http://img.shopping.com/sc/mr/sdc_checks_25.gifhttp://www.shopping.com/xMR-store_radioshack_9689~MRD-332477~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS11148905Nikon D90 Kit 12.3-megapixel Digital SLR with 18-105mm VR LensPhotographers, take your passion further!Now is the time for new creativity, and to rethink what a digital SLR camera can achieve. It's time for the D90, a camera with everything you would expect from Nikon's next-generation D-SLRs, and some unexpected surprises, as well. The stunning image quality is inherited from the D300, Nikon's DX-format flagship. The D90 also has Nikon's unmatched ergonomics and high performance, and now takes high-quality movies with beautifully cinematic results. The world of photography has changed, and with the D90 in your hands, it's time to make your own rules.AF-S DX NIKKOR 18-105mm f/3.5-5.6G ED VR LensWide-ratio 5.8x zoom Compact, versatile and ideal for a broad range of shooting situations, ranging from interiors and landscapes to beautiful portraits� a perfect everyday zoom. Nikon VR (Vibration Reduction) image stabilization Vibration Reduction is engineered specifically for each VR NIKKOR lens and enables handheld shooting at up to 3 shutter speeds slower than would7185Nikonhttp://di110.shopping.com/images/di/6b/51/6e/4236725334416a4e3564783568325f36333167-100x100-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di110.shopping.com/images/di/6b/51/6e/4236725334416a4e3564783568325f36333167-200x200-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di110.shopping.com/images/di/6b/51/6e/4236725334416a4e3564783568325f36333167-300x300-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://img.shopping.com/sc/ds/no_image_100X100.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5http://di110.shopping.com/images/di/6b/51/6e/4236725334416a4e3564783568325f36333167-300x232-0-0.jpg?p=p2.a121bc2aaf029435dce6&a=1&c=1&l=7000610&t=111021183845&r=5in-stockShipping Included!1050.000.001199.00http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=135&BEFID=7185&aon=%5E1&MerchantID=313162&crawler_id=313162&dealId=kQnB6rS4AjN5dx5h2_631g%3D%3D&url=http%3A%2F%2Fonecall.rdr.channelintelligence.com%2Fgo.asp%3FfVhzOGNRAAQIASNiE1pZSxNoWHFwLx8GTAICa2ZeH1sPXTZLNzRpAh1HR0BxPQEGCBJNMhFHUElsFCFCVkVTTHAcBggEHQ4aHXNpGERGH3RQODsbAgdechJtbBt8fx8JAwhtZFAzJj1oGgIWCxRlNyFOUV9UUGIxBgo0T0IyTSYqJ0RWHw4QPCIBAAQXRGMDICg6TllZVBhh%26nAID%3D13736960&linkin_id=7000610&Issdt=111021183845&searchID=p2.a121bc2aaf029435dce6&DealName=Nikon+D90+Kit+12.3-megapixel+Digital+SLR+with+18-105mm+VR+Lens&dlprc=1050.0&crn=&istrsmrc=1&isathrsl=0&AR=6&NG=20&NDP=200&PN=1&ST=7&DB=sdcprod&MT=phx-pkadudc2&FPT=DSP&NDS=&NMS=&MRS=&PD=70621646&brnId=14804&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=1&RR=6&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=1&FS=1&code=&acode=143&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=OneCallhttp://img.shopping.com/cctool/merch_logos/313162.gif1.800.398.07661804.44http://img.shopping.com/sc/mr/sdc_checks_45.gifhttp://www.shopping.com/xMR-store_onecall_9689~MRD-313162~S-1~linkin_id-7000610http://img.shopping.com/sc/glb/flag/US.gifUS92826Price rangehttp://www.shopping.com/digital-cameras/nikon/products?oq=nikon&linkin_id=7000610$24 - $4012http://www.shopping.com/digital-cameras/nikon/products?minPrice=24&maxPrice=4012&linkin_id=7000610$4012 - $7999http://www.shopping.com/digital-cameras/nikon/products?minPrice=4012&maxPrice=7999&linkin_id=7000610Brandhttp://www.shopping.com/digital-cameras/nikon/products~all-9688-brand~MS-1?oq=nikon&linkin_id=7000610Nikonhttp://www.shopping.com/digital-cameras/nikon+brand-nikon/products~linkin_id-7000610Cranehttp://www.shopping.com/digital-cameras/nikon+9688-brand-crane/products~linkin_id-7000610Ikelitehttp://www.shopping.com/digital-cameras/nikon+ikelite/products~linkin_id-7000610Bowerhttp://www.shopping.com/digital-cameras/nikon+bower/products~linkin_id-7000610FUJIFILMhttp://www.shopping.com/digital-cameras/nikon+brand-fuji/products~linkin_id-7000610Storehttp://www.shopping.com/digital-cameras/nikon/products~all-store~MS-1?oq=nikon&linkin_id=7000610Amazon Marketplacehttp://www.shopping.com/digital-cameras/nikon+store-amazon-marketplace-9689/products~linkin_id-7000610Amazonhttp://www.shopping.com/digital-cameras/nikon+store-amazon/products~linkin_id-7000610Adoramahttp://www.shopping.com/digital-cameras/nikon+store-adorama/products~linkin_id-7000610J&R Music and Computer Worldhttp://www.shopping.com/digital-cameras/nikon+store-j-r-music-and-computer-world/products~linkin_id-7000610RytherCamera.comhttp://www.shopping.com/digital-cameras/nikon+store-rythercamera-com/products~linkin_id-7000610Resolutionhttp://www.shopping.com/digital-cameras/nikon/products~all-21885-resolution~MS-1?oq=nikon&linkin_id=7000610Under 4 Megapixelhttp://www.shopping.com/digital-cameras/nikon+under-4-megapixel/products~linkin_id-7000610At least 5 Megapixelhttp://www.shopping.com/digital-cameras/nikon+5-megapixel-digital-cameras/products~linkin_id-7000610At least 6 Megapixelhttp://www.shopping.com/digital-cameras/nikon+6-megapixel-digital-cameras/products~linkin_id-7000610At least 7 Megapixelhttp://www.shopping.com/digital-cameras/nikon+7-megapixel-digital-cameras/products~linkin_id-7000610At least 8 Megapixelhttp://www.shopping.com/digital-cameras/nikon+8-megapixel-digital-cameras/products~linkin_id-7000610Featureshttp://www.shopping.com/digital-cameras/nikon/products~all-32804-features~MS-1?oq=nikon&linkin_id=7000610Shockproofhttp://www.shopping.com/digital-cameras/nikon+32804-features-shockproof/products~linkin_id-7000610Waterproofhttp://www.shopping.com/digital-cameras/nikon+32804-features-waterproof/products~linkin_id-7000610Freezeproofhttp://www.shopping.com/digital-cameras/nikon+32804-features-freezeproof/products~linkin_id-7000610Dust proofhttp://www.shopping.com/digital-cameras/nikon+32804-features-dust-proof/products~linkin_id-7000610Image Stabilizationhttp://www.shopping.com/digital-cameras/nikon+32804-features-image-stabilization/products~linkin_id-7000610hybriddigital camerag1sonycameracanonnikonkodak digital camerakodaksony cybershotkodak easyshare digital cameranikon coolpixolympuspink digital cameracanon powershot \ No newline at end of file diff --git a/build/node_modules/sax/examples/strict.dtd b/build/node_modules/sax/examples/strict.dtd deleted file mode 100644 index b27455943fc..00000000000 --- a/build/node_modules/sax/examples/strict.dtd +++ /dev/null @@ -1,870 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -%HTMLlat1; - - -%HTMLsymbol; - - -%HTMLspecial; - - - - - - - - - - - - - -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/node_modules/sax/examples/test.html b/build/node_modules/sax/examples/test.html deleted file mode 100644 index 61f8f1ab91c..00000000000 --- a/build/node_modules/sax/examples/test.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - testing the parser - - - -

      hello - - - - diff --git a/build/node_modules/sax/examples/test.xml b/build/node_modules/sax/examples/test.xml deleted file mode 100644 index 801292d7f27..00000000000 --- a/build/node_modules/sax/examples/test.xml +++ /dev/null @@ -1,1254 +0,0 @@ - - -]> - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - - Some Text - - - - - - - are ok in here. ]]> - - Pre-Text & Inlined text Post-text. -  - - \ No newline at end of file diff --git a/build/node_modules/sax/lib/sax.js b/build/node_modules/sax/lib/sax.js deleted file mode 100644 index 77e20ae8715..00000000000 --- a/build/node_modules/sax/lib/sax.js +++ /dev/null @@ -1,1329 +0,0 @@ -// wrapper for non-node envs -;(function (sax) { - -sax.parser = function (strict, opt) { return new SAXParser(strict, opt) } -sax.SAXParser = SAXParser -sax.SAXStream = SAXStream -sax.createStream = createStream - -// When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns. -// When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)), -// since that's the earliest that a buffer overrun could occur. This way, checks are -// as rare as required, but as often as necessary to ensure never crossing this bound. -// Furthermore, buffers are only tested at most once per write(), so passing a very -// large string into write() might have undesirable effects, but this is manageable by -// the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme -// edge case, result in creating at most one complete copy of the string passed in. -// Set to Infinity to have unlimited buffers. -sax.MAX_BUFFER_LENGTH = 64 * 1024 - -var buffers = [ - "comment", "sgmlDecl", "textNode", "tagName", "doctype", - "procInstName", "procInstBody", "entity", "attribName", - "attribValue", "cdata", "script" -] - -sax.EVENTS = // for discoverability. - [ "text" - , "processinginstruction" - , "sgmldeclaration" - , "doctype" - , "comment" - , "attribute" - , "opentag" - , "closetag" - , "opencdata" - , "cdata" - , "closecdata" - , "error" - , "end" - , "ready" - , "script" - , "opennamespace" - , "closenamespace" - ] - -function SAXParser (strict, opt) { - if (!(this instanceof SAXParser)) return new SAXParser(strict, opt) - - var parser = this - clearBuffers(parser) - parser.q = parser.c = "" - parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH - parser.opt = opt || {} - parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags - parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase" - parser.tags = [] - parser.closed = parser.closedRoot = parser.sawRoot = false - parser.tag = parser.error = null - parser.strict = !!strict - parser.noscript = !!(strict || parser.opt.noscript) - parser.state = S.BEGIN - parser.ENTITIES = Object.create(sax.ENTITIES) - parser.attribList = [] - - // namespaces form a prototype chain. - // it always points at the current tag, - // which protos to its parent tag. - if (parser.opt.xmlns) parser.ns = Object.create(rootNS) - - // mostly just for error reporting - parser.trackPosition = parser.opt.position !== false - if (parser.trackPosition) { - parser.position = parser.line = parser.column = 0 - } - emit(parser, "onready") -} - -if (!Object.create) Object.create = function (o) { - function f () { this.__proto__ = o } - f.prototype = o - return new f -} - -if (!Object.getPrototypeOf) Object.getPrototypeOf = function (o) { - return o.__proto__ -} - -if (!Object.keys) Object.keys = function (o) { - var a = [] - for (var i in o) if (o.hasOwnProperty(i)) a.push(i) - return a -} - -function checkBufferLength (parser) { - var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10) - , maxActual = 0 - for (var i = 0, l = buffers.length; i < l; i ++) { - var len = parser[buffers[i]].length - if (len > maxAllowed) { - // Text/cdata nodes can get big, and since they're buffered, - // we can get here under normal conditions. - // Avoid issues by emitting the text node now, - // so at least it won't get any bigger. - switch (buffers[i]) { - case "textNode": - closeText(parser) - break - - case "cdata": - emitNode(parser, "oncdata", parser.cdata) - parser.cdata = "" - break - - case "script": - emitNode(parser, "onscript", parser.script) - parser.script = "" - break - - default: - error(parser, "Max buffer length exceeded: "+buffers[i]) - } - } - maxActual = Math.max(maxActual, len) - } - // schedule the next check for the earliest possible buffer overrun. - parser.bufferCheckPosition = (sax.MAX_BUFFER_LENGTH - maxActual) - + parser.position -} - -function clearBuffers (parser) { - for (var i = 0, l = buffers.length; i < l; i ++) { - parser[buffers[i]] = "" - } -} - -SAXParser.prototype = - { end: function () { end(this) } - , write: write - , resume: function () { this.error = null; return this } - , close: function () { return this.write(null) } - } - -try { - var Stream = require("stream").Stream -} catch (ex) { - var Stream = function () {} -} - - -var streamWraps = sax.EVENTS.filter(function (ev) { - return ev !== "error" && ev !== "end" -}) - -function createStream (strict, opt) { - return new SAXStream(strict, opt) -} - -function SAXStream (strict, opt) { - if (!(this instanceof SAXStream)) return new SAXStream(strict, opt) - - Stream.apply(this) - - this._parser = new SAXParser(strict, opt) - this.writable = true - this.readable = true - - - var me = this - - this._parser.onend = function () { - me.emit("end") - } - - this._parser.onerror = function (er) { - me.emit("error", er) - - // if didn't throw, then means error was handled. - // go ahead and clear error, so we can write again. - me._parser.error = null - } - - this._decoder = null; - - streamWraps.forEach(function (ev) { - Object.defineProperty(me, "on" + ev, { - get: function () { return me._parser["on" + ev] }, - set: function (h) { - if (!h) { - me.removeAllListeners(ev) - return me._parser["on"+ev] = h - } - me.on(ev, h) - }, - enumerable: true, - configurable: false - }) - }) -} - -SAXStream.prototype = Object.create(Stream.prototype, - { constructor: { value: SAXStream } }) - -SAXStream.prototype.write = function (data) { - if (typeof Buffer === 'function' && - typeof Buffer.isBuffer === 'function' && - Buffer.isBuffer(data)) { - if (!this._decoder) { - var SD = require('string_decoder').StringDecoder - this._decoder = new SD('utf8') - } - data = this._decoder.write(data); - } - - this._parser.write(data.toString()) - this.emit("data", data) - return true -} - -SAXStream.prototype.end = function (chunk) { - if (chunk && chunk.length) this.write(chunk) - else if (this.leftovers) this._parser.write(this.leftovers.toString()) - this._parser.end() - return true -} - -SAXStream.prototype.on = function (ev, handler) { - var me = this - if (!me._parser["on"+ev] && streamWraps.indexOf(ev) !== -1) { - me._parser["on"+ev] = function () { - var args = arguments.length === 1 ? [arguments[0]] - : Array.apply(null, arguments) - args.splice(0, 0, ev) - me.emit.apply(me, args) - } - } - - return Stream.prototype.on.call(me, ev, handler) -} - - - -// character classes and tokens -var whitespace = "\r\n\t " - // this really needs to be replaced with character classes. - // XML allows all manner of ridiculous numbers and digits. - , number = "0124356789" - , letter = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - // (Letter | "_" | ":") - , quote = "'\"" - , entity = number+letter+"#" - , attribEnd = whitespace + ">" - , CDATA = "[CDATA[" - , DOCTYPE = "DOCTYPE" - , XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace" - , XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/" - , rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE } - -// turn all the string character sets into character class objects. -whitespace = charClass(whitespace) -number = charClass(number) -letter = charClass(letter) - -// http://www.w3.org/TR/REC-xml/#NT-NameStartChar -// This implementation works on strings, a single character at a time -// as such, it cannot ever support astral-plane characters (10000-EFFFF) -// without a significant breaking change to either this parser, or the -// JavaScript language. Implementation of an emoji-capable xml parser -// is left as an exercise for the reader. -var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ - -var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/ - -quote = charClass(quote) -entity = charClass(entity) -attribEnd = charClass(attribEnd) - -function charClass (str) { - return str.split("").reduce(function (s, c) { - s[c] = true - return s - }, {}) -} - -function isRegExp (c) { - return Object.prototype.toString.call(c) === '[object RegExp]' -} - -function is (charclass, c) { - return isRegExp(charclass) ? !!c.match(charclass) : charclass[c] -} - -function not (charclass, c) { - return !is(charclass, c) -} - -var S = 0 -sax.STATE = -{ BEGIN : S++ -, TEXT : S++ // general stuff -, TEXT_ENTITY : S++ // & and such. -, OPEN_WAKA : S++ // < -, SGML_DECL : S++ // -, SCRIPT : S++ // " - , expect : - [ [ "opentag", { name: "xml", attributes: {}, isSelfClosing: false } ] - , [ "opentag", { name: "script", attributes: {}, isSelfClosing: false } ] - , [ "text", "hello world" ] - , [ "closetag", "script" ] - , [ "closetag", "xml" ] - ] - , strict : false - , opt : { lowercasetags: true, noscript: true } - } - ) - -require(__dirname).test - ( { xml : "" - , expect : - [ [ "opentag", { name: "xml", attributes: {}, isSelfClosing: false } ] - , [ "opentag", { name: "script", attributes: {}, isSelfClosing: false } ] - , [ "opencdata", undefined ] - , [ "cdata", "hello world" ] - , [ "closecdata", undefined ] - , [ "closetag", "script" ] - , [ "closetag", "xml" ] - ] - , strict : false - , opt : { lowercasetags: true, noscript: true } - } - ) - diff --git a/build/node_modules/sax/test/issue-84.js b/build/node_modules/sax/test/issue-84.js deleted file mode 100644 index 0e7ee699abc..00000000000 --- a/build/node_modules/sax/test/issue-84.js +++ /dev/null @@ -1,13 +0,0 @@ -// https://github.com/isaacs/sax-js/issues/49 -require(__dirname).test - ( { xml : "body" - , expect : - [ [ "processinginstruction", { name: "has", body: "unbalanced \"quotes" } ], - [ "opentag", { name: "xml", attributes: {}, isSelfClosing: false } ] - , [ "text", "body" ] - , [ "closetag", "xml" ] - ] - , strict : false - , opt : { lowercasetags: true, noscript: true } - } - ) diff --git a/build/node_modules/sax/test/parser-position.js b/build/node_modules/sax/test/parser-position.js deleted file mode 100644 index e4a68b1e960..00000000000 --- a/build/node_modules/sax/test/parser-position.js +++ /dev/null @@ -1,28 +0,0 @@ -var sax = require("../lib/sax"), - assert = require("assert") - -function testPosition(chunks, expectedEvents) { - var parser = sax.parser(); - expectedEvents.forEach(function(expectation) { - parser['on' + expectation[0]] = function() { - for (var prop in expectation[1]) { - assert.equal(parser[prop], expectation[1][prop]); - } - } - }); - chunks.forEach(function(chunk) { - parser.write(chunk); - }); -}; - -testPosition(['

      abcdefgh
      '], - [ ['opentag', { position: 5, startTagPosition: 1 }] - , ['text', { position: 19, startTagPosition: 14 }] - , ['closetag', { position: 19, startTagPosition: 14 }] - ]); - -testPosition(['
      abcde','fgh
      '], - [ ['opentag', { position: 5, startTagPosition: 1 }] - , ['text', { position: 19, startTagPosition: 14 }] - , ['closetag', { position: 19, startTagPosition: 14 }] - ]); diff --git a/build/node_modules/sax/test/script-close-better.js b/build/node_modules/sax/test/script-close-better.js deleted file mode 100644 index f4887b9a053..00000000000 --- a/build/node_modules/sax/test/script-close-better.js +++ /dev/null @@ -1,12 +0,0 @@ -require(__dirname).test({ - xml : "", - expect : [ - ["opentag", {"name": "HTML","attributes": {}, isSelfClosing: false}], - ["opentag", {"name": "HEAD","attributes": {}, isSelfClosing: false}], - ["opentag", {"name": "SCRIPT","attributes": {}, isSelfClosing: false}], - ["script", "'
      foo
      ", - expect : [ - ["opentag", {"name": "HTML","attributes": {}, "isSelfClosing": false}], - ["opentag", {"name": "HEAD","attributes": {}, "isSelfClosing": false}], - ["opentag", {"name": "SCRIPT","attributes": {}, "isSelfClosing": false}], - ["script", "if (1 < 0) { console.log('elo there'); }"], - ["closetag", "SCRIPT"], - ["closetag", "HEAD"], - ["closetag", "HTML"] - ] -}); diff --git a/build/node_modules/sax/test/self-closing-child-strict.js b/build/node_modules/sax/test/self-closing-child-strict.js deleted file mode 100644 index 3d6e98520d8..00000000000 --- a/build/node_modules/sax/test/self-closing-child-strict.js +++ /dev/null @@ -1,44 +0,0 @@ - -require(__dirname).test({ - xml : - ""+ - "" + - "" + - "" + - "" + - "=(|)" + - "" + - "", - expect : [ - ["opentag", { - "name": "root", - "attributes": {}, - "isSelfClosing": false - }], - ["opentag", { - "name": "child", - "attributes": {}, - "isSelfClosing": false - }], - ["opentag", { - "name": "haha", - "attributes": {}, - "isSelfClosing": true - }], - ["closetag", "haha"], - ["closetag", "child"], - ["opentag", { - "name": "monkey", - "attributes": {}, - "isSelfClosing": false - }], - ["text", "=(|)"], - ["closetag", "monkey"], - ["closetag", "root"], - ["end"], - ["ready"] - ], - strict : true, - opt : {} -}); - diff --git a/build/node_modules/sax/test/self-closing-child.js b/build/node_modules/sax/test/self-closing-child.js deleted file mode 100644 index f31c36646cc..00000000000 --- a/build/node_modules/sax/test/self-closing-child.js +++ /dev/null @@ -1,44 +0,0 @@ - -require(__dirname).test({ - xml : - ""+ - "" + - "" + - "" + - "" + - "=(|)" + - "" + - "", - expect : [ - ["opentag", { - "name": "ROOT", - "attributes": {}, - "isSelfClosing": false - }], - ["opentag", { - "name": "CHILD", - "attributes": {}, - "isSelfClosing": false - }], - ["opentag", { - "name": "HAHA", - "attributes": {}, - "isSelfClosing": true - }], - ["closetag", "HAHA"], - ["closetag", "CHILD"], - ["opentag", { - "name": "MONKEY", - "attributes": {}, - "isSelfClosing": false - }], - ["text", "=(|)"], - ["closetag", "MONKEY"], - ["closetag", "ROOT"], - ["end"], - ["ready"] - ], - strict : false, - opt : {} -}); - diff --git a/build/node_modules/sax/test/self-closing-tag.js b/build/node_modules/sax/test/self-closing-tag.js deleted file mode 100644 index d1d8b7c828c..00000000000 --- a/build/node_modules/sax/test/self-closing-tag.js +++ /dev/null @@ -1,25 +0,0 @@ - -require(__dirname).test({ - xml : - " "+ - " "+ - " "+ - " "+ - "=(|) "+ - ""+ - " ", - expect : [ - ["opentag", {name:"ROOT", attributes:{}, isSelfClosing: false}], - ["opentag", {name:"HAHA", attributes:{}, isSelfClosing: true}], - ["closetag", "HAHA"], - ["opentag", {name:"HAHA", attributes:{}, isSelfClosing: true}], - ["closetag", "HAHA"], - // ["opentag", {name:"HAHA", attributes:{}}], - // ["closetag", "HAHA"], - ["opentag", {name:"MONKEY", attributes:{}, isSelfClosing: false}], - ["text", "=(|)"], - ["closetag", "MONKEY"], - ["closetag", "ROOT"] - ], - opt : { trim : true } -}); \ No newline at end of file diff --git a/build/node_modules/sax/test/stray-ending.js b/build/node_modules/sax/test/stray-ending.js deleted file mode 100644 index bec467b2267..00000000000 --- a/build/node_modules/sax/test/stray-ending.js +++ /dev/null @@ -1,17 +0,0 @@ -// stray ending tags should just be ignored in non-strict mode. -// https://github.com/isaacs/sax-js/issues/32 -require(__dirname).test - ( { xml : - "" - , expect : - [ [ "opentag", { name: "A", attributes: {}, isSelfClosing: false } ] - , [ "opentag", { name: "B", attributes: {}, isSelfClosing: false } ] - , [ "text", "" ] - , [ "closetag", "B" ] - , [ "closetag", "A" ] - ] - , strict : false - , opt : {} - } - ) - diff --git a/build/node_modules/sax/test/trailing-attribute-no-value.js b/build/node_modules/sax/test/trailing-attribute-no-value.js deleted file mode 100644 index 222837f8f9d..00000000000 --- a/build/node_modules/sax/test/trailing-attribute-no-value.js +++ /dev/null @@ -1,10 +0,0 @@ - -require(__dirname).test({ - xml : - "", - expect : [ - ["attribute", {name:"ATTRIB", value:"attrib"}], - ["opentag", {name:"ROOT", attributes:{"ATTRIB":"attrib"}, isSelfClosing: false}] - ], - opt : { trim : true } -}); diff --git a/build/node_modules/sax/test/trailing-non-whitespace.js b/build/node_modules/sax/test/trailing-non-whitespace.js deleted file mode 100644 index 619578b1773..00000000000 --- a/build/node_modules/sax/test/trailing-non-whitespace.js +++ /dev/null @@ -1,18 +0,0 @@ - -require(__dirname).test({ - xml : "Welcome, to monkey land", - expect : [ - ["opentag", { - "name": "SPAN", - "attributes": {}, - isSelfClosing: false - }], - ["text", "Welcome,"], - ["closetag", "SPAN"], - ["text", " to monkey land"], - ["end"], - ["ready"] - ], - strict : false, - opt : {} -}); diff --git a/build/node_modules/sax/test/unclosed-root.js b/build/node_modules/sax/test/unclosed-root.js deleted file mode 100644 index f4eeac61b31..00000000000 --- a/build/node_modules/sax/test/unclosed-root.js +++ /dev/null @@ -1,11 +0,0 @@ -require(__dirname).test - ( { xml : "" - - , expect : - [ [ "opentag", { name: "root", attributes: {}, isSelfClosing: false } ] - , [ "error", "Unclosed root tag\nLine: 0\nColumn: 6\nChar: " ] - ] - , strict : true - , opt : {} - } - ) diff --git a/build/node_modules/sax/test/unquoted.js b/build/node_modules/sax/test/unquoted.js deleted file mode 100644 index b3a9a8122e8..00000000000 --- a/build/node_modules/sax/test/unquoted.js +++ /dev/null @@ -1,18 +0,0 @@ -// unquoted attributes should be ok in non-strict mode -// https://github.com/isaacs/sax-js/issues/31 -require(__dirname).test - ( { xml : - "" - , expect : - [ [ "attribute", { name: "CLASS", value: "test" } ] - , [ "attribute", { name: "HELLO", value: "world" } ] - , [ "opentag", { name: "SPAN", - attributes: { CLASS: "test", HELLO: "world" }, - isSelfClosing: false } ] - , [ "closetag", "SPAN" ] - ] - , strict : false - , opt : {} - } - ) - diff --git a/build/node_modules/sax/test/utf8-split.js b/build/node_modules/sax/test/utf8-split.js deleted file mode 100644 index e22bc100443..00000000000 --- a/build/node_modules/sax/test/utf8-split.js +++ /dev/null @@ -1,32 +0,0 @@ -var assert = require('assert') -var saxStream = require('../lib/sax').createStream() - -var b = new Buffer('误') - -saxStream.on('text', function(text) { - assert.equal(text, b.toString()) -}) - -saxStream.write(new Buffer('')) -saxStream.write(b.slice(0, 1)) -saxStream.write(b.slice(1)) -saxStream.write(new Buffer('')) -saxStream.write(b.slice(0, 2)) -saxStream.write(b.slice(2)) -saxStream.write(new Buffer('')) -saxStream.write(b) -saxStream.write(new Buffer('')) -saxStream.write(Buffer.concat([new Buffer(''), b.slice(0, 1)])) -saxStream.end(Buffer.concat([b.slice(1), new Buffer('')])) - -var saxStream2 = require('../lib/sax').createStream() - -saxStream2.on('text', function(text) { - assert.equal(text, '�') -}); - -saxStream2.write(new Buffer('')); -saxStream2.write(new Buffer([0xC0])); -saxStream2.write(new Buffer('')); -saxStream2.write(Buffer.concat([new Buffer(''), b.slice(0,1)])); -saxStream2.end(); diff --git a/build/node_modules/sax/test/xmlns-issue-41.js b/build/node_modules/sax/test/xmlns-issue-41.js deleted file mode 100644 index 17ab45a0fb7..00000000000 --- a/build/node_modules/sax/test/xmlns-issue-41.js +++ /dev/null @@ -1,68 +0,0 @@ -var t = require(__dirname) - - , xmls = // should be the same both ways. - [ "" - , "" ] - - , ex1 = - [ [ "opennamespace" - , { prefix: "a" - , uri: "http://ATTRIBUTE" - } - ] - , [ "attribute" - , { name: "xmlns:a" - , value: "http://ATTRIBUTE" - , prefix: "xmlns" - , local: "a" - , uri: "http://www.w3.org/2000/xmlns/" - } - ] - , [ "attribute" - , { name: "a:attr" - , local: "attr" - , prefix: "a" - , uri: "http://ATTRIBUTE" - , value: "value" - } - ] - , [ "opentag" - , { name: "parent" - , uri: "" - , prefix: "" - , local: "parent" - , attributes: - { "a:attr": - { name: "a:attr" - , local: "attr" - , prefix: "a" - , uri: "http://ATTRIBUTE" - , value: "value" - } - , "xmlns:a": - { name: "xmlns:a" - , local: "a" - , prefix: "xmlns" - , uri: "http://www.w3.org/2000/xmlns/" - , value: "http://ATTRIBUTE" - } - } - , ns: {"a": "http://ATTRIBUTE"} - , isSelfClosing: true - } - ] - , ["closetag", "parent"] - , ["closenamespace", { prefix: "a", uri: "http://ATTRIBUTE" }] - ] - - // swap the order of elements 2 and 1 - , ex2 = [ex1[0], ex1[2], ex1[1]].concat(ex1.slice(3)) - , expected = [ex1, ex2] - -xmls.forEach(function (x, i) { - t.test({ xml: x - , expect: expected[i] - , strict: true - , opt: { xmlns: true } - }) -}) diff --git a/build/node_modules/sax/test/xmlns-rebinding.js b/build/node_modules/sax/test/xmlns-rebinding.js deleted file mode 100644 index 07e04255390..00000000000 --- a/build/node_modules/sax/test/xmlns-rebinding.js +++ /dev/null @@ -1,63 +0,0 @@ - -require(__dirname).test - ( { xml : - ""+ - ""+ - ""+ - ""+ - ""+ - "" - - , expect : - [ [ "opennamespace", { prefix: "x", uri: "x1" } ] - , [ "opennamespace", { prefix: "y", uri: "y1" } ] - , [ "attribute", { name: "xmlns:x", value: "x1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } ] - , [ "attribute", { name: "xmlns:y", value: "y1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "y" } ] - , [ "attribute", { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } ] - , [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ] - , [ "opentag", { name: "root", uri: "", prefix: "", local: "root", - attributes: { "xmlns:x": { name: "xmlns:x", value: "x1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } - , "xmlns:y": { name: "xmlns:y", value: "y1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "y" } - , "x:a": { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } - , "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } }, - ns: { x: 'x1', y: 'y1' }, - isSelfClosing: false } ] - - , [ "opennamespace", { prefix: "x", uri: "x2" } ] - , [ "attribute", { name: "xmlns:x", value: "x2", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } ] - , [ "opentag", { name: "rebind", uri: "", prefix: "", local: "rebind", - attributes: { "xmlns:x": { name: "xmlns:x", value: "x2", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } }, - ns: { x: 'x2' }, - isSelfClosing: false } ] - - , [ "attribute", { name: "x:a", value: "x2", uri: "x2", prefix: "x", local: "a" } ] - , [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ] - , [ "opentag", { name: "check", uri: "", prefix: "", local: "check", - attributes: { "x:a": { name: "x:a", value: "x2", uri: "x2", prefix: "x", local: "a" } - , "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } }, - ns: { x: 'x2' }, - isSelfClosing: true } ] - - , [ "closetag", "check" ] - - , [ "closetag", "rebind" ] - , [ "closenamespace", { prefix: "x", uri: "x2" } ] - - , [ "attribute", { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } ] - , [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ] - , [ "opentag", { name: "check", uri: "", prefix: "", local: "check", - attributes: { "x:a": { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } - , "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } }, - ns: { x: 'x1', y: 'y1' }, - isSelfClosing: true } ] - , [ "closetag", "check" ] - - , [ "closetag", "root" ] - , [ "closenamespace", { prefix: "x", uri: "x1" } ] - , [ "closenamespace", { prefix: "y", uri: "y1" } ] - ] - , strict : true - , opt : { xmlns: true } - } - ) - diff --git a/build/node_modules/sax/test/xmlns-strict.js b/build/node_modules/sax/test/xmlns-strict.js deleted file mode 100644 index b5e3e518868..00000000000 --- a/build/node_modules/sax/test/xmlns-strict.js +++ /dev/null @@ -1,74 +0,0 @@ - -require(__dirname).test - ( { xml : - ""+ - ""+ - ""+ - ""+ - ""+ - ""+ - ""+ - ""+ - ""+ - "" - - , expect : - [ [ "opentag", { name: "root", prefix: "", local: "root", uri: "", - attributes: {}, ns: {}, isSelfClosing: false } ] - - , [ "attribute", { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } ] - , [ "opentag", { name: "plain", prefix: "", local: "plain", uri: "", - attributes: { "attr": { name: "attr", value: "normal", uri: "", prefix: "", local: "attr", uri: "" } }, - ns: {}, isSelfClosing: true } ] - , [ "closetag", "plain" ] - - , [ "opennamespace", { prefix: "", uri: "uri:default" } ] - - , [ "attribute", { name: "xmlns", value: "uri:default", prefix: "xmlns", local: "", uri: "http://www.w3.org/2000/xmlns/" } ] - , [ "opentag", { name: "ns1", prefix: "", local: "ns1", uri: "uri:default", - attributes: { "xmlns": { name: "xmlns", value: "uri:default", prefix: "xmlns", local: "", uri: "http://www.w3.org/2000/xmlns/" } }, - ns: { "": "uri:default" }, isSelfClosing: false } ] - - , [ "attribute", { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } ] - , [ "opentag", { name: "plain", prefix: "", local: "plain", uri: "uri:default", ns: { '': 'uri:default' }, - attributes: { "attr": { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } }, - isSelfClosing: true } ] - , [ "closetag", "plain" ] - - , [ "closetag", "ns1" ] - - , [ "closenamespace", { prefix: "", uri: "uri:default" } ] - - , [ "opennamespace", { prefix: "a", uri: "uri:nsa" } ] - - , [ "attribute", { name: "xmlns:a", value: "uri:nsa", prefix: "xmlns", local: "a", uri: "http://www.w3.org/2000/xmlns/" } ] - - , [ "opentag", { name: "ns2", prefix: "", local: "ns2", uri: "", - attributes: { "xmlns:a": { name: "xmlns:a", value: "uri:nsa", prefix: "xmlns", local: "a", uri: "http://www.w3.org/2000/xmlns/" } }, - ns: { a: "uri:nsa" }, isSelfClosing: false } ] - - , [ "attribute", { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } ] - , [ "opentag", { name: "plain", prefix: "", local: "plain", uri: "", - attributes: { "attr": { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } }, - ns: { a: 'uri:nsa' }, - isSelfClosing: true } ] - , [ "closetag", "plain" ] - - , [ "attribute", { name: "a:attr", value: "namespaced", prefix: "a", local: "attr", uri: "uri:nsa" } ] - , [ "opentag", { name: "a:ns", prefix: "a", local: "ns", uri: "uri:nsa", - attributes: { "a:attr": { name: "a:attr", value: "namespaced", prefix: "a", local: "attr", uri: "uri:nsa" } }, - ns: { a: 'uri:nsa' }, - isSelfClosing: true } ] - , [ "closetag", "a:ns" ] - - , [ "closetag", "ns2" ] - - , [ "closenamespace", { prefix: "a", uri: "uri:nsa" } ] - - , [ "closetag", "root" ] - ] - , strict : true - , opt : { xmlns: true } - } - ) - diff --git a/build/node_modules/sax/test/xmlns-unbound-element.js b/build/node_modules/sax/test/xmlns-unbound-element.js deleted file mode 100644 index 9d031a2bdad..00000000000 --- a/build/node_modules/sax/test/xmlns-unbound-element.js +++ /dev/null @@ -1,33 +0,0 @@ -require(__dirname).test( - { strict : true - , opt : { xmlns: true } - , expect : - [ [ "error", "Unbound namespace prefix: \"unbound:root\"\nLine: 0\nColumn: 15\nChar: >"] - , [ "opentag", { name: "unbound:root", uri: "unbound", prefix: "unbound", local: "root" - , attributes: {}, ns: {}, isSelfClosing: true } ] - , [ "closetag", "unbound:root" ] - ] - } -).write(""); - -require(__dirname).test( - { strict : true - , opt : { xmlns: true } - , expect : - [ [ "opennamespace", { prefix: "unbound", uri: "someuri" } ] - , [ "attribute", { name: 'xmlns:unbound', value: 'someuri' - , prefix: 'xmlns', local: 'unbound' - , uri: 'http://www.w3.org/2000/xmlns/' } ] - , [ "opentag", { name: "unbound:root", uri: "someuri", prefix: "unbound", local: "root" - , attributes: { 'xmlns:unbound': { - name: 'xmlns:unbound' - , value: 'someuri' - , prefix: 'xmlns' - , local: 'unbound' - , uri: 'http://www.w3.org/2000/xmlns/' } } - , ns: { "unbound": "someuri" }, isSelfClosing: true } ] - , [ "closetag", "unbound:root" ] - , [ "closenamespace", { prefix: 'unbound', uri: 'someuri' }] - ] - } -).write(""); diff --git a/build/node_modules/sax/test/xmlns-unbound.js b/build/node_modules/sax/test/xmlns-unbound.js deleted file mode 100644 index b740e26124d..00000000000 --- a/build/node_modules/sax/test/xmlns-unbound.js +++ /dev/null @@ -1,15 +0,0 @@ - -require(__dirname).test( - { strict : true - , opt : { xmlns: true } - , expect : - [ ["error", "Unbound namespace prefix: \"unbound\"\nLine: 0\nColumn: 28\nChar: >"] - - , [ "attribute", { name: "unbound:attr", value: "value", uri: "unbound", prefix: "unbound", local: "attr" } ] - , [ "opentag", { name: "root", uri: "", prefix: "", local: "root", - attributes: { "unbound:attr": { name: "unbound:attr", value: "value", uri: "unbound", prefix: "unbound", local: "attr" } }, - ns: {}, isSelfClosing: true } ] - , [ "closetag", "root" ] - ] - } -).write("") diff --git a/build/node_modules/sax/test/xmlns-xml-default-ns.js b/build/node_modules/sax/test/xmlns-xml-default-ns.js deleted file mode 100644 index b1984d25509..00000000000 --- a/build/node_modules/sax/test/xmlns-xml-default-ns.js +++ /dev/null @@ -1,31 +0,0 @@ -var xmlns_attr = -{ - name: "xmlns", value: "http://foo", prefix: "xmlns", - local: "", uri : "http://www.w3.org/2000/xmlns/" -}; - -var attr_attr = -{ - name: "attr", value: "bar", prefix: "", - local : "attr", uri : "" -}; - - -require(__dirname).test - ( { xml : - "" - , expect : - [ [ "opennamespace", { prefix: "", uri: "http://foo" } ] - , [ "attribute", xmlns_attr ] - , [ "attribute", attr_attr ] - , [ "opentag", { name: "elm", prefix: "", local: "elm", uri : "http://foo", - ns : { "" : "http://foo" }, - attributes: { xmlns: xmlns_attr, attr: attr_attr }, - isSelfClosing: true } ] - , [ "closetag", "elm" ] - , [ "closenamespace", { prefix: "", uri: "http://foo"} ] - ] - , strict : true - , opt : {xmlns: true} - } - ) diff --git a/build/node_modules/sax/test/xmlns-xml-default-prefix-attribute.js b/build/node_modules/sax/test/xmlns-xml-default-prefix-attribute.js deleted file mode 100644 index e41f21875e4..00000000000 --- a/build/node_modules/sax/test/xmlns-xml-default-prefix-attribute.js +++ /dev/null @@ -1,36 +0,0 @@ -require(__dirname).test( - { xml : "" - , expect : - [ [ "attribute" - , { name: "xml:lang" - , local: "lang" - , prefix: "xml" - , uri: "http://www.w3.org/XML/1998/namespace" - , value: "en" - } - ] - , [ "opentag" - , { name: "root" - , uri: "" - , prefix: "" - , local: "root" - , attributes: - { "xml:lang": - { name: "xml:lang" - , local: "lang" - , prefix: "xml" - , uri: "http://www.w3.org/XML/1998/namespace" - , value: "en" - } - } - , ns: {} - , isSelfClosing: true - } - ] - , ["closetag", "root"] - ] - , strict : true - , opt : { xmlns: true } - } -) - diff --git a/build/node_modules/sax/test/xmlns-xml-default-prefix.js b/build/node_modules/sax/test/xmlns-xml-default-prefix.js deleted file mode 100644 index a85b4787f21..00000000000 --- a/build/node_modules/sax/test/xmlns-xml-default-prefix.js +++ /dev/null @@ -1,21 +0,0 @@ -require(__dirname).test( - { xml : "" - , expect : - [ - [ "opentag" - , { name: "xml:root" - , uri: "http://www.w3.org/XML/1998/namespace" - , prefix: "xml" - , local: "root" - , attributes: {} - , ns: {} - , isSelfClosing: true - } - ] - , ["closetag", "xml:root"] - ] - , strict : true - , opt : { xmlns: true } - } -) - diff --git a/build/node_modules/sax/test/xmlns-xml-default-redefine.js b/build/node_modules/sax/test/xmlns-xml-default-redefine.js deleted file mode 100644 index d35d5a0cbe2..00000000000 --- a/build/node_modules/sax/test/xmlns-xml-default-redefine.js +++ /dev/null @@ -1,41 +0,0 @@ -require(__dirname).test( - { xml : "" - , expect : - [ ["error" - , "xml: prefix must be bound to http://www.w3.org/XML/1998/namespace\n" - + "Actual: ERROR\n" - + "Line: 0\nColumn: 27\nChar: '" - ] - , [ "attribute" - , { name: "xmlns:xml" - , local: "xml" - , prefix: "xmlns" - , uri: "http://www.w3.org/2000/xmlns/" - , value: "ERROR" - } - ] - , [ "opentag" - , { name: "xml:root" - , uri: "http://www.w3.org/XML/1998/namespace" - , prefix: "xml" - , local: "root" - , attributes: - { "xmlns:xml": - { name: "xmlns:xml" - , local: "xml" - , prefix: "xmlns" - , uri: "http://www.w3.org/2000/xmlns/" - , value: "ERROR" - } - } - , ns: {} - , isSelfClosing: true - } - ] - , ["closetag", "xml:root"] - ] - , strict : true - , opt : { xmlns: true } - } -) - diff --git a/build/vswhere.exe b/build/vswhere.exe new file mode 100644 index 00000000000..1731aa6ed27 Binary files /dev/null and b/build/vswhere.exe differ diff --git a/lib/Microsoft.Web.Infrastructure.dll b/lib/Microsoft.Web.Infrastructure.dll deleted file mode 100644 index 85f1138c57b..00000000000 Binary files a/lib/Microsoft.Web.Infrastructure.dll and /dev/null differ diff --git a/lib/Mono.Data.Sqlite.dll b/lib/Mono.Data.Sqlite.dll deleted file mode 100644 index dad79f065d7..00000000000 Binary files a/lib/Mono.Data.Sqlite.dll and /dev/null differ diff --git a/lib/Mono.Security.dll b/lib/Mono.Security.dll deleted file mode 100644 index 1371f5cb635..00000000000 Binary files a/lib/Mono.Security.dll and /dev/null differ diff --git a/lib/MsgPack.XML b/lib/MsgPack.XML deleted file mode 100644 index 41ad85b1f3c..00000000000 --- a/lib/MsgPack.XML +++ /dev/null @@ -1,8549 +0,0 @@ - - - - MsgPack - - - - - Build serializer for . - - Object to be serialized/deserialized. - - - - Initializes a new instance of the class. - - The . - - - - Creates serializer for . - - - . This value will not be null. - - - - - Creates serializer for . - - Serialization target members. This will not be null nor empty. - - . This value will not be null. - - - - - Creates serializer as is array type. - - - . - This value will not be null. - - - - - Creates serializer as is map type. - - - . - This value will not be null. - - - - - Creates serializer as is tuple type. - - - . - This value will not be null. - - - - - Gets the . - - - The . - - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Defines common exception factory methods. - - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that value type cannot be null on deserialization. - - The name of the member. - The type of the member. - The type that declares the member. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that value type cannot be null on deserialization. - - The target type. - instance. It will not be null. - - - - of method. - - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that value type cannot serialize. - - The target type. - instance. It will not be null. - - - - of method. - - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that value type cannot deserialize. - - The target type. - instance. It will not be null. - - - - of method. - - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that item is not found on the unpacking stream. - - The index to be unpacking. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that target type is not serializable because it does not have public default constructor. - - The target type. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that target type is not serializable because it does not have both of public default constructor and public constructor with an Int32 parameter. - - The target type. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that there are no serializable fields and properties on the target type. - - The target type. - instance. It will not be null. - - - - of method. - - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that required field is not found on the unpacking stream. - - The name of the property. - instance. It will not be null. - - - - of method. - - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that unpacking stream ends on unexpectedly position. - - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that target collection type does not declare appropriate Add(T) method. - - The target type. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that unpacker is not in the array header, that is the state is invalid. - - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that unpacker is not in the array header, that is the state is invalid. - - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that operation is not supported because cannot be instanciated. - - Type. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that the array length does not match to expected tuple cardinality. - - The expected cardinality of the tuple. - The actual serialized array length. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that the underlying stream is not correct semantically because failed to unpack items count of array/map. - - The inner exception for the debug. The value is implementation specific. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that the unpacking collection is too large to represents in the current runtime environment. - - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that the the unpacker does not contain any data because the underlying stream is empty or unpacker has not been started. - - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that the member cannot be null or the unpacking value cannot be nil because nil value is explicitly prohibitted. - - The name of the member. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that the unpacking value cannot be nil because the target member is read only and its type is collection. - - The name of the member. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that the unpacking collection value is not a collection. - - The name of the member. - instance. It will not be null. - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Returns new exception to notify that the unpacking array size is not expected length. - - Expected, required for deserialization array length. - Actual array length. - instance. It will not be null. - - - - Represents serializing member information. - - - - - Emits 'for' statement on current IL stream. - - IL generator to be emitted to. - 'count' local variable which is type and holds maximum loop count. - Delegate to emit for statement body. - - - - Emits 'foreach' statement on the IL stream. - - IL generator to be emitted to. - which contains traits of the iterating collection. - 'collection' argument index. - Delegate to emit body statement. - - - - Emits appropriate loading member instructions. - - IL generator to be emitted to. - to be loaded. - - - - Emits appropriate storing member instructions. - - IL generator to be emitted to. - to be stored. - - - - Emits gets with exception handling. - Note that final state is the value is pushed top of the evaluation stack. - - IL generator. - Argument index of the unpacker. - - - - Represents member's data contract. - - - - - Initializes a new instance of the struct. - - The target member. - - - - Initializes a new instance of the struct from . - - The target member. - The data contract member attribute. This value can be null. - - - - Initializes a new instance of the struct from . - - The target member. - The MessagePack member attribute. This value can be null. - - - - Gets the name of the member. - - - The name of the member. - - - - - - Gets the ID of the member. - - - The ID of the member. Default is -1. - - - - - Gets the nil implication. - - - The nil implication. - - - - - Represents generic unpacking error. - - - - - Initializes a new instance of the class with the default error message. - - - - - Initializes a new instance of the class with a specified error message. - - The message that describes the error. - - - - Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - - The exception that is the cause of the current exception, or a null if no inner exception is specified. - - - - - Initializes a new instance of the class with serialized data. - - - The that holds the serialized object data about the exception being thrown. - - - The that contains contextual information about the source or destination. - - The parameter is null. - - - The class name is null or is zero (0). - - - - - Defines non-generic functions of . - - - - - Defines base contract for object serialization. - - Target type. - - - This class implements strongly typed serialization and deserialization. - - - When the underlying stream does not contain strongly typed or contains dynamically typed objects, - you should use directly and take advantage of . - - - - - - - - Defines non-generic message pack serializer interface. - - - - - Serialize specified object with specified . - - which packs values in . - Object to be serialized. - - is null. - - - is not compatible for this serializer. - - - The type of is not serializable etc. - - - - - Deserialize object with specified . - - which unpacks values of resulting object tree. - Deserialized object. - - is null. - - - Failed to deserialize object due to invalid unpacker state, stream content, or so. - - - Deserializing type is abstract type. - - - - - Deserialize collection items with specified and stores them to . - - which unpacks values of resulting object tree. - Collection that the items to be stored. - - is null. - Or is null. - - - is not compatible for this serializer. - - - Failed to deserialize object due to invalid unpacker state, stream content, or so. - - - The type of is not serializable etc. - - - - - Serialize specified object to the . - - Destination . - Object to be serialized. - - is null. - - - is not serializable etc. - - - - - Deserialize object from the . - - Source . - Deserialized object. - - is null. - - - is not serializable etc. - - - - - Serialize specified object with specified . - - which packs values in . - Object to be serialized. - - is null. - - - is not serializable etc. - - - - - Serialize specified object with specified . - - which packs values in . This value will not be null. - Object to be serialized. - - is not serializable etc. - - - - - Deserialize object with specified . - - which unpacks values of resulting object tree. - Deserialized object. - - is null. - - - Failed to deserialize object due to invalid unpacker state, stream content, or so. - - - is abstract type. - - - - - Deserialize object with specified . - - which unpacks values of resulting object tree. This value will not be null. - Deserialized object. - - Failed to deserialize object due to invalid unpacker state, stream content, or so. - - - is abstract type. - - - - - Deserialize collection items with specified and stores them to . - - which unpacks values of resulting object tree. - Collection that the items to be stored. - - is null. - Or is null. - - - Failed to deserialize object due to invalid unpacker state, stream content, or so. - - - is not collection. - - - - - Deserialize collection items with specified and stores them to . - - which unpacks values of resulting object tree. This value will not be null. - Collection that the items to be stored. This value will not be null. - - Failed to deserialize object due to invalid unpacker state, stream content, or so. - - - is not collection. - - - - - based on reflection, opt-out based. - - - - - - Initializes a new instance of the class. - - - - - Serialize specified object with specified . - - which packs values in . This value will not be null. - Object to be serialized. - - - - Deserialize object with specified . - - which unpacks values of resulting object tree. This value will not be null. - Deserialized object. - - - - Deserialize collection items with specified and stores them to . - - which unpacks values of resulting object tree. This value will not be null. - Collection that the items to be stored. This value will not be null. - - Failed to deserialize object due to invalid unpacker state, stream content, or so. - - - is not collection. - - - - - for a sequential collection using expression tree. - - The type of element. - - - - for array format stream. - - The type of target type. - - - - Implements expression tree based serializer for general object. - - The type of target object. - - - - Defines extension method to pack or unpack various objects. - - - - - Packs specified value with the default context. - - The type of the value. - The . - The value to be serialized. - - is null. - - - Cannot serialize . - - - - - Packs specified value with the specified context. - - The type of the value. - The . - The value to be serialized. - The holds shared serializers. - - is null. - Or is null. - - - Cannot serialize . - - - - - Packs specified value with the default context. - - The . - The value to be serialized. - - is null. - - - Cannot serialize . - - - - - Packs specified value with the specified context. - - The . - The value to be serialized. - The holds shared serializers. - - is null. - Or is null. - - - Cannot serialize . - - - - - Unpacks specified type value with the default context. - - The type of the value. - The . - The deserialized value. - - is null. - - - Cannot deserialize value. - - - - - Unpacks specified type value with the specified context. - - The type of the value. - The . - The holds shared serializers. - The deserialized value. - - is null. - Or is null. - - - Cannot deserialize value. - - - - - Define common convert rountines specific to MessagePack. - - - - - Encode specified string by default encoding. - - String value. - Encoded . - - is null. - - - - - Decode specified byte[] by default encoding. - - Byte[] value. - Decoded . - - is null. - - - contains non-UTF-8 bits. - - - - - Convert specified to . - - - value which is unpacked from packed message and may represent date-time value. - - - . Offset of this value always 0. - - - - - Convert specified to . - - - value which is unpacked from packed message and may represent date-time value. - - - . This value is always UTC. - - - - - Convert specified to as MessagePack defacto-standard. - - . - - UTC epoc time from 1970/1/1 0:00:00, in milliseconds. - - - - - Convert specified to as MessagePack defacto-standard. - - . - - UTC epoc time from 1970/1/1 0:00:00, in milliseconds. - - - - - Implements for . - - - This dictionary handles type semantics for the key. - Additionally, this dictionary implements 'freezing' feature. - For details, see , , and . - - - - - Initializes an empty new instance of the class with default capacity. - - - This operation is an O(1) operation. - - - - - Initializes an empty new instance of the class with specified initial capacity. - - The initial capacity. - - is negative. - - - This operation is an O(1) operation. - - - - - Initializes a new instance of the class. - - The dictionary to be copied from. - - is null. - - - Failed to copy from . - - - This constructor takes O(N) time, N is of . - Initial capacity will be of . - - - - - Determines whether the contains an element with the specified key. - - The key to locate in the . - - is . - - - true if the contains an element with the key; otherwise, false. - - - This method approaches an O(1) operation. - - - - - Determines whether the contains an element with the specified value. - - The value to locate in the . - - true if the contains an element with the value; otherwise, false. - - - This method approaches an O(N) operation where N is . - - - - - Gets the value associated with the specified key. - - - The key whose value to get. - - - When this method returns, the value associated with the specified key, if the key is found; - otherwise, the default value for the type of the parameter. - This parameter is passed uninitialized. - - - true if this dictionary contains an element with the specified key; otherwise, false. - - - is . - - - - Note that tiny integers are considered equal regardless of its CLI , - and UTF-8 encoded bytes are considered equals to . - - - This method approaches an O(1) operation. - - - - - - Adds the specified key and value to the dictionary. - - - The key of the element to add. - - - The value of the element to add. The value can be null for reference types. - - - An element with the same key already does not exist in the dictionary and sucess to add then newly added node; - otherwise null. - - - already exists in this dictionary. - Note that tiny integers are considered equal regardless of its CLI , - and UTF-8 encoded bytes are considered equals to . - - - is . - - - If is less than the capacity, this method approaches an O(1) operation. - If the capacity must be increased to accommodate the new element, - this method becomes an O(N) operation, where N is . - - - - - Removes the element with the specified key from the . - - The key of the element to remove. - - true if the element is successfully removed; otherwise, false. - This method also returns false if was not found in the original . - - - is . - - - This method approaches an O(1) operation. - - - - - Removes all items from the . - - - This method approaches an O(N) operation, where N is . - - - - - Returns an enumerator that iterates through the . - - - Returns an enumerator that iterates through the . - - - This method is an O(1) operation. - - - - - Freezes this instance. - - - This instance itself. - This value will not be null and its is true. - - - This method freezes this instance itself. - This operation is an O(1) operation. - - - - - Gets a copy of this instance as frozen instance. - - - New instance which contains same items as this instance. - This value will not be null and its is true. - - - This method does not freeze this instance itself. - This operation is an O(N) operation where O(N) of items. - - - - - Gets a value indicating whether this instance is frozen. - - - true if this instance is frozen; otherwise, false. - - - This operation is an O(1) operation. - - - - - Gets the number of elements contained in the . - - - The number of elements contained in the . - - - This operation is an O(1) operation. - - - - - Gets or sets the element with the specified key. - - - The element with the specified key. - - Key for geting or seting value. - - is . - - - The property is retrieved and is not found. - - - The property is set and this instance is frozen. - - - - Note that tiny integers are considered equal regardless of its CLI , - and UTF-8 encoded bytes are considered equals to . - - - This method approaches an O(1) operation. - - - - - - Gets an containing the keys of the . - - - An containing the keys of the object. - This value will not be null. - - - This operation is an O(1) operation. - - - - - Gets an containing the values of the . - - - An containing the values of the object. - This value will not be null. - - - This operation is an O(1) operation. - - - - - Represents the set of keys. - - - - - Copies the entire collection to a compatible one-dimensional array, starting at the beginning of the target array. - - - The one-dimensional that is the destination of the elements copied from this dictionary. - The must have zero-based indexing. - - - - - Copies the entire collection to a compatible one-dimensional array, - starting at the specified index of the target array. - - - The one-dimensional that is the destination of the elements copied from this dictionary. - The must have zero-based indexing. - - - The zero-based index in at which copying begins. - - - - - Copies a range of elements from this collection to a compatible one-dimensional array, - starting at the specified index of the target array. - - - The zero-based index in the source dictionary at which copying begins. - - - The one-dimensional that is the destination of the elements copied from this dictionary. - The must have zero-based indexing. - - - The zero-based index in at which copying begins. - - - The number of elements to copy. - - - - - Determines whether this collection contains a specific value. - - - The object to locate in this collection. - - true if is found in this collection; otherwise, false. - - - - - Determines whether this set is proper subset of the specified collection. - - - The collection to compare to the current set. - - - true if this set is proper subset of the specified collection; otherwise, false. - - - is Nothing. - - - - - Determines whether this set is proper superset of the specified collection. - - - The collection to compare to the current set. - - - true if this set is proper superset of the specified collection; otherwise, false. - - - is Nothing. - - - - - Determines whether this set is subset of the specified collection. - - - The collection to compare to the current set. - - - true if this set is subset of the specified collection; otherwise, false. - - - is Nothing. - - - - - Determines whether this set is superset of the specified collection. - - - The collection to compare to the current set. - - - true if this set is superset of the specified collection; otherwise, false. - - - is Nothing. - - - - - Determines whether the current set and a specified collection share common elements. - - - The collection to compare to the current set. - - - true if this set and share at least one common element; otherwise, false. - - - is Nothing. - - - - - Determines whether this set and the specified collection contain the same elements. - - - The collection to compare to the current set. - - - true if this set is equal to ; otherwise, false. - - - is Nothing. - - - - - Returns an enumerator that iterates through this collction. - - - Returns an enumerator that iterates through this collction. - - - - - Gets the number of elements contained in the . - - - The number of elements contained in the . - - - - - Enumerates the elements of a . - - - - - Releases all resources used by the this instance. - - - - - Advances the enumerator to the next element of the underlying collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, which is before the first element in the collection. - - - The collection was modified after the enumerator was created. - - - - - Gets the element at the current position of the enumerator. - - - The element in the underlying collection at the current position of the enumerator. - - - - - Gets the element at the current position of the enumerator. - - - The element in the collection at the current position of the enumerator, as an . - - - The enumerator is positioned before the first element of the collection or after the last element. - - - - - Represents the collection of values in a . - - - - - Copies the entire collection to a compatible one-dimensional array, starting at the beginning of the target array. - - - The one-dimensional that is the destination of the elements copied from this dictionary. - The must have zero-based indexing. - - - - - Copies the entire collection to a compatible one-dimensional array, - starting at the specified index of the target array. - - - The one-dimensional that is the destination of the elements copied from this dictionary. - The must have zero-based indexing. - - - The zero-based index in at which copying begins. - - - - - Copies a range of elements from this collection to a compatible one-dimensional array, - starting at the specified index of the target array. - - - The zero-based index in the source dictionary at which copying begins. - - - The one-dimensional that is the destination of the elements copied from this dictionary. - The must have zero-based indexing. - - - The zero-based index in at which copying begins. - - - The number of elements to copy. - - - - - Determines whether this collection contains a specific value. - - - The object to locate in this collection. - - true if is found in this collection; otherwise, false. - - - - - Returns an enumerator that iterates through this collction. - - - Returns an enumerator that iterates through this collction. - - - - - Gets the number of elements contained in the . - - - The number of elements contained in the . - - - - - Enumerates the elements of a . - - - - - Releases all resources used by the this instance. - - - - - Advances the enumerator to the next element of the underlying collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, which is before the first element in the collection. - - - The collection was modified after the enumerator was created. - - - - - Gets the element at the current position of the enumerator. - - - The element in the underlying collection at the current position of the enumerator. - - - - - Gets the element at the current position of the enumerator. - - - The element in the collection at the current position of the enumerator, as an . - - - The enumerator is positioned before the first element of the collection or after the last element. - - - - - Enumerates the elements of a in order. - - - - - Releases all resources used by the this instance. - - - - - Advances the enumerator to the next element of the underlying collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, which is before the first element in the collection. - - - The collection was modified after the enumerator was created. - - - - - Gets the element at the current position of the enumerator. - - - The element in the underlying collection at the current position of the enumerator. - - - - - Gets the element at the current position of the enumerator. - - - The element in the collection at the current position of the enumerator, as an . - - - The enumerator is positioned before the first element of the collection or after the last element. - - - - - Enumerates the elements of a in order. - - - - - Advances the enumerator to the next element of the underlying collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, which is before the first element in the collection. - - - The collection was modified after the enumerator was created. - - - - - Gets the element at the current position of the enumerator. - - - The element in the collection at the current position of the enumerator, as an . - - - The enumerator is positioned before the first element of the collection or after the last element. - - - - - Gets the element at the current position of the enumerator. - - - The element in the dictionary at the current position of the enumerator, as a B - - - The enumerator is positioned before the first element of the collection or after the last element. - - - - - Gets the key of the element at the current position of the enumerator. - - - The key of the element in the dictionary at the current position of the enumerator. - - - The enumerator is positioned before the first element of the collection or after the last element. - - - - - Gets the value of the element at the current position of the enumerator. - - - The value of the element in the dictionary at the current position of the enumerator. - - - The enumerator is positioned before the first element of the collection or after the last element. - - - - - Implements deserializing feature of MsgPack. - - - implements three mode, that is 'Streaming', 'Enumerating', 'Skipping', and 'Subtree'. - - - - Streaming - - - When the is called, unpacker go into 'Streaming' mode. - In this mode, unpacker unpacks individual entries as via property. - If the underlying stream is ended unexpectedly, then returns false, and will be null. - Note that if the underlying stream is feeded, that is the is expanded and its is not forwarded, - subsequent invocation will success, and is set as complete entry which reflects feeded binary. - - - If the reading of the entry is completed, that is the is not null, unpacker can transit other mode. - - - - - Enumerating - - - When the is called and the enumeration is started, unpacker go into 'Enumerating' mode. - In this mode, unpacker unpacks individual entries as via property. - If the underlying stream is ended unexpectedly, enumeration is interrupted. - The interrupted unpacker cannot be resume. - - - Once the enumeration is completed gracefully, unpacker can transit other mode. - - - - - Skipping - - - When the is called, unpacker go into 'Skipping' mode. - In this mode, unpacker scans the subtree where the root is current item, then returns skipped byte length. - If the underlying stream is ended unexpectedly, it returns null. - Note that if the underlying stream is feeded, that is the is expanded and its is not forwarded, - subsequent invocation will success, and returns length as complete entry which reflects feeded binary. - - If the underlying is cannot be seeked (that is, is false), - DO NOT use this method. - You can buffering the content via instead, for example. - - - - If the skipping of the subtree is completed, that is the return value is not null, unpacker can transit other mode. - - - - - Subtree - - - When the is called, unpacker go into 'Subtree' mode. - In this mode, any operation for this unpacker instance is invalid. - Instead of use this instance itself, you can use subtree unpacker returned from . - The subtree unpacker is the instance which scope is limited to the subtree where the root is the current entry when is called. - The subtree unpacker also have its own mode and state. - - of the subtree unpacker must be called to indicate subtree unpacking is gracefully completed. - When the extra entries are remained in the subtree, these will be skipped on the disposal process. - - - - Once the subtree unpacking is completed gracefully, that is, on the subtree unpacker called, the parant unpacker can transit other mode. - - - - - - - - - Verifies the mode. - - The mode to be. - - Already disposed. - - - Is in incompatible mode. - - - - - Verifies this instance is not disposed. - - - - - Returns new exception instance to notify invalid mode transition. - - New exception instance to notify invalid mode transition. - - - - Creates the new with internal buffer which has default size. - - instance. - - - - Creates the new from specified stream. - - The stream to be unpacked. This stream will be closed when is called. - instance. - - - - Creates the new from specified stream. - - The stream to be unpacked. - - true to close when this instance is disposed; - false, otherwise. - - instance. - - - - Initializes a new instance of the class. - - - - - Releases all managed resources. - - - - - Releases unmanaged and optionally managed resources. - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Starts unpacking of current subtree. - - - to unpack current subtree. - This will not be null. - - - This unpacker is not positioned on the header of array nor map. - - - While subtree unpacker is used, this instance will be 'locked' (called 'subtree' mode) and be unavailable. - When you finish to unpack subtree, you must invoke , - or you faces when you use the parent instance. - Subtree unpacker can only unpack subtree, so you can handle collection deserialization easily. - - - - - Starts unpacking of current subtree. - - - to unpack current subtree. - This will not be null. - - - - - Ends the read subtree. - - - This method only be called from subtree unpacker. - Custom subtree unpacker implementation must call this method from its method. - - - - - Reads next Message Pack entry. - - - true, if position is sucessfully move to next entry; - false, if position reaches the tail of the Message Pack stream. - - - This instance is in 'subtree' mode. - - - - - Reads next Message Pack entry. - - - true, if position is sucessfully move to next entry; - false, if position reaches the tail of the Message Pack stream. - - - - - Gets to enumerate from source stream. - - to enumerate from source stream. - - - - Skips the subtree where the root is the current entry, and returns skipped byte length. - - - Skipped byte length. - If the subtree is not completed, then null. - - - - - Skips the subtree where the root is the current entry, and returns skipped byte length. - - - Skipped byte length. - If the subtree is not completed, then null. - - - - - Gets current item or collection as single from the stream. - - - A read item or collection from the stream. - Or null when stream is ended. - - - - - Unpacks current subtree and returns subtree root as array or map. - - - An unpacked array or map when current position is array or map header. - null when current position is not array nor map header. - - - - - Get last unpacked data. - - Last unpacked data or null. - - If you use any of directory APIs (methods which return non-), - then this property to be invalidated. - - - - - Gets a value indicating whether this instance is positioned to array header. - - - true if this instance is positioned to array header; otherwise, false. - - - - - Gets a value indicating whether this instance is positioned to map header. - - - true if this instance is positioned to map header; otherwise, false. - - - - - Gets the items count for current array or map. - - - The items count for current array or map. - - - Both of the and are false. - - - - - Gets the underlying stream to handle direct API. - - - This instance does not supoort direct API. - - - - - Defines subtree unpacking unpacker. - - - - - Implements basic (maybe naive) implementation for common operation. - - - - - Represents serialization method for complex types. - - - - - The object will be serialized as array which is ordered by member ID. - This is default and more interoperable option. - - - - - The object will be serialized as map which is ordered by member ID. - This is a bit slower than array, but more stable for forward/backward compatibility. - - - - - like IL stream builder with tracing. - - - - - Emit 'call' or 'callvirt' appropriately. - - to be called. - - - - Emit property getter invocation. - Pre condition is there is target instance on the top of evaluation stack when is instance property. - Post condition are that target instance will be removed from the stack for instance property, and property value will be placed on there. - - for target property. - - - - Emit invocation. - - - - - Emit invocation. - - - - - Emit invocation. - Pre condition is that target instance is placed on the top of evaluation stack. - Post condition is that target instance will be replaced with of it. - - - - - Emit invocation with . - - - Index of temporary local variable index to store param array for . - Note that the type of local variable must be Object[]. - - Forat string literal. - - List of delegates to emittion of loading formatting parameter loading instruction. - Index of this array corresponds to index of formatting parameter. - 1st argument is this instance. - Post condition is that exactly one storing element will be added on the top of evaluation stack. - - - - - Emit invocation with . - - - Index of temporary local variable index to store param array for . - Note that the type of local variable must be Object[]. - - - Type of resource accessor. - - - Key of rethis. Note that this method assumes that key equals to accessor property name. - - - List of delegates to emittion of loading formatting parameter loading instruction. - Index of this array corresponds to index of formatting parameter. - 1st argument is this instance. - Post condition is that exactly one storing element will be added on the top of evaluation stack. - - - - - Emit invocation with . - - - Index of temporary local variable index to store param array for . - Note that the type of local variable must be Object[]. - - Forat string literal. - - List of delegates to emittion of loading formatting parameter loading instruction. - Index of this array corresponds to index of formatting parameter. - 1st argument is this instance. - Post condition is that exactly one storing element will be added on the top of evaluation stack. - - - - - Emit invocation with . - - - Index of temporary local variable index to store param array for . - Note that the type of local variable must be Object[]. - - - Type of resource accessor. - - - Key of rethis. Note that this method assumes that key equals to accessor property name. - - - List of delegates to emittion of loading formatting parameter loading instruction. - Index of this array corresponds to index of formatting parameter. - 1st argument is this instance. - Post condition is that exactly one storing element will be added on the top of evaluation stack. - - - - - Emit load 'this' pointer instruction (namely 'ldarg.0'). - Post condition is that the loaded value will be added on the evaluation stack. - - - - - Emit apprpriate 'ldarg.*' instruction. - Post condition is that the loaded value will be added on the evaluation stack. - - - Index of argument to be fetched. - - - - - Emit apprpriate 'ldloc.*' instruction. - Post condition is that the loaded value will be added on the evaluation stack. - - - Index of local variable to be fetched. - - - - - Emit array initialization code with initializer. - Pre condition is that the storing value is placed on the top of evaluation stack and its type is valid. - Post condition is that the stored value will be removed from the evaluation stack. - - - Index of local variable which stores the array. - - - - - Emit array initialization code without initializer. - Post condition is evaluation stack will no be modified as previous state. - Note that initialized array is not placed on the top of evaluation stack. - - of array element. This can be generaic parameter. - Size of array. - - - - Emit array initialization code with initializer. - Post condition is evaluation stack will no be modified as previous state. - Note that initialized array is not placed on the top of evaluation stack. - - - Index of local variable which stores the array. - - of array element. This can be generaic parameter. - - List of delegates to emittion of storing element loading instruction. - Index of this array corresponds to index of initializing array. - 1st argument is this instance. - Post condition is that exactly one storing element will be added on the top of stack and its type is compatible. - - - - - Emit array initialization code with initializer. - Post condition is evaluation stack will no be modified as previous state. - Note that initialized array is not placed on the top of evaluation stack. - - - Delegate to emittion of array loading instruction. - 1st argument is this instance. - Post condition is that exactly one target array will be added on the top of stack and element type is . - - - Delegate to emittion of array storing instruction. - 1st argument is this instance. - Pre condition is that the top of evaluation stack is array type and its element type is . - Post condition is that exactly one target array will be removed from the top of stack. - - of array element. This can be generaic parameter. - - List of delegates to emittion of storing element loading instruction. - Index of this array corresponds to index of initializing array. - 1st argument is this instance. - Post condition is that exactly one storing element will be added on the top of stack and its type is compatible. - - - - - Emit array element loading instructions. - Post condition is that exactly one loaded element will be placed on the top of stack and its element type is . - - of array element. This can be generaic parameter. - - Delegate to emittion of array loading instruction. - 1st argument is this instance. - Post condition is that exactly one target array will be added on the top of stack and its element type is . - - Index of array element. - - - - Emit array element storing instructions. - Post condition is evaluation stack will no be modified as previous state. - - of array element. This can be generaic parameter. - - Delegate to emittion of array loading instruction. - 1st argument is this instance. - Post condition is that exactly one target array will be added on the top of stack and its element type is . - - Index of array element. - - Delegate to emittion of storing element loading instruction. - 1st argument is this instance. - Post condition is that exactly one storing element will be added on the top of stack and its type is compatible. - - - - - Emit efficient integer constant loading. - Post condition is that exactly one integer will be added on the top of stack. - - Integer value. - - - - Emit 'typeof' expression. - Post condition is instance for will be placed on the top of evaluation stack. - - Target . - - - - Emit 'throw new ArgumentException(String,String,Exception)' statement. - Pre condition is that there are exactly three entries in the evaluation stack, - which are string, string, and Exception instance. - Post condition is that the evaluation statck will be empty. - - - - - Emit 'throw new TException(String,String,Exception)' statement. - Pre condition is that there are exactly two entries in the evaluation stack, - which are string and Exception instance. - Post condition is that the evaluation statck will be empty. - - of initializing and throwing . - - - - Emit 'nop' instruction with specified arguments. - - - - - Emit 'break' instruction with specified arguments. - - - - - Emit 'ldarg.0' instruction with specified arguments. - - - - - Emit 'ldarg.1' instruction with specified arguments. - - - - - Emit 'ldarg.2' instruction with specified arguments. - - - - - Emit 'ldarg.3' instruction with specified arguments. - - - - - Emit 'ldloc.0' instruction with specified arguments. - - - - - Emit 'ldloc.1' instruction with specified arguments. - - - - - Emit 'ldloc.2' instruction with specified arguments. - - - - - Emit 'ldloc.3' instruction with specified arguments. - - - - - Emit 'stloc.0' instruction with specified arguments. - - - - - Emit 'stloc.1' instruction with specified arguments. - - - - - Emit 'stloc.2' instruction with specified arguments. - - - - - Emit 'stloc.3' instruction with specified arguments. - - - - - Emit 'ldarg.s' instruction with specified arguments. - - as value. - - - - Emit 'ldarga.s' instruction with specified arguments. - - as value. - - - - Emit 'starg.s' instruction with specified arguments. - - as value. - - - - Emit 'ldloc.s' instruction with specified arguments. - - as value. - - - - Emit 'ldloca.s' instruction with specified arguments. - - as value. - - - - Emit 'stloc.s' instruction with specified arguments. - - as value. - - - - Emit 'ldnull' instruction with specified arguments. - - - - - Emit 'ldc.i4.m1' instruction with specified arguments. - - - - - Emit 'ldc.i4.0' instruction with specified arguments. - - - - - Emit 'ldc.i4.1' instruction with specified arguments. - - - - - Emit 'ldc.i4.2' instruction with specified arguments. - - - - - Emit 'ldc.i4.3' instruction with specified arguments. - - - - - Emit 'ldc.i4.4' instruction with specified arguments. - - - - - Emit 'ldc.i4.5' instruction with specified arguments. - - - - - Emit 'ldc.i4.6' instruction with specified arguments. - - - - - Emit 'ldc.i4.7' instruction with specified arguments. - - - - - Emit 'ldc.i4.8' instruction with specified arguments. - - - - - Emit 'ldc.i4.s' instruction with specified arguments. - - as value. - - - - Emit 'ldc.i4' instruction with specified arguments. - - as value. - - - - Emit 'ldc.i8' instruction with specified arguments. - - as value. - - - - Emit 'ldc.r4' instruction with specified arguments. - - as value. - - - - Emit 'ldc.r8' instruction with specified arguments. - - as value. - - - - Emit 'dup' instruction with specified arguments. - - - - - Emit 'pop' instruction with specified arguments. - - - - - Emit 'jmp' instruction with specified arguments. - - as target. - - - - Emit 'call' instruction with specified arguments. - - as target. - - - - Emit 'br.s' instruction with specified arguments. - - as target. - - - - Emit 'brfalse.s' instruction with specified arguments. - - as target. - - - - Emit 'brtrue.s' instruction with specified arguments. - - as target. - - - - Emit 'beq.s' instruction with specified arguments. - - as target. - - - - Emit 'bge.s' instruction with specified arguments. - - as target. - - - - Emit 'bgt.s' instruction with specified arguments. - - as target. - - - - Emit 'ble.s' instruction with specified arguments. - - as target. - - - - Emit 'blt.s' instruction with specified arguments. - - as target. - - - - Emit 'bne.un.s' instruction with specified arguments. - - as target. - - - - Emit 'bge.un.s' instruction with specified arguments. - - as target. - - - - Emit 'bgt.un.s' instruction with specified arguments. - - as target. - - - - Emit 'ble.un.s' instruction with specified arguments. - - as target. - - - - Emit 'blt.un.s' instruction with specified arguments. - - as target. - - - - Emit 'br' instruction with specified arguments. - - as target. - - - - Emit 'brfalse' instruction with specified arguments. - - as target. - - - - Emit 'brtrue' instruction with specified arguments. - - as target. - - - - Emit 'beq' instruction with specified arguments. - - as target. - - - - Emit 'bge' instruction with specified arguments. - - as target. - - - - Emit 'bgt' instruction with specified arguments. - - as target. - - - - Emit 'ble' instruction with specified arguments. - - as target. - - - - Emit 'blt' instruction with specified arguments. - - as target. - - - - Emit 'bne.un' instruction with specified arguments. - - as target. - - - - Emit 'bge.un' instruction with specified arguments. - - as target. - - - - Emit 'bgt.un' instruction with specified arguments. - - as target. - - - - Emit 'ble.un' instruction with specified arguments. - - as target. - - - - Emit 'blt.un' instruction with specified arguments. - - as target. - - - - Emit 'switch' instruction with specified arguments. - - [] as targets. - - - - Emit 'ldind.i1' instruction with specified arguments. - - - - - Emit 'ldind.u1' instruction with specified arguments. - - - - - Emit 'ldind.i2' instruction with specified arguments. - - - - - Emit 'ldind.u2' instruction with specified arguments. - - - - - Emit 'ldind.i4' instruction with specified arguments. - - - - - Emit 'ldind.u4' instruction with specified arguments. - - - - - Emit 'ldind.i8' instruction with specified arguments. - - - - - Emit 'ldind.i' instruction with specified arguments. - - - - - Emit 'ldind.r4' instruction with specified arguments. - - - - - Emit 'ldind.r8' instruction with specified arguments. - - - - - Emit 'ldind.ref' instruction with specified arguments. - - - - - Emit 'stind.ref' instruction with specified arguments. - - - - - Emit 'stind.i1' instruction with specified arguments. - - - - - Emit 'stind.i2' instruction with specified arguments. - - - - - Emit 'stind.i4' instruction with specified arguments. - - - - - Emit 'stind.i8' instruction with specified arguments. - - - - - Emit 'stind.r4' instruction with specified arguments. - - - - - Emit 'stind.r8' instruction with specified arguments. - - - - - Emit 'add' instruction with specified arguments. - - - - - Emit 'sub' instruction with specified arguments. - - - - - Emit 'mul' instruction with specified arguments. - - - - - Emit 'div' instruction with specified arguments. - - - - - Emit 'div.un' instruction with specified arguments. - - - - - Emit 'rem' instruction with specified arguments. - - - - - Emit 'rem.un' instruction with specified arguments. - - - - - Emit 'and' instruction with specified arguments. - - - - - Emit 'or' instruction with specified arguments. - - - - - Emit 'xor' instruction with specified arguments. - - - - - Emit 'shl' instruction with specified arguments. - - - - - Emit 'shr' instruction with specified arguments. - - - - - Emit 'shr.un' instruction with specified arguments. - - - - - Emit 'neg' instruction with specified arguments. - - - - - Emit 'not' instruction with specified arguments. - - - - - Emit 'conv.i1' instruction with specified arguments. - - - - - Emit 'conv.i2' instruction with specified arguments. - - - - - Emit 'conv.i4' instruction with specified arguments. - - - - - Emit 'conv.i8' instruction with specified arguments. - - - - - Emit 'conv.r4' instruction with specified arguments. - - - - - Emit 'conv.r8' instruction with specified arguments. - - - - - Emit 'conv.u4' instruction with specified arguments. - - - - - Emit 'conv.u8' instruction with specified arguments. - - - - - Emit 'callvirt' instruction with specified arguments. - - as target. - - - - Emit 'cpobj' instruction with specified arguments. - - as type. - - - - Emit 'ldobj' instruction with specified arguments. - - as type. - - - - Emit 'ldstr' instruction with specified arguments. - - as value. - - - - Emit 'newobj' instruction with specified arguments. - - as constructor. - - - - Emit 'castclass' instruction with specified arguments. - - as type. - - - - Emit 'isinst' instruction with specified arguments. - - as type. - - - - Emit 'conv.r.un' instruction with specified arguments. - - - - - Emit 'unbox' instruction with specified arguments. - - as type. - - - - Emit 'throw' instruction with specified arguments. - - - - - Emit 'ldfld' instruction with specified arguments. - - as field. - - - - Emit 'ldflda' instruction with specified arguments. - - as field. - - - - Emit 'stfld' instruction with specified arguments. - - as field. - - - - Emit 'ldsfld' instruction with specified arguments. - - as field. - - - - Emit 'ldsflda' instruction with specified arguments. - - as field. - - - - Emit 'stsfld' instruction with specified arguments. - - as field. - - - - Emit 'stobj' instruction with specified arguments. - - as type. - - - - Emit 'conv.ovf.i1.un' instruction with specified arguments. - - - - - Emit 'conv.ovf.i2.un' instruction with specified arguments. - - - - - Emit 'conv.ovf.i4.un' instruction with specified arguments. - - - - - Emit 'conv.ovf.i8.un' instruction with specified arguments. - - - - - Emit 'conv.ovf.u1.un' instruction with specified arguments. - - - - - Emit 'conv.ovf.u2.un' instruction with specified arguments. - - - - - Emit 'conv.ovf.u4.un' instruction with specified arguments. - - - - - Emit 'conv.ovf.u8.un' instruction with specified arguments. - - - - - Emit 'conv.ovf.i.un' instruction with specified arguments. - - - - - Emit 'conv.ovf.u.un' instruction with specified arguments. - - - - - Emit 'box' instruction with specified arguments. - - as type. - - - - Emit 'newarr' instruction with specified arguments. - - as type. - - - - Emit 'ldlen' instruction with specified arguments. - - - - - Emit 'ldelema' instruction with specified arguments. - - as type. - - - - Emit 'ldelem.i1' instruction with specified arguments. - - - - - Emit 'ldelem.u1' instruction with specified arguments. - - - - - Emit 'ldelem.i2' instruction with specified arguments. - - - - - Emit 'ldelem.u2' instruction with specified arguments. - - - - - Emit 'ldelem.i4' instruction with specified arguments. - - - - - Emit 'ldelem.u4' instruction with specified arguments. - - - - - Emit 'ldelem.i8' instruction with specified arguments. - - - - - Emit 'ldelem.i' instruction with specified arguments. - - - - - Emit 'ldelem.r4' instruction with specified arguments. - - - - - Emit 'ldelem.r8' instruction with specified arguments. - - - - - Emit 'ldelem.ref' instruction with specified arguments. - - - - - Emit 'stelem.i' instruction with specified arguments. - - - - - Emit 'stelem.i1' instruction with specified arguments. - - - - - Emit 'stelem.i2' instruction with specified arguments. - - - - - Emit 'stelem.i4' instruction with specified arguments. - - - - - Emit 'stelem.i8' instruction with specified arguments. - - - - - Emit 'stelem.r4' instruction with specified arguments. - - - - - Emit 'stelem.r8' instruction with specified arguments. - - - - - Emit 'stelem.ref' instruction with specified arguments. - - - - - Emit 'ldelem' instruction with specified arguments. - - as type. - - - - Emit 'stelem' instruction with specified arguments. - - as type. - - - - Emit 'unbox.any' instruction with specified arguments. - - as type. - - - - Emit 'conv.ovf.i1' instruction with specified arguments. - - - - - Emit 'conv.ovf.u1' instruction with specified arguments. - - - - - Emit 'conv.ovf.i2' instruction with specified arguments. - - - - - Emit 'conv.ovf.u2' instruction with specified arguments. - - - - - Emit 'conv.ovf.i4' instruction with specified arguments. - - - - - Emit 'conv.ovf.u4' instruction with specified arguments. - - - - - Emit 'conv.ovf.i8' instruction with specified arguments. - - - - - Emit 'conv.ovf.u8' instruction with specified arguments. - - - - - Emit 'refanyval' instruction with specified arguments. - - as type. - - - - Emit 'ckfinite' instruction with specified arguments. - - - - - Emit 'mkrefany' instruction with specified arguments. - - as type. - - - - Emit 'ldtoken' instruction with specified arguments. - - as target. - - - - Emit 'ldtoken' instruction with specified arguments. - - as target. - - - - Emit 'ldtoken' instruction with specified arguments. - - as target. - - - - Emit 'conv.u2' instruction with specified arguments. - - - - - Emit 'conv.u1' instruction with specified arguments. - - - - - Emit 'conv.i' instruction with specified arguments. - - - - - Emit 'conv.ovf.i' instruction with specified arguments. - - - - - Emit 'conv.ovf.u' instruction with specified arguments. - - - - - Emit 'add.ovf' instruction with specified arguments. - - - - - Emit 'add.ovf.un' instruction with specified arguments. - - - - - Emit 'mul.ovf' instruction with specified arguments. - - - - - Emit 'mul.ovf.un' instruction with specified arguments. - - - - - Emit 'sub.ovf' instruction with specified arguments. - - - - - Emit 'sub.ovf.un' instruction with specified arguments. - - - - - Emit 'endfinally' instruction with specified arguments. - - - - - Emit 'leave' instruction with specified arguments. - - as target. - - - - Emit 'leave.s' instruction with specified arguments. - - as target. - - - - Emit 'stind.i' instruction with specified arguments. - - - - - Emit 'conv.u' instruction with specified arguments. - - - - - Emit 'arglist' instruction with specified arguments. - - - - - Emit 'ceq' instruction with specified arguments. - - - - - Emit 'cgt' instruction with specified arguments. - - - - - Emit 'cgt.un' instruction with specified arguments. - - - - - Emit 'clt' instruction with specified arguments. - - - - - Emit 'clt.un' instruction with specified arguments. - - - - - Emit 'ldftn' instruction with specified arguments. - - as method. - - - - Emit 'ldvirtftn' instruction with specified arguments. - - as method. - - - - Emit 'ldarg' instruction with specified arguments. - - as index. - - - - Emit 'ldarga' instruction with specified arguments. - - as index. - - - - Emit 'starg' instruction with specified arguments. - - as index. - - - - Emit 'ldloc' instruction with specified arguments. - - as index. - - - - Emit 'ldloca' instruction with specified arguments. - - as index. - - - - Emit 'stloc' instruction with specified arguments. - - as index. - - - - Emit 'localloc' instruction with specified arguments. - - - - - Emit 'endfilter' instruction with specified arguments. - - - - - Emit 'initobj' instruction with specified arguments. - - as type. - - - - Emit 'cpblk' instruction with specified arguments. - - - - - Emit 'initblk' instruction with specified arguments. - - - - - Emit 'rethrow' instruction with specified arguments. - - - - - Emit 'sizeof' instruction with specified arguments. - - as type. - - - - Emit 'refanytype' instruction with specified arguments. - - - - - Initializes a new instance of the class. - - The method builder. - The trace writer. - - - - Initializes a new instance of the class. - - The dynamic method. - The trace writer. - - - - Initializes a new instance of the class. - - The method builder. - The trace writer. - true if the underlying builders are debuggable; othersie false. - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - - - - Emit 'ret' instruction with specified arguments. - - - - - Declare local without pinning and name for debugging. - - of local variable. - to refer declared local variable. - - - - Declare local without name for debugging. - - of local variable. - If true, the local variable will be pinned. - to refer declared local variable. - - - - Declare local with name for debugging and without pinning. - Note that this method is not enabled for dynamic method. - - of local variable. - Name of the local variable. - to refer declared local variable. - - - - Declare local with name for debugging. - Note that this method is not enabled for dynamic method. - - of local variable. - Name of the local variable. - If true, the local variable will be pinned. - to refer declared local variable. - - - - Emit exception block with catch blocks. - - - which emits exception block (try in C#) body. - A 1st argument is this , - and a 2nd argument is will to be end of emitting exception block. - The delegate do not have to emit leave or leave.s instrauction at tail of the body. - - - for catch block body emittion. - A 1st item of the tuple is which indicates catching exception type. - A 2nd item of the tuple is which emits catch block body. - A 1st argument of the delegate is this , - a 2nd argument of the delegate is will to be end of emitting exception block, - and 3rd argument of the delegate is the 1st item of the tuple. - The delegate do not have to emit leave or leave.s instrauction at tail of the body. - - - for catch block body emittion. - A 1st item of the tuple is which indicates catching exception type. - A 2nd item of the tuple is which emits catch block body. - A 1st argument of the delegate is this , - a 2nd argument of the delegate is will to be end of emitting exception block, - and 3rd argument of the delegate is the 1st item of the tuple. - The delegate do not have to emit leave or leave.s instrauction at tail of the body. - - - - - Emit exception block with catch blocks and a finally block. - - - which emits exception block (try in C#) body. - A 1st argument is this , - and a 2nd argument is will to be end of emitting exception block. - The delegate do not have to emit leave or leave.s instrauction at tail of the body. - - - which emits finally block body. - A 1st argument is this , - and a 2nd argument is will to be end of emitting exception block. - The delegate do not have to emit endfinally instrauction at tail of the body. - - - for catch block body emittion. - A 1st item of the tuple is which indicates catching exception type. - A 2nd item of the tuple is which emits catch block body. - A 1st argument of the delegate is this , - a 2nd argument of the delegate is will to be end of emitting exception block, - and 3rd argument of the delegate is the 1st item of the tuple. - The delegate do not have to emit leave or leave.s instrauction at tail of the body. - - - - - Begin exception block (try in C#) here. - Note that you do not have to emit leave or laeve.s instrauction at tail of the body. - - will to be end of begun exception block. - - - - Begin catch block with specified exception. - Note that you do not have to emit leave or laeve.s instrauction at tail of the body. - - for catch. - - - - Begin filter block. - Note that you do not have to emit leave or laeve.s instrauction at tail of the body. - - - - - Begin fault block. - Note that you do not have to emit endfinally instrauction at tail of the body. - - - - - Begin finally block. - Note that you do not have to emit endfinally instrauction at tail of the body. - - - - - End current exception block and its last clause. - - - - - Define new without name for tracing. - - which will be target of branch instructions. - - - - Define new with name for tracing. - - Name of label. Note that debugging information will not have this name. - which will be target of branch instructions. - - - - Mark current position using specifieid . - - . - - - - Emit 'calli' instruction for indirect unmanaged function call. - - of unmanaged function. - Return of the function. - Parameter s of the function. - - - - Emit 'calli' instruction for indirect managed method call. - - of managed method. - Return of the method. - Required parameter s of the method. - Optional varargs parameter s of the method. - - - - Emit constrained 'callvirt' instruction. - - to be constrained to. - Target which must be virtual method. - - - - Emit readonly 'ldelema' instruction. - - of array element. - - - - Emit 'call' instruction with specified arguments as tail call. - - as target. - - Subsequent 'ret' instruction will be emitted together. - - - - - Emit 'callvirt' instruction with specified arguments as tail call. - - as target. - - Subsequent 'ret' instruction will be emitted together. - - - - - Emit 'calli' instruction for indirect unmanaged function call as tail call. - - of unmanaged function. - Return of the function. - Parameter s of the function. - - Subsequent 'ret' instruction will be emitted together. - - - - - Emit 'calli' instruction for indirect managed method call as tail call. - - of managed method. - Return of the method. - Required parameter s of the method. - Optional varargs parameter s of the method. - - Subsequent 'ret' instruction will be emitted together. - - - - - Emit 'unaligned.' prefix. - - Alignment. - - - - Write trace message. - - The string. - - - - Write trace message. - - The format string. - Format argument. - - - - Write trace message. - - The format string. - Format arguments. - - - - Write trace line break. - - - - - Write trace message followed by line break. - - The string. - - - - Write trace message followed by line break. - - The format string. - Format argument. - - - - Write trace message followed by line break. - - The format string. - Format arguments. - - - - Get for end of method. - - - for end of method. - - - - - Get for end of current exception blocks. - - - for end of current exception blocks. - When there are no exception blocks, then null. - - - - - Get whether there are any exception blocks in current positon. - - - If there are any exception blocks in current positon then true; otherwise, false. - - - - - Get the value whether this instance used for dynamic method. - - If this instance used for dynamic method then true; otherwise false. - - Dynamic method does not support debugging information like local variable name. - - - - - Get level of indentation. - - - - - Get or set indent characters. - - - to be used to indent. - To reset default, specify null. - - - - - Get current line number. - - Current line number. - - - - Get whether this IL stream is ended with 'ret'. - - - When this IL stream is ended with 'ret' then true; otherwise, false. - - - - - Define utility extension method for generic type. - - - - - Determine whether the source type implements specified generic type or its built type. - - Target type. - Generic interface type. - - true if implements , - or built closed generic interface type; - otherwise false. - - - - - Get name of type without namespace and assembly name of itself and its generic arguments. - - Target type. - Simple name of type. - - - - Get full name of type including namespace and excluding assembly name of itself and its generic arguments. - - Target type. - Full name of type. - - - - Lazy initialized serializer which delegates actual work for the other serializer implementation. - - - The type of target type. - - - This serializer is intended to support self-composit structure like directories or XML nodes. - - - - - Initializes a new instance of the class. - - - The serialization context to support lazy retrieval. - - - - - using to hold serializers for target members. - - - - - Genereates serialization methods which can be save to file. - - - - - Flushes the trace. - - - - - Initializes a new instance of the class. - - - - - Releases all managed resources. - - - - - Releases unmanaged and optionally managed resources. - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Gets the IL generator to implement overrides. - - - The IL generator to implement overrides. - This value will not be null. - - - - - Gets the IL generator to implement overrides. - - - The IL generator to implement overrides. - This value will not be null. - - - - - Gets the IL generator to implement overrides. - - - The IL generator to implement overrides. - - - When this method is called, will be overridden. - This value will not be null. - - - - - Creates the serializer type built now and returns its new instance. - - Target type to be serialized/deserialized. - The to holds serializers. - - Newly built instance. - This value will not be null. - - - - - Regisgter using target type to the current emitting session. - - Type to be serialized/deserialized. - - to emit serializer retrieval instructions. - The 1st argument should be to emit instructions. - The 2nd argument should be argument index of the serializer holder. - This value will not be null. - - - - - Gets a value indicating whether this instance is trace enabled. - - - true if the trace enabled; otherwise, false. - - - - - Gets the for tracing. - - - The for tracing. - This value will not be null. - - - - - Initializes a new instance of the class. - - Type of the target. - - - - Gets the IL generator to implement overrides. - - - The IL generator to implement overrides. - This value will not be null. - - - - - Gets the IL generator to implement overrides. - - - The IL generator to implement overrides. - This value will not be null. - - - - - Gets the IL generator to implement overrides. - - - The IL generator to implement overrides. - - - - - Creates the serializer type built now and returns its new instance. - - Target type to be serialized/deserialized. - The to holds serializers. - - Newly built instance. - This value will not be null. - - - - - Regisgter using target type to the current emitting session. - - Type to be serialized/deserialized. - - to emit serializer retrieval instructions. - The 1st argument should be to emit instructions. - The 2nd argument should be argument index of the serializer holder. - This value will not be null. - - - - - Callback based to implement context-based serialization. - - The type of target type. - - - - Provides bit access for . - - - - - Value as . - - - - - Most significant byte of current endian. - - - - - 2nd bit from most significant byte of current endian. - - - - - 3rd byte from most significant byte of current endian. - - - - - Least byte of current endian. - - - - - Initializes a new instance of the type from specified . - - Value of . - - - - Initializes a new instance of the type from specified [] which is big endian. - - Array of which contains bytes in big endian. - Offset to read. - - - - Implements which reads raw binary with specific . - - - - - Gets the length of the underlying raw binary length. - - - The length of the underlying raw binary length. - This value will not be negative. - - - - - Utilities related to member/type ID. - - - - - Builds the name of the generating method. - - The operation. - Type of the target. - Name of the target member. - Name of the method. - - - - for a map collection using expression tree. - - The type of element. - - - - Implements common features code generation based serializer builders. - - The type of the serialization target. - - - - Initializes a new instance of the class. - - The . - - - - Creates serializer for . - - Serialization target members. This will not be null nor empty. - - . This value will not be null. - - - - - Emits the ILs to pack the members of the current type. - - holding emittion context information. - to emit IL. - The array of s where each represents the member to be (de)serialized. - - - - Creates serializer as is array type. - - - . - This value will not be null. - - - - - Creates serializer as is map type. - - - . - This value will not be null. - - - - - Creates serializer as is tuple type. - - - . - This value will not be null. - - - - - Provides bit access for . - - - - - Value as . - - - - - Most significant byte of current endian. - - - - - 2nd bit from most significant byte of current endian. - - - - - 3rd byte from most significant byte of current endian. - - - - - 4th byte from most significant byte of current endian. - - - - - 5th byte from most significant byte of current endian. - - - - - 6th byte from most significant byte of current endian. - - - - - 7th byte from most significant byte of current endian. - - - - - Least significant byte of current endian. - - - - - Initializes a new instance of the type from specified . - - Value of . - - - - Initializes a new instance of the type from specified [] which is big endian. - - Array of which contains bytes in big endian. - Offset to read. - - - - Debugger type proxy for . - - The key type of the dictionary. - The value type of the dictionary. - - - - Defines direct conversion value from/to Message Pack binary stream without intermediate . - - - This class provides convinient way to unpack objects from wellknown seekable stream. - This class does not support stream feeding. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks value from the specified . - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array with UTF-8 encoding. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - Or, the unpacked result in the is invalid as UTF-8 encoded byte stream. - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the head of specified byte array with specified encoding. - - The byte array which contains Message Pack binary stream. - The to decode binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - Or, is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - Or, the unpacked result in the is invalid as UTF-8 encoded byte stream. - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from specified offsetted byte array with UTF-8 encoding. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked value and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not greater than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - Or, the unpacked result in the is invalid as specified encoding byte stream. - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from specified offsetted byte array with specified encoding. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - The to decode binary stream. - - The of which contains unpacked value and processed bytes count. - - - is null. - Or, is null. - - - is empty. - Or, the length of is not greater than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - Or, the unpacked result in the is invalid as specified encoding byte stream. - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified with UTF-8 encoding. - - The which contains Message Pack binary stream. - - The unpacked value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not raw binary. - Or, the unpacked result in the is invalid as UTF-8 encoded byte stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks value from the specified with specified encoding. - - The which contains Message Pack binary stream. - The to decode binary stream. - - The unpacked value. - - - is null. - Or is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not raw binary. - Or, the unpacked result in the is invalid as specified encoding byte stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks raw value from the specified as . - - The which contains Message Pack binary stream. - - The which represents raw value stream. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not raw binary. - Note that the state of will be unpredictable espicially it is not seekable. - - - - does not own , so still should be closed. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks raw value from the specified as with UTF-8 encoding. - - The which contains Message Pack binary stream. - - The which represents raw value stream as UTF-8 string. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not raw binary. - Note that the state of will be unpredictable espicially it is not seekable. - - - - if contains invalid sequence as UTF-8 encoding string, - the may occurs on read char. - - - does not own , so still should be closed. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks raw value from the specified as with specified encoding. - - The which contains Message Pack binary stream. - The to decode binary stream. - - The which represents raw value stream as UTF-8 string. - - - is null. - Or, is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not raw binary. - Note that the state of will be unpredictable espicially it is not seekable. - - - - if contains invalid sequence as specified encoding string, - the may occurs on read char. - - - does not own , so still should be closed. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the array from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked the array and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - The items count of the underlying collection body is over . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the array from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked the array and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - The items count of the underlying collection body is over . - - - When the type of packed value is not known, use instead. - - - - - Unpacks the array value from the specified . - - The which contains Message Pack binary stream. - - The unpacked the array value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - The items count of the underlying collection body is over . - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks length of the array from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of nullable which contains unpacked length of the array and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to nullable . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks length of the array from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of nullable which contains unpacked length of the array and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to nullable . - - - When the type of packed value is not known, use instead. - - - - - Unpacks length of the array value from the specified . - - The which contains Message Pack binary stream. - - The unpacked length of the array value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to nullable . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the dictionary from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked the dictionary and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - The items count of the underlying collection body is over . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the dictionary from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked the dictionary and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - The items count of the underlying collection body is over . - - - When the type of packed value is not known, use instead. - - - - - Unpacks the dictionary value from the specified . - - The which contains Message Pack binary stream. - - The unpacked the dictionary value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - The items count of the underlying collection body is over . - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks count of the dictionary entries from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of nullable which contains unpacked count of the dictionary entries and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to nullable . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks count of the dictionary entries from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of nullable which contains unpacked count of the dictionary entries and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to nullable . - - - When the type of packed value is not known, use instead. - - - - - Unpacks count of the dictionary entries value from the specified . - - The which contains Message Pack binary stream. - - The unpacked count of the dictionary entries value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to nullable . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the raw binary from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of [] which contains unpacked the raw binary and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to []. - - - The items count of the underlying collection body is over . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the raw binary from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of [] which contains unpacked the raw binary and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to []. - - - The items count of the underlying collection body is over . - - - When the type of packed value is not known, use instead. - - - - - Unpacks the raw binary value from the specified . - - The which contains Message Pack binary stream. - - The unpacked the raw binary value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to []. - Note that the state of will be unpredictable espicially it is not seekable. - - - The items count of the underlying collection body is over . - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the boolean from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked the boolean and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the boolean from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked the boolean and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks the boolean value from the specified . - - The which contains Message Pack binary stream. - - The unpacked the boolean value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the nil from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked the nil and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the nil from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked the nil and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks the nil value from the specified . - - The which contains Message Pack binary stream. - - The unpacked the nil value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the which represents the value which has MessagePack type semantics. from the head of specified byte array. - - The byte array which contains Message Pack binary stream. - - The of which contains unpacked the which represents the value which has MessagePack type semantics. and processed bytes count. - - - is null. - - - is empty. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - - Invocation of this method is equivalant to call with offset is 0. - - - When the type of packed value is not known, use instead. - - - - - - Unpacks the which represents the value which has MessagePack type semantics. from the specified byte array. - - The byte array which contains Message Pack binary stream. - The offset to be unpacking start with. - - The of which contains unpacked the which represents the value which has MessagePack type semantics. and processed bytes count. - - - is null. - - - is empty. - Or, the length of is not grator than . - - - is negative value. - - - is not valid MessagePack stream. - - - The unpacked result in the is not compatible to . - - - When the type of packed value is not known, use instead. - - - - - Unpacks the which represents the value which has MessagePack type semantics. value from the specified . - - The which contains Message Pack binary stream. - - The unpacked the which represents the value which has MessagePack type semantics. value. - - - is null. - - - The of is false. - - - is not valid MessagePack stream. - Note that the state of will be unpredictable espicially it is not seekable. - - - The unpacked result in the is not compatible to . - Note that the state of will be unpredictable espicially it is not seekable. - - - - The processed bytes count can be calculated via of when the is true. - - - When the type of packed value is not known, use instead. - - - - - - Represents raw binary as read only . - - - - This object behaves as wrapper of the underlying which contains message pack encoded byte array. - But, this object does not own the stream, so that stream is not closed when this stream is closed. - - - The value of , timeout, and async API depends on the underlying stream. - - - - - - Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. - - - An array of bytes. When this method returns, - the buffer contains the specified byte array with the values between and ( + - 1) - replaced by the bytes read from the current source. - - - The zero-based byte offset in at which to begin storing the data read from the current stream. - - - The maximum number of bytes to be read from the current stream. - - - The total number of bytes read into the buffer. - This can be less than the number of bytes requested if that many bytes are not currently available, - or zero (0) if the end of the stream has been reached. - - - The sum of and is larger than the buffer length. - - - is null. - - - or is negative. - - - An I/O error occurs. - - - Methods were called after the stream was closed. - - - - Arguments might be passed to the underlying without any validation. - - - - - - Overrides so that no action is performed. - - - - - Throws . - - Never used. - - Always thrown. - - - - - Throws . - - Never used. - Never used. - Never used. - - Always thrown. - - - - - Gets a value indicating whether the current stream supports reading. - - Always true. - - - - Gets a value indicating whether the current stream supports writing. - - Always false. - - - - Gets the length in bytes of the stream. - - - A long value representing the length of the raw binary length. - This value must be between 0 and . - - - Methods were called after the stream was closed. - - - This property never throws even if is false. - - - - - Gets a value that determines whether the current stream can time out. - - - A value that determines whether the current stream can time out. - - - Methods were called after the stream was closed. - - - - - Basic implementation using managed . - - - - - Implements serialization feature of MsgPack. - - - - - Initializes a new instance of the class. - - - - - Create standard Safe instancde wrapping specified . - - object. This stream will be closed when is called. - Safe . This will not be null. - is null. - - You can specify any derived class like , , - NetworkStream, , or so. - - - - - Create standard Safe instancde wrapping specified . - - object. - - true to close when this instance is disposed; - false, otherwise. - - Safe . This will not be null. - is null. - - You can specify any derived class like , , - NetworkStream, , or so. - - - - - Clean up internal resources. - - - - - When overridden by derived class, release all unmanaged resources, optionally release managed resources. - - If true, release managed resources too. - - - - When overridden by derived class, change current position to specified offset. - - Offset. You shoud not specify the value which causes underflow or overflow. - - A class of this instance does not support seek. - - - - - When overridden by derived class, writes specified byte to stream using implementation specific manner. - - A byte to be written. - - - - Writes specified bytes to stream using implementation specific most efficient manner. - - Collection of bytes to be written. - - - - Writes specified bytes to stream using implementation specific most efficient manner. - - Bytes to be written. - If the can be treat as immutable (that is, can be used safely without copying) then true. - - - - Pack value to current stream. - - value. - This instance. - This instance has been disposed. - - - - Try pack value to current stream strictly. - - Maybe value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Pack value to current stream. - - value. - This instance. - This instance has been disposed. - - - - Try pack value to current stream strictly. - - Maybe value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Pack value to current stream. - - value. - This instance. - This instance has been disposed. - - - - Try pack value to current stream strictly. - - Maybe value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Pack value to current stream. - - value. - This instance. - This instance has been disposed. - - - - Try pack value to current stream strictly. - - Maybe value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Pack value to current stream. - - value. - This instance. - This instance has been disposed. - - - - Try pack value to current stream strictly. - - Maybe value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Pack value to current stream. - - value. - This instance. - This instance has been disposed. - - - - Try pack value to current stream strictly. - - Maybe value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Pack value to current stream. - - value. - This instance. - This instance has been disposed. - - - - Try pack value to current stream strictly. - - Maybe value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Pack value to current stream. - - value. - This instance. - This instance has been disposed. - - - - Try pack value to current stream strictly. - - Maybe value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Pack value to current stream. - - value. - This instance. - - - - Pack value to current stream. - - value. - This instance. - - - - Pack value to current stream. - - value. - This instance. - - - - Bookkeep array length to be packed on current stream. - - Array length. - This instance. - This instance has been disposed. - - - - Bookkeep array length to be packed on current stream. - - Array length. - This instance. - - - - Bookkeep dictionary items count to be packed on current stream. - - Dictionary items count. - This instance. - This instance has been disposed. - - - - Bookkeep dictionary items count to be packed on current stream. - - Dictionary items count. - This instance. - - - - Bookkeep byte length to be packed on current stream. - - Byte length. - This instance. - This instance has been disposed. - - - - Bookkeep byte length to be packed on current stream. - - Byte length. - This instance. - - - - Pack specified byte stream to current stream. - - Source bytes its size is not known. - This instance. - This instance has been disposed. - - - - Pack specified byte stream to current stream. - - Source bytes its size is known. - This instance. - This instance has been disposed. - - - - Pack specified byte array to current stream. - - Source byte array. - This instance. - This instance has been disposed. - - - - Pack specified byte array to current stream without any header. - - Source byte array. - This instance. - This instance has been disposed. - - If you forget to write header first, then resulting stream will be corrupsed. - - - - - Packs specified byte sequence to current stream without any header. - - Source byte array. - This instance. - This instance has been disposed. - - If you forget to write header first, then resulting stream will be corrupsed. - - - - - Pack specified char stream to current stream with UTF-8 . - - Source chars its size is not known. - This instance. - This instance has been disposed. - - - - Pack specified string to current stream with UTF-8 . - - Source string. - This instance. - This instance has been disposed. - - - - Pack specified char stream to current stream with specified . - - Source chars its size is not known. - to be used. - This instance. - This instance has been disposed. - - - - Pack specified string to current stream with specified . - - Source string. - to be used. - This instance. - This instance has been disposed. - - - - Pack specified char stream to current stream with specified . - - Source chars its size is not known. - to be used. - - - - Pack specified string to current stream with specified . - - Source string. - to be used. - - - - Bookkeep collection count to be packed on current stream. - - Collection count to be written. - This instance. - This instance has been disposed. - - - - Bookkeep dictionary count to be packed on current stream. - - Dictionary count to be written. - This instance. - This instance has been disposed. - - - - Try pack value to current stream as tiny fix num. - - Maybe tiny value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Try pack value to current stream as tiny fix num. - - Maybe tiny value. - If has be packed successfully then true, otherwise false (normally, larger type required). - - - - Pack a null value to current stream. - - This instance. - This instance has been disposed. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Pack nullable value. - - Value to serialize. - This packer instance. - - - - Get whether this class supports seek operation and quering property. - - If this class supports seek operation and quering property then true. - - - - Get current position of underlying stream. - - Opaque position value of underlying stream. - - A class of this instance does not support seek. - - - - - Provides pre-compiled serialier assembly generation. - - - Currently, generated assembly has some restrictions: - - - The type name cannot be customize. It always to be MsgPack.Serialization.EmittingSerializers.Generated.<ESCAPED_TARGET_NAME>Serializer. - Note that the ESCAPED_TARGET_NAME is the string generated by replacing type delimiters with undersecore ('_'). - - - The assembly cannot be used on WinRT because - - - - You should NOT assume at all like class hierarchy of generated type, its implementing interfaces, custom attributes, or dependencies. - They subject to be changed in the future. - If you want to get such fine grained control for them, you should implement own hand made serializers. - - - - - - Initializes a new instance of the class. - - Type of the root object which will be serialized/deserialized. - Name of the assembly to be generated. - - is null. - Or is null. - - - - - Generates the serializer assembly and save it to current directory. - - - - - Gets the type of the root object which will be serialized/deserialized. - - - The type of the root object which will be serialized/deserialized. - This value will not be null. - - - - - Gets the name of the assembly to be generated. - - - The name of the assembly to be generated. - - - - - Gets or sets the which indicates serialization method to be used. - - - The which indicates serialization method to be used. - - - - - Defines non-generic interface of actual generic serializer builder. - - - - - Generates the assembly and saves it to current directory. - - The dedicated . - The dedicated . - - - - Actual generic serializer builder. - - The type of root type. - - - - Generates the assembly and saves it to current directory. - - The dedicated . - The dedicated . - - - - Speifies nil implication in serialization/deserialization. - - - - - A nil is interpreted as default value of the member. - - - - This value affects only deserialization. - - - If the unpacking value is nil, the serializer will not set any value to the member. - - - This value corresponds to optional on the IDL. - - - This is default option because the most safe option. - - - - - - A nil is interpreted as null. - - - - This value affects only deserialization. - - - If the unpacking value is nil, the serializer will set null to the member. - If the member is non-nullable value type and the packed value is nil, then will be thrown. - - - This value corresponds to nullable required on the IDL. - - - If the destination end point sends nil for the value type member like type, - you can avoid the exception with change the type of the member to nullable value type. - - - - - - A nil is prohibitted. - - - - This value affects both of serialization and deserialization. - - - If the packing value is null or the unpacking value is nil, - the serializer will throw exception. - - - This value corresponds to required on the IDL. - - - When you specify this value to newly added member, - it means that you BREAK backword compatibility. - - - - - - Represents unpacking error when message type is unknown or unavailable. - - - - - Initializes a new instance of the class with the default error message. - - - - - Initializes a new instance of the class with a specified error message. - - The message that describes the error. - - - - Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - - The exception that is the cause of the current exception, or a null if no inner exception is specified. - - - - - Initializes a new instance of the class with serialized data. - - - The that holds the serialized object data about the exception being thrown. - - - The that contains contextual information about the source or destination. - - The parameter is null. - - - The class name is null or is zero (0). - - - - - Exception occurs when serialized stream contains structures or features which will never be supported by MsgPack/CLI implementation. - - - - - Initializes a new instance of the class with the default error message. - - - - - Initializes a new instance of the class with a specified error message. - - The message that describes the error. - - - - Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - - The exception that is the cause of the current exception, or a null if no inner exception is specified. - - - - - Initializes a new instance of the class with serialized data. - - - The that holds the serialized object data about the exception being thrown. - - - The that contains contextual information about the source or destination. - - The parameter is null. - - - The class name is null or is zero (0). - - - - - Implements of . - - - - - Initializes a new instance of the class. - - - - - Determines whether two objects of type are equal. - - The first object to compare. - The second object to compare. - - true if the specified objects are equal; otherwise, false. - - - - - Returns a hash code for the specified . - - The . - - A hash code for , suitable for use in hashing algorithms and data structures like a hash table. - - - - - Represents deserialized object of MsgPack. - - - - - Represents objects which knows how to pack ifself using specified . - - - - - Pack this instance itself using specified . - - . - Packing options. This value can be null. - is null. - - - - Instance represents nil. This is equal to default value. - - - - - Initializes a new instance wraps . - - - The collection to be copied. - - - - - Initializes a new instance wraps . - - - The collection to be copied or used. - - - true if the is immutable collection; - othereise, false. - - - When the collection is truely immutable or dedicated, you can specify true to the . - When is true, this constructor does not copy its contents, - or copies its contents otherwise. - - Note that both of IReadOnlyList and is NOT immutable - because the modification to the underlying collection will be reflected to the read-only collection. - - - - - - Initializes a new instance wraps . - - - The dictitonary to be copied. - - - - - Initializes a new instance wraps . - - - The dictitonary to be copied or used. - - - true if the is immutable collection; - othereise, false. - - - When the collection is truely immutable or dedicated, you can specify true to the . - When is true, this constructor does not copy its contents, - or copies its contents otherwise. - - Note that both of IReadOnlyDictionary and ReadOnlyDictionary is NOT immutable - because the modification to the underlying collection will be reflected to the read-only collection. - - - - - - Initializes a new instance wraps . - - which represents byte array or UTF-8 encoded string. - - - - Compare two instances are equal. - - instance. - - If is and its value is equal to this instance, then true. - Otherwise false. - - - - - Compare two instances are equal. - - instance. - - Whether value of is equal to this instance or not. - - - - - Get hash code of this instance. - - Hash code of this instance. - - - - Returns a string that represents the current object. - - - A string that represents the current object. - - - - DO NOT use this value programmically. - The purpose of this method is informational, so format of this value subject to change. - - - - - - Determine whether the underlying value of this instance is specified type or not. - - Target type. - If the underlying value of this instance is then true, otherwise false. - - - - Determine whether the underlying value of this instance is specified type or not. - - Target type. - If the underlying value of this instance is then true, otherwise false. - is null. - - - - Pack this instance itself using specified . - - . - Packing options. This value can be null. - is null. - - - - Gets the underlying value as string encoded with specified . - - - The string. - Note that some returns null if the binary is not valid encoded string. - - - - - Get underlying value as UTF8 string. - - Underlying raw binary. - - - - Get underlying value as UTF-16 string. - - Underlying string. - - This method detects BOM. If BOM is not exist, them bytes should be Big-Endian UTF-16. - - - - - Get underlying value as UTF-16 charcter array. - - Underlying string. - - - - Get underlying value as . - - Underlying . - - - - Get underlying value as . - - Underlying . - - - - Get underlying value as . - - Underlying . - - - - Wraps specified object as recursively. - - Object to be wrapped. - wrapps . - - is not primitive value type, list of , - dictionary of , , [], or null. - - - - - Get boxed underlying value for this object. - - Boxed underlying value for this object. - - - - Compare two instances are equal. - - instance. - instance. - - Whether value of and are equal each other or not. - - - - - Compare two instances are not equal. - - instance. - instance. - - Whether value of and are not equal each other or are equal. - - - - - Convert [] instance to instance. - - [] instance. - instance corresponds to . - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps instance. - - - - - Initializes a new instance of the type which wraps [] instance. - - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to instance. - - instance corresponds to this instance. - - - - Convert this instance to [] instance. - - [] instance corresponds to this instance. - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert instance to instance. - - instance. - instance corresponds to . - - - - Convert []instance to instance. - - [] instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to instance. - - instance. - instance corresponds to . - - - - Convert this instance to [] instance. - - instance. - [] instance corresponds to . - - - - Get whether this instance represents nil. - - If this instance represents nil object, then true. - - - - Get the value indicates whether this instance wraps raw binary (or string) or not. - - This instance wraps raw binary (or string) then true. - - - - Get the value indicates whether this instance wraps list (array) or not. - - This instance wraps list (array) then true. - - - - Get the value indicates whether this instance wraps list (array) or not. - - This instance wraps list (array) then true. - - - - Get the value indicates whether this instance wraps dictionary (map) or not. - - This instance wraps dictionary (map) then true. - - - - Get the value indicates whether this instance wraps dictionary (map) or not. - - This instance wraps dictionary (map) then true. - - - - Get underlying type of this instance. - - Underlying . - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Defines serialization helper APIs. - - - - - Unpacks the array to the specified array. - - The type of the array element. - The unpacker to unpack the underlying stream. - The serializer to deserialize array. - The array instance to be filled. - - is null. - Or is null. - Or is null. - - - is not in the array header. - Or failed to deserialization. - - - - - Unpacks the collection with the specified method as colletion of . - - The unpacker to unpack the underlying stream. - The non-generic collection instance to be added unpacked elements. - The delegate which contains the instance method of the . The parameter is unpacked object. - - is null. - Or is null. - Or is null. - - - is not in the array header. - Or failed to deserialization. - - - - - Unpacks the dictionary with the specified method as colletion of . - - The type of elements. - The unpacker to unpack the underlying stream. - The serializer to deserialize elements. - The generic collection instance to be added unpacked elements. - The delegate which contains the instance method of the . The parameter is unpacked object. - - is null. - Or is null. - Or is null. - Or is null. - - - is not in the array header. - Or failed to deserialization. - - - - - Unpacks the collection with the specified method as colletion of . - - The return type of Add method. - The unpacker to unpack the underlying stream. - The non-generic collection instance to be added unpacked elements. - The delegate which contains the instance method of the . The parameter is unpacked object. - - is null. - Or is null. - Or is null. - - - is not in the array header. - Or failed to deserialization. - - - - - Unpacks the dictionary with the specified method as colletion of . - - The type of elements. - The return type of Add method. - The unpacker to unpack the underlying stream. - The serializer to deserialize elements. - The generic collection instance to be added unpacked elements. - The delegate which contains the instance method of the . The parameter is unpacked object. - - is null. - Or is null. - Or is null. - Or is null. - - - is not in the array header. - Or failed to deserialization. - - - - - Unpacks the dictionary with the specified method as colletion of . - - The type of keys. - The type of values. - The unpacker to unpack the underlying stream. - The serializer to deserialize key elements. - The serializer to deserialize value elements. - The generic dictionary instance to be added unpacked elements. - - is null. - Or is null. - Or is null. - Or is null. - - - is not in the map header. - Or failed to deserialization. - - - - - Unpacks the dictionary with the specified method as colletion of . - - The unpacker to unpack the underlying stream. - The non-generic dictionary instance to be added unpacked elements. - - is null. - Or is null. - - - is not in the map header. - Or failed to deserialization. - - - - - Repository of known s. - - - - - Initializes a new empty instance of the class. - - - - - Initializes a new instance of the class which has copied serializers. - - The repository which will be copied its contents. - - is null. - - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - - - - Gets the registered from this repository. - - Type of the object to be marshaled/unmarshaled. - - . If no appropriate mashalers has benn registered, then null. - - - - - Register . - - The type of serialization target. - instance. - - true if success to register; otherwise, false. - - - is null. - - - - - Gets the system default repository. - - - The system default repository. - This value will not be null. - Note that the repository is frozen. - - - - - implementation which emits as map. - - The type of the target object. - - - - using instance fields to hold serializers for target members. - - - - - Initializes a new instance of the class. - - The host . - The sequence number to name new type. - Type of the serialization target. - Set to true when is debuggable. - - - - Gets the IL generator to implement overrides. - - - The IL generator to implement overrides. - This value will not be null. - - - - - Gets the IL generator to implement overrides. - - - The IL generator to implement overrides. - This value will not be null. - - - - - Gets the IL generator to implement overrides. - - - The IL generator to implement overrides. - - - - - Creates the serializer type built now and returns its new instance. - - Target type to be serialized/deserialized. - The to holds serializers. - - Newly built instance. - This value will not be null. - - - - - Creates the serializer type built now and returns its constructor. - - - Newly built type constructor. - This value will not be null. - - - - - Regisgter using target type to the current emitting session. - - Type to be serialized/deserialized. - - to emit serializer retrieval instructions. - The 1st argument should be to emit instructions. - The 2nd argument should be argument index of the serializer holder. - This value will not be null. - - - - - for a collection which has Add method. - - The type of element. - - - - Creates a delegate which returns collection count. - - The type of collection element. - The traits of the collection. - A delegate which returns collection count. - - - - Creates an which returns collection count. - - The type of collection element. - The traits of the collection. - The parameter which represents the target collection. - An which returns collection count. - - - - Creates an which represents using statement block. - - The type of variable. It must be assignable to . - The type of entire expression. This can be null. - The right of using declaration . - The body creator. The argument is left of using declaration. - An which represents using statement block. - - - - Creates an which represents index based for block. - - The count which limits iteration. - The body creator. The argument is i index variable of for loop. - An which represents index based for block. - - - - Creates an which represents foreach block. - - The collection to be enumerated. - The traits of the collection. - The body creator. The argument is Current property of the enumerator. - An which represents foreach block. - - - - Returns an appropriate of collection. - - The type of the collection. - An appropriate of collection. - - If the collection has .ctor(int capacity), then it will be returned. - Otherwise, default constructor will be returned. - Note that this method cannot determine whether a single parameter truely represents 'capacity' or not. - - - - - Creates an which unpack an item. - - The parameter which holds the unpacker. - The target UnpackFrom method of the serializer for item type. - The parameter which has UnpackFrom will be invoked. - The type of the item serializer. - An which unpack an item. - - - - Debugger type proxy for . - - The element type of the collection. - - - - Common validtion utility. - - - - - Determine specified category is printiable. - - Unicode cateory. - - If all charactors in specified category are printable then true. - Other wise false. - - - This method is conservative, but application cannot print the charactor - because appropriate font is not installed the machine. - - - - - This is intened to MsgPack for CLI internal use. Do not use this type from application directly. - Represents serialization context information for internal serialization logic. - - - - - Initializes a new instance of the class with copy of . - - - - - Gets the with this instance. - - Type of serialization/deserialization target. - - . - If there is exiting one, returns it. - Else the new instance will be created. - - - This method automatically register new instance via . - - - - - Gets the serializer for the specified . - - Type of the serialization target. - - . - If there is exiting one, returns it. - Else the new instance will be created. - - - is null. - - - Although is preferred, - this method can be used from non-generic type or methods. - - - - - Gets or sets the default instance. - - - The default instance. - - The setting value is null. - - - - Gets the current . - - - The current . - - - - - Gets or sets the . - - - The - - - For testing purposes. - - - - - Gets the compatibility options. - - - The which stores compatibility options. This value will not be null. - - - - - Gets or sets the to determine serialization strategy. - - - The to determine serialization strategy. - - - - - Gets or sets the to control code generation. - - - The . - - - - - Represents compatibility options of serialization runtime. - - - - - Gets or sets a value indicating whether should be started with 1 instead of 0. - - - true if should be started with 1 instead of 0; otherwise, false. - Default is false. - - - Using this value, you can switch between MessagePack for CLI and ProtoBuf.NET seamlessly. - - - - - Implements common features expression tree based serializer builders. - - The type of the serialization target. - - - - Represents options of packing. - - - - - Initializes a new instance of the class. - - - - - Get encoding for string. - - - for string. Default is UTF-8 encoding without BOM. - - - - - Defines helper method for items of tuple type. - - - - - Creates type list for nested tuples. - - The type list of tuple items, in order. - - The type list for nested tuples. - The order is from outer to inner. - - - - - for map format stream. - - The type of target type. - - - - Manages serializer generators. - - - - - Defines common features and interfaces for . - - - - - Get the appropriate for the current configuration. - - - The appropriate for the current configuration. - This value will not be null. - - - - - Get the appropriate for specified options. - - . - - The appropriate for specified options. - This value will not be null. - - - - - Get the dumpable with specified brandnew assembly builder. - - An assembly builder which will store all generated types. - - The appropriate to generate pre-cimplied serializers. - This value will not be null. - - - - - Creates new which corresponds to the specified . - - The type of the serialization target. - . - New which corresponds to the specified . - - - - Creates new which corresponds to the specified . - - The type of the serialization target. - . - New which corresponds to the specified . - - - - Save ILs as modules to specified directory. - - - The file path generated is too long on the current platform. - - - Current user does not have required permission to save file on the current directory. - - - The output device does not have enough free space. - Or the target file already exists and is locked by other thread. - Or the low level I/O error is occurred. - - - - - Create a new dumpable with specified brandnew assembly builder. - - An assembly builder which will store all generated types. - - The appropriate to generate pre-cimplied serializers. - This value will not be null. - - - - - Creates new which corresponds to the specified . - - The type of the serialization target. - . - - New which corresponds to the specified . - - - - - Get the singleton instance for can-collect mode. - - - - - Get the singleton instance for can-dump mode. - - - - - Get the singleton instance for fast mode. - - - - - for an array. - - The type of element. - - - - Represents result of direct conversion from the byte array. - - Type of value. - - - - Compare two instances are equal. - - instance. - - If is and its value is equal to this instance, then true. - Otherwise false. - - - - - Compare two instances are equal. - - instance. - - Whether value of is equal to this instance or not. - - - - - Get hash code of this instance. - - Hash code of this instance. - - - - Get string representation of this object. - - String representation of this object. - - - DO NOT use this value programmically. - The purpose of this method is informational, so format of this value subject to change. - - - - - - Compare two instances are equal. - - instance. - instance. - - Whether value of and are equal each other or not. - - - - - Compare two instances are not equal. - - instance. - instance. - - Whether value of and are not equal each other or are equal. - - - - - Get read bytes count from input byte array. - - - Read bytes count from input byte array. - If this value equals to old offset, then a value of property is not undifined. - - - - - Get retrieved value from the byte array. - - - Retrieved value from the byte array. - If equals to old offset, then a value of this property is not undefined. - - - - - Define options of serializer generation. - - - - - The generated method IL can be dumped to the current directory. - It is intended for the runtime, you cannot use this option. - - - - - The entire generated method can be collected by GC when it is no longer used. - - - - - Prefer performance. This options is default. - - - - - Marks a field or a property to be serialized with MessagePack Serializer and defines some required informations to serialize. - - - - - Initializes a new instance of the class. - - - The ID of the member. This value cannot be negative and must be unique in the type. - - - - - Gets the ID of the member. - - - The ID of the member. - - - - - Gets or sets the implication of the nil value. - - - The implication of the nil value. - Default value is . - - - - - Takes text dump for expression tree supporting block expression etc. - - - - - Defines binary related utilities. - - - - - Singleton empty []. - - - - - implementation which emits as array (default). - - The type of the target object. - - - - Encapselates and its serialized UTF-8 bytes. - - - - - Exception occured when inbound stream is invalid as serialized Message Pack stream. - - - - - Initializes a new instance of the class with the default error message. - - - - - Initializes a new instance of the class with a specified error message. - - The message that describes the error. - - - - Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - - The exception that is the cause of the current exception, or a null if no inner exception is specified. - - - - - Initializes a new instance of the class with serialized data. - - - The that holds the serialized object data about the exception being thrown. - - - The that contains contextual information about the source or destination. - - The parameter is null. - - - The class name is null or is zero (0). - - - - - Defines utility extension method for reflection API. - - - - - Determines whether specified can be assigned to source . - - The source type. - The type to compare with the source type. - - true if and represent the same type, - or if is in the inheritance hierarchy of , - or if is an interface that implements, - or if is a generic type parameter and represents one of the constraints of . - false if none of these conditions are true, or if is false. - - - - - Stream based unpacker. - - - - - Default buffer size. - - - This value is subject to change. - - - - - Actual unpackaging strategy. - - - - - If current position MAY be in tail of source then true, otherwise false. - - - This value should be refered via . - - - - - Queue of successors of data source. - - - - - Current data source. - - - - - Initializes a new instance with default sized on memory buffer. - - - - - Initializes a new instance using specified as source. - - Source . - If you want to dispose stream when this instance is disposed, then true. - is null. - - - - Clean up internal resources. - - - - - Starts unpacking of current subtree. - - - to unpack current subtree. - This will not be null. - - - - - Reads next Message Pack entry. - - - true, if position is sucessfully move to next entry; - false, if position reaches the tail of the Message Pack stream. - - - - - Read subtree item from current stream. - - - true, if position is sucessfully move to next entry; - false, if position reaches the tail of the Message Pack stream. - - - This method only be called from . - - - - - Determins this instance is in tail of all data sources. - This method deque successors when needed. - - If this instance is in tail of all data sources then true, otherwise false. - - - - Get last unpacked data. - - - Last unpacked data or null. - - - - - Gets a value indicating whether this instance is positioned to array header. - - - true if this instance is positioned to array header; otherwise, false. - - - - - Gets a value indicating whether this instance is positioned to map header. - - - true if this instance is positioned to map header; otherwise, false. - - - - - Gets the items count for current array or map. - - - The items count for current array or map. - - - Both of the and are false. - - - - - Gets the underlying stream to handle direct API. - - - - - Encapselates Stream and ownership information. - - - - - Indicates whether this unpacker should . - - - - - Underlying stream of this source. This value could be null. - - - - - Defines entry points for usage. - - - - - Creates new instance with . - - Target type. - - New instance to serialize/deserialize the object tree which the top is . - - - - - Creates new instance with specified . - - Target type. - - to store known/created serializers. - - - New instance to serialize/deserialize the object tree which the top is . - - - is null. - - - - - Creates new instance with . - - Target type. - - New instance to serialize/deserialize the object tree which the top is . - - - is null. - - - To avoid boxing and strongly typed API is prefered, use instead when possible. - - - - - Creates new instance with specified . - - Target type. - - to store known/created serializers. - - - New instance to serialize/deserialize the object tree which the top is . - - - is null. - Or, is null. - - - To avoid boxing and strongly typed API is prefered, use instead when possible. - - - - - Determines emitter strategy. - - - - - Uses in each case of the members (de)serialization. - It may cause more contentions but is available in WP7. - - - - - Caches serializers for the members (de)serialization. - It is default. - - - - - Uses expression tree to (de)serialization. - It may have more overhead but is available in WinRT. - - - - - Invokes in deserializaton manner. - - . - A deserialized value. - is not expected type. - - - - Defines interface for object which can be deserialzed from MessagePack object. - - - - - Restore object state from specified . - - . - is null. - Cannot restore state from the stream. - - - - Define bit operations which enforce big endian. - - - - diff --git a/lib/MsgPack.dll b/lib/MsgPack.dll deleted file mode 100644 index 5bb0eb6b1b3..00000000000 Binary files a/lib/MsgPack.dll and /dev/null differ diff --git a/lib/MsgPack.pdb b/lib/MsgPack.pdb deleted file mode 100644 index df725c7a1a8..00000000000 Binary files a/lib/MsgPack.pdb and /dev/null differ diff --git a/lib/MySql.Data.dll b/lib/MySql.Data.dll deleted file mode 100644 index d7dc2ab89a6..00000000000 Binary files a/lib/MySql.Data.dll and /dev/null differ diff --git a/lib/Npgsql.dll b/lib/Npgsql.dll deleted file mode 100644 index 1e71b583204..00000000000 Binary files a/lib/Npgsql.dll and /dev/null differ diff --git a/lib/Npgsql.xml b/lib/Npgsql.xml deleted file mode 100644 index 642180e48ed..00000000000 --- a/lib/Npgsql.xml +++ /dev/null @@ -1,6497 +0,0 @@ - - - - Npgsql - - - - - Handles serialisation of .NET array or IEnumeration to pg format. - Arrays of arrays, enumerations of enumerations, arrays of enumerations etc. - are treated as multi-dimensional arrays (in much the same manner as an array of arrays - is used to emulate multi-dimensional arrays in languages that lack native support for them). - If such an enumeration of enumerations is "jagged" (as opposed to rectangular, cuboid, - hypercuboid, hyperhypercuboid, etc) then this class will "correctly" serialise it, but pg - will raise an error as it doesn't allow jagged arrays. - - - - - Create an ArrayNativeToBackendTypeConverter with the element converter passed - - The that would be used to serialise the element type. - - - - Serialise the enumeration or array. - - - - - Convert a System.Array to PG binary format. - Write the array header and prepare to write array data to the stream. - - - - - Append all array data to the binary stream. - - - - - Handles parsing of pg arrays into .NET arrays. - - - - - Takes a string representation of a pg 1-dimensional array - (or a 1-dimensional row within an n-dimensional array) - and allows enumeration of the string represenations of each items. - - - - - Takes a string representation of a pg n-dimensional array - and allows enumeration of the string represenations of the next - lower level of rows (which in turn can be taken as (n-1)-dimensional arrays. - - - - - Takes an ArrayList which may be an ArrayList of ArrayLists, an ArrayList of ArrayLists of ArrayLists - and so on and enumerates the items that aren't ArrayLists (the leaf nodes if we think of the ArrayList - passed as a tree). Simply uses the ArrayLists' own IEnumerators to get that of the next, - pushing them onto a stack until we hit something that isn't an ArrayList. - ArrayList to enumerate - IEnumerable - - - - - Create a new ArrayBackendToNativeTypeConverter - - for the element type. - - - - Creates an array from pg text representation. - - - - - Creates an array list from pg represenation of an array. - Multidimensional arrays are treated as ArrayLists of ArrayLists - - - - - Creates an n-dimensional array from an ArrayList of ArrayLists or - a 1-dimensional array from something else. - - to convert - Type of the elements in the list - produced. - - - - Creates an n-dimensional System.Array from PG binary representation. - This function reads the array header and sets up an n-dimensional System.Array object to hold its data. - PopulateArrayFromBinaryArray() is then called to carry out array population. - - - - - Recursively populates an array from PB binary data representation. - - - - - Takes an array of ints and treats them like the limits of a set of counters. - Retains a matching set of ints that is set to all zeros on the first ++ - On a ++ it increments the "right-most" int. If that int reaches it's - limit it is set to zero and the one before it is incremented, and so on. - - Making this a more general purpose class is pretty straight-forward, but we'll just put what we need here. - - - - - Implements a bit string; a collection of zero or more bits which can each be 1 or 0. - BitString's behave as a list of bools, though like most strings and unlike most collections the position - tends to be of as much significance as the value. - BitStrings are often used as masks, and are commonly cast to and from other values. - - - - - Represents the empty string. - - - - - Create a BitString from an enumeration of boolean values. The BitString will contain - those booleans in the order they came in. - - The boolean values. - - - - Creates a BitString filled with a given number of true or false values. - - The value to fill the string with. - The number of bits to fill. - - - - Creats a bitstring from a string. - The string to copy from. - - - - - - Creates a single-bit element from a boolean value. - - The bool value which determines whether - the bit is 1 or 0. - - - - Creates a bitstring from an unsigned integer value. The string will be the shortest required to - contain the integer (e.g. 1 bit for 0 or 1, 2 for 2 or 3, 3 for 4-7, and so on). - - The integer. - This method is not CLS Compliant, and may not be available to some languages. - - - - Creates a bitstring from an integer value. The string will be the shortest required to - contain the integer (e.g. 1 bit for 0 or 1, 2 for 2 or 3, 3 for 4-7, and so on). - - The integer. - - - - Finds the first instance of a given value - - The value - whether true or false - to search for. - The index of the value found, or -1 if none are present. - - - - True if there is at least one bit with the value looked for. - - The value - true or false - to detect. - True if at least one bit was the same as item, false otherwise. - - - - Copies the bitstring to an array of bools. - - The boolean array to copy to. - The index in the array to start copying from. - - - - Returns an enumerator that enumerates through the string. - - The enumerator. - - - - Creats a bitstring by concatenating another onto this one. - - The string to append to this one. - The combined strings. - - - - Returns a substring of this string. - - The position to start from, must be between 0 and the length of the string. - The length of the string to return, must be greater than zero, and may not be - so large that the start + length exceeds the bounds of this instance. - The Bitstring identified - - - - Returns a substring of this string. - - The position to start from, must be between 0 and the length of the string, - the rest of the string is returned. - The Bitstring identified - - - - A logical and between this string and another. The two strings must be the same length. - - Another BitString to AND with this one. - A bitstring with 1 where both BitStrings had 1 and 0 otherwise. - - - - A logical or between this string and another. The two strings must be the same length. - - Another BitString to OR with this one. - A bitstring with 1 where either BitString had 1 and 0 otherwise. - - - - A logical xor between this string and another. The two strings must be the same length. - - Another BitString to XOR with this one. - A bitstring with 1 where one BitStrings and the other had 0, - and 0 where they both had 1 or both had 0. - - - - A bitstring that is the logical inverse of this one. - - A bitstring of the same length as this with 1 where this has 0 and vice-versa. - - - - Shifts the string operand bits to the left, filling with zeros to produce a - string of the same length. - - The number of bits to shift to the left. - A left-shifted bitstring. - The behaviour of LShift is closer to what one would expect from dealing - with PostgreSQL bit-strings than in using the same operations on integers in .NET - In particular, negative operands result in a right-shift, and operands greater than - the length of the string will shift it entirely, resulting in a zero-filled string. - - - - - Shifts the string operand bits to the right, filling with zeros to produce a - string of the same length. - - The number of bits to shift to the right. - A right-shifted bitstring. - The behaviour of RShift is closer to what one would expect from dealing - with PostgreSQL bit-strings than in using the same operations on integers in .NET - In particular, negative operands result in a left-shift, and operands greater than - the length of the string will shift it entirely, resulting in a zero-filled string. It also performs - a logical shift, rather than an arithmetic shift, so it always sets the vacated bit positions to zero - (like PostgreSQL and like .NET for unsigned integers but not for signed integers). - - - - - Returns true if the this string is identical to the argument passed. - - - - - Compares two strings. Strings are compared as strings, so while 0 being less than 1 will - mean a comparison between two strings of the same size is the same as treating them as numbers, - in the case of two strings of differing lengths the comparison starts at the right-most (most significant) - bit, and if all bits of the shorter string are exhausted without finding a comparison, then the larger - string is deemed to be greater than the shorter (0010 is greater than 0001 but less than 00100). - - Another string to compare with this one. - A value if the two strings are identical, an integer less - than zero if this is less than the argument, and an integer greater - than zero otherwise. - - - - Compares the string with another object. - - The object to compare with. - If the object is null then this string is considered greater. If the object is another BitString - then they are compared as in the explicit comparison for BitStrings - in any other case a is thrown. - - - - Compares this BitString with an object for equality. - - - - - Returns a code for use in hashing operations. - - - - - Returns a string representation of the BitString. - - - A string which can contain a letter and optionally a number which sets a minimum size for the string - returned. In each case using the lower-case form of the letter will result in a lower-case string - being returned. - - - B - A string of 1s and 0s. - - - X - An hexadecimal string (will result in an error unless the string's length is divisible by 4). - - - G - A string of 1s and 0s in single-quotes preceded by 'B' (Postgres bit string literal syntax). - - Y - An hexadecimal string in single-quotes preceded by 'X' (Postgres bit literal syntax, will result in an error unless the string's length is divisible by 4. - - C - The format produced by format-string "Y" if legal, otherwise that produced by format-string "G". - E - The most compact safe representation for Postgres. If single bit will be either a 0 or a 1. Otherwise if it - can be that produce by format string "Y" it will, otherwise if there are less than 9bits in length it will be that - produced by format-string "G". For longer strings that cannot be represented in hexadecimal it will be a string - representing the first part of the string in format "Y" followed by the PostgreSQL concatenation operator, followed - by the final bits in the format "G". E.g. "X'13DCE'||B'110'" - If format is empty or null, it is treated as if "B" had been passed (the default repreesentation, and that - generally used by PostgreSQL for display). - - The formatted string. - - - - Returns a string representation for the Bitstring - - A string containing '0' and '1' characters. - - - - Returns the same string as . formatProvider is ignored. - - - - - Parses a string to produce a BitString. Most formats that can be produced by - can be accepted, but hexadecimal - can be interpreted with the preceding X' to mark the following characters as - being hexadecimal rather than binary. - - - - - Performs a logical AND on the two operands. - - - - - Performs a logcial OR on the two operands. - - - - - Perofrms a logical EXCLUSIVE-OR on the two operands - - - - - Performs a logical NOT on the operand. - - - - - Concatenates the operands. - - - - - Left-shifts the string BitString. - - - - - Right-shifts the string BitString. - - - - - Compares the two operands. - - - - - Compares the two operands. - - - - - Compares the two operands. - - - - - Compares the two operands. - - - - - Compares the two operands. - - - - - Compares the two operands. - - - - - Interprets the bitstring as a series of bits in an encoded character string, - encoded according to the Encoding passed, and returns that string. - The bitstring must contain a whole number of octets(bytes) and also be - valid according to the Encoding passed. - - The to use in producing the string. - The string that was encoded in the BitString. - - - - Interprets the bitstring as a series of octets (bytes) and returns those octets. Fails - if the Bitstring does not contain a whole number of octets (its length is not evenly - divisible by 8). - - - - - Interprets the bitstring as a series of signed octets (bytes) and returns those octets. Fails - if the Bitstring does not contain a whole number of octets (its length is not evenly - divisible by 8). - This method is not CLS-Compliant and may not be available to languages that cannot - handle signed bytes. - - - - - Interprets the bitstring as a series of unsigned 16-bit integers and returns those integers. - Fails if the Bitstring's length is not evenly divisible by 16. - This method is not CLS-Compliant and may not be available to languages that cannot - handle unsigned integers. - - - - - Interprets the bitstring as a series of 16-bit integers and returns those integers. - Fails if the Bitstring's length is not evenly divisible by 16. - - - - - Interprets the bitstring as a series of unsigned 32-bit integers and returns those integers. - Fails if the Bitstring's length is not evenly divisible by 32. - This method is not CLS-Compliant and may not be available to languages that cannot - handle unsigned integers. - - - - - Interprets the bitstring as a series of signed 32-bit integers and returns those integers. - Fails if the Bitstring's length is not evenly divisible by 32. - - - - - Interprets the bitstring as a series of unsigned 64-bit integers and returns those integers. - Fails if the Bitstring's length is not evenly divisible by 64. - This method is not CLS-Compliant and may not be available to languages that cannot - handle unsigned integers. - - - - - Interprets the bitstring as a series of signed 64-bit integers and returns those integers. - Fails if the Bitstring's length is not evenly divisible by 64. - - - - - The length of the string. - - - - - Retrieves the value of the bit at the given index. - - - - - Represents the PostgreSQL interval datatype. - PostgreSQL differs from .NET in how it's interval type doesn't assume 24 hours in a day - (to deal with 23- and 25-hour days caused by daylight savings adjustments) and has a concept - of months that doesn't exist in .NET's class. (Neither datatype - has any concessions for leap-seconds). - For most uses just casting to and from TimeSpan will work correctly — in particular, - the results of subtracting one or the PostgreSQL date, time and - timestamp types from another should be the same whether you do so in .NET or PostgreSQL — - but if the handling of days and months in PostgreSQL is important to your application then you - should use this class instead of . - If you don't know whether these differences are important to your application, they - probably arent! Just use and do not use this class directly ☺ - To avoid forcing unnecessary provider-specific concerns on users who need not be concerned - with them a call to on a field containing an - value will return a rather than an - . If you need the extra functionality of - then use . - - - - - - - - - - Represents the number of ticks (100ns periods) in one microsecond. This field is constant. - - - - - Represents the number of ticks (100ns periods) in one millisecond. This field is constant. - - - - - Represents the number of ticks (100ns periods) in one second. This field is constant. - - - - - Represents the number of ticks (100ns periods) in one minute. This field is constant. - - - - - Represents the number of ticks (100ns periods) in one hour. This field is constant. - - - - - Represents the number of ticks (100ns periods) in one day. This field is constant. - - - - - Represents the number of hours in one day (assuming no daylight savings adjustments). This field is constant. - - - - - Represents the number of days assumed in one month if month justification or unjustifcation is performed. - This is set to 30 for consistency with PostgreSQL. Note that this is means that month adjustments cause - a year to be taken as 30 × 12 = 360 rather than 356/366 days. - - - - - Represents the number of ticks (100ns periods) in one day, assuming 30 days per month. - - - - - Represents the number of months in a year. This field is constant. - - - - - Represents the maximum . This field is read-only. - - - - - Represents the minimum . This field is read-only. - - - - - Represents the zero . This field is read-only. - - - - - Initializes a new to the specified number of ticks. - - A time period expressed in 100ns units. - - - - Initializes a new to hold the same time as a - - A time period expressed in a - - - - Initializes a new to the specified number of months, days - & ticks. - - Number of months. - Number of days. - Number of 100ns units. - - - - Initializes a new to the specified number of - days, hours, minutes & seconds. - - Number of days. - Number of hours. - Number of minutes. - Number of seconds. - - - - Initializes a new to the specified number of - days, hours, minutes, seconds & milliseconds. - - Number of days. - Number of hours. - Number of minutes. - Number of seconds. - Number of milliseconds. - - - - Initializes a new to the specified number of - months, days, hours, minutes, seconds & milliseconds. - - Number of months. - Number of days. - Number of hours. - Number of minutes. - Number of seconds. - Number of milliseconds. - - - - Initializes a new to the specified number of - years, months, days, hours, minutes, seconds & milliseconds. - Years are calculated exactly equivalent to 12 months. - - Number of years. - Number of months. - Number of days. - Number of hours. - Number of minutes. - Number of seconds. - Number of milliseconds. - - - - Creates an from a number of ticks. - - The number of ticks (100ns units) in the interval. - A d with the given number of ticks. - - - - Creates an from a number of microseconds. - - The number of microseconds in the interval. - A d with the given number of microseconds. - - - - Creates an from a number of milliseconds. - - The number of milliseconds in the interval. - A d with the given number of milliseconds. - - - - Creates an from a number of seconds. - - The number of seconds in the interval. - A d with the given number of seconds. - - - - Creates an from a number of minutes. - - The number of minutes in the interval. - A d with the given number of minutes. - - - - Creates an from a number of hours. - - The number of hours in the interval. - A d with the given number of hours. - - - - Creates an from a number of days. - - The number of days in the interval. - A d with the given number of days. - - - - Creates an from a number of months. - - The number of months in the interval. - A d with the given number of months. - - - - Adds another interval to this instance and returns the result. - - An to add to this instance. - An whose values are the sums of the two instances. - - - - Subtracts another interval from this instance and returns the result. - - An to subtract from this instance. - An whose values are the differences of the two instances. - - - - Returns an whose value is the negated value of this instance. - - An whose value is the negated value of this instance. - - - - This absolute value of this instance. In the case of some, but not all, components being negative, - the rules used for justification are used to determine if the instance is positive or negative. - - An whose value is the absolute value of this instance. - - - - Equivalent to PostgreSQL's justify_days function. - - An based on this one, but with any hours outside of the range [-23, 23] - converted into days. - - - - Opposite to PostgreSQL's justify_days function. - - An based on this one, but with any days converted to multiples of ±24hours. - - - - Equivalent to PostgreSQL's justify_months function. - - An based on this one, but with any days outside of the range [-30, 30] - converted into months. - - - - Opposite to PostgreSQL's justify_months function. - - An based on this one, but with any months converted to multiples of ±30days. - - - - Equivalent to PostgreSQL's justify_interval function. - - An based on this one, - but with any months converted to multiples of ±30days - and then with any days converted to multiples of ±24hours - - - - Opposite to PostgreSQL's justify_interval function. - - An based on this one, but with any months converted to multiples of ±30days and then any days converted to multiples of ±24hours; - - - - Produces a canonical NpgslInterval with 0 months and hours in the range of [-23, 23]. - - - While the fact that for many purposes, two different instances could be considered - equivalent (e.g. one with 2days, 3hours and one with 1day 27hours) there are different possible canonical forms. - - E.g. we could move all excess hours into days and all excess days into months and have the most readable form, - or we could move everything into the ticks and have the form that allows for the easiest arithmetic) the form - chosen has two important properties that make it the best choice. - First, it is closest two how - objects are most often represented. Second, it is compatible with results of many - PostgreSQL functions, particularly with age() and the results of subtracting one date, time or timestamp from - another. - - Note that the results of casting a to is - canonicalised. - - - An based on this one, but with months converted to multiples of ±30days and with any hours outside of the range [-23, 23] - converted into days. - - - - Implicit cast of a to an - - A - An eqivalent, canonical, . - - - - Implicit cast of an to a . - - A . - An equivalent . - - - - Returns true if another is exactly the same as this instance. - - An for comparison. - true if the two instances are exactly the same, - false otherwise. - - - - Returns true if another object is an , that is exactly the same as - this instance - - An for comparison. - true if the argument is an and is exactly the same - as this one, false otherwise. - - - - Compares two instances. - - The first . - The second . - 0 if the two are equal or equivalent. A value greater than zero if x is greater than y, - a value less than zero if x is less than y. - - - - A hash code suitable for uses with hashing algorithms. - - An signed integer. - - - - Compares this instance with another/ - - An to compare this with. - 0 if the instances are equal or equivalent. A value less than zero if - this instance is less than the argument. A value greater than zero if this instance - is greater than the instance. - - - - Compares this instance with another/ - - An object to compare this with. - 0 if the argument is an and the instances are equal or equivalent. - A value less than zero if the argument is an and - this instance is less than the argument. - A value greater than zero if the argument is an and this instance - is greater than the instance. - A value greater than zero if the argument is null. - The argument is not an . - - - - Parses a and returns a instance. - Designed to use the formats generally returned by PostgreSQL. - - The to parse. - An represented by the argument. - The string was null. - A value obtained from parsing the string exceeded the values allowed for the relevant component. - The string was not in a format that could be parsed to produce an . - - - - Attempt to parse a to produce an . - - The to parse. - (out) The produced, or if the parsing failed. - true if the parsing succeeded, false otherwise. - - - - Create a representation of the instance. - The format returned is of the form: - [M mon[s]] [d day[s]] [HH:mm:ss[.f[f[f[f[f[f[f[f[f]]]]]]]]]] - A zero is represented as 00:00:00 - - Ticks are 100ns, Postgress resolution is only to 1µs at most. Hence we lose 1 or more decimal - precision in storing values in the database. Despite this, this method will output that extra - digit of precision. It's forward-compatible with any future increases in resolution up to 100ns, - and also makes this ToString() more applicable to any other use-case. - - - The representation. - - - - Adds two together. - - The first to add. - The second to add. - An whose values are the sum of the arguments. - - - - Subtracts one from another. - - The to subtract the other from. - The to subtract from the other. - An whose values are the difference of the arguments - - - - Returns true if two are exactly the same. - - The first to compare. - The second to compare. - true if the two arguments are exactly the same, false otherwise. - - - - Returns false if two are exactly the same. - - The first to compare. - The second to compare. - false if the two arguments are exactly the same, true otherwise. - - - - Compares two instances to see if the first is less than the second - - The first to compare. - The second to compare. - true if the first is less than second, false otherwise. - - - - Compares two instances to see if the first is less than or equivalent to the second - - The first to compare. - The second to compare. - true if the first is less than or equivalent to second, false otherwise. - - - - Compares two instances to see if the first is greater than the second - - The first to compare. - The second to compare. - true if the first is greater than second, false otherwise. - - - - Compares two instances to see if the first is greater than or equivalent the second - - The first to compare. - The second to compare. - true if the first is greater than or equivalent to the second, false otherwise. - - - - Returns the instance. - - An . - The argument. - - - - Negates an instance. - - An . - The negation of the argument. - - - - The total number of ticks(100ns units) contained. This is the resolution of the - type. This ignores the number of days and - months held. If you want them included use first. - The resolution of the PostgreSQL - interval type is by default 1µs = 1,000 ns. It may be smaller as follows: - - - interval(0) - resolution of 1s (1 second) - - - interval(1) - resolution of 100ms = 0.1s (100 milliseconds) - - - interval(2) - resolution of 10ms = 0.01s (10 milliseconds) - - - interval(3) - resolution of 1ms = 0.001s (1 millisecond) - - - interval(4) - resolution of 100µs = 0.0001s (100 microseconds) - - - interval(5) - resolution of 10µs = 0.00001s (10 microseconds) - - - interval(6) or interval - resolution of 1µs = 0.000001s (1 microsecond) - - - As such, if the 100-nanosecond resolution is significant to an application, a PostgreSQL interval will - not suffice for those purposes. - In more frequent cases though, the resolution of the interval suffices. - will always suffice to handle the resolution of any interval value, and upon - writing to the database, will be rounded to the resolution used. - - The number of ticks in the instance. - - - - - Gets the number of whole microseconds held in the instance. - An in the range [-999999, 999999]. - - - - - Gets the number of whole milliseconds held in the instance. - An in the range [-999, 999]. - - - - - Gets the number of whole seconds held in the instance. - An in the range [-59, 59]. - - - - - Gets the number of whole minutes held in the instance. - An in the range [-59, 59]. - - - - - Gets the number of whole hours held in the instance. - Note that this can be less than -23 or greater than 23 unless - has been used to produce this instance. - - - - - Gets the number of days held in the instance. - Note that this does not pay attention to a time component with -24 or less hours or - 24 or more hours, unless has been called to produce this instance. - - - - - Gets the number of months held in the instance. - Note that this does not pay attention to a day component with -30 or less days or - 30 or more days, unless has been called to produce this instance. - - - - - Returns a representing the time component of the instance. - Note that this may have a value beyond the range ±23:59:59.9999999 unless - has been called to produce this instance. - - - - - The total number of ticks (100ns units) in the instance, assuming 24 hours in each day and - 30 days in a month. - - - - - The total number of microseconds in the instance, assuming 24 hours in each day and - 30 days in a month. - - - - - The total number of milliseconds in the instance, assuming 24 hours in each day and - 30 days in a month. - - - - - The total number of seconds in the instance, assuming 24 hours in each day and - 30 days in a month. - - - - - The total number of minutes in the instance, assuming 24 hours in each day and - 30 days in a month. - - - - - The total number of hours in the instance, assuming 24 hours in each day and - 30 days in a month. - - - - - The total number of days in the instance, assuming 24 hours in each day and - 30 days in a month. - - - - - The total number of months in the instance, assuming 24 hours in each day and - 30 days in a month. - - - - - Normalise this time; if it is 24:00:00, convert it to 00:00:00 - - This time, normalised - - - - The total number of ticks(100ns units) contained. This is the resolution of the - type. - The resolution of the PostgreSQL - interval type is by default 1µs = 1,000 ns. It may be smaller as follows: - - - time(0) - resolution of 1s (1 second) - - - time(1) - resolution of 100ms = 0.1s (100 milliseconds) - - - time(2) - resolution of 10ms = 0.01s (10 milliseconds) - - - time(3) - resolution of 1ms = 0.001s (1 millisecond) - - - time(4) - resolution of 100µs = 0.0001s (100 microseconds) - - - time(5) - resolution of 10µs = 0.00001s (10 microseconds) - - - time(6) or interval - resolution of 1µs = 0.000001s (1 microsecond) - - - As such, if the 100-nanosecond resolution is significant to an application, a PostgreSQL time will - not suffice for those purposes. - In more frequent cases though, the resolution of time suffices. - will always suffice to handle the resolution of any time value, and upon - writing to the database, will be rounded to the resolution used. - - The number of ticks in the instance. - - - - - Gets the number of whole microseconds held in the instance. - An integer in the range [0, 999999]. - - - - - Gets the number of whole milliseconds held in the instance. - An integer in the range [0, 999]. - - - - - Gets the number of whole seconds held in the instance. - An interger in the range [0, 59]. - - - - - Gets the number of whole minutes held in the instance. - An integer in the range [0, 59]. - - - - - Gets the number of whole hours held in the instance. - Note that the time 24:00:00 can be stored for roundtrip compatibility. Any calculations on such a - value will normalised it to 00:00:00. - - - - - Normalise this time; if it is 24:00:00, convert it to 00:00:00 - - This time, normalised - - - - Compares this with another . As per postgres' rules, - first the times are compared as if they were both in the same timezone. If they are equal then - then timezones are compared (+01:00 being "smaller" than -01:00). - - the to compare with. - An integer which is 0 if they are equal, < 0 if this is the smaller and > 0 if this is the larger. - - - - Gets the number of whole microseconds held in the instance. - An integer in the range [0, 999999]. - - - - - Gets the number of whole milliseconds held in the instance. - An integer in the range [0, 999]. - - - - - Gets the number of whole seconds held in the instance. - An interger in the range [0, 59]. - - - - - Gets the number of whole minutes held in the instance. - An integer in the range [0, 59]. - - - - - Gets the number of whole hours held in the instance. - Note that the time 24:00:00 can be stored for roundtrip compatibility. Any calculations on such a - value will normalised it to 00:00:00. - - - - - This class implements the Fastpath api. - - - - - This maps the functions names to their id's (possible unique just - to a connection). - - - - - Our connection. - - - - - The network stream. - - - - - Initialises the fastpath system. - - BaseConnection to attach to. - The network stream to the backend. - - - - Initialises the fastpath system. - - BaseConnection to attach to. - - - - Send a function call to the PostgreSQL backend. - - Function id. - True if the result is an integer, false for other results. - FastpathArguments to pass to fastpath. - null if no data, Integer if an integer result, or byte[] otherwise. - - - - Send a function call to the PostgreSQL backend by name. - Note: the mapping for the procedure name to function id needs to exist, - usually to an earlier call to addfunction(). - This is the prefered method to call, as function id's can/may change - between versions of the backend. - For an example of how this works, refer to NpgsqlTypes.LargeObject - - Function name. - True if the result is an integer, false for other results. - FastpathArguments to pass to fastpath. - null if no data, Integer if an integer result, or byte[] otherwise. - - - - This convenience method assumes that the return value is an Integer. - - Function name. - Function arguments. - Integer result. - - - - This convenience method assumes that the return value is an Integer. - - Function name. - Function arguments. - Array containing result - - - - This adds a function to our lookup table. - User code should use the addFunctions method, which is based upon a - query, rather than hard coding the oid. The oid for a function is not - guaranteed to remain static, even on different servers of the same - version. - - Function name. - Function id. - - - - This takes a ResultSet containing two columns. Column 1 contains the - function name, Column 2 the oid. - It reads the entire ResultSet, loading the values into the function - table. - REMEMBER to close() the resultset after calling this!! - Implementation note about function name lookups: - PostgreSQL stores the function id's and their corresponding names in - the pg_proc table. To speed things up locally, instead of querying each - function from that table when required, a Dictionary is used. Also, only - the function's required are entered into this table, keeping connection - times as fast as possible. - The org.postgresql.largeobject.LargeObject class performs a query upon it's startup, - and passes the returned ResultSet to the addFunctions() method here. - Once this has been done, the LargeObject api refers to the functions by - name. - Dont think that manually converting them to the oid's will work. Ok, - they will for now, but they can change during development (there was some - discussion about this for V7.0), so this is implemented to prevent any - unwarranted headaches in the future. - - ResultSet - - - - This returns the function id associated by its name - If addFunction() or addFunctions() have not been called for this name, - then an NpgsqlException is thrown. - - Function name to lookup. - Function ID for fastpath call. - - - - Fast Path Arg. - - - - - Type of argument, true=integer, false=byte[]. - - - - - Integer value if type=true. - - - - - Byte value if type=false; - - - - - Constructs an argument that consists of an integer value. - - Int value to set. - - - - Constructs an argument that consists of an array of bytes. - - Array to store. - - - - Constructs an argument that consists of part of a byte array. - - Source array. - offset within array. - length of data to include. - - - - Constructs an argument that consists of a String. - - String to store. - - - - This sends this argument down the network stream. - The stream sent consists of the length.int4 then the contents. - Note: This is called from Fastpath, and cannot be called from - client code. - - - - - - Report send size. - - Send size. - - - - Large Object. - - - - - Indicates a seek from the begining of a file. - - - - - Indicates a seek from the current position. - - - - - Indicates a seek from the end of a file. - - - - - This opens a large object. - If the object does not exist, then an NpgsqlException is thrown. - - FastPath API for the connection to use. - OID of the Large Object to open. - Mode of opening the large object - - - - OID getter. - - The OID of this LargeObject. - - - - This method closes the object. You must not call methods in this - object after this is called. - - - - - Reads some data from the object, and return as a byte[] array. - - Number of bytes to read. - Array containing data read. - - - - Reads some data from the object into an existing array. - - Destination array. - Offset within array. - Maximum number of bytes to read. - The number of bytes actually read. - - - - Writes an array to the object. - - Array to write. - - - - Writes some data from an array to the object. - - Destination array. - Offset within array. - Number of bytes to write. - - - - Sets the current position within the object. - This is similar to the fseek() call in the standard C library. It - allows you to have random access to the large object. - - Position within object. - Either SEEK_SET, SEEK_CUR or SEEK_END. - - - - Sets the current position within the object. - This is similar to the fseek() call in the standard C library. It - allows you to have random access to the large object. - - Position within object from begining. - - - - Report the current position within the object. - - The current position within the object. - - - - This method is inefficient, as the only way to find out the size of - the object is to seek to the end, record the current position, then - return to the original position. - A better method will be found in the future. - - The size of the large object. - - - - OID. - - - - - Large Object Manager. - - - - - This mode indicates we want to write to an object - - - - - This mode indicates we want to read an object - - - - - This mode is the default. It indicates we want read and write access to - - - - - Constructs the LargeObject API. - There should only be one LargeObjectManager per Connection. The - org.postgresql.Connection class keeps track of the various extension API's - and it's advised you use those to gain access, and not going direct. - - - - - - This opens an existing large object, based on its OID. This method - assumes that READ and WRITE access is required (the default). - - OID of large object. - LargeObject instance providing access to the object - - - - This opens an existing large object, based on its OID. - - OID of large object. - Mode of open. - - - - - This creates a large object, returning its OID. - - OID of new object. - - - - This creates a large object, returning its OID. - - Bitmask describing different attributes of the new object. - OID of new object. - - - - This deletes a large object. - - OID describing object to delete. - - - - This deletes a large object. - It is identical to the Delete() method, and is supplied as the C API uses unlink. - - OID describing object to delete. - - - - Options that control certain aspects of native to backend conversions that depend - on backend version and status. - - - - - Clone the current object. - - A new NativeToBackendTypeConverterOptions object. - - - - Clone the current object with a different OID/Name mapping. - - OID/Name mapping object to use in the new instance. - A new NativeToBackendTypeConverterOptions object. - - - - Provide event handlers to convert all native supported basic data types from their backend - text representation to a .NET object. - - - - - Convert UTF8 encoded text a string. - - - - - Byte array from bytea encoded as ASCII text, escaped or hex format. - - - - - Byte array from bytea encoded as binary. - - - - - Convert a postgresql boolean to a System.Boolean. - - - - - Convert a postgresql boolean to a System.Boolean. - - - - - Convert a postgresql bit to a System.Boolean. - - - - - Convert a postgresql datetime to a System.DateTime. - - - - - Convert a postgresql date to a System.DateTime. - - - - - Convert a postgresql time to a System.DateTime. - - - - - Convert a postgresql money to a System.Decimal. - - - - - Convert a postgresql float4 or float8 to a System.Float or System.Double respectively. - - - - - Provide event handlers to convert extended native supported data types from their backend - text representation to a .NET object. - - - - - Convert a postgresql point to a System.NpgsqlPoint. - - - - - Convert a postgresql point to a System.RectangleF. - - - - - LDeg. - - - - - Path. - - - - - Polygon. - - - - - Circle. - - - - - Inet. - - - - - MAC Address. - - - - - interval - - - - - Provide event handlers to convert the basic native supported data types from - native form to backend representation. - - - - - Convert a string to UTF8 encoded text, escaped and quoted as required. - - - - - Convert a string to UTF8 encoded text. - - - - - Binary data, escaped and quoted as required. - - - - - Binary data with possible older style octal escapes, quoted. - - - - - Binary data in the new hex format (>= 9.0), quoted. - - - - - Binary data, raw. - - - - - Convert to a postgresql boolean text format. - - - - - Convert to a postgresql boolean binary format. - - - - - Convert to a postgresql binary int2. - - - - - Convert to a postgresql binary int4. - - - - - Convert to a postgresql binary int8. - - - - - Convert to a postgresql bit. - - - - - Convert to a postgresql timestamp. - - - - - Convert to a postgresql date. - - - - - Convert to a postgresql time. - - - - - Convert to a postgres money. - - - - - Convert to a postgres double with maximum precision. - - - - - Convert a System.Float to a postgres float4. - - - - - Convert a System.Double to a postgres float8. - - - - - Provide event handlers to convert extended native supported data types from - native form to backend representation. - - - - - Point. - - - - - Box. - - - - - LSeg. - - - - - Open path. - - - - - Polygon. - - - - - Convert to a postgres MAC Address. - - - - - Circle. - - - - - Convert to a postgres inet. - - - - - Convert to a postgres interval - - - - - Delegate called to convert the given backend text data to its native representation. - - - - - Delegate called to convert the given backend binary data to its native representation. - - - - - Represents a backend data type. - This class can be called upon to convert a backend field representation to a native object. - - - - - Construct a new NpgsqlTypeInfo with the given attributes and conversion handlers. - - Type OID provided by the backend server. - Type name provided by the backend server. - NpgsqlDbType - DbType - System type to convert fields of this type to. - Data conversion handler for text encoding. - Data conversion handler for binary data. - - - - Perform a data conversion from a backend representation to - a native object. - - Data sent from the backend. - fieldValueSize - Type modifier field sent from the backend. - - - - Perform a data conversion from a backend representation to - a native object. - - Data sent from the backend. - TypeSize - Type modifier field sent from the backend. - - - - Type OID provided by the backend server. - - - - - Type name provided by the backend server. - - - - - NpgsqlDbType. - - - - - NpgsqlDbType. - - - - - Provider type to convert fields of this type to. - - - - - System type to convert fields of this type to. - - - - - Reports whether a backend binary to native decoder is available for this type. - - - - - Delegate called to convert the given native data to its backand representation. - - - - - Represents a backend data type. - This class can be called upon to convert a native object to its backend field representation, - - - - - Returns an NpgsqlNativeTypeInfo for an array where the elements are of the type - described by the NpgsqlNativeTypeInfo supplied. - - - - - Construct a new NpgsqlTypeInfo with the given attributes and conversion handlers. - - Type name provided by the backend server. - DbType - Quote - NpgsqlDbType - Data conversion handler for text backend encoding. - Data conversion handler for binary backend encoding (for extended queries). - - - - Perform a data conversion from a native object to - a backend representation. - DBNull and null values are handled differently depending if a plain query is used - When - - Native .NET object to be converted. - Specifies that the value should be formatted for the extended query syntax. - Options to guide serialization. If null, a default options set is used. - Specifies that the value should be formatted as an extended query array element. - - - - Type name provided by the backend server. - - - - - NpgsqlDbType. - - - - - DbType. - - - - - Apply quoting. - - - - - Use parameter size information. - - - - - Reports whether a native to backend binary encoder is available for this type. - - - - - Provide mapping between type OID, type name, and a NpgsqlBackendTypeInfo object that represents it. - - - - - Construct an empty mapping. - - - - - Copy constuctor. - - - - - Add the given NpgsqlBackendTypeInfo to this mapping. - - - - - Add a new NpgsqlBackendTypeInfo with the given attributes and conversion handlers to this mapping. - - Type OID provided by the backend server. - Type name provided by the backend server. - NpgsqlDbType - DbType - System type to convert fields of this type to. - Data conversion handler for text encoding. - Data conversion handler for binary data. - - - - Make a shallow copy of this type mapping. - - - - - Determine if a NpgsqlBackendTypeInfo with the given backend type OID exists in this mapping. - - - - - Determine if a NpgsqlBackendTypeInfo with the given backend type name exists in this mapping. - - - - - Get the number of type infos held. - - - - - Retrieve the NpgsqlBackendTypeInfo with the given backend type OID, or null if none found. - - - - - Retrieve the NpgsqlBackendTypeInfo with the given backend type name, or null if none found. - - - - - Provide mapping between type Type, NpgsqlDbType and a NpgsqlNativeTypeInfo object that represents it. - - - - - Add the given NpgsqlNativeTypeInfo to this mapping. - - - - - Add a new NpgsqlNativeTypeInfo with the given attributes and conversion handlers to this mapping. - - Type name provided by the backend server. - NpgsqlDbType - DbType - Quote - Data conversion handler for text backend encoding. - Data conversion handler for binary backend encoding (for extended query). - - - - Retrieve the NpgsqlNativeTypeInfo with the given NpgsqlDbType. - - - - - Retrieve the NpgsqlNativeTypeInfo with the given DbType. - - - - - Retrieve the NpgsqlNativeTypeInfo with the given Type. - - - - - Determine if a NpgsqlNativeTypeInfo with the given backend type name exists in this mapping. - - - - - Determine if a NpgsqlNativeTypeInfo with the given NpgsqlDbType exists in this mapping. - - - - - Determine if a NpgsqlNativeTypeInfo with the given Type name exists in this mapping. - - - - - Get the number of type infos held. - - - - - Represents a PostgreSQL Point type - - - - - Represents a PostgreSQL Line Segment type. - - - - - Represents a PostgreSQL Path type. - - - - - Represents a PostgreSQL Polygon type. - - - - - Represents a PostgreSQL Circle type. - - - - - Represents a PostgreSQL inet type. - - - - - Represents a PostgreSQL MacAddress type. - - - - - - - The macAddr parameter must contain a string that can only consist of numbers - and upper-case letters as hexadecimal digits. (See PhysicalAddress.Parse method on MSDN) - - - - This class contains helper methods for type conversion between - the .Net type system and postgresql. - - - - - A cache of basic datatype mappings keyed by server version. This way we don't - have to load the basic type mappings for every connection. - - - - - Find a NpgsqlNativeTypeInfo in the default types map that can handle objects - of the given NpgsqlDbType. - - - - - Find a NpgsqlNativeTypeInfo in the default types map that can handle objects - of the given NpgsqlDbType. - - - - - Find a NpgsqlNativeTypeInfo in the default types map that can handle objects - of the given DbType. - - - - - Find a NpgsqlNativeTypeInfo in the default types map that can handle objects - of the given System.Type. - - - - - This method is responsible to convert the byte[] received from the backend - to the corresponding NpgsqlType. - The given TypeInfo is called upon to do the conversion. - If no TypeInfo object is provided, no conversion is performed. - - - - - This method is responsible to convert the string received from the backend - to the corresponding NpgsqlType. - The given TypeInfo is called upon to do the conversion. - If no TypeInfo object is provided, no conversion is performed. - - - - - Create the one and only native to backend type map. - This map is used when formatting native data - types to backend representations. - - - - - This method creates (or retrieves from cache) a mapping between type and OID - of all natively supported postgresql data types. - This is needed as from one version to another, this mapping can be changed and - so we avoid hardcoding them. - - NpgsqlTypeMapping containing all known data types. The mapping must be - cloned before it is modified because it is cached; changes made by one connection may - effect another connection. - - - - - Attempt to map types by issuing a query against pg_type. - This function takes a list of NpgsqlTypeInfo and attempts to resolve the OID field - of each by querying pg_type. If the mapping is found, the type info object is - updated (OID) and added to the provided NpgsqlTypeMapping object. - - NpgsqlConnector to send query through. - Mapping object to add types too. - List of types that need to have OID's mapped. - - - - Summary description for NpgsqlQuery - - - - - For classes representing messages sent from the client to the server. - - - - - Set Cache Size. The default value is 20. - - - - - Lookup cached entity. null will returned if not match. - For both get{} and set{} apply LRU rule. - - key - - - - - The globally available text encoding used for frontend/backend communication. - - - - This class represents the base class for the state pattern design pattern - implementation. - - - This class represents the base class for the state pattern design pattern - implementation. - - - - - - This method is used by the states to change the state of the context. - - - - - Call ProcessBackendResponsesEnum(), and scan and discard all results. - - - - - This method is responsible to handle all protocol messages sent from the backend. - It holds all the logic to do it. - To exchange data, it uses a Mediator object from which it reads/writes information - to handle backend requests. - - - - - - Checks for context socket availability. - Socket.Poll supports integer as microseconds parameter. - This limits the usable command timeout value - to 2,147 seconds: (2,147 x 1,000,000 less than max_int). - In order to bypass this limit, the availability of - the socket is checked in 2,147 seconds cycles - - true, if for context socket availability was checked, false otherwise. - Context. - Select mode. - - - - Called from constructor of derived class. - - - - - Finalizer for HashAlgorithm - - - - - Computes the entire hash of all the bytes in the byte array. - - - - - When overridden in a derived class, drives the hashing function. - - - - - - - - When overridden in a derived class, this pads and hashes whatever data might be left in the buffers and then returns the hash created. - - - - - When overridden in a derived class, initializes the object to prepare for hashing. - - - - - Used for stream chaining. Computes hash as data passes through it. - - The buffer from which to grab the data to be copied. - The offset into the input buffer to start reading at. - The number of bytes to be copied. - The buffer to write the copied data to. - At what point in the outputBuffer to write the data at. - - - - Used for stream chaining. Computes hash as data passes through it. Finishes off the hash. - - The buffer from which to grab the data to be copied. - The offset into the input buffer to start reading at. - The number of bytes to be copied. - - - - Get whether or not the hash can transform multiple blocks at a time. - Note: MUST be overriden if descendant can transform multiple block - on a single call! - - - - - Gets the previously computed hash. - - - - - Returns the size in bits of the hash. - - - - - Must be overriden if not 1 - - - - - Must be overriden if not 1 - - - - - Common base class for all derived MD5 implementations. - - - - - Called from constructor of derived class. - - - - - Creates the default derived class. - - - - - C# implementation of the MD5 cryptographic hash function. - - - - - Creates a new MD5CryptoServiceProvider. - - - - - Drives the hashing function. - - Byte array containing the data to hash. - Where in the input buffer to start. - Size in bytes of the data in the buffer to hash. - - - - This finalizes the hash. Takes the data from the chaining variables and returns it. - - - - - Resets the class after use. Called automatically after hashing is done. - - - - - This is the meat of the hash function. It is what processes each block one at a time. - - Byte array to process data from. - Where in the byte array to start processing. - - - - Pads and then processes the final block. - - Buffer to grab data from. - Position in buffer in bytes to get data from. - How much data in bytes in the buffer to use. - - - - Implements for version 3 of the protocol. - - - - - Reads a row, field by field, allowing a DataRow to be built appropriately. - - - - - Marker interface which identifies a class which may take possession of a stream for the duration of - it's lifetime (possibly temporarily giving that possession to another class for part of that time. - - It inherits from IDisposable, since any such class must make sure it leaves the stream in a valid state. - - The most important such class is that compiler-generated from ProcessBackendResponsesEnum. Of course - we can't make that inherit from this interface, alas. - - - - - Marker interface which identifies a class which represents part of - a response from the server. - - - - - Reads part of a field, as needed (for - and - - - - - Adds further functionality to stream that is dependant upon the type of data read. - - - - - Completes the implementation of Streamer for char data. - - - - - Completes the implementation of Streamer for byte data. - - - - - This class represents a BackEndKeyData message received - from PostgreSQL - - - - - This class represents the Bind message sent to PostgreSQL - server. - - - - - - This class represents the CancelRequest message sent to PostgreSQL - server. - - - - - - Represents a SQL statement or function (stored procedure) to execute - against a PostgreSQL database. This class cannot be inherited. - - - Represents a SQL statement or function (stored procedure) to execute - against a PostgreSQL database. This class cannot be inherited. - - - Represents a SQL statement or function (stored procedure) to execute - against a PostgreSQL database. This class cannot be inherited. - - - - - Initializes a new instance of the NpgsqlCommand class. - - - - - Initializes a new instance of the NpgsqlCommand class with the text of the query. - - The text of the query. - - - - Initializes a new instance of the NpgsqlCommand class with the text of the query and a NpgsqlConnection. - - The text of the query. - A NpgsqlConnection that represents the connection to a PostgreSQL server. - - - - Initializes a new instance of the NpgsqlCommand class with the text of the query, a NpgsqlConnection, and the NpgsqlTransaction. - - The text of the query. - A NpgsqlConnection that represents the connection to a PostgreSQL server. - The NpgsqlTransaction in which the NpgsqlCommand executes. - - - - Used to execute internal commands. - - - - - Attempts to cancel the execution of a NpgsqlCommand. - - This Method isn't implemented yet. - - - - Create a new command based on this one. - - A new NpgsqlCommand object. - - - - Create a new command based on this one. - - A new NpgsqlCommand object. - - - - Creates a new instance of an DbParameter object. - - An DbParameter object. - - - - Creates a new instance of a NpgsqlParameter object. - - A NpgsqlParameter object. - - - - Releases the resources used by the NpgsqlCommand. - - - - - Internal query shortcut for use in cases where the number - of affected rows is of no interest. - - - - - Special adaptation of ExecuteBlind() that sets statement_timeout. - This exists to prevent Connector.SetBackendCommandTimeout() from calling Command.ExecuteBlind(), - which will cause an endless recursive loop. - - - Timeout in seconds. - - - - Executes a SQL statement against the connection and returns the number of rows affected. - - The number of rows affected if known; -1 otherwise. - - - - Sends the CommandText to - the Connection and builds a - NpgsqlDataReader - using one of the CommandBehavior values. - - One of the CommandBehavior values. - A NpgsqlDataReader object. - - - - Sends the CommandText to - the Connection and builds a - NpgsqlDataReader. - - A NpgsqlDataReader object. - - - - Sends the CommandText to - the Connection and builds a - NpgsqlDataReader - using one of the CommandBehavior values. - - One of the CommandBehavior values. - A NpgsqlDataReader object. - Currently the CommandBehavior parameter is ignored. - - - - This method binds the parameters from parameters collection to the bind - message. - - - - - Executes the query, and returns the first column of the first row - in the result set returned by the query. Extra columns or rows are ignored. - - The first column of the first row in the result set, - or a null reference if the result set is empty. - - - - Creates a prepared version of the command on a PostgreSQL server. - - - - - This method checks the connection state to see if the connection - is set or it is open. If one of this conditions is not met, throws - an InvalidOperationException - - - - - This method substitutes the Parameters, if exist, in the command - to their actual values. - The parameter name format is :ParameterName. - - A version of CommandText with the Parameters inserted. - - - - Process this.commandText, trimming each distinct command and substituting paramater - tokens. - - - UTF8 encoded command ready to be sent to the backend. - - - - Append a region of a source command text to an output command, performing parameter token - substitutions. - - Stream to which to append output. - Command text. - - - false if the query has multiple statements which are not allowed - - - - Gets or sets the SQL statement or function (stored procedure) to execute at the data source. - - The Transact-SQL statement or stored procedure to execute. The default is an empty string. - - - - Gets or sets the wait time before terminating the attempt - to execute a command and generating an error. - - The time (in seconds) to wait for the command to execute. - The default is 20 seconds. - - - - Gets or sets a value indicating how the - CommandText property is to be interpreted. - - One of the CommandType values. The default is CommandType.Text. - - - - DB connection. - - - - - Gets or sets the NpgsqlConnection - used by this instance of the NpgsqlCommand. - - The connection to a data source. The default value is a null reference. - - - - DB parameter collection. - - - - - Gets the NpgsqlParameterCollection. - - The parameters of the SQL statement or function (stored procedure). The default is an empty collection. - - - - DB transaction. - - - - - Gets or sets the NpgsqlTransaction - within which the NpgsqlCommand executes. - - The NpgsqlTransaction. - The default value is a null reference. - - - - Gets or sets how command results are applied to the DataRow - when used by the Update - method of the DbDataAdapter. - - One of the UpdateRowSource values. - - - - Returns oid of inserted row. This is only updated when using executenonQuery and when command inserts just a single row. If table is created without oids, this will always be 0. - - - - - Design time visible. - - - - - This class is responsible to create database commands for automatic insert, update and delete operations. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The adapter. - - - - - This method is reponsible to derive the command parameter list with values obtained from function definition. - It clears the Parameters collection of command. Also, if there is any parameter type which is not supported by Npgsql, an InvalidOperationException will be thrown. - Parameters name will be parameter1, parameter2, ... - - NpgsqlCommand whose function parameters will be obtained. - - - - Gets the automatically generated object required - to perform insertions at the data source. - - - The automatically generated object required to perform insertions. - - - - - Gets the automatically generated object required to perform insertions - at the data source, optionally using columns for parameter names. - - - If true, generate parameter names matching column names, if possible. - If false, generate @p1, @p2, and so on. - - - The automatically generated object required to perform insertions. - - - - - Gets the automatically generated System.Data.Common.DbCommand object required - to perform updates at the data source. - - - The automatically generated System.Data.Common.DbCommand object required to perform updates. - - - - - Gets the automatically generated object required to perform updates - at the data source, optionally using columns for parameter names. - - - If true, generate parameter names matching column names, if possible. - If false, generate @p1, @p2, and so on. - - - The automatically generated object required to perform updates. - - - - - Gets the automatically generated System.Data.Common.DbCommand object required - to perform deletions at the data source. - - - The automatically generated System.Data.Common.DbCommand object required to perform deletions. - - - - - Gets the automatically generated object required to perform deletions - at the data source, optionally using columns for parameter names. - - - If true, generate parameter names matching column names, if possible. - If false, generate @p1, @p2, and so on. - - - The automatically generated object required to perform deletions. - - - - - Applies the parameter information. - - The parameter. - The row. - Type of the statement. - if set to true [where clause]. - - - - Returns the name of the specified parameter in the format of @p#. - - The number to be included as part of the parameter's name.. - - The name of the parameter with the specified number appended as part of the parameter name. - - - - - Returns the full parameter name, given the partial parameter name. - - The partial name of the parameter. - - The full parameter name corresponding to the partial parameter name requested. - - - - - Returns the placeholder for the parameter in the associated SQL statement. - - The number to be included as part of the parameter's name. - - The name of the parameter with the specified number appended. - - - - - Registers the to handle the event for a . - - The to be used for the update. - - - - Adds an event handler for the event. - - The sender - A instance containing information about the event. - - - - Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier, including properly escaping any embedded quotes in the identifier. - - The original unquoted identifier. - - The quoted version of the identifier. Embedded quotes within the identifier are properly escaped. - - - - - Unquoted identifier parameter cannot be null - - - - Given a quoted identifier, returns the correct unquoted form of that identifier, including properly un-escaping any embedded quotes in the identifier. - - The identifier that will have its embedded quotes removed. - - The unquoted identifier, with embedded quotes properly un-escaped. - - - - - Quoted identifier parameter cannot be null - - - - Gets or sets the beginning character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens. - - - The beginning character or characters to use. The default is an empty string. - - - - - - - - Gets or sets the ending character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens. - - - The ending character or characters to use. The default is an empty string. - - - - - - - - Represents the method that handles the Notice events. - - The source of the event. - A NpgsqlNoticeEventArgs that contains the event data. - - - - Represents the method that handles the Notification events. - - The source of the event. - A NpgsqlNotificationEventArgs that contains the event data. - - - - This class represents a connection to a - PostgreSQL server. - - - - - Initializes a new instance of the - NpgsqlConnection class. - - - - - Initializes a new instance of the - NpgsqlConnection class - and sets the ConnectionString. - - The connection used to open the PostgreSQL database. - - - - Initializes a new instance of the - NpgsqlConnection class - and sets the ConnectionString. - - The connection used to open the PostgreSQL database. - - - - Begins a database transaction with the specified isolation level. - - The isolation level under which the transaction should run. - An DbTransaction - object representing the new transaction. - - Currently the IsolationLevel ReadCommitted and Serializable are supported by the PostgreSQL backend. - There's no support for nested transactions. - - - - - Begins a database transaction. - - A NpgsqlTransaction - object representing the new transaction. - - Currently there's no support for nested transactions. - - - - - Begins a database transaction with the specified isolation level. - - The isolation level under which the transaction should run. - A NpgsqlTransaction - object representing the new transaction. - - Currently the IsolationLevel ReadCommitted and Serializable are supported by the PostgreSQL backend. - There's no support for nested transactions. - - - - - Opens a database connection with the property settings specified by the - ConnectionString. - - - - - This method changes the current database by disconnecting from the actual - database and connecting to the specified. - - The name of the database to use in place of the current database. - - - - Releases the connection to the database. If the connection is pooled, it will be - made available for re-use. If it is non-pooled, the actual connection will be shutdown. - - - - - When a connection is closed within an enclosing TransactionScope and the transaction - hasn't been promoted, we defer the actual closing until the scope ends. - - - - - Creates and returns a DbCommand - object associated with the IDbConnection. - - A DbCommand object. - - - - Creates and returns a NpgsqlCommand - object associated with the NpgsqlConnection. - - A NpgsqlCommand object. - - - - Releases all resources used by the - NpgsqlConnection. - - true when called from Dispose(); - false when being called from the finalizer. - - - - Create a new connection based on this one. - - A new NpgsqlConnection object. - - - - Create a new connection based on this one. - - A new NpgsqlConnection object. - - - - Returns a copy of the NpgsqlConnectionStringBuilder that contains the parsed connection string values. - - - - - Default SSL CertificateSelectionCallback implementation. - - - - - Default SSL CertificateValidationCallback implementation. - - - - - Default SSL PrivateKeySelectionCallback implementation. - - - - - Default SSL ProvideClientCertificatesCallback implementation. - - - - - Default SSL ValidateRemoteCertificateCallback implementation. - - - - - Write each key/value pair in the connection string to the log. - - - - - Sets the `settings` ConnectionStringBuilder based on the given `connectionString` - - The connection string to load the builder from - - - - Sets the `settings` ConnectionStringBuilder based on the given `connectionString` - - The connection string to load the builder from - - - - Refresh the cached _connectionString whenever the builder settings change - - - - - Returns the supported collections - - - - - Returns the schema collection specified by the collection name. - - The collection name. - The collection specified. - - - - Returns the schema collection specified by the collection name filtered by the restrictions. - - The collection name. - - The restriction values to filter the results. A description of the restrictions is contained - in the Restrictions collection. - - The collection specified. - - - - Clear connection pool. - - - - - Clear all connection pools. - - - - - Enlist transation. - - - - - - Occurs on NoticeResponses from the PostgreSQL backend. - - - - - Occurs on NotificationResponses from the PostgreSQL backend. - - - - - Called to provide client certificates for SSL handshake. - - - - - Mono.Security.Protocol.Tls.CertificateSelectionCallback delegate. - - - - - Mono.Security.Protocol.Tls.CertificateValidationCallback delegate. - - - - - Mono.Security.Protocol.Tls.PrivateKeySelectionCallback delegate. - - - - - Called to validate server's certificate during SSL handshake - - - - - Gets or sets the string used to connect to a PostgreSQL database. - Valid values are: -
        -
      • - Server: Address/Name of Postgresql Server; -
      • -
      • - Port: Port to connect to; -
      • -
      • - Protocol: Protocol version to use, instead of automatic; Integer 2 or 3; -
      • -
      • - Database: Database name. Defaults to user name if not specified; -
      • -
      • - User Id: User name; -
      • -
      • - Password: Password for clear text authentication; -
      • -
      • - SSL: True or False. Controls whether to attempt a secure connection. Default = False; -
      • -
      • - Pooling: True or False. Controls whether connection pooling is used. Default = True; -
      • -
      • - MinPoolSize: Min size of connection pool; -
      • -
      • - MaxPoolSize: Max size of connection pool; -
      • -
      • - Timeout: Time to wait for connection open in seconds. Default is 15. -
      • -
      • - CommandTimeout: Time to wait for command to finish execution before throw an exception. In seconds. Default is 20. -
      • -
      • - Sslmode: Mode for ssl connection control. Can be Prefer, Require, Allow or Disable. Default is Disable. Check user manual for explanation of values. -
      • -
      • - ConnectionLifeTime: Time to wait before closing unused connections in the pool in seconds. Default is 15. -
      • -
      • - SyncNotification: Specifies if Npgsql should use synchronous notifications. -
      • -
      • - SearchPath: Changes search path to specified and public schemas. -
      • -
      -
      - The connection string that includes the server name, - the database name, and other parameters needed to establish - the initial connection. The default value is an empty string. - -
      - - - Backend server host name. - - - - - Backend server port. - - - - - If true, the connection will attempt to use SSL. - - - - - Gets the time to wait while trying to establish a connection - before terminating the attempt and generating an error. - - The time (in seconds) to wait for a connection to open. The default value is 15 seconds. - - - - Gets the time to wait while trying to execute a command - before terminating the attempt and generating an error. - - The time (in seconds) to wait for a command to complete. The default value is 20 seconds. - - - - Gets the time to wait before closing unused connections in the pool if the count - of all connections exeeds MinPoolSize. - - - If connection pool contains unused connections for ConnectionLifeTime seconds, - the half of them will be closed. If there will be unused connections in a second - later then again the half of them will be closed and so on. - This strategy provide smooth change of connection count in the pool. - - The time (in seconds) to wait. The default value is 15 seconds. - - - - Gets the name of the current database or the database to be used after a connection is opened. - - The name of the current database or the name of the database to be - used after a connection is opened. The default value is the empty string. - - - - Whether datareaders are loaded in their entirety (for compatibility with earlier code). - - - - - Gets the database server name. - - - - - Gets flag indicating if we are using Synchronous notification or not. - The default value is false. - - - - - Gets the current state of the connection. - - A bitwise combination of the ConnectionState values. The default is Closed. - - - - Gets whether the current state of the connection is Open or Closed - - ConnectionState.Open or ConnectionState.Closed - - - - Compatibility version. - - - - - Version of the PostgreSQL backend. - This can only be called when there is an active connection. - - - - - PostgreSQL server version. - - - - - Protocol version in use. - This can only be called when there is an active connection. - Always retuna Version3 - - - - - Process id of backend server. - This can only be called when there is an active connection. - - - - - Report whether the backend is expecting standard conformant strings. - In version 8.1, Postgres began reporting this value (false), but did not actually support standard conformant strings. - In version 8.2, Postgres began supporting standard conformant strings, but defaulted this flag to false. - As of version 9.1, this flag defaults to true. - - - - - Report whether the backend understands the string literal E prefix (>= 8.1). - - - - - Report whether the backend understands the hex byte format (>= 9.0). - - - - - The connector object connected to the backend. - - - - - Gets the NpgsqlConnectionStringBuilder containing the parsed connection string values. - - - - - User name. - - - - - Use extended types. - - - - - Password. - - - - - Determine if connection pooling will be used for this connection. - - - - - DB provider factory. - - - - - Return an exact copy of this NpgsqlConnectionString. - - - - - No integrated security if we're on mono and .NET 4.5 because of ClaimsIdentity, - see https://github.com/npgsql/Npgsql/issues/133 - - - - - This function will set value for known key, both private member and base[key]. - - - - - value, coerced as needed to the stored type. - - - - The function will modify private member only, not base[key]. - - - - value, coerced as needed to the stored type. - - - - The function will access private member only, not base[key]. - - - value. - - - - Clear the member and assign them to the default value. - - - - - Gets or sets the backend server host name. - - - - - Gets or sets the backend server port. - - - - - Gets or sets the name of the database to be used after a connection is opened. - - The name of the database to be - used after a connection is opened. - - - - Gets or sets the login user name. - - - - - Gets or sets the login password as a UTF8 encoded byte array. - - - - - Sets the login password as a string. - - - - - Gets or sets a value indicating whether to attempt to use SSL. - - - - - Gets or sets a value indicating whether to attempt to use SSL. - - - - - Gets or sets the time to wait while trying to establish a connection - before terminating the attempt and generating an error. - - The time (in seconds) to wait for a connection to open. The default value is 15 seconds. - - - - Gets or sets the schema search path. - - - - - Gets or sets a value indicating whether connection pooling should be used. - - - - - Gets or sets the time to wait before closing unused connections in the pool if the count - of all connections exeeds MinPoolSize. - - - If connection pool contains unused connections for ConnectionLifeTime seconds, - the half of them will be closed. If there will be unused connections in a second - later then again the half of them will be closed and so on. - This strategy provide smooth change of connection count in the pool. - - The time (in seconds) to wait. The default value is 15 seconds. - - - - Gets or sets the minimum connection pool size. - - - - - Gets or sets the maximum connection pool size. - - - - - Gets or sets a value indicating whether to listen for notifications and report them between command activity. - - - - - Gets the time to wait while trying to execute a command - before terminating the attempt and generating an error. - - The time (in seconds) to wait for a command to complete. The default value is 20 seconds. - - - - Gets or sets a value indicating whether datareaders are loaded in their entirety (for compatibility with earlier code). - - - - - Compatibilty version. When possible, behaviour caused by breaking changes will be preserved - if this version is less than that where the breaking change was introduced. - - - - - Gets or sets the ootional application name parameter to be sent to the backend during connection initiation. - - - - - Gets or sets a value indicating whether to silently Prepare() all commands before execution. - - - - - Gets or sets the specified backend communication protocol version. - - - - - Gets the backend encoding. Always returns "UTF8". - - - - - Case insensative accessor for indivual connection string values. - - - - - Set both ImplicitDefault and ExplicitDefault to the 's default value. - - - - - - - - Set ImplicitDefault to the default value of 's type, - and ExplicitDefault to . - - - - - - - - Represents the method that allows the application to provide a certificate collection to be used for SSL clien authentication - - A X509CertificateCollection to be filled with one or more client certificates. - - - - Represents the method that is called to validate the certificate provided by the server during an SSL handshake - - The server's certificate - The certificate chain containing the certificate's CA and any intermediate authorities - Any errors that were detected - - - - !!! Helper class, for compilation only. - Connector implements the logic for the Connection Objects to - access the physical connection to the database, and isolate - the application developer from connection pooling internals. - - - - - Constructor. - - Connection string. - Pooled - Controls whether the connector can be shared. - - - - This method checks if the connector is still ok. - We try to send a simple query text, select 1 as ConnectionTest; - - - - - This method is responsible for releasing all resources associated with this Connector. - - - - - This method is responsible to release all portals used by this Connector. - - - - - Modify the backend statement_timeout value if needed. - - New timeout - - - - Default SSL CertificateSelectionCallback implementation. - - - - - Default SSL CertificateValidationCallback implementation. - - - - - Default SSL PrivateKeySelectionCallback implementation. - - - - - Default SSL ProvideClientCertificatesCallback implementation. - - - - - Default SSL ValidateRemoteCertificateCallback implementation. - - - - - This method is required to set all the version dependent features flags. - SupportsPrepare means the server can use prepared query plans (7.3+) - - - - - Opens the physical connection to the server. - - Usually called by the RequestConnector - Method of the connection pool manager. - - - - Closes the physical connection to the server. - - - - - Returns next portal index. - - - - - Returns next plan index. - - - - - Occurs on NoticeResponses from the PostgreSQL backend. - - - - - Occurs on NotificationResponses from the PostgreSQL backend. - - - - - Called to provide client certificates for SSL handshake. - - - - - Mono.Security.Protocol.Tls.CertificateSelectionCallback delegate. - - - - - Mono.Security.Protocol.Tls.CertificateValidationCallback delegate. - - - - - Mono.Security.Protocol.Tls.PrivateKeySelectionCallback delegate. - - - - - Called to validate server's certificate during SSL handshake - - - - - Gets the current state of the connection. - - - - - Return Connection String. - - - - - Version of backend server this connector is connected to. - - - - - The physical connection socket to the backend. - - - - - The physical connection stream to the backend. - - - - - The top level stream to the backend. - - - - - Reports if this connector is fully connected. - - - - - The connection mediator. - - - - - Report if the connection is in a transaction. - - - - - Options that control certain aspects of native to backend conversions that depend - on backend version and status. - - - - - This class manages all connector objects, pooled AND non-pooled. - - - - Unique static instance of the connector pool - mamager. - - - Map of index to unused pooled connectors, avaliable to the - next RequestConnector() call. - This hashmap will be indexed by connection string. - This key will hold a list of queues of pooled connectors available to be used. - - - Timer for tracking unused connections in pools. - - - - Searches the shared and pooled connector lists for a - matching connector object or creates a new one. - - The NpgsqlConnection that is requesting - the connector. Its ConnectionString will be used to search the - pool for available connectors. - A connector object. - - - - Find a pooled connector. Handle shared/non-shared here. - - - - - Releases a connector, possibly back to the pool for future use. - - - Pooled connectors will be put back into the pool if there is room. - Shared connectors should just have their use count decremented - since they always stay in the shared pool. - - Connection to which the connector is leased. - The connector to release. - - - - Release a pooled connector. Handle shared/non-shared here. - - - - - Find an available pooled connector in the non-shared pool, or create - a new one if none found. - - - - - Put a pooled connector into the pool queue. - - Connection is leased to. - Connector to pool - - - - A queue with an extra Int32 for keeping track of busy connections. - - - - - Connections available to the end user - - - - - Connections currently in use - - - - - Represents information about COPY operation data transfer format as returned by server. - - - - - Only created when a CopyInResponse or CopyOutResponse is received by NpgsqlState.ProcessBackendResponses() - - - - - Returns true if this operation is currently active and field at given location is in binary format. - - - - - Returns true if this operation is currently active and in binary format. - - - - - Returns number of fields if this operation is currently active, otherwise -1 - - - - - Represents a PostgreSQL COPY FROM STDIN operation with a corresponding SQL statement - to execute against a PostgreSQL database - and an associated stream used to read data from (if provided by user) - or for writing it (when generated by driver). - Eg. new NpgsqlCopyIn("COPY mytable FROM STDIN", connection, streamToRead).Start(); - - - - - Creates NpgsqlCommand to run given query upon Start(). Data for the requested COPY IN operation can then be written to CopyData stream followed by a call to End() or Cancel(). - - - - - Given command is run upon Start(). Data for the requested COPY IN operation can then be written to CopyData stream followed by a call to End() or Cancel(). - - - - - Given command is executed upon Start() and all data from fromStream is passed to it as copy data. - - - - - Returns true if this operation is currently active and field at given location is in binary format. - - - - - Command specified upon creation is executed as a non-query. - If CopyStream is set upon creation, it will be flushed to server as copy data, and operation will be finished immediately. - Otherwise the CopyStream member can be used for writing copy data to server and operation finished with a call to End() or Cancel(). - - - - - Called after writing all data to CopyStream to successfully complete this copy operation. - - - - - Withdraws an already started copy operation. The operation will fail with given error message. - Will do nothing if current operation is not active. - - - - - Returns true if the connection is currently reserved for this operation. - - - - - The stream provided by user or generated upon Start(). - User may provide a stream to constructor; it is used to pass to server all data read from it. - Otherwise, call to Start() sets this to a writable NpgsqlCopyInStream that passes all data written to it to server. - In latter case this is only available while the copy operation is active and null otherwise. - - - - - Returns true if this operation is currently active and in binary format. - - - - - Returns number of fields expected on each input row if this operation is currently active, otherwise -1 - - - - - The Command used to execute this copy operation. - - - - - Set before a COPY IN query to define size of internal buffer for reading from given CopyStream. - - - - - Represents an ongoing COPY FROM STDIN operation. - Provides methods to push data to server and end or cancel the operation. - - - - - Called from NpgsqlState.ProcessBackendResponses upon CopyInResponse. - If CopyStream is already set, it is used to read data to push to server, after which the copy is completed. - Otherwise CopyStream is set to a writable NpgsqlCopyInStream that calls SendCopyData each time it is written to. - - - - - Sends given packet to server as a CopyData message. - Does not check for notifications! Use another thread for that. - - - - - Sends CopyDone message to server. Handles responses, ie. may throw an exception. - - - - - Sends CopyFail message to server. Handles responses, ie. should always throw an exception: - in CopyIn state the server responds to CopyFail with an error response; - outside of a CopyIn state the server responds to CopyFail with an error response; - without network connection or whatever, there's going to eventually be a failure, timeout or user intervention. - - - - - Copy format information returned from server. - - - - - Stream for writing data to a table on a PostgreSQL version 7.4 or newer database during an active COPY FROM STDIN operation. - Passes data exactly as is and when given, so see to it that you use server encoding, correct format and reasonably sized writes! - - - - - Created only by NpgsqlCopyInState.StartCopy() - - - - - Successfully completes copying data to server. Returns after operation is finished. - Does nothing if this stream is not the active copy operation writer. - - - - - Withdraws an already started copy operation. The operation will fail with given error message. - Does nothing if this stream is not the active copy operation writer. - - - - - Writes given bytes to server. - Fails if this stream is not the active copy operation writer. - - - - - Flushes stream contents to server. - Fails if this stream is not the active copy operation writer. - - - - - Not readable - - - - - Not seekable - - - - - Not supported - - - - - True while this stream can be used to write copy data to server - - - - - False - - - - - True - - - - - False - - - - - Number of bytes written so far - - - - - Number of bytes written so far; not settable - - - - - Represents a PostgreSQL COPY TO STDOUT operation with a corresponding SQL statement - to execute against a PostgreSQL database - and an associated stream used to write results to (if provided by user) - or for reading the results (when generated by driver). - Eg. new NpgsqlCopyOut("COPY (SELECT * FROM mytable) TO STDOUT", connection, streamToWrite).Start(); - - - - - Creates NpgsqlCommand to run given query upon Start(), after which CopyStream provides data from database as requested in the query. - - - - - Given command is run upon Start(), after which CopyStream provides data from database as requested in the query. - - - - - Given command is executed upon Start() and all requested copy data is written to toStream immediately. - - - - - Returns true if this operation is currently active and field at given location is in binary format. - - - - - Command specified upon creation is executed as a non-query. - If CopyStream is set upon creation, all copy data from server will be written to it, and operation will be finished immediately. - Otherwise the CopyStream member can be used for reading copy data from server until no more data is available. - - - - - Flush generated CopyStream at once. Effectively reads and discard all the rest of copy data from server. - - - - - Returns true if the connection is currently reserved for this operation. - - - - - The stream provided by user or generated upon Start() - - - - - The Command used to execute this copy operation. - - - - - Returns true if this operation is currently active and in binary format. - - - - - Returns number of fields if this operation is currently active, otherwise -1 - - - - - Faster alternative to using the generated CopyStream. - - - - - Represents an ongoing COPY TO STDOUT operation. - Provides methods to read data from server or end the operation. - - - - - Called from NpgsqlState.ProcessBackendResponses upon CopyOutResponse. - If CopyStream is already set, it is used to write data received from server, after which the copy ends. - Otherwise CopyStream is set to a readable NpgsqlCopyOutStream that receives data from server. - - - - - Called from NpgsqlOutStream.Read to read copy data from server. - - - - - Copy format information returned from server. - - - - - Stream for reading data from a table or select on a PostgreSQL version 7.4 or newer database during an active COPY TO STDOUT operation. - Passes data exactly as provided by the server. - - - - - Created only by NpgsqlCopyOutState.StartCopy() - - - - - Discards copy data as long as server pushes it. Returns after operation is finished. - Does nothing if this stream is not the active copy operation reader. - - - - - Not writable. - - - - - Not flushable. - - - - - Copies data read from server to given byte buffer. - Since server returns data row by row, length will differ each time, but it is only zero once the operation ends. - Can be mixed with calls to the more efficient NpgsqlCopyOutStream.Read() : byte[] though that would not make much sense. - - - - - Not seekable - - - - - Not supported - - - - - Returns a whole row of data from server without extra work. - If standard Stream.Read(...) has been called before, it's internal buffers remains are returned. - - - - - True while this stream can be used to read copy data from server - - - - - True - - - - - False - - - - - False - - - - - Number of bytes read so far - - - - - Number of bytes read so far; can not be set. - - - - - Writes given objects into a stream for PostgreSQL COPY in default copy format (not CSV or BINARY). - - - - - Default delimiter. - - - - - Default separator. - - - - - Default null. - - - - - Default escape. - - - - - Default quote. - - - - - Default buffer size. - - - - - Constructor. - - - - - - Flush buffers. - - - - - Flush rows. - - - - - Flush fields. - - - - - Close the serializer. - - - - - Escape sequence for the given character. - - - - - - - Make room for bytes. - - - - - - Add bytes. - - - - - - End row. - - - - - Prefix field. - - - - - Field added. - - - - - Add null. - - - - - Add string. - - - - - - add Int32. - - - - - - Add Int64. - - - - - - Add number. - - - - - - Add bool - - - - - - Add DateTime. - - - - - - Report whether the serializer is active. - - - - - To Stream. - - - - - Delimiter. - - - - - Separator. - - - - - Escape. - - - - - Null. - - - - - Buffer size. - - - - - Report whether space remains in the buffer. - - - - - Strings to escape. - - - - - Escape sequence bytes. - - - - - Represents the method that handles the RowUpdated events. - - The source of the event. - A NpgsqlRowUpdatedEventArgs that contains the event data. - - - - Represents the method that handles the RowUpdating events. - - The source of the event. - A NpgsqlRowUpdatingEventArgs that contains the event data. - - - - This class represents an adapter from many commands: select, update, insert and delete to fill Datasets. - - - - - Default constructor. - - - - - Constructor. - - - - - - Constructor. - - - - - - - Constructor. - - - - - - - Create row updated event. - - - - - - - - - - Create row updating event. - - - - - - - - - - Raise the RowUpdated event. - - - - - - Raise the RowUpdating event. - - - - - - Row updated event. - - - - - Row updating event. - - - - - Delete command. - - - - - Select command. - - - - - Update command. - - - - - Insert command. - - - - - Provides a means of reading a forward-only stream of rows from a PostgreSQL backend. This class cannot be inherited. - - - - - Return the data type name of the column at index . - - - - - Return the data type of the column at index . - - - - - Return the Npgsql specific data type of the column at requested ordinal. - - column position - Appropriate Npgsql type for column. - - - - Return the column name of the column at index . - - - - - Return the data type OID of the column at index . - - FIXME: Why this method returns String? - - - - Has ordinal. - - - - - - - Return the column name of the column named . - - - - - Return the data DbType of the column at index . - - - - - Return the data NpgsqlDbType of the column at index . - - - - - Get specified field value. - /// - - - - - - Get the value of a column as a . - If the differences between and - in handling of days and months is not important to your application, use - instead. - - Index of the field to find. - value of the field. - - - - Get specified field value. - /// - - - - - - Get specified field value. - /// - - - - - - Get specified field value. - /// - - - - - - Get specified field value. - /// - - - - - - Get specified field value. - /// - - - - - - Send closed event. - - - - - Gets the value of a column converted to a Guid. - - - - - Gets the value of a column as Int16. - - - - - Gets the value of a column as Int32. - - - - - Gets the value of a column as Int64. - - - - - Gets the value of a column as Single. - - - - - Gets the value of a column as Double. - - - - - Gets the value of a column as String. - - - - - Gets the value of a column as Decimal. - - - - - Gets the value of a column as TimeSpan. - - - - - Copy values from each column in the current row into . - - Destination for column values. - The number of column values copied. - - - - Copy values from each column in the current row into . - - An array appropriately sized to store values from all columns. - The number of column values copied. - - - - Gets the value of a column as Boolean. - - - - - Gets the value of a column as Byte. - - - - - Gets the value of a column as Char. - - - - - Gets the value of a column as DateTime. - - - - - Returns a System.Data.DataTable that describes the column metadata of the DataReader. - - - - - This methods parses the command text and tries to get the tablename - from it. - - - - - Get enumerator. - - - - - - Is raised whenever Close() is called. - - - - - Gets the number of columns in the current row. - - - - - Gets the value of a column in its native format. - - - - - Gets the value of a column in its native format. - - - - - Gets a value indicating the depth of nesting for the current row. Always returns zero. - - - - - Gets a value indicating whether the data reader is closed. - - - - - Contains the column names as the keys - - - - - Contains all unique columns - - - - - This is the primary implementation of NpgsqlDataReader. It is the one used in normal cases (where the - preload-reader option is not set in the connection string to resolve some potential backwards-compatibility - issues), the only implementation used internally, and in cases where CachingDataReader is used, it is still - used to do the actual "leg-work" of turning a response stream from the server into a datareader-style - object - with CachingDataReader then filling it's cache from here. - - - - - Iterate through the objects returned through from the server. - If it's a CompletedResponse the rowsaffected count is updated appropriately, - and we iterate again, otherwise we return it (perhaps updating our cache of pending - rows if appropriate). - - The next we will deal with. - - - - Advances the data reader to the next result, when multiple result sets were returned by the PostgreSQL backend. - - True if the reader was advanced, otherwise false. - - - - Releases the resources used by the NpgsqlCommand. - - - - - Closes the data reader object. - - - - - Advances the data reader to the next result, when multiple result sets were returned by the PostgreSQL backend. - - True if the reader was advanced, otherwise false. - - - - Advances the data reader to the next row. - - True if the reader was advanced, otherwise false. - - - - Return the value of the column at index . - - - - - Gets raw data from a column. - - - - - Gets raw data from a column. - - - - - Report whether the value in a column is DBNull. - - - - - Gets the number of rows changed, inserted, or deleted by execution of the SQL statement. - - - - - Indicates if NpgsqlDatareader has rows to be read. - - - - - Provides an implementation of NpgsqlDataReader in which all data is pre-loaded into memory. - This operates by first creating a ForwardsOnlyDataReader as usual, and then loading all of it's - Rows into memory. There is a general principle that when there is a trade-off between a class design that - is more efficient and/or scalable on the one hand and one that is less efficient but has more functionality - (in this case the internal-only functionality of caching results) that one can build the less efficent class - from the most efficient without significant extra loss in efficiency, but not the other way around. The relationship - between ForwardsOnlyDataReader and CachingDataReader is an example of this). - Since the interface presented to the user is still forwards-only, queues are used to - store this information, so that dequeueing as we go we give the garbage collector the best opportunity - possible to reclaim any memory that is no longer in use. - ForwardsOnlyDataReader being used to actually - obtain the information from the server means that the "leg-work" is still only done (and need only be - maintained) in one place. - This class exists to allow for certain potential backwards-compatibility issues to be resolved - with little effort on the part of affected users. It is considerably less efficient than ForwardsOnlyDataReader - and hence never used internally. - - - - - This is the base class for NpgsqlDescribeStatement and NpgsqlDescribePortal. - - - - - - This class represents the Statement Describe message sent to PostgreSQL - server. - - - - - - This class represents the Portal Describe message sent to PostgreSQL - server. - - - - - - EventArgs class to send Notice parameters, which are just NpgsqlError's in a lighter context. - - - - - Notice information. - - - - - This class represents the ErrorResponse and NoticeResponse - message sent from PostgreSQL server. - - - - - Return a string representation of this error object. - - - - - Severity code. All versions. - - - - - Error code. PostgreSQL 7.4 and up. - - - - - Terse error message. All versions. - - - - - Detailed error message. PostgreSQL 7.4 and up. - - - - - Suggestion to help resolve the error. PostgreSQL 7.4 and up. - - - - - Position (one based) within the query string where the error was encounterd. PostgreSQL 7.4 and up. - - - - - Position (one based) within the query string where the error was encounterd. This position refers to an internal command executed for example inside a PL/pgSQL function. PostgreSQL 7.4 and up. - - - - - Internal query string where the error was encounterd. This position refers to an internal command executed for example inside a PL/pgSQL function. PostgreSQL 7.4 and up. - - - - - Trace back information. PostgreSQL 7.4 and up. - - - - - Source file (in backend) reporting the error. PostgreSQL 7.4 and up. - - - - - Source file line number (in backend) reporting the error. PostgreSQL 7.4 and up. - - - - - Source routine (in backend) reporting the error. PostgreSQL 7.4 and up. - - - - - Schema name which relates to the error. PostgreSQL 9.3 and up. - - - - - Table name which relates to the error. PostgreSQL 9.3 and up. - - - - - Column name which relates to the error. PostgreSQL 9.3 and up. - - - - - Data type of column which relates to the error. PostgreSQL 9.3 and up. - - - - - Constraint name which relates to the error. PostgreSQL 9.3 and up. - - - - - String containing the sql sent which produced this error. - - - - - Backend protocol version in use. - - - - - Error and notice message field codes - - - - - Severity: the field contents are ERROR, FATAL, or PANIC (in an error message), - or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message), or a localized - translation of one of these. Always present. - - - - - Code: the SQLSTATE code for the error (see Appendix A). Not localizable. Always present. - - - - - Message: the primary human-readable error message. This should be accurate - but terse (typically one line). Always present. - - - - - Detail: an optional secondary error message carrying more detail about the problem. - Might run to multiple lines. - - - - - Hint: an optional suggestion what to do about the problem. This is intended to differ - from Detail in that it offers advice (potentially inappropriate) rather than hard facts. - Might run to multiple lines. - - - - - Position: the field value is a decimal ASCII integer, indicating an error cursor - position as an index into the original query string. The first character has index 1, - and positions are measured in characters not bytes. - - - - - Internal position: this is defined the same as the P field, but it is used when the - cursor position refers to an internally generated command rather than the one submitted - by the client. - The q field will always appear when this field appears. - - - - - Internal query: the text of a failed internally-generated command. - This could be, for example, a SQL query issued by a PL/pgSQL function. - - - - - Where: an indication of the context in which the error occurred. - Presently this includes a call stack traceback of active procedural language functions - and internally-generated queries. The trace is one entry per line, most recent first. - - - - - Schema name: if the error was associated with a specific database object, - the name of the schema containing that object, if any. - - - - - Table name: if the error was associated with a specific table, the name of the table. - (Refer to the schema name field for the name of the table's schema.) - - - - - Column name: if the error was associated with a specific table column, the name of the column. - (Refer to the schema and table name fields to identify the table.) - - - - - Data type name: if the error was associated with a specific data type, the name of the data type. - (Refer to the schema name field for the name of the data type's schema.) - - - - - Constraint name: if the error was associated with a specific constraint, the name of the constraint. - Refer to fields listed above for the associated table or domain. - (For this purpose, indexes are treated as constraints, even if they weren't created with constraint syntax.) - - - - - File: the file name of the source-code location where the error was reported. - - - - - Line: the line number of the source-code location where the error was reported. - - - - - Routine: the name of the source-code routine reporting the error. - - - - - The level of verbosity of the NpgsqlEventLog - - - - - Don't log at all - - - - - Only log the most common issues - - - - - Log everything - - - - - This class handles all the Npgsql event and debug logging - - - - - Writes a string to the Npgsql event log if msglevel is bigger then NpgsqlEventLog.Level - - - This method is obsolete and should no longer be used. - It is likely to be removed in future versions of Npgsql - - The message to write to the event log - The minimum LogLevel for which this message should be logged. - - - - Writes a string to the Npgsql event log if msglevel is bigger then NpgsqlEventLog.Level - - The ResourceManager to get the localized resources - The name of the resource that should be fetched by the ResourceManager - The minimum LogLevel for which this message should be logged. - The additional parameters that shall be included into the log-message (must be compatible with the string in the resource): - - - - Writes the default log-message for the action of calling the Get-part of an Indexer to the log file. - - The minimum LogLevel for which this message should be logged. - The name of the class that contains the Indexer - The parameter given to the Indexer - - - - Writes the default log-message for the action of calling the Set-part of an Indexer to the logfile. - - The minimum LogLevel for which this message should be logged. - The name of the class that contains the Indexer - The parameter given to the Indexer - The value the Indexer is set to - - - - Writes the default log-message for the action of calling the Get-part of a Property to the logfile. - - The minimum LogLevel for which this message should be logged. - The name of the class that contains the Property - The name of the Property - - - - Writes the default log-message for the action of calling the Set-part of a Property to the logfile. - - The minimum LogLevel for which this message should be logged. - The name of the class that contains the Property - The name of the Property - The value the Property is set to - - - - Writes the default log-message for the action of calling a Method without Arguments to the logfile. - - The minimum LogLevel for which this message should be logged. - The name of the class that contains the Method - The name of the Method - - - - Writes the default log-message for the action of calling a Method with one Argument to the logfile. - - The minimum LogLevel for which this message should be logged. - The name of the class that contains the Method - The name of the Method - The value of the Argument of the Method - - - - Writes the default log-message for the action of calling a Method with two Arguments to the logfile. - - The minimum LogLevel for which this message should be logged. - The name of the class that contains the Method - The name of the Method - The value of the first Argument of the Method - The value of the second Argument of the Method - - - - Writes the default log-message for the action of calling a Method with three Arguments to the logfile. - - The minimum LogLevel for which this message should be logged. - The name of the class that contains the Method - The name of the Method - The value of the first Argument of the Method - The value of the second Argument of the Method - The value of the third Argument of the Method - - - - Writes the default log-message for the action of calling a Method with more than three Arguments to the logfile. - - The minimum LogLevel for which this message should be logged. - The name of the class that contains the Method - The name of the Method - A Object-Array with zero or more Ojects that are Arguments of the Method. - - - - Sets/Returns the filename to use for logging. - - The filename of the current Log file. - - - - Sets/Returns whether Log messages should be echoed to the console - - true if Log messages are echoed to the console, otherwise false - - - - The exception that is thrown when the PostgreSQL backend reports errors. - - - - - Construct a backend error exception based on a list of one or more - backend errors. The basic Exception.Message will be built from the - first (usually the only) error in the list. - - - - - Get object data. - - - - - - - Format a .NET style exception string. - Include all errors in the list, including any hints. - - - - - Append a line to the given Stream, first checking for zero-length. - - - - - Provide access to the entire list of errors provided by the PostgreSQL backend. - - - - - Severity code. All versions. - - - - - Error code. PostgreSQL 7.4 and up. - - - - - Basic error message. All versions. - - - - - Detailed error message. PostgreSQL 7.4 and up. - - - - - Suggestion to help resolve the error. PostgreSQL 7.4 and up. - - - - - Position (one based) within the query string where the error was encounterd. PostgreSQL 7.4 and up. - - - - - Trace back information. PostgreSQL 7.4 and up. - - - - - Source file (in backend) reporting the error. PostgreSQL 7.4 and up. - - - - - Source file line number (in backend) reporting the error. PostgreSQL 7.4 and up. - - - - - Source routine (in backend) reporting the error. PostgreSQL 7.4 and up. - - - - - Schema name which relates to the error. PostgreSQL 9.3 and up. - - - - - Table name which relates to the error. PostgreSQL 9.3 and up. - - - - - Column name which relates to the error. PostgreSQL 9.3 and up. - - - - - Data type of column which relates to the error. PostgreSQL 9.3 and up. - - - - - Constraint name which relates to the error. PostgreSQL 9.3 and up. - - - - - String containing the sql sent which produced this error. - - - - - Returns the entire list of errors provided by the PostgreSQL backend. - - - - - This class represents the Execute message sent to PostgreSQL - server. - - - - - - A factory to create instances of various Npgsql objects. - - - - - Creates an NpgsqlCommand object. - - - - - This class represents the Flush message sent to PostgreSQL - server. - - - - - - For classes representing simple messages, - consisting only of a message code and length identifier, - sent from the client to the server. - - - - - This class is responsible for serving as bridge between the backend - protocol handling and the core classes. It is used as the mediator for - exchanging data generated/sent from/to backend. - - - - - - The current command timeout on the backend. This is set via "SET statement_timeout = (milliseconds)". - A value of -1 means the backend's timeout value is unknown because it has not yet been set. - - - - - EventArgs class to send Notification parameters. - - - - - Process ID of the PostgreSQL backend that sent this notification. - - - - - Condition that triggered that notification. - - - - - Additional Information From Notifiying Process (for future use, currently postgres always sets this to an empty string) - - - - - This class represents a parameter to a command that will be sent to server - - - - - Initializes a new instance of the NpgsqlParameter class. - - - - - Initializes a new instance of the NpgsqlParameter - class with the parameter m_Name and a value of the new NpgsqlParameter. - - The m_Name of the parameter to map. - An Object that is the value of the NpgsqlParameter. - -

      When you specify an Object - in the value parameter, the DbType is - inferred from the .NET Framework type of the Object.

      -

      When using this constructor, you must be aware of a possible misuse of the constructor which takes a DbType parameter. - This happens when calling this constructor passing an int 0 and the compiler thinks you are passing a value of DbType. - Use Convert.ToInt32(value) for example to have compiler calling the correct constructor.

      -
      -
      - - - Initializes a new instance of the NpgsqlParameter - class with the parameter m_Name and the data type. - - The m_Name of the parameter to map. - One of the DbType values. - - - - Initializes a new instance of the NpgsqlParameter. - - The m_Name of the parameter to map. - One of the DbType values. - - - - Initializes a new instance of the NpgsqlParameter. - - The m_Name of the parameter to map. - One of the NpgsqlDbType values. - The length of the parameter. - - - - Initializes a new instance of the NpgsqlParameter. - - The m_Name of the parameter to map. - One of the DbType values. - The length of the parameter. - - - - Initializes a new instance of the NpgsqlParameter - - The m_Name of the parameter to map. - One of the NpgsqlDbType values. - The length of the parameter. - The m_Name of the source column. - - - - Initializes a new instance of the NpgsqlParameter. - - The m_Name of the parameter to map. - One of the DbType values. - The length of the parameter. - The m_Name of the source column. - - - - Initializes a new instance of the NpgsqlParameter. - - The m_Name of the parameter to map. - One of the NpgsqlDbType values. - The length of the parameter. - The m_Name of the source column. - One of the ParameterDirection values. - true if the value of the field can be null, otherwise false. - The total number of digits to the left and right of the decimal point to which - Value is resolved. - The total number of decimal places to which - Value is resolved. - One of the DataRowVersion values. - An Object that is the value - of the NpgsqlParameter. - - - - Initializes a new instance of the NpgsqlParameter. - - The m_Name of the parameter to map. - One of the DbType values. - The length of the parameter. - The m_Name of the source column. - One of the ParameterDirection values. - true if the value of the field can be null, otherwise false. - The total number of digits to the left and right of the decimal point to which - Value is resolved. - The total number of decimal places to which - Value is resolved. - One of the DataRowVersion values. - An Object that is the value - of the NpgsqlParameter. - - - - Reset DBType. - - - - - Creates a new NpgsqlParameter that - is a copy of the current instance. - - A new NpgsqlParameter that is a copy of this instance. - - - - The collection to which this parameter belongs, if any. - - - - - Gets or sets the maximum number of digits used to represent the - Value property. - - The maximum number of digits used to represent the - Value property. - The default value is 0, which indicates that the data provider - sets the precision for Value. - - - - Whether to use an explicit cast when included in a query. - - - - - Gets or sets the number of decimal places to which - Value is resolved. - - The number of decimal places to which - Value is resolved. The default is 0. - - - - Gets or sets the maximum size, in bytes, of the data within the column. - - The maximum size, in bytes, of the data within the column. - The default value is inferred from the parameter value. - - - - Gets or sets the DbType of the parameter. - - One of the DbType values. The default is String. - - - - Gets or sets the DbType of the parameter. - - One of the DbType values. The default is String. - - - - Gets or sets a value indicating whether the parameter is input-only, - output-only, bidirectional, or a stored procedure return value parameter. - - One of the ParameterDirection - values. The default is Input. - - - - Gets or sets a value indicating whether the parameter accepts null values. - - true if null values are accepted; otherwise, false. The default is false. - - - - Gets or sets the m_Name of the NpgsqlParameter. - - The m_Name of the NpgsqlParameter. - The default is an empty string. - - - - The m_Name scrubbed of any optional marker - - - - - Gets or sets the m_Name of the source column that is mapped to the - DataSet and used for loading or - returning the Value. - - The m_Name of the source column that is mapped to the - DataSet. The default is an empty string. - - - - Gets or sets the DataRowVersion - to use when loading Value. - - One of the DataRowVersion values. - The default is Current. - - - - Gets or sets the value of the parameter. - - An Object that is the value of the parameter. - The default value is null. - - - - Gets or sets the value of the parameter. - - An Object that is the value of the parameter. - The default value is null. - - - - Source column mapping. - - - - - Represents a collection of parameters relevant to a NpgsqlCommand - as well as their respective mappings to columns in a DataSet. - This class cannot be inherited. - - - - - Initializes a new instance of the NpgsqlParameterCollection class. - - - - - Invalidate the hash lookup tables. This should be done any time a change - may throw the lookups out of sync with the list. - - - - - Adds the specified NpgsqlParameter object to the NpgsqlParameterCollection. - - The NpgsqlParameter to add to the collection. - The index of the new NpgsqlParameter object. - - - - Obsolete. Use AddWithValue instead. - - - Use caution when using this overload of the - Add method to specify integer parameter values. - Because this overload takes a value of type Object, - you must convert the integral value to an Object - type when the value is zero, as the following C# example demonstrates. - parameters.Add(":pname", Convert.ToInt32(0)); - If you do not perform this conversion, the compiler will assume you - are attempting to call the NpgsqlParameterCollection.Add(string, DbType) overload. - - - - - Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified parameter name and value. - - The name of the NpgsqlParameter. - The Value of the NpgsqlParameter to add to the collection. - The paramater that was added. - - - - Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified parameter name and value. - - The name of the NpgsqlParameter. - The Value of the NpgsqlParameter to add to the collection. - One of the NpgsqlDbType values. - The paramater that was added. - - - - Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified parameter name and value. - - The name of the NpgsqlParameter. - The Value of the NpgsqlParameter to add to the collection. - One of the NpgsqlDbType values. - The length of the column. - The paramater that was added. - - - - Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified parameter name and value. - - The name of the NpgsqlParameter. - The Value of the NpgsqlParameter to add to the collection. - One of the NpgsqlDbType values. - The length of the column. - The name of the source column. - The paramater that was added. - - - - Adds a NpgsqlParameter to the NpgsqlParameterCollection given the parameter name and the data type. - - The name of the parameter. - One of the DbType values. - The index of the new NpgsqlParameter object. - - - - Adds a NpgsqlParameter to the NpgsqlParameterCollection with the parameter name, the data type, and the column length. - - The name of the parameter. - One of the DbType values. - The length of the column. - The index of the new NpgsqlParameter object. - - - - Adds a NpgsqlParameter to the NpgsqlParameterCollection with the parameter name, the data type, the column length, and the source column name. - - The name of the parameter. - One of the DbType values. - The length of the column. - The name of the source column. - The index of the new NpgsqlParameter object. - - - - Removes the specified NpgsqlParameter from the collection using the parameter name. - - The name of the NpgsqlParameter object to retrieve. - - - - Gets a value indicating whether a NpgsqlParameter with the specified parameter name exists in the collection. - - The name of the NpgsqlParameter object to find. - true if the collection contains the parameter; otherwise, false. - - - - Gets the location of the NpgsqlParameter in the collection with a specific parameter name. - - The name of the NpgsqlParameter object to find. - The zero-based location of the NpgsqlParameter in the collection. - - - - Removes the specified NpgsqlParameter from the collection using a specific index. - - The zero-based index of the parameter. - - - - Inserts a NpgsqlParameter into the collection at the specified index. - - The zero-based index where the parameter is to be inserted within the collection. - The NpgsqlParameter to add to the collection. - - - - Removes the specified NpgsqlParameter from the collection. - - The name of the NpgsqlParameter to remove from the collection. - - - - Removes the specified NpgsqlParameter from the collection. - - The NpgsqlParameter to remove from the collection. - - - - Gets a value indicating whether a NpgsqlParameter exists in the collection. - - The value of the NpgsqlParameter object to find. - true if the collection contains the NpgsqlParameter object; otherwise, false. - - - - Gets a value indicating whether a NpgsqlParameter with the specified parameter name exists in the collection. - - The name of the NpgsqlParameter object to find. - A reference to the requested parameter is returned in this out param if it is found in the list. This value is null if the parameter is not found. - true if the collection contains the parameter and param will contain the parameter; otherwise, false. - - - - Removes all items from the collection. - - - - - Gets the location of a NpgsqlParameter in the collection. - - The value of the NpgsqlParameter object to find. - The zero-based index of the NpgsqlParameter object in the collection. - - - - Adds the specified NpgsqlParameter object to the NpgsqlParameterCollection. - - The NpgsqlParameter to add to the collection. - The zero-based index of the new NpgsqlParameter object. - - - - Copies NpgsqlParameter objects from the NpgsqlParameterCollection to the specified array. - - An Array to which to copy the NpgsqlParameter objects in the collection. - The starting index of the array. - - - - Returns an enumerator that can iterate through the collection. - - An IEnumerator that can be used to iterate through the collection. - - - - Add an Array of parameters to the collection. - - Parameters to add. - - - - Get parameter. - - - - - - - Get parameter. - - - - - - - Set parameter. - - - - - - - Set parameter. - - - - - - - In methods taking an object as argument this method is used to verify - that the argument has the type NpgsqlParameter - - The object to verify - - - - Report the offset within the collection of the given parameter. - - Parameter to find. - Index of the parameter, or -1 if the parameter is not present. - - - - Insert the specified parameter into the collection. - - Index of the existing parameter before which to insert the new one. - Parameter to insert. - - - - Report whether the specified parameter is present in the collection. - - Parameter to find. - True if the parameter was found, otherwise false. - - - - Remove the specified parameter from the collection. - - Parameter to remove. - True if the parameter was found and removed, otherwise false. - - - - Convert collection to a System.Array. - - Destination array. - Starting index in destination array. - - - - Convert collection to a System.Array. - - NpgsqlParameter[] - - - - Gets the NpgsqlParameter with the specified name. - - The name of the NpgsqlParameter to retrieve. - The NpgsqlParameter with the specified name, or a null reference if the parameter is not found. - - - - Gets the NpgsqlParameter at the specified index. - - The zero-based index of the NpgsqlParameter to retrieve. - The NpgsqlParameter at the specified index. - - - - Report whether the collection is read only. Always false. - - - - - Report whether the collection is fixed size. Always false. - - - - - Report whether the collection is synchronized. - - - - - Gets the number of NpgsqlParameter objects in the collection. - - The number of NpgsqlParameter objects in the collection. - - - - Sync root. - - - - - This class represents the ParameterStatus message sent from PostgreSQL - server. - - - - - - This class represents the Parse message sent to PostgreSQL - server. - - - - - - This class represents a PasswordPacket message sent to backend - PostgreSQL. - - - - - Used when a connection is closed - - - - - This is the abstract base class for NpgsqlAsciiRow and NpgsqlBinaryRow. - - - - - The index of the current field in the stream, i.e. the one that hasn't - been read yet - - - - - This class represents a RowDescription message sent from - the PostgreSQL. - - - - - - This struct represents the internal data of the RowDescription message. - - - - - Provides the underlying mechanism for reading schema information. - - - - - Returns the MetaDataCollections that lists all possible collections. - - The MetaDataCollections - - - - Returns the Restrictions that contains the meaning and position of the values in the restrictions array. - - The Restrictions - - - - Returns the Databases that contains a list of all accessable databases. - - The database connection on which to run the metadataquery. - The restrictions to filter the collection. - The Databases - - - - Returns the Tables that contains table and view names and the database and schema they come from. - - The database connection on which to run the metadataquery. - The restrictions to filter the collection. - The Tables - - - - Returns the Columns that contains information about columns in tables. - - The database connection on which to run the metadataquery. - The restrictions to filter the collection. - The Columns. - - - - Returns the Views that contains view names and the database and schema they come from. - - The database connection on which to run the metadataquery. - The restrictions to filter the collection. - The Views - - - - Returns the Users containing user names and the sysid of those users. - - The database connection on which to run the metadataquery. - The restrictions to filter the collection. - The Users. - - - - This class represents a StartupPacket message of PostgreSQL - protocol. - - - - - - Represents a completed response message. - - - - - This class represents the Sync message sent to PostgreSQL - server. - - - - - - Represents a transaction to be made in a PostgreSQL database. This class cannot be inherited. - - - - - Dispose. - - - - - - Commits the database transaction. - - - - - Rolls back a transaction from a pending state. - - - - - Rolls back a transaction from a pending savepoint state. - - - - - Creates a transaction save point. - - - - - Cancel the transaction without telling the backend about it. This is - used to make the transaction go away when closing a connection. - - - - - Gets the NpgsqlConnection - object associated with the transaction, or a null reference if the - transaction is no longer valid. - - The NpgsqlConnection - object associated with the transaction. - - - - DB connection. - - - - - Specifies the IsolationLevel for this transaction. - - The IsolationLevel for this transaction. - The default is ReadCommitted. - - - - This class provides many util methods to handle - reading and writing of PostgreSQL protocol messages. - - - - - This method takes a ProtocolVersion and returns an integer - version number that the Postgres backend will recognize in a - startup packet. - - - - - This method takes a version string as returned by SELECT VERSION() and returns - a valid version string ("7.2.2" for example). - This is only needed when running protocol version 2. - This does not do any validity checks. - - - - - This method gets a C NULL terminated string from the network stream. - It keeps reading a byte in each time until a NULL byte is returned. - It returns the resultant string of bytes read. - This string is sent from backend. - - - - - Reads requested number of bytes from stream with retries until Stream.Read returns 0 or count is reached. - - Stream to read - byte buffer to fill - starting position to fill the buffer - number of bytes to read - The number of bytes read. May be less than count if no more bytes are available. - - - - Reads requested number of bytes from . If output matches exactly, and == false, is returned directly. - - Source array. - Starting position to read from - Number of bytes to read - Force a copy, even if the output is an exact copy of . - byte[] containing data requested. - - - - This method writes a string to the network stream. - - - - - This method writes a string to the network stream. - - - - - This method writes a C NULL terminated string to the network stream. - It appends a NULL terminator to the end of the String. - - - - - This method writes a C NULL terminated string to the network stream. - It appends a NULL terminator to the end of the String. - - - - - This method writes a byte to the stream. It also enables logging of them. - - - - - This method writes a byte to the stream. It also enables logging of them. - - - - - This method writes a set of bytes to the stream. It also enables logging of them. - - - - - This method writes a set of bytes to the stream. It also enables logging of them. - - - - - This method writes a C NULL terminated string limited in length to the - backend server. - It pads the string with null bytes to the size specified. - - - - - This method writes a C NULL terminated byte[] limited in length to the - backend server. - It pads the string with null bytes to the size specified. - - - - - Write a 32-bit integer to the given stream in the correct byte order. - - - - - Read a 32-bit integer from the given stream in the correct byte order. - - - - - Read a 32-bit integer from the given array in the correct byte order. - - - - - Write a 16-bit integer to the given stream in the correct byte order. - - - - - Read a 16-bit integer from the given stream in the correct byte order. - - - - - Read a 16-bit integer from the given array in the correct byte order. - - - - - Copy and possibly reverse a byte array, depending on host architecture endienness. - - Source byte array. - Force a copy even if no swap is performed. - , reversed if on a little-endian architecture, copied if required. - - - - Copy and possibly reverse a byte array, depending on host architecture endienness. - - Source byte array. - Starting offset in source array. - Number of bytes to copy. - Force a copy even if no swap is performed. - , reversed if on a little-endian architecture, copied if required. - - - - Represent the frontend/backend protocol version. - - - - - Represent the backend server version. - As this class offers no functionality beyond that offered by it has been - deprecated in favour of that class. - - - - - - Returns the string representation of this version in three place dot notation (Major.Minor.Patch). - - - - - Server version major number. - - - - - Server version minor number. - - - - - Server version patch level number. - - - - - A class to handle everything associated with SSPI authentication - - - - - Simplified SecBufferDesc struct with only one SecBuffer - - -
      -
      diff --git a/lib/ServiceStack.Client.dll b/lib/ServiceStack.Client.dll deleted file mode 100644 index ece117f3254..00000000000 Binary files a/lib/ServiceStack.Client.dll and /dev/null differ diff --git a/lib/ServiceStack.Client.dll.CodeAnalysisLog.xml b/lib/ServiceStack.Client.dll.CodeAnalysisLog.xml deleted file mode 100644 index 7e8e26acc45..00000000000 --- a/lib/ServiceStack.Client.dll.CodeAnalysisLog.xml +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - - - - - - - - - Object 'reader' can be disposed more than once in method 'AsyncServiceClient.ReadCallBack<T>(Task<int>, AsyncState<T>)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 360 - - - - - - - - - Provide an overridable implementation of Dispose(bool) on 'AsyncState<TResponse>' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - - - - - - Modify 'AsyncState<TResponse>.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - Provide an overridable implementation of Dispose(bool) on 'AsyncTimer' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - - - - - - Modify 'AsyncTimer.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - Add [Serializable] to 'AuthenticationException' as this type implements ISerializable. - - - - - - - Provide an overridable implementation of Dispose(bool) on 'ServerEventsClient' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - - - - - - 'ServerEventsClient' contains field 'ServerEventsClient.cancel' that is of IDisposable type: 'CancellationTokenSource'. Change the Dispose method on 'ServerEventsClient' to call Dispose or Close on this field. - - - Modify 'ServerEventsClient.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - - - 'ServiceClientBase.ServiceClientBase()' contains a call chain that results in a call to a virtual method defined by the class. Review the following call stack for unintended consequences: ServiceClientBase..ctor() ServiceClientBase.get_ContentType():String - - - - - - - Modify 'ServiceClientBase.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - Object 'responseStream' can be disposed more than once in method 'ServiceClientBase.HandleResponse<TResponse>(WebResponse)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 1355 - - - - - - - 'ServiceClientBase.PrepareWebRequest(string, string, object, Action<HttpWebRequest>)' rethrows a caught exception and specifies it explicitly as an argument. Use 'throw' without an argument instead, in order to preserve the stack location where the exception was initially raised. - - - - - - - - - - - Modify 'WcfServiceClient.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - Add an implementation of GetObjectData to type 'WebServiceException'. - - - - - - - - - - - Provide an overridable implementation of Dispose(bool) on 'InMemoryMessageQueueClient' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - - - - - - Modify 'InMemoryMessageQueueClient.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - Provide an overridable implementation of Dispose(bool) on 'MessageQueueClientFactory' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - - - - - - Modify 'MessageQueueClientFactory.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - Provide an overridable implementation of Dispose(bool) on 'RedisMessageFactory' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - - - - - - Modify 'RedisMessageFactory.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - Provide an overridable implementation of Dispose(bool) on 'RedisMessageProducer' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - - - - - - Modify 'RedisMessageProducer.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - Provide an overridable implementation of Dispose(bool) on 'RedisMessageQueueClient' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - - - - - - Modify 'RedisMessageQueueClient.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - Provide an overridable implementation of Dispose(bool) on 'RedisMessageQueueClientFactory' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - - - - - - Modify 'RedisMessageQueueClientFactory.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - - - - - - - - - - - - - - - Object 'deflateStream' can be disposed more than once in method 'DataContractSerializer.CompressToStream<XmlDto>(XmlDto, Stream)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 106 - Object 'stream' can be disposed more than once in method 'DataContractSerializer.CompressToStream<XmlDto>(XmlDto, Stream)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 106 - - - - - - - Object 'ms' can be disposed more than once in method 'DataContractSerializer.Parse<XmlDto>(XmlDto, bool)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 64 - - - - - - - - - - - Object 'ms' can be disposed more than once in method 'JsonDataContractSerializer.SerializeToString<T>(T)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 43 - - - - - - - - - - - Object 'ms' can be disposed more than once in method 'XmlSerializableSerializer.SerializeToString<XmlDto>(XmlDto)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 29 - - - - - - - - - - - - - - - Object 'ms' can be disposed more than once in method 'NetDeflateProvider.Deflate(string)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 21 - Object 'zipStream' can be disposed more than once in method 'NetDeflateProvider.Deflate(string)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 21 - - - - - - - Object 'compressedStream' can be disposed more than once in method 'NetDeflateProvider.Inflate(byte[])'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 31 - - - - - - - - - - - Object 'compressedStream' can be disposed more than once in method 'NetGZipProvider.GUnzip(byte[])'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 30 - - - - - - - Object 'ms' can be disposed more than once in method 'NetGZipProvider.GZip(string)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 20 - Object 'zipStream' can be disposed more than once in method 'NetGZipProvider.GZip(string)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 20 - - - - - - - - - - - - - Add [Serializable] to 'ValidationError' as this type implements ISerializable. - - - - - - - - - - - - - Disposable fields should be disposed - If a type that implements IDisposable owns fields that also implement IDisposable, the encapsulating type's Dispose() implementation should call Dispose() on each disposable field. - {0} contains field {1} that is of IDisposable type: {2}. Change the Dispose method on {0} to call Dispose or Close on this field. - - http://msdn.microsoft.com/library/ms182328(VS.100).aspx - [none] - Warning - - - - Do not dispose objects multiple times - A correctly implemented Dispose method can be called multiple times without throwing an exception. However, this is not guaranteed and to avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object. - Object {0} can be disposed more than once in method {1}. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 30 - RuleOwner - http://msdn.microsoft.com/library/ms182334(VS.100).aspx - - Warning - - - - Do not call overridable methods in constructors - Virtual methods defined on the class should not be called from constructors. If a derived class has overridden the method, the derived class version will be called (before the derived class constructor is called). - {0} contains a call chain that results in a call to a virtual method defined by the class. Review the following call stack for unintended consequences: {1} - - http://msdn.microsoft.com/library/ms182331(VS.100).aspx - [none] - CriticalWarning - - - - Implement IDisposable correctly - All IDisposable types should implement the Dispose pattern correctly. - Modify {0} so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. - Provide an overridable implementation of Dispose(bool) on {0} or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. - - http://msdn.microsoft.com/library/ms244737(VS.100).aspx - [none] - Error - - - - Implement ISerializable correctly - If a type is assignable to ISerializable, it should implement GetObjectData. For unsealed types, the GetObjectData method should be callable and overridable by derived types. - Add an implementation of GetObjectData to type {0}. - - http://msdn.microsoft.com/library/ms182342(VS.100).aspx - [none] - Error - - - - Mark ISerializable types with SerializableAttribute - The System.Runtime.Serialization.ISerializable interface allows the type to customize its serialization, while the Serializable attribute enables the runtime to recognize the type as being serializable. - Add [Serializable] to {0} as this type implements ISerializable. - - http://msdn.microsoft.com/library/ms182350(VS.100).aspx - [none] - Warning - - - - Rethrow to preserve stack details - Use the IL rethrow instruction to preserve original stack details when re-raising a caught exception. - {0} rethrows a caught exception and specifies it explicitly as an argument. Use 'throw' without an argument instead, in order to preserve the stack location where the exception was initially raised. - - http://msdn.microsoft.com/library/ms182363(VS.100).aspx - [none] - Error - - - - - Category - Certainty - Collapse All - Check Id - Error - error(s) - Expand All - Help - Line - message(s) - [Location not stored in Pdb] - Project - Resolution - Rule - Rule File - Rule Description - Source - Status - Target - Warning - warning(s) - Code Analysis Report - - diff --git a/lib/ServiceStack.Client.xml b/lib/ServiceStack.Client.xml deleted file mode 100644 index 10ce7eee9e6..00000000000 --- a/lib/ServiceStack.Client.xml +++ /dev/null @@ -1,374 +0,0 @@ - - - - ServiceStack.Client - - - - Need to provide async request options - http://msdn.microsoft.com/en-us/library/86wf6409(VS.71).aspx - - - - The request filter is called before any request. - This request filter is executed globally. - - - - - The response action is called once the server response is available. - It will allow you to access raw response information. - This response action is executed globally. - Note that you should NOT consume the response stream as this is handled by ServiceStack - - - - - Called before request resend, when the initial request required authentication - - - - - The request filter is called before any request. - This request filter only works with the instance where it was set (not global). - - - - - The response action is called once the server response is available. - It will allow you to access raw response information. - Note that you should NOT consume the response stream as this is handled by ServiceStack - - - - - Returns the next message from queueName or null if no message - - - - - - - Generic Proxy for service calls. - - The service Contract - - - - Returns the transparent proxy for the service call - - - - Need to provide async request options - http://msdn.microsoft.com/en-us/library/86wf6409(VS.71).aspx - - - - The request filter is called before any request. - This request filter is executed globally. - - - - - The response action is called once the server response is available. - It will allow you to access raw response information. - This response action is executed globally. - Note that you should NOT consume the response stream as this is handled by ServiceStack - - - - - Sets all baseUri properties, using the Format property for the SyncReplyBaseUri and AsyncOneWayBaseUri - - Base URI of the service - - - - Whether to Accept Gzip,Deflate Content-Encoding and to auto decompress responses - - - - - The user name for basic authentication - - - - - The password for basic authentication - - - - - Sets the username and the password for basic authentication. - - - - - Determines if the basic auth header should be sent with every request. - By default, the basic auth header is only sent when "401 Unauthorized" is returned. - - - - - Specifies if cookies should be stored - - - - - Called by Send method if an exception occurs, for instance a System.Net.WebException because the server - returned an HTTP error code. Override if you want to handle specific exceptions or always want to parse the - response to a custom ErrorResponse DTO type instead of ServiceStack's ErrorResponse class. In case ex is a - System.Net.WebException, do not use - createWebRequest/getResponse/HandleResponse<TResponse> to parse the response - because that will result in the same exception again. Use - ThrowWebServiceException<YourErrorResponseType> to parse the response and to throw a - WebServiceException containing the parsed DTO. Then override Send to handle that exception. - - - - - Gets the collection of headers to be added to outgoing requests. - - - - - Whether to execute async callbacks on the same Synchronization Context it was called from. - - - - - Gets or sets authentication information for the request. - Warning: It's recommened to use and for basic auth. - This property is only used for IIS level authentication. - - - - - Called before request resend, when the initial request required authentication - - - - - The request filter is called before any request. - This request filter only works with the instance where it was set (not global). - - - - - The response action is called once the server response is available. - It will allow you to access raw response information. - Note that you should NOT consume the response stream as this is handled by ServiceStack - - - - - Creates the error response from the values provided. - - If the errorCode is empty it will use the first validation error code, - if there is none it will throw an error. - - The error code. - The error message. - The validation errors. - - - - - Default MaxStringContentLength is 8k, and throws an exception when reached - - - - - Serializer cache of delegates required to create a type from a string map (e.g. for REST urls) - - - - - Gets the namespace from an attribute marked on the type's definition - - - Namespace of type - - - - Specifies if cookies should be stored - - - - - Compresses the specified text using the default compression method: Deflate - - The text. - Type of the compression. - - - - - Decompresses the specified gz buffer using the default compression method: Inflate - - The gz buffer. - Type of the compression. - - - - - Donated by Ivan Korneliuk from his post: - http://korneliuk.blogspot.com/2012/08/servicestack-reusing-dtos.html - - Modified to only allow using routes matching the supplied HTTP Verb - - - - - Generate a url from a Request DTO. Pretty URL generation require Routes to be defined using `[Route]` on the Request DTO - - - - - The exception which is thrown when a validation error occurred. - This validation is serialized in a extra clean and human-readable way by ServiceStack. - - - - - Used if we need to serialize this exception to XML - - - - - - Returns the first error code - - The error code. - - - - Encapsulates a validation result. - - - - - Constructs a new ValidationResult - - - - - Constructs a new ValidationResult - - A list of validation results - - - - Initializes a new instance of the class. - - The errors. - The success code. - The error code. - - - - Merge errors from another - - - - - - Gets or sets the success code. - - The success code. - - - - Gets or sets the error code. - - The error code. - - - - Gets or sets the success message. - - The success message. - - - - Gets or sets the error message. - - The error message. - - - - The errors generated by the validation. - - - - - Returns True if the validation was successful (errors list is empty). - - - - - Adds the singleton instance of to an endpoint on the client. - - - Based on http://megakemp.wordpress.com/2009/02/06/managing-shared-cookies-in-wcf/ - - - - - Adds the singleton of the class to the client endpoint's message inspectors. - - The endpoint that is to be customized. - The client runtime to be customized. - - - - Maintains a copy of the cookies contained in the incoming HTTP response received from any service - and appends it to all outgoing HTTP requests. - - - This class effectively allows to send any received HTTP cookies to different services, - reproducing the same functionality available in ASMX Web Services proxies with the class. - Based on http://megakemp.wordpress.com/2009/02/06/managing-shared-cookies-in-wcf/ - - - - - Initializes a new instance of the class. - - - - - Inspects a message after a reply message is received but prior to passing it back to the client application. - - The message to be transformed into types and handed back to the client application. - Correlation state data. - - - - Inspects a message before a request message is sent to a service. - - The message to be sent to the service. - The client object channel. - - Null since no message correlation is used. - - - - - Gets the singleton instance. - - - - - Naming convention for the request's Response DTO - - - - - Shortcut to get the ResponseStatus whether it's bare or inside a IHttpResult - - - - - - diff --git a/lib/ServiceStack.Common.dll b/lib/ServiceStack.Common.dll deleted file mode 100755 index b71670754f7..00000000000 Binary files a/lib/ServiceStack.Common.dll and /dev/null differ diff --git a/lib/ServiceStack.Common.dll.CodeAnalysisLog.xml b/lib/ServiceStack.Common.dll.CodeAnalysisLog.xml deleted file mode 100644 index ad91043c52e..00000000000 --- a/lib/ServiceStack.Common.dll.CodeAnalysisLog.xml +++ /dev/null @@ -1,2769 +0,0 @@ - - - - - - - - Consider merging the types defined in 'ServiceStack.Data' with another namespace. - - - - - - - Consider merging the types defined in 'ServiceStack.Logging' with another namespace. - - - - - - - Consider merging the types defined in 'ServiceStack.Reflection' with another namespace. - - - - - - - - - - - Sign 'ServiceStack.Common.dll' with a strong name key. - - - Mark 'ServiceStack.Common.dll' with CLSCompliant(true) because it exposes externally visible types. - - - - - - - - - 'DictionaryExtensions' should be declared inside a namespace. - - - - - - - Change 'List<T>' in 'DictionaryExtensions.ConvertAll<T, K, V>(IDictionary<K, V>, Func<K, V, T>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In member 'DictionaryExtensions.ConvertAll<T, K, V>(IDictionary<K, V>, Func<K, V, T>)', correct the casing of 'Fn' in parameter name 'createFn' by changing it to 'FN'. - - - In method 'DictionaryExtensions.ConvertAll<T, K, V>(IDictionary<K, V>, Func<K, V, T>)', correct the spelling of 'Fn' in parameter name 'createFn' or remove it entirely if it represents any sort of Hungarian notation. - - - On method 'DictionaryExtensions.ConvertAll<T, K, V>(IDictionary<K, V>, Func<K, V, T>)', consider providing a more meaningful name than generic type parameter name 'K'. - - - On method 'DictionaryExtensions.ConvertAll<T, K, V>(IDictionary<K, V>, Func<K, V, T>)', consider providing a more meaningful name than generic type parameter name 'V'. - - - On method 'DictionaryExtensions.ConvertAll<T, K, V>(IDictionary<K, V>, Func<K, V, T>)', prefix generic type parameter name 'K' with 'T'. - On method 'DictionaryExtensions.ConvertAll<T, K, V>(IDictionary<K, V>, Func<K, V, T>)', prefix generic type parameter name 'V' with 'T'. - - - - - - - In member 'DictionaryExtensions.ForEach<TKey, TValue>(this Dictionary<TKey, TValue>, Action<TKey, TValue>)', correct the casing of 'Fn' in parameter name 'onEachFn' by changing it to 'FN'. - - - In method 'DictionaryExtensions.ForEach<TKey, TValue>(this Dictionary<TKey, TValue>, Action<TKey, TValue>)', correct the spelling of 'Fn' in parameter name 'onEachFn' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'DictionaryExtensions.ForEach<TKey, TValue>(this Dictionary<TKey, TValue>, Action<TKey, TValue>)', validate parameter 'dictionary' before using it. - - - In externally visible method 'DictionaryExtensions.ForEach<TKey, TValue>(this Dictionary<TKey, TValue>, Action<TKey, TValue>)', validate parameter 'onEachFn' before using it. - - - - - - - In member 'DictionaryExtensions.GetOrAdd<K, V>(this Dictionary<K, V>, K, Func<K, V>)', correct the casing of 'Fn' in parameter name 'createFn' by changing it to 'FN'. - - - In method 'DictionaryExtensions.GetOrAdd<K, V>(this Dictionary<K, V>, K, Func<K, V>)', correct the spelling of 'Fn' in parameter name 'createFn' or remove it entirely if it represents any sort of Hungarian notation. - - - On method 'DictionaryExtensions.GetOrAdd<K, V>(this Dictionary<K, V>, K, Func<K, V>)', consider providing a more meaningful name than generic type parameter name 'K'. - - - On method 'DictionaryExtensions.GetOrAdd<K, V>(this Dictionary<K, V>, K, Func<K, V>)', consider providing a more meaningful name than generic type parameter name 'V'. - - - On method 'DictionaryExtensions.GetOrAdd<K, V>(this Dictionary<K, V>, K, Func<K, V>)', prefix generic type parameter name 'K' with 'T'. - On method 'DictionaryExtensions.GetOrAdd<K, V>(this Dictionary<K, V>, K, Func<K, V>)', prefix generic type parameter name 'V' with 'T'. - - - In externally visible method 'DictionaryExtensions.GetOrAdd<K, V>(this Dictionary<K, V>, K, Func<K, V>)', validate parameter 'map' before using it. - - - In externally visible method 'DictionaryExtensions.GetOrAdd<K, V>(this Dictionary<K, V>, K, Func<K, V>)', validate parameter 'createFn' before using it. - - - - - - - In externally visible method 'DictionaryExtensions.GetValueOrDefault<TValue, TKey>(this Dictionary<TKey, TValue>, TKey)', validate parameter 'dictionary' before using it. - - - - - - - On method 'DictionaryExtensions.UnorderedEquivalentTo<K, V>(this IDictionary<K, V>, IDictionary<K, V>)', consider providing a more meaningful name than generic type parameter name 'K'. - - - On method 'DictionaryExtensions.UnorderedEquivalentTo<K, V>(this IDictionary<K, V>, IDictionary<K, V>)', consider providing a more meaningful name than generic type parameter name 'V'. - - - On method 'DictionaryExtensions.UnorderedEquivalentTo<K, V>(this IDictionary<K, V>, IDictionary<K, V>)', prefix generic type parameter name 'K' with 'T'. - On method 'DictionaryExtensions.UnorderedEquivalentTo<K, V>(this IDictionary<K, V>, IDictionary<K, V>)', prefix generic type parameter name 'V' with 'T'. - - - - - - - - - - - - - - - In externally visible method 'ActionExecExtensions.ExecAllAndWait(this ICollection<Action>, TimeSpan)', validate parameter 'actions' before using it. - - - - - - - Change 'List<WaitHandle>' in 'ActionExecExtensions.ExecAsync(this IEnumerable<Action>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In externally visible method 'ActionExecExtensions.ExecAsync(this IEnumerable<Action>)', validate parameter 'actions' before using it. - - - - - - - In member 'ActionExecExtensions.WaitAll(this ICollection<WaitHandle>, int)', correct the casing of 'Ms' in parameter name 'timeoutMs' by changing it to 'MS'. - - - In method 'ActionExecExtensions.WaitAll(this ICollection<WaitHandle>, int)', correct the spelling of 'Ms' in parameter name 'timeoutMs' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Change 'List<IAsyncResult>' in 'ActionExecExtensions.WaitAll(this List<IAsyncResult>, TimeSpan)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In externally visible method 'ActionExecExtensions.WaitAll(this List<IAsyncResult>, TimeSpan)', validate parameter 'asyncResults' before using it. - - - - - - - Change 'List<WaitHandle>' in 'ActionExecExtensions.WaitAll(this List<WaitHandle>, int)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In member 'ActionExecExtensions.WaitAll(this List<WaitHandle>, int)', correct the casing of 'Ms' in parameter name 'timeoutMs' by changing it to 'MS'. - - - In method 'ActionExecExtensions.WaitAll(this List<WaitHandle>, int)', correct the spelling of 'Ms' in parameter name 'timeoutMs' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'ActionExecExtensions.WaitAll(this List<WaitHandle>, int)', validate parameter 'waitHandles' before using it. - - - - - - - In member 'ActionExecExtensions.WaitAll(WaitHandle[], int)', the compound word 'timeOut' in parameter name 'timeOutMs' exists as a discrete term. If your usage is intended to be single word, case it as 'timeout' or strip the first token entirely if it represents any sort of Hungarian notation. - - - In member 'ActionExecExtensions.WaitAll(WaitHandle[], int)', correct the casing of 'Ms' in parameter name 'timeOutMs' by changing it to 'MS'. - - - In method 'ActionExecExtensions.WaitAll(WaitHandle[], int)', correct the spelling of 'Ms' in parameter name 'timeOutMs' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - - - - - In member 'AssertExtensions.ThrowIfNull(this object)', consider replacing the data type identifier 'obj' in parameter name 'obj' with a more generic term, such as 'value'. - - - - - - - In member 'AssertExtensions.ThrowIfNull(this object, string)', consider replacing the data type identifier 'obj' in parameter name 'obj' with a more generic term, such as 'value'. - - - - - - - In method 'AssertExtensions.ThrowIfNullOrEmpty(this string)', correct the spelling of 'str' in parameter name 'strValue' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - In method 'AssertExtensions.ThrowIfNullOrEmpty(this string, string)', correct the spelling of 'str' in parameter name 'strValue' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - In method 'AssertExtensions.ThrowOnFirstNull(params object[])', correct the spelling of 'objs' in parameter name 'objs' or remove it entirely if it represents any sort of Hungarian notation. - - - In member 'AssertExtensions.ThrowOnFirstNull(params object[])', consider replacing the data type identifier 'objs' in parameter name 'objs' with a more generic term, such as 'value'. - - - In externally visible method 'AssertExtensions.ThrowOnFirstNull(params object[])', validate parameter 'objs' before using it. - - - - - - - - - Correct the spelling of 'Utils' in type name 'AssertUtils'. - - - - - - - In externally visible method 'AssertUtils.AreNotNull(IDictionary<string, object>)', validate parameter 'fieldMap' before using it. - - - - - - - - - - - In method 'ByteArrayExtensions.AreEqual(this byte[], byte[])', correct the spelling of 'b' in parameter name 'b1' or remove it entirely if it represents any sort of Hungarian notation. - In method 'ByteArrayExtensions.AreEqual(this byte[], byte[])', correct the spelling of 'b' in parameter name 'b2' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - - - Correct the spelling of 'Utils' in type name 'CommandsUtils'. - - - Because type 'CommandsUtils' contains only 'static' members, mark it as 'static' to prevent the compiler from adding a default public constructor. - - - - - - - Change 'List<WaitHandle>' in 'CommandsUtils.ExecuteAsyncCommandExec(IEnumerable<ICommandExec>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In externally visible method 'CommandsUtils.ExecuteAsyncCommandExec(IEnumerable<ICommandExec>)', validate parameter 'commands' before using it. - - - - - - - Parameter 'timeout' of 'CommandsUtils.ExecuteAsyncCommandExec(TimeSpan, IEnumerable<ICommandExec>)' is never used. Remove the parameter or use it in the method body. - - - In externally visible method 'CommandsUtils.ExecuteAsyncCommandExec(TimeSpan, IEnumerable<ICommandExec>)', validate parameter 'commands' before using it. - - - - - - - Change 'List<T>' in 'CommandsUtils.ExecuteAsyncCommandList<T>(TimeSpan, params ICommandList<T>[])' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'List<T>' in 'CommandsUtils.ExecuteAsyncCommandList<T>(TimeSpan, IEnumerable<ICommandList<T>>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - Consider a design where 'CommandsUtils.ExecuteAsyncCommandList<T>(TimeSpan, IEnumerable<ICommandList<T>>)' doesn't nest generic type 'IEnumerable<ICommandList<T>>'. - - - In externally visible method 'CommandsUtils.ExecuteAsyncCommandList<T>(TimeSpan, IEnumerable<ICommandList<T>>)', validate parameter 'commands' before using it. - - - - - - - - - Correct the spelling of 'Utils' in type name 'CryptUtils'. - - - - - - - In method 'CryptUtils.CreatePublicAndPrivateKeyPair()', call System.IDisposable.Dispose on object 'rsaProvider' before all references to it are out of scope. - - - - - - - Replace method 'CryptUtils.CreatePublicAndPrivateKeyPair(RsaKeyLengths)' with an overload that supplies all default arguments. - - - In method 'CryptUtils.CreatePublicAndPrivateKeyPair(RsaKeyLengths)', call System.IDisposable.Dispose on object 'rsaProvider' before all references to it are out of scope. - - - - - - - Method 'CryptUtils.Decrypt(this string)' passes 'No KeyPair given for encryption in CryptUtils' as the 'paramName' argument to a 'ArgumentNullException' constructor. Replace this argument with one of the method's parameter names. Note that the provided parameter name should have the exact casing as declared on the method. - - - - - - - Replace method 'CryptUtils.Decrypt(string, string, RsaKeyLengths)' with an overload that supplies all default arguments. - - - In method 'CryptUtils.Decrypt(string, string, RsaKeyLengths)', call System.IDisposable.Dispose on object 'rsaCryptoServiceProvider' before all references to it are out of scope. - - - In externally visible method 'CryptUtils.Decrypt(string, string, RsaKeyLengths)', validate parameter 'data' before using it. - - - - - - - Method 'CryptUtils.Encrypt(this string)' passes 'No KeyPair given for encryption in CryptUtils' as the 'paramName' argument to a 'ArgumentNullException' constructor. Replace this argument with one of the method's parameter names. Note that the provided parameter name should have the exact casing as declared on the method. - - - - - - - Replace method 'CryptUtils.Encrypt(string, string, RsaKeyLengths)' with an overload that supplies all default arguments. - - - In method 'CryptUtils.Encrypt(string, string, RsaKeyLengths)', call System.IDisposable.Dispose on object 'SHA1.Create()' before all references to it are out of scope. - In method 'CryptUtils.Encrypt(string, string, RsaKeyLengths)', call System.IDisposable.Dispose on object 'rsaCryptoServiceProvider' before all references to it are out of scope. - - - - - - - Consider making 'CryptUtils.KeyPair' non-public or a constant. - - - - - - - Consider making 'CryptUtils.Length' non-public or a constant. - - - - - - - - - - - Consider changing the type of parameter 'rootDirPath' in 'DirectoryInfoExtensions.GetMatchingFiles(this DirectoryInfo, string)' from 'DirectoryInfo' to its base type 'FileSystemInfo'. This method appears to only require base class members in its implementation. Suppress this violation if there is a compelling reason to require the more derived type in the method signature. - - - In method 'DirectoryInfoExtensions.GetMatchingFiles(this DirectoryInfo, string)', correct the spelling of 'Dir' in parameter name 'rootDirPath' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'DirectoryInfoExtensions.GetMatchingFiles(this DirectoryInfo, string)', validate parameter 'rootDirPath' before using it. - - - - - - - In method 'DirectoryInfoExtensions.GetMatchingFiles(string, string)', correct the spelling of 'Dir' in parameter name 'rootDirPath' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - - - - - Modify 'DisposableExtensions.Dispose(this IEnumerable<IDisposable>, ILog)' to catch a more specific exception than 'Exception' or rethrow the exception. - - - Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'DisposableExtensions.Dispose(this IEnumerable<IDisposable>, ILog)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - In externally visible method 'DisposableExtensions.Dispose(this IEnumerable<IDisposable>, ILog)', validate parameter 'resources' before using it. - - - - - - - In externally visible method 'DisposableExtensions.Run<T>(this T, Action<T>)', validate parameter 'runActionThenDispose' before using it. - - - - - - - - - - - In externally visible method 'EnumerableExtensions.Each<T>(this IEnumerable<T>, Action<T>)', validate parameter 'action' before using it. - - - - - - - In externally visible method 'EnumerableExtensions.Each<T>(this IEnumerable<T>, Action<int, T>)', validate parameter 'action' before using it. - - - - - - - In externally visible method 'EnumerableExtensions.FirstNonDefault<T>(this IEnumerable<T>)', validate parameter 'values' before using it. - - - - - - - In externally visible method 'EnumerableExtensions.FirstNonDefaultOrEmpty(this IEnumerable<string>)', validate parameter 'values' before using it. - - - - - - - Change 'List<To>' in 'EnumerableExtensions.Map<To>(this IEnumerable, Func<object, To>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - On method 'EnumerableExtensions.Map<To>(this IEnumerable, Func<object, To>)', prefix generic type parameter name 'To' with 'T'. - - - In externally visible method 'EnumerableExtensions.Map<To>(this IEnumerable, Func<object, To>)', validate parameter 'converter' before using it. - - - - - - - Change 'List<To>' in 'EnumerableExtensions.Map<To, From>(this IEnumerable<From>, Func<From, To>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - On method 'EnumerableExtensions.Map<To, From>(this IEnumerable<From>, Func<From, To>)', prefix generic type parameter name 'From' with 'T'. - On method 'EnumerableExtensions.Map<To, From>(this IEnumerable<From>, Func<From, To>)', prefix generic type parameter name 'To' with 'T'. - - - In externally visible method 'EnumerableExtensions.Map<To, From>(this IEnumerable<From>, Func<From, To>)', validate parameter 'converter' before using it. - - - - - - - Consider a design where 'EnumerableExtensions.ToDictionary<T, TKey, TValue>(this IEnumerable<T>, Func<T, KeyValuePair<TKey, TValue>>)' doesn't nest generic type 'Func<T, KeyValuePair<TKey, TValue>>'. - - - In externally visible method 'EnumerableExtensions.ToDictionary<T, TKey, TValue>(this IEnumerable<T>, Func<T, KeyValuePair<TKey, TValue>>)', validate parameter 'list' before using it. - - - In externally visible method 'EnumerableExtensions.ToDictionary<T, TKey, TValue>(this IEnumerable<T>, Func<T, KeyValuePair<TKey, TValue>>)', validate parameter 'map' before using it. - - - - - - - Change 'List<object>' in 'EnumerableExtensions.ToObjects<T>(this IEnumerable<T>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In externally visible method 'EnumerableExtensions.ToObjects<T>(this IEnumerable<T>)', validate parameter 'items' before using it. - - - - - - - In method 'EnumerableExtensions.ToSafeDictionary<T, TKey>(this IEnumerable<T>, Func<T, TKey>)', correct the spelling of 'expr' in parameter name 'expr' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'EnumerableExtensions.ToSafeDictionary<T, TKey>(this IEnumerable<T>, Func<T, TKey>)', validate parameter 'expr' before using it. - - - - - - - - - - - Method 'EnumExtensions.Add<T>(this Enum, T)' passes a literal string as parameter 'text' of a call to 'StringExtensions.Fmt(this string, params object[])'. Retrieve the following string(s) from a resource table instead: "Enums of type {0}". - - - In externally visible method 'EnumExtensions.Add<T>(this Enum, T)', validate parameter 'enum' before using it. - - - - - - - In externally visible method 'EnumExtensions.GetTypeCode(this Enum)', validate parameter 'enum' before using it. - - - - - - - Method 'EnumExtensions.Has<T>(this Enum, T)' passes a literal string as parameter 'text' of a call to 'StringExtensions.Fmt(this string, params object[])'. Retrieve the following string(s) from a resource table instead: "Enums of type {0}". - - - In externally visible method 'EnumExtensions.Has<T>(this Enum, T)', validate parameter 'enum' before using it. - - - - - - - Method 'EnumExtensions.Is<T>(this Enum, T)' passes a literal string as parameter 'text' of a call to 'StringExtensions.Fmt(this string, params object[])'. Retrieve the following string(s) from a resource table instead: "Enums of type {0}". - - - In externally visible method 'EnumExtensions.Is<T>(this Enum, T)', validate parameter 'enum' before using it. - - - - - - - Method 'EnumExtensions.Remove<T>(this Enum, T)' passes a literal string as parameter 'text' of a call to 'StringExtensions.Fmt(this string, params object[])'. Retrieve the following string(s) from a resource table instead: "Enums of type {0}". - - - In externally visible method 'EnumExtensions.Remove<T>(this Enum, T)', validate parameter 'enum' before using it. - - - - - - - In externally visible method 'EnumExtensions.ToDescription(this Enum)', validate parameter 'enum' before using it. - - - - - - - Change 'List<string>' in 'EnumExtensions.ToList(this Enum)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In externally visible method 'EnumExtensions.ToList(this Enum)', validate parameter 'enum' before using it. - - - - - - - - - - - Modify 'ExecExtensions.ExecAll<T>(this IEnumerable<T>, Action<T>)' to catch a more specific exception than 'Exception' or rethrow the exception. - - - In externally visible method 'ExecExtensions.ExecAll<T>(this IEnumerable<T>, Action<T>)', validate parameter 'instances' before using it. - - - In externally visible method 'ExecExtensions.ExecAll<T>(this IEnumerable<T>, Action<T>)', validate parameter 'action' before using it. - - - - - - - Modify 'ExecExtensions.ExecAllWithFirstOut<T, TReturn>(this IEnumerable<T>, Func<T, TReturn>, ref TReturn)' to catch a more specific exception than 'Exception' or rethrow the exception. - - - Consider a design that does not require that 'firstResult' be a reference parameter. - - - In externally visible method 'ExecExtensions.ExecAllWithFirstOut<T, TReturn>(this IEnumerable<T>, Func<T, TReturn>, ref TReturn)', validate parameter 'instances' before using it. - - - In externally visible method 'ExecExtensions.ExecAllWithFirstOut<T, TReturn>(this IEnumerable<T>, Func<T, TReturn>, ref TReturn)', validate parameter 'action' before using it. - - - - - - - Modify 'ExecExtensions.ExecReturnFirstWithResult<T, TReturn>(this IEnumerable<T>, Func<T, TReturn>)' to catch a more specific exception than 'Exception' or rethrow the exception. - - - In externally visible method 'ExecExtensions.ExecReturnFirstWithResult<T, TReturn>(this IEnumerable<T>, Func<T, TReturn>)', validate parameter 'instances' before using it. - - - In externally visible method 'ExecExtensions.ExecReturnFirstWithResult<T, TReturn>(this IEnumerable<T>, Func<T, TReturn>)', validate parameter 'action' before using it. - - - - - - - Because the behavior of 'string.Format(string, object, object, object)' could vary based on the current user's locale settings, replace this call in 'ExecExtensions.LogError(Type, string, Exception)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - In externally visible method 'ExecExtensions.LogError(Type, string, Exception)', validate parameter 'declaringType' before using it. - - - In externally visible method 'ExecExtensions.LogError(Type, string, Exception)', validate parameter 'ex' before using it. - - - - - - - In externally visible method 'ExecExtensions.RetryOnException(Action, int)', validate parameter 'action' before using it. - - - - - - - In member 'ExecExtensions.RetryOnException(Action, TimeSpan?)', the compound word 'timeOut' in parameter name 'timeOut' exists as a discrete term. If your usage is intended to be single word, case it as 'timeout' or strip the first token entirely if it represents any sort of Hungarian notation. - - - Modify 'ExecExtensions.RetryOnException(Action, TimeSpan?)' to catch a more specific exception than 'Exception' or rethrow the exception. - - - Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'ExecExtensions.RetryOnException(Action, TimeSpan?)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - In externally visible method 'ExecExtensions.RetryOnException(Action, TimeSpan?)', validate parameter 'action' before using it. - - - - - - - In member 'ExecExtensions.RetryUntilTrue(Func<bool>, TimeSpan?)', the compound word 'timeOut' in parameter name 'timeOut' exists as a discrete term. If your usage is intended to be single word, case it as 'timeout' or strip the first token entirely if it represents any sort of Hungarian notation. - - - Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'ExecExtensions.RetryUntilTrue(Func<bool>, TimeSpan?)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - In externally visible method 'ExecExtensions.RetryUntilTrue(Func<bool>, TimeSpan?)', validate parameter 'action' before using it. - - - - - - - - - Correct the spelling of 'Utils' in type name 'FuncUtils'. - - - - - - - Modify 'FuncUtils.TryExec(Action)' to catch a more specific exception than 'Exception' or rethrow the exception. - - - In externally visible method 'FuncUtils.TryExec(Action)', validate parameter 'action' before using it. - - - - - - - Modify 'FuncUtils.TryExec<T>(Func<T>, T)' to catch a more specific exception than 'Exception' or rethrow the exception. - - - Parameter 'defaultValue' of 'FuncUtils.TryExec<T>(Func<T>, T)' is never used. Remove the parameter or use it in the method body. - - - In externally visible method 'FuncUtils.TryExec<T>(Func<T>, T)', validate parameter 'func' before using it. - - - - - - - Replace method 'FuncUtils.WaitWhile(Func<bool>, int, int)' with an overload that supplies all default arguments. - - - In method 'FuncUtils.WaitWhile(Func<bool>, int, int)', correct the spelling of 'millsecond' in parameter name 'millsecondPollPeriod' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'FuncUtils.WaitWhile(Func<bool>, int, int)', validate parameter 'condition' before using it. - - - - - - - - - - - Initialize all static fields in 'HasId<TEntity>' when those fields are declared and remove the explicit static constructor. - - - - - - - - - - - Initialize all static fields in 'HasPropertyId<TEntity>' when those fields are declared and remove the explicit static constructor. - - - - - - - - - Correct the spelling of 'Utils' in type name 'IdUtils'. - - - - - - - Consider a design where 'IdUtils.CreateCacheKeyPath<T>(string)' doesn't require explicit type parameter 'T' in any call to it. - - - Because the behavior of 'string.Format(string, params object[])' could vary based on the current user's locale settings, replace this call in 'IdUtils.CreateCacheKeyPath<T>(string)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - In externally visible method 'IdUtils.CreateCacheKeyPath<T>(string)', validate parameter 'idValue' before using it. - - - - - - - Consider changing the type of parameter 'type' in 'IdUtils.CreateUrn(Type, object)' from 'Type' to its base type 'MemberInfo'. This method appears to only require base class members in its implementation. Suppress this violation if there is a compelling reason to require the more derived type in the method signature. - - - In method 'IdUtils.CreateUrn(Type, object)', replace the call to 'string.ToLowerInvariant()' with String.ToUpperInvariant(). - - - Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'IdUtils.CreateUrn(Type, object)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - Change the return type of 'IdUtils.CreateUrn(Type, object)' from string to System.Uri. - - - In externally visible method 'IdUtils.CreateUrn(Type, object)', validate parameter 'type' before using it. - - - - - - - In method 'IdUtils.CreateUrn<T>(this T)', replace the call to 'string.ToLowerInvariant()' with String.ToUpperInvariant(). - - - Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'IdUtils.CreateUrn<T>(this T)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - Change the return type of 'IdUtils.CreateUrn<T>(this T)' from string to System.Uri. - - - - - - - Consider a design where 'IdUtils.CreateUrn<T>(object)' doesn't require explicit type parameter 'T' in any call to it. - - - In method 'IdUtils.CreateUrn<T>(object)', replace the call to 'string.ToLowerInvariant()' with String.ToUpperInvariant(). - - - Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'IdUtils.CreateUrn<T>(object)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - Change the return type of 'IdUtils.CreateUrn<T>(object)' from string to System.Uri. - - - - - - - In externally visible method 'IdUtils.GetObjectId(this object)', validate parameter 'entity' before using it. - - - - - - - Consider a design where 'IdUtils.ToSafePathCacheKey<T>(this string)' doesn't require explicit type parameter 'T' in any call to it. - - - - - - - Change the return type of 'IdUtils.ToUrn<T>(this T)' from string to System.Uri. - - - - - - - Consider a design where 'IdUtils.ToUrn<T>(this object)' doesn't require explicit type parameter 'T' in any call to it. - - - Change the return type of 'IdUtils.ToUrn<T>(this object)' from string to System.Uri. - - - - - - - - - Correct the spelling of 'Utils' in type name 'IdUtils<T>'. - - - - - - - Initialize all static fields in 'IdUtils<T>' when those fields are declared and remove the explicit static constructor. - - - - - - - Remove 'IdUtils<T>.GetId(T)' from 'IdUtils<T>' or make it an instance member. - - - - - - - - - - - Change either member or parameter name 'times' so that one differs from the other. - - - - - - - In member 'IntExtensions.Times(this int, Action)', correct the casing of 'Fn' in parameter name 'actionFn' by changing it to 'FN'. - - - In method 'IntExtensions.Times(this int, Action)', correct the spelling of 'Fn' in parameter name 'actionFn' or remove it entirely if it represents any sort of Hungarian notation. - - - Change either member or parameter name 'times' so that one differs from the other. - - - In externally visible method 'IntExtensions.Times(this int, Action)', validate parameter 'actionFn' before using it. - - - - - - - In member 'IntExtensions.Times(this int, Action<int>)', correct the casing of 'Fn' in parameter name 'actionFn' by changing it to 'FN'. - - - In method 'IntExtensions.Times(this int, Action<int>)', correct the spelling of 'Fn' in parameter name 'actionFn' or remove it entirely if it represents any sort of Hungarian notation. - - - Change either member or parameter name 'times' so that one differs from the other. - - - In externally visible method 'IntExtensions.Times(this int, Action<int>)', validate parameter 'actionFn' before using it. - - - - - - - Change 'List<T>' in 'IntExtensions.Times<T>(this int, Func<T>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In member 'IntExtensions.Times<T>(this int, Func<T>)', correct the casing of 'Fn' in parameter name 'actionFn' by changing it to 'FN'. - - - In method 'IntExtensions.Times<T>(this int, Func<T>)', correct the spelling of 'Fn' in parameter name 'actionFn' or remove it entirely if it represents any sort of Hungarian notation. - - - Change either member or parameter name 'times' so that one differs from the other. - - - In externally visible method 'IntExtensions.Times<T>(this int, Func<T>)', validate parameter 'actionFn' before using it. - - - - - - - Change 'List<T>' in 'IntExtensions.Times<T>(this int, Func<int, T>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In member 'IntExtensions.Times<T>(this int, Func<int, T>)', correct the casing of 'Fn' in parameter name 'actionFn' by changing it to 'FN'. - - - In method 'IntExtensions.Times<T>(this int, Func<int, T>)', correct the spelling of 'Fn' in parameter name 'actionFn' or remove it entirely if it represents any sort of Hungarian notation. - - - Change either member or parameter name 'times' so that one differs from the other. - - - In externally visible method 'IntExtensions.Times<T>(this int, Func<int, T>)', validate parameter 'actionFn' before using it. - - - - - - - Change 'List<IAsyncResult>' in 'IntExtensions.TimesAsync(this int, Action)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In member 'IntExtensions.TimesAsync(this int, Action)', correct the casing of 'Fn' in parameter name 'actionFn' by changing it to 'FN'. - - - In method 'IntExtensions.TimesAsync(this int, Action)', correct the spelling of 'Fn' in parameter name 'actionFn' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'IntExtensions.TimesAsync(this int, Action)', validate parameter 'actionFn' before using it. - - - - - - - Change 'List<IAsyncResult>' in 'IntExtensions.TimesAsync(this int, Action<int>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In member 'IntExtensions.TimesAsync(this int, Action<int>)', correct the casing of 'Fn' in parameter name 'actionFn' by changing it to 'FN'. - - - In method 'IntExtensions.TimesAsync(this int, Action<int>)', correct the spelling of 'Fn' in parameter name 'actionFn' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'IntExtensions.TimesAsync(this int, Action<int>)', validate parameter 'actionFn' before using it. - - - - - - - - - - - Modify 'IPAddressExtensions.GetAllNetworkInterfaceIpv4Addresses()' to catch a more specific exception than 'object' or rethrow the exception. - - - Change 'IPAddressExtensions.GetAllNetworkInterfaceIpv4Addresses()' to a property if appropriate. - - - - - - - Modify 'IPAddressExtensions.GetAllNetworkInterfaceIpv6Addresses()' to catch a more specific exception than 'object' or rethrow the exception. - - - Change 'List<IPAddress>' in 'IPAddressExtensions.GetAllNetworkInterfaceIpv6Addresses()' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - Change 'IPAddressExtensions.GetAllNetworkInterfaceIpv6Addresses()' to a property if appropriate. - - - - - - - In externally visible method 'IPAddressExtensions.GetBroadcastAddress(this IPAddress, IPAddress)', validate parameter 'address' before using it. - - - In externally visible method 'IPAddressExtensions.GetBroadcastAddress(this IPAddress, IPAddress)', validate parameter 'subnetMask' before using it. - - - - - - - In externally visible method 'IPAddressExtensions.GetNetworkAddress(this IPAddress, IPAddress)', validate parameter 'address' before using it. - - - In externally visible method 'IPAddressExtensions.GetNetworkAddress(this IPAddress, IPAddress)', validate parameter 'subnetMask' before using it. - - - - - - - In method 'IPAddressExtensions.GetNetworkAddressBytes(byte[], byte[])', correct the spelling of 'Adress' in parameter name 'ipAdressBytes' or remove it entirely if it represents any sort of Hungarian notation. - - - In method 'IPAddressExtensions.GetNetworkAddressBytes(byte[], byte[])', correct the spelling of 'ip' in parameter name 'ipAdressBytes' or remove it entirely if it represents any sort of Hungarian notation. - - - In member 'IPAddressExtensions.GetNetworkAddressBytes(byte[], byte[])', consider replacing the data type identifier 'Bytes' in parameter name 'ipAdressBytes' with a more generic term, such as 'value'. - In member 'IPAddressExtensions.GetNetworkAddressBytes(byte[], byte[])', consider replacing the data type identifier 'Bytes' in parameter name 'subnetMaskBytes' with a more generic term, such as 'value'. - - - In externally visible method 'IPAddressExtensions.GetNetworkAddressBytes(byte[], byte[])', validate parameter 'ipAdressBytes' before using it. - - - In externally visible method 'IPAddressExtensions.GetNetworkAddressBytes(byte[], byte[])', validate parameter 'subnetMaskBytes' before using it. - - - - - - - In member 'IPAddressExtensions.IsInSameIpv4Subnet(this byte[], byte[], byte[])', consider replacing the data type identifier 'Bytes' in parameter name 'address1Bytes' with a more generic term, such as 'value'. - In member 'IPAddressExtensions.IsInSameIpv4Subnet(this byte[], byte[], byte[])', consider replacing the data type identifier 'Bytes' in parameter name 'address2Bytes' with a more generic term, such as 'value'. - In member 'IPAddressExtensions.IsInSameIpv4Subnet(this byte[], byte[], byte[])', consider replacing the data type identifier 'Bytes' in parameter name 'subnetMaskBytes' with a more generic term, such as 'value'. - - - In externally visible method 'IPAddressExtensions.IsInSameIpv4Subnet(this byte[], byte[], byte[])', validate parameter 'address1Bytes' before using it. - - - In externally visible method 'IPAddressExtensions.IsInSameIpv4Subnet(this byte[], byte[], byte[])', validate parameter 'address2Bytes' before using it. - - - - - - - In externally visible method 'IPAddressExtensions.IsInSameIpv4Subnet(this IPAddress, IPAddress, IPAddress)', validate parameter 'address2' before using it. - - - In externally visible method 'IPAddressExtensions.IsInSameIpv4Subnet(this IPAddress, IPAddress, IPAddress)', validate parameter 'address' before using it. - - - - - - - In member 'IPAddressExtensions.IsInSameIpv6Subnet(this byte[], byte[])', consider replacing the data type identifier 'Bytes' in parameter name 'address1Bytes' with a more generic term, such as 'value'. - In member 'IPAddressExtensions.IsInSameIpv6Subnet(this byte[], byte[])', consider replacing the data type identifier 'Bytes' in parameter name 'address2Bytes' with a more generic term, such as 'value'. - - - In externally visible method 'IPAddressExtensions.IsInSameIpv6Subnet(this byte[], byte[])', validate parameter 'address1Bytes' before using it. - - - In externally visible method 'IPAddressExtensions.IsInSameIpv6Subnet(this byte[], byte[])', validate parameter 'address2Bytes' before using it. - - - - - - - In externally visible method 'IPAddressExtensions.IsInSameIpv6Subnet(this IPAddress, IPAddress)', validate parameter 'address2' before using it. - - - In externally visible method 'IPAddressExtensions.IsInSameIpv6Subnet(this IPAddress, IPAddress)', validate parameter 'address' before using it. - - - - - - - - - Rename type name 'MetadataAttribute' so that it does not end in 'Attribute'. - - - - - - - Change 'MetadataAttribute.Args' to be read-only by removing the property setter. - - - Change 'List<MetadataPropertyType>' in 'MetadataAttribute.Args' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataAttribute.ConstructorArgs' to be read-only by removing the property setter. - - - Change 'List<MetadataPropertyType>' in 'MetadataAttribute.ConstructorArgs' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - - - - - Change 'MetadataOperationType.Actions' to be read-only by removing the property setter. - - - Change 'List<string>' in 'MetadataOperationType.Actions' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - - - - - Change 'MetadataPropertyType.AllowableValues' to return a collection or make it a method. - - - - - - - Change 'MetadataPropertyType.Attributes' to be read-only by removing the property setter. - - - Change 'List<MetadataAttribute>' in 'MetadataPropertyType.Attributes' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataPropertyType.GenericArgs' to return a collection or make it a method. - - - - - - - Correct the spelling of 'Param' in member name 'MetadataPropertyType.ParamType' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - The property name 'MetadataPropertyType.Type' is confusing given the existence of inherited method 'object.GetType()'. Rename or remove this property. - - - - - - - - - - - Change 'MetadataType.Attributes' to be read-only by removing the property setter. - - - Change 'List<MetadataAttribute>' in 'MetadataType.Attributes' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataType.EnumNames' to be read-only by removing the property setter. - - - Change 'List<string>' in 'MetadataType.EnumNames' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataType.EnumValues' to be read-only by removing the property setter. - - - Change 'List<string>' in 'MetadataType.EnumValues' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataType.GenericArgs' to return a collection or make it a method. - - - - - - - Change 'MetadataType.GetFullName()' to a property if appropriate. - - - - - - - Change 'MetadataType.InnerTypes' to be read-only by removing the property setter. - - - Change 'List<MetadataTypeName>' in 'MetadataType.InnerTypes' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataType.Properties' to be read-only by removing the property setter. - - - Change 'List<MetadataPropertyType>' in 'MetadataType.Properties' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataType.Routes' to be read-only by removing the property setter. - - - Change 'List<MetadataRoute>' in 'MetadataType.Routes' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - - - - - Change 'MetadataTypeName.GenericArgs' to return a collection or make it a method. - - - - - - - - - - - Change 'MetadataTypes.Operations' to be read-only by removing the property setter. - - - Change 'List<MetadataOperationType>' in 'MetadataTypes.Operations' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataTypes.Types' to be read-only by removing the property setter. - - - Change 'List<MetadataType>' in 'MetadataTypes.Types' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - - - - - Replace method 'MetadataTypesConfig.MetadataTypesConfig(string, bool, bool, bool, bool, bool, bool, string, bool, bool, bool, int?)' with an overload that supplies all default arguments. - - - Change the type of parameter 'baseUrl' of method 'MetadataTypesConfig.MetadataTypesConfig(string, bool, bool, bool, bool, bool, bool, string, bool, bool, bool, int?)' from string to System.Uri, or provide an overload of 'MetadataTypesConfig.MetadataTypesConfig(string, bool, bool, bool, bool, bool, bool, string, bool, bool, bool, int?)', that allows 'baseUrl' to be passed as a System.Uri object. - - - - - - - Change the type of property 'MetadataTypesConfig.BaseUrl' from string to System.Uri. - - - - - - - Change 'MetadataTypesConfig.CSharpTypeAlias' to be read-only by removing the property setter. - - - - - - - Change 'MetadataTypesConfig.DefaultNamespaces' to be read-only by removing the property setter. - - - Change 'List<string>' in 'MetadataTypesConfig.DefaultNamespaces' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataTypesConfig.ExportAttributes' to be read-only by removing the property setter. - - - - - - - Change 'MetadataTypesConfig.FSharpTypeAlias' to be read-only by removing the property setter. - - - - - - - Change 'MetadataTypesConfig.IgnoreTypes' to be read-only by removing the property setter. - - - - - - - Change 'MetadataTypesConfig.IgnoreTypesInNamespaces' to be read-only by removing the property setter. - - - Change 'List<string>' in 'MetadataTypesConfig.IgnoreTypesInNamespaces' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'MetadataTypesConfig.VbNetKeyWords' to be read-only by removing the property setter. - - - The compound word 'KeyWords' in member name 'MetadataTypesConfig.VbNetKeyWords' exists as a discrete term. If your usage is intended to be single word, case it as 'Keywords' or strip the first token entirely if it represents any sort of Hungarian notation. - - - Correct the casing of 'Vb' in member name 'MetadataTypesConfig.VbNetKeyWords' by changing it to 'VB'. - - - Correct the spelling of 'Vb' in member name 'MetadataTypesConfig.VbNetKeyWords' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Change 'MetadataTypesConfig.VbNetTypeAlias' to be read-only by removing the property setter. - - - Correct the casing of 'Vb' in member name 'MetadataTypesConfig.VbNetTypeAlias' by changing it to 'VB'. - - - Correct the spelling of 'Vb' in member name 'MetadataTypesConfig.VbNetTypeAlias' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - - - Because type 'ModelConfig<T>' contains only 'static' members, mark it as 'static' to prevent the compiler from adding a default public constructor. - - - - - - - Remove 'ModelConfig<T>.Id(Func<T, object>)' from 'ModelConfig<T>' or make it an instance member. - - - In member 'ModelConfig<T>.Id(Func<T, object>)', correct the casing of 'Fn' in parameter name 'getIdFn' by changing it to 'FN'. - - - In method 'ModelConfig<T>.Id(Func<T, object>)', correct the spelling of 'Fn' in parameter name 'getIdFn' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - - - Correct the spelling of 'Perf' in type name 'PerfUtils'. - - - Correct the spelling of 'Utils' in type name 'PerfUtils'. - - - - - - - Remove the call to GC.Collect from 'PerfUtils.Measure(Action, int, int, Action, Action, Action)'. It is usually unnecessary to force garbage collection, and doing so can severely degrade performance. - - - In member 'PerfUtils.Measure(Action, int, int, Action, Action, Action)', the compound word 'ForMs' in parameter name 'runForMs' exists as a discrete term. If your usage is intended to be single word, case it as 'Forms' or strip the first token entirely if it represents any sort of Hungarian notation. - - - Replace method 'PerfUtils.Measure(Action, int, int, Action, Action, Action)' with an overload that supplies all default arguments. - - - In member 'PerfUtils.Measure(Action, int, int, Action, Action, Action)', correct the casing of 'Ms' in parameter name 'runForMs' by changing it to 'MS'. - - - In method 'PerfUtils.Measure(Action, int, int, Action, Action, Action)', correct the spelling of 'Ms' in parameter name 'runForMs' or remove it entirely if it represents any sort of Hungarian notation. - - - In method 'PerfUtils.Measure(Action, int, int, Action, Action, Action)', correct the spelling of 'fn' in parameter name 'fn' or remove it entirely if it represents any sort of Hungarian notation. - - - In method 'PerfUtils.Measure(Action, int, int, Action, Action, Action)', correct the spelling of 'warmup' in parameter name 'warmup' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - In member 'PerfUtils.MeasureFor(Action, int)', the compound word 'ForMs' in parameter name 'runForMs' exists as a discrete term. If your usage is intended to be single word, case it as 'Forms' or strip the first token entirely if it represents any sort of Hungarian notation. - - - In member 'PerfUtils.MeasureFor(Action, int)', correct the casing of 'Ms' in parameter name 'runForMs' by changing it to 'MS'. - - - In method 'PerfUtils.MeasureFor(Action, int)', correct the spelling of 'Ms' in parameter name 'runForMs' or remove it entirely if it represents any sort of Hungarian notation. - - - In method 'PerfUtils.MeasureFor(Action, int)', correct the spelling of 'fn' in parameter name 'fn' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'PerfUtils.MeasureFor(Action, int)', validate parameter 'fn' before using it. - - - - - - - - - Add a member to 'RsaKeyLengths' that has a value of zero with a suggested name of 'None'. - - - The constituent members of 'RsaKeyLengths' appear to represent flags that can be combined rather than discrete values. If this is correct, mark the enumeration with FlagsAttribute. - - - If the name 'RsaKeyLengths' is plural, change it to its singular form. - - - - - - - Correct the spelling of 'Utils' in type name 'StringUtils'. - - - - - - - Remove the read-only designation from 'StringUtils.HtmlCharacterCodes' or change the field to one that is an immutable reference type. If the reference type 'IDictionary<string, string>' is, in fact, immutable, exclude this message. - - - - - - - - - - - Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'UrnId.Create(string, string)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - In externally visible method 'UrnId.Create(string, string)', validate parameter 'objectTypeName' before using it. - - - In externally visible method 'UrnId.Create(string, string)', validate parameter 'idFieldValue' before using it. - - - - - - - Consider changing the type of parameter 'objectType' in 'UrnId.Create(Type, string)' from 'Type' to its base type 'MemberInfo'. This method appears to only require base class members in its implementation. Suppress this violation if there is a compelling reason to require the more derived type in the method signature. - - - Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'UrnId.Create(Type, string)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - In externally visible method 'UrnId.Create(Type, string)', validate parameter 'objectType' before using it. - - - In externally visible method 'UrnId.Create(Type, string)', validate parameter 'idFieldValue' before using it. - - - - - - - Consider changing the type of parameter 'objectType' in 'UrnId.Create(Type, string, string)' from 'Type' to its base type 'MemberInfo'. This method appears to only require base class members in its implementation. Suppress this violation if there is a compelling reason to require the more derived type in the method signature. - - - Because the behavior of 'string.Format(string, object, object, object)' could vary based on the current user's locale settings, replace this call in 'UrnId.Create(Type, string, string)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - In externally visible method 'UrnId.Create(Type, string, string)', validate parameter 'objectType' before using it. - - - In externally visible method 'UrnId.Create(Type, string, string)', validate parameter 'idFieldName' before using it. - - - In externally visible method 'UrnId.Create(Type, string, string)', validate parameter 'idFieldValue' before using it. - - - - - - - Consider a design where 'UrnId.Create<T>(object)' doesn't require explicit type parameter 'T' in any call to it. - - - In externally visible method 'UrnId.Create<T>(object)', validate parameter 'idFieldValue' before using it. - - - - - - - Consider a design where 'UrnId.Create<T>(string)' doesn't require explicit type parameter 'T' in any call to it. - - - - - - - Consider a design where 'UrnId.Create<T>(string, string)' doesn't require explicit type parameter 'T' in any call to it. - - - - - - - Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'UrnId.CreateWithParts(string, params string[])' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - In externally visible method 'UrnId.CreateWithParts(string, params string[])', validate parameter 'objectTypeName' before using it. - - - In externally visible method 'UrnId.CreateWithParts(string, params string[])', validate parameter 'keyParts' before using it. - - - - - - - Consider a design where 'UrnId.CreateWithParts<T>(params string[])' doesn't require explicit type parameter 'T' in any call to it. - - - - - - - Change the type of parameter 'urn' of method 'UrnId.GetGuidId(string)' from string to System.Uri, or provide an overload of 'UrnId.GetGuidId(string)', that allows 'urn' to be passed as a System.Uri object. - - - - - - - Consider replacing the language-specific data type identifier 'Long' in member name 'UrnId.GetLongId(string)' with either a language-independent equivalent or a more generic term, such as 'value'. - - - Because the behavior of 'long.Parse(string)' could vary based on the current user's locale settings, replace this call in 'UrnId.GetLongId(string)' with a call to 'long.Parse(string, IFormatProvider)'. If the result of 'long.Parse(string, IFormatProvider)' will be based on input from the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will based on input stored and accessed by software, such as when it is loaded from disk or from a database, specify 'CultureInfo.InvariantCulture'. - - - Change the type of parameter 'urn' of method 'UrnId.GetLongId(string)' from string to System.Uri, or provide an overload of 'UrnId.GetLongId(string)', that allows 'urn' to be passed as a System.Uri object. - - - - - - - Change the type of parameter 'urn' of method 'UrnId.GetStringId(string)' from string to System.Uri, or provide an overload of 'UrnId.GetStringId(string)', that allows 'urn' to be passed as a System.Uri object. - - - - - - - Change the type of parameter 'urnId' of method 'UrnId.Parse(string)' from string to System.Uri, or provide an overload of 'UrnId.Parse(string)', that allows 'urnId' to be passed as a System.Uri object. - - - In externally visible method 'UrnId.Parse(string)', validate parameter 'urnId' before using it. - - - - - - - - - - - In externally visible method 'XLinqExtensions.AllElements(this IEnumerable<XElement>, string)', validate parameter 'elements' before using it. - - - - - - - Consider changing the type of parameter 'element' in 'XLinqExtensions.AllElements(this XElement, string)' from 'XElement' to its base type 'XContainer'. This method appears to only require base class members in its implementation. Suppress this violation if there is a compelling reason to require the more derived type in the method signature. - - - - - - - In externally visible method 'XLinqExtensions.AnyElement(this IEnumerable<XElement>, string)', validate parameter 'elements' before using it. - - - - - - - Consider changing the type of parameter 'element' in 'XLinqExtensions.AnyElement(this XElement, string)' from 'XElement' to its base type 'XContainer'. This method appears to only require base class members in its implementation. Suppress this violation if there is a compelling reason to require the more derived type in the method signature. - - - - - - - Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'XLinqExtensions.AssertElementHasValue(this XElement, string)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - - - - - Consider changing the type of parameter 'element' in 'XLinqExtensions.FirstElement(this XElement)' from 'XElement' to its base type 'XContainer'. This method appears to only require base class members in its implementation. Suppress this violation if there is a compelling reason to require the more derived type in the method signature. - - - In externally visible method 'XLinqExtensions.FirstElement(this XElement)', validate parameter 'element' before using it. - - - - - - - In method 'XLinqExtensions.GetAttributeValueOrDefault<T>(this XAttribute, string, Func<XAttribute, T>)', correct the spelling of 'attr' in parameter name 'attr' or remove it entirely if it represents any sort of Hungarian notation. - - - Parameter 'name' of 'XLinqExtensions.GetAttributeValueOrDefault<T>(this XAttribute, string, Func<XAttribute, T>)' is never used. Remove the parameter or use it in the method body. - - - - - - - Consider replacing the language-specific data type identifier 'Bool' in member name 'XLinqExtensions.GetBool(this XElement, string)' with either a language-independent equivalent or a more generic term, such as 'value'. - - - - - - - Consider replacing the language-specific data type identifier 'Bool' in member name 'XLinqExtensions.GetBoolOrDefault(this XElement, string)' with either a language-independent equivalent or a more generic term, such as 'value'. - - - - - - - Consider replacing the language-specific data type identifier 'Int' in member name 'XLinqExtensions.GetInt(this XElement, string)' with either a language-independent equivalent or a more generic term, such as 'value'. - - - - - - - Consider replacing the language-specific data type identifier 'Int' in member name 'XLinqExtensions.GetIntOrDefault(this XElement, string)' with either a language-independent equivalent or a more generic term, such as 'value'. - - - - - - - Consider replacing the language-specific data type identifier 'Long' in member name 'XLinqExtensions.GetLong(this XElement, string)' with either a language-independent equivalent or a more generic term, such as 'value'. - - - - - - - Consider replacing the language-specific data type identifier 'Long' in member name 'XLinqExtensions.GetLongOrDefault(this XElement, string)' with either a language-independent equivalent or a more generic term, such as 'value'. - - - - - - - Change 'List<string>' in 'XLinqExtensions.GetValues(this IEnumerable<XElement>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - In method 'XLinqExtensions.GetValues(this IEnumerable<XElement>)', correct the spelling of 'els' in parameter name 'els' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'XLinqExtensions.GetValues(this IEnumerable<XElement>)', validate parameter 'els' before using it. - - - - - - - - - - - - - - - In member 'DbConnectionFactory.DbConnectionFactory(Func<IDbConnection>)', correct the casing of 'Fn' in parameter name 'connectionFactoryFn' by changing it to 'FN'. - - - In method 'DbConnectionFactory.DbConnectionFactory(Func<IDbConnection>)', correct the spelling of 'Fn' in parameter name 'connectionFactoryFn' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - - - - - - - - - Replace method 'ConsoleLogFactory.ConsoleLogFactory(bool)' with an overload that supplies all default arguments. - - - - - - - - - - - Parameter 'type' of 'ConsoleLogger.ConsoleLogger(string)' is never used. Remove the parameter or use it in the method body. - - - - - - - Parameter 'type' of 'ConsoleLogger.ConsoleLogger(Type)' is never used. Remove the parameter or use it in the method body. - - - - - - - Method 'ConsoleLogger.Log(object, Exception)' passes a literal string as parameter 'value' of a call to 'Console.WriteLine(string)'. Retrieve the following string(s) from a resource table instead: ", Exception: ". - - - - - - - - - - - - - - - In externally visible method 'DelegateFactory.Create(MethodInfo)', validate parameter 'method' before using it. - - - - - - - In externally visible method 'DelegateFactory.CreateVoid(MethodInfo)', validate parameter 'method' before using it. - - - - - - - - - Do not nest type 'DelegateFactory.LateBoundMethod'. Alternatively, change its accessibility so that it is not externally visible. - - - - - - - Do not nest type 'DelegateFactory.LateBoundVoid'. Alternatively, change its accessibility so that it is not externally visible. - - - - - - - - - Correct the casing of 'Fn' in member name 'PropertyAccessor.GetPropertyFn<TEntity>(string)' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor.GetPropertyFn<TEntity>(string)' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Correct the casing of 'Fn' in member name 'PropertyAccessor.SetPropertyFn<TEntity>(string)' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor.SetPropertyFn<TEntity>(string)' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - - - - - Correct the casing of 'Fn' in member name 'PropertyAccessor<TEntity>.GetPropertyFn()' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor<TEntity>.GetPropertyFn()' or remove it entirely if it represents any sort of Hungarian notation. - - - Change 'PropertyAccessor<TEntity>.GetPropertyFn()' to a property if appropriate. - - - - - - - Correct the casing of 'Fn' in member name 'PropertyAccessor<TEntity>.SetPropertyFn()' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor<TEntity>.SetPropertyFn()' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Correct the casing of 'Fn' in member name 'PropertyAccessor<TEntity>.TypedGetPropertyFn<TId>()' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor<TEntity>.TypedGetPropertyFn<TId>()' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Correct the casing of 'Fn' in member name 'PropertyAccessor<TEntity>.TypedSetPropertyFn<TId>()' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor<TEntity>.TypedSetPropertyFn<TId>()' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Consider a design where 'PropertyAccessor<TEntity>.UnTypedGetPropertyFn<TId>()' doesn't require explicit type parameter 'TId' in any call to it. - - - Correct the casing of 'Fn' in member name 'PropertyAccessor<TEntity>.UnTypedGetPropertyFn<TId>()' by changing it to 'FN'. - - - Correct the casing of 'Un' in member name 'PropertyAccessor<TEntity>.UnTypedGetPropertyFn<TId>()' by changing it to 'UN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor<TEntity>.UnTypedGetPropertyFn<TId>()' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Consider a design where 'PropertyAccessor<TEntity>.UnTypedSetPropertyFn<TId>()' doesn't require explicit type parameter 'TId' in any call to it. - - - Correct the casing of 'Fn' in member name 'PropertyAccessor<TEntity>.UnTypedSetPropertyFn<TId>()' by changing it to 'FN'. - - - Correct the casing of 'Un' in member name 'PropertyAccessor<TEntity>.UnTypedSetPropertyFn<TId>()' by changing it to 'UN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor<TEntity>.UnTypedSetPropertyFn<TId>()' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Consider a design where 'PropertyAccessor<TEntity>.ValueTypedGetPropertyFn<TId>()' doesn't require explicit type parameter 'TId' in any call to it. - - - Correct the casing of 'Fn' in member name 'PropertyAccessor<TEntity>.ValueTypedGetPropertyFn<TId>()' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor<TEntity>.ValueTypedGetPropertyFn<TId>()' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Consider a design where 'PropertyAccessor<TEntity>.ValueTypesSetPropertyFn<TId>()' doesn't require explicit type parameter 'TId' in any call to it. - - - Correct the casing of 'Fn' in member name 'PropertyAccessor<TEntity>.ValueTypesSetPropertyFn<TId>()' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'PropertyAccessor<TEntity>.ValueTypesSetPropertyFn<TId>()' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - - - - - Remove 'StaticAccessors<TEntity>.TypedGetPropertyFn<TId>(PropertyInfo)' from 'StaticAccessors<TEntity>' or make it an instance member. - - - Correct the casing of 'Fn' in member name 'StaticAccessors<TEntity>.TypedGetPropertyFn<TId>(PropertyInfo)' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'StaticAccessors<TEntity>.TypedGetPropertyFn<TId>(PropertyInfo)' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Remove 'StaticAccessors<TEntity>.TypedSetPropertyFn<TId>(PropertyInfo)' from 'StaticAccessors<TEntity>' or make it an instance member. - - - Correct the casing of 'Fn' in member name 'StaticAccessors<TEntity>.TypedSetPropertyFn<TId>(PropertyInfo)' by changing it to 'FN'. - - - Correct the spelling of 'Fn' in member name 'StaticAccessors<TEntity>.TypedSetPropertyFn<TId>(PropertyInfo)' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Remove 'StaticAccessors<TEntity>.UnTypedGetPropertyFn<TId>(PropertyInfo)' from 'StaticAccessors<TEntity>' or make it an instance member. - - - Consider a design where 'StaticAccessors<TEntity>.UnTypedGetPropertyFn<TId>(PropertyInfo)' doesn't require explicit type parameter 'TId' in any call to it. - - - Correct the casing of 'Fn' in member name 'StaticAccessors<TEntity>.UnTypedGetPropertyFn<TId>(PropertyInfo)' by changing it to 'FN'. - - - Correct the casing of 'Un' in member name 'StaticAccessors<TEntity>.UnTypedGetPropertyFn<TId>(PropertyInfo)' by changing it to 'UN'. - - - Correct the spelling of 'Fn' in member name 'StaticAccessors<TEntity>.UnTypedGetPropertyFn<TId>(PropertyInfo)' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Remove 'StaticAccessors<TEntity>.UnTypedSetPropertyFn<TId>(PropertyInfo)' from 'StaticAccessors<TEntity>' or make it an instance member. - - - Consider a design where 'StaticAccessors<TEntity>.UnTypedSetPropertyFn<TId>(PropertyInfo)' doesn't require explicit type parameter 'TId' in any call to it. - - - Correct the casing of 'Fn' in member name 'StaticAccessors<TEntity>.UnTypedSetPropertyFn<TId>(PropertyInfo)' by changing it to 'FN'. - - - Correct the casing of 'Un' in member name 'StaticAccessors<TEntity>.UnTypedSetPropertyFn<TId>(PropertyInfo)' by changing it to 'UN'. - - - Correct the spelling of 'Fn' in member name 'StaticAccessors<TEntity>.UnTypedSetPropertyFn<TId>(PropertyInfo)' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Remove 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyFn<TId>(PropertyInfo)' from 'StaticAccessors<TEntity>' or make it an instance member. - - - Consider a design where 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyFn<TId>(PropertyInfo)' doesn't require explicit type parameter 'TId' in any call to it. - - - Correct the casing of 'Fn' in member name 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyFn<TId>(PropertyInfo)' by changing it to 'FN'. - - - Correct the casing of 'Un' in member name 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyFn<TId>(PropertyInfo)' by changing it to 'UN'. - - - Correct the spelling of 'Fn' in member name 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyFn<TId>(PropertyInfo)' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Remove 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyTypeFn(PropertyInfo)' from 'StaticAccessors<TEntity>' or make it an instance member. - - - Correct the casing of 'Fn' in member name 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyTypeFn(PropertyInfo)' by changing it to 'FN'. - - - Correct the casing of 'Un' in member name 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyTypeFn(PropertyInfo)' by changing it to 'UN'. - - - Correct the spelling of 'Fn' in member name 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyTypeFn(PropertyInfo)' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'StaticAccessors<TEntity>.ValueUnTypedGetPropertyTypeFn(PropertyInfo)', validate parameter 'pi' before using it. - - - - - - - Remove 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyFn<TId>(PropertyInfo)' from 'StaticAccessors<TEntity>' or make it an instance member. - - - Consider a design where 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyFn<TId>(PropertyInfo)' doesn't require explicit type parameter 'TId' in any call to it. - - - Correct the casing of 'Fn' in member name 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyFn<TId>(PropertyInfo)' by changing it to 'FN'. - - - Correct the casing of 'Un' in member name 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyFn<TId>(PropertyInfo)' by changing it to 'UN'. - - - Correct the spelling of 'Fn' in member name 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyFn<TId>(PropertyInfo)' or remove it entirely if it represents any sort of Hungarian notation. - - - - - - - Remove 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyTypeFn(PropertyInfo)' from 'StaticAccessors<TEntity>' or make it an instance member. - - - Correct the casing of 'Fn' in member name 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyTypeFn(PropertyInfo)' by changing it to 'FN'. - - - Correct the casing of 'Un' in member name 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyTypeFn(PropertyInfo)' by changing it to 'UN'. - - - Correct the spelling of 'Fn' in member name 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyTypeFn(PropertyInfo)' or remove it entirely if it represents any sort of Hungarian notation. - - - In externally visible method 'StaticAccessors<TEntity>.ValueUnTypedSetPropertyTypeFn(PropertyInfo)', validate parameter 'pi' before using it. - - - - - - - - - - - - - - - In externally visible method 'AdapterBase.Execute(Action)', validate parameter 'action' before using it. - - - - - - - In externally visible method 'AdapterBase.Execute<T>(Func<T>)', validate parameter 'action' before using it. - - - - - - - - - - - Change 'List<T>' in 'CommandResultsHandler<T>.CommandResultsHandler(List<T>, ICommandList<T>, AutoResetEvent)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - - - - - Because the behavior of 'string.Format(string, params object[])' could vary based on the current user's locale settings, replace this call in 'InMemoryLog.AppendToLog(ICollection<string>, string, params object[])' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. - - - - - - - Change 'InMemoryLog.DebugEntries' to be read-only by removing the property setter. - - - Change 'List<string>' in 'InMemoryLog.DebugEntries' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'InMemoryLog.DebugExceptions' to be read-only by removing the property setter. - - - Change 'List<Exception>' in 'InMemoryLog.DebugExceptions' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'InMemoryLog.ErrorEntries' to be read-only by removing the property setter. - - - Change 'List<string>' in 'InMemoryLog.ErrorEntries' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'InMemoryLog.ErrorExceptions' to be read-only by removing the property setter. - - - Change 'List<Exception>' in 'InMemoryLog.ErrorExceptions' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'InMemoryLog.FatalEntries' to be read-only by removing the property setter. - - - Change 'List<string>' in 'InMemoryLog.FatalEntries' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'InMemoryLog.FatalExceptions' to be read-only by removing the property setter. - - - Change 'List<Exception>' in 'InMemoryLog.FatalExceptions' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'InMemoryLog.InfoEntries' to be read-only by removing the property setter. - - - Change 'List<string>' in 'InMemoryLog.InfoEntries' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'InMemoryLog.InfoExceptions' to be read-only by removing the property setter. - - - Change 'List<Exception>' in 'InMemoryLog.InfoExceptions' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'InMemoryLog.WarnEntries' to be read-only by removing the property setter. - - - Change 'List<string>' in 'InMemoryLog.WarnEntries' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - Change 'InMemoryLog.WarnExceptions' to be read-only by removing the property setter. - - - Change 'List<Exception>' in 'InMemoryLog.WarnExceptions' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - - - - - - - - - - In externally visible method 'InMemoryLogFactory.GetLogger(Type)', validate parameter 'type' before using it. - - - - - - - - - - - - - - - Assemblies should have valid strong names - Either the assembly has no strong name, an invalid one, or the strong name is valid only because of the computer configuration. The assembly should not be deployed in this state. The most common causes of this are: 1) The assembly's contents were modified after it was signed. 2) The signing process failed. 3) The assembly was delay-signed. 4) A registry key existed that allowed the check to pass (where it would not have otherwise). - Sign {0} with a strong name key. - - http://msdn.microsoft.com/library/ms182127(VS.100).aspx - [none] - CriticalError - - - - Avoid calling problematic methods - Avoid making unnecessary and potentially dangerous method calls. - Remove the call to GC.Collect from {0}. It is usually unnecessary to force garbage collection, and doing so can severely degrade performance. - - http://msdn.microsoft.com/library/bb385973(VS.100).aspx - [none] - Error - - - - Avoid namespaces with few types - A namespace should generally have more than five types. - Consider merging the types defined in '{0}' with another namespace. - - http://msdn.microsoft.com/library/ms182130(VS.100).aspx - [none] - Warning - - - - Collection properties should be read only - Properties that return collections should be read-only so that users cannot entirely replace the backing store. Users can still modify the contents of the collection by calling relevant methods on the collection. Note that the XmlSerializer class has special support for deserializing read-only collections. See the XmlSerializer overview for more information. - Change {0} to be read-only by removing the property setter. - - http://msdn.microsoft.com/library/ms182327(VS.100).aspx - [none] - Warning - - - - Compound words should be cased correctly - Avoid creating compound words from terms which exist in the dictionary as discrete terms. Do not create a compound word such as 'StopWatch' or 'PopUp'. These terms are recognized in the dictionary and should be cased as 'Stopwatch' and 'Popup'. - In member {0}, the compound word '{1}' in parameter name {2} exists as a discrete term. If your usage is intended to be single word, case it as '{3}' or strip the first token entirely if it represents any sort of Hungarian notation. - The compound word '{0}' in member name {1} exists as a discrete term. If your usage is intended to be single word, case it as '{2}' or strip the first token entirely if it represents any sort of Hungarian notation. - - http://msdn.microsoft.com/library/bb264474(VS.100).aspx - [none] - Error - - - - Consider passing base types as parameters - Using base types as parameters to methods improves re-use of these methods if you only use methods & properties from the parameter's base class. E.g. use Stream instead of FileStream as a parameter when only calling Stream.Read(), this makes the method work on all kind of streams instead of just File streams. - Consider changing the type of parameter {0} in {1} from {2} to its base type {3}. This method appears to only require base class members in its implementation. Suppress this violation if there is a compelling reason to require the more derived type in the method signature. - - http://msdn.microsoft.com/library/3hk32yyz(VS.100).aspx - [none] - Error - - - - Declare types in namespaces - A type should be defined inside a namespace to avoid duplication. - {0} should be declared inside a namespace. - - http://msdn.microsoft.com/library/ms182134(VS.100).aspx - [none] - Error - - - - Default parameters should not be used - Some programming languages do not support default parameters. Replace default parameters with method overloads that supply the default argument. - Replace method {0} with an overload that supplies all default arguments. - - http://msdn.microsoft.com/library/ms182135(VS.100).aspx - [none] - Error - - - - Dispose objects before losing scope - If a disposable object is not explicitly disposed before all references to it are out of scope, the object will be disposed at some indeterminate time when the garbage collector runs the finalizer of the object. Because an exceptional event might occur that will prevent the finalizer of the object from running, the object should be explicitly disposed instead. - In method {0}, call System.IDisposable.Dispose on object {1} before all references to it are out of scope. - RuleOwner - http://msdn.microsoft.com/library/ms182289(VS.100).aspx - - Warning - - - - Do not pass literals as localized parameters - Literal strings that are embedded in source code are difficult to localize. Avoid passing literal strings as arguments in circumstances where a localized string is generally expected. - Method {0} passes a literal string as parameter '{1}' of a call to {2}. Retrieve the following string(s) from a resource table instead: {3}. - RuleOwner - http://msdn.microsoft.com/library/ms182187(VS.100).aspx - - Warning - - - - Do not catch general exception types - You should not catch Exception or SystemException. Catching generic exception types can hide run-time problems from the library user, and can complicate debugging. You should catch only those exceptions that you can handle gracefully. - Modify {0} to catch a more specific exception than {1} or rethrow the exception. - - http://msdn.microsoft.com/library/ms182137(VS.100).aspx - [none] - CriticalError - - - - Do not declare read only mutable reference types - A read-only declaration for a mutable reference type does not prevent the field's instance data from being modified. For example, a read-only StringBuilder field declaration does not make sense, since the data encapsulated by the StringBuilder can be modified using the read-only reference. - Remove the read-only designation from {0} or change the field to one that is an immutable reference type. If the reference type {1} is, in fact, immutable, exclude this message. - - http://msdn.microsoft.com/library/ms182302(VS.100).aspx - [none] - Error - - - - Do not declare static members on generic types - The syntax for calling static members on generic types is complex as the type parameter has to be specified for each call. - Remove {0} from {1} or make it an instance member. - - http://msdn.microsoft.com/library/ms182139(VS.100).aspx - [none] - Error - - - - Do not expose generic lists - Do not expose List<T> in object models. Use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> instead. List<T> is meant to be used from implementation, not in object model API. List<T> is optimized for performance at the cost of long term versioning. For example, if you return List<T> to the client code, you will not ever be able to receive notifications when client code modifies the collection. - Change {0} in {1} to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V> - - http://msdn.microsoft.com/library/ms182142(VS.100).aspx - [none] - Error - - - - Do not nest generic types in member signatures - Avoid API that require users to instantiate a generic type with another generic type as type argument. The syntax gets too complex. - Consider a design where {0} doesn't nest generic type {1}. - - http://msdn.microsoft.com/library/ms182144(VS.100).aspx - [none] - CriticalError - - - - Do not pass types by reference - Although there are legitimate times to use reference parameters, such use frequently indicates a design that does not conform to the design guidelines for managed code. - Consider a design that does not require that {0} be a reference parameter. - - http://msdn.microsoft.com/library/ms182146(VS.100).aspx - [none] - Warning - - - - Enums should have zero value - An enum should generally have a zero value. If the enum is not decorated with the Flags attribute, it should have a member with a value of zero that represents the empty state. Optionally, this value is named 'None'. For a Flags-attributed enum, a zero-valued member is optional and, if it exists, should always be named 'None'. This value should indicate that no values have been set in the enum. Using a zero-valued member for other purposes is contrary to the use of the Flags attribute in that the bitwise AND and OR operators are useless with the member. - Add a member to {0} that has a value of zero with a suggested name of 'None'. - - http://msdn.microsoft.com/library/ms182149(VS.100).aspx - [none] - CriticalError - - - - Generic methods should provide type parameter - Methods where the type parameter cannot be inferred from the parameters and therefore has to be defined in the method call are too difficult to understand. Methods with a formal parameter typed as the generic method type parameter support inference. Methods with no formal parameter typed as the generic method type parameter don't support inference. - Consider a design where {0} doesn't require explicit type parameter {1} in any call to it. - - http://msdn.microsoft.com/library/ms182150(VS.100).aspx - [none] - Warning - - - - Identifiers should be cased correctly - Type, namespace, and member identifiers are Pascal-cased. Parameter identifiers are camel-cased. Two letter acronyms within these identifiers should be upper-cased, for example, use System.IO instead of System.Io. Acronyms of three or more letters should be Pascal-cased, for example, use System.Xml instead of System.XML. The pascal-casing convention capitalizes the first letter of each word, as in BackColor. The camel-casing convention formats the first letter of the first word in lowercase and capitalizes the first letter of all subsequent words, as in backgroundColor. Although it may be common practice for some two letter acronyms to not be fully capitalized, violations of this rule should not be excluded for this reason. For example, 'DbConnection', is common but incorrect; use DBConnection. A violation of this rule might be required for compatibility with existing, non-managed symbol schemes. In general, however, these symbols should not be visible outside the assembly that uses them. - Correct the casing of '{0}' in member name {1} by changing it to '{2}'. - In member {0}, correct the casing of '{1}' in parameter name {2} by changing it to '{3}'. - - http://msdn.microsoft.com/library/ms182240(VS.100).aspx - [none] - Error - - - - Identifiers should be spelled correctly - The individual words that make up an identifier should not be abbreviated and should be spelled correctly. If this rule generates a false positive on a term that should be recognized, add the word to the FxCop custom dictionary. - Correct the spelling of '{0}' in member name {1} or remove it entirely if it represents any sort of Hungarian notation. - In method {0}, correct the spelling of '{1}' in parameter name {2} or remove it entirely if it represents any sort of Hungarian notation. - On method {0}, consider providing a more meaningful name than generic type parameter name {1}. - Correct the spelling of '{0}' in type name {1}. - - http://msdn.microsoft.com/library/bb264492(VS.100).aspx - [none] - CriticalWarning - - - - Identifiers should have correct prefix - Prefix interface names with the letter 'I' to indicate that the type is an interface, as in IFormattable. Prefix generic type parameter names with the letter 'T' and provide them with descriptive names, as in Dictionary<TKey, TValue>, unless a single 'T' is completely self-explanatory, as in Collection<T>. Use Pascal casing for both interface and type parameter names. Use abbreviations sparingly. Do not use the underscore character. Do use similar names when defining a class/interface pair where the class is a standard implementation of the interface. The names should differ only by the letter I prefixed on the interface name, as with Component and IComponent. - On method {0}, prefix generic type parameter name {1} with 'T'. - - http://msdn.microsoft.com/library/ms182243(VS.100).aspx - [none] - Error - - - - Identifiers should not contain type names - Avoid using language-specific types name in parameters and members and data type identifiers in parameters. Types names might not be intuitive for all developers. It is recommended that you select a generic name, such as 'value', instead. If this is not sufficient, be sure to use the type name as it is defined in the .NET Framework Library and avoid language-specific type names completely. Some examples of C#-specific type names are 'float' (use 'Single' if a generic name is not sufficient), and 'ulong' (use 'UInt64' if a generic name is not sufficient). - In member {0}, consider replacing the data type identifier '{1}' in parameter name {2} with a more generic term, such as 'value'. - Consider replacing the language-specific data type identifier '{0}' in member name {1} with either a language-independent equivalent or a more generic term, such as 'value'. - - http://msdn.microsoft.com/library/bb531486(VS.100).aspx - [none] - Error - - - - Identifiers should not have incorrect suffix - Types that do not extend certain base types should not use reserved name suffixes. Types and members should not use 'Ex' or 'New' to distinguish them from an earlier version of the same API, instead, use a numeric suffix such as '2' or provide a more meaningful suffix. Concrete type implementations and members should not end 'Impl'. Members instead, should either consider using the suggested alternate 'Core' in replacement of 'Impl' or avoid any suffix at all. - Rename type name {0} so that it does not end in '{1}'. - - http://msdn.microsoft.com/library/ms182247(VS.100).aspx - [none] - CriticalError - - - - Initialize reference type static fields inline - Static fields should be initialized when declared. Initializing static data in explicit static constructors results in less performant code. - Initialize all static fields in {0} when those fields are declared and remove the explicit static constructor. - - http://msdn.microsoft.com/library/ms182275(VS.100).aspx - [none] - CriticalWarning - - - - Instantiate argument exceptions correctly - String arguments passed to constructors of ArgumentException and its derived types should be correct. Types derived from ArgumentException have inconsistent constructor overloads with respect to the message and paramName parameters as compared to ArgumentException. - Method {0} passes '{1}' as the {2} argument to a {3} constructor. Replace this argument with one of the method's parameter names. Note that the provided parameter name should have the exact casing as declared on the method. - - http://msdn.microsoft.com/library/ms182347(VS.100).aspx - [none] - CriticalError - - - - Mark assemblies with CLSCompliantAttribute - Assemblies should explicitly state their CLS compliance using the CLSCompliant attribute. An assembly without this attribute is not CLS-compliant. Assemblies, modules, and types can be CLS-compliant even if some parts of the assembly, module, or type are not CLS-compliant. The following rules apply: 1) If the element is marked CLSCompliant, any noncompliant members must have the CLSCompliant attribute present with its argument set to false. 2) A comparable CLS-compliant alternative member must be supplied for each member that is not CLS-compliant. - Mark {0} with CLSCompliant(true) because it exposes externally visible types. - - http://msdn.microsoft.com/library/ms182156(VS.100).aspx - [none] - Error - - - - Mark enums with FlagsAttribute - The enumeration appears to be made up of combinable flags. If this true, apply the Flags attribute to the enumeration. - The constituent members of {0} appear to represent flags that can be combined rather than discrete values. If this is correct, mark the enumeration with FlagsAttribute. - - http://msdn.microsoft.com/library/ms182159(VS.100).aspx - [none] - Warning - - - - Nested types should not be visible - Do not use public, protected or protected internal (Protected Friend) nested types as a way of grouping types. Use namespaces for this purpose. There are very limited scenarios where nested types are the best design. Also, nested type member accessibility is not clearly understood by all audiences. Enumerators are exempt from this rule. - Do not nest type {0}. Alternatively, change its accessibility so that it is not externally visible. - - http://msdn.microsoft.com/library/ms182162(VS.100).aspx - [none] - Error - - - - Non-constant fields should not be visible - Static fields should be constant unless you carefully manage access to the field using locks. Using static variables without making them thread safe can compromise execution state. This rule applies to managed code libraries. If the analyzed assembly is an application, it is usually safe to exclude violations of this rule. - Consider making {0} non-public or a constant. - - http://msdn.microsoft.com/library/ms182353(VS.100).aspx - [none] - Warning - - - - Normalize strings to uppercase - Strings should be normalized to upper-case. - In method {0}, replace the call to {1} with String.ToUpperInvariant(). - - http://msdn.microsoft.com/library/bb386042(VS.100).aspx - [none] - Error - - - - Only FlagsAttribute enums should have plural names - Plural names indicate that the values of the enumeration can be combined. For example, an enumeration named 'Day' indicates a single day, and an enumeration named 'Days' indicates multiple days. Enumeration values should be combined using the bit-wise OR operator only if the Flags attribute is present on the enumeration. - If the name {0} is plural, change it to its singular form. - - http://msdn.microsoft.com/library/bb264487(VS.100).aspx - [none] - Error - - - - Parameter names should not match member names - Parameter names should be distinct from member names. - Change either member or parameter name {0} so that one differs from the other. - - http://msdn.microsoft.com/library/ms182252(VS.100).aspx - [none] - Error - - - - Properties should not return arrays - Properties that return arrays are prone to code inefficiencies. Consider using a collection or making this a method. See the design guidelines for more information. - Change {0} to return a collection or make it a method. - - http://msdn.microsoft.com/library/0fss9skc(VS.100).aspx - [none] - Warning - - - - Property names should not match get methods - A Get method was found with the same name as a property. Get methods and properties should have names that clearly distinguish their function. See the design guidelines for information regarding choosing properties over methods. - The property name {0} is confusing given the existence of inherited method {1}. Rename or remove this property. - - http://msdn.microsoft.com/library/ms182253(VS.100).aspx - [none] - Error - - - - Review unused parameters - Review parameters in non-virtual methods that are not used in the method body to ensure no correctness exists around failure to access them. Unused parameters incur maintenance and performance costs. Sometimes a violation of this rule can point to an implementation bug in the method (i.e. the parameter should actually have been used in the method body). Exclude warnings of this rule if the parameter has to exist because of backward compatibility. - Parameter {0} of {1} is never used. Remove the parameter or use it in the method body. - - http://msdn.microsoft.com/library/ms182268(VS.100).aspx - [none] - Warning - - - - Specify IFormatProvider - If an overload exists that takes an IFormatProvider argument, it should always be called in favor of an overload that does not. Some methods in the runtime convert a value to or from a string representation and take a string parameter that contains one or more characters, called format specifiers, which indicate how the value is to be converted. If the meaning of the format specifier varies by culture, a formatting object supplies the actual characters used in the string representation. In scenarios where sorting and comparison behavior should never change between cultures, specify CultureInfo.InvariantCulture, otherwise, specify CultureInfo.CurrentCulture. - Because the behavior of {0} could vary based on the current user's locale settings, replace this call in {1} with a call to {2}. If the result of {2} will be based on input from the user, specify {3} as the 'IFormatProvider' parameter. Otherwise, if the result will based on input stored and accessed by software, such as when it is loaded from disk or from a database, specify {4}. - Because the behavior of {0} could vary based on the current user's locale settings, replace this call in {1} with a call to {2}. If the result of {2} will be displayed to the user, specify {3} as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify {4}. - - http://msdn.microsoft.com/library/ms182190(VS.100).aspx - [none] - Error - - - - Static holder types should not have constructors - Instances of types that define only static members do not need to be created. Many compilers will automatically add a public default constructor if no constructor is specified. To prevent this, adding an empty private constructor may be required. - Because type {0} contains only 'static' members, mark it as 'static' to prevent the compiler from adding a default public constructor. - - http://msdn.microsoft.com/library/ms182169(VS.100).aspx - [none] - Error - - - - URI parameters should not be strings - If a parameter name contains "uri" or "url" or "urn", and it's typed as string, the parameter type should be changed to System.Uri, unless there is an overload method where the same parameter is typed as System.Uri. - Change the type of parameter {0} of method {1} from string to System.Uri, or provide an overload of {1}, that allows {0} to be passed as a System.Uri object. - - http://msdn.microsoft.com/library/ms182174(VS.100).aspx - [none] - Error - - - - URI properties should not be strings - If a property name contains "uri" or "url" or "urn" and it's typed as string, it should be changed to System.Uri. - Change the type of property {0} from string to System.Uri. - - http://msdn.microsoft.com/library/ms182175(VS.100).aspx - [none] - Error - - - - URI return values should not be strings - If a function name contains "uri" or "url" or "urn" and the return type is string, the return type should be changed to System.Uri. - Change the return type of {0} from string to System.Uri. - - http://msdn.microsoft.com/library/ms182176(VS.100).aspx - [none] - Error - - - - Use properties where appropriate - Properties should be used instead of Get/Set methods in most situations. Methods are preferable to properties in the following situations: the operation is a conversion, is expensive or has an observable side-effect; the order of execution is important; calling the member twice in succession creates different results; a member is static but returns a mutable value; or the member returns an array. - Change {0} to a property if appropriate. - - http://msdn.microsoft.com/library/ms182181(VS.100).aspx - [none] - Warning - - - - Validate arguments of public methods - All reference arguments passed to externally visible methods should be checked against null (Nothing in VB). If appropriate, throw a System.ArgumentNullException when the argument is null. - In externally visible method {0}, validate parameter '{1}' before using it. - RuleOwner - http://msdn.microsoft.com/library/ms182182(VS.100).aspx - - Warning - - - - - Category - Certainty - Collapse All - Check Id - Error - error(s) - Expand All - Help - Line - message(s) - [Location not stored in Pdb] - Project - Resolution - Rule - Rule File - Rule Description - Source - Status - Target - Warning - warning(s) - Code Analysis Report - - diff --git a/lib/ServiceStack.Common.xml b/lib/ServiceStack.Common.xml deleted file mode 100644 index eefa5dfbf09..00000000000 --- a/lib/ServiceStack.Common.xml +++ /dev/null @@ -1,231 +0,0 @@ - - - - ServiceStack.Common - - - - - Useful .NET Encryption Utils from: - http://andrewlocatelliwoodcock.com/2011/08/01/implementing-rsa-asymmetric-public-private-key-encryption-in-c-encrypting-under-the-public-key/ - - - - - Encrypt an arbitrary string of data under the supplied public key - - The public key to encrypt under - The data to encrypt - The bit length or strength of the public key: 1024, 2048 or 4096 bits. This must match the - value actually used to create the publicKey - - - - - Create Public and Private Key Pair based on settings already in static class. - - RsaKeyPair - - - - Return T[0] when enumerable is null, safe to use in enumerations like foreach - - - - - Gets the textual description of the enum if it has one. e.g. - - - enum UserColors - { - [Description("Bright Red")] - BrightRed - } - UserColors.BrightRed.ToDescription(); - - - - - - - - Creates a Console Logger, that logs all messages to: System.Console - - Made public so its testable - - - - - Default logger is to Console.WriteLine - - Made public so its testable - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - - - Logs the specified message. - - - - - Logs the format. - - - - - Logs the specified message. - - - - - Useful IPAddressExtensions from: - http://blogs.msdn.com/knom/archive/2008/12/31/ip-address-calculations-with-c-subnetmasks-networks.aspx - - - - - - Gets the ipv4 addresses from all Network Interfaces that have Subnet masks. - - - - - - Gets the ipv6 addresses from all Network Interfaces. - - - - - - Func to get the Strongly-typed field - - - - - Required to cast the return ValueType to an object for caching - - - - - Func to set the Strongly-typed field - - - - - Required to cast the ValueType to an object for caching - - - - - Required to cast the ValueType to an object for caching - - - - - Func to get the Strongly-typed field - - - - - Required to cast the return ValueType to an object for caching - - - - - Func to set the Strongly-typed field - - - - - Required to cast the ValueType to an object for caching - - - - - Required to cast the ValueType to an object for caching - - - - - Common functionality when creating adapters - - - - - Executes the specified expression. - - - The action. - - - - - Executes the specified action (for void methods). - - The action. - - - - Note: InMemoryLog keeps all logs in memory, so don't use it long running exceptions - - Returns a thread-safe InMemoryLog which you can use while *TESTING* - to provide a detailed analysis of your logs. - - - - - Creates a Unified Resource Name (URN) with the following formats: - - - urn:{TypeName}:{IdFieldValue} e.g. urn:UserSession:1 - - urn:{TypeName}:{IdFieldName}:{IdFieldValue} e.g. urn:UserSession:UserId:1 - - - - - - - Provide the an option for the callee to block until all commands are executed - - - - - - - Invokes the action provided and returns true if no excpetion was thrown. - Otherwise logs the exception and returns false if an exception was thrown. - - The action. - - - - - Runs an action for a minimum of runForMs - - What to run - Minimum ms to run for - time elapsed in micro seconds - - - - Returns average microseconds an action takes when run for the specified runForMs - - What to run - How many times to run for each iteration - Minimum ms to run for - - - - - - - diff --git a/lib/ServiceStack.Interfaces.dll b/lib/ServiceStack.Interfaces.dll deleted file mode 100644 index 72e6de9291c..00000000000 Binary files a/lib/ServiceStack.Interfaces.dll and /dev/null differ diff --git a/lib/ServiceStack.Interfaces.dll.CodeAnalysisLog.xml b/lib/ServiceStack.Interfaces.dll.CodeAnalysisLog.xml deleted file mode 100644 index d16d977efd1..00000000000 --- a/lib/ServiceStack.Interfaces.dll.CodeAnalysisLog.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Category - Certainty - Collapse All - Check Id - Error - error(s) - Expand All - Help - Line - message(s) - [Location not stored in Pdb] - Project - Resolution - Rule - Rule File - Rule Description - Source - Status - Target - Warning - warning(s) - Code Analysis Report - - diff --git a/lib/ServiceStack.Interfaces.dll.mdb b/lib/ServiceStack.Interfaces.dll.mdb deleted file mode 100644 index c43efb573e4..00000000000 Binary files a/lib/ServiceStack.Interfaces.dll.mdb and /dev/null differ diff --git a/lib/ServiceStack.Interfaces.xml b/lib/ServiceStack.Interfaces.xml deleted file mode 100644 index 8729e037bbd..00000000000 --- a/lib/ServiceStack.Interfaces.xml +++ /dev/null @@ -1,1722 +0,0 @@ - - - - ServiceStack.Interfaces - - - - - A common interface implementation that is implemented by most cache providers - - - - - Removes the specified item from the cache. - - The identifier for the item to delete. - - true if the item was successfully removed from the cache; false otherwise. - - - - - Removes the cache for all the keys provided. - - The keys. - - - - Retrieves the specified item from the cache. - - - The identifier for the item to retrieve. - - The retrieved item, or null if the key was not found. - - - - - Increments the value of the specified key by the given amount. - The operation is atomic and happens on the server. - A non existent value at key starts at 0 - - The identifier for the item to increment. - The amount by which the client wants to increase the item. - - The new value of the item or -1 if not found. - - The item must be inserted into the cache before it can be changed. The item must be inserted as a . The operation only works with values, so -1 always indicates that the item was not found. - - - - Increments the value of the specified key by the given amount. - The operation is atomic and happens on the server. - A non existent value at key starts at 0 - - The identifier for the item to increment. - The amount by which the client wants to decrease the item. - - The new value of the item or -1 if not found. - - The item must be inserted into the cache before it can be changed. The item must be inserted as a . The operation only works with values, so -1 always indicates that the item was not found. - - - - Adds a new item into the cache at the specified cache key only if the cache is empty. - - The key used to reference the item. - The object to be inserted into the cache. - - true if the item was successfully stored in the cache; false otherwise. - - The item does not expire unless it is removed due memory pressure. - - - - Sets an item into the cache at the cache key specified regardless if it already exists or not. - - - - - Replaces the item at the cachekey specified only if an items exists at the location already. - - - - - Invalidates all data on the cache. - - - - - Retrieves multiple items from the cache. - The default value of T is set for all keys that do not exist. - - The list of identifiers for the items to retrieve. - - a Dictionary holding all items indexed by their key. - - - - - Sets multiple items to the cache. - - - The values. - - - - Removes items from cache that have keys matching the specified wildcard pattern - - The wildcard, where "*" means any sequence of characters and "?" means any single character. - - - - Removes items from the cache based on the specified regular expression pattern - - Regular expression pattern to search cache keys - - - - A light interface over a cache client. - This interface was inspired by Enyim.Caching.MemcachedClient - - Only the methods that are intended to be used are required, if you require - extra functionality you can uncomment the unused methods below as they have been - implemented in DdnMemcachedClient - - - - - Removes the specified item from the cache. - - The identifier for the item to delete. - - true if the item was successfully removed from the cache; false otherwise. - - - - - Removes the cache for all the keys provided. - - The keys. - - - - Retrieves the specified item from the cache. - - The identifier for the item to retrieve. - - The retrieved item, or null if the key was not found. - - - - - Increments the value of the specified key by the given amount. The operation is atomic and happens on the server. - - The identifier for the item to increment. - The amount by which the client wants to increase the item. - - The new value of the item or -1 if not found. - - The item must be inserted into the cache before it can be changed. The item must be inserted as a . The operation only works with values, so -1 always indicates that the item was not found. - - - - Increments the value of the specified key by the given amount. The operation is atomic and happens on the server. - - The identifier for the item to increment. - The amount by which the client wants to decrease the item. - - The new value of the item or -1 if not found. - - The item must be inserted into the cache before it can be changed. The item must be inserted as a . The operation only works with values, so -1 always indicates that the item was not found. - - - - Inserts an item into the cache with a cache key to reference its location. - - The key used to reference the item. - The object to be inserted into the cache. - - true if the item was successfully stored in the cache; false otherwise. - - The item does not expire unless it is removed due memory pressure. - - - - Inserts an item into the cache with a cache key to reference its location. - - The key used to reference the item. - The object to be inserted into the cache. - The time when the item is invalidated in the cache. - true if the item was successfully stored in the cache; false otherwise. - - - - Removes all data from the cache. - - - - - Retrieves multiple items from the cache. - - The list of identifiers for the items to retrieve. - - a Dictionary holding all items indexed by their key. - - - - - A Users Session - - - - - Set a typed value at key - - - - - - - - Get a typed value at key - - - - - - - - Store any object at key - - - - - - - Retrieves a User Session - - - - - Gets the session for this request, creates one if it doesn't exist. - - - - - - - - Gets the session for this request, creates one if it doesn't exist. - Only for ASP.NET apps. Uses the HttpContext.Current singleton. - - - - - Allow delegation of dependencies to other IOC's - - - - - Resolve Property Dependency - - - - - - - Resolve Constructor Dependency - - - - - - - BelongToAttribute - Use to indicate that a join column belongs to another table. - - - - - Compute attribute. - Use to indicate that a property is a Calculated Field - - - - - Mark types that are to be excluded from specified features - - - - - Decimal length attribute. - - - - - Explicit foreign key name. If it's null, or empty, the FK name will be autogenerated as before. - - - - - IgnoreAttribute - Use to indicate that a property is not a field in the table - properties with this attribute are ignored when building sql sentences - - - - - Primary key attribute. - use to indicate that property is part of the pk - - - - - Used to indicate that property is a row version incremented automatically by the database - - - - - Used to annotate an Entity with its DB schema - - - - - - For providers that want a cleaner API with a little more perf - - - - - - Decorate any type or property with adhoc info - - - - - Contract indication that the Response DTO has a ResponseStatus - - - - - Creates a Debug Logger, that logs all messages to: System.Diagnostics.Debug - - Made public so its testable - - - - - Factory to create ILog instances - - - - - Gets the logger. - - - - - Gets the logger. - - - - - Default logger is to System.Diagnostics.Debug.WriteLine - - Made public so its testable - - - - - Logs a message in a running application - - - - - Logs a Debug message. - - The message. - - - - Logs a Debug message and exception. - - The message. - The exception. - - - - Logs a Debug format message. - - The format. - The args. - - - - Logs a Error message. - - The message. - - - - Logs a Error message and exception. - - The message. - The exception. - - - - Logs a Error format message. - - The format. - The args. - - - - Logs a Fatal message. - - The message. - - - - Logs a Fatal message and exception. - - The message. - The exception. - - - - Logs a Error format message. - - The format. - The args. - - - - Logs an Info message and exception. - - The message. - - - - Logs an Info message and exception. - - The message. - The exception. - - - - Logs an Info format message. - - The format. - The args. - - - - Logs a Warning message. - - The message. - - - - Logs a Warning message and exception. - - The message. - The exception. - - - - Logs a Warning format message. - - The format. - The args. - - - - Gets or sets a value indicating whether this instance is debug enabled. - - - true if this instance is debug enabled; otherwise, false. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - - - Logs the specified message. - - - - - Logs the format. - - - - - Logs the specified message. - - - - - Default logger is to System.Diagnostics.Debug.Print - - Made public so its testable - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - - - Logs the specified message. - - - - - Logs the format. - - - - - Logs the specified message. - - - - - Creates a Debug Logger, that logs all messages to: System.Diagnostics.Debug - - Made public so its testable - - - - - StringBuilderLog writes to shared StringBuffer. - Made public so its testable - - - - - Logs the specified message. - - - - - Logs the format. - - - - - Logs the specified message. - - The message. - - - - Creates a test Logger, that stores all log messages in a member list - - - - - Tests logger which stores all log messages in a member list which can be examined later - - Made public so its testable - - - - - Initializes a new instance of the class. - - The type. - - - - Initializes a new instance of the class. - - The type. - - - - Logs the specified message. - - The message. - The exception. - - - - Logs the format. - - The message. - The args. - - - - Logs the specified message. - - The message. - - - - Logging API for this library. You can inject your own implementation otherwise - will use the DebugLogFactory to write to System.Diagnostics.Debug - - - - - Gets the logger. - - - - - Gets the logger. - - - - - Gets or sets the log factory. - Use this to override the factory that is used to create loggers - - - - - Publish the specified message into the durable queue @queueName - - - - - Publish the specified message into the transient queue @queueName - - - - - Synchronous blocking get. - - - - - Non blocking get message - - - - - Acknowledge the message has been successfully received or processed - - - - - Negative acknowledgement the message was not processed correctly - - - - - Create a typed message from a raw MQ Response artefact - - - - - Create a temporary Queue for Request / Reply - - - - - - Simple definition of an MQ Host - - - - - Register DTOs and hanlders the MQ Host will process - - - - - - - Register DTOs and hanlders the MQ Host will process - - - - - - - - Get Total Current Stats for all Message Handlers - - - - - - Get the status of the service. Potential Statuses: Disposed, Stopped, Stopping, Starting, Started - - - - - - Get a Stats dump - - - - - - Start the MQ Host if not already started. - - - - - Stop the MQ Host if not already stopped. - - - - - Factory to create consumers and producers that work with this service - - - - - Get a list of all message types registered on this MQ Host - - - - - Basic implementation of IMessage[T] - - - - - - Util static generic class to create unique queue names for types - - - - - - Util class to create unique queue names for runtime types - - - - - For messaging exceptions that should by-pass the messaging service's configured - retry attempts and store the message straight into the DLQ - - - - - Wrap the common redis list operations under a IList[string] interface. - - - - - Redis transaction for typed client - - - - - - interface to queueable operation using typed redis client - - - - - - Interface to redis typed pipeline - - - - - Pipeline interface shared by typed and non-typed pipelines - - - - - Interface to operations that allow queued commands to be completed - - - - - Returns a high-level typed client API - - - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. - - - - - - Returns a Read/Write ICacheClient (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly ICacheClient using the hosts defined in ReadOnlyHosts. - - - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. - - - - - - Returns a Read/Write ICacheClient (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly ICacheClient using the hosts defined in ReadOnlyHosts. - - - - - - Subscribe to channels by name - - - - - - Subscribe to channels matching the supplied patterns - - - - - - The number of active subscriptions this client has - - - - - Registered handler called after client *Subscribes* to each new channel - - - - - Registered handler called when each message is received - - - - - Registered handler called when each channel is unsubscribed - - - - - Interface to redis transaction - - - - - Base transaction interface, shared by typed and non-typed transactions - - - - - interface to operation that can queue commands - - - - - Interface to redis pipeline - - - - - Gets or sets parameter name with which allowable values will be associated. - - - - - The overall description of an API. Used by Swagger. - - - - - Gets or sets verb to which applies attribute. By default applies to all verbs. - - - - - Gets or sets parameter type: It can be only one of the following: path, query, body, model, or header. - - - - - Gets or sets unique name for the parameter. Each name must be unique, even if they are associated with different paramType values. - - - - Other notes on the name field: - If paramType is body, the name is used only for UI and codegeneration. - If paramType is path, the name field must correspond to the associated path segment from the path field in the api object. - If paramType is query, the name field corresponds to the query param name. - - - - - - Gets or sets the human-readable description for the parameter. - - - - - For path, query, and header paramTypes, this field must be a primitive. For body, this can be a complex or container datatype. - - - - - For path, this is always true. Otherwise, this field tells the client whether or not the field must be supplied. - - - - - For query params, this specifies that a comma-separated list of values can be passed to the API. For path and body types, this field cannot be true. - - - - - Gets or sets route to which applies attribute, matches using StartsWith. By default applies to all routes. - - - - - The status code of a response - - - - - The description of a response status code - - - - - Marker interfaces - - - - - Implement on Request DTOs that need access to the raw Request Stream - - - - - The raw Http Request Input Stream - - - - - Resolve a dependency from the AppHost's IOC - - - - - - - This interface can be implemented by an attribute - which adds an request filter for the specific request DTO the attribute marked. - - - - - The request filter is executed before the service. - - The http request wrapper - The http response wrapper - The request DTO - - - - A new shallow copy of this filter is used on every request. - - - - - - Order in which Request Filters are executed. - <0 Executed before global request filters - >0 Executed after global request filters - - - - - This interface can be implemented by an attribute - which adds an response filter for the specific response DTO the attribute marked. - - - - - The response filter is executed after the service - - The http request wrapper - The http response wrapper - - - - A new shallow copy of this filter is used on every request. - - - - - - Order in which Response Filters are executed. - <0 Executed before global response filters - >0 Executed after global response filters - - - - - The HTTP Response Status - - - - - The HTTP Response Status Code - - - - - The HTTP Status Description - - - - - The HTTP Response ContentType - - - - - Additional HTTP Headers - - - - - Response DTO - - - - - if not provided, get's injected by ServiceStack - - - - - Holds the request call context - - - - - The padding length written with the body, to be added to ContentLength of body - - - - - A thin wrapper around ASP.NET or HttpListener's HttpRequest - - - - - A thin wrapper around each host's Request e.g: ASP.NET, HttpListener, MQ, etc - - - - - The entire string contents of Request.InputStream - - - - - - The underlying ASP.NET or HttpListener HttpRequest - - - - - The name of the service being called (e.g. Request DTO Name) - - - - - The Verb / HttpMethod or Action for this request - - - - - Optional preferences for the processing of this Request - - - - - The Request DTO, after it has been deserialized. - - - - - The request ContentType - - - - - The expected Response ContentType for this request - - - - - Whether the ResponseContentType has been explicitly overrided or whether it was just the default - - - - - Attach any data to this request that all filters and services can access. - - - - - Buffer the Request InputStream so it can be re-read - - - - - The Remote Ip as reported by Request.UserHostAddress - - - - - The Remote Ip as reported by X-Forwarded-For, X-Real-IP or Request.UserHostAddress - - - - - e.g. is https or not - - - - - Access to the multi-part/formdata files posted on this request - - - - - The value of the Referrer, null if not available - - - - - The HttpResponse - - - - - The HTTP Verb - - - - - The IP Address of the X-Forwarded-For header, null if null or empty - - - - - The Port number of the X-Forwarded-Port header, null if null or empty - - - - - The http or https scheme of the X-Forwarded-Proto header, null if null or empty - - - - - The value of the X-Real-IP header, null if null or empty - - - - - A thin wrapper around ASP.NET or HttpListener's HttpResponse - - - - - A thin wrapper around each host's Response e.g: ASP.NET, HttpListener, MQ, etc - - - - - Write once to the Response Stream then close it. - - - - - - Signal that this response has been handled and no more processing should be done. - When used in a request or response filter, no more filters or processing is done on this request. - - - - - Calls Response.End() on ASP.NET HttpResponse otherwise is an alias for Close(). - Useful when you want to prevent ASP.NET to provide it's own custom error page. - - - - - Response.Flush() and OutputStream.Flush() seem to have different behaviour in ASP.NET - - - - - The underlying ASP.NET or HttpListener HttpResponse - - - - - The Response DTO - - - - - Buffer the Response OutputStream so it can be written in 1 batch - - - - - Gets a value indicating whether this instance is closed. - - - - - Log every service request - - - - - Log a request - - The RequestContext - Request DTO - Response DTO or Exception - How long did the Request take - - - - View the most recent logs - - - - - - - Turn On/Off Session Tracking - - - - - Turn On/Off Raw Request Body Tracking - - - - - Turn On/Off Tracking of Responses - - - - - Turn On/Off Tracking of Exceptions - - - - - Limit access to /requestlogs service to role - - - - - Don't log requests of these types. - - - - - Don't log request bodys for services with sensitive information. - By default Auth and Registration requests are hidden. - - - - - Implement on services that need access to the RequestContext - - - - - Responsible for executing the operation within the specified context. - - The operation types. - - - - Returns the first matching RestPath - - - - - Executes the MQ DTO request. - - - - - Executes the MQ DTO request with the supplied requestContext - - - - - Executes the DTO request under the supplied requestContext. - - - - - Executes the DTO request with an empty RequestContext. - - - - - Allow the registration of user-defined routes for services - - - - - Maps the specified REST path to the specified request DTO. - - The type of request DTO to map - the path to. - The path to map the request DTO to. - See RouteAttribute.Path - for details on the correct format. - The same instance; - never . - - - - Maps the specified REST path to the specified request DTO, and - specifies the HTTP verbs supported by the path. - - The type of request DTO to map - the path to. - The path to map the request DTO to. - See RouteAttribute.Path - for details on the correct format. - - The comma-delimited list of HTTP verbs supported by the path, - such as "GET,PUT,DELETE". Specify empty or - to indicate that all verbs are supported. - - The same instance; - never . - - - - Maps the specified REST path to the specified request DTO, - specifies the HTTP verbs supported by the path, and indicates - the default MIME type of the returned response. - - - The type of request DTO to map the path to. - - The path to map the request DTO to. - See RouteAttribute.Path - for details on the correct format. - - The comma-delimited list of HTTP verbs supported by the path, - such as "GET,PUT,DELETE". - - The same instance; - never . - - - - Maps the specified REST path to the specified request DTO, - specifies the HTTP verbs supported by the path, and indicates - the default MIME type of the returned response. - - - Used to rank the precedences of route definitions in reverse routing. - i.e. Priorities below 0 are auto-generated have less precedence. - - - - - Maps the specified REST path to the specified request DTO, - specifies the HTTP verbs supported by the path, and indicates - the default MIME type of the returned response. - - - The type of request DTO to map the path to. - - The path to map the request DTO to. - See RouteAttribute.Path - for details on the correct format. - - The comma-delimited list of HTTP verbs supported by the path, - such as "GET,PUT,DELETE". - - - The short summary of what the REST does. - - - The longer text to explain the behaviour of the REST. - - The same instance; - never . - - - - Used to decorate Request DTO's to associate a RESTful request - path mapping with a service. Multiple attributes can be applied to - each request DTO, to map multiple paths to the service. - - - - - Initializes an instance of the class. - - - The path template to map to the request. See - RouteAttribute.Path - for details on the correct format. - - - - - Initializes an instance of the class. - - - The path template to map to the request. See - RouteAttribute.Path - for details on the correct format. - - A comma-delimited list of HTTP verbs supported by the - service. If unspecified, all verbs are assumed to be supported. - - - - Gets or sets the path template to be mapped to the request. - - - A value providing the path mapped to - the request. Never . - - - Some examples of valid paths are: - - - "/Inventory" - "/Inventory/{Category}/{ItemId}" - "/Inventory/{ItemPath*}" - - - Variables are specified within "{}" - brackets. Each variable in the path is mapped to the same-named property - on the request DTO. At runtime, ServiceStack will parse the - request URL, extract the variable values, instantiate the request DTO, - and assign the variable values into the corresponding request properties, - prior to passing the request DTO to the service object for processing. - - It is not necessary to specify all request properties as - variables in the path. For unspecified properties, callers may provide - values in the query string. For example: the URL - "http://services/Inventory?Category=Books&ItemId=12345" causes the same - request DTO to be processed as "http://services/Inventory/Books/12345", - provided that the paths "/Inventory" (which supports the first URL) and - "/Inventory/{Category}/{ItemId}" (which supports the second URL) - are both mapped to the request DTO. - - Please note that while it is possible to specify property values - in the query string, it is generally considered to be less RESTful and - less desirable than to specify them as variables in the path. Using the - query string to specify property values may also interfere with HTTP - caching. - - The final variable in the path may contain a "*" suffix - to grab all remaining segments in the path portion of the request URL and assign - them to a single property on the request DTO. - For example, if the path "/Inventory/{ItemPath*}" is mapped to the request DTO, - then the request URL "http://services/Inventory/Books/12345" will result - in a request DTO whose ItemPath property contains "Books/12345". - You may only specify one such variable in the path, and it must be positioned at - the end of the path. - - - - - Gets or sets short summary of what the route does. - - - - - Gets or sets longer text to explain the behaviour of the route. - - - - - Gets or sets a comma-delimited list of HTTP verbs supported by the service, such as - "GET,PUT,POST,DELETE". - - - A providing a comma-delimited list of HTTP verbs supported - by the service, or empty if all verbs are supported. - - - - - Used to rank the precedences of route definitions in reverse routing. - i.e. Priorities below 0 are auto-generated have less precedence. - - - - - Fallback routes have the lowest precedence, i.e. after normal Routes, static files or any matching Catch All Handlers. - - - - - Generic ResponseStatus for when Response Type can't be inferred. - In schemaless formats like JSON, JSV it has the same shape as a typed Response DTO - - - - - A log entry added by the IRequestLogger - - - - - Decorate on Request DTO's to alter the accessibility of a service and its visibility on /metadata pages - - - - - Restrict access and metadata visibility to any of the specified access scenarios - - The restrict access to scenarios. - - - - Restrict access and metadata visibility to any of the specified access scenarios - - The restrict access to scenarios. - - - - Returns the allowed set of scenarios based on the user-specified restrictions - - - - - - - Allow access but hide from metadata to requests from Localhost only - - - - - Allow access but hide from metadata to requests from Localhost and Local Intranet only - - - - - Restrict access and hide from metadata to requests from Localhost only - - - - - Restrict access and hide from metadata to requests from Localhost and Local Intranet only - - - - - Restrict access and hide from metadata to requests from External only - - - - - Sets a single access restriction - - Restrict Access to. - - - - Restrict access to any of the specified access scenarios - - Access restrictions - - - - Sets a single metadata Visibility restriction - - Restrict metadata Visibility to. - - - - Restrict metadata visibility to any of the specified access scenarios - - Visibility restrictions - - - - Converts from a User intended restriction to a flag with all the allowed attribute flags set, e.g: - - If No Network restrictions were specified all Network access types are allowed, e.g: - restrict EndpointAttributes.None => ... 111 - - If a Network restriction was specified, only it will be allowed, e.g: - restrict EndpointAttributes.LocalSubnet => ... 010 - - The returned Enum will have a flag with all the allowed attributes set - - - - - - - Error information pertaining to a particular named field. - Used for returning multiple field validation errors.s - - - - - Common ResponseStatus class that should be present on all response DTO's - - - - - Initializes a new instance of the class. - - A response status without an errorcode == success - - - - - Initializes a new instance of the class. - - A response status with an errorcode == failure - - - - - Initializes a new instance of the class. - - A response status with an errorcode == failure - - - - - Holds the custom ErrorCode enum if provided in ValidationException - otherwise will hold the name of the Exception type, e.g. typeof(Exception).Name - - A value of non-null means the service encountered an error while processing the request. - - - - - A human friendly error message - - - - - - - - - - For multiple detailed validation errors. - Can hold a specific error message for each named field. - - - - - Write a partial content result - - - - - Whether this HttpResult allows Partial Response - - - - - Sends the specified request. - - The request. - - - - diff --git a/lib/ServiceStack.OrmLite.MySql.dll b/lib/ServiceStack.OrmLite.MySql.dll deleted file mode 100644 index 0b176e95a3a..00000000000 Binary files a/lib/ServiceStack.OrmLite.MySql.dll and /dev/null differ diff --git a/lib/ServiceStack.OrmLite.MySql.dll.config b/lib/ServiceStack.OrmLite.MySql.dll.config deleted file mode 100644 index 4a0067ef2da..00000000000 --- a/lib/ServiceStack.OrmLite.MySql.dll.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/lib/ServiceStack.OrmLite.PostgreSQL.dll b/lib/ServiceStack.OrmLite.PostgreSQL.dll deleted file mode 100644 index 02ce208d8c8..00000000000 Binary files a/lib/ServiceStack.OrmLite.PostgreSQL.dll and /dev/null differ diff --git a/lib/ServiceStack.OrmLite.SqlServer.dll b/lib/ServiceStack.OrmLite.SqlServer.dll deleted file mode 100644 index 9061c33bc11..00000000000 Binary files a/lib/ServiceStack.OrmLite.SqlServer.dll and /dev/null differ diff --git a/lib/ServiceStack.OrmLite.Sqlite.Windows.dll b/lib/ServiceStack.OrmLite.Sqlite.Windows.dll deleted file mode 100644 index 4f3533d62e1..00000000000 Binary files a/lib/ServiceStack.OrmLite.Sqlite.Windows.dll and /dev/null differ diff --git a/lib/ServiceStack.OrmLite.Sqlite.dll b/lib/ServiceStack.OrmLite.Sqlite.dll deleted file mode 100644 index de62a1274a0..00000000000 Binary files a/lib/ServiceStack.OrmLite.Sqlite.dll and /dev/null differ diff --git a/lib/ServiceStack.OrmLite.dll b/lib/ServiceStack.OrmLite.dll deleted file mode 100644 index 6eeb1d83ffb..00000000000 Binary files a/lib/ServiceStack.OrmLite.dll and /dev/null differ diff --git a/lib/ServiceStack.OrmLite.pdb b/lib/ServiceStack.OrmLite.pdb deleted file mode 100644 index a35834c106e..00000000000 Binary files a/lib/ServiceStack.OrmLite.pdb and /dev/null differ diff --git a/lib/ServiceStack.OrmLite.xml b/lib/ServiceStack.OrmLite.xml deleted file mode 100644 index 5c5c12543b2..00000000000 --- a/lib/ServiceStack.OrmLite.xml +++ /dev/null @@ -1,2240 +0,0 @@ - - - - ServiceStack.OrmLite - - - - - Tell ServiceStack to use ThreadStatic Items Collection for Context Scoped items. - Warning: ThreadStatic Items aren't pinned to the same request in async services which callback on different threads. - - - - - Gets a list of items for this context. - - - - - Clear select expression. All properties will be selected. - - - - - set the specified selectExpression. - - - raw Select expression: "Select SomeField1, SomeField2 from SomeTable" - - - - - Fields to be selected. - - - x=> x.SomeProperty1 or x=> new{ x.SomeProperty1, x.SomeProperty2} - - - objectWithProperties - - - - - Offset of the first row to return. The offset of the initial row is 0 - - - - - Number of rows returned by a SELECT statement - - - - - Set the specified offset and rows for SQL Limit clause. - - - Offset of the first row to return. The offset of the initial row is 0 - - - Number of rows returned by a SELECT statement - - - - - Set the specified offset and rows for SQL Limit clause where they exist. - - - Offset of the first row to return. The offset of the initial row is 0 - - - Number of rows returned by a SELECT statement - - - - - Set the specified rows for Sql Limit clause. - - - Number of rows returned by a SELECT statement - - - - - Clear Sql Limit clause - - - - - Clear Offset and Limit clauses. Alias for Limit() - - - - - - - Fields to be updated. - - - x=> x.SomeProperty1 or x=> new{ x.SomeProperty1, x.SomeProperty2} - - - objectWithProperties - - - - - Clear UpdateFields list ( all fields will be updated) - - - - - Fields to be inserted. - - - x=> x.SomeProperty1 or x=> new{ x.SomeProperty1, x.SomeProperty2} - - - objectWithProperties - - - - - fields to be inserted. - - - IList<string> containing Names of properties to be inserted - - - - - Clear InsertFields list ( all fields will be inserted) - - - - - Enables the efficient, dynamic composition of query predicates. - - - - - Creates a predicate that evaluates to true. - - - - - Creates a predicate that evaluates to false. - - - - - Creates a predicate expression from the specified lambda expression. - - - - - Combines the first predicate with the second using the logical "and". - - - - - Combines the first predicate with the second using the logical "or". - - - - - Negates the predicate. - - - - - Combines the first expression with the second using the specified merge function. - - - - - Create a new SqlExpression builder allowing typed LINQ-like queries. - - - - - Creates a new SqlExpression builder allowing typed LINQ-like queries. - Alias for SqlExpression. - - - - - Creates a new SqlExpression builder for the specified type using a user-defined FROM sql expression. - - - - - Open a Transaction in OrmLite - - - - - Open a Transaction in OrmLite - - - - - Returns results from using a LINQ Expression. E.g: - db.Select<Person>(x => x.Age > 40) - - - - - Returns results from using an SqlExpression lambda. E.g: - db.Select<Person>(q => q.Where(x => x.Age > 40)) - - - - - Returns results from using an SqlExpression lambda. E.g: - db.Select(db.From<Person>().Where(x => x.Age > 40)) - - - - - Project results from a number of joined tables into a different model - - - - - Project results from a number of joined tables into a different model - - - - - Returns results from using an SqlExpression lambda. E.g: - db.Select(db.From<Person>().Where(x => x.Age > 40)) - - - - - Returns a single result from using a LINQ Expression. E.g: - db.Single<Person>(x => x.Age == 42) - - - - - Returns a single result from using an SqlExpression lambda. E.g: - db.Single<Person>(q => q.Where(x => x.Age == 42)) - - - - - Returns results from using an SqlExpression lambda. E.g: - db.Select<Person>(x => x.Age > 40) - - - - - Returns a scalar result from using an SqlExpression lambda. E.g: - db.Scalar<Person, int>(x => Sql.Max(x.Age)) - - - - - Returns a scalar result from using an SqlExpression lambda. E.g: - db.Scalar<Person, int>(x => Sql.Max(x.Age), , x => x.Age < 50) - - - - - Returns the count of rows that match the LINQ expression, E.g: - db.Count<Person>(x => x.Age < 50) - - - - - Returns the count of rows that match the SqlExpression lambda, E.g: - db.Count<Person>(q => q.Where(x => x.Age < 50)) - - - - - Returns the count of rows that match the supplied SqlExpression, E.g: - db.Count(db.From<Person>().Where(x => x.Age < 50)) - - - - - Return the number of rows returned by the supplied expression - - - - - Return the number of rows returned by the supplied sql - - - - - Returns results with references from using a LINQ Expression. E.g: - db.LoadSelect<Person>(x => x.Age > 40) - - - - - Returns results with references from using an SqlExpression lambda. E.g: - db.LoadSelect<Person>(q => q.Where(x => x.Age > 40)) - - - - - Returns results with references from using an SqlExpression lambda. E.g: - db.LoadSelect(db.From<Person>().Where(x => x.Age > 40)) - - - - - Project results with references from a number of joined tables into a different model - - - - - Use an SqlExpression to select which fields to update and construct the where expression, E.g: - - db.UpdateOnly(new Person { FirstName = "JJ" }, ev => ev.Update(p => p.FirstName).Where(x => x.FirstName == "Jimi")); - UPDATE "Person" SET "FirstName" = 'JJ' WHERE ("FirstName" = 'Jimi') - - What's not in the update expression doesn't get updated. No where expression updates all rows. E.g: - - db.UpdateOnly(new Person { FirstName = "JJ", LastName = "Hendo" }, ev => ev.Update(p => p.FirstName)); - UPDATE "Person" SET "FirstName" = 'JJ' - - - - - Use an SqlExpression to select which fields to update and construct the where expression, E.g: - - var q = db.From>Person<()); - db.UpdateOnly(new Person { FirstName = "JJ" }, q.Update(p => p.FirstName).Where(x => x.FirstName == "Jimi")); - UPDATE "Person" SET "FirstName" = 'JJ' WHERE ("FirstName" = 'Jimi') - - What's not in the update expression doesn't get updated. No where expression updates all rows. E.g: - - db.UpdateOnly(new Person { FirstName = "JJ", LastName = "Hendo" }, ev.Update(p => p.FirstName)); - UPDATE "Person" SET "FirstName" = 'JJ' - - - - - Update record, updating only fields specified in updateOnly that matches the where condition (if any), E.g: - - db.UpdateOnly(new Person { FirstName = "JJ" }, p => p.FirstName, p => p.LastName == "Hendrix"); - UPDATE "Person" SET "FirstName" = 'JJ' WHERE ("LastName" = 'Hendrix') - - db.UpdateOnly(new Person { FirstName = "JJ" }, p => p.FirstName); - UPDATE "Person" SET "FirstName" = 'JJ' - - - - - Updates all non-default values set on item matching the where condition (if any). E.g - - db.UpdateNonDefaults(new Person { FirstName = "JJ" }, p => p.FirstName == "Jimi"); - UPDATE "Person" SET "FirstName" = 'JJ' WHERE ("FirstName" = 'Jimi') - - - - - Updates all values set on item matching the where condition (if any). E.g - - db.Update(new Person { Id = 1, FirstName = "JJ" }, p => p.LastName == "Hendrix"); - UPDATE "Person" SET "Id" = 1,"FirstName" = 'JJ',"LastName" = NULL,"Age" = 0 WHERE ("LastName" = 'Hendrix') - - - - - Updates all matching fields populated on anonymousType that matches where condition (if any). E.g: - - db.Update<Person>(new { FirstName = "JJ" }, p => p.LastName == "Hendrix"); - UPDATE "Person" SET "FirstName" = 'JJ' WHERE ("LastName" = 'Hendrix') - - - - - Flexible Update method to succinctly execute a free-text update statement using optional params. E.g: - - db.Update<Person>(set:"FirstName = {0}".Params("JJ"), where:"LastName = {0}".Params("Hendrix")); - UPDATE "Person" SET FirstName = 'JJ' WHERE LastName = 'Hendrix' - - - - - Flexible Update method to succinctly execute a free-text update statement using optional params. E.g. - - db.Update(table:"Person", set: "FirstName = {0}".Params("JJ"), where: "LastName = {0}".Params("Hendrix")); - UPDATE "Person" SET FirstName = 'JJ' WHERE LastName = 'Hendrix' - - - - - Insert only fields in POCO specified by the SqlExpression lambda. E.g: - db.InsertOnly(new Person { FirstName = "Amy", Age = 27 }, q => q.Insert(p => new { p.FirstName, p.Age })) - - - - - Using an SqlExpression to only Insert the fields specified, e.g: - - db.InsertOnly(new Person { FirstName = "Amy" }, q => q.Insert(p => new { p.FirstName })); - INSERT INTO "Person" ("FirstName") VALUES ('Amy'); - - - - - Delete the rows that matches the where expression, e.g: - - db.Delete<Person>(p => p.Age == 27); - DELETE FROM "Person" WHERE ("Age" = 27) - - - - - Delete the rows that matches the where expression, e.g: - - db.Delete<Person>(ev => ev.Where(p => p.Age == 27)); - DELETE FROM "Person" WHERE ("Age" = 27) - - - - - Delete the rows that matches the where expression, e.g: - - var q = db.From>Person<()); - db.Delete<Person>(q.Where(p => p.Age == 27)); - DELETE FROM "Person" WHERE ("Age" = 27) - - - - - Flexible Delete method to succinctly execute a delete statement using free-text where expression. E.g. - - db.Delete<Person>(where:"Age = {0}".Params(27)); - DELETE FROM "Person" WHERE Age = 27 - - - - - Flexible Delete method to succinctly execute a delete statement using free-text where expression. E.g. - - db.Delete(table:"Person", where: "Age = {0}".Params(27)); - DELETE FROM "Person" WHERE Age = 27 - - - - - Offset of the first row to return. The offset of the initial row is 0 - - - - - Number of rows returned by a SELECT statement - - - - - Set the specified offset and rows for SQL Limit clause. - - - Offset of the first row to return. The offset of the initial row is 0 - - - Number of rows returned by a SELECT statement - - - - - Set the specified offset and rows for SQL Limit clause where they exist. - - - Offset of the first row to return. The offset of the initial row is 0 - - - Number of rows returned by a SELECT statement - - - - - Set the specified rows for Sql Limit clause. - - - Number of rows returned by a SELECT statement - - - - - Clear Sql Limit clause - - - - - Returns results from the active connection. - - - - - Returns results from using sql. E.g: - db.Select<Person>("Age > 40") - db.Select<Person>("SELECT * FROM Person WHERE Age > 40") - - - - - Returns results from using a parameterized query. E.g: - db.Select<Person>("Age > @age", new { age = 40}) - db.Select<Person>("SELECT * FROM Person WHERE Age > @age", new { age = 40}) - - - - - Returns results from using a parameterized query. E.g: - db.Select<Person>("Age > @age", new Dictionary<string, object> { { "age", 40 } }) - db.Select<Person>("SELECT * FROM Person WHERE Age > @age", new Dictionary<string, object> { { "age", 40 } }) - - - - - Returns results from using an SqlFormat query. E.g: - db.SelectFmt<Person>("Age > {0}", 40) - db.SelectFmt<Person>("SELECT * FROM Person WHERE Age > {0}", 40) - - - - - Returns a partial subset of results from the specified tableType. E.g: - db.Select<EntityWithId>(typeof(Person)) - - - - - - Returns a partial subset of results from the specified tableType using a SqlFormat query. E.g: - db.SelectFmt<EntityWithId>(typeof(Person), "Age > {0}", 40) - - - - - Returns results from using a single name, value filter. E.g: - db.Where<Person>("Age", 27) - - - - - Returns results from using an anonymous type filter. E.g: - db.Where<Person>(new { Age = 27 }) - - - - - Returns results using the supplied primary key ids. E.g: - db.SelectByIds<Person>(new[] { 1, 2, 3 }) - - - - - Query results using the non-default values in the supplied partially populated POCO example. E.g: - db.SelectNonDefaults(new Person { Id = 1 }) - - - - - Query results using the non-default values in the supplied partially populated POCO example. E.g: - db.SelectNonDefaults("Age > @Age", new Person { Age = 42 }) - - - - - Returns a lazyily loaded stream of results. E.g: - db.SelectLazy<Person>() - - - - - Returns a lazyily loaded stream of results using a parameterized query. E.g: - db.SelectLazy<Person>("Age > @age", new { age = 40 }) - - - - - Returns a lazyily loaded stream of results using an SqlFilter query. E.g: - db.SelectLazyFmt<Person>("Age > {0}", 40) - - - - - Returns a stream of results that are lazily loaded using a parameterized query. E.g: - db.WhereLazy<Person>(new { Age = 27 }) - - - - - Returns the first result using a parameterized query. E.g: - db.Single<Person>(new { Age = 42 }) - - - - - Returns results from using a single name, value filter. E.g: - db.Single<Person>("Age = @age", new { age = 42 }) - - - - - Returns the first result using a SqlFormat query. E.g: - db.SingleFmt<Person>("Age = {0}", 42) - - - - - Returns the first result using a primary key id. E.g: - db.SingleById<Person>(1) - - - - - Returns the first result using a name, value filter. E.g: - db.SingleWhere<Person>("Age", 42) - - - - - Returns a single scalar value using an SqlExpression. E.g: - db.Column<int>(db.From<Persion>().Select(x => Sql.Count("*")).Where(q => q.Age > 40)) - - - - - Returns a single scalar value using a parameterized query. E.g: - db.Scalar<int>("SELECT COUNT(*) FROM Person WHERE Age > @age", new { age = 40 }) - - - - - Returns a single scalar value using an SqlFormat query. E.g: - db.ScalarFmt<int>("SELECT COUNT(*) FROM Person WHERE Age > {0}", 40) - - - - - Returns the distinct first column values in a HashSet using an SqlExpression. E.g: - db.Column<int>(db.From<Persion>().Select(x => x.LastName).Where(q => q.Age == 27)) - - - - - Returns the first column in a List using a SqlFormat query. E.g: - db.ColumnLazy<string>("SELECT LastName FROM Person WHERE Age = @age", new { age = 27 }) - - - - - Returns the distinct first column values in a HashSet using an SqlExpression. E.g: - db.ColumnLazy<int>(db.From<Persion>().Select(x => x.LastName).Where(q => q.Age == 27)) - - - - - Returns the first column in a List using a SqlFormat query. E.g: - db.Column<string>("SELECT LastName FROM Person WHERE Age = @age", new { age = 27 }) - - - - - Returns the first column in a List using a SqlFormat query. E.g: - db.ColumnFmt<string>("SELECT LastName FROM Person WHERE Age = {0}", 27) - - - - - - Returns the distinct first column values in a HashSet using an SqlFormat query. E.g: - db.ColumnDistinct<int>("SELECT Age FROM Person WHERE Age < @age", new { age = 50 }) - - - - - Returns the distinct first column values in a HashSet using an SqlFormat query. E.g: - db.ColumnDistinctFmt<int>("SELECT Age FROM Person WHERE Age < {0}", 50) - - - - - - Returns an Dictionary<K, List<V>> grouping made from the first two columns using an parameterized query. E.g: - db.Lookup<int, string>("SELECT Age, LastName FROM Person WHERE Age < @age", new { age = 50 }) - - - - - Returns an Dictionary<K, List<V>> grouping made from the first two columns using an SqlFormat query. E.g: - db.LookupFmt<int, string>("SELECT Age, LastName FROM Person WHERE Age < {0}", 50) - - - - - - Returns a Dictionary from the first 2 columns: Column 1 (Keys), Column 2 (Values) using sql. E.g: - db.Dictionary<int, string>("SELECT Id, LastName FROM Person WHERE Age < @age", new { age = 50 }) - - - - - Returns a Dictionary from the first 2 columns: Column 1 (Keys), Column 2 (Values) using an SqlFormat query. E.g: - db.DictionaryFmt<int, string>("SELECT Id, LastName FROM Person WHERE Age < {0}", 50) - - - - - Returns true if the Query returns any records that match the LINQ expression, E.g: - db.Exists<Person>(x => x.Age < 50) - - - - - Returns true if the Query returns any records that match the SqlExpression lambda, E.g: - db.Exists<Person>(q => q.Where(x => x.Age < 50)) - - - - - Returns true if the Query returns any records that match the supplied SqlExpression, E.g: - db.Exists(db.From<Person>().Where(x => x.Age < 50)) - - - - - Returns true if the Query returns any records, using an SqlFormat query. E.g: - db.Exists<Person>(new { Age = 42 }) - - - - - Returns true if the Query returns any records, using a parameterized query. E.g: - db.Exists<Person>("Age = @age", new { age = 42 }) - db.Exists<Person>("SELECT * FROM Person WHERE Age = @age", new { age = 42 }) - - - - - Returns true if the Query returns any records, using an SqlFormat query. E.g: - db.ExistsFmt<Person>("Age = {0}", 42) - db.ExistsFmt<Person>("SELECT * FROM Person WHERE Age = {0}", 50) - - - - - Returns results from an arbitrary SqlExpression. E.g: - db.SqlList<Person>(db.From<Person>().Select("*").Where(q => q.Age < 50)) - - - - - Returns results from an arbitrary parameterized raw sql query. E.g: - db.SqlList<Person>("EXEC GetRockstarsAged @age", new { age = 50 }) - - - - - Returns results from an arbitrary parameterized raw sql query. E.g: - db.SqlList<Person>("EXEC GetRockstarsAged @age", new Dictionary<string, object> { { "age", 42 } }) - - - - - Returns results from an arbitrary parameterized raw sql query with a dbCmd filter. E.g: - db.SqlList<Person>("EXEC GetRockstarsAged @age", dbCmd => ...) - - - - - Prepare Stored Procedure with Input parameters, optionally populated with Input Params. E.g: - var cmd = db.SqlProc("GetRockstarsAged", new { age = 42 }) - - - - - - Returns the first column in a List using a parameterized query. E.g: - db.SqlColumn<string>("SELECT LastName FROM Person WHERE Age < @age", new { age = 50 }) - - - - - Returns the first column in a List using a parameterized query. E.g: - db.SqlColumn<string>("SELECT LastName FROM Person WHERE Age < @age", new Dictionary<string, object> { { "age", 50 } }) - - - - - Returns a single Scalar value using an SqlExpression. E.g: - db.SqlScalar<int>(db.From<Person>().Select(Sql.Count("*")).Where(q => q.Age < 50)) - - - - - Returns a single Scalar value using a parameterized query. E.g: - db.SqlScalar<int>("SELECT COUNT(*) FROM Person WHERE Age < @age", new { age = 50 }) - - - - - Returns a single Scalar value using a parameterized query. E.g: - db.SqlScalar<int>("SELECT COUNT(*) FROM Person WHERE Age < @age", new Dictionary<string, object> { { "age", 50 } }) - - - - - Returns the last insert Id made from this connection. - - - - - Executes a raw sql non-query using sql. E.g: - var rowsAffected = db.ExecuteNonQuery("UPDATE Person SET LastName={0} WHERE Id={1}".SqlFormat("WaterHouse", 7)) - - number of rows affected - - - - Executes a raw sql non-query using a parameterized query. E.g: - var rowsAffected = db.ExecuteNonQuery("UPDATE Person SET LastName=@name WHERE Id=@id", new { name = "WaterHouse", id = 7 }) - - number of rows affected - - - - Executes a raw sql non-query using a parameterized query. - - number of rows affected - - - - Returns results from a Stored Procedure, using a parameterized query. - - - - - Returns results from a Stored Procedure using an SqlFormat query. E.g: - - - - - - Returns the scalar result as a long. - - - - - Returns the first result with all its references loaded, using a primary key id. E.g: - db.LoadSingleById<Person>(1) - - - - - Loads all the related references onto the instance. E.g: - db.LoadReferences(customer) - - - - - Checks whether a Table Exists. E.g: - db.TableExists("Person") - - - - - Checks whether a Table Exists. E.g: - db.TableExists<Person>() - - - - - Create DB Tables from the schemas of runtime types. E.g: - db.CreateTables(typeof(Table1), typeof(Table2)) - - - - - Create DB Table from the schema of the runtime type. Use overwrite to drop existing Table. E.g: - db.CreateTable(true, typeof(Table)) - - - - - Only Create new DB Tables from the schemas of runtime types if they don't already exist. E.g: - db.CreateTableIfNotExists(typeof(Table1), typeof(Table2)) - - - - - Drop existing DB Tables and re-create them from the schemas of runtime types. E.g: - db.DropAndCreateTables(typeof(Table1), typeof(Table2)) - - - - - Create a DB Table from the generic type. Use overwrite to drop the existing table or not. E.g: - db.CreateTable<Person>(overwrite=false) //default - db.CreateTable<Person>(overwrite=true) - - - - - Only create a DB Table from the generic type if it doesn't already exist. E.g: - db.CreateTableIfNotExists<Person>() - - - - - Only create a DB Table from the runtime type if it doesn't already exist. E.g: - db.CreateTableIfNotExists(typeof(Person)) - - - - - Drop existing table if exists and re-create a DB Table from the generic type. E.g: - db.DropAndCreateTable<Person>() - - - - - Drop existing table if exists and re-create a DB Table from the runtime type. E.g: - db.DropAndCreateTable(typeof(Person)) - - - - - Drop any existing tables from their runtime types. E.g: - db.DropTables(typeof(Table1),typeof(Table2)) - - - - - Drop any existing tables from the runtime type. E.g: - db.DropTable(typeof(Person)) - - - - - Drop any existing tables from the generic type. E.g: - db.DropTable<Person>() - - - - - Get the last SQL statement that was executed. - - - - - Execute any arbitrary raw SQL. - - number of rows affected - - - - Insert 1 POCO, use selectIdentity to retrieve the last insert AutoIncrement id (if any). E.g: - var id = db.Insert(new Person { Id = 1, FirstName = "Jimi }, selectIdentity:true) - - - - - Insert 1 or more POCOs in a transaction. E.g: - db.Insert(new Person { Id = 1, FirstName = "Tupac", LastName = "Shakur", Age = 25 }, - new Person { Id = 2, FirstName = "Biggie", LastName = "Smalls", Age = 24 }) - - - - - Insert a collection of POCOs in a transaction. E.g: - db.InsertAll(new[] { new Person { Id = 9, FirstName = "Biggie", LastName = "Smalls", Age = 24 } }) - - - - - Updates 1 POCO. All fields are updated except for the PrimaryKey which is used as the identity selector. E.g: - db.Update(new Person { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 }) - - - - - Updates 1 or more POCOs in a transaction. E.g: - db.Update(new Person { Id = 1, FirstName = "Tupac", LastName = "Shakur", Age = 25 }, - new Person { Id = 2, FirstName = "Biggie", LastName = "Smalls", Age = 24 }) - - - - - Updates 1 or more POCOs in a transaction. E.g: - db.UpdateAll(new[] { new Person { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 } }) - - - - - Delete rows using an anonymous type filter. E.g: - db.Delete<Person>(new { FirstName = "Jimi", Age = 27 }) - - number of rows deleted - - - - Delete 1 or more rows in a transaction using an anonymous type filter. E.g: - db.Delete<Person>(new { FirstName = "Jimi", Age = 27 }, new { FirstName = "Janis", Age = 27 }) - - - - - Delete 1 row using all fields in the filter. E.g: - db.Delete(new Person { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 }) - - number of rows deleted - - - - Delete 1 or more rows in a transaction using all fields in the filter. E.g: - db.Delete(new Person { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 }) - - - - - Delete 1 or more rows using only field with non-default values in the filter. E.g: - db.DeleteNonDefaults(new Person { FirstName = "Jimi", Age = 27 }) - - number of rows deleted - - - - Delete 1 or more rows in a transaction using only field with non-default values in the filter. E.g: - db.DeleteNonDefaults(new Person { FirstName = "Jimi", Age = 27 }, - new Person { FirstName = "Janis", Age = 27 }) - - number of rows deleted - - - - Delete 1 row by the PrimaryKey. E.g: - db.DeleteById<Person>(1) - - number of rows deleted - - - - Delete 1 row by the PrimaryKey where the rowVersion matches the optimistic concurrency field. - Will throw RowModefiedExeption if the - row does not exist or has a different row version. - E.g: db.DeleteById<Person>(1) - - - - - Delete all rows identified by the PrimaryKeys. E.g: - db.DeleteById<Person>(new[] { 1, 2, 3 }) - - number of rows deleted - - - - Delete all rows in the generic table type. E.g: - db.DeleteAll<Person>() - - number of rows deleted - - - - Delete all rows in the runtime table type. E.g: - db.DeleteAll(typeof(Person)) - - number of rows deleted - - - - Delete rows using a SqlFormat filter. E.g: - - number of rows deleted - - - - Delete rows from the runtime table type using a SqlFormat filter. E.g: - - db.DeleteFmt(typeof(Person), "Age = {0}", 27) - number of rows deleted - - - - Insert a new row or update existing row. Returns true if a new row was inserted. - Optional references param decides whether to save all related references as well. E.g: - db.Save(customer, references:true) - - true if a row was inserted; false if it was updated - - - - Insert new rows or update existing rows. Return number of rows added E.g: - db.Save(new Person { Id = 10, FirstName = "Amy", LastName = "Winehouse", Age = 27 }) - - number of rows added - - - - Insert new rows or update existing rows. Return number of rows added E.g: - db.SaveAll(new [] { new Person { Id = 10, FirstName = "Amy", LastName = "Winehouse", Age = 27 } }) - - number of rows added - - - - Populates all related references on the instance with its primary key and saves them. Uses '(T)Id' naming convention. E.g: - db.SaveAllReferences(customer) - - - - - Populates the related references with the instance primary key and saves them. Uses '(T)Id' naming convention. E.g: - db.SaveReference(customer, customer.Orders) - - - - - Populates the related references with the instance primary key and saves them. Uses '(T)Id' naming convention. E.g: - db.SaveReference(customer, customer.Orders) - - - - - Populates the related references with the instance primary key and saves them. Uses '(T)Id' naming convention. E.g: - db.SaveReferences(customer, customer.Orders) - - - - - Wrapper IDbConnection class to allow for connection sharing, mocking, etc. - - - - - Allow for mocking and unit testing by providing non-disposing - connection factory with injectable IDbCommand and IDbTransaction proxies - - - - - Force the IDbConnection to always return this IDbCommand - - - - - Force the IDbConnection to always return this IDbTransaction - - - - - Alias for OpenDbConnection - - - - - Alias for OpenDbConnection - - - - - Allow for code-sharing between OrmLite, IPersistenceProvider and ICacheClient - - - - - Quote the string so that it can be used inside an SQL-expression - Escape quotes inside the string - - - - - - - Populates row fields during re-hydration of results. - - - - Fmt - - - - Nice SqlBuilder class by @samsaffron from Dapper.Contrib: - http://samsaffron.com/archive/2011/09/05/Digging+ourselves+out+of+the+mess+Linq-2-SQL+created - Modified to work in .NET 3.5 - - - - - Additional state flags that control command behaviour - - - - - No additonal flags - - - - - Should data be buffered before returning? - - - - - Can async queries be pipelined? - - - - - Should the plan cache be bypassed? - - - - - Represents the key aspects of a sql operation - - - - - Initialize the command definition - - - - - The command (sql or a stored-procedure name) to execute - - - - - The parameters associated with the command - - - - - The active transaction for the command - - - - - The effective timeout for the command - - - - - The type of command that the command-text represents - - - - - Should data be buffered before returning? - - - - - Should the plan for this query be cached? - - - - - Additional state flags against this command - - - - - Can async queries be pipelined? - - - - - Dapper, a light weight object mapper for ADO.NET - - - - - Key used to indicate the type name associated with a DataTable - - - - - Purge the query cache - - - - - Return a count of all the cached queries by dapper - - - - - - Return a list of all the queries cached by dapper - - - - - - - Deep diagnostics only: find any hash collisions in the cache - - - - - - Clear the registered type handlers - - - - - Configire the specified type to be mapped to a given db-type - - - - - Configire the specified type to be processed by a custom handler - - - - - Configire the specified type to be processed by a custom handler - - - - - Configire the specified type to be processed by a custom handler - - - - - Get the DbType that maps to a given value - - - - - Execute parameterized SQL - - Number of rows affected - - - - Execute parameterized SQL - - Number of rows affected - - - - Execute parameterized SQL that selects a single value - - The first cell selected - - - - Execute parameterized SQL that selects a single value - - The first cell selected - - - - Execute parameterized SQL that selects a single value - - The first cell selected - - - - Execute parameterized SQL that selects a single value - - The first cell selected - - - - Execute parameterized SQL and return an - - An that can be used to iterate over the results of the SQL query. - - This is typically used when the results of a query are not processed by Dapper, for example, used to fill a DataTable or DataSet. - - - - - - - - - - Execute parameterized SQL and return an - - An that can be used to iterate over the results of the SQL query. - - This is typically used when the results of a query are not processed by Dapper, for example, used to fill a DataTable or DataSet. - - - - - Execute parameterized SQL and return an - - An that can be used to iterate over the results of the SQL query. - - This is typically used when the results of a query are not processed by Dapper, for example, used to fill a DataTable or DataSet. - - - - - Return a list of dynamic objects, reader is closed after the call - - - - - Executes a query, returning the data typed as per T - - the dynamic param may seem a bit odd, but this works around a major usability issue in vs, if it is Object vs completion gets annoying. Eg type new [space] get new object - A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is - created per row, and a direct column-name===member-name mapping is assumed (case insensitive). - - - - - Executes a query, returning the data typed as per the Type suggested - - A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is - created per row, and a direct column-name===member-name mapping is assumed (case insensitive). - - - - - Executes a query, returning the data typed as per T - - the dynamic param may seem a bit odd, but this works around a major usability issue in vs, if it is Object vs completion gets annoying. Eg type new [space] get new object - A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is - created per row, and a direct column-name===member-name mapping is assumed (case insensitive). - - - - - Execute a command that returns multiple result sets, and access each in turn - - - - - Execute a command that returns multiple result sets, and access each in turn - - - - - Maps a query to objects - - The first type in the recordset - The second type in the recordset - The return type - - - - - - - The Field we should split and read the second object from (default: id) - Number of seconds before command execution timeout - Is it a stored proc or a batch? - - - - - Maps a query to objects - - - - - - - - - - - - The Field we should split and read the second object from (default: id) - Number of seconds before command execution timeout - - - - - - Perform a multi mapping query with 4 input parameters - - - - - - - - - - - - - - - - - - - - Perform a multi mapping query with 5 input parameters - - - - - - - - - - - - - - - - - - - - - Perform a multi mapping query with 6 input parameters - - - - - - - - - - - - - - - - - - - - - - Perform a multi mapping query with 7 input parameters - - - - - - - - - - - - - - - - - - - - - - - Perform a multi mapping query with arbitrary input parameters - - The return type - - - array of types in the recordset - - - - - The Field we should split and read the second object from (default: id) - Number of seconds before command execution timeout - Is it a stored proc or a batch? - - - - - Internal use only - - - - - - - Internal use only - - - - - Internal use only - - - - - Internal use only - - - - - Replace all literal tokens with their text form - - - - - Convert numeric values to their string form for SQL literal purposes - - - - - Internal use only - - - - - Gets type-map for the given type - - Type map implementation, DefaultTypeMap instance if no override present - - - - Set custom mapping for type deserializers - - Entity type to override - Mapping rules impementation, null to remove custom map - - - - Internal use only - - - - - - - - - - - Throws a data exception, only used internally - - - - - Called if the query cache is purged via PurgeQueryCache - - - - - How should connection strings be compared for equivalence? Defaults to StringComparer.Ordinal. - Providing a custom implementation can be useful for allowing multi-tenancy databases with identical - schema to share startegies. Note that usual equivalence rules apply: any equivalent connection strings - MUST yield the same hash-code. - - - - - Implement this interface to pass an arbitrary db specific set of parameters to Dapper - - - - - Add all the parameters needed to the command just before it executes - - The raw command prior to execution - Information about the query - - - - Extends IDynamicParameters providing by-name lookup of parameter values - - - - - Get the value of the specified parameter (return null if not found) - - - - - Extends IDynamicParameters with facitilies for executing callbacks after commands have completed - - - - - Invoked when the command has executed - - - - - Implement this interface to pass an arbitrary db specific parameter to Dapper - - - - - Add the parameter needed to the command before it executes - - The raw command prior to execution - Parameter name - - - - Implement this interface to perform custom type-based parameter handling and value parsing - - - - - Assign the value of a parameter before a command executes - - The parameter to configure - Parameter value - - - - Parse a database value back to a typed value - - The value from the database - The type to parse to - The typed value - - - - A type handler for data-types that are supported by the underlying provider, but which need - a well-known UdtTypeName to be specified - - - - - Creates a new instance of UdtTypeHandler with the specified UdtTypeName - - - - - Base-class for simple type-handlers - - - - - Assign the value of a parameter before a command executes - - The parameter to configure - Parameter value - - - - Parse a database value back to a typed value - - The value from the database - The typed value - - - - Implement this interface to change default mapping of reader columns to type memebers - - - - - Finds best constructor - - DataReader column names - DataReader column types - Matching constructor or default one - - - - Gets mapping for constructor parameter - - Constructor to resolve - DataReader column name - Mapping implementation - - - - Gets member mapping for column - - DataReader column name - Mapping implementation - - - - Implements this interface to provide custom member mapping - - - - - Source DataReader column name - - - - - Target member type - - - - - Target property - - - - - Target field - - - - - Target constructor parameter - - - - - This is a micro-cache; suitable when the number of terms is controllable (a few hundred, for example), - and strictly append-only; you cannot change existing values. All key matches are on **REFERENCE** - equality. The type is fully thread-safe. - - - - - Not intended for direct usage - - - - - Not intended for direct usage - - - - - Not intended for direct usage - - - - - Identity of a cached query in Dapper, used for extensability - - - - - Create an identity for use with DynamicParameters, internal use only - - - - - - - - - - - - - - The sql - - - - - The command type - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compare 2 Identity objects - - - - - - - Represents a placeholder for a value that should be replaced as a literal value in the resulting sql - - - - - The text in the original command that should be replaced - - - - - The name of the member referred to by the token - - - - - The grid reader provides interfaces for reading multiple result sets from a Dapper query - - - - - Read the next grid of results, returned as a dynamic object - - - - - Read the next grid of results - - - - - Read the next grid of results - - - - - Read multiple objects from a single recordset on the grid - - - - - Read multiple objects from a single recordset on the grid - - - - - Read multiple objects from a single record set on the grid - - - - - Read multiple objects from a single record set on the grid - - - - - Read multiple objects from a single record set on the grid - - - - - Read multiple objects from a single record set on the grid - - - - - Dispose the grid, closing and disposing both the underlying reader and command. - - - - - Has the underlying reader been consumed? - - - - - A bag of parameters that can be passed to the Dapper Query and Execute methods - - - - - construct a dynamic parameter bag - - - - - construct a dynamic parameter bag - - can be an anonymous type or a DynamicParameters bag - - - - Append a whole object full of params to the dynamic - EG: AddDynamicParams(new {A = 1, B = 2}) // will add property A and B to the dynamic - - - - - - Add a parameter to this dynamic parameter list - - - - - - - - - - Add all the parameters needed to the command just before it executes - - The raw command prior to execution - Information about the query - - - - Get the value of a parameter - - - - The value, note DBNull.Value is not returned, instead the value is returned as null - - - - Allows you to automatically populate a target property/field from output parameters. It actually - creates an InputOutput parameter, so you can still pass data in. - - - The object whose property/field you wish to populate. - A MemberExpression targeting a property/field of the target (or descendant thereof.) - - The size to set on the parameter. Defaults to 0, or DbString.DefaultLength in case of strings. - The DynamicParameters instance - - - - If true, the command-text is inspected and only values that are clearly used are included on the connection - - - - - All the names of the param in the bag, use Get to yank them out - - - - - This class represents a SQL string, it can be used if you need to denote your parameter is a Char vs VarChar vs nVarChar vs nChar - - - - - A value to set the default value of strings - going through Dapper. Default is 4000, any value larger than this - field will not have the default value applied. - - - - - Create a new DbString - - - - - Add the parameter to the command... internal use only - - - - - - - Ansi vs Unicode - - - - - Fixed length - - - - - Length of the string -1 for max - - - - - The value of the string - - - - - Handles variances in features per DBMS - - - - - Gets the featureset based on the passed connection - - - - - True if the db supports array columns e.g. Postgresql - - - - - Represents simple memeber map for one of target parameter or property or field to source DataReader column - - - - - Creates instance for simple property mapping - - DataReader column name - Target property - - - - Creates instance for simple field mapping - - DataReader column name - Target property - - - - Creates instance for simple constructor parameter mapping - - DataReader column name - Target constructor parameter - - - - DataReader column name - - - - - Target member type - - - - - Target property - - - - - Target field - - - - - Target constructor parameter - - - - - Represents default type mapping strategy used by Dapper - - - - - Creates default type map - - Entity type - - - - Finds best constructor - - DataReader column names - DataReader column types - Matching constructor or default one - - - - Gets mapping for constructor parameter - - Constructor to resolve - DataReader column name - Mapping implementation - - - - Gets member mapping for column - - DataReader column name - Mapping implementation - - - - Should column names like User_Id be allowed to match properties/fields like UserId ? - - - - - Implements custom property mapping by user provided criteria (usually presence of some custom attribute with column to member mapping) - - - - - Creates custom property mapping - - Target entity type - Property selector based on target type and DataReader column name - - - - Always returns default constructor - - DataReader column names - DataReader column types - Default constructor - - - - Not impelmeneted as far as default constructor used for all cases - - - - - - - - Returns property based on selector strategy - - DataReader column name - Poperty member map - - - diff --git a/lib/ServiceStack.Pcl.Net45.dll b/lib/ServiceStack.Pcl.Net45.dll deleted file mode 100644 index 1d289b87225..00000000000 Binary files a/lib/ServiceStack.Pcl.Net45.dll and /dev/null differ diff --git a/lib/ServiceStack.Pcl.WinStore.dll b/lib/ServiceStack.Pcl.WinStore.dll deleted file mode 100644 index 51ebd33ce17..00000000000 Binary files a/lib/ServiceStack.Pcl.WinStore.dll and /dev/null differ diff --git a/lib/ServiceStack.Pcl.WinStore.pri b/lib/ServiceStack.Pcl.WinStore.pri deleted file mode 100644 index a3071fe88d3..00000000000 Binary files a/lib/ServiceStack.Pcl.WinStore.pri and /dev/null differ diff --git a/lib/ServiceStack.Razor.BuildTask.dll b/lib/ServiceStack.Razor.BuildTask.dll deleted file mode 100644 index 77a54a9ee93..00000000000 Binary files a/lib/ServiceStack.Razor.BuildTask.dll and /dev/null differ diff --git a/lib/ServiceStack.Redis.XML b/lib/ServiceStack.Redis.XML deleted file mode 100644 index 1b460938ad0..00000000000 --- a/lib/ServiceStack.Redis.XML +++ /dev/null @@ -1,1382 +0,0 @@ - - - - ServiceStack.Redis - - - - - Provides thread-safe retrievel of redis clients since each client is a new one. - Allows the configuration of different ReadWrite and ReadOnly hosts - - - BasicRedisClientManager for ICacheClient - - For more interoperabilty I'm also implementing the ICacheClient on - this cache client manager which has the affect of calling - GetCacheClient() for all write operations and GetReadOnlyCacheClient() - for the read ones. - - This works well for master-slave replication scenarios where you have - 1 master that replicates to multiple read slaves. - - - - - Hosts can be an IP Address or Hostname in the format: host[:port] - e.g. 127.0.0.1:6379 - default is: localhost:6379 - - The write hosts. - The read hosts. - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. - - - - - - Gets or sets object key prefix. - - - - - Courtesy of @marcgravell - http://code.google.com/p/protobuf-net/source/browse/trunk/protobuf-net/BufferPool.cs - - - - - Provides thread-safe pooling of redis client connections. - - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Called within a lock - - - - - - Disposes the write client. - - The client. - - - - The client wraps the native redis operations into a more readable c# API. - - Where possible these operations are also exposed in common c# interfaces, - e.g. RedisClient.Lists => IList[string] - RedisClient.Sets => ICollection[string] - - - - - This class contains all the common operations for the RedisClient. - The client contains a 1:1 mapping of c# methods to redis operations of the same name. - - Not threadsafe use a pooled manager - - - - - Requires custom result parsing - - Number of results - - - - Command to set multuple binary safe arguments - - - - - - - reset buffer index in send buffer - - - - - Used to manage connection pooling - - - - - Gets or sets object key prefix. - - - - - Creates a new instance of the Redis Client from NewFactoryFn. - - - - - Alias for GetValue - - - - - Returns key with automatic object id detection in provided value with generic type. - - - - - - - Returns key with explicit object id. - - - - - - - Returns key with explicit object type and id. - - - - - - - - A complete redis command, with method to send command, receive response, and run callback on success or failure - - - - - Allows you to get Redis value operations to operate against POCO types. - - - - - - Use this to share the same redis connection with another - - The client. - - - - Pipeline for redis typed client - - - - - - Queue of commands for redis typed client - - - - - - Redis operation (transaction/pipeline) that allows queued commands to be completed - - - - - For interoperabilty GetCacheClient() and GetReadOnlyCacheClient() - return an ICacheClient wrapper around the redis manager which has the affect of calling - GetClient() for all write operations and GetReadOnlyClient() for the read ones. - - This works well for master-slave replication scenarios where you have - 1 master that replicates to multiple read slaves. - - - - - Ignore dispose on RedisClientsManager, which should be registered as a singleton - - - - - Useful wrapper IRedisClientsManager to cut down the boiler plate of most IRedisClient access - - - - - Creates a PubSubServer that uses a background thread to listen and process for - Redis Pub/Sub messages published to the specified channel. - Use optional callbacks to listen for message, error and life-cycle events. - Callbacks can be assigned later, then call Start() for PubSubServer to start listening for messages - - - - - A complete redis command, with method to send command, receive response, and run callback on success or failure - - - - - Redis command that does not get queued - - - - - Initialize channel and register client manager - - - - - - Check if GetValidSentinel should try the next sentinel server - - - This will be true if the failures is less than either RedisSentinel.MaxFailures or the # of sentinels, whatever is greater - - - - Raised if there is an error from a sentinel worker - - - - - - - Event that is fired when the sentinel subscription raises an event - - - - - - - Does a sentinel check for masters and slaves and either sets up or fails over to the new config - - - - - Takes output from sentinel slaves command and converts into a list of servers - - - - - - - Takes output from sentinel master command and converts into a list of servers - - - - - - - Provides a redis connection pool that can be sharded - - - - - Provides thread-safe pooling of redis client connections. - Allows load-balancing of master-write and read-slave hosts, ideal for - 1 master and multiple replicated read slaves. - - - - - Hosts can be an IP Address or Hostname in the format: host[:port] - e.g. 127.0.0.1:6379 - default is: localhost:6379 - - The write hosts. - The read hosts. - The config. - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Called within a lock - - - - - - Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. - - - - - - Called within a lock - - - - - - Disposes the read only client. - - The client. - - - - Disposes the write client. - - The client. - - - - Gets or sets object key prefix. - - - - - Manage a client acquired from the PooledRedisClientManager - Dispose method will release the client back to the pool. - - - - - wrap the acquired client - - - - - - release the wrapped client back to the pool - - - - - access the wrapped client - - - - - logical name - - - - - An arbitrary weight relative to other nodes - - - - logical name - An arbitrary weight relative to other nodes - redis nodes - - - - Provides sharding of redis client connections. - uses consistent hashing to distribute keys across connection pools - - - - - maps a key to a redis connection pool - - key to map - a redis connection pool - - - - Adds a node and maps points across the circle - - node to add - An arbitrary number, specifies how often it occurs relative to other targets. - - - - A variation of Binary Search algorithm. Given a number, matches the next highest number from the sorted array. - If a higher number does not exist, then the first number in the array is returned. - - a sorted array to perform the search - number to find the next highest number against - next highest number - - - - Given a key, generates an unsigned 64 bit hash code using MD5 - - - - - - - Provides access to the method reflection data as part of the before/after event - - - - - Stores details about the context in which an IRedisClient is allocated. - - - - - - Tracks each IRedisClient instance allocated from the IRedisClientsManager logging when they are allocated and disposed. - Periodically writes the allocated instances to the log for diagnostic purposes. - - - - - Distributed lock interface - - - - - Optimized implementation. Primitive types are manually serialized, the rest are serialized using binary serializer />. - - - - - serialize/deserialize arbitrary objects - (objects must be serializable) - - - - - Serialize object to buffer - - serializable object - - - - - Deserialize buffer to object - - byte array to deserialize - - - - - - - - - - - - - - - - - - - serialize value and wrap with - - - - - - - Unwrap object wrapped in - - - - - - - pop numProcessed items from queue and unlock queue for work item id that dequeued - items are associated with - - - - - - A dequeued work item has been processed. When all of the dequeued items have been processed, - all items will be popped from the queue,and the queue unlocked for the work item id that - the dequeued items are associated with - - - - - Update first unprocessed item with new work item. - - - - - - - - - - - distributed work item queue. Each message must have an associated - work item id. For a given id, all work items are guaranteed to be processed - in the order in which they are received. - - - - - distributed work item queue. Each message must have an associated - work item id. For a given id, all work items are guaranteed to be processed - in the order in which they are received. - - - - - - - distributed work item queue - - - - - Enqueue item in priority queue corresponding to workItemId identifier - - - - - - - Preprare next work item id for dequeueing - - - - - Dequeue up to maxBatchSize items from queue corresponding to workItemId identifier. - Once this method is called, or will not - return any items for workItemId until the dequeue lock returned is unlocked. - - - - - - - - Replace existing work item in workItemId queue - - - - - - - - Queue incoming messages - - - - - - - Must call this periodically to move work items from priority queue to pending queue - - - - - Replace existing work item in workItemId queue - - - - - - - - Pop items from list - - - - - - - Force release of locks held by crashed servers - - - - - release lock held by crashed server - - - - true if lock is released, either by this method or by another client; false otherwise - - - - Unlock work item id, so other servers can process items for this id - - - - - - - - - - - - - - - - - - - - - - - - - - - pop remaining items that were returned by dequeue, and unlock queue - - - - - - indicate that an item has been processed by the caller - - - - - Update first unprocessed work item - - - - - - wraps a serialized representation of an object - - - - - - Initializes a new instance of . - - Custom item data. - The serialized item. - - - - The data representing the item being stored/retireved. - - - - - Flags set for this instance. - - - - - distributed lock class that follows the Resource Allocation Is Initialization pattern - - - - - Lock - - - - in seconds - in seconds - - - - unlock - - - - - Enqueue item - - - - - - Dequeue up to maxBatchSize items from queue - - - - - - - distributed work item queue. Messages are processed in chronological order - - - - - Enqueue incoming messages - - - - - - - - Dequeue next batch of work items - - - - - - - - - simple distributed work item queue - - - - - - - Queue incoming messages - - - - - - Dequeue next batch of work items for processing. After this method is called, - no other work items with same id will be available for - dequeuing until PostDequeue is called - - KeyValuePair: key is work item id, and value is list of dequeued items. - - - - - Serialize object to buffer - - serializable object - - - - - - - array of serializable objects - - - - - Deserialize buffer to object - - byte array to deserialize - - - - - - customize the client serializer - - - - - Factory to create SerializingRedisClient objects - - - - - - - - - General purpose pipeline - - - - - - Flush send buffer, and read responses - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Adds support for Redis Transactions (i.e. MULTI/EXEC/DISCARD operations). - - - - - Put "QUEUED" messages at back of queue - - - - - - Issue exec command (not queued) - - - - - callback for after result count is read in - - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Redis-specific exception. Thrown if unable to connect to Redis server due to socket exception, for example. - - - - - Adds support for Redis Transactions (i.e. MULTI/EXEC/DISCARD operations). - - - - - Put "QUEUED" messages at back of queue - - - - - - Issue exec command (not queued) - - - - - callback for after result count is read in - - - - - - Provide the default factory implementation for creating a RedisClient that - can be mocked and used by different 'Redis Client Managers' - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Provide the factory implementation for creating a RedisCacheClient that - can be mocked and used by different 'Redis Client Managers' - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Wrap the common redis list operations under a IList[string] interface. - - - - - Represents a generic collection of key/value pairs that are ordered independently of the key and value. - - The type of the keys in the dictionary - The type of the values in the dictionary - - - - Adds an entry with the specified key and value into the IOrderedDictionary<TKey,TValue> collection with the lowest available index. - - The key of the entry to add. - The value of the entry to add. - The index of the newly added entry - - You can also use the property to add new elements by setting the value of a key that does not exist in the IOrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the IOrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. - An element with the same key already exists in the IOrderedDictionary<TKey,TValue> - The IOrderedDictionary<TKey,TValue> is read-only.
      - -or-
      - The IOrderedDictionary<TKey,TValue> has a fized size.
      -
      - - - Inserts a new entry into the IOrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. - - The zero-based index at which the element should be inserted. - The key of the entry to add. - The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. - is less than 0.
      - -or-
      - is greater than .
      - An element with the same key already exists in the IOrderedDictionary<TKey,TValue>. - The IOrderedDictionary<TKey,TValue> is read-only.
      - -or-
      - The IOrderedDictionary<TKey,TValue> has a fized size.
      -
      - - - Gets or sets the value at the specified index. - - The zero-based index of the value to get or set. - The value of the item at the specified index. - is less than 0.
      - -or-
      - is equal to or greater than .
      -
      - - - Represents a generic collection of key/value pairs that are ordered independently of the key and value. - - The type of the keys in the dictionary - The type of the values in the dictionary - - - - Initializes a new instance of the OrderedDictionary<TKey,TValue> class. - - - - - Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified initial capacity. - - The initial number of elements that the OrderedDictionary<TKey,TValue> can contain. - is less than 0 - - - - Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified comparer. - - The IEqualityComparer<TKey> to use when comparing keys, or to use the default EqualityComparer<TKey> for the type of the key. - - - - Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified initial capacity and comparer. - - The initial number of elements that the OrderedDictionary<TKey,TValue> collection can contain. - The IEqualityComparer<TKey> to use when comparing keys, or to use the default EqualityComparer<TKey> for the type of the key. - is less than 0 - - - - Converts the object passed as a key to the key type of the dictionary - - The key object to check - The key object, cast as the key type of the dictionary - is . - The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . - - - - Converts the object passed as a value to the value type of the dictionary - - The object to convert to the value type of the dictionary - The value object, converted to the value type of the dictionary - is , and the value type of the OrderedDictionary<TKey,TValue> is a value type. - The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . - - - - Inserts a new entry into the OrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. - - The zero-based index at which the element should be inserted. - The key of the entry to add. - The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. - is less than 0.
      - -or-
      - is greater than .
      - is . - An element with the same key already exists in the OrderedDictionary<TKey,TValue>. -
      - - - Inserts a new entry into the OrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. - - The zero-based index at which the element should be inserted. - The key of the entry to add. - The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. - is less than 0.
      - -or-
      - is greater than .
      - is .
      - -or-
      - is , and the value type of the OrderedDictionary<TKey,TValue> is a value type.
      - The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      - -or-
      - The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      - -or-
      - An element with the same key already exists in the OrderedDictionary<TKey,TValue>.
      -
      - - - Removes the entry at the specified index from the OrderedDictionary<TKey,TValue> collection. - - The zero-based index of the entry to remove. - is less than 0.
      - -or-
      - index is equal to or greater than .
      -
      - - - Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. - - The key of the entry to add. - The value of the entry to add. This value can be . - A key cannot be , but a value can be. - You can also use the property to add new elements by setting the value of a key that does not exist in the OrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the OrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. - is - An element with the same key already exists in the OrderedDictionary<TKey,TValue> - - - - Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. - - The key of the entry to add. - The value of the entry to add. This value can be . - The index of the newly added entry - A key cannot be , but a value can be. - You can also use the property to add new elements by setting the value of a key that does not exist in the OrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the OrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. - is - An element with the same key already exists in the OrderedDictionary<TKey,TValue> - - - - Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. - - The key of the entry to add. - The value of the entry to add. This value can be . - is .
      - -or-
      - is , and the value type of the OrderedDictionary<TKey,TValue> is a value type.
      - The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      - -or-
      - The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      -
      - - - Removes all elements from the OrderedDictionary<TKey,TValue> collection. - - The capacity is not changed as a result of calling this method. - - - - Determines whether the OrderedDictionary<TKey,TValue> collection contains a specific key. - - The key to locate in the OrderedDictionary<TKey,TValue> collection. - if the OrderedDictionary<TKey,TValue> collection contains an element with the specified key; otherwise, . - is - - - - Determines whether the OrderedDictionary<TKey,TValue> collection contains a specific key. - - The key to locate in the OrderedDictionary<TKey,TValue> collection. - if the OrderedDictionary<TKey,TValue> collection contains an element with the specified key; otherwise, . - is - The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . - - - - Returns the zero-based index of the specified key in the OrderedDictionary<TKey,TValue> - - The key to locate in the OrderedDictionary<TKey,TValue> - The zero-based index of , if is found in the OrderedDictionary<TKey,TValue>; otherwise, -1 - This method performs a linear search; therefore it has a cost of O(n) at worst. - - - - Removes the entry with the specified key from the OrderedDictionary<TKey,TValue> collection. - - The key of the entry to remove - if the key was found and the corresponding element was removed; otherwise, - - - - Removes the entry with the specified key from the OrderedDictionary<TKey,TValue> collection. - - The key of the entry to remove - - - - Copies the elements of the OrderedDictionary<TKey,TValue> elements to a one-dimensional Array object at the specified index. - - The one-dimensional object that is the destination of the objects copied from the OrderedDictionary<TKey,TValue>. The must have zero-based indexing. - The zero-based index in at which copying begins. - The method preserves the order of the elements in the OrderedDictionary<TKey,TValue> - - - - Gets the value associated with the specified key. - - The key of the value to get. - When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of . This parameter can be passed uninitialized. - if the OrderedDictionary<TKey,TValue> contains an element with the specified key; otherwise, . - - - - Adds the specified value to the OrderedDictionary<TKey,TValue> with the specified key. - - The KeyValuePair<TKey,TValue> structure representing the key and value to add to the OrderedDictionary<TKey,TValue>. - - - - Determines whether the OrderedDictionary<TKey,TValue> contains a specific key and value. - - The KeyValuePair<TKey,TValue> structure to locate in the OrderedDictionary<TKey,TValue>. - if is found in the OrderedDictionary<TKey,TValue>; otherwise, . - - - - Copies the elements of the OrderedDictionary<TKey,TValue> to an array of type , starting at the specified index. - - The one-dimensional array of type KeyValuePair<TKey,TValue> that is the destination of the KeyValuePair<TKey,TValue> elements copied from the OrderedDictionary<TKey,TValue>. The array must have zero-based indexing. - The zero-based index in at which copying begins. - - - - Removes a key and value from the dictionary. - - The KeyValuePair<TKey,TValue> structure representing the key and value to remove from the OrderedDictionary<TKey,TValue>. - if the key and value represented by is successfully found and removed; otherwise, . This method returns if is not found in the OrderedDictionary<TKey,TValue>. - - - - Gets the dictionary object that stores the keys and values - - The dictionary object that stores the keys and values for the OrderedDictionary<TKey,TValue> - Accessing this property will create the dictionary object if necessary - - - - Gets the list object that stores the key/value pairs. - - The list object that stores the key/value pairs for the OrderedDictionary<TKey,TValue> - Accessing this property will create the list object if necessary. - - - - Gets or sets the value at the specified index. - - The zero-based index of the value to get or set. - The value of the item at the specified index. - is less than 0.
      - -or-
      - index is equal to or greater than .
      -
      - - - Gets or sets the value at the specified index. - - The zero-based index of the value to get or set. - The value of the item at the specified index. - is less than 0.
      - -or-
      - index is equal to or greater than .
      - is a null reference, and the value type of the OrderedDictionary<TKey,TValue> is a value type. - The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . -
      - - - Gets a value indicating whether the OrderedDictionary<TKey,TValue> has a fixed size. - - if the OrderedDictionary<TKey,TValue> has a fixed size; otherwise, . The default is . - - - - Gets a value indicating whether the OrderedDictionary<TKey,TValue> collection is read-only. - - if the OrderedDictionary<TKey,TValue> is read-only; otherwise, . The default is . - - A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created. - A collection that is read-only is simply a collection with a wrapper that prevents modification of the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes. - - - - - Gets an object containing the keys in the OrderedDictionary<TKey,TValue>. - - An object containing the keys in the OrderedDictionary<TKey,TValue>. - The returned object is not a static copy; instead, the collection refers back to the keys in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the key collection. - - - - Gets an object containing the values in the OrderedDictionary<TKey,TValue> collection. - - An object containing the values in the OrderedDictionary<TKey,TValue> collection. - The returned object is not a static copy; instead, the refers back to the values in the original OrderedDictionary<TKey,TValue> collection. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the . - - - - Gets or sets the value with the specified key. - - The key of the value to get or set. - The value associated with the specified key. If the specified key is not found, attempting to get it returns , and attempting to set it creates a new element using the specified key. - - - - Gets or sets the value with the specified key. - - The key of the value to get or set. - The value associated with the specified key. If the specified key is not found, attempting to get it returns , and attempting to set it creates a new element using the specified key. - - - - Gets the number of key/values pairs contained in the OrderedDictionary<TKey,TValue> collection. - - The number of key/value pairs contained in the OrderedDictionary<TKey,TValue> collection. - - - - Gets a value indicating whether access to the OrderedDictionary<TKey,TValue> object is synchronized (thread-safe). - - This method always returns false. - - - - Gets an object that can be used to synchronize access to the OrderedDictionary<TKey,TValue> object. - - An object that can be used to synchronize access to the OrderedDictionary<TKey,TValue> object. - - - - Gets an ICollection<TKey> object containing the keys in the OrderedDictionary<TKey,TValue>. - - An ICollection<TKey> object containing the keys in the OrderedDictionary<TKey,TValue>. - The returned ICollection<TKey> object is not a static copy; instead, the collection refers back to the keys in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the key collection. - - - - Gets an ICollection<TValue> object containing the values in the OrderedDictionary<TKey,TValue>. - - An ICollection<TValue> object containing the values in the OrderedDictionary<TKey,TValue>. - The returned ICollection<TKey> object is not a static copy; instead, the collection refers back to the values in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the value collection. - - - - acquire distributed, non-reentrant lock on key - - global key for this lock - timeout for acquiring lock - timeout for lock, in seconds (stored as value against lock key) - - - - - - unlock key - - - - - - - - - - - - - Locking strategy interface - - - - - This class manages a read lock for a local readers/writer lock, - using the Resource Acquisition Is Initialization pattern - - - - - RAII initialization - - - - - - RAII disposal - - - - - This class manages a write lock for a local readers/writer lock, - using the Resource Acquisition Is Initialization pattern - - - - - - RAII disposal - - - - - manages a "region" in the redis key space - namespace can be cleared by incrementing the generation - - - - - get current generation - - - - - - set new generation - - - - - - redis key for generation - - - - - - get redis key that holds all namespace keys - - - - - - get global cache key - - - - - - - get global key inside of this namespace - - - prefixes can be added for name deconfliction - - - - - replace UniqueCharacter with its double, to avoid name clash - - - - - - - - - - - - - - get locking strategy - - -
      -
      diff --git a/lib/ServiceStack.Redis.dll b/lib/ServiceStack.Redis.dll deleted file mode 100644 index 3a5d6914c1f..00000000000 Binary files a/lib/ServiceStack.Redis.dll and /dev/null differ diff --git a/lib/ServiceStack.Text.XML b/lib/ServiceStack.Text.XML deleted file mode 100644 index 6cf831f51f8..00000000000 --- a/lib/ServiceStack.Text.XML +++ /dev/null @@ -1,714 +0,0 @@ - - - - ServiceStack.Text - - - - - Utils to load types - - - - - Find the type from the name supplied - - [typeName] or [typeName, assemblyName] - - - - - The top-most interface of the given type, if any. - - - - - Find type if it exists - - - - The type if it exists - - - - Populate an object with Example data. - - - - - - - Populates the object with example data. - - - Tracks how deeply nested we are - - - - - If AlwaysUseUtc is set to true then convert all DateTime to UTC. - - - - - - - Repairs an out-of-spec XML date/time string which incorrectly uses a space instead of a 'T' to separate the date from the time. - These string are occasionally generated by SQLite and can cause errors in OrmLite when reading these columns from the DB. - - The XML date/time string to repair - The repaired string. If no repairs were made, the original string is returned. - - - - WCF Json format: /Date(unixts+0000)/ - - - - - - - WCF Json format: /Date(unixts+0000)/ - - - - - - - Get the type(string) constructor if exists - - The type. - - - - - micro optimizations: using flags instead of value.IndexOfAny(EscapeChars) - - - - - - - Class to hold - - - - - - A fast, standards-based, serialization-issue free DateTime serailizer. - - - - - Determines whether this serializer can create the specified type from a string. - - The type. - - true if this instance [can create from string] the specified type; otherwise, false. - - - - - Parses the specified value. - - The value. - - - - - Deserializes from reader. - - The reader. - - - - - Serializes to string. - - The value. - - - - - Serializes to writer. - - The value. - The writer. - - - - Sets which format to use when serializing TimeSpans - - - - - if the is configured - to take advantage of specification, - to support user-friendly serialized formats, ie emitting camelCasing for JSON - and parsing member names and enum values in a case-insensitive manner. - - - - - if the is configured - to support web-friendly serialized formats, ie emitting lowercase_underscore_casing for JSON - - - - - Define how property names are mapped during deserialization - - - - - Gets or sets a value indicating if the framework should throw serialization exceptions - or continue regardless of deserialization errors. If the framework - will throw; otherwise, it will parse as many fields as possible. The default is . - - - - - Gets or sets a value indicating if the framework should always convert to UTC format instead of local time. - - - - - Gets or sets a value indicating if the framework should always assume is in UTC format if Kind is Unspecified. - - - - - Gets or sets whether we should append the Utc offset when we serialize Utc dates. Defaults to no. - Only supported for when the JsConfig.DateHandler == JsonDateHandler.TimestampOffset - - - - - Gets or sets a value indicating if unicode symbols should be serialized as "\uXXXX". - - - - - If set to true, Interface types will be prefered over concrete types when serializing. - - - - - For extra serialization performance you can re-use a ThreadStatic StringBuilder - when serializing to a JSON String. - - - - - Sets the maximum depth to avoid circular dependencies - - - - - Set this to enable your own type construction provider. - This is helpful for integration with IoC containers where you need to call the container constructor. - Return null if you don't know how to construct the type and the parameterless constructor will be used. - - - - - If set to true, Interface types will be prefered over concrete types when serializing. - - - - - Always emit type info for this type. Takes precedence over ExcludeTypeInfo - - - - - Never emit type info for this type - - - - - if the is configured - to take advantage of specification, - to support user-friendly serialized formats, ie emitting camelCasing for JSON - and parsing member names and enum values in a case-insensitive manner. - - - - - Define custom serialization fn for BCL Structs - - - - - Define custom raw serialization fn - - - - - Define custom serialization hook - - - - - Define custom after serialization hook - - - - - Define custom deserialization fn for BCL Structs - - - - - Define custom raw deserialization fn for objects - - - - - Exclude specific properties of this type from being serialized - - - - - Opt-in flag to set some Value Types to be treated as a Ref Type - - - - - Whether there is a fn (raw or otherwise) - - - - - The property names on target types must match property names in the JSON source - - - - - The property names on target types may not match the property names in the JSON source - - - - - Uses the xsd format like PT15H10M20S - - - - - Uses the standard .net ToString method of the TimeSpan class - - - - - Get JSON string value converted to T - - - - - Get JSON string value - - - - - Get unescaped string value - - - - - Get unescaped string value - - - - - Write JSON Array, Object, bool or number values as raw string - - - - - Get JSON string value - - - - - Creates an instance of a Type from a string value - - - - - Parses the specified value. - - The value. - - - - - Shortcut escape when we're sure value doesn't contain any escaped chars - - - - - - - Given a character as utf32, returns the equivalent string provided that the character - is legal json. - - - - - - - micro optimizations: using flags instead of value.IndexOfAny(EscapeChars) - - - - - - - Implement the serializer using a more static approach - - - - - - Implement the serializer using a more static approach - - - - - - Public Code API to register commercial license for ServiceStack. - - - - - Internal Utilities to verify licensing - - - - - Pretty Thread-Safe cache class from: - http://code.google.com/p/dapper-dot-net/source/browse/Dapper/SqlMapper.cs - - This is a micro-cache; suitable when the number of terms is controllable (a few hundred, for example), - and strictly append-only; you cannot change existing values. All key matches are on **REFERENCE** - equality. The type is fully thread-safe. - - - - - Represents an individual object, allowing access to members by-name - - - - - Use the target types definition of equality - - - - - Obtain the hash of the target object - - - - - Use the target's definition of a string representation - - - - - Wraps an individual object, allowing by-name access to that instance - - - - - Get or Set the value of a named member for the underlying object - - - - - The object represented by this instance - - - - - Provides by-name member-access to objects of a given type - - - - - Create a new instance of this type - - - - - Provides a type-specific accessor, allowing by-name access for all objects of that type - - The accessor is cached internally; a pre-existing accessor may be returned - - - - Does this type support new instances via a parameterless constructor? - - - - - Get or set the value of a named member on the target instance - - - - - Maps the path of a file in the context of a VS project - - the relative path - the absolute path - Assumes static content is two directories above the /bin/ directory, - eg. in a unit test scenario the assembly would be in /bin/Debug/. - - - - Maps the path of a file in a self-hosted scenario - - the relative path - the absolute path - Assumes static content is copied to /bin/ folder with the assemblies - - - - Maps the path of a file in an Asp.Net hosted scenario - - the relative path - the absolute path - Assumes static content is in the parent folder of the /bin/ directory - - - - Implement the serializer using a more static approach - - - - - - Creates a new instance of type. - First looks at JsConfig.ModelFactory before falling back to CreateInstance - - - - - Creates a new instance of type. - First looks at JsConfig.ModelFactory before falling back to CreateInstance - - - - - Creates a new instance from the default constructor of type - - - - - Add a Property attribute at runtime. - Not threadsafe, should only add attributes on Startup. - - - - - Add a Property attribute at runtime. - Not threadsafe, should only add attributes on Startup. - - - - - @jonskeet: Collection of utility methods which operate on streams. - r285, February 26th 2009: http://www.yoda.arachsys.com/csharp/miscutil/ - - - - - Reads the given stream up to the end, returning the data as a byte - array. - - - - - Reads the given stream up to the end, returning the data as a byte - array, using the given buffer size. - - - - - Reads the given stream up to the end, returning the data as a byte - array, using the given buffer for transferring data. Note that the - current contents of the buffer is ignored, so the buffer needn't - be cleared beforehand. - - - - - Copies all the data from one stream into another. - - - - - Copies all the data from one stream into another, using a buffer - of the given size. - - - - - Copies all the data from one stream into another, using the given - buffer for transferring data. Note that the current contents of - the buffer is ignored, so the buffer needn't be cleared beforehand. - - - - - Reads exactly the given number of bytes from the specified stream. - If the end of the stream is reached before the specified amount - of data is read, an exception is thrown. - - - - - Reads into a buffer, filling it completely. - - - - - Reads exactly the given number of bytes from the specified stream, - into the given buffer, starting at position 0 of the array. - - - - - Reads exactly the given number of bytes from the specified stream, - into the given buffer, starting at position 0 of the array. - - - - - Same as ReadExactly, but without the argument checks. - - - - - Converts from base: 0 - 62 - - The source. - From. - To. - - - - - Skip the encoding process for 'safe strings' - - - - - - - A class to allow the conversion of doubles to string representations of - their exact decimal values. The implementation aims for readability over - efficiency. - - Courtesy of @JonSkeet - http://www.yoda.arachsys.com/csharp/DoubleConverter.cs - - - - - - - - How many digits are *after* the decimal point - - - - - Constructs an arbitrary decimal expansion from the given long. - The long must not be negative. - - - - - Multiplies the current expansion by the given amount, which should - only be 2 or 5. - - - - - Shifts the decimal point; a negative value makes - the decimal expansion bigger (as fewer digits come after the - decimal place) and a positive value makes the decimal - expansion smaller. - - - - - Removes leading/trailing zeroes from the expansion. - - - - - Converts the value to a proper decimal string representation. - - - - - Creates an instance of a Type from a string value - - - - - Determines whether the specified type is convertible from string. - - The type. - - true if the specified type is convertible from string; otherwise, false. - - - - - Parses the specified value. - - The value. - - - - - Parses the specified type. - - The type. - The value. - - - - - Useful extension method to get the Dictionary[string,string] representation of any POCO type. - - - - - - Recursively prints the contents of any POCO object in a human-friendly, readable format - - - - - - Print Dump to Console.WriteLine - - - - - Print string.Format to Console.WriteLine - - - - - Parses the specified value. - - The value. - - - - diff --git a/lib/ServiceStack.Text.dll b/lib/ServiceStack.Text.dll deleted file mode 100644 index 3b6cc11575d..00000000000 Binary files a/lib/ServiceStack.Text.dll and /dev/null differ diff --git a/lib/ServiceStack.dll b/lib/ServiceStack.dll deleted file mode 100644 index 3a0855cb1f8..00000000000 Binary files a/lib/ServiceStack.dll and /dev/null differ diff --git a/lib/ServiceStack.pdb b/lib/ServiceStack.pdb deleted file mode 100644 index 5bb0f593c0b..00000000000 Binary files a/lib/ServiceStack.pdb and /dev/null differ diff --git a/lib/System.Web.Mvc.dll b/lib/System.Web.Mvc.dll deleted file mode 100644 index eed0d994a05..00000000000 Binary files a/lib/System.Web.Mvc.dll and /dev/null differ diff --git a/lib/System.Web.Mvc.xml b/lib/System.Web.Mvc.xml deleted file mode 100644 index af648fcbf71..00000000000 --- a/lib/System.Web.Mvc.xml +++ /dev/null @@ -1,9395 +0,0 @@ - - - - System.Web.Mvc - - - - Represents an attribute that specifies which HTTP verbs an action method will respond to. - - - Initializes a new instance of the class by using a list of HTTP verbs that the action method will respond to. - The HTTP verbs that the action method will respond to. - The parameter is null or zero length. - - - Initializes a new instance of the class using the HTTP verbs that the action method will respond to. - The HTTP verbs that the action method will respond to. - - - Determines whether the specified method information is valid for the specified controller context. - true if the method information is valid; otherwise, false. - The controller context. - The method information. - The parameter is null. - - - Gets or sets the list of HTTP verbs that the action method will respond to. - The list of HTTP verbs that the action method will respond to. - - - Provides information about an action method, such as its name, controller, parameters, attributes, and filters. - - - Initializes a new instance of the class. - - - Gets the name of the action method. - The name of the action method. - - - Gets the controller descriptor. - The controller descriptor. - - - Executes the action method by using the specified parameters and controller context. - The result of executing the action method. - The controller context. - The parameters of the action method. - - - Returns an array of custom attributes that are defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - - - Returns an array of custom attributes that are defined for this member, identified by type. - An array of custom attributes, or an empty array if no custom attributes of the specified type exist. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - The parameter is null. - - - Returns the filters that are associated with this action method. - The filters that are associated with this action method. - - - Returns the parameters of the action method. - The parameters of the action method. - - - Returns the action-method selectors. - The action-method selectors. - - - Determines whether one or more instances of the specified attribute type are defined for this member. - true if is defined for this member; otherwise, false. - The type of the custom attribute. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The parameter is null. - - - Gets the unique ID for the action descriptor using lazy initialization. - The unique ID. - - - Provides the context for the ActionExecuted method of the class. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class. - The controller context. - The action method descriptor. - true if the action is canceled. - The exception object. - The parameter is null. - - - Gets or sets the action descriptor. - The action descriptor. - - - Gets or sets a value that indicates that this object is canceled. - true if the context canceled; otherwise, false. - - - Gets or sets the exception that occurred during the execution of the action method, if any. - The exception that occurred during the execution of the action method. - - - Gets or sets a value that indicates whether the exception is handled. - true if the exception is handled; otherwise, false. - - - Gets or sets the result returned by the action method. - The result returned by the action method. - - - Provides the context for the ActionExecuting method of the class. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using the specified controller context, action descriptor, and action-method parameters. - The controller context. - The action descriptor. - The action-method parameters. - The or parameter is null. - - - Gets or sets the action descriptor. - The action descriptor. - - - Gets or sets the action-method parameters. - The action-method parameters. - - - Gets or sets the result that is returned by the action method. - The result that is returned by the action method. - - - Represents the base class for filter attributes. - - - Initializes a new instance of the class. - - - Called by the ASP.NET MVC framework after the action method executes. - The filter context. - - - Called by the ASP.NET MVC framework before the action method executes. - The filter context. - - - Called by the ASP.NET MVC framework after the action result executes. - The filter context. - - - Called by the ASP.NET MVC framework before the action result executes. - The filter context. - - - Represents an attribute that is used to influence the selection of an action method. - - - Initializes a new instance of the class. - - - Determines whether the action method selection is valid for the specified controller context. - true if the action method selection is valid for the specified controller context; otherwise, false. - The controller context. - Information about the action method. - - - Represents an attribute that is used for the name of an action. - - - Initializes a new instance of the class. - Name of the action. - The parameter is null or empty. - - - Determines whether the action name is valid within the specified controller context. - true if the action name is valid within the specified controller context; otherwise, false. - The controller context. - The name of the action. - Information about the action method. - - - Gets or sets the name of the action. - The name of the action. - - - Represents an attribute that affects the selection of an action method. - - - Initializes a new instance of the class. - - - Determines whether the action name is valid in the specified controller context. - true if the action name is valid in the specified controller context; otherwise, false. - The controller context. - The name of the action. - Information about the action method. - - - Encapsulates the result of an action method and is used to perform a framework-level operation on behalf of the action method. - - - Initializes a new instance of the class. - - - Enables processing of the result of an action method by a custom type that inherits from the class. - The context in which the result is executed. The context information includes the controller, HTTP content, request context, and route data. - - - Represents a delegate that contains the logic for selecting an action method. - true if an action method was successfully selected; otherwise, false. - The current HTTP request context. - - - Provides a class that implements the interface in order to support additional metadata. - - - Initializes a new instance of the class. - The name of the model metadata. - The value of the model metadata. - - - Gets the name of the additional metadata attribute. - The name of the of the additional metadata attribute. - - - Provides metadata to the model metadata creation process. - - - Gets the type of the of the additional metadata attribute. - The type of the of the additional metadata attribute. - - - Gets the value of the of the additional metadata attribute. - The value of the of the additional metadata attribute. - - - Represents support for rendering HTML in AJAX scenarios within a view. - - - Initializes a new instance of the class using the specified view context and view data container. - The view context. - The view data container. - One or both of the parameters is null. - - - Initializes a new instance of the class by using the specified view context, view data container, and route collection. - The view context. - The view data container. - The URL route collection. - One or more of the parameters is null. - - - Gets or sets the root path for the location to use for globalization script files. - The location of the folder where globalization script files are stored. The default location is "~/Scripts/Globalization". - - - Serializes the specified message and returns the resulting JSON-formatted string. - The serialized message as a JSON-formatted string. - The message to serialize. - - - Gets the collection of URL routes for the application. - The collection of routes for the application. - - - Gets the context information about the view. - The context of the view. - - - Gets the current view data dictionary. - The view data dictionary. - - - Gets the view data container. - The view data container. - - - Represents support for rendering HTML in AJAX scenarios within a strongly typed view. - The type of the model. - - - Initializes a new instance of the class by using the specified view context and view data container. - The view context. - The view data container. - - - Initializes a new instance of the class by using the specified view context, view data container, and URL route collection. - The view context. - The view data container. - The URL route collection. - - - Gets the strongly typed version of the view data dictionary. - The strongly typed data dictionary of the view. - - - Represents a class that extends the class by adding the ability to determine whether an HTTP request is an AJAX request. - - - - Allows a request to include HTML markup during model binding by skipping request validation for the property. (It is strongly recommended that your application explicitly check all models where you disable request validation in order to prevent script exploits.) - - - Initializes a new instance of the class. - - - This method supports the ASP.NET MVC validation infrastructure and is not intended to be used directly from your code. - The model metadata. - - - Provides a way to register one or more areas in an ASP.NET MVC application. - - - Initializes a new instance of the class. - - - Gets the name of the area to register. - The name of the area to register. - - - Registers all areas in an ASP.NET MVC application. - - - Registers all areas in an ASP.NET MVC application by using the specified user-defined information. - An object that contains user-defined information to pass to the area. - - - Registers an area in an ASP.NET MVC application using the specified area's context information. - Encapsulates the information that is required in order to register the area. - - - Encapsulates the information that is required in order to register an area within an ASP.NET MVC application. - - - Initializes a new instance of the class using the specified area name and routes collection. - The name of the area to register. - The collection of routes for the application. - - - Initializes a new instance of the class using the specified area name, routes collection, and user-defined data. - The name of the area to register. - The collection of routes for the application. - An object that contains user-defined information to pass to the area. - - - Gets the name of the area to register. - The name of the area to register. - - - Maps the specified URL route and associates it with the area that is specified by the property. - A reference to the mapped route. - The name of the route. - The URL pattern for the route. - The parameter is null. - - - Maps the specified URL route and associates it with the area that is specified by the property, using the specified route default values. - A reference to the mapped route. - The name of the route. - The URL pattern for the route. - An object that contains default route values. - The parameter is null. - - - Maps the specified URL route and associates it with the area that is specified by the property, using the specified route default values and constraint. - A reference to the mapped route. - The name of the route. - The URL pattern for the route. - An object that contains default route values. - A set of expressions that specify valid values for a URL parameter. - The parameter is null. - - - Maps the specified URL route and associates it with the area that is specified by the property, using the specified route default values, constraints, and namespaces. - A reference to the mapped route. - The name of the route. - The URL pattern for the route. - An object that contains default route values. - A set of expressions that specify valid values for a URL parameter. - An enumerable set of namespaces for the application. - The parameter is null. - - - Maps the specified URL route and associates it with the area that is specified by the property, using the specified route default values and namespaces. - A reference to the mapped route. - The name of the route. - The URL pattern for the route. - An object that contains default route values. - An enumerable set of namespaces for the application. - The parameter is null. - - - Maps the specified URL route and associates it with the area that is specified by the property, using the specified namespaces. - A reference to the mapped route. - The name of the route. - The URL pattern for the route. - An enumerable set of namespaces for the application. - The parameter is null. - - - Gets the namespaces for the application. - An enumerable set of namespaces for the application. - - - Gets a collection of defined routes for the application. - A collection of defined routes for the application. - - - Gets an object that contains user-defined information to pass to the area. - An object that contains user-defined information to pass to the area. - - - Provides an abstract class to implement a metadata provider. - - - Called from constructors in a derived class to initialize the class. - - - When overridden in a derived class, creates the model metadata for the property. - The model metadata for the property. - The set of attributes. - The type of the container. - The model accessor. - The type of the model. - The name of the property. - - - Gets a list of attributes. - A list of attributes. - The type of the container. - The property descriptor. - The attribute container. - - - Returns a list of properties for the model. - A list of properties for the model. - The model container. - The type of the container. - - - Returns the metadata for the specified property using the container type and property descriptor. - The metadata for the specified property using the container type and property descriptor. - The model accessor. - The type of the container. - The property descriptor - - - Returns the metadata for the specified property using the container type and property name. - The metadata for the specified property using the container type and property name. - The model accessor. - The type of the container. - The name of the property. - - - Returns the metadata for the specified property using the type of the model. - The metadata for the specified property using the type of the model. - The model accessor. - The type of the model. - - - Returns the type descriptor from the specified type. - The type descriptor. - The type. - - - Provides an abstract class for classes that implement a validation provider. - - - Called from constructors in derived classes to initialize the class. - - - Gets a type descriptor for the specified type. - A type descriptor for the specified type. - The type of the validation provider. - - - Gets the validators for the model using the metadata and controller context. - The validators for the model. - The metadata. - The controller context. - - - Gets the validators for the model using the metadata, the controller context, and a list of attributes. - The validators for the model. - The metadata. - The controller context. - The list of attributes. - - - Provides the base class for asynchronous controllers. - - - Initializes a new instance of the class. - - - Gets the asynchronous manager instance. - The asynchronous manager instance. - - - Called by ASP.NET to initialize asynchronous request processing. - The status of the asynchronous operation. - The request context. - The asynchronous callback method. - The state object. - - - Called by ASP.NET during initialization of asynchronous request processing. - The status of the asynchronous operation. - The asynchronous callback method. - The state object. - - - Creates an action invoker. - An action invoker. - - - Cancels the execution of an asynchronous action method. - The status of the asynchronous result. - - - Called by ASP.NET when the current asynchronous action has completed. - The status of the asynchronous result. - - - Called by ASP.NET to begin the execution of an asynchronous action method. - The status of the asynchronous operation. - The request context. - The asynchronous callback method. - An object that contains information to be used by the callback method. This parameter can be null. - - - Cancels the execution of an asynchronous action method by ASP.NET at the end of the execution of an asynchronous action method. - The status of the asynchronous result. - - - Represents an attribute that is used to set the timeout value, in milliseconds, for an asynchronous method. - - - Initializes a new instance of the class. - The timeout value, in milliseconds. - - - Gets the timeout duration, in milliseconds. - The timeout duration, in milliseconds. - - - Called by ASP.NET before the asynchronous action method executes. - The filter context. - - - Encapsulates the information that is required for using an attribute. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the specified controller context. - The context within which the result is executed. The context information includes the controller, HTTP content, request context, and route data. - - - Initializes a new instance of the class using the specified controller context and action descriptor. - The context in which the result is executed. The context information includes the controller, HTTP content, request context, and route data. - An object that provides information about an action method, such as its name, controller, parameters, attributes, and filters. - - - Provides information about the action method that is marked by the attribute, such as its name, controller, parameters, attributes, and filters. - The action descriptor for the action method that is marked by the attribute. - - - Gets or sets the result that is returned by an action method. - The result that is returned by an action method. - - - Represents an attribute that is used to restrict access by callers to an action method. - - - Initializes a new instance of the class. - - - When overridden, provides an entry point for custom authorization checks. - true if the user is authorized; otherwise, false. - The HTTP context, which encapsulates all HTTP-specific information about an individual HTTP request. - The parameter is null. - - - Processes HTTP requests that fail authorization. - Encapsulates the information for using . The object contains the controller, HTTP context, request context, action result, and route data. - - - Called when a process requests authorization. - The filter context, which encapsulates information for using . - The parameter is null. - - - Called when the caching module requests authorization. - A reference to the validation status. - The HTTP context, which encapsulates all HTTP-specific information about an individual HTTP request. - The parameter is null. - - - Gets or sets the user roles. - The user roles. - - - Gets the unique identifier for this attribute. - The unique identifier for this attribute. - - - Gets or sets the authorized users. - The authorized users. - - - Represents an attribute that is used to provide details about how model binding to a parameter should occur. - - - Initializes a new instance of the class. - - - Gets or sets a comma-delimited list of property names for which binding is not allowed. - The exclude list. - - - Gets or sets a comma-delimited list of property names for which binding is allowed. - The include list. - - - Determines whether the specified property is allowed. - true if the specified property is allowed; otherwise, false. - The name of the property. - - - Gets or sets the prefix to use when markup is rendered for binding to an action argument or to a model property. - The prefix to use. - - - Represents the base class for views that are compiled by the BuildManager class before being rendered by a view engine. - - - Initializes a new instance of the class using the specified controller context and view path. - The controller context. - The view path. - - - Initializes a new instance of the class using the specified controller context, view path, and view page activator. - Context information for the current controller. This information includes the HTTP context, request context, route data, parent action view context, and more. - The path to the view that will be rendered. - The object responsible for dynamically constructing the view page at run time. - The parameter is null. - The parameter is null or empty. - - - Renders the specified view context by using the specified the writer object. - Information related to rendering a view, such as view data, temporary data, and form context. - The writer object. - The parameter is null. - An instance of the view type could not be created. - - - When overridden in a derived class, renders the specified view context by using the specified writer object and object instance. - Information related to rendering a view, such as view data, temporary data, and form context. - The writer object. - An object that contains additional information that can be used in the view. - - - Gets or sets the view path. - The view path. - - - Provides a base class for view engines. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the specified view page activator. - The view page activator. - - - Gets a value that indicates whether a file exists in the specified virtual file system (path). - true if the file exists in the virtual file system; otherwise, false. - The controller context. - The virtual path. - - - Gets the view page activator. - The view page activator. - - - Maps a browser request to a byte array. - - - Initializes a new instance of the class. - - - Binds the model by using the specified controller context and binding context. - The bound data object. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - The parameter is null. - - - Represents an attribute that is used to indicate that an action method should be called only as a child action. - - - Initializes a new instance of the class. - - - Called when authorization is required. - An object that encapsulates the information that is required in order to authorize access to the child action. - - - Represents a value provider for values from child actions. - - - Initializes a new instance of the class. - The controller context. - - - Retrieves a value object using the specified key. - The value object for the specified key. - The key. - - - Represents a factory for creating value provider objects for child actions. - - - Initializes a new instance of the class. - - - Returns a object for the specified controller context. - A object. - The controller context. - - - Returns the client data-type model validators. - - - Initializes a new instance of the class. - - - Returns the client data-type model validators. - The client data-type model validators. - The metadata. - The context. - - - Provides an attribute that compares two properties of a model. - - - Initializes a new instance of the class. - The property to compare with the current property. - - - Applies formatting to an error message based on the data field where the compare error occurred. - The formatted error message. - The name of the field that caused the validation failure. - - - Formats the property for client validation by prepending an asterisk (*) and a dot. - The string "*." is prepended to the property. - The property. - - - Gets a list of compare-value client validation rules for the property using the specified model metadata and controller context. - A list of compare-value client validation rules. - The model metadata. - The controller context. - - - Determines whether the specified object is equal to the compared object. - null if the value of the compared property is equal to the value parameter; otherwise, a validation result that contains the error message that indicates that the comparison failed. - The value of the object to compare. - The validation context. - - - Gets the property to compare with the current property. - The property to compare with the current property. - - - Represents a user-defined content type that is the result of an action method. - - - Initializes a new instance of the class. - - - Gets or sets the content. - The content. - - - Gets or sets the content encoding. - The content encoding. - - - Gets or sets the type of the content. - The type of the content. - - - Enables processing of the result of an action method by a custom type that inherits from the class. - The context within which the result is executed. - The parameter is null. - - - Provides methods that respond to HTTP requests that are made to an ASP.NET MVC Web site. - - - Initializes a new instance of the class. - - - Gets the action invoker for the controller. - The action invoker. - - - Gets or sets the binder. - The binder. - - - Creates a content result object by using a string. - The content result instance. - The content to write to the response. - - - Creates a content result object by using a string and the content type. - The content result instance. - The content to write to the response. - The content type (MIME type). - - - Creates a content result object by using a string, the content type, and content encoding. - The content result instance. - The content to write to the response. - The content type (MIME type). - The content encoding. - - - Creates an action invoker. - An action invoker. - - - Creates a temporary data provider. - A temporary data provider. - - - Releases all resources that are used by the current instance of the class. - - - Releases unmanaged resources and optionally releases managed resources. - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - Invokes the action in the current controller context. - - - Creates a object by using the file contents and file type. - The file-content result object. - The binary content to send to the response. - The content type (MIME type). - - - Creates a object by using the file contents, content type, and the destination file name. - The file-content result object. - The binary content to send to the response. - The content type (MIME type). - The file name to use in the file-download dialog box that is displayed in the browser. - - - Creates a object by using the object and content type. - The file-content result object. - The stream to send to the response. - The content type (MIME type). - - - Creates a object using the object, the content type, and the target file name. - The file-stream result object. - The stream to send to the response. - The content type (MIME type) - The file name to use in the file-download dialog box that is displayed in the browser. - - - Creates a object by using the file name and the content type. - The file-stream result object. - The path of the file to send to the response. - The content type (MIME type). - - - Creates a object by using the file name, the content type, and the file download name. - The file-stream result object. - The path of the file to send to the response. - The content type (MIME type). - The file name to use in the file-download dialog box that is displayed in the browser. - - - Called when a request matches this controller, but no method with the specified action name is found in the controller. - The name of the attempted action. - - - Gets HTTP-specific information about an individual HTTP request. - The HTTP context. - - - Returns an instance of the class. - An instance of the class. - - - Returns an instance of the class. - An instance of the class. - The status description. - - - Initializes data that might not be available when the constructor is called. - The HTTP context and route data. - - - Creates a object. - The object that writes the script to the response. - The JavaScript code to run on the client - - - Creates a object that serializes the specified object to JavaScript Object Notation (JSON). - The JSON result object that serializes the specified object to JSON format. The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed. - The JavaScript object graph to serialize. - - - Creates a object that serializes the specified object to JavaScript Object Notation (JSON) format. - The JSON result object that serializes the specified object to JSON format. - The JavaScript object graph to serialize. - The content type (MIME type). - - - Creates a object that serializes the specified object to JavaScript Object Notation (JSON) format. - The JSON result object that serializes the specified object to JSON format. - The JavaScript object graph to serialize. - The content type (MIME type). - The content encoding. - - - Creates a object that serializes the specified object to JavaScript Object Notation (JSON) format using the content type, content encoding, and the JSON request behavior. - The result object that serializes the specified object to JSON format. - The JavaScript object graph to serialize. - The content type (MIME type). - The content encoding. - The JSON request behavior - - - Creates a object that serializes the specified object to JavaScript Object Notation (JSON) format using the specified content type and JSON request behavior. - The result object that serializes the specified object to JSON format. - The JavaScript object graph to serialize. - The content type (MIME type). - The JSON request behavior - - - Creates a object that serializes the specified object to JavaScript Object Notation (JSON) format using the specified JSON request behavior. - The result object that serializes the specified object to JSON format. - The JavaScript object graph to serialize. - The content type (MIME type). - - - Gets the model state dictionary object that contains the state of the model and of model-binding validation. - The model state dictionary. - - - Called after the action method is invoked. - Information about the current request and action. - - - Called before the action method is invoked. - Information about the current request and action. - - - Called when authorization occurs. - Information about the current request and action. - - - Called when an unhandled exception occurs in the action. - Information about the current request and action. - - - Called after the action result that is returned by an action method is executed. - Information about the current request and action result - - - Called before the action result that is returned by an action method is executed. - Information about the current request and action result - - - Creates a object that renders a partial view. - A partial-view result object. - - - Creates a object that renders a partial view, by using the specified model. - A partial-view result object. - The model that is rendered by the partial view - - - Creates a object that renders a partial view, by using the specified view name. - A partial-view result object. - The name of the view that is rendered to the response. - - - Creates a object that renders a partial view, by using the specified view name and model. - A partial-view result object. - The name of the view that is rendered to the response. - The model that is rendered by the partial view - - - Creates a object that redirects to the specified URL. - The redirect result object. - The URL to redirect to. - - - Returns an instance of the class with the property set to true. - An instance of the class with the property set to true. - The URL to redirect to. - - - Redirects to the specified action using the action name. - The redirect result object. - The name of the action. - - - Redirects to the specified action using the action name and route values. - The redirect result object. - The name of the action. - The parameters for a route. - - - Redirects to the specified action using the action name and controller name. - The redirect result object. - The name of the action. - The name of the controller - - - Redirects to the specified action using the action name, controller name, and route values. - The redirect result object. - The name of the action. - The name of the controller - The parameters for a route. - - - Redirects to the specified action using the action name, controller name, and route dictionary. - The redirect result object. - The name of the action. - The name of the controller - The parameters for a route. - - - Redirects to the specified action using the action name and route dictionary. - The redirect result object. - The name of the action. - The parameters for a route. - - - Returns an instance of the class with the property set to true using the specified action name. - An instance of the class with the property set to true using the specified action name, controller name, and route values. - The action name. - - - Returns an instance of the class with the property set to true using the specified action name, and route values. - An instance of the class with the property set to true using the specified action name, and route values. - The action name. - The route values. - - - Returns an instance of the class with the property set to true using the specified action name, and controller name. - An instance of the class with the property set to true using the specified action name, and controller name. - The action name. - The controller name. - - - Returns an instance of the class with the property set to true using the specified action name, controller name, and route values. - An instance of the class with the property set to true. - The action name. - The controller name. - The route values. - - - Returns an instance of the class with the property set to true using the specified action name, controller name, and route values. - An instance of the class with the property set to true using the specified action name, controller name, and route values. - The action name. - The controller name. - The route values. - - - Returns an instance of the class with the property set to true using the specified action name, and route values. - An instance of the class with the property set to true using the specified action name, and route values. - - - Redirects to the specified route using the specified route values. - The redirect-to-route result object. - The parameters for a route. - - - Redirects to the specified route using the route name. - The redirect-to-route result object. - The name of the route - - - Redirects to the specified route using the route name and route values. - The redirect-to-route result object. - The name of the route - The parameters for a route. - - - Redirects to the specified route using the route name and route dictionary. - The redirect-to-route result object. - The name of the route - The parameters for a route. - - - Redirects to the specified route using the route dictionary. - The redirect-to-route result object. - The parameters for a route. - - - Returns an instance of the class with the property set to true using the specified route values. - Returns . - The route name. - - - Returns an instance of the class with the property set to true using the specified route name. - Returns an instance of the class with the property set to true using the specified route name. - The route name. - - - Returns an instance of the class with the property set to true using the specified route name and route values. - An instance of the class with the property set to true. - The route name. - The route values. - - - Returns an instance of the class with the property set to true using the specified route name and route values. - An instance of the class with the property set to true using the specified route name and route values. - The route name. - The route values. - - - Returns an instance of the class with the property set to true using the specified route values. - An instance of the class with the property set to true using the specified route values. - The route values. - - - Gets the object for the current HTTP request. - The request object. - - - Gets the object for the current HTTP response. - The response object. - - - Gets the route data for the current request. - The route data. - - - Gets the object that provides methods that are used during Web request processing. - The HTTP server object. - - - Gets the object for the current HTTP request. - The HTTP session-state object for the current HTTP request. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. This method calls the method. - The filter context. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. This method calls the method. - The filter context. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. This method calls the method. - The filter context. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. This method calls the method. - The filter context. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. This method calls the method. - The filter context. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. This method calls the method. - The filter context. - - - Gets the temporary-data provider object that is used to store data for the next request. - The temporary-data provider. - - - Updates the specified model instance using values from the controller's current value provider. - true if the update is successful; otherwise, false. - The model instance to update. - The type of the model object. - The parameter or the property is null. - - - Updates the specified model instance using values from the controller's current value provider and a prefix. - true if the update is successful; otherwise, false. - The model instance to update. - The prefix to use when looking up values in the value provider. - The type of the model object. - The parameter or the property is null. - - - Updates the specified model instance using values from the controller's current value provider, a prefix, and included properties. - true if the update is successful; otherwise, false. - The model instance to update. - The prefix to use when looking up values in the value provider. - A list of properties of the model to update. - The type of the model object. - The parameter or the property is null. - - - Updates the specified model instance using values from the controller's current value provider, a prefix, a list of properties to exclude, and a list of properties to include. - true if the update is successful; otherwise, false. - The model instance to update. - The prefix to use when looking up values in the value provider - A list of properties of the model to update. - A list of properties to explicitly exclude from the update. These are excluded even if they are listed in the parameter list. - The type of the model object. - The parameter or the property is null. - - - Updates the specified model instance using values from the value provider, a prefix, a list of properties to exclude , and a list of properties to include. - true if the update is successful; otherwise, false. - The model instance to update. - The prefix to use when looking up values in the value provider. - A list of properties of the model to update. - A list of properties to explicitly exclude from the update. These are excluded even if they are listed in the parameter list. - A dictionary of values that is used to update the model. - The type of the model object. - - - Updates the specified model instance using values from the value provider, a prefix, and included properties. - true if the update is successful; otherwise, false. - The model instance to update. - The prefix to use when looking up values in the value provider. - A list of properties of the model to update. - A dictionary of values that is used to update the model. - The type of the model object. - - - Updates the specified model instance using values from the value provider and a prefix. - true if the update is successful; otherwise, false. - The model instance to update. - The prefix to use when looking up values in the value provider. - A dictionary of values that is used to update the model. - The type of the model object. - - - Updates the specified model instance using values from the controller's current value provider and included properties. - true if the update is successful; otherwise, false. - The model instance to update. - A list of properties of the model to update. - The type of the model object. - The parameter or the property is null. - - - Updates the specified model instance using values from the value provider and a list of properties to include. - true if the update is successful; otherwise, false. - The model instance to update. - A list of properties of the model to update. - A dictionary of values that is used to update the model. - The type of the model object. - - - Updates the specified model instance using values from the value provider. - true if the update is successful; otherwise, false. - The model instance to update. - A dictionary of values that is used to update the model. - The type of the model object. - - - Validates the specified model instance. - true if the model validation is successful; otherwise, false. - The model instance to validate. - - - Validates the specified model instance using an HTML prefix. - true if the model validation is successful; otherwise, false. - The model to validate. - The prefix to use when looking up values in the model provider. - - - Updates the specified model instance using values from the controller's current value provider. - The model instance to update. - The type of the model object. - The model was not successfully updated. - - - Updates the specified model instance using values from the controller's current value provider and a prefix. - The model instance to update. - A prefix to use when looking up values in the value provider. - The type of the model object. - - - Updates the specified model instance using values from the controller's current value provider, a prefix, and included properties. - The model instance to update. - A prefix to use when looking up values in the value provider. - A list of properties of the model to update. - The type of the model object. - - - Updates the specified model instance using values from the controller's current value provider, a prefix, a list of properties to exclude, and a list of properties to include. - The model instance to update. - A prefix to use when looking up values in the value provider. - A list of properties of the model to update. - A list of properties to explicitly exclude from the update. These are excluded even if they are listed in the list. - The type of the model object. - - - Updates the specified model instance using values from the value provider, a prefix, a list of properties to exclude, and a list of properties to include. - The model instance to update. - The prefix to use when looking up values in the value provider. - A list of properties of the model to update. - A list of properties to explicitly exclude from the update. These are excluded even if they are listed in the parameter list. - A dictionary of values that is used to update the model. - The type of the model object. - - - Updates the specified model instance using values from the value provider, a prefix, and a list of properties to include. - The model instance to update. - The prefix to use when looking up values in the value provider. - A list of properties of the model to update. - A dictionary of values that is used to update the model. - The type of the model object. - - - Updates the specified model instance using values from the value provider and a prefix. - The model instance to update. - The prefix to use when looking up values in the value provider. - A dictionary of values that is used to update the model. - The type of the model object. - - - Updates the specified model instance using values from the controller object's current value provider. - The model instance to update. - A list of properties of the model to update. - The type of the model object. - - - Updates the specified model instance using values from the value provider, a prefix, and a list of properties to include. - The model instance to update. - A list of properties of the model to update. - A dictionary of values that is used to update the model. - The type of the model object. - - - Updates the specified model instance using values from the value provider. - The model instance to update. - A dictionary of values that is used to update the model. - The type of the model object. - - - Gets the URL helper object that is used to generate URLs by using routing. - The URL helper object. - - - Gets the user security information for the current HTTP request. - The user security information for the current HTTP request. - - - Validates the specified model instance. - The model to validate. - - - Validates the specified model instance using an HTML prefix. - The model to validate. - The prefix to use when looking up values in the model provider. - - - Creates a object that renders a view to the response. - The view result that renders a view to the response. - - - Creates a object by using the model that renders a view to the response. - The view result. - The model that is rendered by the view. - - - Creates a object by using the view name that renders a view. - The view result. - The name of the view that is rendered to the response. - - - Creates a object by using the view name and model that renders a view to the response. - The view result. - The name of the view that is rendered to the response. - The model that is rendered by the view. - - - Creates a object using the view name and master-page name that renders a view to the response. - The view result. - The name of the view that is rendered to the response. - The name of the master page or template to use when the view is rendered. - - - Creates a object using the view name, master-page name, and model that renders a view. - The view result. - The name of the view that is rendered to the response. - The name of the master page or template to use when the view is rendered. - The model that is rendered by the view. - - - Creates a object that renders the specified object. - The view result. - The view that is rendered to the response. - - - Creates a object that renders the specified object. - The view result. - The view that is rendered to the response. - The model that is rendered by the view. - - - Represents a class that is responsible for invoking the action methods of a controller. - - - Initializes a new instance of the class. - - - Gets or sets the model binders that are associated with the action. - The model binders that are associated with the action. - - - Creates the action result. - The action result object. - The controller context. - The action descriptor. - The action return value. - - - Finds the information about the action method. - Information about the action method. - The controller context. - The controller descriptor. - The name of the action. - - - Retrieves information about the controller by using the specified controller context. - Information about the controller. - The controller context. - - - Retrieves information about the action filters. - Information about the action filters. - The controller context. - The action descriptor. - - - Gets the value of the specified action-method parameter. - The value of the action-method parameter. - The controller context. - The parameter descriptor. - - - Gets the values of the action-method parameters. - The values of the action-method parameters. - The controller context. - The action descriptor. - - - Invokes the specified action by using the specified controller context. - The result of executing the action. - The controller context. - The name of the action to invoke. - The parameter is null. - The parameter is null or empty. - The thread was aborted during invocation of the action. - An unspecified error occurred during invocation of the action. - - - Invokes the specified action method by using the specified parameters and the controller context. - The result of executing the action method. - The controller context. - The action descriptor. - The parameters. - - - Invokes the specified action method by using the specified parameters, controller context, and action filters. - The context for the ActionExecuted method of the class. - The controller context. - The action filters. - The action descriptor. - The parameters. - - - Invokes the specified action result by using the specified controller context. - The controller context. - The action result. - - - Invokes the specified action result by using the specified action filters and the controller context. - The context for the ResultExecuted method of the class. - The controller context. - The action filters. - The action result. - - - Invokes the specified authorization filters by using the specified action descriptor and controller context. - The context for the object. - The controller context. - The authorization filters. - The action descriptor. - - - Invokes the specified exception filters by using the specified exception and controller context. - The context for the object. - The controller context. - The exception filters. - The exception. - - - Represents the base class for all MVC controllers. - - - Initializes a new instance of the class. - - - Gets or sets the controller context. - The controller context. - - - Executes the specified request context. - The request context. - The parameter is null. - - - Executes the request. - - - Initializes the specified request context. - The request context. - - - Executes the specified request context. - The request context. - - - Gets or sets the dictionary for temporary data. - The dictionary for temporary data. - - - Gets or sets a value that indicates whether request validation is enabled for this request. - true if request validation is enabled for this request; otherwise, false. The default is true. - - - Gets or sets the value provider for the controller. - The value provider for the controller. - - - Gets the dynamic view data dictionary. - The dynamic view data dictionary. - - - Gets or sets the dictionary for view data. - The dictionary for the view data. - - - Represents a class that is responsible for dynamically building a controller. - - - Initializes a new instance of the class. - - - Gets the current controller builder object. - The current controller builder. - - - Gets the default namespaces. - The default namespaces. - - - Gets the associated controller factory. - The controller factory. - - - Sets the controller factory by using the specified type. - The type of the controller factory. - The parameter is null. - The controller factory cannot be assigned from the type in the parameter. - An error occurred while the controller factory was being set. - - - Sets the specified controller factory. - The controller factory. - The parameter is null. - - - Encapsulates information about an HTTP request that matches specified and instances. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using the specified HTTP context, URL route data, and controller. - The HTTP context. - The route data. - The controller. - - - Initializes a new instance of the class by using the specified controller context. - The controller context. - The parameter is null. - - - Initializes a new instance of the class by using the specified request context and controller. - The request context. - The controller. - One or both parameters are null. - - - Gets or sets the controller. - The controller. - - - Gets or sets the HTTP context. - The HTTP context. - - - Gets a value that indicates whether the associated action method is a child action. - true if the associated action method is a child action; otherwise, false. - - - Gets an object that contains the view context information for the parent action method. - An object that contains the view context information for the parent action method. - - - Gets or sets the request context. - The request context. - - - Gets or sets the URL route data. - The URL route data. - - - Encapsulates information that describes a controller, such as its name, type, and actions. - - - Initializes a new instance of the class. - - - Gets the name of the controller. - The name of the controller. - - - Gets the type of the controller. - The type of the controller. - - - Finds an action method by using the specified name and controller context. - The information about the action method. - The controller context. - The name of the action. - - - Retrieves a list of action-method descriptors in the controller. - A list of action-method descriptors in the controller. - - - Retrieves custom attributes that are defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - - - Retrieves custom attributes of a specified type that are defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - The parameter is null (Nothing in Visual Basic). - - - Retrieves a value that indicates whether one or more instance of the specified custom attribute are defined for this member. - true if the is defined for this member; otherwise, false. - The type of the custom attribute. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The parameter is null (Nothing in Visual Basic). - - - When implemented in a derived class, gets the unique ID for the controller descriptor using lazy initialization. - The unique ID. - - - Adds the controller to the instance. - - - Initializes a new instance of the class. - - - Returns the collection of controller instance filters. - The collection of controller instance filters. - The controller context. - The action descriptor. - - - Represents an attribute that invokes a custom model binder. - - - Initializes a new instance of the class. - - - Retrieves the associated model binder. - A reference to an object that implements the interface. - - - Provides a container for common metadata, for the class, and for the class for a data model. - - - Initializes a new instance of the class. - The data-annotations model metadata provider. - The type of the container. - The model accessor. - The type of the model. - The name of the property. - The display column attribute. - - - Returns simple text for the model data. - Simple text for the model data. - - - Implements the default model metadata provider for ASP.NET MVC. - - - Initializes a new instance of the class. - - - Gets the metadata for the specified property. - The metadata for the property. - The attributes. - The type of the container. - The model accessor. - The type of the model. - The name of the property. - - - Represents the method that creates a instance. - - - Provides a model validator. - - - Initializes a new instance of the class. - The metadata for the model. - The controller context for the model. - The validation attribute for the model. - - - Gets the validation attribute for the model validator. - The validation attribute for the model validator. - - - Gets the error message for the validation failure. - The error message for the validation failure. - - - Retrieves a collection of client validation rules. - A collection of client validation rules. - - - Gets a value that indicates whether model validation is required. - true if model validation is required; otherwise, false. - - - Returns a list of validation error messages for the model. - A list of validation error messages for the model, or an empty list if no errors have occurred. - The container for the model. - - - Provides a model validator for a specified validation type. - - - - Initializes a new instance of the class. - The metadata for the model. - The controller context for the model. - The validation attribute for the model. - - - Gets the validation attribute from the model validator. - The validation attribute from the model validator. - - - Implements the default validation provider for ASP.NET MVC. - - - Initializes a new instance of the class. - - - Gets or sets a value that indicates whether non-nullable value types are required. - true if non-nullable value types are required; otherwise, false. - - - Gets a list of validators. - A list of validators. - The metadata. - The context. - The list of validation attributes. - - - Registers an adapter to provide client-side validation. - The type of the validation attribute. - The type of the adapter. - - - Registers an adapter factory for the validation provider. - The type of the attribute. - The factory that will be used to create the object for the specified attribute. - - - Registers the default adapter. - The type of the adapter. - - - Registers the default adapter factory. - The factory that will be used to create the object for the default adapter. - - - Registers an adapter to provide default object validation. - The type of the adapter. - - - Registers an adapter factory for the default object validation provider. - The factory. - - - Registers an adapter to provide object validation. - The type of the model. - The type of the adapter. - - - Registers an adapter factory for the object validation provider. - The type of the model. - The factory. - - - Provides a factory for validators that are based on . - - - Provides a container for the error-information model validator. - - - Initializes a new instance of the class. - - - Gets a list of error-information model validators. - A list of error-information model validators. - The model metadata. - The controller context. - - - Represents the controller factory that is registered by default. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using a controller activator. - An object that implements the controller activator interface. - - - Creates the specified controller by using the specified request context. - The controller. - The context of the HTTP request, which includes the HTTP context and route data. - The name of the controller. - The parameter is null. - The parameter is null or empty. - - - Retrieves the controller instance for the specified request context and controller type. - The controller instance. - The context of the HTTP request, which includes the HTTP context and route data. - The type of the controller. - - is null. - - cannot be assigned. - An instance of cannot be created. - - - Returns the controller's session behavior. - The controller's session behavior. - The request context. - The type of the controller. - - - Retrieves the controller type for the specified name and request context. - The controller type. - The context of the HTTP request, which includes the HTTP context and route data. - The name of the controller. - - - Releases the specified controller. - The controller to release. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. This method calls the method. - The controller's session behavior. - The request context. - The controller name. - - - Maps a browser request to a data object. This class provides a concrete implementation of a model binder. - - - Initializes a new instance of the class. - - - Gets or sets the model binders for the application. - The model binders for the application. - - - Binds the model by using the specified controller context and binding context. - The bound object. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - The parameter is null. - - - Binds the specified property by using the specified controller context and binding context and the specified property descriptor. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - Describes a property to be bound. The descriptor provides information such as the component type, property type, and property value. It also provides methods to get or set the property value. - - - Creates the specified model type by using the specified controller context and binding context. - A data object of the specified type. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - The type of the model object to return. - - - Creates an index (a subindex) based on a category of components that make up a larger index, where the specified index value is an integer. - The name of the subindex. - The prefix for the subindex. - The index value. - - - Creates an index (a subindex) based on a category of components that make up a larger index, where the specified index value is a string. - The name of the subindex. - The prefix for the subindex. - The index value. - - - Creates the name of the subproperty by using the specified prefix and property name. - The name of the subproperty. - The prefix for the subproperty. - The name of the property. - - - Returns a set of properties that match the property filter restrictions that are established by the specified . - An enumerable set of property descriptors. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - - - Returns the properties of the model by using the specified controller context and binding context. - A collection of property descriptors. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - - - Returns the value of a property using the specified controller context, binding context, property descriptor, and property binder. - An object that represents the property value. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - The descriptor for the property to access. The descriptor provides information such as the component type, property type, and property value. It also provides methods to get or set the property value. - An object that provides a way to bind the property. - - - Returns the descriptor object for a type that is specified by its controller context and binding context. - A custom type descriptor object. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - - - Determines whether a data model is valid for the specified binding context. - true if the model is valid; otherwise, false. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - The parameter is null. - - - Called when the model is updated. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - - - Called when the model is updating. - true if the model is updating; otherwise, false. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - - - Called when the specified property is validated. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - Describes a property to be validated. The descriptor provides information such as the component type, property type, and property value. It also provides methods to get or set the property value. - The value to set for the property. - - - Called when the specified property is validating. - true if the property is validating; otherwise, false. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - Describes a property being validated. The descriptor provides information such as component type, property type, and property value. It also provides methods to get or set the property value. - The value to set for the property. - - - Gets or sets the name of the resource file (class key) that contains localized string values. - The name of the resource file (class key). - - - Sets the specified property by using the specified controller context, binding context, and property value. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - Describes a property to be set. The descriptor provides information such as the component type, property type, and property value. It also provides methods to get or set the property value. - The value to set for the property. - - - Represents a memory cache for view locations. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using the specified cache time span. - The cache time span. - The Ticks attribute of the parameter is set to a negative number. - - - Retrieves the default view location by using the specified HTTP context and cache key. - The default view location. - The HTTP context. - The cache key - The parameter is null. - - - Inserts the view in the specified virtual path by using the specified HTTP context, cache key, and virtual path. - The HTTP context. - The cache key. - The virtual path - The parameter is null. - - - Creates an empty view location cache. - - - Gets or sets the cache time span. - The cache time span. - - - Provides a registration point for dependency resolvers that implement or the Common Service Locator IServiceLocator interface. - - - Initializes a new instance of the class. - - - Gets the implementation of the dependency resolver. - The implementation of the dependency resolver. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. - The implementation of the dependency resolver. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. - The function that provides the service. - The function that provides the services. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. - The common service locator. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. - The object that implements the dependency resolver. - - - Provides a registration point for dependency resolvers using the specified service delegate and specified service collection delegates. - The service delegate. - The services delegates. - - - Provides a registration point for dependency resolvers using the provided common service locator when using a service locator interface. - The common service locator. - - - Provides a registration point for dependency resolvers, using the specified dependency resolver interface. - The dependency resolver. - - - Provides a type-safe implementation of and . - - - Resolves singly registered services that support arbitrary object creation. - The requested service or object. - The dependency resolver instance that this method extends. - The type of the requested service or object. - - - Resolves multiply registered services. - The requested services. - The dependency resolver instance that this method extends. - The type of the requested services. - - - Represents the base class for value providers whose values come from a collection that implements the interface. - The type of the value. - - - Initializes a new instance of the class. - The name/value pairs that are used to initialize the value provider. - Information about a specific culture, such as the names of the culture, the writing system, and the calendar used. - The parameter is null. - - - Determines whether the collection contains the specified prefix. - true if the collection contains the specified prefix; otherwise, false. - The prefix to search for. - The parameter is null. - - - Returns a value object using the specified key and controller context. - The value object for the specified key. - The key of the value object to retrieve. - The parameter is null. - - - Provides an empty metadata provider for data models that do not require metadata. - - - Initializes a new instance of the class. - - - Creates a new instance of the class. - A new instance of the class. - The attributes. - The type of the container. - The model accessor. - The type of the model. - The name of the model. - - - Provides an empty validation provider for models that do not require a validator. - - - Initializes a new instance of the class. - - - Gets the empty model validator. - The empty model validator. - The metadata. - The context. - - - Represents a result that does nothing, such as a controller action method that returns nothing. - - - Initializes a new instance of the class. - - - Executes the specified result context. - The result context. - - - Provides the context for using the class. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class for the specified exception by using the specified controller context. - The controller context. - The exception. - The parameter is null. - - - Gets or sets the exception object. - The exception object. - - - Gets or sets a value that indicates whether the exception has been handled. - true if the exception has been handled; otherwise, false. - - - Gets or sets the action result. - The action result. - - - Provides a helper class to get the model name from an expression. - - - Gets the model name from a lambda expression. - The model name. - The expression. - - - Gets the model name from a string expression. - The model name. - The expression. - - - Provides a container for client-side field validation metadata. - - - Initializes a new instance of the class. - - - Gets or sets the name of the data field. - The name of the data field. - - - Gets or sets a value that indicates whether the validation message contents should be replaced with the client validation error. - true if the validation message contents should be replaced with the client validation error; otherwise, false. - - - Gets or sets the validator message ID. - The validator message ID. - - - Gets the client validation rules. - The client validation rules. - - - Sends the contents of a binary file to the response. - - - Initializes a new instance of the class by using the specified file contents and content type. - The byte array to send to the response. - The content type to use for the response. - The parameter is null. - - - The binary content to send to the response. - The file contents. - - - Writes the file content to the response. - The response. - - - Sends the contents of a file to the response. - - - Initializes a new instance of the class by using the specified file name and content type. - The name of the file to send to the response. - The content type of the response. - The parameter is null or empty. - - - Gets or sets the path of the file that is sent to the response. - The path of the file that is sent to the response. - - - Writes the file to the response. - The response. - - - Represents a base class that is used to send binary file content to the response. - - - Initializes a new instance of the class. - The type of the content. - The parameter is null or empty. - - - Gets the content type to use for the response. - The type of the content. - - - Enables processing of the result of an action method by a custom type that inherits from the class. - The context within which the result is executed. - The parameter is null. - - - Gets or sets the content-disposition header so that a file-download dialog box is displayed in the browser with the specified file name. - The name of the file. - - - Writes the file to the response. - The response. - - - Sends binary content to the response by using a instance. - - - Initializes a new instance of the class. - The stream to send to the response. - The content type to use for the response. - The parameter is null. - - - Gets the stream that will be sent to the response. - The file stream. - - - Writes the file to the response. - The response. - - - Represents a metadata class that contains a reference to the implementation of one or more of the filter interfaces, the filter's order, and the filter's scope. - - - Initializes a new instance of the class. - The instance. - The scope. - The order. - - - Represents a constant that is used to specify the default ordering of filters. - - - Gets the instance of this class. - The instance of this class. - - - Gets the order in which the filter is applied. - The order in which the filter is applied. - - - Gets the scope ordering of the filter. - The scope ordering of the filter. - - - Represents the base class for action and result filter attributes. - - - Initializes a new instance of the class. - - - Gets or sets a value that indicates whether more than one instance of the filter attribute can be specified. - true if more than one instance of the filter attribute can be specified; otherwise, false. - - - Gets or sets the order in which the action filters are executed. - The order in which the action filters are executed. - - - Defines a filter provider for filter attributes. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class and optionally caches attribute instances. - true to cache attribute instances; otherwise, false. - - - Gets a collection of custom action attributes. - A collection of custom action attributes. - The controller context. - The action descriptor. - - - Gets a collection of controller attributes. - A collection of controller attributes. - The controller context. - The action descriptor. - - - Aggregates the filters from all of the filter providers into one collection. - The collection filters from all of the filter providers. - The controller context. - The action descriptor. - - - Encapsulates information about the available action filters. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the specified filters collection. - The filters collection. - - - Gets all the action filters in the application. - The action filters. - - - Gets all the authorization filters in the application. - The authorization filters. - - - Gets all the exception filters in the application. - The exception filters. - - - Gets all the result filters in the application. - The result filters. - - - Represents the collection of filter providers for the application. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the filter providers collection. - The filter providers collection. - - - Returns the collection of filter providers. - The collection of filter providers. - The controller context. - The action descriptor. - - - Provides a registration point for filters. - - - Provides a registration point for filters. - The collection of filters. - - - Defines values that specify the order in which ASP.NET MVC filters run within the same filter type and filter order. - - - Specifies first. - - - Specifies an order before and after . - - - Specifies an order before and after . - - - Specifies an order before and after . - - - Specifies last. - - - Contains the form value providers for the application. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class. - The collection. - The parameter is null. - - - Gets the specified value provider. - The value provider. - The name of the value provider to get. - The parameter is null or empty. - - - Gets a value that indicates whether the value provider contains an entry that has the specified prefix. - true if the value provider contains an entry that has the specified prefix; otherwise, false. - The prefix to look for. - - - Gets a value from a value provider using the specified key. - A value from a value provider. - The key. - - - Returns a dictionary that contains the value providers. - A dictionary of value providers. - - - Encapsulates information that is required in order to validate and process the input data from an HTML form. - - - Initializes a new instance of the class. - - - Gets the field validators for the form. - A dictionary of field validators for the form. - - - Gets or sets the form identifier. - The form identifier. - - - Returns a serialized object that contains the form identifier and field-validation values for the form. - A serialized object that contains the form identifier and field-validation values for the form. - - - Returns the validation value for the specified input field. - The value to validate the field input with. - The name of the field to retrieve the validation value for. - The parameter is either null or empty. - - - Returns the validation value for the specified input field and a value that indicates what to do if the validation value is not found. - The value to validate the field input with. - The name of the field to retrieve the validation value for. - true to create a validation value if one is not found; otherwise, false. - The parameter is either null or empty. - - - Returns a value that indicates whether the specified field has been rendered in the form. - true if the field has been rendered; otherwise, false. - The field name. - - - Sets a value that indicates whether the specified field has been rendered in the form. - The field name. - true to specify that the field has been rendered in the form; otherwise, false. - - - Determines whether client validation errors should be dynamically added to the validation summary. - true if client validation errors should be added to the validation summary; otherwise, false. - - - Gets or sets the identifier for the validation summary. - The identifier for the validation summary. - - - Enumerates the HTTP request types for a form. - - - Specifies a GET request. - - - Specifies a POST request. - - - Represents a value provider for form values that are contained in a object. - - - Initializes a new instance of the class. - An object that encapsulates information about the current HTTP request. - - - Represents a class that is responsible for creating a new instance of a form-value provider object. - - - Initializes a new instance of the class. - - - Returns a form-value provider object for the specified controller context. - A form-value provider object. - An object that encapsulates information about the current HTTP request. - The parameter is null. - - - Represents a class that contains all the global filters. - - - Initializes a new instance of the class. - - - Adds the specified filter to the global filter collection. - The filter. - - - Adds the specified filter to the global filter collection using the specified filter run order. - The filter. - The filter run order. - - - Removes all filters from the global filter collection. - - - Determines whether a filter is in the global filter collection. - true if is found in the global filter collection; otherwise, false. - The filter. - - - Gets the number of filters in the global filter collection. - The number of filters in the global filter collection. - - - Returns an enumerator that iterates through the global filter collection. - An enumerator that iterates through the global filter collection. - - - Removes all the filters that match the specified filter. - The filter to remove. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. - An enumerator that iterates through the global filter collection. - - - This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. - An enumerator that iterates through the global filter collection. - The controller context. - The action descriptor. - - - Represents the global filter collection. - - - Gets or sets the global filter collection. - The global filter collection. - - - Represents an attribute that is used to handle an exception that is thrown by an action method. - - - Initializes a new instance of the class. - - - Gets or sets the type of the exception. - The type of the exception. - - - Gets or sets the master view for displaying exception information. - The master view. - - - Called when an exception occurs. - The action-filter context. - The parameter is null. - - - Gets the unique identifier for this attribute. - The unique identifier for this attribute. - - - Gets or sets the page view for displaying exception information. - The page view. - - - Encapsulates information for handling an error that was thrown by an action method. - - - Initializes a new instance of the class. - The exception. - The name of the controller. - The name of the action. - The parameter is null. - The or parameter is null or empty. - - - Gets or sets the name of the action that was executing when the exception was thrown. - The name of the action. - - - Gets or sets the name of the controller that contains the action method that threw the exception. - The name of the controller. - - - Gets or sets the exception object. - The exception object. - - - Represents an attribute that is used to indicate whether a property or field value should be rendered as a hidden input element. - - - Initializes a new instance of the class. - - - Gets or sets a value that indicates whether to display the value of the hidden input element. - true if the value should be displayed; otherwise, false. - - - Represents support for rendering HTML controls in a view. - - - Initializes a new instance of the class by using the specified view context and view data container. - The view context. - The view data container. - The or the parameter is null. - - - Initializes a new instance of the class by using the specified view context, view data container, and route collection. - The view context. - The view data container. - The route collection. - One or more parameters is null. - - - Replaces underscore characters (_) with hyphens (-) in the specified HTML attributes. - The HTML attributes with underscore characters replaced by hyphens. - The HTML attributes. - - - Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. - The generated form field (anti-forgery token). - - - Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. The field value is generated using the specified salt value. - The generated form field (anti-forgery token). - The salt value, which can be any non-empty string. - - - Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. The field value is generated using the specified salt value, domain, and path. - The generated form field (anti-forgery token). - The salt value, which can be any non-empty string. - The application domain. - The virtual path. - - - Converts the specified attribute object to an HTML-encoded string. - The HTML-encoded string. If the value parameter is null or empty, this method returns an empty string. - The object to encode. - - - Converts the specified attribute string to an HTML-encoded string. - The HTML-encoded string. If the value parameter is null or empty, this method returns an empty string. - The string to encode. - - - Gets or sets a value that indicates whether client validation is enabled. - true if enable client validation is enabled; otherwise, false. - - - Enables input validation that is performed by using client script in the browser. - - - Enables or disables client validation. - true to enable client validation; otherwise, false. - - - Enables unobtrusive JavaScript. - - - Enables or disables unobtrusive JavaScript. - true to enable unobtrusive JavaScript; otherwise, false. - - - Converts the value of the specified object to an HTML-encoded string. - The HTML-encoded string. - The object to encode. - - - Converts the specified string to an HTML-encoded string. - The HTML-encoded string. - The string to encode. - - - Creates an HTML element ID using the specified element name. - The ID of the HTML element. - The name of the HTML element. - The parameter is null. - - - Creates an HTML element ID using the specified element name and a string that replaces dots in the name. - The ID of the HTML element. - The name of the HTML element. - The string that replaces dots (.) in the parameter. - The parameter or the parameter is null. - - - Generates an HTML anchor element (a element) that links to the specified action method, and enables the user to specify the communication protocol, name of the host, and a URL fragment. - An HTML element that links to the specified action method. - The context of the HTTP request. - The collection of URL routes. - The text caption to display for the link. - The name of the route that is used to return a virtual path. - The name of the action method. - The name of the controller. - The communication protocol, such as HTTP or HTTPS. If this parameter is null, the protocol defaults to HTTP. - The name of the host. - The fragment identifier. - An object that contains the parameters for a route. - An object that contains the HTML attributes for the element. - - - Generates an HTML anchor element (a element) that links to the specified action method. - An HTML element that links to the specified action method. - The context of the HTTP request. - The collection of URL routes. - The text caption to display for the link. - The name of the route that is used to return a virtual path. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. - An object that contains the HTML attributes for the element. - - - Generates an HTML anchor element (a element) that links to the specified URL route, and enables the user to specify the communication protocol, name of the host, and a URL fragment. - An HTML element that links to the specified URL route. - The context of the HTTP request. - The collection of URL routes. - The text caption to display for the link. - The name of the route that is used to return a virtual path. - The communication protocol, such as HTTP or HTTPS. If this parameter is null, the protocol defaults to HTTP. - The name of the host. - The fragment identifier. - An object that contains the parameters for a route. - An object that contains the HTML attributes for the element. - - - Generates an HTML anchor element (a element) that links to the specified URL route. - An HTML element that links to the specified URL route. - The context of the HTTP request. - The collection of URL routes. - The text caption to display for the link. - The name of the route that is used to return a virtual path. - An object that contains the parameters for a route. - An object that contains the HTML attributes for the element. - - - Returns the HTTP method that handles form input (GET or POST) as a string. - The form method string, either "get" or "post". - The HTTP method that handles the form. - - - Returns the HTML input control type as a string. - The input type string ("checkbox", "hidden", "password", "radio", or "text"). - The enumerated input type. - - - Gets the collection of unobtrusive JavaScript validation attributes using the specified HTML name attribute. - The collection of unobtrusive JavaScript validation attributes. - The HTML name attribute. - - - Gets the collection of unobtrusive JavaScript validation attributes using the specified HTML name attribute and model metadata. - The collection of unobtrusive JavaScript validation attributes. - The HTML name attribute. - The model metadata. - - - Returns a hidden input element that identifies the override method for the specified HTTP data-transfer method that was used by the client. - The override method that uses the HTTP data-transfer method that was used by the client. - The HTTP data-transfer method that was used by the client (DELETE, HEAD, or PUT). - The parameter is not "PUT", "DELETE", or "HEAD". - - - Returns a hidden input element that identifies the override method for the specified verb that represents the HTTP data-transfer method used by the client. - The override method that uses the verb that represents the HTTP data-transfer method used by the client. - The verb that represents the HTTP data-transfer method used by the client. - The parameter is not "PUT", "DELETE", or "HEAD". - - - Gets or sets the character that replaces periods in the ID attribute of an element. - The character that replaces periods in the ID attribute of an element. - - - Returns markup that is not HTML encoded. - The HTML markup without encoding. - The HTML markup. - - - Gets or sets the collection of routes for the application. - The collection of routes for the application. - - - Gets or sets a value that indicates whether unobtrusive JavaScript is enabled. - true if unobtrusive JavaScript is enabled; otherwise, false. - - - The name of the CSS class that is used to style an input field when a validation error occurs. - - - The name of the CSS class that is used to style an input field when the input is valid. - - - The name of the CSS class that is used to style the error message when a validation error occurs. - - - The name of the CSS class that is used to style the validation message when the input is valid. - - - The name of the CSS class that is used to style validation summary error messages. - - - The name of the CSS class that is used to style the validation summary when the input is valid. - - - Gets or sets the context information about the view. - The context of the view. - - - Gets the current view data dictionary. - The view data dictionary. - - - Gets or sets the view data container. - The view data container. - - - Represents support for rendering HTML controls in a strongly typed view. - The type of the model. - - - Initializes a new instance of the class by using the specified view context and view data container. - The view context. - The view data container. - - - Initializes a new instance of the class by using the specified view context, view data container, and route collection. - The view context. - The view data container. - The route collection. - - - Gets the strongly typed view data dictionary. - The strongly typed view data dictionary. - - - Represents an attribute that is used to restrict an action method so that the method handles only HTTP DELETE requests. - - - Initializes a new instance of the class. - - - Determines whether a request is a valid HTTP DELETE request. - true if the request is valid; otherwise, false. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - Encapsulates information about a method, such as its type, return type, and arguments. - - - Represents a value provider to use with values that come from a collection of HTTP files. - - - Initializes a new instance of the class. - An object that encapsulates information about the current HTTP request. - - - Represents a class that is responsible for creating a new instance of an HTTP file collection value provider object. - - - Initializes a new instance of the class. - - - Returns a value provider object for the specified controller context. - An HTTP file collection value provider. - An object that encapsulates information about the HTTP request. - The parameter is null. - - - Represents an attribute that is used to restrict an action method so that the method handles only HTTP GET requests. - - - Initializes a new instance of the class. - - - Determines whether a request is a valid HTTP GET request. - true if the request is valid; otherwise, false. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - Encapsulates information about a method, such as its type, return type, and arguments. - - - Defines an object that is used to indicate that the requested resource was not found. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using a status description. - The status description. - - - Represents an attribute that is used to restrict an action method so that the method handles only HTTP POST requests. - - - Initializes a new instance of the class. - - - Determines whether a request is a valid HTTP POST request. - true if the request is valid; otherwise, false. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - Encapsulates information about a method, such as its type, return type, and arguments. - - - Binds a model to a posted file. - - - Initializes a new instance of the class. - - - Binds the model. - The bound value. - The controller context. - The binding context. - One or both parameters are null. - - - Represents an attribute that is used to restrict an action method so that the method handles only HTTP PUT requests. - - - Initializes a new instance of the class. - - - Determines whether a request is a valid HTTP PUT request. - true if the request is valid; otherwise, false. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - Encapsulates information about a method, such as its type, return type, and arguments. - - - Extends the class that contains the HTTP values that were sent by a client during a Web request. - - - Retrieves the HTTP data-transfer method override that was used by the client. - The HTTP data-transfer method override that was used by the client. - An object that contains the HTTP values that were sent by a client during a Web request. - The parameter is null. - The HTTP data-transfer method override was not implemented. - - - Provides a way to return an action result with a specific HTTP response status code and description. - - - Initializes a new instance of the class using a status code. - The status code. - - - Initializes a new instance of the class using a status code and status description. - The status code. - The status description. - - - Enables processing of the result of an action method by a custom type that inherits from the class. - The context in which the result is executed. The context information includes the controller, HTTP content, request context, and route data. - - - Gets the HTTP status code. - The HTTP status code. - - - Gets the HTTP status description. - the HTTP status description. - - - Represents the result of an unauthorized HTTP request. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the status description. - The status description. - - - Enumerates the HTTP verbs. - - - Retrieves the information or entity that is identified by the URI of the request. - - - Posts a new entity as an addition to a URI. - - - Replaces an entity that is identified by a URI. - - - Requests that a specified URI be deleted. - - - Retrieves the message headers for the information or entity that is identified by the URI of the request. - - - Defines the methods that are used in an action filter. - - - Called after the action method executes. - The filter context. - - - Called before an action method executes. - The filter context. - - - Defines the contract for an action invoker, which is used to invoke an action in response to an HTTP request. - - - Invokes the specified action by using the specified controller context. - true if the action was found; otherwise, false. - The controller context. - The name of the action. - - - Defines the methods that are required for an authorization filter. - - - Called when authorization is required. - The filter context. - - - Provides a way for the ASP.NET MVC validation framework to discover at run time whether a validator has support for client validation. - - - When implemented in a class, returns client validation rules for that class. - The client validation rules for this validator. - The model metadata. - The controller context. - - - Defines the methods that are required for a controller. - - - Executes the specified request context. - The request context. - - - Provides fine-grained control over how controllers are instantiated using dependency injection. - - - When implemented in a class, creates a controller. - The created controller. - The request context. - The controller type. - - - Defines the methods that are required for a controller factory. - - - Creates the specified controller by using the specified request context. - The controller. - The request context. - The name of the controller. - - - Gets the controller's session behavior. - The controller's session behavior. - The request context. - The name of the controller whose session behavior you want to get. - - - Releases the specified controller. - The controller. - - - Defines the methods that simplify service location and dependency resolution. - - - Resolves singly registered services that support arbitrary object creation. - The requested service or object. - The type of the requested service or object. - - - Resolves multiply registered services. - The requested services. - The type of the requested services. - - - Defines the methods that are required for an exception filter. - - - Called when an exception occurs. - The filter context. - - - Provides an interface for finding filters. - - - Returns an enumerator that contains all the instances in the service locator. - The enumerator that contains all the instances in the service locator. - The controller context. - The action descriptor. - - - Provides an interface for exposing attributes to the class. - - - When implemented in a class, provides metadata to the model metadata creation process. - The model metadata. - - - Defines the methods that are required for a model binder. - - - Binds the model to a value by using the specified controller context and binding context. - The bound value. - The controller context. - The binding context. - - - Defines methods that enable dynamic implementations of model binding for classes that implement the interface. - - - Returns the model binder for the specified type. - The model binder for the specified type. - The type of the model. - - - Defines members that specify the order of filters and whether multiple filters are allowed. - - - When implemented in a class, gets or sets a value that indicates whether multiple filters are allowed. - true if multiple filters are allowed; otherwise, false. - - - When implemented in a class, gets the filter order. - The filter order. - - - Enumerates the types of input controls. - - - A check box. - - - A hidden field. - - - A password box. - - - A radio button. - - - A text box. - - - Defines the methods that are required for a result filter. - - - Called after an action result executes. - The filter context. - - - Called before an action result executes. - The filter context. - - - Associates a route with an area in an ASP.NET MVC application. - - - Gets the name of the area to associate the route with. - The name of the area to associate the route with. - - - Defines the contract for temporary-data providers that store data that is viewed on the next request. - - - Loads the temporary data. - The temporary data. - The controller context. - - - Saves the temporary data. - The controller context. - The values. - - - Represents an interface that can skip request validation. - - - Retrieves the value of the object that is associated with the specified key. - The value of the object for the specified key. - The key. - true if validation should be skipped; otherwise, false. - - - Defines the methods that are required for a value provider in ASP.NET MVC. - - - Determines whether the collection contains the specified prefix. - true if the collection contains the specified prefix; otherwise, false. - The prefix to search for. - - - Retrieves a value object using the specified key. - The value object for the specified key. - The key of the value object to retrieve. - - - Defines the methods that are required for a view. - - - Renders the specified view context by using the specified the writer object. - The view context. - The writer object. - - - Defines the methods that are required for a view data dictionary. - - - Gets or sets the view data dictionary. - The view data dictionary. - - - Defines the methods that are required for a view engine. - - - Finds the specified partial view by using the specified controller context. - The partial view. - The controller context. - The name of the partial view. - true to specify that the view engine returns the cached view, if a cached view exists; otherwise, false. - - - Finds the specified view by using the specified controller context. - The page view. - The controller context. - The name of the view. - The name of the master. - true to specify that the view engine returns the cached view, if a cached view exists; otherwise, false. - - - Releases the specified view by using the specified controller context. - The controller context. - The view. - - - Defines the methods that are required in order to cache view locations in memory. - - - Gets the view location by using the specified HTTP context and the cache key. - The view location. - The HTTP context. - The cache key. - - - Inserts the specified view location into the cache by using the specified HTTP context and the cache key. - The HTTP context. - The cache key. - The virtual path. - - - Provides fine-grained control over how view pages are instantiated using dependency injection. - - - The created view page. - The controller context. - The type of the controller. - - - Sends JavaScript content to the response. - - - Initializes a new instance of the class. - - - Enables processing of the result of an action method by a custom type that inherits from the class. - The context within which the result is executed. - The parameter is null. - - - Gets or sets the script. - The script. - - - Specifies whether HTTP GET requests from the client are allowed. - - - HTTP GET requests from the client are allowed. - - - HTTP GET requests from the client are not allowed. - - - Represents a class that is used to send JSON-formatted content to the response. - - - Initializes a new instance of the class. - - - Gets or sets the content encoding. - The content encoding. - - - Gets or sets the type of the content. - The type of the content. - - - Gets or sets the data. - The data. - - - Enables processing of the result of an action method by a custom type that inherits from the class. - The context within which the result is executed. - The parameter is null. - - - Gets or sets a value that indicates whether HTTP GET requests from the client are allowed. - A value that indicates whether HTTP GET requests from the client are allowed. - - - Enables action methods to send and receive JSON-formatted text and to model-bind the JSON text to parameters of action methods. - - - Initializes a new instance of the class. - - - Returns a JSON value-provider object for the specified controller context. - A JSON value-provider object for the specified controller context. - The controller context. - - - Maps a browser request to a LINQ object. - - - Initializes a new instance of the class. - - - Binds the model by using the specified controller context and binding context. - The bound data object. If the model cannot be bound, this method returns null. - The context within which the controller operates. The context information includes the controller, HTTP content, request context, and route data. - The context within which the model is bound. The context includes information such as the model object, model name, model type, property filter, and value provider. - - - Represents an attribute that is used to associate a model type to a model-builder type. - - - Initializes a new instance of the class. - The type of the binder. - The parameter is null. - - - Gets or sets the type of the binder. - The type of the binder. - - - Retrieves an instance of the model binder. - A reference to an object that implements the interface. - An error occurred while an instance of the model binder was being created. - - - Represents a class that contains all model binders for the application, listed by binder type. - - - Initializes a new instance of the class. - - - Adds the specified item to the model binder dictionary. - The object to add to the instance. - The object is read-only. - - - Adds the specified item to the model binder dictionary using the specified key. - The key of the element to add. - The value of the element to add. - The object is read-only. - - is null. - An element that has the same key already exists in the object. - - - Removes all items from the model binder dictionary. - The object is read-only. - - - Determines whether the model binder dictionary contains a specified value. - true if is found in the model binder dictionary; otherwise, false. - The object to locate in the object. - - - Determines whether the model binder dictionary contains an element that has the specified key. - true if the model binder dictionary contains an element that has the specified key; otherwise, false. - The key to locate in the object. - - is null. - - - Copies the elements of the model binder dictionary to an array, starting at a specified index. - The one-dimensional array that is the destination of the elements copied from . The array must have zero-based indexing. - The zero-based index in at which copying starts. - - is null. - - is less than 0. - - is multidimensional.-or- is equal to or greater than the length of .-or- The number of elements in the source object is greater than the available space from to the end of the destination array. -or- Type cannot be cast automatically to the type of the destination array. - - - Gets the number of elements in the model binder dictionary. - The number of elements in the model binder dictionary. - - - Gets or sets the default model binder. - The default model binder. - - - Retrieves the model binder for the specified type. - The model binder. - The type of the model to retrieve. - The parameter is null. - - - Retrieves the model binder for the specified type or retrieves the default model binder. - The model binder. - The type of the model to retrieve. - true to retrieve the default model binder. - The parameter is null. - - - Returns an enumerator that can be used to iterate through the collection. - An enumerator that can be used to iterate through the collection. - - - Gets a value that indicates whether the model binder dictionary is read-only. - true if the model binder dictionary is read-only; otherwise, false. - - - Gets or sets the specified key in an object that implements the interface. - The key for the specified item. - The item key. - - - Gets a collection that contains the keys in the model binder dictionary. - A collection that contains the keys in the model binder dictionary. - - - Removes the first occurrence of the specified element from the model binder dictionary. - true if was successfully removed from the model binder dictionary; otherwise, false. This method also returns false if is not found in the model binder dictionary. - The object to remove from the object. - The object is read-only. - - - Removes the element that has the specified key from the model binder dictionary. - true if the element is successfully removed; otherwise, false. This method also returns false if was not found in the model binder dictionary. - The key of the element to remove. - The object is read-only. - - is null. - - - Returns an enumerator that can be used to iterate through a collection. - An enumerator that can be used to iterate through the collection. - - - Gets the value that is associated with the specified key. - true if the object that implements contains an element that has the specified key; otherwise, false. - The key of the value to get. - When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. - - is null. - - - Gets a collection that contains the values in the model binder dictionary. - A collection that contains the values in the model binder dictionary. - - - Provides a container for model binder providers. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using a list of model binder providers. - A list of model binder providers. - - - Returns a model binder of the specified type. - A model binder of the specified type. - The type of the model binder. - - - Inserts a model binder provider into the at the specified index. - The index. - The model binder provider. - - - Replaces the model binder provider element at the specified index. - The index. - The model binder provider. - - - Provides a container for model binder providers. - - - Provides a registration point for model binder providers for applications that do not use dependency injection. - The model binder provider collection. - - - Provides global access to the model binders for the application. - - - Gets the model binders for the application. - The model binders for the application. - - - Provides the context in which a model binder functions. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the binding context. - The binding context. - - - Gets or sets a value that indicates whether the binder should use an empty prefix. - true if the binder should use an empty prefix; otherwise, false. - - - Gets or sets the model. - The model. - - - Gets or sets the model metadata. - The model metadata. - - - Gets or sets the name of the model. - The name of the model. - - - Gets or sets the state of the model. - The state of the model. - - - Gets or sets the type of the model. - The type of the model. - - - Gets or sets the property filter. - The property filter. - - - Gets the property metadata. - The property metadata. - - - Gets or sets the value provider. - The value provider. - - - Provides a container for an equality validation rule that is sent to the browser. - - - Initializes a new instance of the class. - The error message. - The model value used for equality comparison. - - - Provides a container for a range-validation rule that is sent to the browser. - - - Initializes a new instance of the class. - The error message. - The minimum value. - The maximum value. - - - Provides a container for a regular-expression client validation rule that is sent to the browser. - - - Initializes a new instance of the class. - The error message to display when the regular expression validation fails. - The regular expression. - - - Provides a container for a remote validation rule that is sent to the browser. - - - Initializes a new instance of the class. - The error message. - The URL for the validation parameters. - The HTTP method for the validation parameters. - - - Provides a container for client validation for required field. - - - Initializes a new instance of the class. - The error message to display when a value for the required field is not provided. - - - Provides a base class container for a client validation rule that is sent to the browser. - - - Initializes a new instance of the class. - - - Gets or sets the error message for the client validation rule. - The error message for the client validation rule. - - - Gets the list of validation parameters. - A list of validation parameters. - - - Gets or sets the validation type. - The validation type. - - - Provides a container for a string-length validation rule that is sent to the browser. - - - Initializes a new instance of the class. - The validation error message. - The minimum length of the string. - The maximum length of the string. - - - Represents an error that occurs during model binding. - - - Initializes a new instance of the class by using the specified exception. - The exception. - The parameter is null. - - - Initializes a new instance of the class by using the specified exception and error message. - The exception. - The error message. - The parameter is null. - - - Initializes a new instance of the class by using the specified error message. - The error message. - - - Gets or sets the error message. - The error message. - - - Gets or sets the exception object. - The exception object. - - - A collection of instances. - - - Initializes a new instance of the class. - - - Adds the specified object to the model-error collection. - The exception. - - - Adds the specified error message to the model-error collection. - The error message. - - - Provides a container for common metadata, for the class, and for the class for a data model. - - - Initializes a new instance of the class. - The provider. - The type of the container. - The model accessor. - The type of the model. - The name of the model. - - - Gets a dictionary that contains additional metadata about the model. - A dictionary that contains additional metadata about the model. - - - Gets or sets the type of the container for the model. - The type of the container for the model. - - - Gets or sets a value that indicates whether empty strings that are posted back in forms should be converted to null. - true if empty strings that are posted back in forms should be converted to null; otherwise, false. The default value is true. - - - Gets or sets meta information about the data type. - Meta information about the data type. - - - The default order value, which is 10000. - - - Gets or sets the description of the model. - The description of the model. The default value is null. - - - Gets or sets the display format string for the model. - The display format string for the model. - - - Gets or sets the display name of the model. - The display name of the model. - - - Gets or sets the edit format string of the model. - The edit format string of the model. - - - Returns the metadata from the parameter for the model. - The metadata. - An expression that identifies the model. - The view data dictionary. - The type of the parameter. - The type of the value. - - - Gets the metadata from the expression parameter for the model. - The metadata for the model. - An expression that identifies the model. - The view data dictionary. - - - Gets the display name for the model. - The display name for the model. - - - Returns the simple description of the model. - The simple description of the model. - - - Gets a list of validators for the model. - A list of validators for the model. - The controller context. - - - Gets or sets a value that indicates whether the model object should be rendered using associated HTML elements. - true if the associated HTML elements that contains the model object should be included with the object; otherwise, false. - - - Gets or sets a value that indicates whether the model is a complex type. - A value that indicates whether the model is considered a complex type by the MVC framework. - - - Gets a value that indicates whether the type is nullable. - true if the type is nullable; otherwise, false. - - - Gets or sets a value that indicates whether the model is read-only. - true if the model is read-only; otherwise, false. - - - Gets or sets a value that indicates whether the model is required. - true if the model is required; otherwise, false. - - - Gets the value of the model. - The value of the model. For more information about , see the entry ASP.NET MVC 2 Templates, Part 2: ModelMetadata on Brad Wilson's blog - - - Gets the type of the model. - The type of the model. - - - Gets or sets the string to display for null values. - The string to display for null values. - - - Gets or sets a value that represents order of the current metadata. - The order value of the current metadata. - - - Gets a collection of model metadata objects that describe the properties of the model. - A collection of model metadata objects that describe the properties of the model. - - - Gets the property name. - The property name. - - - Gets or sets the provider. - The provider. - - - Gets or sets a value that indicates whether request validation is enabled. - true if request validation is enabled; otherwise, false. - - - Gets or sets a short display name. - The short display name. - - - Gets or sets a value that indicates whether the property should be displayed in read-only views such as list and detail views. - true if the model should be displayed in read-only views; otherwise, false. - - - Gets or sets a value that indicates whether the model should be displayed in editable views. - true if the model should be displayed in editable views; otherwise, false. - - - Gets or sets the simple display string for the model. - The simple display string for the model. - - - Gets or sets a hint that suggests what template to use for this model. - A hint that suggests what template to use for this model. - - - Gets or sets a value that can be used as a watermark. - The watermark. - - - Provides an abstract base class for a custom metadata provider. - - - When overridden in a derived class, initializes a new instance of the object that derives from the class. - - - Gets a object for each property of a model. - A object for each property of a model. - The container. - The type of the container. - - - Gets metadata for the specified property. - A object for the property. - The model accessor. - The type of the container. - The property to get the metadata model for. - - - Gets metadata for the specified model accessor and model type. - A object for the specified model accessor and model type. - The model accessor. - The type of the model. - - - Provides a container for the current instance. - - - Gets or sets the current object. - The current object. - - - Encapsulates the state of model binding to a property of an action-method argument, or to the argument itself. - - - Initializes a new instance of the class. - - - Returns a object that contains any errors that occurred during model binding. - The errors. - - - Returns a object that encapsulates the value that was being bound during model binding. - The value. - - - Represents the state of an attempt to bind a posted form to an action method, which includes validation information. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using values that are copied from the specified model-state dictionary. - The model-state dictionary. - The parameter is null. - - - Adds the specified item to the model-state dictionary. - The object to add to the model-state dictionary. - The model-state dictionary is read-only. - - - Adds an element that has the specified key and value to the model-state dictionary. - The key of the element to add. - The value of the element to add. - The model-state dictionary is read-only. - - is null. - An element that has the specified key already occurs in the model-state dictionary. - - - Adds the specified model error to the errors collection for the model-state dictionary that is associated with the specified key. - The key. - The exception. - - - Adds the specified error message to the errors collection for the model-state dictionary that is associated with the specified key. - The key. - The error message. - - - Removes all items from the model-state dictionary. - The model-state dictionary is read-only. - - - Determines whether the model-state dictionary contains a specific value. - true if is found in the model-state dictionary; otherwise, false. - The object to locate in the model-state dictionary. - - - Determines whether the model-state dictionary contains the specified key. - true if the model-state dictionary contains the specified key; otherwise, false. - The key to locate in the model-state dictionary. - - - Copies the elements of the model-state dictionary to an array, starting at a specified index. - The one-dimensional array that is the destination of the elements copied from the object. The array must have zero-based indexing. - The zero-based index in at which copying starts. - - is null. - - is less than 0. - - is multidimensional.-or- is equal to or greater than the length of .-or- The number of elements in the source collection is greater than the available space from to the end of the destination .-or- Type cannot be cast automatically to the type of the destination . - - - Gets the number of key/value pairs in the collection. - The number of key/value pairs in the collection. - - - Returns an enumerator that can be used to iterate through the collection. - An enumerator that can be used to iterate through the collection. - - - Gets a value that indicates whether the collection is read-only. - true if the collection is read-only; otherwise, false. - - - Gets a value that indicates whether this instance of the model-state dictionary is valid. - true if this instance is valid; otherwise, false. - - - Determines whether there are any objects that are associated with or prefixed with the specified key. - true if the model-state dictionary contains a value that is associated with the specified key; otherwise, false. - The key. - The parameter is null. - - - Gets or sets the value that is associated with the specified key. - The model state item. - The key. - - - Gets a collection that contains the keys in the dictionary. - A collection that contains the keys of the model-state dictionary. - - - Copies the values from the specified object into this dictionary, overwriting existing values if keys are the same. - The dictionary. - - - Removes the first occurrence of the specified object from the model-state dictionary. - true if was successfully removed the model-state dictionary; otherwise, false. This method also returns false if is not found in the model-state dictionary. - The object to remove from the model-state dictionary. - The model-state dictionary is read-only. - - - Removes the element that has the specified key from the model-state dictionary. - true if the element is successfully removed; otherwise, false. This method also returns false if was not found in the model-state dictionary. - The key of the element to remove. - The model-state dictionary is read-only. - - is null. - - - Sets the value for the specified key by using the specified value provider dictionary. - The key. - The value. - - - Returns an enumerator that can be used to iterate through the collection. - An enumerator that can be used to iterate through the collection. - - - Attempts to gets the value that is associated with the specified key. - true if the object that implements contains an element that has the specified key; otherwise, false. - The key of the value to get. - When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. - - is null. - - - Gets a collection that contains the values in the dictionary. - A collection that contains the values of the model-state dictionary. - - - Provides a container for a validation result. - - - Initializes a new instance of the class. - - - Gets or sets the name of the member. - The name of the member. - - - Gets or sets the validation result message. - The validation result message. - - - Provides a base class for implementing validation logic. - - - Called from constructors in derived classes to initialize the class. - The metadata. - The controller context. - - - Gets the controller context. - The controller context. - - - When implemented in a derived class, returns metadata for client validation. - The metadata for client validation. - - - Returns a composite model validator for the model. - A composite model validator for the model. - The metadata. - The controller context. - - - Gets or sets a value that indicates whether a model property is required. - true if the model property is required; otherwise, false. - - - Gets the metadata for the model validator. - The metadata for the model validator. - - - When implemented in a derived class, validates the object. - A list of validation results. - The container. - - - Provides a list of validators for a model. - - - When implemented in a derived class, initializes a new instance of the class. - - - Gets a list of validators. - A list of validators. - The metadata. - The context. - - - Provides a container for a list of validation providers. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using a list of model-validation providers. - A list of model-validation providers. - - - Returns the list of model validators. - The list of model validators. - The model metadata. - The controller context. - - - Inserts a model-validator provider into the collection. - The zero-based index at which item should be inserted. - The model-validator provider object to insert. - - - Replaces the model-validator provider element at the specified index. - The zero-based index of the model-validator provider element to replace. - The new value for the model-validator provider element. - - - Provides a container for the current validation provider. - - - Gets the model validator provider collection. - The model validator provider collection. - - - Represents a list of items that users can select more than one item from. - - - Initializes a new instance of the class by using the specified items to include in the list. - The items. - The parameter is null. - - - Initializes a new instance of the class by using the specified items to include in the list and the selected values. - The items. - The selected values. - The parameter is null. - - - Initializes a new instance of the class by using the items to include in the list, the data value field, and the data text field. - The items. - The data value field. - The data text field. - The parameter is null. - - - Initializes a new instance of the class by using the items to include in the list, the data value field, the data text field, and the selected values. - The items. - The data value field. - The data text field. - The selected values. - The parameter is null. - - - Gets or sets the data text field. - The data text field. - - - Gets or sets the data value field. - The data value field. - - - Returns an enumerator that can be used to iterate through the collection. - An enumerator that can be used to iterate through the collection. - - - Gets or sets the items in the list. - The items in the list. - - - Gets or sets the selected values. - The selected values. - - - Returns an enumerator can be used to iterate through a collection. - An enumerator that can be used to iterate through the collection. - - - When implemented in a derived class, provides a metadata class that contains a reference to the implementation of one or more of the filter interfaces, the filter's order, and the filter's scope. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class and specifies the order of filters and whether multiple filters are allowed. - true to specify that multiple filters of the same type are allowed; otherwise, false. - The filter order. - - - Gets a value that indicates whether more than one instance of the filter attribute can be specified. - true if more than one instance of the filter attribute is allowed; otherwise, false. - - - Gets a value that indicates the order in which a filter is applied. - A value that indicates the order in which a filter is applied. - - - Selects the controller that will handle an HTTP request. - - - Initializes a new instance of the class. - The request context. - The parameter is null. - - - Adds the version header by using the specified HTTP context. - The HTTP context. - - - Called by ASP.NET to begin asynchronous request processing. - The status of the asynchronous call. - The HTTP context. - The asynchronous callback method. - The state of the asynchronous object. - - - Called by ASP.NET to begin asynchronous request processing using the base HTTP context. - The status of the asynchronous call. - The HTTP context. - The asynchronous callback method. - The state of the asynchronous object. - - - Gets or sets a value that indicates whether the MVC response header is disabled. - true if the MVC response header is disabled; otherwise, false. - - - Called by ASP.NET when asynchronous request processing has ended. - The asynchronous result. - - - Gets a value that indicates whether another request can use the instance. - true if the instance is reusable; otherwise, false. - - - Contains the header name of the ASP.NET MVC version. - - - Processes the request by using the specified HTTP request context. - The HTTP context. - - - Processes the request by using the specified base HTTP request context. - The HTTP context. - - - Gets the request context. - The request context. - - - Called by ASP.NET to begin asynchronous request processing using the base HTTP context. - The status of the asynchronous call. - The HTTP context. - The asynchronous callback method. - The data. - - - Called by ASP.NET when asynchronous request processing has ended. - The asynchronous result. - - - Gets a value that indicates whether another request can use the instance. - true if the instance is reusable; otherwise, false. - - - Enables processing of HTTP Web requests by a custom HTTP handler that implements the interface. - An object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) that are used to service HTTP requests. - - - Represents an HTML-encoded string that should not be encoded again. - - - Initializes a new instance of the class. - The string to create. If no value is assigned, the object is created using an empty-string value. - - - Creates an HTML-encoded string using the specified text value. - An HTML-encoded string. - The value of the string to create . - - - Contains an empty HTML string. - - - Determines whether the specified string contains content or is either null or empty. - true if the string is null or empty; otherwise, false. - The string. - - - Verifies and processes an HTTP request. - - - Initializes a new instance of the class. - - - Called by ASP.NET to begin asynchronous request processing. - The status of the asynchronous call. - The HTTP context. - The asynchronous callback method. - The state. - - - Called by ASP.NET to begin asynchronous request processing. - The status of the asynchronous call. - The base HTTP context. - The asynchronous callback method. - The state. - - - Called by ASP.NET when asynchronous request processing has ended. - The asynchronous result. - - - Called by ASP.NET to begin asynchronous request processing. - The status of the asynchronous call. - The context. - The asynchronous callback method. - An object that contains data. - - - Called by ASP.NET when asynchronous request processing has ended. - The status of the asynchronous operations. - - - Verifies and processes an HTTP request. - The HTTP handler. - The HTTP context. - - - Creates an object that implements the IHttpHandler interface and passes the request context to it. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the specified factory controller object. - The controller factory. - - - Returns the HTTP handler by using the specified HTTP context. - The HTTP handler. - The request context. - - - Returns the session behavior. - The session behavior. - The request context. - - - Returns the HTTP handler by using the specified request context. - The HTTP handler. - The request context. - - - Creates instances of files. - - - Initializes a new instance of the class. - - - Creates a Razor host. - A Razor host. - The virtual path to the target file. - The physical path to the target file. - - - Extends a NameValueCollection object so that the collection can be copied to a specified dictionary. - - - Copies the specified collection to the specified destination. - The collection. - The destination. - - - Copies the specified collection to the specified destination, and optionally replaces previous entries. - The collection. - The destination. - true to replace previous entries; otherwise, false. - - - Represents the base class for value providers whose values come from a object. - - - Initializes a new instance of the class using the specified unvalidated collection. - A collection that contains the values that are used to initialize the provider. - A collection that contains the values that are used to initialize the provider. This collection will not be validated. - An object that contains information about the target culture. - - - Initializes a new instance of the class. - A collection that contains the values that are used to initialize the provider. - An object that contains information about the target culture. - The parameter is null. - - - Determines whether the collection contains the specified prefix. - true if the collection contains the specified prefix; otherwise, false. - The prefix to search for. - The parameter is null. - - - Returns a value object using the specified key. - The value object for the specified key. - The key of the value object to retrieve. - The parameter is null. - - - Returns a value object using the specified key and validation directive. - The value object for the specified key. - The key. - true if validation should be skipped; otherwise, false. - - - Provides a convenience wrapper for the attribute. - - - Initializes a new instance of the class. - - - Represents an attribute that is used to indicate that a controller method is not an action method. - - - Initializes a new instance of the class. - - - Determines whether the attribute marks a method that is not an action method by using the specified controller context. - true if the attribute marks a valid non-action method; otherwise, false. - The controller context. - The method information. - - - Represents an attribute that is used to mark an action method whose output will be cached. - - - Initializes a new instance of the class. - - - Gets or sets the cache profile name. - The cache profile name. - - - Gets or sets the child action cache. - The child action cache. - - - Gets or sets the cache duration, in seconds. - The cache duration. - - - Returns a value that indicates whether a child action cache is active. - true if the child action cache is active; otherwise, false. - The controller context. - - - Gets or sets the location. - The location. - - - Gets or sets a value that indicates whether to store the cache. - true if the cache should be stored; otherwise, false. - - - This method is an implementation of and supports the ASP.NET MVC infrastructure. It is not intended to be used directly from your code. - The filter context. - - - This method is an implementation of and supports the ASP.NET MVC infrastructure. It is not intended to be used directly from your code. - The filter context. - - - This method is an implementation of and supports the ASP.NET MVC infrastructure. It is not intended to be used directly from your code. - The filter context. - - - This method is an implementation of and supports the ASP.NET MVC infrastructure. It is not intended to be used directly from your code. - The filter context. - - - Called before the action result executes. - The filter context, which encapsulates information for using . - The parameter is null. - - - Gets or sets the SQL dependency. - The SQL dependency. - - - Gets or sets the vary-by-content encoding. - The vary-by-content encoding. - - - Gets or sets the vary-by-custom value. - The vary-by-custom value. - - - Gets or sets the vary-by-header value. - The vary-by-header value. - - - Gets or sets the vary-by-param value. - The vary-by-param value. - - - Encapsulates information for binding action-method parameters to a data model. - - - Initializes a new instance of the class. - - - Gets the model binder. - The model binder. - - - Gets a comma-delimited list of property names for which binding is disabled. - The exclude list. - - - Gets a comma-delimited list of property names for which binding is enabled. - The include list. - - - Gets the prefix to use when the MVC framework binds a value to an action parameter or to a model property. - The prefix. - - - Contains information that describes a parameter. - - - Initializes a new instance of the class. - - - Gets the action descriptor. - The action descriptor. - - - Gets the binding information. - The binding information. - - - Gets the default value of the parameter. - The default value of the parameter. - - - Returns an array of custom attributes that are defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - - - Returns an array of custom attributes that are defined for this member, identified by type. - An array of custom attributes, or an empty array if no custom attributes exist. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - The parameter is null. - - - Indicates whether one or more instances of a custom attribute type are defined for this member. - true if the custom attribute type is defined for this member; otherwise, false. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The parameter is null. - - - Gets the name of the parameter. - The name of the parameter. - - - Gets the type of the parameter. - The type of the parameter. - - - Represents a base class that is used to send a partial view to the response. - - - Initializes a new instance of the class. - - - Returns the object that is used to render the view. - The view engine result. - The controller context. - An error occurred while the method was attempting to find the view. - - - Provides a registration point for ASP.NET Razor pre-application start code. - - - Registers Razor pre-application start code. - - - Represents a value provider for query strings that are contained in a object. - - - Initializes a new instance of the class. - An object that encapsulates information about the current HTTP request. - - - Represents a class that is responsible for creating a new instance of a query-string value-provider object. - - - Initializes a new instance of the class. - - - Returns a value-provider object for the specified controller context. - A query-string value-provider object. - An object that encapsulates information about the current HTTP request. - The parameter is null. - - - Provides an adapter for the attribute. - - - Initializes a new instance of the class. - The model metadata. - The controller context. - The range attribute. - - - Gets a list of client validation rules for a range check. - A list of client validation rules for a range check. - - - Represents the class used to create views that have Razor syntax. - - - Initializes a new instance of the class. - The controller context. - The view path. - The layout or master page. - A value that indicates whether view start files should be executed before the view. - The set of extensions that will be used when looking up view start files. - - - Initializes a new instance of the class using the view page activator. - The controller context. - The view path. - The layout or master page. - A value that indicates whether view start files should be executed before the view. - The set of extensions that will be used when looking up view start files. - The view page activator. - - - Gets the layout or master page. - The layout or master page. - - - Renders the specified view context by using the specified writer and instance. - The view context. - The writer that is used to render the view to the response. - The instance. - - - Gets a value that indicates whether view start files should be executed before the view. - A value that indicates whether view start files should be executed before the view. - - - Gets or sets the set of file extensions that will be used when looking up view start files. - The set of file extensions that will be used when looking up view start files. - - - Represents a view engine that is used to render a Web page that uses the ASP.NET Razor syntax. - - - Initializes a new instance of the class. - - - - Creates a partial view using the specified controller context and partial path. - The partial view. - The controller context. - The path to the partial view. - - - Creates a view by using the specified controller context and the paths of the view and master view. - The view. - The controller context. - The path to the view. - The path to the master view. - - - Controls the processing of application actions by redirecting to a specified URI. - - - Initializes a new instance of the class. - The target URL. - The parameter is null. - - - Initializes a new instance of the class using the specified URL and permanent-redirection flag. - The URL. - A value that indicates whether the redirection should be permanent. - - - Enables processing of the result of an action method by a custom type that inherits from the class. - The context within which the result is executed. - The parameter is null. - - - Gets a value that indicates whether the redirection should be permanent. - true if the redirection should be permanent; otherwise, false. - - - Gets or sets the target URL. - The target URL. - - - Represents a result that performs a redirection by using the specified route values dictionary. - - - Initializes a new instance of the class by using the specified route name and route values. - The name of the route. - The route values. - - - Initializes a new instance of the class by using the specified route name, route values, and permanent-redirection flag. - The name of the route. - The route values. - A value that indicates whether the redirection should be permanent. - - - Initializes a new instance of the class by using the specified route values. - The route values. - - - Enables processing of the result of an action method by a custom type that inherits from the class. - The context within which the result is executed. - The parameter is null. - - - Gets a value that indicates whether the redirection should be permanent. - true if the redirection should be permanent; otherwise, false. - - - Gets or sets the name of the route. - The name of the route. - - - Gets or sets the route values. - The route values. - - - Contains information that describes a reflected action method. - - - Initializes a new instance of the class. - The action-method information. - The name of the action. - The controller descriptor. - Either the or parameter is null. - The parameter is null or empty. - - - Gets the name of the action. - The name of the action. - - - Gets the controller descriptor. - The controller descriptor. - - - Executes the specified controller context by using the specified action-method parameters. - The action return value. - The controller context. - The parameters. - The or parameter is null. - - - Returns an array of custom attributes defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - - - Returns an array of custom attributes defined for this member, identified by type. - An array of custom attributes, or an empty array if no custom attributes exist. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - - - Retrieves the parameters of the action method. - The parameters of the action method. - - - Retrieves the action selectors. - The action selectors. - - - Indicates whether one or more instances of a custom attribute type are defined for this member. - true if the custom attribute type is defined for this member; otherwise, false. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - - - Gets or sets the action-method information. - The action-method information. - - - Gets the unique ID for the reflected action descriptor using lazy initialization. - The unique ID. - - - Contains information that describes a reflected controller. - - - Initializes a new instance of the class. - The type of the controller. - The parameter is null. - - - Gets the type of the controller. - The type of the controller. - - - Finds the specified action for the specified controller context. - The information about the action. - The controller context. - The name of the action. - The parameter is null. - The parameter is null or empty. - - - Returns the list of actions for the controller. - A list of action descriptors for the controller. - - - Returns an array of custom attributes that are defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - - - Returns an array of custom attributes that are defined for this member, identified by type. - An array of custom attributes, or an empty array if no custom attributes exist. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - - - Returns a value that indicates whether one or more instances of a custom attribute type are defined for this member. - true if the custom attribute type is defined for this member; otherwise, false. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - - - Contains information that describes a reflected action-method parameter. - - - Initializes a new instance of the class. - The parameter information. - The action descriptor. - The or parameter is null. - - - Gets the action descriptor. - The action descriptor. - - - Gets the binding information. - The binding information. - - - Gets the default value of the reflected parameter. - The default value of the reflected parameter. - - - Returns an array of custom attributes that are defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - - - Returns an array of custom attributes that are defined for this member, identified by type. - An array of custom attributes, or an empty array if no custom attributes exist. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - The custom attribute type cannot be loaded. - There is more than one attribute of type defined for this member. - - - Returns a value that indicates whether one or more instances of a custom attribute type are defined for this member. - true if the custom attribute type is defined for this member; otherwise, false. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - - - Gets or sets the parameter information. - The parameter information. - - - Gets the name of the parameter. - The name of the parameter. - - - Gets the type of the parameter. - The type of the parameter. - - - Provides an adapter for the attribute. - - - Initializes a new instance of the class. - The model metadata. - The controller context. - The regular expression attribute. - - - Gets a list of regular-expression client validation rules. - A list of regular-expression client validation rules. - - - Provides an attribute that uses the jQuery validation plug-in remote validator. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the specified route name. - The route name. - - - Initializes a new instance of the class using the specified action-method name and controller name. - The name of the action method. - The name of the controller. - - - Initializes a new instance of the class using the specified action-method name, controller name, and area name. - The name of the action method. - The name of the controller. - The name of the area. - - - Gets or sets the additional fields that are required for validation. - The additional fields that are required for validation. - - - Returns a comma-delimited string of validation field names. - A comma-delimited string of validation field names. - The name of the validation property. - - - Formats the error message that is displayed when validation fails. - A formatted error message. - A name to display with the error message. - - - Formats the property for client validation by prepending an asterisk (*) and a dot. - The string "*." Is prepended to the property. - The property. - - - Gets a list of client validation rules for the property. - A list of remote client validation rules for the property. - The model metadata. - The controller context. - - - Gets the URL for the remote validation call. - The URL for the remote validation call. - The controller context. - - - Gets or sets the HTTP method used for remote validation. - The HTTP method used for remote validation. The default value is "Get". - - - This method always returns true. - true - The validation target. - - - Gets the route data dictionary. - The route data dictionary. - - - Gets or sets the route name. - The route name. - - - Gets the route collection from the route table. - The route collection from the route table. - - - Provides an adapter for the attribute. - - - Initializes a new instance of the class. - The model metadata. - The controller context. - The required attribute. - - - Gets a list of required-value client validation rules. - A list of required-value client validation rules. - - - Represents an attribute that forces an unsecured HTTP request to be re-sent over HTTPS. - - - Initializes a new instance of the class. - - - Handles unsecured HTTP requests that are sent to the action method. - An object that encapsulates information that is required in order to use the attribute. - The HTTP request contains an invalid transfer method override. All GET requests are considered invalid. - - - Determines whether a request is secured (HTTPS) and, if it is not, calls the method. - An object that encapsulates information that is required in order to use the attribute. - The parameter is null. - - - Provides the context for the method of the class. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class. - The controller context. - The result object. - true to cancel execution; otherwise, false. - The exception object. - The parameter is null. - - - Gets or sets a value that indicates whether this instance is canceled. - true if the instance is canceled; otherwise, false. - - - Gets or sets the exception object. - The exception object. - - - Gets or sets a value that indicates whether the exception has been handled. - true if the exception has been handled; otherwise, false. - - - Gets or sets the action result. - The action result. - - - Provides the context for the method of the class. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using the specified controller context and action result. - The controller context. - The action result. - The parameter is null. - - - Gets or sets a value that indicates whether this value is "cancel". - true if the value is "cancel"; otherwise, false. - - - Gets or sets the action result. - The action result. - - - Extends a object for MVC routing. - - - Returns an object that contains information about the route and virtual path that are the result of generating a URL in the current area. - An object that contains information about the route and virtual path that are the result of generating a URL in the current area. - An object that contains the routes for the applications. - An object that encapsulates information about the requested route. - The name of the route to use when information about the URL path is retrieved. - An object that contains the parameters for a route. - - - Returns an object that contains information about the route and virtual path that are the result of generating a URL in the current area. - An object that contains information about the route and virtual path that are the result of generating a URL in the current area. - An object that contains the routes for the applications. - An object that encapsulates information about the requested route. - An object that contains the parameters for a route. - - - Ignores the specified URL route for the given list of available routes. - A collection of routes for the application. - The URL pattern for the route to ignore. - The or parameter is null. - - - Ignores the specified URL route for the given list of the available routes and a list of constraints. - A collection of routes for the application. - The URL pattern for the route to ignore. - A set of expressions that specify values for the parameter. - The or parameter is null. - - - Maps the specified URL route. - A reference to the mapped route. - A collection of routes for the application. - The name of the route to map. - The URL pattern for the route. - The or parameter is null. - - - Maps the specified URL route and sets default route values. - A reference to the mapped route. - A collection of routes for the application. - The name of the route to map. - The URL pattern for the route. - An object that contains default route values. - The or parameter is null. - - - Maps the specified URL route and sets default route values and constraints. - A reference to the mapped route. - A collection of routes for the application. - The name of the route to map. - The URL pattern for the route. - An object that contains default route values. - A set of expressions that specify values for the parameter. - The or parameter is null. - - - Maps the specified URL route and sets default route values, constraints, and namespaces. - A reference to the mapped route. - A collection of routes for the application. - The name of the route to map. - The URL pattern for the route. - An object that contains default route values. - A set of expressions that specify values for the parameter. - A set of namespaces for the application. - The or parameter is null. - - - Maps the specified URL route and sets default route values and namespaces. - A reference to the mapped route. - A collection of routes for the application. - The name of the route to map. - The URL pattern for the route. - An object that contains default route values. - A set of namespaces for the application. - The or parameter is null. - - - Maps the specified URL route and sets the namespaces. - A reference to the mapped route. - A collection of routes for the application. - The name of the route to map. - The URL pattern for the route. - A set of namespaces for the application. - The or parameter is null. - - - Represents a value provider for route data that is contained in an object that implements the interface. - - - Initializes a new instance of the class. - An object that contain information about the HTTP request. - - - Represents a factory for creating route-data value provider objects. - - - Initialized a new instance of the class. - - - Returns a value-provider object for the specified controller context. - A value-provider object. - An object that encapsulates information about the current HTTP request. - The parameter is null. - - - Represents a list that lets users select one item. - - - Initializes a new instance of the class by using the specified items for the list. - The items. - - - Initializes a new instance of the class by using the specified items for the list and a selected value. - The items. - The selected value. - - - Initializes a new instance of the class by using the specified items for the list, the data value field, and the data text field. - The items. - The data value field. - The data text field. - - - Initializes a new instance of the class by using the specified items for the list, the data value field, the data text field, and a selected value. - The items. - The data value field. - The data text field. - The selected value. - - - Gets the list value that was selected by the user. - The selected value. - - - Represents the selected item in an instance of the class. - - - Initializes a new instance of the class. - - - Gets or sets a value that indicates whether this is selected. - true if the item is selected; otherwise, false. - - - Gets or sets the text of the selected item. - The text. - - - Gets or sets the value of the selected item. - The value. - - - Specifies the session state of the controller. - - - Initializes a new instance of the class - The type of the session state. - - - Get the session state behavior for the controller. - The session state behavior for the controller. - - - Provides session-state data to the current object. - - - Initializes a new instance of the class. - - - Loads the temporary data by using the specified controller context. - The temporary data. - The controller context. - An error occurred when the session context was being retrieved. - - - Saves the specified values in the temporary data dictionary by using the specified controller context. - The controller context. - The values. - An error occurred the session context was being retrieved. - - - Provides an adapter for the attribute. - - - Initializes a new instance of the class. - The model metadata. - The controller context. - The string-length attribute. - - - Gets a list of string-length client validation rules. - A list of string-length client validation rules. - - - Represents a set of data that persists only from one request to the next. - - - Initializes a new instance of the class. - - - Adds an element that has the specified key and value to the object. - The key of the element to add. - The value of the element to add. - The object is read-only. - - is null. - An element that has the same key already exists in the object. - - - Removes all items from the instance. - The object is read-only. - - - Determines whether the instance contains an element that has the specified key. - true if the instance contains an element that has the specified key; otherwise, false. - The key to locate in the instance. - - is null. - - - Determines whether the dictionary contains the specified value. - true if the dictionary contains the specified value; otherwise, false. - The value. - - - Gets the number of elements in the object. - The number of elements in the object. - - - Gets the enumerator. - The enumerator. - - - Gets or sets the object that has the specified key. - The object that has the specified key. - The key to access. - - - Marks all keys in the dictionary for retention. - - - Marks the specified key in the dictionary for retention. - The key to retain in the dictionary. - - - Gets an object that contains the keys of elements in the object. - The keys of the elements in the object. - - - Loads the specified controller context by using the specified data provider. - The controller context. - The temporary data provider. - - - Returns an object that contains the element that is associated with the specified key, without marking the key for deletion. - An object that contains the element that is associated with the specified key. - The key of the element to return. - - - Removes the element that has the specified key from the object. - true if the element was removed successfully; otherwise, false. This method also returns false if was not found in the . instance. - The key of the element to remove. - The object is read-only. - - is null. - - - Saves the specified controller context by using the specified data provider. - The controller context. - The temporary data provider. - - - Adds the specified key/value pair to the dictionary. - The key/value pair. - - - Determines whether a sequence contains a specified element by using the default equality comparer. - true if the dictionary contains the specified key/value pair; otherwise, false. - The key/value pair to search for. - - - Copies a key/value pair to the specified array at the specified index. - The target array. - The index. - - - Gets a value that indicates whether the dictionary is read-only. - true if the dictionary is read-only; otherwise, false. - - - Deletes the specified key/value pair from the dictionary. - true if the key/value pair was removed successfully; otherwise, false. - The key/value pair. - - - Returns an enumerator that can be used to iterate through a collection. - An object that can be used to iterate through the collection. - - - Gets the value of the element that has the specified key. - true if the object that implements contains an element that has the specified key; otherwise, false. - The key of the value to get. - When this method returns, the value that is associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. - - is null. - - - Gets the object that contains the values in the object. - The values of the elements in the object that implements . - - - Encapsulates information about the current template context. - - - Initializes a new instance of the class. - - - Gets or sets the formatted model value. - The formatted model value. - - - Retrieves the full DOM ID of a field using the specified HTML name attribute. - The full DOM ID. - The value of the HTML name attribute. - - - Retrieves the fully qualified name (including a prefix) for a field using the specified HTML name attribute. - The prefixed name of the field. - The value of the HTML name attribute. - - - Gets or sets the HTML field prefix. - The HTML field prefix. - - - Contains the number of objects that were visited by the user. - The number of objects. - - - Determines whether the template has been visited by the user. - true if the template has been visited by the user; otherwise, false. - An object that encapsulates information that describes the model. - - - Contains methods to build URLs for ASP.NET MVC within an application. - - - Initializes a new instance of the class using the specified request context. - An object that contains information about the current request and about the route that it matched. - The parameter is null. - - - Initializes a new instance of the class by using the specified request context and route collection. - An object that contains information about the current request and about the route that it matched. - A collection of routes. - The or the parameter is null. - - - Generates a fully qualified URL to an action method by using the specified action name. - The fully qualified URL to an action method. - The name of the action method. - - - Generates a fully qualified URL to an action method by using the specified action name and route values. - The fully qualified URL to an action method. - The name of the action method. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - - - Generates a fully qualified URL to an action method by using the specified action name and controller name. - The fully qualified URL to an action method. - The name of the action method. - The name of the controller. - - - Generates a fully qualified URL to an action method by using the specified action name, controller name, and route values. - The fully qualified URL to an action method. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - - - Generates a fully qualified URL to an action method by using the specified action name, controller name, route values, and protocol to use. - The fully qualified URL to an action method. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - The protocol for the URL, such as "http" or "https". - - - Generates a fully qualified URL to an action method by using the specified action name, controller name, and route values. - The fully qualified URL to an action method. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. - - - Generates a fully qualified URL for an action method by using the specified action name, controller name, route values, protocol to use, and host name. - The fully qualified URL to an action method. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. - The protocol for the URL, such as "http" or "https". - The host name for the URL. - - - Generates a fully qualified URL to an action method for the specified action name and route values. - The fully qualified URL to an action method. - The name of the action method. - An object that contains the parameters for a route. - - - Converts a virtual (relative) path to an application absolute path. - The application absolute path. - The virtual path of the content. - - - Encodes special characters in a URL string into character-entity equivalents. - An encoded URL string. - The text to encode. - - - Returns a string that contains a content URL. - A string that contains a content URL. - The content path. - The HTTP context. - - - Returns a string that contains a URL. - A string that contains a URL. - The route name. - The action name. - The controller name. - The HTTP protocol. - The host name. - The fragment. - The route values. - The route collection. - The request context. - true to include implicit MVC values; otherwise false. - - - Returns a string that contains a URL. - A string that contains a URL. - The route name. - The action name. - The controller name. - The route values. - The route collection. - The request context. - true to include implicit MVC values; otherwise. false. - - - Returns a value that indicates whether the URL is local. - true if the URL is local; otherwise, false. - The URL. - - - Gets information about an HTTP request that matches a defined route. - The request context. - - - Gets a collection that contains the routes that are registered for the application. - The route collection. - - - Generates a fully qualified URL for the specified route values. - The fully qualified URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - - - Generates a fully qualified URL for the specified route name. - The fully qualified URL. - The name of the route that is used to generate the URL. - - - Generates a fully qualified URL for the specified route values by using a route name. - The fully qualified URL. - The name of the route that is used to generate the URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - - - Generates a fully qualified URL for the specified route values by using a route name and the protocol to use. - The fully qualified URL. - The name of the route that is used to generate the URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - The protocol for the URL, such as "http" or "https". - - - Generates a fully qualified URL for the specified route values by using a route name. - The fully qualified URL. - The name of the route that is used to generate the URL. - An object that contains the parameters for a route. - - - Generates a fully qualified URL for the specified route values by using the specified route name, protocol to use, and host name. - The fully qualified URL. - The name of the route that is used to generate the URL. - An object that contains the parameters for a route. - The protocol for the URL, such as "http" or "https". - The host name for the URL. - - - Generates a fully qualified URL for the specified route values. - The fully qualified URL. - An object that contains the parameters for a route. - - - Represents an optional parameter that is used by the class during routing. - - - Contains the read-only value for the optional parameter. - - - Returns an empty string. This method supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code. - An empty string. - - - Provides an object adapter that can be validated. - - - Initializes a new instance of the class. - The model metadata. - The controller context. - - - Validates the specified object. - A list of validation results. - The container. - - - Represents an attribute that is used to detect whether a server request has been tampered with. - - - Initializes a new instance of the class. - - - Called when authorization is required. - The filter context. - The parameter is null. - - - Gets or sets the salt string. - The salt string. - - - Represents an attribute that is used to mark action methods whose input must be validated. - - - Initializes a new instance of the class. - true to enable validation. - - - Gets or sets a value that indicates whether to enable validation. - true if validation is enabled; otherwise, false. - - - Called when authorization is required. - The filter context. - The parameter is null. - - - Represents the collection of value-provider objects for the application. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class and registers the specified value providers. - The list of value providers to register. - - - Determines whether the collection contains the specified prefix. - true if the collection contains the specified prefix; otherwise, false. - The prefix to search for. - - - Returns a value object using the specified key. - The value object for the specified key. - The key of the value object to retrieve. - - - Returns a value object using the specified key and skip-validation parameter. - The value object for the specified key. - The key of the value object to retrieve. - true to specify that validation should be skipped; otherwise, false. - - - Inserts the specified value-provider object into the collection at the specified index location. - The zero-based index location at which to insert the value provider into the collection. - The value-provider object to insert. - The parameter is null. - - - Replaces the value provider at the specified index location with a new value provider. - The zero-based index of the element to replace. - The new value for the element at the specified index. - The parameter is null. - - - Represents a dictionary of value providers for the application. - - - Initializes a new instance of the class. - The controller context. - - - Adds the specified item to the collection of value providers. - The object to add to the object. - The object is read-only. - - - Adds an element that has the specified key and value to the collection of value providers. - The key of the element to add. - The value of the element to add. - The object is read-only. - - is null. - An element that has the specified key already exists in the object. - - - Adds an element that has the specified key and value to the collection of value providers. - The key of the element to add. - The value of the element to add. - The object is read-only. - - is null. - An element that has the specified key already exists in the object. - - - Removes all items from the collection of value providers. - The object is read-only. - - - Determines whether the collection of value providers contains the specified item. - true if is found in the collection of value providers; otherwise, false. - The object to locate in the instance. - - - Determines whether the collection of value providers contains an element that has the specified key. - true if the collection of value providers contains an element that has the key; otherwise, false. - The key of the element to find in the instance. - - is null. - - - Gets or sets the controller context. - The controller context. - - - Copies the elements of the collection to an array, starting at the specified index. - The one-dimensional array that is the destination of the elements copied from the object. The array must have zero-based indexing. - The zero-based index in at which copying starts. - - is null. - - is less than 0. - - is multidimensional.-or- is equal to or greater than the length of .-or-The number of elements in the source collection is greater than the available space from to the end of the destination .-or-Type cannot be cast automatically to the type of the destination array. - - - Gets the number of elements in the collection. - The number of elements in the collection. - - - Returns an enumerator that can be used to iterate through the collection. - An enumerator that can be used to iterate through the collection. - - - Gets a value that indicates whether the collection is read-only. - true if the collection is read-only; otherwise, false. - - - Gets or sets the object that has the specified key. - The object. - The key. - - - Gets a collection that contains the keys of the instance. - A collection that contains the keys of the object that implements the interface. - - - Removes the first occurrence of the specified item from the collection of value providers. - true if was successfully removed from the collection; otherwise, false. This method also returns false if is not found in the collection. - The object to remove from the instance. - The object is read-only. - - - Removes the element that has the specified key from the collection of value providers. - true if the element was successfully removed; otherwise, false. This method also returns false if was not found in the collection. - The key of the element to remove. - The object is read-only. - - is null. - - - Returns an enumerator that can be used to iterate through a collection. - An enumerator that can be used to iterate through the collection. - - - Determines whether the collection contains the specified prefix. - true if the collection contains the specified prefix; otherwise, false. - The prefix to search for. - - - Returns a value object using the specified key. - The value object for the specified key. - The key of the value object to return. - - - Gets the value of the element that has the specified key. - true if the object that implements contains an element that has the specified key; otherwise, false. - The key of the element to get. - When this method returns, the value that is associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. - - is null. - - - Gets a collection that contains the values in the object. - A collection of the values in the object that implements the interface. - - - Represents a container for value-provider factory objects. - - - Gets the collection of value-provider factories for the application. - The collection of value-provider factory objects. - - - Represents a factory for creating value-provider objects. - - - Initializes a new instance of the class. - - - Returns a value-provider object for the specified controller context. - A value-provider object. - An object that encapsulates information about the current HTTP request. - - - Represents the collection of value-provider factories for the application. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the specified list of value-provider factories. - A list of value-provider factories to initialize the collection with. - - - Returns the value-provider factory for the specified controller context. - The value-provider factory object for the specified controller context. - An object that encapsulates information about the current HTTP request. - - - Inserts the specified value-provider factory object at the specified index location. - The zero-based index location at which to insert the value provider into the collection. - The value-provider factory object to insert. - The parameter is null. - - - Sets the specified value-provider factory object at the given index location. - The zero-based index location at which to insert the value provider into the collection. - The value-provider factory object to set. - The parameter is null. - - - Represents the result of binding a value (such as from a form post or query string) to an action-method argument property, or to the argument itself. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using the specified raw value, attempted value, and culture information. - The raw value. - The attempted value. - The culture. - - - Gets or sets the raw value that is converted to a string for display. - The raw value. - - - Converts the value that is encapsulated by this result to the specified type. - The converted value. - The target type. - The parameter is null. - - - Converts the value that is encapsulated by this result to the specified type by using the specified culture information. - The converted value. - The target type. - The culture to use in the conversion. - The parameter is null. - - - Gets or sets the culture. - The culture. - - - Gets or set the raw value that is supplied by the value provider. - The raw value. - - - Encapsulates information that is related to rendering a view. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using the specified controller context, view, view data dictionary, temporary data dictionary, and text writer. - Encapsulates information about the HTTP request. - The view to render. - The dictionary that contains the data that is required in order to render the view. - The dictionary that contains temporary data for the view. - The text writer object that is used to write HTML output. - One of the parameters is null. - - - Gets or sets a value that indicates whether client-side validation is enabled. - true if client-side validation is enabled; otherwise, false. - - - Gets or sets an object that encapsulates information that is required in order to validate and process the input data from an HTML form. - An object that encapsulates information that is required in order to validate and process the input data from an HTML form. - - - Writes the client validation information to the HTTP response. - - - Gets data that is associated with this request and that is available for only one request. - The temporary data. - - - Gets or sets a value that indicates whether unobtrusive JavaScript is enabled. - true if unobtrusive JavaScript is enabled; otherwise, false. - - - Gets an object that implements the interface to render in the browser. - The view. - - - Gets the view data that is passed to the view. - The view data. - - - Gets or sets the text writer object that is used to write HTML output. - The object that is used to write the HTML output. - - - Represents a container that is used to pass data between a controller and a view. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using the specified model. - The model. - - - Initializes a new instance of the class by using the specified dictionary. - The dictionary. - The parameter is null. - - - Adds the specified item to the collection. - The object to add to the collection. - The collection is read-only. - - - Adds an element to the collection using the specified key and value . - The key of the element to add. - The value of the element to add. - The object is read-only. - - is null. - An element with the same key already exists in the object. - - - Removes all items from the collection. - The object is read-only. - - - Determines whether the collection contains the specified item. - true if is found in the collection; otherwise, false. - The object to locate in the collection. - - - Determines whether the collection contains an element that has the specified key. - true if the collection contains an element that has the specified key; otherwise, false. - The key of the element to locate in the collection. - - is null. - - - Copies the elements of the collection to an array, starting at a particular index. - The one-dimensional array that is the destination of the elements copied from the collection. The array must have zero-based indexing. - The zero-based index in at which copying begins. - - is null. - - is less than 0. - - is multidimensional.-or- is equal to or greater than the length of .-or- The number of elements in the source collection is greater than the available space from to the end of the destination .-or- Type cannot be cast automatically to the type of the destination . - - - Gets the number of elements in the collection. - The number of elements in the collection. - - - Evaluates the specified expression. - The results of the evaluation. - The expression. - The parameter is null or empty. - - - Evaluates the specified expression by using the specified format. - The results of the evaluation. - The expression. - The format. - - - Returns an enumerator that can be used to iterate through the collection. - An enumerator that can be used to iterate through the collection. - - - Returns information about the view data as defined by the parameter. - An object that contains the view data information that is defined by the parameter. - A set of key/value pairs that define the view-data information to return. - The parameter is either null or empty. - - - Gets a value that indicates whether the collection is read-only. - true if the collection is read-only; otherwise, false. - - - Gets or sets the item that is associated with the specified key. - The value of the selected item. - The key. - - - Gets a collection that contains the keys of this dictionary. - A collection that contains the keys of the object that implements . - - - Gets or sets the model that is associated with the view data. - The model that is associated with the view data. - - - Gets or sets information about the model. - Information about the model. - - - Gets the state of the model. - The state of the model. - - - Removes the first occurrence of a specified object from the collection. - true if was successfully removed from the collection; otherwise, false. This method also returns false if is not found in the collection. - The object to remove from the collection. - The collection is read-only. - - - Removes the element from the collection using the specified key. - true if the element is successfully removed; otherwise, false. This method also returns false if was not found in the original collection. - The key of the element to remove. - The collection is read-only. - - is null. - - - Sets the data model to use for the view. - The data model to use for the view. - - - Returns an enumerator that can be used to iterate through the collection. - An enumerator that can be used to iterate through the collection. - - - Gets or sets an object that encapsulates information about the current template context. - An object that contains information about the current template. - - - Attempts to retrieve the value that is associated with the specified key. - true if the collection contains an element with the specified key; otherwise, false. - The key of the value to get. - When this method returns, the value that is associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. - - is null. - - - Gets a collection that contains the values in this dictionary. - A collection that contains the values of the object that implements . - - - Represents a container that is used to pass strongly typed data between a controller and a view. - The type of the model. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using the specified view data dictionary. - An existing view data dictionary to copy into this instance. - - - Initializes a new instance of the class by using the specified model. - The data model to use for the view. - - - Gets or sets the model. - A reference to the data model. - - - Gets or sets information about the model. - Information about the model. - - - Sets the data model to use for the view. - The data model to use for the view. - An error occurred while the model was being set. - - - Encapsulates information about the current template content that is used to develop templates and about HTML helpers that interact with templates. - - - Initializes a new instance of the class. - - - Initializes a new instance of the T:System.Web.Mvc.ViewDataInfo class and associates a delegate for accessing the view data information. - A delegate that defines how the view data information is accessed. - - - Gets or sets the object that contains the values to be displayed by the template. - The object that contains the values to be displayed by the template. - - - Gets or sets the description of the property to be displayed by the template. - The description of the property to be displayed by the template. - - - Gets or sets the current value to be displayed by the template. - The current value to be displayed by the template. - - - Represents a collection of view engines that are available to the application. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class by using the specified list of view engines. - The list that is wrapped by the new collection. - - is null. - - - Finds the specified partial view by using the specified controller context. - The partial view. - The controller context. - The name of the partial view. - The parameter is null. - The parameter is null or empty. - - - Finds the specified view by using the specified controller context and master view. - The view. - The controller context. - The name of the view. - The name of the master view. - The parameter is null. - The parameter is null or empty. - - - Inserts an element into the collection at the specified index. - The zero-based index at which should be inserted. - The object to insert. - - is less than zero.-or- is greater than the number of items in the collection. - The parameter is null. - - - Replaces the element at the specified index. - The zero-based index of the element to replace. - The new value for the element at the specified index. - - is less than zero.-or- is greater than the number of items in the collection. - The parameter is null. - - - Represents the result of locating a view engine. - - - Initializes a new instance of the class by using the specified searched locations. - The searched locations. - The parameter is null. - - - Initializes a new instance of the class by using the specified view and view engine. - The view. - The view engine. - The or parameter is null. - - - Gets or sets the searched locations. - The searched locations. - - - Gets or sets the view. - The view. - - - Gets or sets the view engine. - The view engine. - - - Represents a collection of view engines that are available to the application. - - - Gets the view engines. - The view engines. - - - Represents the information that is needed to build a master view page. - - - Initializes a new instance of the class. - - - Gets the AJAX script for the master page. - The AJAX script for the master page. - - - Gets the HTML for the master page. - The HTML for the master page. - - - Gets the model. - The model. - - - Gets the temporary data. - The temporary data. - - - Gets the URL. - The URL. - - - Gets the dynamic view-bag dictionary. - The dynamic view-bag dictionary. - - - Gets the view context. - The view context. - - - Gets the view data. - The view data. - - - Gets the writer that is used to render the master page. - The writer that is used to render the master page. - - - Represents the information that is required in order to build a strongly typed master view page. - The type of the model. - - - Initializes a new instance of the class. - - - Gets the AJAX script for the master page. - The AJAX script for the master page. - - - Gets the HTML for the master page. - The HTML for the master page. - - - Gets the model. - A reference to the data model. - - - Gets the view data. - The view data. - - - Represents the properties and methods that are needed to render a view as a Web Forms page. - - - Initializes a new instance of the class. - - - Gets or sets the object that is used to render HTML in Ajax scenarios. - The Ajax helper object that is associated with the view. - - - Gets or sets the object that is used to render HTML elements. - The HTML helper object that is associated with the view. - - - Initializes the , , and properties. - - - Gets or sets the path of the master view. - The path of the master view. - - - Gets the Model property of the associated object. - The Model property of the associated object. - - - Raises the event at the beginning of page initialization. - The event data. - - - Enables processing of the specified HTTP request by the ASP.NET MVC framework. - An object that encapsulates HTTP-specific information about the current HTTP request. - - - Initializes the object that receives the page content to be rendered. - The object that receives the page content. - - - Renders the view page to the response using the specified view context. - An object that encapsulates the information that is required in order to render the view, which includes the controller context, form context, the temporary data, and the view data for the associated view. - - - Sets the text writer that is used to render the view to the response. - The writer that is used to render the view to the response. - - - Sets the view data dictionary for the associated view. - A dictionary of data to pass to the view. - - - Gets the temporary data to pass to the view. - The temporary data to pass to the view. - - - Gets or sets the URL of the rendered page. - The URL of the rendered page. - - - Gets the view bag. - The view bag. - - - Gets or sets the information that is used to render the view. - The information that is used to render the view, which includes the form context, the temporary data, and the view data of the associated view. - - - Gets or sets a dictionary that contains data to pass between the controller and the view. - A dictionary that contains data to pass between the controller and the view. - - - Gets the text writer that is used to render the view to the response. - The text writer that is used to render the view to the response. - - - Represents the information that is required in order to render a strongly typed view as a Web Forms page. - The type of the model. - - - Initializes a new instance of the class. - - - Gets or sets the object that supports rendering HTML in Ajax scenarios. - The Ajax helper object that is associated with the view. - - - Gets or sets the object that provides support for rendering elements. - The HTML helper object that is associated with the view. - - - Instantiates and initializes the and properties. - - - Gets the property of the associated object. - A reference to the data model. - - - Sets the view data dictionary for the associated view. - A dictionary of data to pass to the view. - - - Gets or sets a dictionary that contains data to pass between the controller and the view. - A dictionary that contains data to pass between the controller and the view. - - - Represents a class that is used to render a view by using an instance that is returned by an object. - - - Initializes a new instance of the class. - - - Searches the registered view engines and returns the object that is used to render the view. - The object that is used to render the view. - The controller context. - An error occurred while the method was searching for the view. - - - Gets the name of the master view (such as a master page or template) to use when the view is rendered. - The name of the master view. - - - Represents a base class that is used to provide the model to the view and then render the view to the response. - - - Initializes a new instance of the class. - - - When called by the action invoker, renders the view to the response. - The context that the result is executed in. - The parameter is null. - - - Returns the object that is used to render the view. - The view engine. - The context. - - - Gets the view data model. - The view data model. - - - Gets or sets the object for this result. - The temporary data. - - - Gets or sets the object that is rendered to the response. - The view. - - - Gets the view bag. - The view bag. - - - Gets or sets the view data object for this result. - The view data. - - - Gets or sets the collection of view engines that are associated with this result. - The collection of view engines. - - - Gets or sets the name of the view to render. - The name of the view. - - - Provides an abstract class that can be used to implement a view start (master) page. - - - When implemented in a derived class, initializes a new instance of the class. - - - When implemented in a derived class, gets the HTML markup for the view start page. - The HTML markup for the view start page. - - - When implemented in a derived class, gets the URL for the view start page. - The URL for the view start page. - - - When implemented in a derived class, gets the view context for the view start page. - The view context for the view start page. - - - Provides a container for objects. - - - Initializes a new instance of the class. - - - Provides a container for objects. - The type of the model. - - - Initializes a new instance of the class. - - - Gets the formatted value. - The formatted value. - - - Represents the type of a view. - - - Initializes a new instance of the class. - - - Gets or sets the name of the type. - The name of the type. - - - Represents the information that is needed to build a user control. - - - Initializes a new instance of the class. - - - Gets the AJAX script for the view. - The AJAX script for the view. - - - Ensures that view data is added to the object of the user control if the view data exists. - - - Gets the HTML for the view. - The HTML for the view. - - - Gets the model. - The model. - - - Renders the view by using the specified view context. - The view context. - - - Sets the text writer that is used to render the view to the response. - The writer that is used to render the view to the response. - - - Sets the view-data dictionary by using the specified view data. - The view data. - - - Gets the temporary-data dictionary. - The temporary-data dictionary. - - - Gets the URL for the view. - The URL for the view. - - - Gets the view bag. - The view bag. - - - Gets or sets the view context. - The view context. - - - Gets or sets the view-data dictionary. - The view-data dictionary. - - - Gets or sets the view-data key. - The view-data key. - - - Gets the writer that is used to render the view to the response. - The writer that is used to render the view to the response. - - - Represents the information that is required in order to build a strongly typed user control. - The type of the model. - - - Initializes a new instance of the class. - - - Gets the AJAX script for the view. - The AJAX script for the view. - - - Gets the HTML for the view. - The HTML for the view. - - - Gets the model. - A reference to the data model. - - - Sets the view data for the view. - The view data. - - - Gets or sets the view data. - The view data. - - - Represents an abstract base-class implementation of the interface. - - - Initializes a new instance of the class. - - - Gets or sets the area-enabled master location formats. - The area-enabled master location formats. - - - Gets or sets the area-enabled partial-view location formats. - The area-enabled partial-view location formats. - - - Gets or sets the area-enabled view location formats. - The area-enabled view location formats. - - - Creates the specified partial view by using the specified controller context. - A reference to the partial view. - The controller context. - The partial path for the new partial view. - - - Creates the specified view by using the controller context, path of the view, and path of the master view. - A reference to the view. - The controller context. - The path of the view. - The path of the master view. - - - Returns a value that indicates whether the file is in the specified path by using the specified controller context. - true if the file is in the specified path; otherwise, false. - The controller context. - The virtual path. - - - Gets or sets the file-name extensions that are used to locate a view. - The file-name extensions that are used to locate a view. - - - Finds the specified partial view by using the specified controller context. - The partial view. - The controller context. - The name of the partial view. - true to use the cached partial view. - The parameter is null (Nothing in Visual Basic). - The parameter is null or empty. - - - Finds the specified view by using the specified controller context and master view name. - The page view. - The controller context. - The name of the view. - The name of the master view. - true to use the cached view. - The parameter is null (Nothing in Visual Basic). - The parameter is null or empty. - - - Gets or sets the master location formats. - The master location formats. - - - Gets or sets the partial-view location formats. - The partial-view location formats. - - - Releases the specified view by using the specified controller context. - The controller context. - The view to release. - - - Gets or sets the view location cache. - The view location cache. - - - Gets or sets the view location formats. - The view location formats. - - - Gets or sets the virtual path provider. - The virtual path provider. - - - Represents the information that is needed to build a Web Forms page in ASP.NET MVC. - - - Initializes a new instance of the class using the controller context and view path. - The controller context. - The view path. - - - Initializes a new instance of the class using the controller context, view path, and the path to the master page. - The controller context. - The view path. - The path to the master page. - - - Initializes a new instance of the class using the controller context, view path, the path to the master page, and a instance. - The controller context. - The view path. - The path to the master page. - An instance of the view page activator interface. - - - Gets or sets the master path. - The master path. - - - Renders the view to the response. - An object that encapsulates the information that is required in order to render the view, which includes the controller context, form context, the temporary data, and the view data for the associated view. - The text writer object that is used to write HTML output. - The view page instance. - - - Represents a view engine that is used to render a Web Forms page to the response. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the specified view page activator. - An instance of a class that implements the interface. - - - Creates the specified partial view by using the specified controller context. - The partial view. - The controller context. - The partial path. - - - Creates the specified view by using the specified controller context and the paths of the view and master view. - The view. - The controller context. - The view path. - The master-view path. - - - Represents the properties and methods that are needed in order to render a view that uses ASP.NET Razor syntax. - - - Initializes a new instance of the class. - - - Gets or sets the object that is used to render HTML using Ajax. - The object that is used to render HTML using Ajax. - - - Sets the view context and view data for the page. - The parent page. - - - Gets the object that is associated with the page. - The object that is associated with the page. - - - Runs the page hierarchy for the ASP.NET Razor execution pipeline. - - - Gets or sets the object that is used to render HTML elements. - The object that is used to render HTML elements. - - - Initializes the , , and classes. - - - Gets the Model property of the associated object. - The Model property of the associated object. - - - Sets the view data. - The view data. - - - Gets the temporary data to pass to the view. - The temporary data to pass to the view. - - - Gets or sets the URL of the rendered page. - The URL of the rendered page. - - - Gets the view bag. - The view bag. - - - Gets or sets the information that is used to render the view. - The information that is used to render the view, which includes the form context, the temporary data, and the view data of the associated view. - - - Gets or sets a dictionary that contains data to pass between the controller and the view. - A dictionary that contains data to pass between the controller and the view. - - - Represents the properties and methods that are needed in order to render a view that uses ASP.NET Razor syntax. - The type of the view data model. - - - Initializes a new instance of the class. - - - Gets or sets the object that is used to render HTML markup using Ajax. - The object that is used to render HTML markup using Ajax. - - - Gets or sets the object that is used to render HTML elements. - The object that is used to render HTML elements. - - - Initializes the , , and classes. - - - Gets the Model property of the associated object. - The Model property of the associated object. - - - Sets the view data. - The view data. - - - Gets or sets a dictionary that contains data to pass between the controller and the view. - A dictionary that contains data to pass between the controller and the view. - - - Represents support for ASP.NET AJAX within an ASP.NET MVC application. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - The name of the controller. - The protocol for the URL, such as "http" or "https". - The host name for the URL. - The URL fragment name (the anchor name). - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - The name of the controller. - The protocol for the URL, such as "http" or "https". - The host name for the URL. - The URL fragment name (the anchor name). - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - The name of the controller. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the action method. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - The name of the controller. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - The name of the controller. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - The name of the controller. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - The name of the action method that will handle the request. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element.. - - - Writes an opening <form> tag to the response. - An opening <form> tag. - The AJAX helper. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response using the specified routing information. - An opening <form> tag. - The AJAX helper. - The name of the route to use to obtain the form post URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response using the specified routing information. - An opening <form> tag. - The AJAX helper. - The name of the route to use to obtain the form post URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response using the specified routing information. - An opening <form> tag. - The AJAX helper. - The name of the route to use to obtain the form post URL. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response using the specified routing information. - An opening <form> tag. - The AJAX helper. - The name of the route to use to obtain the form post URL. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - - - Writes an opening <form> tag to the response using the specified routing information. - An opening <form> tag. - The AJAX helper. - The name of the route to use to obtain the form post URL. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - - - Returns an HTML script element that contains a reference to a globalization script that defines the culture information. - A script element whose src attribute is set to the globalization script, as in the following example: <script type="text/javascript" src="/MvcApplication1/Scripts/Globalization/en-US.js"></script> - The AJAX helper object that this method extends. - - - Returns an HTML script element that contains a reference to a globalization script that defines the specified culture information. - An HTML script element whose src attribute is set to the globalization script, as in the following example:<script type="text/javascript" src="/MvcApplication1/Scripts/Globalization/en-US.js"></script> - The AJAX helper object that this method extends. - Encapsulates information about the target culture, such as date formats. - The parameter is null. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the route to use to obtain the form post URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the route to use to obtain the form post URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the route to use to obtain the form post URL. - The protocol for the URL, such as "http" or "https". - The host name for the URL. - The URL fragment name (the anchor name). - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the route to use to obtain the form post URL. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the route to use to obtain the form post URL. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the route to use to obtain the form post URL. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the route to use to obtain the form post URL. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - The name of the route to use to obtain the form post URL. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - The parameter is null or empty. - - - Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript. - An anchor element. - The AJAX helper. - The inner text of the anchor element. - An object that contains the parameters for a route. - An object that provides options for the asynchronous request. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Represents option settings for running Ajax scripts in an ASP.NET MVC application. - - - Initializes a new instance of the class. - - - Gets or sets the message to display in a confirmation window before a request is submitted. - The message to display in a confirmation window. - - - Gets or sets the HTTP request method ("Get" or "Post"). - The HTTP request method. The default value is "Post". - - - Gets or sets the mode that specifies how to insert the response into the target DOM element. - The insertion mode ("InsertAfter", "InsertBefore", or "Replace"). The default value is "Replace". - - - Gets or sets a value, in milliseconds, that controls the duration of the animation when showing or hiding the loading element. - A value, in milliseconds, that controls the duration of the animation when showing or hiding the loading element. - - - Gets or sets the id attribute of an HTML element that is displayed while the Ajax function is loading. - The ID of the element that is displayed while the Ajax function is loading. - - - Gets or sets the name of the JavaScript function to call immediately before the page is updated. - The name of the JavaScript function to call before the page is updated. - - - Gets or sets the JavaScript function to call when response data has been instantiated but before the page is updated. - The JavaScript function to call when the response data has been instantiated. - - - Gets or sets the JavaScript function to call if the page update fails. - The JavaScript function to call if the page update fails. - - - Gets or sets the JavaScript function to call after the page is successfully updated. - The JavaScript function to call after the page is successfully updated. - - - Returns the Ajax options as a collection of HTML attributes to support unobtrusive JavaScript. - The Ajax options as a collection of HTML attributes to support unobtrusive JavaScript. - - - Gets or sets the ID of the DOM element to update by using the response from the server. - The ID of the DOM element to update. - - - Gets or sets the URL to make the request to. - The URL to make the request to. - - - Enumerates the AJAX script insertion modes. - - - Replace the element. - - - Insert before the element. - - - Insert after the element. - - - Provides information about an asynchronous action method, such as its name, controller, parameters, attributes, and filters. - - - Initializes a new instance of the class. - - - Invokes the asynchronous action method by using the specified parameters and controller context. - An object that contains the result of an asynchronous call. - The controller context. - The parameters of the action method. - The callback method. - An object that contains information to be used by the callback method. This parameter can be null. - - - Returns the result of an asynchronous operation. - The result of an asynchronous operation. - An object that represents the status of an asynchronous operation. - - - Executes the asynchronous action method by using the specified parameters and controller context. - The result of executing the asynchronous action method. - The controller context. - The parameters of the action method. - - - Represents a class that is responsible for invoking the action methods of an asynchronous controller. - - - Initializes a new instance of the class. - - - Invokes the asynchronous action method by using the specified controller context, action name, callback method, and state. - An object that contains the result of an asynchronous operation. - The controller context. - The name of the action. - The callback method. - An object that contains information to be used by the callback method. This parameter can be null. - - - Invokes the asynchronous action method by using the specified controller context, action descriptor, parameters, callback method, and state. - An object that contains the result of an asynchronous operation. - The controller context. - The action descriptor. - The parameters for the asynchronous action method. - The callback method. - An object that contains information to be used by the callback method. This parameter can be null. - - - Invokes the asynchronous action method by using the specified controller context, filters, action descriptor, parameters, callback method, and state. - An object that contains the result of an asynchronous operation. - The controller context. - The filters. - The action descriptor. - The parameters for the asynchronous action method. - The callback method. - An object that contains information to be used by the callback method. This parameter can be null. - - - Cancels the action. - true if the action was canceled; otherwise, false. - The user-defined object that qualifies or contains information about an asynchronous operation. - - - Cancels the action. - true if the action was canceled; otherwise, false. - The user-defined object that qualifies or contains information about an asynchronous operation. - - - Cancels the action. - true if the action was canceled; otherwise, false. - The user-defined object that qualifies or contains information about an asynchronous operation. - - - Returns the controller descriptor. - The controller descriptor. - The controller context. - - - Provides asynchronous operations for the class. - - - Initializes a new instance of the class. - - - Initializes a new instance of the class using the synchronization context. - The synchronization context. - - - Notifies ASP.NET that all asynchronous operations are complete. - - - Occurs when the method is called. - - - Gets the number of outstanding operations. - The number of outstanding operations. - - - Gets the parameters that were passed to the asynchronous completion method. - The parameters that were passed to the asynchronous completion method. - - - Executes a callback in the current synchronization context. - The asynchronous action. - - - Gets or sets the asynchronous timeout value, in milliseconds. - The asynchronous timeout value, in milliseconds. - - - Defines the interface for an action invoker, which is used to invoke an asynchronous action in response to an HTTP request. - - - Invokes the specified action. - The status of the asynchronous result. - The controller context. - The name of the asynchronous action. - The callback method. - The state. - - - Cancels the asynchronous action. - true if the asynchronous method could be canceled; otherwise, false. - The asynchronous result. - - - Defines the methods that are required for an asynchronous controller. - - - Executes the specified request context. - The status of the asynchronous operation. - The request context. - The asynchronous callback method. - The state. - - - Ends the asynchronous operation. - The asynchronous result. - - - Provides a container for the asynchronous manager object. - - - Gets the asynchronous manager object. - The asynchronous manager object. - - - Provides a container that maintains a count of pending asynchronous operations. - - - Initializes a new instance of the class. - - - Occurs when an asynchronous method completes. - - - Gets the operation count. - The operation count. - - - Reduces the operation count by 1. - The updated operation count. - - - Reduces the operation count by the specified value. - The updated operation count. - The number of operations to reduce the count by. - - - Increments the operation count by one. - The updated operation count. - - - Increments the operation count by the specified value. - The updated operation count. - The number of operations to increment the count by. - - - Provides information about an asynchronous action method, such as its name, controller, parameters, attributes, and filters. - - - Initializes a new instance of the class. - An object that contains information about the method that begins the asynchronous operation (the method whose name ends with "Asynch"). - An object that contains information about the completion method (method whose name ends with "Completed"). - The name of the action. - The controller descriptor. - - - Gets the name of the action method. - The name of the action method. - - - Gets the method information for the asynchronous action method. - The method information for the asynchronous action method. - - - Begins running the asynchronous action method by using the specified parameters and controller context. - An object that contains the result of an asynchronous call. - The controller context. - The parameters of the action method. - The callback method. - An object that contains information to be used by the callback method. This parameter can be null. - - - Gets the method information for the asynchronous completion method. - The method information for the asynchronous completion method. - - - Gets the controller descriptor for the asynchronous action method. - The controller descriptor for the asynchronous action method. - - - Returns the result of an asynchronous operation. - The result of an asynchronous operation. - An object that represents the status of an asynchronous operation. - - - Returns an array of custom attributes that are defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - - - Returns an array of custom attributes that are defined for this member, identified by type. - An array of custom attributes, or an empty array if no custom attributes of the specified type exist. - The type of the custom attributes to return. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - - - Returns the parameters of the action method. - The parameters of the action method. - - - Returns the action-method selectors. - The action-method selectors. - - - Determines whether one or more instances of the specified attribute type are defined for the action member. - true if an attribute of type that is represented by is defined for this member; otherwise, false. - The type of the custom attribute. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - - - Gets the lazy initialized unique ID of the instance of this class. - The lazy initialized unique ID of the instance of this class. - - - Encapsulates information that describes an asynchronous controller, such as its name, type, and actions. - - - Initializes a new instance of the class. - The type of the controller. - - - Gets the type of the controller. - The type of the controller. - - - Finds an action method by using the specified name and controller context. - The information about the action method. - The controller context. - The name of the action. - - - Returns a list of action method descriptors in the controller. - A list of action method descriptors in the controller. - - - Returns custom attributes that are defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - - - Returns custom attributes of a specified type that are defined for this member, excluding named attributes. - An array of custom attributes, or an empty array if no custom attributes exist. - The type of the custom attributes. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - - - Returns a value that indicates whether one or more instances of the specified custom attribute are defined for this member. - true if an attribute of the type represented by is defined for this member; otherwise, false. - The type of the custom attribute. - true to look up the hierarchy chain for the inherited custom attribute; otherwise, false. - - - Represents an exception that occurred during the synchronous processing of an HTTP request in an ASP.NET MVC application. - - - Initializes a new instance of the class using a system-supplied message. - - - Initializes a new instance of the class using the specified message. - The message that describes the exception. The caller of this constructor must make sure that this string has been localized for the current system culture. - - - Initializes a new instance of the class using a specified error message and a reference to the inner exception that is the cause of this exception. - The message that describes the exception. The caller of this constructor must make sure that this string has been localized for the current system culture. - The exception that is the cause of the current exception. If the parameter is not null, the current exception is raised in a catch block that handles the inner exception. - - - Represents support for calling child action methods and rendering the result inline in a parent view. - - - Invokes the specified child action method and returns the result as an HTML string. - The child action result as an HTML string. - The HTML helper instance that this method extends. - The name of the action method to invoke. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method with the specified parameters and returns the result as an HTML string. - The child action result as an HTML string. - The HTML helper instance that this method extends. - The name of the action method to invoke. - An object that contains the parameters for a route. You can use to provide the parameters that are bound to the action method parameters. The parameter is merged with the original route values and overrides them. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method using the specified controller name and returns the result as an HTML string. - The child action result as an HTML string. - The HTML helper instance that this method extends. - The name of the action method to invoke. - The name of the controller that contains the action method. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method using the specified parameters and controller name and returns the result as an HTML string. - The child action result as an HTML string. - The HTML helper instance that this method extends. - The name of the action method to invoke. - The name of the controller that contains the action method. - An object that contains the parameters for a route. You can use to provide the parameters that are bound to the action method parameters. The parameter is merged with the original route values and overrides them. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method using the specified parameters and controller name and returns the result as an HTML string. - The child action result as an HTML string. - The HTML helper instance that this method extends. - The name of the action method to invoke. - The name of the controller that contains the action method. - A dictionary that contains the parameters for a route. You can use to provide the parameters that are bound to the action method parameters. The parameter is merged with the original route values and overrides them. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method using the specified parameters and returns the result as an HTML string. - The child action result as an HTML string. - The HTML helper instance that this method extends. - The name of the action method to invoke. - A dictionary that contains the parameters for a route. You can use to provide the parameters that are bound to the action method parameters. The parameter is merged with the original route values and overrides them. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method and renders the result inline in the parent view. - The HTML helper instance that this method extends. - The name of the child action method to invoke. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method using the specified parameters and renders the result inline in the parent view. - The HTML helper instance that this method extends. - The name of the child action method to invoke. - An object that contains the parameters for a route. You can use to provide the parameters that are bound to the action method parameters. The parameter is merged with the original route values and overrides them. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method using the specified controller name and renders the result inline in the parent view. - The HTML helper instance that this method extends. - The name of the child action method to invoke. - The name of the controller that contains the action method. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method using the specified parameters and controller name and renders the result inline in the parent view. - The HTML helper instance that this method extends. - The name of the child action method to invoke. - The name of the controller that contains the action method. - An object that contains the parameters for a route. You can use to provide the parameters that are bound to the action method parameters. The parameter is merged with the original route values and overrides them. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method using the specified parameters and controller name and renders the result inline in the parent view. - The HTML helper instance that this method extends. - The name of the child action method to invoke. - The name of the controller that contains the action method. - A dictionary that contains the parameters for a route. You can use to provide the parameters that are bound to the action method parameters. The parameter is merged with the original route values and overrides them. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Invokes the specified child action method using the specified parameters and renders the result inline in the parent view. - The HTML helper instance that this method extends. - The name of the child action method to invoke. - A dictionary that contains the parameters for a route. You can use to provide the parameters that are bound to the action method parameters. The parameter is merged with the original route values and overrides them. - The parameter is null. - The parameter is null or empty. - The required virtual path data cannot be found. - - - Represents support for rendering object values as HTML. - - - Returns HTML markup for each property in the object that is represented by a string expression. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - - - Returns HTML markup for each property in the object that is represented by a string expression, using additional view data. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns HTML markup for each property in the object that is represented by the expression, using the specified template. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template that is used to render the object. - - - Returns HTML markup for each property in the object that is represented by the expression, using the specified template and additional view data. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template that is used to render the object. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns HTML markup for each property in the object that is represented by the expression, using the specified template and an HTML field ID. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template that is used to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - - - Returns HTML markup for each property in the object that is represented by the expression, using the specified template, HTML field ID, and additional view data. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template that is used to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns HTML markup for each property in the object that is represented by the expression. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The type of the model. - The type of the value. - - - Returns a string that contains each property value in the object that is represented by the specified expression, using additional view data. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - The type of the model. - The type of the value. - - - Returns a string that contains each property value in the object that is represented by the , using the specified template. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template that is used to render the object. - The type of the model. - The type of the value. - - - Returns a string that contains each property value in the object that is represented by the specified expression, using the specified template and additional view data. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template that is used to render the object. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - The type of the model. - The type of the value. - - - Returns HTML markup for each property in the object that is represented by the , using the specified template and an HTML field ID. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template that is used to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - The type of the model. - The type of the value. - - - Returns HTML markup for each property in the object that is represented by the specified expression, using the template, an HTML field ID, and additional view data. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template that is used to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - The type of the model. - The type of the value. - - - Returns HTML markup for each property in the model. - The HTML markup for each property in the model. - The HTML helper instance that this method extends. - - - Returns HTML markup for each property in the model, using additional view data. - The HTML markup for each property in the model. - The HTML helper instance that this method extends. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns HTML markup for each property in the model using the specified template. - The HTML markup for each property in the model. - The HTML helper instance that this method extends. - The name of the template that is used to render the object. - - - Returns HTML markup for each property in the model, using the specified template and additional view data. - The HTML markup for each property in the model. - The HTML helper instance that this method extends. - The name of the template that is used to render the object. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns HTML markup for each property in the model using the specified template and HTML field ID. - The HTML markup for each property in the model. - The HTML helper instance that this method extends. - The name of the template that is used to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - - - Returns HTML markup for each property in the model, using the specified template, an HTML field ID, and additional view data. - The HTML markup for each property in the model. - The HTML helper instance that this method extends. - The name of the template that is used to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Provides a way to render object values as HTML. - - - Returns HTML markup for each property in the object that is represented by the specified expression. - The HTML markup for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - - - Returns HTML markup for each property in the object that is represented by the specified expression. - The HTML markup for each property.zz 12/29/2010 1:25:49 PM - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The type of the model. - The type of the result. - - - Represents support for the HTML input element in an application. - - - Returns an HTML input element for each property in the object that is represented by the expression. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - - - Returns an HTML input element for each property in the object that is represented by the expression, using additional view data. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns an HTML input element for each property in the object that is represented by the expression, using the specified template. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template to use to render the object. - - - Returns an HTML input element for each property in the object that is represented by the expression, using the specified template and additional view data. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template to use to render the object. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns an HTML input element for each property in the object that is represented by the expression, using the specified template and HTML field name. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template to use to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - - - Returns an HTML input element for each property in the object that is represented by the expression, using the specified template, HTML field name, and additional view data. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template to use to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns an HTML input element for each property in the object that is represented by the expression. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The type of the model. - The type of the value. - - - Returns an HTML input element for each property in the object that is represented by the expression, using additional view data. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - The type of the model. - The type of the value. - - - Returns an HTML input element for each property in the object that is represented by the expression, using the specified template. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template to use to render the object. - The type of the model. - The type of the value. - - - Returns an HTML input element for each property in the object that is represented by the expression, using the specified template and additional view data. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template to use to render the object. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - The type of the model. - The type of the value. - - - Returns an HTML input element for each property in the object that is represented by the expression, using the specified template and HTML field name. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template to use to render the object. - The type of the model. - The type of the value. - - - Returns an HTML input element for each property in the object that is represented by the expression, using the specified template, HTML field name, and additional view data. - An HTML input element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - The name of the template to use to render the object. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - The type of the model. - The type of the value. - - - Returns an HTML input element for each property in the model. - An HTML input element for each property in the model. - The HTML helper instance that this method extends. - - - Returns an HTML input element for each property in the model, using additional view data. - An HTML input element for each property in the model. - The HTML helper instance that this method extends. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns an HTML input element for each property in the model, using the specified template. - An HTML input element for each property in the model and in the specified template. - The HTML helper instance that this method extends. - The name of the template to use to render the object. - - - Returns an HTML input element for each property in the model, using the specified template and additional view data. - An HTML input element for each property in the model. - The HTML helper instance that this method extends. - The name of the template to use to render the object. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Returns an HTML input element for each property in the model, using the specified template name and HTML field name. - An HTML input element for each property in the model and in the named template. - The HTML helper instance that this method extends. - The name of the template to use to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - - - Returns an HTML input element for each property in the model, using the template name, HTML field name, and additional view data. - An HTML input element for each property in the model. - The HTML helper instance that this method extends. - The name of the template to use to render the object. - A string that is used to disambiguate the names of HTML input elements that are rendered for properties that have the same name. - An anonymous object that can contain additional view data that will be merged into the instance that is created for the template. - - - Represents support for HTML in an application. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - The HTTP method for processing the form, either GET or POST. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - The HTTP method for processing the form, either GET or POST. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - The HTTP method for processing the form, either GET or POST. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - The HTTP method for processing the form, either GET or POST. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - The HTTP method for processing the form, either GET or POST. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. - The HTTP method for processing the form, either GET or POST. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the action method. - The name of the controller. - An object that contains the parameters for a route. - The HTTP method for processing the form, either GET or POST. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. - An opening <form> tag. - The HTML helper instance that this method extends. - An object that contains the parameters for a route. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - The HTTP method for processing the form, either GET or POST. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - The HTTP method for processing the form, either GET or POST. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - The HTTP method for processing the form, either GET or POST. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - The HTTP method for processing the form, either GET or POST. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - The HTTP method for processing the form, either GET or POST. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - An object that contains the parameters for a route - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - An object that contains the parameters for a route - The HTTP method for processing the form, either GET or POST. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - The name of the route to use to obtain the form-post URL. - An object that contains the parameters for a route - The HTTP method for processing the form, either GET or POST. - An object that contains the HTML attributes to set for the element. - - - Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. - An opening <form> tag. - The HTML helper instance that this method extends. - An object that contains the parameters for a route - - - Renders the closing </form> tag to the response. - The HTML helper instance that this method extends. - - - Represents support for HTML input controls in an application.12/23/2010 12:04:24 PM zz - - - Returns a check box input element by using the specified HTML helper and the name of the form field. - An input element whose type attribute is set to "checkbox". - The HTML helper instance that this method extends. - The name of the form field. - - - Returns a check box input element by using the specified HTML helper, the name of the form field, and a value to indicate whether the check box is selected. - An input element whose type attribute is set to "checkbox". - The HTML helper instance that this method extends. - The name of the form field. - true to select the check box; otherwise, false. - - - Returns a check box input element by using the specified HTML helper, the name of the form field, a value to indicate whether the check box is selected, and the HTML attributes. - An input element whose type attribute is set to "checkbox". - The HTML helper instance that this method extends. - The name of the form field. - true to select the check box; otherwise, false. - An object that contains the HTML attributes to set for the element. - - - Returns a check box input element by using the specified HTML helper, the name of the form field, a value that indicates whether the check box is selected, and the HTML attributes. - An input element whose type attribute is set to "checkbox". - The HTML helper instance that this method extends. - The name of the form field. - true to select the check box; otherwise, false. - An object that contains the HTML attributes to set for the element. - - - Returns a check box input element by using the specified HTML helper, the name of the form field, and the HTML attributes. - An input element whose type attribute is set to "checkbox". - The HTML helper instance that this method extends. - The name of the form field. - An object that contains the HTML attributes to set for the element. - - - Returns a check box input element by using the specified HTML helper, the name of the form field, and the HTML attributes. - An input element whose type attribute is set to "checkbox". - The HTML helper instance that this method extends. - The name of the form field. - An object that contains the HTML attributes to set for the element. - - - Returns a check box input element for each property in the object that is represented by the specified expression. - An HTML input element whose type attribute is set to "checkbox" for each property in the object that is represented by the specified expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The type of the model. - The parameter is null. - - - Returns a check box input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An HTML input element whose type attribute is set to "checkbox" for each property in the object that is represented by the specified expression, using the specified HTML attributes. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - A dictionary that contains the HTML attributes to set for the element. - The type of the model. - The parameter is null. - - - Returns a check box input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An HTML input element whose type attribute is set to "checkbox" for each property in the object that is represented by the specified expression, using the specified HTML attributes. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - An object that contains the HTML attributes to set for the element. - The type of the model. - The parameter is null. - - - Returns a hidden input element by using the specified HTML helper and the name of the form field. - An input element whose type attribute is set to "hidden". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - - - Returns a hidden input element by using the specified HTML helper, the name of the form field, and the value. - An input element whose type attribute is set to "hidden". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - The value of the hidden input element. If this value is null, the value of the element is retrieved from the object. If no value exists there, the value is retrieved from the object. - - - Returns a hidden input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. - An input element whose type attribute is set to "hidden". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - The value of the hidden input element. If this value is null, the value of the element is retrieved from the object. If no value exists there, the value is retrieved from the object. - An object that contains the HTML attributes to set for the element. - - - Returns a hidden input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. - An input element whose type attribute is set to "hidden". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - The value of the hidden input element. If this value is null, the value of the element is retrieved from the object. If no value exists there, the value is retrieved from the object. - An object that contains the HTML attributes to set for the element. - - - Returns an HTML hidden input element for each property in the object that is represented by the specified expression. - An input element whose type attribute is set to "hidden" for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The type of the model. - The type of the property. - - - Returns an HTML hidden input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An input element whose type attribute is set to "hidden" for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - An object that contains the HTML attributes to set for the element. - The type of the model. - The type of the property. - - - Returns an HTML hidden input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An input element whose type attribute is set to "hidden" for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - An object that contains the HTML attributes to set for the element. - The type of the model. - The type of the property. - - - Returns a password input element by using the specified HTML helper and the name of the form field. - An input element whose type attribute is set to "password". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - - - Returns a password input element by using the specified HTML helper, the name of the form field, and the value. - An input element whose type attribute is set to "password". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - The value of the password input element. If this value is null, the value of the element is retrieved from the object. If no value exists there, the value is retrieved from the object. - - - Returns a password input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. - An input element whose type attribute is set to "password". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - The value of the password input element. If this value is null, the value of the element is retrieved from the object. If no value exists there, the value is retrieved from the object. - An object that contains the HTML attributes to set for the element. - - - Returns a password input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. - An input element whose type attribute is set to "password". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - The value of the password input element. If this value is null, the value of the element is retrieved from the object. If no value exists there, the value is retrieved from the object. - An object that contains the HTML attributes to set for the element. - - - Returns a password input element for each property in the object that is represented by the specified expression. - An HTML input element whose type attribute is set to "password" for each property in the object that is represented by the specified expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The type of the model. - The type of the value. - The parameter is null. - - - Returns a password input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An HTML input element whose type attribute is set to "password" for each property in the object that is represented by the specified expression, using the specified HTML attributes. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - A dictionary that contains the HTML attributes to set for the element. - The type of the model. - The type of the value. - The parameter is null. - - - Returns a password input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An HTML input element whose type attribute is set to "password" for each property in the object that is represented by the specified expression, using the specified HTML attributes. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - An object that contains the HTML attributes to set for the element. - The type of the model. - The type of the value. - The parameter is null. - - - Returns a radio button input element that is used to present mutually exclusive options. - An input element whose type attribute is set to "radio". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - If this radio button is selected, the value of the radio button that is submitted when the form is posted. If the value of the selected radio button in the or the object matches this value, this radio button is selected. - The parameter is null or empty. - The parameter is null. - - - Returns a radio button input element that is used to present mutually exclusive options. - An input element whose type attribute is set to "radio". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - If this radio button is selected, the value of the radio button that is submitted when the form is posted. If the value of the selected radio button in the or the object matches this value, this radio button is selected. - true to select the radio button; otherwise, false. - The parameter is null or empty. - The parameter is null. - - - Returns a radio button input element that is used to present mutually exclusive options. - An input element whose type attribute is set to "radio". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - If this radio button is selected, the value of the radio button that is submitted when the form is posted. If the value of the selected radio button in the or the object matches this value, this radio button is selected. - true to select the radio button; otherwise, false. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - The parameter is null. - - - Returns a radio button input element that is used to present mutually exclusive options. - An input element whose type attribute is set to "radio". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - If this radio button is selected, the value of the radio button that is submitted when the form is posted. If the value of the selected radio button in the or the object matches this value, this radio button is selected. - true to select the radio button; otherwise, false. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - The parameter is null. - - - Returns a radio button input element that is used to present mutually exclusive options. - An input element whose type attribute is set to "radio". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - If this radio button is selected, the value of the radio button that is submitted when the form is posted. If the value of the selected radio button in the or the object matches this value, this radio button is selected. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - The parameter is null. - - - Returns a radio button input element that is used to present mutually exclusive options. - An input element whose type attribute is set to "radio". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - If this radio button is selected, the value of the radio button that is submitted when the form is posted. If the value of the selected radio button in the or the object matches this value, this radio button is selected. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - The parameter is null. - - - Returns a radio button input element for each property in the object that is represented by the specified expression. - An HTML input element whose type attribute is set to "radio" for each property in the object that is represented by the specified expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - If this radio button is selected, the value of the radio button that is submitted when the form is posted. If the value of the selected radio button in the or the object matches this value, this radio button is selected. - The type of the model. - The type of the value. - The parameter is null. - - - Returns a radio button input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An HTML input element whose type attribute is set to "radio" for each property in the object that is represented by the specified expression, using the specified HTML attributes. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - If this radio button is selected, the value of the radio button that is submitted when the form is posted. If the value of the selected radio button in the or the object matches this value, this radio button is selected. - A dictionary that contains the HTML attributes to set for the element. - The type of the model. - The type of the value. - The parameter is null. - - - Returns a radio button input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An HTML input element whose type attribute is set to "radio" for each property in the object that is represented by the specified expression, using the specified HTML attributes. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - If this radio button is selected, the value of the radio button that is submitted when the form is posted. If the value of the selected radio button in the or the object matches this value, this radio button is selected. - An object that contains the HTML attributes to set for the element. - The type of the model. - The type of the value. - The parameter is null. - - - Returns a text input element by using the specified HTML helper and the name of the form field. - An input element whose type attribute is set to "text". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - - - Returns a text input element by using the specified HTML helper, the name of the form field, and the value. - An input element whose type attribute is set to "text". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - The value of the text input element. If this value is null, the value of the element is retrieved from the object. If no value exists there, the value is retrieved from the object. - - - Returns a text input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. - An input element whose type attribute is set to "text". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - The value of the text input element. If this value is null, the value of the element is retrieved from the object. If no value exists there, the value is retrieved from the object. - An object that contains the HTML attributes to set for the element. - - - Returns a text input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. - An input element whose type attribute is set to "text". - The HTML helper instance that this method extends. - The name of the form field and the key that is used to look up the value. - The value of the text input element. If this value is null, the value of the element is retrieved from the object. If no value exists there, the value is retrieved from the object. - An object that contains the HTML attributes to set for the element. - - - Returns a text input element for each property in the object that is represented by the specified expression. - An HTML input element whose type attribute is set to "text" for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The type of the model. - The type of the value. - The parameter is null or empty. - - - Returns a text input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An HTML input element type attribute is set to "text" for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - A dictionary that contains the HTML attributes to set for the element. - The type of the model. - The type of the value. - The parameter is null or empty. - - - Returns a text input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. - An HTML input element whose type attribute is set to "text" for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - An object that contains the HTML attributes to set for the element. - The type of the model. - The type of the value. - The parameter is null or empty. - - - Represents support for the HTML label element in an ASP.NET MVC view. - - - Returns an HTML label element and the property name of the property that is represented by the specified expression. - An HTML label element and the property name of the property that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the property to display. - - - Returns . - - - An HTML label element and the property name of the property that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the property to display. - The type of the model. - The type of the value. - - - An HTML label element and the property name of the property that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the property to display. - The label text. - The type of the model. - The type of the value. - - - Returns an HTML label element and the property name of the property that is represented by the model. - An HTML label element and the property name of the property that is represented by the model. - The HTML helper instance that this method extends. - - - Returns . - - - Represents support for HTML links in an application. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - An object that contains the HTML attributes for the element. The attributes are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - The name of the controller. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - The name of the controller. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - The name of the controller. - The protocol for the URL, such as "http" or "https". - The host name for the URL. - The URL fragment name (the anchor name). - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - The name of the controller. - The protocol for the URL, such as "http" or "https". - The host name for the URL. - The URL fragment name (the anchor name). - An object that contains the parameters for a route. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - The name of the controller. - An object that contains the parameters for a route. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - An object that contains the parameters for a route. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the action. - An object that contains the parameters for a route. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the route that is used to return a virtual path. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the route that is used to return a virtual path. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the route that is used to return a virtual path. - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the route that is used to return a virtual path. - The protocol for the URL, such as "http" or "https". - The host name for the URL. - The URL fragment name (the anchor name). - An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the route that is used to return a virtual path. - The protocol for the URL, such as "http" or "https". - The host name for the URL. - The URL fragment name (the anchor name). - An object that contains the parameters for a route. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the route that is used to return a virtual path. - An object that contains the parameters for a route. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - The name of the route that is used to return a virtual path. - An object that contains the parameters for a route. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - An object that contains the parameters for a route. - The parameter is null or empty. - - - Returns an anchor element (a element) that contains the virtual path of the specified action. - An anchor element (a element). - The HTML helper instance that this method extends. - The inner text of the anchor element. - An object that contains the parameters for a route. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Represents an HTML form element in an MVC view. - - - Initializes a new instance of the class using the specified HTTP response object. - The HTTP response object. - The parameter is null. - - - Initializes a new instance of the class using the specified view context. - An object that encapsulates the information that is required in order to render a view. - The parameter is null. - - - Releases all resources that are used by the current instance of the class. - - - Releases unmanaged and, optionally, managed resources used by the current instance of the class. - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - Ends the form and disposes of all form resources. - - - Represents the functionality to render a partial view as an HTML-encoded string. - - - Renders the specified partial view as an HTML-encoded string. - The partial view that is rendered as an HTML-encoded string. - The HTML helper instance that this method extends. - The name of the partial view to render. - - - Renders the specified partial view as an HTML-encoded string. - The partial view that is rendered as an HTML-encoded string. - The HTML helper instance that this method extends. - The name of the partial view to render. - The model for the partial view. - - - Renders the specified partial view as an HTML-encoded string. - The partial view that is rendered as an HTML-encoded string. - The HTML helper instance that this method extends. - The name of the partial view. - The model for the partial view. - The view data dictionary for the partial view. - - - Renders the specified partial view as an HTML-encoded string. - The partial view that is rendered as an HTML-encoded string. - The HTML helper instance that this method extends. - The name of the partial view to render. - The view data dictionary for the partial view. - - - Provides support for rendering a partial view. - - - Renders the specified partial view by using the specified HMTL helper. - The HTML helper. - The name of the partial view - - - Renders the specified partial view, passing it a copy of the current object, but with the Model property set to the specified model. - The HTML helper. - The name of the partial view. - The model. - - - Renders the specified partial view, replacing the partial view's ViewData property with the specified object and setting the Model property of the view data to the specified model. - The HTML helper. - The name of the partial view. - The model for the partial view. - The view data for the partial view. - - - Renders the specified partial view, replacing its ViewData property with the specified object. - The HTML helper. - The name of the partial view. - The view data. - - - Represents support for making selections in a list. - - - Returns a single-selection select element using the specified HTML helper and the name of the form field. - An HTML select element. - The HTML helper instance that this method extends. - The name of the form field to return. - The parameter is null or empty. - - - Returns a single-selection select element using the specified HTML helper, the name of the form field, and the specified list items. - An HTML select element with an option subelement for each item in the list. - The HTML helper instance that this method extends. - The name of the form field to return. - A collection of objects that are used to populate the drop-down list. - The parameter is null or empty. - - - Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HTML attributes. - An HTML select element with an option subelement for each item in the list. - The HTML helper instance that this method extends. - The name of the form field to return. - A collection of objects that are used to populate the drop-down list. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HTML attributes. - An HTML select element with an option subelement for each item in the list. - The HTML helper instance that this method extends. - The name of the form field to return. - A collection of objects that are used to populate the drop-down list. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and an option label. - An HTML select element with an option subelement for each item in the list. - The HTML helper instance that this method extends. - The name of the form field to return. - A collection of objects that are used to populate the drop-down list. - The text for a default empty item. This parameter can be null. - The parameter is null or empty. - - - Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, an option label, and the specified HTML attributes. - An HTML select element with an option subelement for each item in the list. - The HTML helper instance that this method extends. - The name of the form field to return. - A collection of objects that are used to populate the drop-down list. - The text for a default empty item. This parameter can be null. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, an option label, and the specified HTML attributes. - An HTML select element with an option subelement for each item in the list. - The HTML helper instance that this method extends. - The name of the form field to return. - A collection of objects that are used to populate the drop-down list. - The text for a default empty item. This parameter can be null. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns a single-selection select element using the specified HTML helper, the name of the form field, and an option label. - An HTML select element with an option subelement for each item in the list. - The HTML helper instance that this method extends. - The name of the form field to return. - The text for a default empty item. This parameter can be null. - The parameter is null or empty. - - - Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items. - An HTML select element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - A collection of objects that are used to populate the drop-down list. - The type of the model. - The type of the value. - The parameter is null. - - - Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items and HTML attributes. - An HTML select element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - A collection of objects that are used to populate the drop-down list. - The type of the model. - The type of the value. - The parameter is null. - - - Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items and HTML attributes. - An HTML select element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - A collection of objects that are used to populate the drop-down list. - The type of the model. - The type of the value. - The parameter is null. - - - Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items and option label. - An HTML select element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - A collection of objects that are used to populate the drop-down list. - The type of the model. - The type of the value. - The parameter is null. - - - Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items, option label, and HTML attributes. - An HTML select element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - A collection of objects that are used to populate the drop-down list. - The type of the model. - The type of the value. - The parameter is null. - - - Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items, option label, and HTML attributes. - An HTML select element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - A collection of objects that are used to populate the drop-down list. - The type of the model. - The type of the value. - The parameter is null. - - - Returns a multi-select select element using the specified HTML helper and the name of the form field. - An HTML select element. - The HTML helper instance that this method extends. - The name of the form field to return. - The parameter is null or empty. - - - Returns a multi-select select element using the specified HTML helper, the name of the form field, and the specified list items. - An HTML select element with an option subelement for each item in the list. - The HTML helper instance that this method extends. - The name of the form field to return. - A collection of objects that are used to populate the drop-down list. - The parameter is null or empty. - - - Returns a multi-select select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HMTL attributes. - An HTML select element with an option subelement for each item in the list.. - The HTML helper instance that this method extends. - The name of the form field to return. - A collection of objects that are used to populate the drop-down list. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns a multi-select select element using the specified HTML helper, the name of the form field, and the specified list items. - An HTML select element with an option subelement for each item in the list.. - The HTML helper instance that this method extends. - The name of the form field to return. - A collection of objects that are used to populate the drop-down list. - An object that contains the HTML attributes to set for the element. - The parameter is null or empty. - - - Returns an HTML select element for each property in the object that is represented by the specified expression and using the specified list items. - An HTML select element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - A collection of objects that are used to populate the drop-down list. - The type of the model. - The type of the property. - The parameter is null. - - - Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items and HTML attributes. - An HTML select element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - A collection of objects that are used to populate the drop-down list. - The type of the model. - The type of the property. - The parameter is null. - - - Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items and HTML attributes. - An HTML select element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to display. - A collection of objects that are used to populate the drop-down list. - The type of the model. - The type of the property. - The parameter is null. - - - Represents support for HTML textarea controls. - - - Returns the specified textarea element by using the specified HTML helper and the name of the form field. - The textarea element. - The HTML helper instance that this method extends. - The name of the form field to return. - - - Returns the specified textarea element by using the specified HTML helper, the name of the form field, and the specified HTML attributes. - The textarea element. - The HTML helper instance that this method extends. - The name of the form field to return. - An object that contains the HTML attributes to set for the element. - - - Returns the specified textarea element by using the specified HTML helper and HTML attributes. - The textarea element. - The HTML helper instance that this method extends. - The name of the form field to return. - An object that contains the HTML attributes to set for the element. - - - Returns the specified textarea element by using the specified HTML helper, the name of the form field, and the text content. - The textarea element. - The HTML helper instance that this method extends. - The name of the form field to return. - The text content. - - - Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, and the specified HTML attributes. - The textarea element. - The HTML helper instance that this method extends. - The name of the form field to return. - The text content. - An object that contains the HTML attributes to set for the element. - - - Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, the number of rows and columns, and the specified HTML attributes. - The textarea element. - The HTML helper instance that this method extends. - The name of the form field to return. - The text content. - The number of rows. - The number of columns. - An object that contains the HTML attributes to set for the element. - - - Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, the number of rows and columns, and the specified HTML attributes. - The textarea element. - The HTML helper instance that this method extends. - The name of the form field to return. - The text content. - The number of rows. - The number of columns. - An object that contains the HTML attributes to set for the element. - - - Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, and the specified HTML attributes. - The textarea element. - The HTML helper instance that this method extends. - The name of the form field to return. - The text content. - An object that contains the HTML attributes to set for the element. - - - Returns an HTML textarea element for each property in the object that is represented by the specified expression. - An HTML textarea element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The type of the model. - The type of the property. - The parameter is null. - - - Returns an HTML textarea element for each property in the object that is represented by the specified expression using the specified HTML attributes. - An HTML textarea element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - A dictionary that contains the HTML attributes to set for the element. - The type of the model. - The type of the property. - The parameter is null. - - - Returns an HTML textarea element for each property in the object that is represented by the specified expression using the specified HTML attributes and the number of rows and columns. - An HTML textarea element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The number of rows. - The number of columns. - A dictionary that contains the HTML attributes to set for the element. - The type of the model. - The type of the property. - The parameter is null. - - - Returns an HTML textarea element for each property in the object that is represented by the specified expression using the specified HTML attributes and the number of rows and columns. - An HTML textarea element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The number of rows. - The number of columns. - A dictionary that contains the HTML attributes to set for the element. - The type of the model. - The type of the property. - The parameter is null. - - - Returns an HTML textarea element for each property in the object that is represented by the specified expression using the specified HTML attributes. - An HTML textarea element for each property in the object that is represented by the expression. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - A dictionary that contains the HTML attributes to set for the element. - The type of the model. - The type of the property. - The parameter is null. - - - Provides support for validating the input from an HTML form. - - - Gets or sets the name of the resource file (class key) that contains localized string values. - The name of the resource file (class key). - - - Retrieves the validation metadata for the specified model and applies each rule to the data field. - The HTML helper instance that this method extends. - The name of the property or model object that is being validated. - The parameter is null. - - - Retrieves the validation metadata for the specified model and applies each rule to the data field. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The type of the model. - The type of the property. - - - Displays a validation message if an error exists for the specified field in the object. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - The name of the property or model object that is being validated. - - - Displays a validation message if an error exists for the specified field in the object. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - The name of the property or model object that is being validated. - An object that contains the HTML attributes for the element. - - - Displays a validation message if an error exists for the specified field in the object. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - The name of the property or model object that is being validated. - An object that contains the HTML attributes for the element. - - - Displays a validation message if an error exists for the specified field in the object. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - The name of the property or model object that is being validated. - The message to display if the specified field contains an error. - - - Displays a validation message if an error exists for the specified field in the object. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - The name of the property or model object that is being validated. - The message to display if the specified field contains an error. - An object that contains the HTML attributes for the element. - - - Displays a validation message if an error exists for the specified field in the object. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - The name of the property or model object that is being validated. - The message to display if the specified field contains an error. - An object that contains the HTML attributes for the element. - - - Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The type of the model. - The type of the property. - - - Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The message to display if the specified field contains an error. - The type of the model. - The type of the property. - - - Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message and HTML attributes. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The message to display if the specified field contains an error. - An object that contains the HTML attributes for the element. - The type of the model. - The type of the property. - - - Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message and HTML attributes. - If the property or object is valid, an empty string; otherwise, a span element that contains an error message. - The HTML helper instance that this method extends. - An expression that identifies the object that contains the properties to render. - The message to display if the specified field contains an error. - An object that contains the HTML attributes for the element. - The type of the model. - The type of the property. - - - Returns an unordered list (ul element) of validation messages that are in the object. - A string that contains an unordered list (ul element) of validation messages. - The HTML helper instance that this method extends. - - - Returns an unordered list (ul element) of validation messages that are in the object and optionally displays only model-level errors. - A string that contains an unordered list (ul element) of validation messages. - The HTML helper instance that this method extends. - true to have the summary display model-level errors only, or false to have the summary display all errors. - - - Returns an unordered list (ul element) of validation messages that are in the object and optionally displays only model-level errors. - A string that contains an unordered list (ul element) of validation messages. - The HTML helper instance that this method extends. - true to have the summary display model-level errors only, or false to have the summary display all errors. - The message to display with the validation summary. - - - Returns an unordered list (ul element) of validation messages that are in the object and optionally displays only model-level errors. - A string that contains an unordered list (ul element) of validation messages. - The HTML helper instance that this method extends. - true to have the summary display model-level errors only, or false to have the summary display all errors. - The message to display with the validation summary. - A dictionary that contains the HTML attributes for the element. - - - Returns an unordered list (ul element) of validation messages that are in the object and optionally displays only model-level errors. - A string that contains an unordered list (ul element) of validation messages. - The HTML helper instance that this method extends. - true to have the summary display model-level errors only, or false to have the summary display all errors. - The message to display with the validation summary. - An object that contains the HTML attributes for the element. - - - Returns an unordered list (ul element) of validation messages that are in the object. - A string that contains an unordered list (ul element) of validation messages. - The HMTL helper instance that this method extends. - The message to display if the specified field contains an error. - - - Returns an unordered list (ul element) of validation messages that are in the object. - A string that contains an unordered list (ul element) of validation messages. - The HTML helper instance that this method extends. - The message to display if the specified field contains an error. - A dictionary that contains the HTML attributes for the element. - - - Returns an unordered list (ul element) of validation messages in the object. - A string that contains an unordered list (ul element) of validation messages. - The HTML helper instance that this method extends. - The message to display if the specified field contains an error. - An object that contains the HTML attributes for the element. - - - Provides a model-aware class for ASP.NET MVC. - - - Initializes a new instance of the class. - The start of the span. - The content. - The type name of the model. - - - Gets a value that indicates whether the current object is identical to the specified object. - true if the current object is identical to the specified object; otherwise, false. - The model span object. - - - Returns the hash code of the object. - The hash code of the object. - - - Gets the type name of the model. - The type name of the model. - - - Compiles ASP.NET Razor views into classes. - - - Initializes a new instance of the class. - The class name. - The root namespace. - The name of the source file. - The ASP.NET Razor engine host. - - - Returns a value that indicates whether the specified model span is an instance of . - true if the value of the parameter is an instance of ; otherwise, false. - The model span. - - - - - - Compiles ASP.NET Razor views into classes. - - - - - Extends the VBCodeParser class by adding support for the @model keyword. - - - Initializes a new instance of the class. - - - - Configures the ASP.NET Razor parser and code generator for a specified file. - - - Initializes a new instance of the class. - The virtual path of the ASP.NET Razor file. - The physical path of the ASP.NET Razor file. - - - - - \ No newline at end of file diff --git a/lib/System.Web.Razor.dll b/lib/System.Web.Razor.dll deleted file mode 100644 index 8668fb6ba57..00000000000 Binary files a/lib/System.Web.Razor.dll and /dev/null differ diff --git a/lib/System.Web.Razor.xml b/lib/System.Web.Razor.xml deleted file mode 100644 index 05e6ce2f394..00000000000 --- a/lib/System.Web.Razor.xml +++ /dev/null @@ -1,4359 +0,0 @@ - - - - System.Web.Razor - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - . - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - Enumerates the list of Visual Basic keywords. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - \ No newline at end of file diff --git a/lib/System.Web.WebPages.Razor.dll b/lib/System.Web.WebPages.Razor.dll deleted file mode 100644 index 9846dd3fc48..00000000000 Binary files a/lib/System.Web.WebPages.Razor.dll and /dev/null differ diff --git a/lib/System.Web.WebPages.dll b/lib/System.Web.WebPages.dll deleted file mode 100644 index 9fea012852d..00000000000 Binary files a/lib/System.Web.WebPages.dll and /dev/null differ diff --git a/lib/js/JSV.js b/lib/js/JSV.js deleted file mode 100644 index f7d31dfa582..00000000000 --- a/lib/js/JSV.js +++ /dev/null @@ -1,588 +0,0 @@ -/** - * Created by IntelliJ IDEA. - * User: mythz - * Date: 16-Jun-2010 - * Time: 00:51:17 - * To change this template use File | Settings | File Templates. - */ - -var JSV = {}; -/** - * parses JSV text into a JavaScript type - * @param str - */ -JSV.parse = function(str) -{ - if (!str) return str; - if (str[0] == '{') - { - return JSV.parseObject_(str); - } - else if (str[0] == '[') - { - return JSV.parseArray_(str); - } - else - { - return JSV.parseString(str); - } -} - -JSV.ESCAPE_CHARS = ['"', ',', '{', '}', '[', ']']; - -JSV.parseArray_ = function(str) -{ - var to = [], value = JSV.stripList_(str); - if (!value) return to; - - if (value[0] == '{') - { - var ref = {i:0}; - do - { - var itemValue = JSV.eatMapValue_(value, ref); - to.push(JSV.parse(itemValue)); - } while (++ref.i < value.length); - } - else - { - for (var ref={i:0}; ref.i < value.length; ref.i++) - { - var elementValue = JSV.eatElementValue_(value, ref); - to.push(JSV.parse(elementValue)); - } - } - return to; -}; - -JSV.parseObject_ = function(str) -{ - if (str[0] != '{') - { - throw "Type definitions should start with a '{', got string starting with: " - + str.substr(0, str.length < 50 ? str.length : 50); - } - - var name, obj = {}; - - if (str == '{}') return null; - for (var ref={i:1}, strTypeLength = str.length; ref.i < strTypeLength; ref.i++) - { - name = JSV.eatMapKey_(str, ref); - ref.i++; - var value = JSV.eatMapValue_(str, ref); - obj[name]= JSV.parse(value); - } - return obj; -} - -JSV.eatElementValue_ = function(value, ref) -{ - return JSV.eatUntilCharFound_(value, ref, ','); -} - -JSV.containsAny_ = function(str, tests) -{ - if (!is.String(str)) return; - for (var i = 0, len = tests.length; i < len; i++) - { - if (str.indexOf(tests[i]) != -1) return true; - } - return false; -}; - -JSV.toCsvField = function(text) -{ - return !text || JSV.containsAny_(JSV.ESCAPE_CHARS) - ? text - : '"' + text.replace(/"/g, '""') + '"'; -} - -JSV.parseString = JSV.fromCsvField = function(text) -{ - return !text || text[0] != '"' - ? text - : text.substr(1, text.length - 2).replace(/""/g, '"'); -} - -JSV.stripList_ = function(value) -{ - if (!value) return null; - return value[0] == '[' - ? value.substr(1, value.length - 2) - : value; -}; - -/** - * @param value {string} - * @param ref {ref int} - * @param findChar {char} - */ -JSV.eatUntilCharFound_ = function(value, ref, findChar) -{ - var tokenStartPos = ref.i; - var valueLength = value.length; - if (value[tokenStartPos] != '"') - { - ref.i = value.indexOf(findChar, tokenStartPos); - if (ref.i == -1) ref.i = valueLength; - return value.substr(tokenStartPos, ref.i - tokenStartPos); - } - - while (++ref.i < valueLength) - { - if (value[ref.i] == '"') - { - if (ref.i + 1 >= valueLength) - { - return value.substr(tokenStartPos, ++ref.i - tokenStartPos); - } - if (value[ref.i + 1] == '"') - { - ref.i++; - } - else if (value[ref.i + 1] == findChar) - { - return value.substr(tokenStartPos, ++ref.i - tokenStartPos); - } - } - } - - throw "Could not find ending quote"; -} - -/** - * - * @param value {string} - * @param i {ref int} - */ -JSV.eatMapKey_ = function(value, ref) -{ - var tokenStartPos = ref.i; - while (value[++ref.i] != ':' && ref.i < value.length) { } - return value.substr(tokenStartPos, ref.i - tokenStartPos); -} - -/** - * - * @param value {string} - * @param ref {ref int} - */ -JSV.eatMapValue_ = function(value, ref) -{ - var tokenStartPos = ref.i; - var valueLength = value.length; - if (ref.i == valueLength) return null; - - var valueChar = value[ref.i]; - - //If we are at the end, return. - if (valueChar == ',' || valueChar == '}') - { - return null; - } - - //Is List, i.e. [...] - var withinQuotes = false; - if (valueChar == '[') - { - var endsToEat = 1; - while (++ref.i < valueLength && endsToEat > 0) - { - valueChar = value[ref.i]; - if (valueChar == '"') - withinQuotes = !withinQuotes; - if (withinQuotes) - continue; - if (valueChar == '[') - endsToEat++; - if (valueChar == ']') - endsToEat--; - } - return value.substr(tokenStartPos, ref.i - tokenStartPos); - } - - //Is Type/Map, i.e. {...} - if (valueChar == '{') - { - var endsToEat = 1; - while (++ref.i < valueLength && endsToEat > 0) - { - valueChar = value[ref.i]; - - if (valueChar == '"') - withinQuotes = !withinQuotes; - if (withinQuotes) - continue; - if (valueChar == '{') - endsToEat++; - if (valueChar == '}') - endsToEat--; - } - return value.substr(tokenStartPos, ref.i - tokenStartPos); - } - - //Is Within Quotes, i.e. "..." - if (valueChar == '"') - { - while (++ref.i < valueLength) - { - valueChar = value[ref.i]; - if (valueChar != '"') continue; - var isLiteralQuote = ref.i + 1 < valueLength && value[ref.i + 1] == '"'; - ref.i++; //skip quote - if (!isLiteralQuote) - break; - } - return value.substr(tokenStartPos, ref.i - tokenStartPos); - } - - //Is Value - while (++ref.i < valueLength) - { - valueChar = value[ref.i]; - if (valueChar == ',' || valueChar == '}') - break; - } - - return value.substr(tokenStartPos, ref.i - tokenStartPos); -} - -JSV.isEmpty_ = function(a) -{ - return (a === null || a === undefined || a === ""); -} -JSV.isFunction_ = function(a) -{ - return (typeof (a) === 'function') ? a.constructor.toString().match(/Function/) !== null : false; -}; -JSV.isString_ = function(a) -{ - if (a === null || a === undefined) return false; - return (typeof (a) === 'string') ? true : (typeof (a) === 'object') ? a.constructor.toString().match(/string/i) !== null : false; -}; -JSV.isDate_ = function(a) -{ - if (JSV.isEmpty_(a)) return false; - return (typeof (a) === 'date') ? true : (typeof (a) === 'object') ? a.constructor.toString().match(/date/i) !== null : false; -}; - -JSV.isArray_ = function(a) -{ - if (a === null || a === undefined || a === "") return false; - return (typeof (a) === 'object') ? a.constructor.toString().match(/array/i) !== null || a.length !== undefined : false; -}; -JSV.toXsdDateTime = function(date) -{ - function pad(n) { - var s = n.toString(); - return s.length < 2 ? '0'+s : s; - }; - var yyyy = date.getUTCFullYear(); - var MM = pad(date.getUTCMonth()+1); - var dd = pad(date.getUTCDate()); - var hh = pad(date.getUTCHours()); - var mm = pad(date.getUTCMinutes()); - var ss = pad(date.getUTCSeconds()); - var ms = pad(date.getUTCMilliseconds()); - - return yyyy +'-' + MM + '-' + dd + 'T' + hh + ':' + mm + ':' + ss + '.' + ms + 'Z'; -} -JSV.serialize = JSV.stringify = function(obj) -{ - if (obj === null || obj === undefined) return null; - - var typeOf = typeof(obj); - if (obj === 'function') return null; - - if (typeOf === 'object') - { - var ctorStr = obj.constructor.toString().toLowerCase(); - if (ctorStr.indexOf('string') != -1) - return JSV.escapeString(obj); - if (ctorStr.indexOf('boolean') != -1) - return obj ? "True" : "False"; - if (ctorStr.indexOf('number') != -1) - return obj; - if (ctorStr.indexOf('date') != -1) - return JSV.escapeString(JSV.toXsdDateTime(obj)); - if (ctorStr.indexOf('array') != -1) - return JSV.serializeArray(obj); - - return JSV.serializeObject(obj); - } - else - { - switch(typeOf) - { - case 'string': - return JSV.escapeString(obj); - break; - case 'boolean': - return obj ? "True" : "False"; - break; - case 'date': - return JSV.escapeString(JSV.toXsdDateTime(obj)); - break; - case 'array': - return JSV.serializeArray(obj); - break; - case 'number': - default: - return obj; - } - } -}; -JSV.serializeObject = function(obj) -{ - var value, sb = new StringBuffer(); - for (var key in obj) - { - value = obj[key]; - if (!obj.hasOwnProperty(key) || JSV.isEmpty_(value) || JSV.isFunction_(value)) continue; - - if (sb.getLength() > 0) - sb.append(','); - - sb.append(JSV.escapeString(key)); - sb.append(':'); - sb.append(JSV.serialize(value)); - } - return '{' + sb.toString() + '}'; -}; -JSV.serializeArray = function(array) -{ - var value, sb = new StringBuffer(); - for (var i=0, len=array.length; i 0) - sb.append(','); - - sb.append(JSV.serialize(value)); - } - return '[' + sb.toString() + ']'; -}; -JSV.escapeString = function(str) -{ - if (str === undefined || str === null) return null; - if (str === '') return '""'; - - if (str.indexOf('"')) - { - str = str.replace(/"/g,'""'); - } - if (JSV.containsAny_(str, JSV.ESCAPE_CHARS)) - { - return '"' + str + '"'; - } - return str; -}; -JSV.containsAny_ = function(str, tests) -{ - if (!JSV.isString_(str)) return; - for (var i = 0, len = tests.length; i < len; i++) - { - if (str.indexOf(tests[i]) != -1) return true; - } - return false; -}; - -/* Closure Library StringBuffer for efficient string concatenation */ -var hasScriptEngine = 'ScriptEngine' in window; -var HAS_JSCRIPT = hasScriptEngine && window['ScriptEngine']() == 'JScript'; - -StringBuffer = function(opt_a1, var_args) { - this.buffer_ = HAS_JSCRIPT ? [] : ''; - - if (opt_a1 != null) { - this.append.apply(this, arguments); - } -}; -StringBuffer.prototype.set = function(s) { - this.clear(); - this.append(s); -}; -if (HAS_JSCRIPT) { - StringBuffer.prototype.bufferLength_ = 0; - StringBuffer.prototype.append = function(a1, opt_a2, var_args) { - // IE version. - if (opt_a2 == null) { // second argument is undefined (null == undefined) - // Array assignment is 2x faster than Array push. Also, use a1 - // directly to avoid arguments instantiation, another 2x improvement. - this.buffer_[this.bufferLength_++] = a1; - } else { - this.buffer_.push.apply(/** @type {Array} */ (this.buffer_), arguments); - this.bufferLength_ = this.buffer_.length; - } - return this; - }; -} else { - StringBuffer.prototype.append = function(a1, opt_a2, var_args) { - // W3 version. - this.buffer_ += a1; - if (opt_a2 != null) { // second argument is undefined (null == undefined) - for (var i = 1; i < arguments.length; i++) { - this.buffer_ += arguments[i]; - } - } - return this; - }; -} -StringBuffer.prototype.clear = function() { - if (HAS_JSCRIPT) { - this.buffer_.length = 0; // Reuse the array to avoid creating new object. - this.bufferLength_ = 0; - } else { - this.buffer_ = ''; - } -}; -StringBuffer.prototype.getLength = function() { - return this.toString().length; -}; -StringBuffer.prototype.toString = function() { - if (HAS_JSCRIPT) { - var str = this.buffer_.join(''); - this.clear(); - if (str) { - this.append(str); - } - return str; - } else { - return /** @type {string} */ (this.buffer_); - } -}; - - -/** - * Considering pulling this out - * @param baseUri - * @param type - */ -function JsvServiceClient(baseUri) -{ - this.baseSyncReplyUri = JsvServiceClient.combine_(baseUri, "jsv/reply"); - this.baseAsyncOneWayUri = JsvServiceClient.combine_(baseUri, "jsv/oneway"); -} -JsvServiceClient.prototype.send = function(webMethod, request, onSuccess, onError, ajaxOptions) { - var startCallTime = new Date(); - var requestUrl = JsvServiceClient.combine_(this.baseSyncReplyUri, webMethod); - var id = JsvServiceClient.id++; - - var options = { - type: "GET", - url: requestUrl, - data: request, - dataType: "text", - success: function(responseText) - { - var endCallTime = new Date(); - var callDuration = endCallTime.getTime() - startCallTime.getTime(); - - var response = JSV.parse(responseText); - if (!response) - { - if (onSuccess) onSuccess(null); - return; - } - - var status = JsvServiceClient.parseResponseStatus_(response.ResponseStatus); - if (status.isSuccess) - { - if (onSuccess) onSuccess(response); - JsvServiceClient.onSuccess({ id: id, webMethod: webMethod, request: request, - response: response, durationMs: callDuration - }); - } - else - { - if (onError) onError(status); - JsvServiceClient.onError({ id: id, webMethod: webMethod, request: request, - error: status, durationMs: callDuration - }); - } - }, - error: function(xhr, desc, exObj) - { - var endCallTime = new Date(); - var callDuration = endCallTime.getTime() - startCallTime.getTime(); - - try - { - if (onError) onError(xhr.responseText); - } - catch (e) {} - JsvServiceClient.onError({ id: id, webMethod: webMethod, request: request, - error: xhr.responseText, durationMs: callDuration - }); - } - }; - - for (var k in ajaxOptions) options[k] = ajaxOptions[k]; - - var ajax = $.ajax(options); -}; - -JsvServiceClient.combine_ = function() { - var paths = ""; - for (var i = 0, len = arguments.length; i < len; i++) { - if (paths.length > 0) - paths += "/"; - paths += arguments[i].replace(/[/]+$/g, ""); - } - return paths; -}; - -//Sends a HTTP 'GET' request on the QueryString -JsvServiceClient.prototype.getFromService = function(webMethod, request, onSuccess, onError) { - this.send(webMethod, request, onSuccess, onError); -}; - -//Sends a HTTP 'POST' request as key value pair formData -JsvServiceClient.prototype.postFormDataToService = function(webMethod, request, onSuccess, onError) { - this.send(webMethod, request, onSuccess, onError, { type: "POST" }); -}; - -//Sends a HTTP 'POST' request as JSV @requires jQuery -JsvServiceClient.prototype.postToService = function(webMethod, request, onSuccess, onError) { - var jsvRequest = JSV.serialize(request); - this.send(webMethod, jsvRequest, onSuccess, onError, { type: "POST", processData: false, contentType: "application/jsv; charset=utf-8" }); -}; - -JsvServiceClient.id = 0; -JsvServiceClient.onError = function() { }; -JsvServiceClient.onSuccess = function() { }; - -JsvServiceClient.parseResponseStatus_ = function(status) -{ - if (!status) return {isSuccess:true}; - - var result = - { - isSuccess: status.ErrorCode === undefined || status.ErrorCode === null, - errorCode: status.ErrorCode, - message: status.Message, - errorMessage: status.ErrorMessage, - stackTrace: status.StackTrace, - fieldErrors: [], - fieldErrorMap: {} - }; - - if (status.FieldErrors) - { - for (var i=0, len = status.FieldErrors.length; i"); - for (var k in obj) { - cols.push(k); - sb.push("" + k + ""); - } - sb.push(""); - } - sb.push(""); - for (var j = 0, colsLen = cols.length; j < colsLen; j++) { - var k = cols[j]; - var data = tableFormatFns[k] ? tableFormatFns[k](obj[k]) : Dto.formatValue(obj[k]); - - sb.push("" + data + ""); - } - sb.push(""); - } - sb.push(""); - return sb.join(''); -} - -//Object Utils -var O = {}; -O.keys = function(obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; -}; - -//Path Utils -var Path = {}; -Path.combine = function() { - var paths = ""; - for (var i = 0, len = arguments.length; i < len; i++) { - - if (paths.length > 0) - paths += "/"; - - paths += S.rtrim(arguments[i], '/'); - } - return paths; -}; -Path.getFirstArg = function(path) -{ - if (!path) return null; - return path.split('/')[0]; -}; -Path.getFirstValue = function(path) -{ - if (!path || path.indexOf('/') == -1) return null; - return path.substr(path.indexOf('/') + 1); -}; -Path.getArgs = function(path) -{ - if (!path) return null; - return path.split('/'); -}; - -var Urn = {}; -Urn.toId = function(urn) { - return urn.replace(/:/g, '_'); -}; -Urn.getIdValue = function(urn) { - return urn.split(':')[2]; -}; -Urn.fromId = function(urn) { - return urn.replace(/_/g, ':'); -}; - - -var Dto = {}; -Dto.toArray = function(array) { - return is.Array(array) - ? S.toString(array) - : "[" + S.toString(array) + "]"; -}; -Dto.toUtcDate = function(date) { - return date.getUTCFullYear() - + '-' + S.lpad(date.getUTCMonth() + 1, 2) - + '-' + S.lpad(date.getUTCDate(), 2) - + 'T' + S.lpad(date.getUTCHours(), 2) - + ':' + S.lpad(date.getUTCMinutes(), 2) - + ':' + S.lpad(date.getUTCSeconds(), 2) - + 'Z'; -}; -Dto.isJsonDate = function(str) -{ - if (!is.String(str)) return false; - return S.startsWith(str, Dto.WcfDatePrefix); -}; -Dto.WcfDatePrefix = "\/Date("; -Dto.toJsonDate = function(date) { - date = Dto.parseJsonDate(date); - return Dto.WcfDatePrefix + date.getTime() + "+0000)\/"; -}; -Dto.parseJsonDate = function(date) { - return is.Date(date) - ? date - : (S.startsWith(date, Dto.WcfDatePrefix) - ? new Date(parseInt(date.substring(Dto.WcfDatePrefix.length, date.length - 2))) - : new Date(date)); -}; -Dto.formatDate = function(date) { - //IE needs '/' seperators - date = Dto.parseJsonDate(date); - return date.getUTCFullYear() - + '/' + S.lpad(date.getUTCMonth() + 1, 2) - + '/' + S.lpad(date.getUTCDate(), 2); -}; -Dto.formatValue = function(value) -{ - if (Dto.isJsonDate(value)) return Dto.formatDate(value); - if (is.Empty(value)) return ""; - return S.startsWith(value, "{") - ? _.jsonreport(value) - : _.jsonreport.val(value); -}; - - -if (!_) var _ = {}; -_.jsonreport = (function () -{ - var root = this, doc = document, - $ = function (id) { return doc.getElementById(id); }, - $$ = function (sel) { return doc.getElementsByTagName(sel); }, - $each = function (fn) { for (var i = 0, len = this.length; i < len; i++) fn(i, this[i], this); }, - isIE = /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent); - - $.each = function (arr, fn) { $each.call(arr, fn); }; - - var splitCase = function (t) { return typeof t != 'string' ? t : t.replace(/([A-Z]|[0-9]+)/g, ' $1').replace(/_/g, ' '); }, - uniqueKeys = function (m) { var h = {}; for (var i = 0, len = m.length; i < len; i++) for (var k in m[i]) if (show(k)) h[k] = k; return h; }, - keys = function (o) { var a = []; for (var k in o) if (show(k)) a.push(k); return a; } - var tbls = []; - - function val(m) - { - if (m == null) return ''; - if (typeof m == 'number') return num(m); - if (typeof m == 'string') return str(m); - if (typeof m == 'boolean') return m ? 'true' : 'false'; - return m.length ? arr(m) : obj(m); - } - function num(m) { return m; } - function str(m) - { - return m.substr(0, 6) == '/Date(' ? dfmt(date(m)) : m; - } - function date(s) { return new Date(parseFloat(/Date\(([^)]+)\)/.exec(s)[1])); } - function pad(d) { return d < 10 ? '0' + d : d; } - function dfmt(d) { return d.getFullYear() + '/' + pad(d.getMonth() + 1) + '/' + pad(d.getDate()); } - function show(k) { return typeof k != 'string' || k.substr(0, 2) != '__'; } - function obj(m) - { - var sb = '
      '; - for (var k in m) if (show(k)) sb += '
      ' + splitCase(k) + '
      ' + val(m[k]) + '
      '; - sb += '
      '; - return sb; - } - function arr(m) - { - if (typeof m[0] == 'string' || typeof m[0] == 'number') return m.join(', '); - var id = tbls.length, h = uniqueKeys(m); - var sb = ''; - tbls.push(m); - var i = 0; - for (var k in h) sb += ''; - sb += '' + makeRows(h, m) + '
      ' + splitCase(k) + '
      '; - return sb; - } - - function makeRows(h, m) - { - var sb = ''; - for (var r = 0, len = m.length; r < len; r++) - { - sb += ''; - var row = m[r]; - for (var k in h) sb += '' + val(row[k]) + ''; - sb += ''; - } - return sb; - } - - function setTableBody(tbody, html) - { - if (!isIE) { tbody.innerHTML = html; return; } - var temp = tbody.ownerDocument.createElement('div'); - temp.innerHTML = '' + html + '
      '; - tbody.parentNode.replaceChild(temp.firstChild.firstChild, tbody); - } - - function clearSel() - { - if (doc.selection && doc.selection.empty) doc.selection.empty(); - else if (root.getSelection) - { - var sel = root.getSelection(); - if (sel && sel.removeAllRanges) sel.removeAllRanges(); - } - } - - function cmp(v1, v2) - { - var f1, f2, f1 = parseFloat(v1), f2 = parseFloat(v2); - if (!isNaN(f1) && !isNaN(f2)) v1 = f1, v2 = f2; - if (typeof v1 == 'string' && v1.substr(0, 6) == '/Date(') v1 = date(v1), v2 = date(v2); - if (v1 == v2) return 0; - return v1 > v2 ? 1 : -1; - } - - function enc(html) - { - if (typeof html != 'string') return html; - return html.replace(//g, '>').replace(/"/g, '"'); - } - - function addEvent(obj, type, fn) - { - if (obj.attachEvent) - { - obj['e' + type + fn] = fn; - obj[type + fn] = function () { obj['e' + type + fn](root.event); } - obj.attachEvent('on' + type, obj[type + fn]); - } else - obj.addEventListener(type, fn, false); - } - - addEvent(doc, 'click', function (e) - { - var e = e || root.event, el = e.target || e.srcElement, cls = el.className; - if (el.tagName == 'B') el = el.parentNode; - if (el.tagName != 'TH') return; - el.className = cls == 'asc' ? 'desc' : (cls == 'desc' ? null : 'asc'); - $.each($$('TH'), function (i, th) { if (th == el) return; th.className = null; }); - clearSel(); - var ids = el.id.split('-'), tId = ids[1], cId = ids[2]; - var tbl = tbls[tId].slice(0), h = uniqueKeys(tbl), col = keys(h)[cId], tbody = el.parentNode.parentNode.nextSibling; - if (!el.className) { setTableBody(tbody, makeRows(h, tbls[tId])); return; } - var d = el.className == 'asc' ? 1 : -1; - tbl.sort(function (a, b) { return cmp(a[col], b[col]) * d; }); - setTableBody(tbody, makeRows(h, tbl)); - }); - - var f = function (json) - { - var model = typeof json == 'string' ? JSON.parse(json) : json; - return val(model); - }; - f.val = val; - return f; -})(); - - -goog.exportSymbol("JsonServiceClient", JsonServiceClient); -goog.exportSymbol("is", is); -goog.exportSymbol("S", S); -goog.exportSymbol("A", A); -goog.exportSymbol("O", O); -goog.exportSymbol("Path", Path); -goog.exportSymbol("Urn", Urn); -goog.exportSymbol("Dto", Dto); -goog.exportSymbol("jsonreport", _.jsonreport); diff --git a/lib/js/JsonServiceClient.js b/lib/js/JsonServiceClient.js deleted file mode 100644 index 1d634361b7f..00000000000 --- a/lib/js/JsonServiceClient.js +++ /dev/null @@ -1,396 +0,0 @@ -/** @constructor */ - -function JsonServiceClient(baseUri) { - this.baseSyncReplyUri = Path.combine(baseUri, "json/reply"); - this.baseAsyncOneWayUri = Path.combine(baseUri, "json/oneway"); -} -JsonServiceClient.prototype.send = function(webMethod, request, onSuccess, onError, ajaxOptions) { - var startCallTime = new Date(); - var requestUrl = Path.combine(this.baseSyncReplyUri, webMethod); - var id = JsonServiceClient.id++; - - var options = { - type: "GET", - url: requestUrl, - data: request, - dataType: "json", - success: function(response) { - var endCallTime = new Date(); - var callDuration = endCallTime.getTime() - startCallTime.getTime(); - if (!response) { - if (onSuccess) onSuccess(null); - return; - } - - var status = JsonServiceClient.parseResponseStatus_(response.ResponseStatus); - if (status.isSuccess) { - if (onSuccess) onSuccess(response); - JsonServiceClient.onSuccess({ id: id, webMethod: webMethod, request: request, - response: response, durationMs: callDuration - }); - } - else { - if (onError) onError(status); - JsonServiceClient.onError({ id: id, webMethod: webMethod, request: request, - error: status, durationMs: callDuration - }); - } - }, - error: function(xhr, desc, exceptionobj) { - var endCallTime = new Date(); - var callDuration = endCallTime.getTime() - startCallTime.getTime(); - - try { - var response = xhr.responseText; - try { response = JsonServiceClient.parseJSON(response); } catch (e) { } - if (onError) onError(response); - } - catch (e) { } - JsonServiceClient.onError({ id: id, webMethod: webMethod, request: request, - error: xhr.responseText, durationMs: callDuration - }); - } - }; - - for (var k in ajaxOptions) options[k] = ajaxOptions[k]; - - var ajax = JsonServiceClient.ajax(options); -}; - -//Sends a HTTP 'GET' request on the QueryString -JsonServiceClient.prototype.getFromService = function(webMethod, request, onSuccess, onError) { - var options = document.all ? { cache: false} : null; - this.send(webMethod, request, onSuccess, onError, options); -}; - -//Sends a HTTP 'POST' request as key value pair formData -JsonServiceClient.prototype.postFormDataToService = function(webMethod, request, onSuccess, onError) { - this.send(webMethod, request, onSuccess, onError, { type: "POST" }); -}; - -//Sends a HTTP 'POST' request as JSON @requires jQuery -JsonServiceClient.prototype.postToService = function(webMethod, request, onSuccess, onError) { - var jsonRequest = JsonServiceClient.toJSON(request); - this.send(webMethod, jsonRequest, onSuccess, onError, { type: "POST", processData: false, contentType: "application/json; charset=utf-8" }); -}; - -//Sends a HTTP 'PUT' request as JSON @requires jQuery -JsonServiceClient.prototype.putToService = function(webMethod, request, onSuccess, onError) { - var jsonRequest = JsonServiceClient.toJSON(request); - this.send(webMethod, jsonRequest, onSuccess, onError, { type: "PUT", processData: false, contentType: "application/json; charset=utf-8" }); -}; - -//Sends a HTTP 'DELETE' request as JSON @requires jQuery -JsonServiceClient.prototype.deleteFromService = function(webMethod, request, onSuccess, onError) { - var jsonRequest = JsonServiceClient.toJSON(request); - this.send(webMethod, jsonRequest, onSuccess, onError, { type: "DELETE", processData: false, contentType: "application/json; charset=utf-8" }); -}; - -JsonServiceClient.id = 0; -JsonServiceClient.onError = function() { }; -JsonServiceClient.onSuccess = function() { }; -JsonServiceClient.parseResponseStatus_ = function(status) { - if (!status) return { isSuccess: true }; - - var result = - { - isSuccess: status.ErrorCode === undefined || status.ErrorCode === null, - errorCode: status.ErrorCode, - message: status.Message, - errorMessage: status.ErrorMessage, - stackTrace: status.StackTrace, - fieldErrors: [], - fieldErrorMap: {} - }; - - if (status.FieldErrors) { - for (var i = 0, len = status.FieldErrors.length; i < len; i++) { - var err = status.FieldErrors[i]; - var error = { errorCode: err.ErrorCode, fieldName: err.FieldName, errorMessage: err.ErrorMessage || '' }; - result.fieldErrors.push(error); - - if (error.fieldName) { - result.fieldErrorMap[error.fieldName] = error; - } - } - } - return result; -}; -JsonServiceClient.toJsonDate = function(date) { - var jsDate = is.Date(date) ? date : new Date(date); -} -//Adapter methods use jquery or google closure library if available -JsonServiceClient.parseJSON = function(json) { - if (typeof (JSON) == 'object' && JSON.parse) - return JSON.parse(json); - if ($ && $.parseJSON) - return $.parseJSON(json); - if (goog && goog.json) - return goog.json.parse(json); - throw "no json parser found"; -} -JsonServiceClient.toJSON = function(o) { - if (typeof(JSON) == 'object' && JSON.stringify) - return JSON.stringify(o); - if ($ && $.toJSON) - return $.toJSON(o); - if (goog && goog.json) - return goog.json.serialize(o); - throw "no json serializer found"; -} -JsonServiceClient.ajax = function(ajaxOptions) { - if ($ && $.ajax) - return $.ajax(ajaxOptions); - throw "no ajax provider found"; -} - -/* Dependent snippets below from AjaxStack. TODO: replace with utils in Google Closure Library */ -var is = { - Null: function(a) { - return a === null; - }, - Undefined: function(a) { - return a === undefined; - }, - Empty: function(a) { - return (a === null || a === undefined || a === ""); - }, - Function: function(a) { - return (typeof (a) === 'function') ? a.constructor.toString().match(/Function/) !== null : false; - }, - String: function(a) { - if (a === null || a === undefined || a.type) return false; - return (typeof (a) === 'string') ? true : (typeof (a) === 'object') ? a.constructor.toString().match(/string/i) !== null : false; - }, - Array: function(a) { - if (is.Empty(a) || a.type) return false; - return (typeof (a) === 'object') ? a.constructor.toString().match(/array/i) !== null || a.length !== undefined : false; - }, - Boolean: function(a) { - if (is.Empty(a) || a.type) return false; - return (typeof (a) === 'boolean') ? true : (typeof (a) === 'object') ? a.constructor.toString().match(/boolean/i) !== null : false; - }, - Date: function(a) { - if (is.Empty(a) || a.type) return false; - return (typeof (a) === 'date') ? true : (typeof (a) === 'object') ? a.constructor.toString().match(/date/i) !== null : false; - }, - Number: function(a) { - if (is.Empty(a) || a.type) return false; - return (typeof (a) === 'number') ? true : (typeof (a) === 'object') ? a.constructor.toString().match(/Number/) !== null : false; - }, - ValueType: function(a) { - if (is.Empty(a) || a.type) return false; - return is.String(a) || is.Date(a) || is.Number(a) || is.Boolean(a); - } -}; - -//String Utils -var S = {}; -S.rtrim = function(str, chars) { - chars = chars || "\\s"; - return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); -}; -S.toString = function() { - if (arguments.length == 0 || !arguments[0]) return null; - - var s = ""; - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - - if (s) s += "/"; - - if (is.String(arg)) s += arg; - else if (is.ValueType(arg)) s += arg.toString(); - else if (is.Array(arg)) s += '[' + A.join(arg, ",") + ']'; - else { - var o = ""; - for (var name in arg) { - if (o) o += ","; - o += name + ":" + S.safeString(arg[name]); - } - s += '{' + o + '}'; - } - } - return s; -}; -S.safeString = function(str) { - if (!str) return str; - if (S.containsAny(str, ['[', ']', '{', '}', ','])) { - return '"' + str + '"'; - } - return str; -}; -S.containsAny = function(str, tests) { - if (!is.String(str)) return; - for (var i = 0, len = tests.length; i < len; i++) { - if (str.indexOf(tests[i]) != -1) return true; - } - return false; -}; -S.startsWith = function(text, startsWith) { - if (!text || !startsWith) return false; - return text.lastIndexOf(startsWith, 0) == 0; -}; -S.pad = function(text, padLen, padChar, rpad) { - var padChar = padChar || (rpad ? " " : "0"); - text = text.toString(); - while (text.length < padLen) { - text = rpad - ? text + padChar - : padChar + text; - } - return text; -} -S.padLeft = function(text, padLen, padChar) { - return S.pad(text, padLen, padChar, false); -} -S.padRight = function(text, padLen, padChar) { - return S.pad(text, padLen, padChar, true); -} -S.lpad = S.padLeft; -S.rpad = S.padRight; - - -//Array Utils -var A = {}; -A.each = function(array, fn) { - if (!array) return; - for (var i = 0, len = array.length; i < len; i++) - fn(array[i]); -}; -A.convertAll = function(array, convertFn) { - var to = []; - for (var i = 0, len = array.length; i < len; i++) - to[i] = convertFn(array[i]); - return to; -}; -A.join = function(array, on) { - var s = ""; - on = on || ","; - for (var i = 0, len = array.length; i < len; i++) { - if (s) s += on; - s += array[i]; - } - return s; -}; -A.toTable = function(array, tableFormatFns) { - tableFormatFns = tableFormatFns || {}; - var cols = [], sb = []; - for (var i = 0, len = array.length; i < len; i++) { - var obj = array[i]; - if (!obj) continue; - if (i == 0) { - sb.push(""); - for (var k in obj) { - cols.push(k); - sb.push(""); - } - sb.push(""); - } - sb.push(""); - for (var j = 0, colsLen = cols.length; j < colsLen; j++) { - var k = cols[j]; - var data = tableFormatFns[k] ? tableFormatFns[k](obj[k]) : Dto.formatValue(obj[k]); - - sb.push(""); - } - sb.push(""); - } - sb.push("
      " + k + "
      " + data + "
      "); - return sb.join(''); -} - -//Object Utils -var O = {}; -O.keys = function(obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; -}; - -//Path Utils -var Path = {}; -Path.combine = function() { - var paths = ""; - for (var i = 0, len = arguments.length; i < len; i++) { - - if (paths.length > 0) - paths += "/"; - - paths += S.rtrim(arguments[i], '/'); - } - return paths; -}; -Path.getFirstArg = function(path) -{ - if (!path) return null; - return path.split('/')[0]; -}; -Path.getFirstValue = function(path) -{ - if (!path || path.indexOf('/') == -1) return null; - return path.substr(path.indexOf('/') + 1); -}; -Path.getArgs = function(path) -{ - if (!path) return null; - return path.split('/'); -}; - -var Urn = {}; -Urn.toId = function(urn) { - return urn.replace(/:/g, '_'); -}; -Urn.getIdValue = function(urn) { - return urn.split(':')[2]; -}; -Urn.fromId = function(urn) { - return urn.replace(/_/g, ':'); -}; - - -var Dto = {}; -Dto.toArray = function(array) { - return is.Array(array) - ? S.toString(array) - : "[" + S.toString(array) + "]"; -}; -Dto.toUtcDate = function(date) { - return date.getUTCFullYear() - + '-' + S.lpad(date.getUTCMonth() + 1, 2) - + '-' + S.lpad(date.getUTCDate(), 2) - + 'T' + S.lpad(date.getUTCHours(), 2) - + ':' + S.lpad(date.getUTCMinutes(), 2) - + ':' + S.lpad(date.getUTCSeconds(), 2) - + 'Z'; -}; -Dto.isJsonDate = function(str) -{ - if (!is.String(str)) return false; - return S.startsWith(str, Dto.WcfDatePrefix); -}; -Dto.WcfDatePrefix = "\/Date("; -Dto.toJsonDate = function(date) { - date = Dto.parseJsonDate(date); - return Dto.WcfDatePrefix + date.getTime() + "+0000)\/"; -}; -Dto.parseJsonDate = function(date) { - return is.Date(date) - ? date - : (S.startsWith(date, Dto.WcfDatePrefix) - ? new Date(parseInt(date.substring(Dto.WcfDatePrefix.length, date.length - 2))) - : new Date(date)); -}; -Dto.formatDate = function(date) { - //IE needs '/' seperators - date = Dto.parseJsonDate(date); - return date.getUTCFullYear() - + '/' + S.lpad(date.getUTCMonth() + 1, 2) - + '/' + S.lpad(date.getUTCDate(), 2); -}; -Dto.formatValue = function(value) -{ - if (Dto.isJsonDate(value)) return Dto.formatDate(value); - if (is.Empty(value)) return ""; - return value; -}; diff --git a/lib/js/test-jsv.html b/lib/js/test-jsv.html deleted file mode 100644 index b72b2734251..00000000000 --- a/lib/js/test-jsv.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - -

      Serialize JSON to JSV

      - - - -

      Output:

      - -
      - -
      - -

      Error:

      -
      - - - - - - \ No newline at end of file diff --git a/lib/net40/System.Web.Razor.Unofficial.dll b/lib/net40/System.Web.Razor.Unofficial.dll deleted file mode 100644 index 2a523e9e4a2..00000000000 Binary files a/lib/net40/System.Web.Razor.Unofficial.dll and /dev/null differ diff --git a/lib/net45/ServiceStack.OrmLite.SqlServer.dll b/lib/net45/ServiceStack.OrmLite.SqlServer.dll deleted file mode 100644 index b52f82f4211..00000000000 Binary files a/lib/net45/ServiceStack.OrmLite.SqlServer.dll and /dev/null differ diff --git a/lib/net45/ServiceStack.OrmLite.dll b/lib/net45/ServiceStack.OrmLite.dll deleted file mode 100644 index 36349d401cd..00000000000 Binary files a/lib/net45/ServiceStack.OrmLite.dll and /dev/null differ diff --git a/lib/net45/signed/ServiceStack.OrmLite.SqlServer.dll b/lib/net45/signed/ServiceStack.OrmLite.SqlServer.dll deleted file mode 100644 index a3202e4faac..00000000000 Binary files a/lib/net45/signed/ServiceStack.OrmLite.SqlServer.dll and /dev/null differ diff --git a/lib/net45/signed/ServiceStack.OrmLite.dll b/lib/net45/signed/ServiceStack.OrmLite.dll deleted file mode 100644 index ec01a4ba292..00000000000 Binary files a/lib/net45/signed/ServiceStack.OrmLite.dll and /dev/null differ diff --git a/lib/pcl/ServiceStack.Client.Pcl.dll.mdb b/lib/pcl/ServiceStack.Client.Pcl.dll.mdb deleted file mode 100644 index c1cf30b36b1..00000000000 Binary files a/lib/pcl/ServiceStack.Client.Pcl.dll.mdb and /dev/null differ diff --git a/lib/pcl/ServiceStack.Client.dll b/lib/pcl/ServiceStack.Client.dll deleted file mode 100644 index e20446a2cb0..00000000000 Binary files a/lib/pcl/ServiceStack.Client.dll and /dev/null differ diff --git a/lib/pcl/ServiceStack.Client.dll.mdb b/lib/pcl/ServiceStack.Client.dll.mdb deleted file mode 100644 index 1c9b815f71c..00000000000 Binary files a/lib/pcl/ServiceStack.Client.dll.mdb and /dev/null differ diff --git a/lib/pcl/ServiceStack.Interfaces.dll b/lib/pcl/ServiceStack.Interfaces.dll deleted file mode 100644 index 4c3be0c2551..00000000000 Binary files a/lib/pcl/ServiceStack.Interfaces.dll and /dev/null differ diff --git a/lib/pcl/ServiceStack.Interfaces.dll.mdb b/lib/pcl/ServiceStack.Interfaces.dll.mdb deleted file mode 100644 index b835f607d72..00000000000 Binary files a/lib/pcl/ServiceStack.Interfaces.dll.mdb and /dev/null differ diff --git a/lib/pcl/ServiceStack.Pcl.Android.dll b/lib/pcl/ServiceStack.Pcl.Android.dll deleted file mode 100644 index 629c5cf407d..00000000000 Binary files a/lib/pcl/ServiceStack.Pcl.Android.dll and /dev/null differ diff --git a/lib/pcl/ServiceStack.Pcl.Android.dll.mdb b/lib/pcl/ServiceStack.Pcl.Android.dll.mdb deleted file mode 100644 index 13f6c377a0d..00000000000 Binary files a/lib/pcl/ServiceStack.Pcl.Android.dll.mdb and /dev/null differ diff --git a/lib/pcl/ServiceStack.Pcl.Net45.dll b/lib/pcl/ServiceStack.Pcl.Net45.dll deleted file mode 100644 index 1846502b11a..00000000000 Binary files a/lib/pcl/ServiceStack.Pcl.Net45.dll and /dev/null differ diff --git a/lib/pcl/ServiceStack.Pcl.WinStore.dll b/lib/pcl/ServiceStack.Pcl.WinStore.dll deleted file mode 100644 index 63b3beb902c..00000000000 Binary files a/lib/pcl/ServiceStack.Pcl.WinStore.dll and /dev/null differ diff --git a/lib/pcl/ServiceStack.Pcl.WinStore.pri b/lib/pcl/ServiceStack.Pcl.WinStore.pri deleted file mode 100644 index a3071fe88d3..00000000000 Binary files a/lib/pcl/ServiceStack.Pcl.WinStore.pri and /dev/null differ diff --git a/lib/pcl/ServiceStack.Pcl.iOS.dll b/lib/pcl/ServiceStack.Pcl.iOS.dll deleted file mode 100644 index e149d03d01c..00000000000 Binary files a/lib/pcl/ServiceStack.Pcl.iOS.dll and /dev/null differ diff --git a/lib/pcl/ServiceStack.Text.dll b/lib/pcl/ServiceStack.Text.dll deleted file mode 100644 index e43f663138e..00000000000 Binary files a/lib/pcl/ServiceStack.Text.dll and /dev/null differ diff --git a/lib/pcl/ServiceStack.Text.dll.mdb b/lib/pcl/ServiceStack.Text.dll.mdb deleted file mode 100644 index da9615e3ed6..00000000000 Binary files a/lib/pcl/ServiceStack.Text.dll.mdb and /dev/null differ diff --git a/lib/signed/ServiceStack.Client.dll b/lib/signed/ServiceStack.Client.dll deleted file mode 100644 index 01adcc2336a..00000000000 Binary files a/lib/signed/ServiceStack.Client.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.Common.dll b/lib/signed/ServiceStack.Common.dll deleted file mode 100644 index 4dfde049d64..00000000000 Binary files a/lib/signed/ServiceStack.Common.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.Common.xml b/lib/signed/ServiceStack.Common.xml deleted file mode 100644 index 109d91cfff2..00000000000 --- a/lib/signed/ServiceStack.Common.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - ServiceStack.Common - - - - - Useful .NET Encryption Utils from: - http://andrewlocatelliwoodcock.com/2011/08/01/implementing-rsa-asymmetric-public-private-key-encryption-in-c-encrypting-under-the-public-key/ - - - - - Encrypt an arbitrary string of data under the supplied public key - - The public key to encrypt under - The data to encrypt - The bit length or strength of the public key: 1024, 2048 or 4096 bits. This must match the - value actually used to create the publicKey - - - - - Create Public and Private Key Pair based on settings already in static class. - - RsaKeyPair - - - - Gets the textual description of the enum if it has one. e.g. - - - enum UserColors - { - [Description("Bright Red")] - BrightRed - } - UserColors.BrightRed.ToDescription(); - - - - - - - - Creates a Console Logger, that logs all messages to: System.Console - - Made public so its testable - - - - - Default logger is to Console.WriteLine - - Made public so its testable - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - - - Logs the specified message. - - - - - Logs the format. - - - - - Logs the specified message. - - - - - Useful IPAddressExtensions from: - http://blogs.msdn.com/knom/archive/2008/12/31/ip-address-calculations-with-c-subnetmasks-networks.aspx - - - - - - Gets the ipv4 addresses from all Network Interfaces that have Subnet masks. - - - - - - Gets the ipv6 addresses from all Network Interfaces. - - - - - - Func to get the Strongly-typed field - - - - - Required to cast the return ValueType to an object for caching - - - - - Func to set the Strongly-typed field - - - - - Required to cast the ValueType to an object for caching - - - - - Required to cast the ValueType to an object for caching - - - - - Func to get the Strongly-typed field - - - - - Required to cast the return ValueType to an object for caching - - - - - Func to set the Strongly-typed field - - - - - Required to cast the ValueType to an object for caching - - - - - Required to cast the ValueType to an object for caching - - - - - Common functionality when creating adapters - - - - - Executes the specified expression. - - - The action. - - - - - Executes the specified action (for void methods). - - The action. - - - - Note: InMemoryLog keeps all logs in memory, so don't use it long running exceptions - - Returns a thread-safe InMemoryLog which you can use while *TESTING* - to provide a detailed analysis of your logs. - - - - - Creates a Unified Resource Name (URN) with the following formats: - - - urn:{TypeName}:{IdFieldValue} e.g. urn:UserSession:1 - - urn:{TypeName}:{IdFieldName}:{IdFieldValue} e.g. urn:UserSession:UserId:1 - - - - - - - Provide the an option for the callee to block until all commands are executed - - - - - - - Invokes the action provided and returns true if no excpetion was thrown. - Otherwise logs the exception and returns false if an exception was thrown. - - The action. - - - - diff --git a/lib/signed/ServiceStack.Interfaces.XML b/lib/signed/ServiceStack.Interfaces.XML deleted file mode 100644 index c7b048124fb..00000000000 --- a/lib/signed/ServiceStack.Interfaces.XML +++ /dev/null @@ -1,1696 +0,0 @@ - - - - ServiceStack.Interfaces - - - - - Required when using a TypeDescriptor to make it unique - - - - - A common interface implementation that is implemented by most cache providers - - - - - Removes the specified item from the cache. - - The identifier for the item to delete. - - true if the item was successfully removed from the cache; false otherwise. - - - - - Removes the cache for all the keys provided. - - The keys. - - - - Retrieves the specified item from the cache. - - - The identifier for the item to retrieve. - - The retrieved item, or null if the key was not found. - - - - - Increments the value of the specified key by the given amount. - The operation is atomic and happens on the server. - A non existent value at key starts at 0 - - The identifier for the item to increment. - The amount by which the client wants to increase the item. - - The new value of the item or -1 if not found. - - The item must be inserted into the cache before it can be changed. The item must be inserted as a . The operation only works with values, so -1 always indicates that the item was not found. - - - - Increments the value of the specified key by the given amount. - The operation is atomic and happens on the server. - A non existent value at key starts at 0 - - The identifier for the item to increment. - The amount by which the client wants to decrease the item. - - The new value of the item or -1 if not found. - - The item must be inserted into the cache before it can be changed. The item must be inserted as a . The operation only works with values, so -1 always indicates that the item was not found. - - - - Adds a new item into the cache at the specified cache key only if the cache is empty. - - The key used to reference the item. - The object to be inserted into the cache. - - true if the item was successfully stored in the cache; false otherwise. - - The item does not expire unless it is removed due memory pressure. - - - - Sets an item into the cache at the cache key specified regardless if it already exists or not. - - - - - Replaces the item at the cachekey specified only if an items exists at the location already. - - - - - Invalidates all data on the cache. - - - - - Retrieves multiple items from the cache. - The default value of T is set for all keys that do not exist. - - The list of identifiers for the items to retrieve. - - a Dictionary holding all items indexed by their key. - - - - - Sets multiple items to the cache. - - - The values. - - - - Removes items from cache that have keys matching the specified wildcard pattern - - The wildcard, where "*" means any sequence of characters and "?" means any single character. - - - - Removes items from the cache based on the specified regular expression pattern - - Regular expression pattern to search cache keys - - - - A light interface over a cache client. - This interface was inspired by Enyim.Caching.MemcachedClient - - Only the methods that are intended to be used are required, if you require - extra functionality you can uncomment the unused methods below as they have been - implemented in DdnMemcachedClient - - - - - Removes the specified item from the cache. - - The identifier for the item to delete. - - true if the item was successfully removed from the cache; false otherwise. - - - - - Removes the cache for all the keys provided. - - The keys. - - - - Retrieves the specified item from the cache. - - The identifier for the item to retrieve. - - The retrieved item, or null if the key was not found. - - - - - Increments the value of the specified key by the given amount. The operation is atomic and happens on the server. - - The identifier for the item to increment. - The amount by which the client wants to increase the item. - - The new value of the item or -1 if not found. - - The item must be inserted into the cache before it can be changed. The item must be inserted as a . The operation only works with values, so -1 always indicates that the item was not found. - - - - Increments the value of the specified key by the given amount. The operation is atomic and happens on the server. - - The identifier for the item to increment. - The amount by which the client wants to decrease the item. - - The new value of the item or -1 if not found. - - The item must be inserted into the cache before it can be changed. The item must be inserted as a . The operation only works with values, so -1 always indicates that the item was not found. - - - - Inserts an item into the cache with a cache key to reference its location. - - The key used to reference the item. - The object to be inserted into the cache. - - true if the item was successfully stored in the cache; false otherwise. - - The item does not expire unless it is removed due memory pressure. - - - - Inserts an item into the cache with a cache key to reference its location. - - The key used to reference the item. - The object to be inserted into the cache. - The time when the item is invalidated in the cache. - true if the item was successfully stored in the cache; false otherwise. - - - - Removes all data from the cache. - - - - - Retrieves multiple items from the cache. - - The list of identifiers for the items to retrieve. - - a Dictionary holding all items indexed by their key. - - - - - A Users Session - - - - - Set a typed value at key - - - - - - - - Get a typed value at key - - - - - - - - Store any object at key - - - - - - - Retrieves a User Session - - - - - Gets the session for this request, creates one if it doesn't exist. - - - - - - - - Gets the session for this request, creates one if it doesn't exist. - Only for ASP.NET apps. Uses the HttpContext.Current singleton. - - - - - Allow delegation of dependencies to other IOC's - - - - - Resolve Property Dependency - - - - - - - Resolve Constructor Dependency - - - - - - - BelongToAttribute - Use to indicate that a join column belongs to another table. - - - - - Compute attribute. - Use to indicate that a property is a Calculated Field - - - - - Decimal length attribute. - - - - - Explicit foreign key name. If it's null, or empty, the FK name will be autogenerated as before. - - - - - IgnoreAttribute - Use to indicate that a property is not a field in the table - properties with this attribute are ignored when building sql sentences - - - - - Primary key attribute. - use to indicate that property is part of the pk - - - - - Used to annotate an Entity with its DB schema - - - - - - For providers that want a cleaner API with a little more perf - - - - - - Decorate any type or property with adhoc info - - - - - Creates a Debug Logger, that logs all messages to: System.Diagnostics.Debug - - Made public so its testable - - - - - Factory to create ILog instances - - - - - Gets the logger. - - - - - Gets the logger. - - - - - Default logger is to System.Diagnostics.Debug.WriteLine - - Made public so its testable - - - - - Logs a message in a running application - - - - - Logs a Debug message. - - The message. - - - - Logs a Debug message and exception. - - The message. - The exception. - - - - Logs a Debug format message. - - The format. - The args. - - - - Logs a Error message. - - The message. - - - - Logs a Error message and exception. - - The message. - The exception. - - - - Logs a Error format message. - - The format. - The args. - - - - Logs a Fatal message. - - The message. - - - - Logs a Fatal message and exception. - - The message. - The exception. - - - - Logs a Error format message. - - The format. - The args. - - - - Logs an Info message and exception. - - The message. - - - - Logs an Info message and exception. - - The message. - The exception. - - - - Logs an Info format message. - - The format. - The args. - - - - Logs a Warning message. - - The message. - - - - Logs a Warning message and exception. - - The message. - The exception. - - - - Logs a Warning format message. - - The format. - The args. - - - - Gets or sets a value indicating whether this instance is debug enabled. - - - true if this instance is debug enabled; otherwise, false. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - - - Logs the specified message. - - - - - Logs the format. - - - - - Logs the specified message. - - - - - Default logger is to System.Diagnostics.Debug.Print - - Made public so its testable - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - - - Logs the specified message. - - - - - Logs the format. - - - - - Logs the specified message. - - - - - Creates a Debug Logger, that logs all messages to: System.Diagnostics.Debug - - Made public so its testable - - - - - StringBuilderLog writes to shared StringBuffer. - Made public so its testable - - - - - Logs the specified message. - - - - - Logs the format. - - - - - Logs the specified message. - - The message. - - - - Creates a test Logger, that stores all log messages in a member list - - - - - Tests logger which stores all log messages in a member list which can be examined later - - Made public so its testable - - - - - Initializes a new instance of the class. - - The type. - - - - Initializes a new instance of the class. - - The type. - - - - Logs the specified message. - - The message. - The exception. - - - - Logs the format. - - The message. - The args. - - - - Logs the specified message. - - The message. - - - - Logging API for this library. You can inject your own implementation otherwise - will use the DebugLogFactory to write to System.Diagnostics.Debug - - - - - Gets the logger. - - - - - Gets the logger. - - - - - Gets or sets the log factory. - Use this to override the factory that is used to create loggers - - - - - Publish the specified message into the durable queue @queueName - - - - - - - Publish the specified message into the transient queue @queueName - - - - - - - Synchronous blocking get. - - - - - - - - Non blocking get message - - - - - - - Blocking wait for notifications on any of the supplied channels - - - - - - - Simple definition of an MQ Host - - - - - Register DTOs and hanlders the MQ Host will process - - - - - - - Register DTOs and hanlders the MQ Host will process - - - - - - - - Get Total Current Stats for all Message Handlers - - - - - - Get the status of the service. Potential Statuses: Disposed, Stopped, Stopping, Starting, Started - - - - - - Get a Stats dump - - - - - - Start the MQ Host if not already started. - - - - - Stop the MQ Host if not already stopped. - - - - - Factory to create consumers and producers that work with this service - - - - - Get a list of all message types registered on this MQ Host - - - - - An Error Message Type that can be easily serialized - - - - - Basic implementation of IMessage[T] - - - - - - Base Exception for all ServiceStack.Messaging exceptions - - - - - Util static generic class to create unique queue names for types - - - - - - Util class to create unique queue names for runtime types - - - - - For messaging exceptions that should by-pass the messaging service's configured - retry attempts and store the message straight into the DLQ - - - - - Wrap the common redis list operations under a IList[string] interface. - - - - - Redis transaction for typed client - - - - - - interface to queueable operation using typed redis client - - - - - - Interface to redis typed pipeline - - - - - Pipeline interface shared by typed and non-typed pipelines - - - - - Interface to operations that allow queued commands to be completed - - - - - Returns a high-level typed client API - - - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. - - - - - - Returns a Read/Write ICacheClient (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly ICacheClient using the hosts defined in ReadOnlyHosts. - - - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. - - - - - - Returns a Read/Write ICacheClient (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly ICacheClient using the hosts defined in ReadOnlyHosts. - - - - - - Subscribe to channels by name - - - - - - Subscribe to channels matching the supplied patterns - - - - - - The number of active subscriptions this client has - - - - - Registered handler called after client *Subscribes* to each new channel - - - - - Registered handler called when each message is received - - - - - Registered handler called when each channel is unsubscribed - - - - - Interface to redis transaction - - - - - Base transaction interface, shared by typed and non-typed transactions - - - - - interface to operation that can queue commands - - - - - Interface to redis pipeline - - - - - Gets or sets parameter name with which allowable values will be associated. - - - - - The overall description of an API. Used by Swagger. - - - - - Gets or sets verb to which applies attribute. By default applies to all verbs. - - - - - Gets or sets parameter type: It can be only one of the following: path, query, body, or header. - - - - - Gets or sets unique name for the parameter. Each name must be unique, even if they are associated with different paramType values. - - - - Other notes on the name field: - If paramType is body, the name is used only for UI and codegeneration. - If paramType is path, the name field must correspond to the associated path segment from the path field in the api object. - If paramType is query, the name field corresponds to the query param name. - - - - - - Gets or sets the human-readable description for the parameter. - - - - - For path, query, and header paramTypes, this field must be a primitive. For body, this can be a complex or container datatype. - - - - - For path, this is always true. Otherwise, this field tells the client whether or not the field must be supplied. - - - - - For query params, this specifies that a comma-separated list of values can be passed to the API. For path and body types, this field cannot be true. - - - - - The status code of a response - - - - - The description of a response status code - - - - - Marker interfaces - - - - - Implement on Request DTOs that need access to the raw Request Stream - - - - - The raw Http Request Input Stream - - - - - Resolve a dependency from the AppHost's IOC - - - - - - - This interface can be implemented by an attribute - which adds an request filter for the specific request DTO the attribute marked. - - - - - The request filter is executed before the service. - - The http request wrapper - The http response wrapper - The request DTO - - - - A new shallow copy of this filter is used on every request. - - - - - - Order in which Request Filters are executed. - <0 Executed before global request filters - >0 Executed after global request filters - - - - - This interface can be implemented by an attribute - which adds an response filter for the specific response DTO the attribute marked. - - - - - The response filter is executed after the service - - The http request wrapper - The http response wrapper - - - - A new shallow copy of this filter is used on every request. - - - - - - Order in which Response Filters are executed. - <0 Executed before global response filters - >0 Executed after global response filters - - - - - The HTTP Response Status - - - - - The HTTP Response Status Code - - - - - The HTTP Status Description - - - - - The HTTP Response ContentType - - - - - Additional HTTP Headers - - - - - Response DTO - - - - - if not provided, get's injected by ServiceStack - - - - - Holds the request call context - - - - - A thin wrapper around ASP.NET or HttpListener's HttpRequest - - - - - A thin wrapper around each host's Request e.g: ASP.NET, HttpListener, MQ, etc - - - - - The entire string contents of Request.InputStream - - - - - - The underlying ASP.NET or HttpListener HttpRequest - - - - - The name of the service being called (e.g. Request DTO Name) - - - - - The Verb / HttpMethod or Action for this request - - - - - Optional preferences for the processing of this Request - - - - - The Request DTO, after it has been deserialized. - - - - - The request ContentType - - - - - The expected Response ContentType for this request - - - - - Whether the ResponseContentType has been explicitly overrided or whether it was just the default - - - - - Attach any data to this request that all filters and services can access. - - - - - Buffer the Request InputStream so it can be re-read - - - - - The Remote Ip as reported by Request.UserHostAddress - - - - - The Remote Ip as reported by X-Forwarded-For, X-Real-IP or Request.UserHostAddress - - - - - e.g. is https or not - - - - - Access to the multi-part/formdata files posted on this request - - - - - The value of the Referrer, null if not available - - - - - The HttpResponse - - - - - The HTTP Verb - - - - - The IP Address of the X-Forwarded-For header, null if null or empty - - - - - The Port number of the X-Forwarded-Port header, null if null or empty - - - - - The http or https scheme of the X-Forwarded-Proto header, null if null or empty - - - - - The value of the X-Real-IP header, null if null or empty - - - - - A thin wrapper around ASP.NET or HttpListener's HttpResponse - - - - - A thin wrapper around each host's Response e.g: ASP.NET, HttpListener, MQ, etc - - - - - Signal that this response has been handled and no more processing should be done. - When used in a request or response filter, no more filters or processing is done on this request. - - - - - Calls Response.End() on ASP.NET HttpResponse otherwise is an alias for Close(). - Useful when you want to prevent ASP.NET to provide it's own custom error page. - - - - - Response.Flush() and OutputStream.Flush() seem to have different behaviour in ASP.NET - - - - - The underlying ASP.NET or HttpListener HttpResponse - - - - - The Response DTO - - - - - Gets a value indicating whether this instance is closed. - - - - - Log every service request - - - - - Log a request - - The RequestContext - Request DTO - Response DTO or Exception - How long did the Request take - - - - View the most recent logs - - - - - - - Turn On/Off Session Tracking - - - - - Turn On/Off Raw Request Body Tracking - - - - - Turn On/Off Tracking of Responses - - - - - Turn On/Off Tracking of Exceptions - - - - - Limit access to /requestlogs service to role - - - - - Don't log requests of these types. - - - - - Don't log request bodys for services with sensitive information. - By default Auth and Registration requests are hidden. - - - - - Implement on services that need access to the RequestContext - - - - - Responsible for executing the operation within the specified context. - - The operation types. - - - - Returns the first matching RestPath - - - - - Executes the MQ DTO request. - - - - - Executes the MQ DTO request with the supplied requestContext - - - - - Executes the DTO request under the supplied requestContext. - - - - - Executes the DTO request with an empty RequestContext. - - - - - Allow the registration of user-defined routes for services - - - - - Maps the specified REST path to the specified request DTO. - - The type of request DTO to map - the path to. - The path to map the request DTO to. - See RouteAttribute.Path - for details on the correct format. - The same instance; - never . - - - - Maps the specified REST path to the specified request DTO, and - specifies the HTTP verbs supported by the path. - - The type of request DTO to map - the path to. - The path to map the request DTO to. - See RouteAttribute.Path - for details on the correct format. - - The comma-delimited list of HTTP verbs supported by the path, - such as "GET,PUT,DELETE". Specify empty or - to indicate that all verbs are supported. - - The same instance; - never . - - - - Maps the specified REST path to the specified request DTO, - specifies the HTTP verbs supported by the path, and indicates - the default MIME type of the returned response. - - - The type of request DTO to map the path to. - - The path to map the request DTO to. - See RouteAttribute.Path - for details on the correct format. - - The comma-delimited list of HTTP verbs supported by the path, - such as "GET,PUT,DELETE". - - The same instance; - never . - - - - Maps the specified REST path to the specified request DTO, - specifies the HTTP verbs supported by the path, and indicates - the default MIME type of the returned response. - - - Used to rank the precedences of route definitions in reverse routing. - i.e. Priorities below 0 are auto-generated have less precedence. - - - - - Maps the specified REST path to the specified request DTO, - specifies the HTTP verbs supported by the path, and indicates - the default MIME type of the returned response. - - - The type of request DTO to map the path to. - - The path to map the request DTO to. - See RouteAttribute.Path - for details on the correct format. - - The comma-delimited list of HTTP verbs supported by the path, - such as "GET,PUT,DELETE". - - - The short summary of what the REST does. - - - The longer text to explain the behaviour of the REST. - - The same instance; - never . - - - - Used to decorate Request DTO's to associate a RESTful request - path mapping with a service. Multiple attributes can be applied to - each request DTO, to map multiple paths to the service. - - - - - Initializes an instance of the class. - - - The path template to map to the request. See - RouteAttribute.Path - for details on the correct format. - - - - - Initializes an instance of the class. - - - The path template to map to the request. See - RouteAttribute.Path - for details on the correct format. - - A comma-delimited list of HTTP verbs supported by the - service. If unspecified, all verbs are assumed to be supported. - - - - Gets or sets the path template to be mapped to the request. - - - A value providing the path mapped to - the request. Never . - - - Some examples of valid paths are: - - - "/Inventory" - "/Inventory/{Category}/{ItemId}" - "/Inventory/{ItemPath*}" - - - Variables are specified within "{}" - brackets. Each variable in the path is mapped to the same-named property - on the request DTO. At runtime, ServiceStack will parse the - request URL, extract the variable values, instantiate the request DTO, - and assign the variable values into the corresponding request properties, - prior to passing the request DTO to the service object for processing. - - It is not necessary to specify all request properties as - variables in the path. For unspecified properties, callers may provide - values in the query string. For example: the URL - "http://services/Inventory?Category=Books&ItemId=12345" causes the same - request DTO to be processed as "http://services/Inventory/Books/12345", - provided that the paths "/Inventory" (which supports the first URL) and - "/Inventory/{Category}/{ItemId}" (which supports the second URL) - are both mapped to the request DTO. - - Please note that while it is possible to specify property values - in the query string, it is generally considered to be less RESTful and - less desirable than to specify them as variables in the path. Using the - query string to specify property values may also interfere with HTTP - caching. - - The final variable in the path may contain a "*" suffix - to grab all remaining segments in the path portion of the request URL and assign - them to a single property on the request DTO. - For example, if the path "/Inventory/{ItemPath*}" is mapped to the request DTO, - then the request URL "http://services/Inventory/Books/12345" will result - in a request DTO whose ItemPath property contains "Books/12345". - You may only specify one such variable in the path, and it must be positioned at - the end of the path. - - - - - Gets or sets short summary of what the route does. - - - - - Gets or sets longer text to explain the behaviour of the route. - - - - - Gets or sets a comma-delimited list of HTTP verbs supported by the service, such as - "GET,PUT,POST,DELETE". - - - A providing a comma-delimited list of HTTP verbs supported - by the service, or empty if all verbs are supported. - - - - - Used to rank the precedences of route definitions in reverse routing. - i.e. Priorities below 0 are auto-generated have less precedence. - - - - - Fallback routes have the lowest precedence, i.e. after normal Routes, static files or any matching Catch All Handlers. - - - - - Generic ResponseStatus for when Response Type can't be inferred. - In schemaless formats like JSON, JSV it has the same shape as a typed Response DTO - - - - - Contract indication that the Response DTO has a ResponseStatus - - - - - A log entry added by the IRequestLogger - - - - - Decorate on Request DTO's to alter the accessibility of a service and its visibility on /metadata pages - - - - - Restrict access and metadata visibility to any of the specified access scenarios - - The restrict access to scenarios. - - - - Restrict access and metadata visibility to any of the specified access scenarios - - The restrict access to scenarios. - - - - Returns the allowed set of scenarios based on the user-specified restrictions - - - - - - - Allow access but hide from metadata to requests from Localhost only - - - - - Allow access but hide from metadata to requests from Localhost and Local Intranet only - - - - - Restrict access and hide from metadata to requests from Localhost and Local Intranet only - - - - - Restrict access and hide from metadata to requests from Localhost only - - - - - Sets a single access restriction - - Restrict Access to. - - - - Restrict access to any of the specified access scenarios - - Access restrictions - - - - Sets a single metadata Visibility restriction - - Restrict metadata Visibility to. - - - - Restrict metadata visibility to any of the specified access scenarios - - Visibility restrictions - - - - Converts from a User intended restriction to a flag with all the allowed attribute flags set, e.g: - - If No Network restrictions were specified all Network access types are allowed, e.g: - restrict EndpointAttributes.None => ... 111 - - If a Network restriction was specified, only it will be allowed, e.g: - restrict EndpointAttributes.LocalSubnet => ... 010 - - The returned Enum will have a flag with all the allowed attributes set - - - - - - - Error information pertaining to a particular named field. - Used for returning multiple field validation errors.s - - - - - Common ResponseStatus class that should be present on all response DTO's - - - - - Initializes a new instance of the class. - - A response status without an errorcode == success - - - - - Initializes a new instance of the class. - - A response status with an errorcode == failure - - - - - Initializes a new instance of the class. - - A response status with an errorcode == failure - - - - - Holds the custom ErrorCode enum if provided in ValidationException - otherwise will hold the name of the Exception type, e.g. typeof(Exception).Name - - A value of non-null means the service encountered an error while processing the request. - - - - - A human friendly error message - - - - - - - - - - For multiple detailed validation errors. - Can hold a specific error message for each named field. - - - - - Write a partial content result - - - - - Whether this HttpResult allows Partial Response - - - - - Sends the specified request. - - The request. - - - - diff --git a/lib/signed/ServiceStack.Interfaces.dll b/lib/signed/ServiceStack.Interfaces.dll deleted file mode 100644 index 3fb50307e67..00000000000 Binary files a/lib/signed/ServiceStack.Interfaces.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.OrmLite.SqlServer.dll b/lib/signed/ServiceStack.OrmLite.SqlServer.dll deleted file mode 100644 index aa510535305..00000000000 Binary files a/lib/signed/ServiceStack.OrmLite.SqlServer.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.OrmLite.dll b/lib/signed/ServiceStack.OrmLite.dll deleted file mode 100644 index 5fbedd1905a..00000000000 Binary files a/lib/signed/ServiceStack.OrmLite.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.Razor.dll b/lib/signed/ServiceStack.Razor.dll deleted file mode 100644 index 1e6079c4825..00000000000 Binary files a/lib/signed/ServiceStack.Razor.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.Redis.XML b/lib/signed/ServiceStack.Redis.XML deleted file mode 100644 index 1b460938ad0..00000000000 --- a/lib/signed/ServiceStack.Redis.XML +++ /dev/null @@ -1,1382 +0,0 @@ - - - - ServiceStack.Redis - - - - - Provides thread-safe retrievel of redis clients since each client is a new one. - Allows the configuration of different ReadWrite and ReadOnly hosts - - - BasicRedisClientManager for ICacheClient - - For more interoperabilty I'm also implementing the ICacheClient on - this cache client manager which has the affect of calling - GetCacheClient() for all write operations and GetReadOnlyCacheClient() - for the read ones. - - This works well for master-slave replication scenarios where you have - 1 master that replicates to multiple read slaves. - - - - - Hosts can be an IP Address or Hostname in the format: host[:port] - e.g. 127.0.0.1:6379 - default is: localhost:6379 - - The write hosts. - The read hosts. - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. - - - - - - Gets or sets object key prefix. - - - - - Courtesy of @marcgravell - http://code.google.com/p/protobuf-net/source/browse/trunk/protobuf-net/BufferPool.cs - - - - - Provides thread-safe pooling of redis client connections. - - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Called within a lock - - - - - - Disposes the write client. - - The client. - - - - The client wraps the native redis operations into a more readable c# API. - - Where possible these operations are also exposed in common c# interfaces, - e.g. RedisClient.Lists => IList[string] - RedisClient.Sets => ICollection[string] - - - - - This class contains all the common operations for the RedisClient. - The client contains a 1:1 mapping of c# methods to redis operations of the same name. - - Not threadsafe use a pooled manager - - - - - Requires custom result parsing - - Number of results - - - - Command to set multuple binary safe arguments - - - - - - - reset buffer index in send buffer - - - - - Used to manage connection pooling - - - - - Gets or sets object key prefix. - - - - - Creates a new instance of the Redis Client from NewFactoryFn. - - - - - Alias for GetValue - - - - - Returns key with automatic object id detection in provided value with generic type. - - - - - - - Returns key with explicit object id. - - - - - - - Returns key with explicit object type and id. - - - - - - - - A complete redis command, with method to send command, receive response, and run callback on success or failure - - - - - Allows you to get Redis value operations to operate against POCO types. - - - - - - Use this to share the same redis connection with another - - The client. - - - - Pipeline for redis typed client - - - - - - Queue of commands for redis typed client - - - - - - Redis operation (transaction/pipeline) that allows queued commands to be completed - - - - - For interoperabilty GetCacheClient() and GetReadOnlyCacheClient() - return an ICacheClient wrapper around the redis manager which has the affect of calling - GetClient() for all write operations and GetReadOnlyClient() for the read ones. - - This works well for master-slave replication scenarios where you have - 1 master that replicates to multiple read slaves. - - - - - Ignore dispose on RedisClientsManager, which should be registered as a singleton - - - - - Useful wrapper IRedisClientsManager to cut down the boiler plate of most IRedisClient access - - - - - Creates a PubSubServer that uses a background thread to listen and process for - Redis Pub/Sub messages published to the specified channel. - Use optional callbacks to listen for message, error and life-cycle events. - Callbacks can be assigned later, then call Start() for PubSubServer to start listening for messages - - - - - A complete redis command, with method to send command, receive response, and run callback on success or failure - - - - - Redis command that does not get queued - - - - - Initialize channel and register client manager - - - - - - Check if GetValidSentinel should try the next sentinel server - - - This will be true if the failures is less than either RedisSentinel.MaxFailures or the # of sentinels, whatever is greater - - - - Raised if there is an error from a sentinel worker - - - - - - - Event that is fired when the sentinel subscription raises an event - - - - - - - Does a sentinel check for masters and slaves and either sets up or fails over to the new config - - - - - Takes output from sentinel slaves command and converts into a list of servers - - - - - - - Takes output from sentinel master command and converts into a list of servers - - - - - - - Provides a redis connection pool that can be sharded - - - - - Provides thread-safe pooling of redis client connections. - Allows load-balancing of master-write and read-slave hosts, ideal for - 1 master and multiple replicated read slaves. - - - - - Hosts can be an IP Address or Hostname in the format: host[:port] - e.g. 127.0.0.1:6379 - default is: localhost:6379 - - The write hosts. - The read hosts. - The config. - - - - Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts - - - - - - Called within a lock - - - - - - Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. - - - - - - Called within a lock - - - - - - Disposes the read only client. - - The client. - - - - Disposes the write client. - - The client. - - - - Gets or sets object key prefix. - - - - - Manage a client acquired from the PooledRedisClientManager - Dispose method will release the client back to the pool. - - - - - wrap the acquired client - - - - - - release the wrapped client back to the pool - - - - - access the wrapped client - - - - - logical name - - - - - An arbitrary weight relative to other nodes - - - - logical name - An arbitrary weight relative to other nodes - redis nodes - - - - Provides sharding of redis client connections. - uses consistent hashing to distribute keys across connection pools - - - - - maps a key to a redis connection pool - - key to map - a redis connection pool - - - - Adds a node and maps points across the circle - - node to add - An arbitrary number, specifies how often it occurs relative to other targets. - - - - A variation of Binary Search algorithm. Given a number, matches the next highest number from the sorted array. - If a higher number does not exist, then the first number in the array is returned. - - a sorted array to perform the search - number to find the next highest number against - next highest number - - - - Given a key, generates an unsigned 64 bit hash code using MD5 - - - - - - - Provides access to the method reflection data as part of the before/after event - - - - - Stores details about the context in which an IRedisClient is allocated. - - - - - - Tracks each IRedisClient instance allocated from the IRedisClientsManager logging when they are allocated and disposed. - Periodically writes the allocated instances to the log for diagnostic purposes. - - - - - Distributed lock interface - - - - - Optimized implementation. Primitive types are manually serialized, the rest are serialized using binary serializer />. - - - - - serialize/deserialize arbitrary objects - (objects must be serializable) - - - - - Serialize object to buffer - - serializable object - - - - - Deserialize buffer to object - - byte array to deserialize - - - - - - - - - - - - - - - - - - - serialize value and wrap with - - - - - - - Unwrap object wrapped in - - - - - - - pop numProcessed items from queue and unlock queue for work item id that dequeued - items are associated with - - - - - - A dequeued work item has been processed. When all of the dequeued items have been processed, - all items will be popped from the queue,and the queue unlocked for the work item id that - the dequeued items are associated with - - - - - Update first unprocessed item with new work item. - - - - - - - - - - - distributed work item queue. Each message must have an associated - work item id. For a given id, all work items are guaranteed to be processed - in the order in which they are received. - - - - - distributed work item queue. Each message must have an associated - work item id. For a given id, all work items are guaranteed to be processed - in the order in which they are received. - - - - - - - distributed work item queue - - - - - Enqueue item in priority queue corresponding to workItemId identifier - - - - - - - Preprare next work item id for dequeueing - - - - - Dequeue up to maxBatchSize items from queue corresponding to workItemId identifier. - Once this method is called, or will not - return any items for workItemId until the dequeue lock returned is unlocked. - - - - - - - - Replace existing work item in workItemId queue - - - - - - - - Queue incoming messages - - - - - - - Must call this periodically to move work items from priority queue to pending queue - - - - - Replace existing work item in workItemId queue - - - - - - - - Pop items from list - - - - - - - Force release of locks held by crashed servers - - - - - release lock held by crashed server - - - - true if lock is released, either by this method or by another client; false otherwise - - - - Unlock work item id, so other servers can process items for this id - - - - - - - - - - - - - - - - - - - - - - - - - - - pop remaining items that were returned by dequeue, and unlock queue - - - - - - indicate that an item has been processed by the caller - - - - - Update first unprocessed work item - - - - - - wraps a serialized representation of an object - - - - - - Initializes a new instance of . - - Custom item data. - The serialized item. - - - - The data representing the item being stored/retireved. - - - - - Flags set for this instance. - - - - - distributed lock class that follows the Resource Allocation Is Initialization pattern - - - - - Lock - - - - in seconds - in seconds - - - - unlock - - - - - Enqueue item - - - - - - Dequeue up to maxBatchSize items from queue - - - - - - - distributed work item queue. Messages are processed in chronological order - - - - - Enqueue incoming messages - - - - - - - - Dequeue next batch of work items - - - - - - - - - simple distributed work item queue - - - - - - - Queue incoming messages - - - - - - Dequeue next batch of work items for processing. After this method is called, - no other work items with same id will be available for - dequeuing until PostDequeue is called - - KeyValuePair: key is work item id, and value is list of dequeued items. - - - - - Serialize object to buffer - - serializable object - - - - - - - array of serializable objects - - - - - Deserialize buffer to object - - byte array to deserialize - - - - - - customize the client serializer - - - - - Factory to create SerializingRedisClient objects - - - - - - - - - General purpose pipeline - - - - - - Flush send buffer, and read responses - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Adds support for Redis Transactions (i.e. MULTI/EXEC/DISCARD operations). - - - - - Put "QUEUED" messages at back of queue - - - - - - Issue exec command (not queued) - - - - - callback for after result count is read in - - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Redis-specific exception. Thrown if unable to connect to Redis server due to socket exception, for example. - - - - - Adds support for Redis Transactions (i.e. MULTI/EXEC/DISCARD operations). - - - - - Put "QUEUED" messages at back of queue - - - - - - Issue exec command (not queued) - - - - - callback for after result count is read in - - - - - - Provide the default factory implementation for creating a RedisClient that - can be mocked and used by different 'Redis Client Managers' - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Provide the factory implementation for creating a RedisCacheClient that - can be mocked and used by different 'Redis Client Managers' - - - - - Wrap the common redis set operations under a ICollection[string] interface. - - - - - Wrap the common redis list operations under a IList[string] interface. - - - - - Represents a generic collection of key/value pairs that are ordered independently of the key and value. - - The type of the keys in the dictionary - The type of the values in the dictionary - - - - Adds an entry with the specified key and value into the IOrderedDictionary<TKey,TValue> collection with the lowest available index. - - The key of the entry to add. - The value of the entry to add. - The index of the newly added entry - - You can also use the property to add new elements by setting the value of a key that does not exist in the IOrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the IOrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. - An element with the same key already exists in the IOrderedDictionary<TKey,TValue> - The IOrderedDictionary<TKey,TValue> is read-only.
      - -or-
      - The IOrderedDictionary<TKey,TValue> has a fized size.
      -
      - - - Inserts a new entry into the IOrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. - - The zero-based index at which the element should be inserted. - The key of the entry to add. - The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. - is less than 0.
      - -or-
      - is greater than .
      - An element with the same key already exists in the IOrderedDictionary<TKey,TValue>. - The IOrderedDictionary<TKey,TValue> is read-only.
      - -or-
      - The IOrderedDictionary<TKey,TValue> has a fized size.
      -
      - - - Gets or sets the value at the specified index. - - The zero-based index of the value to get or set. - The value of the item at the specified index. - is less than 0.
      - -or-
      - is equal to or greater than .
      -
      - - - Represents a generic collection of key/value pairs that are ordered independently of the key and value. - - The type of the keys in the dictionary - The type of the values in the dictionary - - - - Initializes a new instance of the OrderedDictionary<TKey,TValue> class. - - - - - Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified initial capacity. - - The initial number of elements that the OrderedDictionary<TKey,TValue> can contain. - is less than 0 - - - - Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified comparer. - - The IEqualityComparer<TKey> to use when comparing keys, or to use the default EqualityComparer<TKey> for the type of the key. - - - - Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified initial capacity and comparer. - - The initial number of elements that the OrderedDictionary<TKey,TValue> collection can contain. - The IEqualityComparer<TKey> to use when comparing keys, or to use the default EqualityComparer<TKey> for the type of the key. - is less than 0 - - - - Converts the object passed as a key to the key type of the dictionary - - The key object to check - The key object, cast as the key type of the dictionary - is . - The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . - - - - Converts the object passed as a value to the value type of the dictionary - - The object to convert to the value type of the dictionary - The value object, converted to the value type of the dictionary - is , and the value type of the OrderedDictionary<TKey,TValue> is a value type. - The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . - - - - Inserts a new entry into the OrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. - - The zero-based index at which the element should be inserted. - The key of the entry to add. - The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. - is less than 0.
      - -or-
      - is greater than .
      - is . - An element with the same key already exists in the OrderedDictionary<TKey,TValue>. -
      - - - Inserts a new entry into the OrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. - - The zero-based index at which the element should be inserted. - The key of the entry to add. - The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. - is less than 0.
      - -or-
      - is greater than .
      - is .
      - -or-
      - is , and the value type of the OrderedDictionary<TKey,TValue> is a value type.
      - The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      - -or-
      - The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      - -or-
      - An element with the same key already exists in the OrderedDictionary<TKey,TValue>.
      -
      - - - Removes the entry at the specified index from the OrderedDictionary<TKey,TValue> collection. - - The zero-based index of the entry to remove. - is less than 0.
      - -or-
      - index is equal to or greater than .
      -
      - - - Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. - - The key of the entry to add. - The value of the entry to add. This value can be . - A key cannot be , but a value can be. - You can also use the property to add new elements by setting the value of a key that does not exist in the OrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the OrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. - is - An element with the same key already exists in the OrderedDictionary<TKey,TValue> - - - - Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. - - The key of the entry to add. - The value of the entry to add. This value can be . - The index of the newly added entry - A key cannot be , but a value can be. - You can also use the property to add new elements by setting the value of a key that does not exist in the OrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the OrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. - is - An element with the same key already exists in the OrderedDictionary<TKey,TValue> - - - - Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. - - The key of the entry to add. - The value of the entry to add. This value can be . - is .
      - -or-
      - is , and the value type of the OrderedDictionary<TKey,TValue> is a value type.
      - The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      - -or-
      - The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      -
      - - - Removes all elements from the OrderedDictionary<TKey,TValue> collection. - - The capacity is not changed as a result of calling this method. - - - - Determines whether the OrderedDictionary<TKey,TValue> collection contains a specific key. - - The key to locate in the OrderedDictionary<TKey,TValue> collection. - if the OrderedDictionary<TKey,TValue> collection contains an element with the specified key; otherwise, . - is - - - - Determines whether the OrderedDictionary<TKey,TValue> collection contains a specific key. - - The key to locate in the OrderedDictionary<TKey,TValue> collection. - if the OrderedDictionary<TKey,TValue> collection contains an element with the specified key; otherwise, . - is - The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . - - - - Returns the zero-based index of the specified key in the OrderedDictionary<TKey,TValue> - - The key to locate in the OrderedDictionary<TKey,TValue> - The zero-based index of , if is found in the OrderedDictionary<TKey,TValue>; otherwise, -1 - This method performs a linear search; therefore it has a cost of O(n) at worst. - - - - Removes the entry with the specified key from the OrderedDictionary<TKey,TValue> collection. - - The key of the entry to remove - if the key was found and the corresponding element was removed; otherwise, - - - - Removes the entry with the specified key from the OrderedDictionary<TKey,TValue> collection. - - The key of the entry to remove - - - - Copies the elements of the OrderedDictionary<TKey,TValue> elements to a one-dimensional Array object at the specified index. - - The one-dimensional object that is the destination of the objects copied from the OrderedDictionary<TKey,TValue>. The must have zero-based indexing. - The zero-based index in at which copying begins. - The method preserves the order of the elements in the OrderedDictionary<TKey,TValue> - - - - Gets the value associated with the specified key. - - The key of the value to get. - When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of . This parameter can be passed uninitialized. - if the OrderedDictionary<TKey,TValue> contains an element with the specified key; otherwise, . - - - - Adds the specified value to the OrderedDictionary<TKey,TValue> with the specified key. - - The KeyValuePair<TKey,TValue> structure representing the key and value to add to the OrderedDictionary<TKey,TValue>. - - - - Determines whether the OrderedDictionary<TKey,TValue> contains a specific key and value. - - The KeyValuePair<TKey,TValue> structure to locate in the OrderedDictionary<TKey,TValue>. - if is found in the OrderedDictionary<TKey,TValue>; otherwise, . - - - - Copies the elements of the OrderedDictionary<TKey,TValue> to an array of type , starting at the specified index. - - The one-dimensional array of type KeyValuePair<TKey,TValue> that is the destination of the KeyValuePair<TKey,TValue> elements copied from the OrderedDictionary<TKey,TValue>. The array must have zero-based indexing. - The zero-based index in at which copying begins. - - - - Removes a key and value from the dictionary. - - The KeyValuePair<TKey,TValue> structure representing the key and value to remove from the OrderedDictionary<TKey,TValue>. - if the key and value represented by is successfully found and removed; otherwise, . This method returns if is not found in the OrderedDictionary<TKey,TValue>. - - - - Gets the dictionary object that stores the keys and values - - The dictionary object that stores the keys and values for the OrderedDictionary<TKey,TValue> - Accessing this property will create the dictionary object if necessary - - - - Gets the list object that stores the key/value pairs. - - The list object that stores the key/value pairs for the OrderedDictionary<TKey,TValue> - Accessing this property will create the list object if necessary. - - - - Gets or sets the value at the specified index. - - The zero-based index of the value to get or set. - The value of the item at the specified index. - is less than 0.
      - -or-
      - index is equal to or greater than .
      -
      - - - Gets or sets the value at the specified index. - - The zero-based index of the value to get or set. - The value of the item at the specified index. - is less than 0.
      - -or-
      - index is equal to or greater than .
      - is a null reference, and the value type of the OrderedDictionary<TKey,TValue> is a value type. - The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . -
      - - - Gets a value indicating whether the OrderedDictionary<TKey,TValue> has a fixed size. - - if the OrderedDictionary<TKey,TValue> has a fixed size; otherwise, . The default is . - - - - Gets a value indicating whether the OrderedDictionary<TKey,TValue> collection is read-only. - - if the OrderedDictionary<TKey,TValue> is read-only; otherwise, . The default is . - - A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created. - A collection that is read-only is simply a collection with a wrapper that prevents modification of the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes. - - - - - Gets an object containing the keys in the OrderedDictionary<TKey,TValue>. - - An object containing the keys in the OrderedDictionary<TKey,TValue>. - The returned object is not a static copy; instead, the collection refers back to the keys in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the key collection. - - - - Gets an object containing the values in the OrderedDictionary<TKey,TValue> collection. - - An object containing the values in the OrderedDictionary<TKey,TValue> collection. - The returned object is not a static copy; instead, the refers back to the values in the original OrderedDictionary<TKey,TValue> collection. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the . - - - - Gets or sets the value with the specified key. - - The key of the value to get or set. - The value associated with the specified key. If the specified key is not found, attempting to get it returns , and attempting to set it creates a new element using the specified key. - - - - Gets or sets the value with the specified key. - - The key of the value to get or set. - The value associated with the specified key. If the specified key is not found, attempting to get it returns , and attempting to set it creates a new element using the specified key. - - - - Gets the number of key/values pairs contained in the OrderedDictionary<TKey,TValue> collection. - - The number of key/value pairs contained in the OrderedDictionary<TKey,TValue> collection. - - - - Gets a value indicating whether access to the OrderedDictionary<TKey,TValue> object is synchronized (thread-safe). - - This method always returns false. - - - - Gets an object that can be used to synchronize access to the OrderedDictionary<TKey,TValue> object. - - An object that can be used to synchronize access to the OrderedDictionary<TKey,TValue> object. - - - - Gets an ICollection<TKey> object containing the keys in the OrderedDictionary<TKey,TValue>. - - An ICollection<TKey> object containing the keys in the OrderedDictionary<TKey,TValue>. - The returned ICollection<TKey> object is not a static copy; instead, the collection refers back to the keys in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the key collection. - - - - Gets an ICollection<TValue> object containing the values in the OrderedDictionary<TKey,TValue>. - - An ICollection<TValue> object containing the values in the OrderedDictionary<TKey,TValue>. - The returned ICollection<TKey> object is not a static copy; instead, the collection refers back to the values in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the value collection. - - - - acquire distributed, non-reentrant lock on key - - global key for this lock - timeout for acquiring lock - timeout for lock, in seconds (stored as value against lock key) - - - - - - unlock key - - - - - - - - - - - - - Locking strategy interface - - - - - This class manages a read lock for a local readers/writer lock, - using the Resource Acquisition Is Initialization pattern - - - - - RAII initialization - - - - - - RAII disposal - - - - - This class manages a write lock for a local readers/writer lock, - using the Resource Acquisition Is Initialization pattern - - - - - - RAII disposal - - - - - manages a "region" in the redis key space - namespace can be cleared by incrementing the generation - - - - - get current generation - - - - - - set new generation - - - - - - redis key for generation - - - - - - get redis key that holds all namespace keys - - - - - - get global cache key - - - - - - - get global key inside of this namespace - - - prefixes can be added for name deconfliction - - - - - replace UniqueCharacter with its double, to avoid name clash - - - - - - - - - - - - - - get locking strategy - - -
      -
      diff --git a/lib/signed/ServiceStack.Redis.dll b/lib/signed/ServiceStack.Redis.dll deleted file mode 100644 index 20222c58591..00000000000 Binary files a/lib/signed/ServiceStack.Redis.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.Server.dll b/lib/signed/ServiceStack.Server.dll deleted file mode 100644 index aa9788e38e0..00000000000 Binary files a/lib/signed/ServiceStack.Server.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.Text.XML b/lib/signed/ServiceStack.Text.XML deleted file mode 100644 index 6cf831f51f8..00000000000 --- a/lib/signed/ServiceStack.Text.XML +++ /dev/null @@ -1,714 +0,0 @@ - - - - ServiceStack.Text - - - - - Utils to load types - - - - - Find the type from the name supplied - - [typeName] or [typeName, assemblyName] - - - - - The top-most interface of the given type, if any. - - - - - Find type if it exists - - - - The type if it exists - - - - Populate an object with Example data. - - - - - - - Populates the object with example data. - - - Tracks how deeply nested we are - - - - - If AlwaysUseUtc is set to true then convert all DateTime to UTC. - - - - - - - Repairs an out-of-spec XML date/time string which incorrectly uses a space instead of a 'T' to separate the date from the time. - These string are occasionally generated by SQLite and can cause errors in OrmLite when reading these columns from the DB. - - The XML date/time string to repair - The repaired string. If no repairs were made, the original string is returned. - - - - WCF Json format: /Date(unixts+0000)/ - - - - - - - WCF Json format: /Date(unixts+0000)/ - - - - - - - Get the type(string) constructor if exists - - The type. - - - - - micro optimizations: using flags instead of value.IndexOfAny(EscapeChars) - - - - - - - Class to hold - - - - - - A fast, standards-based, serialization-issue free DateTime serailizer. - - - - - Determines whether this serializer can create the specified type from a string. - - The type. - - true if this instance [can create from string] the specified type; otherwise, false. - - - - - Parses the specified value. - - The value. - - - - - Deserializes from reader. - - The reader. - - - - - Serializes to string. - - The value. - - - - - Serializes to writer. - - The value. - The writer. - - - - Sets which format to use when serializing TimeSpans - - - - - if the is configured - to take advantage of specification, - to support user-friendly serialized formats, ie emitting camelCasing for JSON - and parsing member names and enum values in a case-insensitive manner. - - - - - if the is configured - to support web-friendly serialized formats, ie emitting lowercase_underscore_casing for JSON - - - - - Define how property names are mapped during deserialization - - - - - Gets or sets a value indicating if the framework should throw serialization exceptions - or continue regardless of deserialization errors. If the framework - will throw; otherwise, it will parse as many fields as possible. The default is . - - - - - Gets or sets a value indicating if the framework should always convert to UTC format instead of local time. - - - - - Gets or sets a value indicating if the framework should always assume is in UTC format if Kind is Unspecified. - - - - - Gets or sets whether we should append the Utc offset when we serialize Utc dates. Defaults to no. - Only supported for when the JsConfig.DateHandler == JsonDateHandler.TimestampOffset - - - - - Gets or sets a value indicating if unicode symbols should be serialized as "\uXXXX". - - - - - If set to true, Interface types will be prefered over concrete types when serializing. - - - - - For extra serialization performance you can re-use a ThreadStatic StringBuilder - when serializing to a JSON String. - - - - - Sets the maximum depth to avoid circular dependencies - - - - - Set this to enable your own type construction provider. - This is helpful for integration with IoC containers where you need to call the container constructor. - Return null if you don't know how to construct the type and the parameterless constructor will be used. - - - - - If set to true, Interface types will be prefered over concrete types when serializing. - - - - - Always emit type info for this type. Takes precedence over ExcludeTypeInfo - - - - - Never emit type info for this type - - - - - if the is configured - to take advantage of specification, - to support user-friendly serialized formats, ie emitting camelCasing for JSON - and parsing member names and enum values in a case-insensitive manner. - - - - - Define custom serialization fn for BCL Structs - - - - - Define custom raw serialization fn - - - - - Define custom serialization hook - - - - - Define custom after serialization hook - - - - - Define custom deserialization fn for BCL Structs - - - - - Define custom raw deserialization fn for objects - - - - - Exclude specific properties of this type from being serialized - - - - - Opt-in flag to set some Value Types to be treated as a Ref Type - - - - - Whether there is a fn (raw or otherwise) - - - - - The property names on target types must match property names in the JSON source - - - - - The property names on target types may not match the property names in the JSON source - - - - - Uses the xsd format like PT15H10M20S - - - - - Uses the standard .net ToString method of the TimeSpan class - - - - - Get JSON string value converted to T - - - - - Get JSON string value - - - - - Get unescaped string value - - - - - Get unescaped string value - - - - - Write JSON Array, Object, bool or number values as raw string - - - - - Get JSON string value - - - - - Creates an instance of a Type from a string value - - - - - Parses the specified value. - - The value. - - - - - Shortcut escape when we're sure value doesn't contain any escaped chars - - - - - - - Given a character as utf32, returns the equivalent string provided that the character - is legal json. - - - - - - - micro optimizations: using flags instead of value.IndexOfAny(EscapeChars) - - - - - - - Implement the serializer using a more static approach - - - - - - Implement the serializer using a more static approach - - - - - - Public Code API to register commercial license for ServiceStack. - - - - - Internal Utilities to verify licensing - - - - - Pretty Thread-Safe cache class from: - http://code.google.com/p/dapper-dot-net/source/browse/Dapper/SqlMapper.cs - - This is a micro-cache; suitable when the number of terms is controllable (a few hundred, for example), - and strictly append-only; you cannot change existing values. All key matches are on **REFERENCE** - equality. The type is fully thread-safe. - - - - - Represents an individual object, allowing access to members by-name - - - - - Use the target types definition of equality - - - - - Obtain the hash of the target object - - - - - Use the target's definition of a string representation - - - - - Wraps an individual object, allowing by-name access to that instance - - - - - Get or Set the value of a named member for the underlying object - - - - - The object represented by this instance - - - - - Provides by-name member-access to objects of a given type - - - - - Create a new instance of this type - - - - - Provides a type-specific accessor, allowing by-name access for all objects of that type - - The accessor is cached internally; a pre-existing accessor may be returned - - - - Does this type support new instances via a parameterless constructor? - - - - - Get or set the value of a named member on the target instance - - - - - Maps the path of a file in the context of a VS project - - the relative path - the absolute path - Assumes static content is two directories above the /bin/ directory, - eg. in a unit test scenario the assembly would be in /bin/Debug/. - - - - Maps the path of a file in a self-hosted scenario - - the relative path - the absolute path - Assumes static content is copied to /bin/ folder with the assemblies - - - - Maps the path of a file in an Asp.Net hosted scenario - - the relative path - the absolute path - Assumes static content is in the parent folder of the /bin/ directory - - - - Implement the serializer using a more static approach - - - - - - Creates a new instance of type. - First looks at JsConfig.ModelFactory before falling back to CreateInstance - - - - - Creates a new instance of type. - First looks at JsConfig.ModelFactory before falling back to CreateInstance - - - - - Creates a new instance from the default constructor of type - - - - - Add a Property attribute at runtime. - Not threadsafe, should only add attributes on Startup. - - - - - Add a Property attribute at runtime. - Not threadsafe, should only add attributes on Startup. - - - - - @jonskeet: Collection of utility methods which operate on streams. - r285, February 26th 2009: http://www.yoda.arachsys.com/csharp/miscutil/ - - - - - Reads the given stream up to the end, returning the data as a byte - array. - - - - - Reads the given stream up to the end, returning the data as a byte - array, using the given buffer size. - - - - - Reads the given stream up to the end, returning the data as a byte - array, using the given buffer for transferring data. Note that the - current contents of the buffer is ignored, so the buffer needn't - be cleared beforehand. - - - - - Copies all the data from one stream into another. - - - - - Copies all the data from one stream into another, using a buffer - of the given size. - - - - - Copies all the data from one stream into another, using the given - buffer for transferring data. Note that the current contents of - the buffer is ignored, so the buffer needn't be cleared beforehand. - - - - - Reads exactly the given number of bytes from the specified stream. - If the end of the stream is reached before the specified amount - of data is read, an exception is thrown. - - - - - Reads into a buffer, filling it completely. - - - - - Reads exactly the given number of bytes from the specified stream, - into the given buffer, starting at position 0 of the array. - - - - - Reads exactly the given number of bytes from the specified stream, - into the given buffer, starting at position 0 of the array. - - - - - Same as ReadExactly, but without the argument checks. - - - - - Converts from base: 0 - 62 - - The source. - From. - To. - - - - - Skip the encoding process for 'safe strings' - - - - - - - A class to allow the conversion of doubles to string representations of - their exact decimal values. The implementation aims for readability over - efficiency. - - Courtesy of @JonSkeet - http://www.yoda.arachsys.com/csharp/DoubleConverter.cs - - - - - - - - How many digits are *after* the decimal point - - - - - Constructs an arbitrary decimal expansion from the given long. - The long must not be negative. - - - - - Multiplies the current expansion by the given amount, which should - only be 2 or 5. - - - - - Shifts the decimal point; a negative value makes - the decimal expansion bigger (as fewer digits come after the - decimal place) and a positive value makes the decimal - expansion smaller. - - - - - Removes leading/trailing zeroes from the expansion. - - - - - Converts the value to a proper decimal string representation. - - - - - Creates an instance of a Type from a string value - - - - - Determines whether the specified type is convertible from string. - - The type. - - true if the specified type is convertible from string; otherwise, false. - - - - - Parses the specified value. - - The value. - - - - - Parses the specified type. - - The type. - The value. - - - - - Useful extension method to get the Dictionary[string,string] representation of any POCO type. - - - - - - Recursively prints the contents of any POCO object in a human-friendly, readable format - - - - - - Print Dump to Console.WriteLine - - - - - Print string.Format to Console.WriteLine - - - - - Parses the specified value. - - The value. - - - - diff --git a/lib/signed/ServiceStack.Text.dll b/lib/signed/ServiceStack.Text.dll deleted file mode 100644 index 794729c86d2..00000000000 Binary files a/lib/signed/ServiceStack.Text.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.dll b/lib/signed/ServiceStack.dll deleted file mode 100644 index f9da09e59fb..00000000000 Binary files a/lib/signed/ServiceStack.dll and /dev/null differ diff --git a/lib/signed/ServiceStack.xml b/lib/signed/ServiceStack.xml deleted file mode 100644 index fd1d004639a..00000000000 --- a/lib/signed/ServiceStack.xml +++ /dev/null @@ -1,5996 +0,0 @@ - - - - ServiceStack - - - - - Base class to create request filter attributes only for specific HTTP methods (GET, POST...) - - - - - Creates a new - - Defines when the filter should be executed - - - - This method is only executed if the HTTP method matches the property. - - The http request wrapper - The http response wrapper - The request DTO - - - - Create a ShallowCopy of this instance. - - - - - - Redirect to the https:// version of this url if not already. - - - - - Don't redirect when in DebugMode - - - - - Don't redirect if the request was a forwarded request, e.g. from a Load Balancer - - - - - Single threaded message handler that can process all messages - of a particular message type. - - - - - Process all messages pending - - - - - - Process messages from a single queue. - - - The queue to process - A predicate on whether to continue processing the next message if any - - - - - Get Current Stats for this Message Handler - - - - - - The type of the message this handler processes - - - - - Encapsulates creating a new message handler - - - - - Processes all messages in a Normal and Priority Queue. - Expects to be called in 1 thread. i.e. Non Thread-Safe. - - - - - - A convenient repository base class you can inherit from to reduce the boilerplate - with accessing a managed IDbConnection - - - - - A convenient base class for your injected service dependencies that reduces the boilerplate - with managed access to ServiceStack's built-in providers - - - - - Respond with a 'Soft redirect' so smart clients (e.g. ajax) have access to the response and - can decide whether or not they should redirect - - - - - Decorate the response with an additional client-side event to instruct participating - smart clients (e.g. ajax) with hints to transparently invoke client-side functionality - - - - - Shortcut to get the ResponseDTO whether it's bare or inside a IHttpResult - - - - - - - Alias of AsDto - - - - - Shortcut to get the ResponseDTO whether it's bare or inside a IHttpResult - - - TResponse if found; otherwise null - - - - Alias of AsDto - - - - - Whether the response is an IHttpError or Exception - - - - - rangeHeader should be of the format "bytes=0-" or "bytes=0-12345" or "bytes=123-456" - - - - - Adds 206 PartialContent Status, Content-Range and Content-Length headers - - - - - Writes partial range as specified by start-end, from fromStream to toStream. - - - - - Service error logs are kept in 'urn:ServiceErrors:{ServiceName}' - - - - - Combined service error logs are maintained in 'urn:ServiceErrors:All' - - - - - RequestLogs service Route, default is /requestlogs - - - - - Turn On/Off Session Tracking - - - - - Turn On/Off Logging of Raw Request Body, default is Off - - - - - Turn On/Off Tracking of Responses - - - - - Turn On/Off Tracking of Exceptions - - - - - Size of InMemoryRollingRequestLogger circular buffer - - - - - Limit access to /requestlogs service to these roles - - - - - Change the RequestLogger provider. Default is InMemoryRollingRequestLogger - - - - - Don't log requests of these types. By default RequestLog's are excluded - - - - - Don't log request bodys for services with sensitive information. - By default Auth and Registration requests are hidden. - - - - - Generic + Useful IService base class - - - - - Resolve an alternate Web Service from ServiceStack's IOC container. - - - - - - - Dynamic Session Bag - - - - - Typed UserSession - - - - - Indicates that the request dto, which is associated with this attribute, - requires authentication. - - - - - Restrict authentication to a specific . - For example, if this attribute should only permit access - if the user is authenticated with , - you should set this property to . - - - - - Redirect the client to a specific URL if authentication failed. - If this property is null, simply `401 Unauthorized` is returned. - - - - - Enable the authentication feature and configure the AuthService. - - - - - Inject logic into existing services by introspecting the request and injecting your own - validation logic. Exceptions thrown will have the same behaviour as if the service threw it. - - If a non-null object is returned the request will short-circuit and return that response. - - The instance of the service - GET,POST,PUT,DELETE - - Response DTO; non-null will short-circuit execution and return that response - - - - Public API entry point to authenticate via code - - - null; if already autenticated otherwise a populated instance of AuthResponse - - - - The specified may change as a side-effect of this method. If - subsequent code relies on current data be sure to reload - the session istance via . - - - - - Remove the Users Session - - - - - - - - The entry point for all AuthProvider providers. Runs inside the AuthService so exceptions are treated normally. - Overridable so you can provide your own Auth implementation. - - - - - Determine if the current session is already authenticated with this AuthProvider - - - - - Allows specifying a global fallback config that if exists is formatted with the Provider as the first arg. - E.g. this appSetting with the TwitterAuthProvider: - oauth.CallbackUrl="http://localhost:11001/auth/{0}" - Would result in: - oauth.CallbackUrl="http://localhost:11001/auth/twitter" - - - - - - Remove the Users Session - - - - - - - - Saves the Auth Tokens for this request. Called in OnAuthenticated(). - Overrideable, the default behaviour is to call IUserAuthRepository.CreateOrMergeAuthSession(). - - - - - Base class for entity validator classes. - - The type of the object being validated - - - - Defines a validator for a particualr type. - - - - - - Defines a validator for a particular type. - - - - - Validates the specified instance - - - A ValidationResult containing any validation failures - - - - Validates the specified instance. - - A ValidationContext - A ValidationResult object containy any validation failures. - - - - Creates a hook to access various meta data properties - - A IValidatorDescriptor object which contains methods to access metadata - - - - Checks to see whether the validator can validate objects of the specified type - - - - - Validates the specified instance. - - The instance to validate - A ValidationResult object containing any validation failures. - - - - Sets the cascade mode for all rules within this validator. - - - - - Validates the specified instance - - The object to validate - A ValidationResult object containing any validation failures - - - - Validates the specified instance. - - Validation Context - A ValidationResult object containing any validation failures. - - - - Adds a rule to the current validator. - - - - - - Creates a that can be used to obtain metadata about the current validator. - - - - - Defines a validation rule for a specify property. - - - RuleFor(x => x.Surname)... - - The type of property being validated - The expression representing the property to validate - an IRuleBuilder instance on which validators can be defined - - - - Defines a custom validation rule using a lambda expression. - If the validation rule fails, it should return a instance of a ValidationFailure - If the validation rule succeeds, it should return null. - - A lambda that executes custom validation rules. - - - - Defines a custom validation rule using a lambda expression. - If the validation rule fails, it should return an instance of ValidationFailure - If the validation rule succeeds, it should return null. - - A lambda that executes custom validation rules - - - - Defines a RuleSet that can be used to group together several validators. - - The name of the ruleset. - Action that encapsulates the rules in the ruleset. - - - - Defines a RuleSet that can be used to provide specific validation rules for specific HTTP methods (GET, POST...) - - The HTTP methods where this rule set should be used. - Action that encapuslates the rules in the ruleset. - - - - Defines a condition that applies to several rules - - The condition that should apply to multiple rules - Action that encapsulates the rules. - - - - - Defiles an inverse condition that applies to several rules - - The condition that should be applied to multiple rules - Action that encapsulates the rules - - - - Returns an enumerator that iterates through the collection of validation rules. - - - A that can be used to iterate through the collection. - - 1 - - - - Sets the cascade mode for all rules within this validator. - - - - - Create a Facebook App at: https://developers.facebook.com/apps - The Callback URL for your app should match the CallbackUrl provided. - - - - - The entry point for all AuthProvider providers. Runs inside the AuthService so exceptions are treated normally. - Overridable so you can provide your own Auth implementation. - - - - - - - - - Sets the CallbackUrl and session.ReferrerUrl if not set and initializes the session tokens for this AuthProvider - - - - - - - - - Download Yammer User Info given its ID. - - - The Yammer User ID. - - - The User info in JSON format. - - - - Yammer provides a method to retrieve current user information via - "https://www.yammer.com/api/v1/users/current.json". - - - However, to ensure consistency with the rest of the Auth codebase, - the explicit URL will be used, where [:id] denotes the User ID: - "https://www.yammer.com/api/v1/users/[:id].json" - - - Refer to: https://developer.yammer.com/restapi/ for full documentation. - - - - - - Thread-safe In memory UserAuth data store so it can be used without a dependency on Redis. - - - - - Creates the required missing tables or DB schema - - - - - Create new Registration - - - - - Logic to update UserAuth from Registration info, not enabled on OnPut because of security. - - - - - Thank you Martijn - http://www.dijksterhuis.org/creating-salted-hash-values-in-c/ - - - - - Create an app at https://dev.twitter.com/apps to get your ConsumerKey and ConsumerSecret for your app. - The Callback URL for your app should match the CallbackUrl provided. - - - - - Creates the required missing tables or DB schema - - - - - The ServiceStack Yammer OAuth provider. - - - - This provider is loosely based on the existing ServiceStack's Facebook OAuth provider. - - - For the full info on Yammer's OAuth2 authentication flow, refer to: - https://developer.yammer.com/authentication/#a-oauth2 - - - Note: Add these to your application / web config settings under appSettings and replace - values as appropriate. - - - - - - - - - ]]> - - - - - - The OAuth provider name / identifier. - - - - - Initializes a new instance of the class. - - - The application settings (in web.config). - - - - - Authenticate against Yammer OAuth endpoint. - - - The auth service. - - - The session. - - - The request. - - - The . - - - - - Load the UserAuth info into the session. - - - The User session. - - - The OAuth tokens. - - - The auth info. - - - - - Load the UserOAuth info into the session. - - - The auth session. - - - The OAuth tokens. - - - - - Gets or sets the Yammer OAuth client id. - - - - - Gets or sets the Yammer OAuth client secret. - - - - - Gets or sets the Yammer OAuth pre-auth url. - - - - - The Yammer User's email addresses. - - - - - Gets or sets the email address type (e.g. primary). - - - - - Gets or sets the email address. - - - - - Removes items from cache that have keys matching the specified wildcard pattern - - Cache client - The wildcard, where "*" means any sequence of characters and "?" means any single character. - - - - Removes items from the cache based on the specified regular expression pattern - - Cache client - Regular expression pattern to search cache keys - - - - Add value with specified key to the cache, and set the cache entry to never expire. - - - - - Stores The value with key only if such key doesn't exist at the server yet. - - - - - Adds or replaces the value with key, and sets the cache entry to never expire. - - - - - Adds or replaces the value with key. - - - - - Adds or replaces the value with key. - - - - - Replace the value with specified key if it exists, and set the cache entry to never expire. - - - - - Replace the value with specified key if it exists. - - - - - Add the value with key to the cache, set to never expire. - - - - - Add or replace the value with key to the cache, set to never expire. - - - - - Replace the value with key in the cache, set to never expire. - - - - - Add the value with key to the cache, set to expire at specified DateTime. - - This method examines the DateTimeKind of expiresAt to determine if conversion to - universal time is needed. The version of Add that takes a TimeSpan expiration is faster - than using this method with a DateTime of Kind other than Utc, and is not affected by - ambiguous local time during daylight savings/standard time transition. - - - - Add or replace the value with key to the cache, set to expire at specified DateTime. - - This method examines the DateTimeKind of expiresAt to determine if conversion to - universal time is needed. The version of Set that takes a TimeSpan expiration is faster - than using this method with a DateTime of Kind other than Utc, and is not affected by - ambiguous local time during daylight savings/standard time transition. - - - - Replace the value with key in the cache, set to expire at specified DateTime. - - This method examines the DateTimeKind of expiresAt to determine if conversion to - universal time is needed. The version of Replace that takes a TimeSpan expiration is faster - than using this method with a DateTime of Kind other than Utc, and is not affected by - ambiguous local time during daylight savings/standard time transition. - - - - Add the value with key to the cache, set to expire after specified TimeSpan. - - - - - Add or replace the value with key to the cache, set to expire after specified TimeSpan. - - - - - Replace the value with key in the cache, set to expire after specified TimeSpan. - - - - - Create new instance of CacheEntry. - - - - UTC time at which CacheEntry expires. - - - - Would've preferred to use [assembly: ContractNamespace] attribute but it is not supported in Mono - - - - - More familiar name for the new crowd. - - - - - The tier lets you specify a retrieving a setting with the tier prefix first before falling back to the original key. - E.g a tier of 'Live' looks for 'Live.{Key}' or if not found falls back to '{Key}'. - - - - - Returns string if exists, otherwise null - - - - - - - Provides a common interface for Settings providers such as - ConfigurationManager or Azure's RoleEnvironment. The only - requirement is that if the implementation cannot find the - specified key, the return value must be null - - The key for the setting - The string value of the specified key, or null if the key - was invalid - - - - Gets the nullable app setting. - - - - - Gets the app setting. - - - - - Determines wheter the Config section identified by the sectionName exists. - - - - - Returns AppSetting[key] if exists otherwise defaultValue - - - - - Returns AppSetting[key] if exists otherwise defaultValue, for non-string values - - - - - Gets the connection string setting. - - - - - Gets the connection string. - - - - - Gets the list from app setting. - - - - - Gets the dictionary from app setting. - - - - - Get the static Parse(string) method on the type supplied - - - - - Gets the constructor info for T(string) if exists. - - - - - Returns the value returned by the 'T.Parse(string)' method if exists otherwise 'new T(string)'. - e.g. if T was a TimeSpan it will return TimeSpan.Parse(textValue). - If there is no Parse Method it will attempt to create a new instance of the destined type - - - - - Plugin adds support for Cross-origin resource sharing (CORS, see http://www.w3.org/TR/access-control/). - CORS allows to access resources from different domain which usually forbidden by origin policy. - - - - - Represents a default constructor with Allow Origin equals to "*", Allowed GET, POST, PUT, DELETE, OPTIONS request and allowed "Content-Type" header. - - - - - Attribute marks that specific response class has support for Cross-origin resource sharing (CORS, see http://www.w3.org/TR/access-control/). CORS allows to access resources from different domain which usually forbidden by origin policy. - - - - - Represents a default constructor with Allow Origin equals to "*", Allowed GET, POST, PUT, DELETE, OPTIONS request and allowed "Content-Type" header. - - - - - Change the default HTML view or template used for the HTML response of this service - - - - - Class that can be used to find all the validators from a collection of types. - - - - - Creates a scanner that works on a sequence of types. - - - - - Finds all the validators in the specified assembly. - - - - - Finds all the validators in the assembly containing the specified type. - - - - - Performs the specified action to all of the assembly scan results. - - - - - Returns an enumerator that iterates through the collection. - - - A that can be used to iterate through the collection. - - 1 - - - - Result of performing a scan. - - - - - Creates an instance of an AssemblyScanResult. - - - - - Validator interface type, eg IValidator<Foo> - - - - - Concrete type that implements the InterfaceType, eg FooValidator. - - - - - Implementation of IValidatorFactory that looks for ValidatorAttribute instances on the specified type in order to provide the validator instance. - - - - - Gets validators for a particular type. - - - - - Gets the validator for the specified type. - - - - - Gets the validator for the specified type. - - - - - Gets a validator for the appropriate type. - - - - - Gets a validator for the appropriate type. - - - - - Validator attribute to define the class that will describe the Validation rules - - - - - Creates an instance of the ValidatorAttribute allowing a validator type to be specified. - - - - - The type of the validator used to validate the current type. - - - - - Associates an instance of IValidator with the current property rule and is used to validate each item within the collection. - - The validator to use - - - - Rule builder - - - - - - - Rule builder - - - - - - - Associates a validator with this the property for this rule builder. - - The validator to set - - - - - Associates an instance of IValidator with the current property rule. - - The validator to use - - - - Represents an object that is configurable. - - Type of object being configured - Return type - - - - Configures the current object. - - Action to configure the object. - - - - - Extension methods that provide the default set of validators. - - - - - Defines a 'not null' validator on the current rule builder. - Validation will fail if the property is null. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - - - - - Defines a 'not empty' validator on the current rule builder. - Validation will fail if the property is null, an empty or the default value for the type (for example, 0 for integers) - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - - - - - Defines a length validator on the current rule builder, but only for string properties. - Validation will fail if the length of the string is outside of the specifed range. The range is inclusive. - - Type of object being validated - The rule builder on which the validator should be defined - - - - - Defines a length validator on the current rule builder, but only for string properties. - Validation will fail if the length of the string is not equal to the length specified. - - Type of object being validated - The rule builder on which the validator should be defined - - - - - Defines a regular expression validator on the current rule builder, but only for string properties. - Validation will fail if the value returned by the lambda does not match the regular expression. - - Type of object being validated - The rule builder on which the validator should be defined - The regular expression to check the value against. - - - - - Defines a regular expression validator on the current rule builder, but only for string properties. - Validation will fail if the value returned by the lambda is not a valid email address. - - Type of object being validated - The rule builder on which the validator should be defined - - - - - Defines a 'not equal' validator on the current rule builder. - Validation will fail if the specified value is equal to the value of the property. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value to compare - Equality comparer to use - - - - - Defines a 'not equal' validator on the current rule builder using a lambda to specify the value. - Validation will fail if the value returned by the lambda is equal to the value of the property. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - A lambda expression to provide the comparison value - Equality Comparer to use - - - - - Defines an 'equals' validator on the current rule builder. - Validation will fail if the specified value is not equal to the value of the property. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value to compare - Equality Comparer to use - - - - - Defines an 'equals' validator on the current rule builder using a lambda to specify the comparison value. - Validation will fail if the value returned by the lambda is not equal to the value of the property. - - The type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - A lambda expression to provide the comparison value - Equality comparer to use - - - - - Defines a predicate validator on the current rule builder using a lambda expression to specify the predicate. - Validation will fail if the specified lambda returns false. - Validation will succeed if the specifed lambda returns true. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - A lambda expression specifying the predicate - - - - - Defines a predicate validator on the current rule builder using a lambda expression to specify the predicate. - Validation will fail if the specified lambda returns false. - Validation will succeed if the specifed lambda returns true. - This overload accepts the object being validated in addition to the property being validated. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - A lambda expression specifying the predicate - - - - - Defines a predicate validator on the current rule builder using a lambda expression to specify the predicate. - Validation will fail if the specified lambda returns false. - Validation will succeed if the specifed lambda returns true. - This overload accepts the object being validated in addition to the property being validated. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - A lambda expression specifying the predicate - - - - - Defines a 'less than' validator on the current rule builder. - The validation will succeed if the property value is less than the specified value. - The validation will fail if the property value is greater than or equal to the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'less than' validator on the current rule builder. - The validation will succeed if the property value is less than the specified value. - The validation will fail if the property value is greater than or equal to the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'less than or equal' validator on the current rule builder. - The validation will succeed if the property value is less than or equal to the specified value. - The validation will fail if the property value is greater than the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'less than or equal' validator on the current rule builder. - The validation will succeed if the property value is less than or equal to the specified value. - The validation will fail if the property value is greater than the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'greater than' validator on the current rule builder. - The validation will succeed if the property value is greater than the specified value. - The validation will fail if the property value is less than or equal to the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'greater than' validator on the current rule builder. - The validation will succeed if the property value is greater than the specified value. - The validation will fail if the property value is less than or equal to the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'greater than or equal' validator on the current rule builder. - The validation will succeed if the property value is greater than or equal the specified value. - The validation will fail if the property value is less than the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'greater than or equal' validator on the current rule builder. - The validation will succeed if the property value is greater than or equal the specified value. - The validation will fail if the property value is less than the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'less than' validator on the current rule builder using a lambda expression. - The validation will succeed if the property value is less than the specified value. - The validation will fail if the property value is greater than or equal to the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - A lambda that should return the value being compared - - - - - Defines a 'less than' validator on the current rule builder using a lambda expression. - The validation will succeed if the property value is less than the specified value. - The validation will fail if the property value is greater than or equal to the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - A lambda that should return the value being compared - - - - - Defines a 'less than or equal' validator on the current rule builder using a lambda expression. - The validation will succeed if the property value is less than or equal to the specified value. - The validation will fail if the property value is greater than the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'less than or equal' validator on the current rule builder using a lambda expression. - The validation will succeed if the property value is less than or equal to the specified value. - The validation will fail if the property value is greater than the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'less than' validator on the current rule builder using a lambda expression. - The validation will succeed if the property value is greater than the specified value. - The validation will fail if the property value is less than or equal to the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'less than' validator on the current rule builder using a lambda expression. - The validation will succeed if the property value is greater than the specified value. - The validation will fail if the property value is less than or equal to the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'less than' validator on the current rule builder using a lambda expression. - The validation will succeed if the property value is greater than or equal the specified value. - The validation will fail if the property value is less than the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Defines a 'less than' validator on the current rule builder using a lambda expression. - The validation will succeed if the property value is greater than or equal the specified value. - The validation will fail if the property value is less than the specified value. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The value being compared - - - - - Validates certain properties of the specified instance. - - The current validator - The object to validate - Expressions to specify the properties to validate - A ValidationResult object containing any validation failures - - - - Validates certain properties of the specified instance. - - The object to validate - The names of the properties to validate. - A ValidationResult object containing any validation failures. - - - - Performs validation and then throws an exception if validation fails. - - - - - Defines an 'inclusive between' validator on the current rule builder, but only for properties of types that implement IComparable. - Validation will fail if the value of the property is outside of the specifed range. The range is inclusive. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The lowest allowed value - The highest allowed value - - - - - Defines an 'inclusive between' validator on the current rule builder, but only for properties of types that implement IComparable. - Validation will fail if the value of the property is outside of the specifed range. The range is inclusive. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The lowest allowed value - The highest allowed value - - - - - Defines an 'exclusive between' validator on the current rule builder, but only for properties of types that implement IComparable. - Validation will fail if the value of the property is outside of the specifed range. The range is exclusive. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The lowest allowed value - The highest allowed value - - - - - Defines an 'exclusive between' validator on the current rule builder, but only for properties of types that implement IComparable. - Validation will fail if the value of the property is outside of the specifed range. The range is exclusive. - - Type of object being validated - Type of property being validated - The rule builder on which the validator should be defined - The lowest allowed value - The highest allowed value - - - - - Defines a credit card validator for the current rule builder that ensures that the specified string is a valid credit card number. - - - - - Default options that can be used to configure a validator. - - - - - Specifies the cascade mode for failures. - If set to 'Stop' then execution of the rule will stop once the first validator in the chain fails. - If set to 'Continue' then all validators in the chain will execute regardless of failures. - - - - - Specifies a custom action to be invoked when the validator fails. - - - - - - - - - - Specifies a custom error message to use if validation fails. - - The current rule - The error message to use - - - - - Specifies a custom error message to use if validation fails. - - The current rule - The error message to use - Additional arguments to be specified when formatting the custom error message. - - - - - Specifies a custom error message to use if validation fails. - - The current rule - The error message to use - Additional property values to be included when formatting the custom error message. - - - - - Specifies a custom error message resource to use when validation fails. - - The current rule - The resource to use as an expression, eg () => Messages.MyResource - - - - - Specifies a custom error message resource to use when validation fails. - - The current rule - The resource to use as an expression, eg () => Messages.MyResource - Custom message format args - - - - - Specifies a custom error message resource to use when validation fails. - - The current rule - The resource to use as an expression, eg () => Messages.MyResource - Custom message format args - - - - - Specifies a custom error message resource to use when validation fails. - - The current rule - The resource to use as an expression, eg () => Messages.MyResource - The resource accessor builder to use. - - - - - Specifies a custom error code to use when validation fails - - The current rule - The error code to use - - - - - Specifies a condition limiting when the validator should run. - The validator will only be executed if the result of the lambda returns true. - - The current rule - A lambda expression that specifies a condition for when the validator should run - Whether the condition should be applied to the current rule or all rules in the chain - - - - - Specifies a condition limiting when the validator should not run. - The validator will only be executed if the result of the lambda returns false. - - The current rule - A lambda expression that specifies a condition for when the validator should not run - Whether the condition should be applied to the current rule or all rules in the chain - - - - - Specifies a custom property name to use within the error message. - - The current rule - The property name to use - - - - - Specifies a localized name for the error message. - - The current rule - The resource to use as an expression, eg () => Messages.MyResource - Resource accessor builder to use - - - - Overrides the name of the property associated with this rule. - NOTE: This is a considered to be an advanced feature. 99% of the time that you use this, you actually meant to use WithName. - - The current rule - The property name to use - - - - - Specifies custom state that should be stored alongside the validation message when validation fails for this rule. - - - - - - - - - - Specifies how rules should cascade when one fails. - - - - - When a rule fails, execution continues to the next rule. - - - - - When a rule fails, validation is stopped and all other rules in the chain will not be executed. - - - - - Specifies where a When/Unless condition should be applied - - - - - Applies the condition to all validators declared so far in the chain. - - - - - Applies the condition to the current validator only. - - - - - Validator implementation that allows rules to be defined without inheriting from AbstractValidator. - - - - public class Customer { - public int Id { get; set; } - public string Name { get; set; } - - public static readonly InlineValidator<Customer> Validator = new InlineValidator<Customer> { - v => v.RuleFor(x => x.Name).NotNull(), - v => v.RuleFor(x => x.Id).NotEqual(0), - } - } - - - - - - - Allows configuration of the validator. - - - - - Delegate that specifies configuring an InlineValidator. - - - - - Default validator selector that will execute all rules that do not belong to a RuleSet. - - - - - Determines whether or not a rule should execute. - - - - - Determines whether or not a rule should execute. - - The rule - Property path (eg Customer.Address.Line1) - Contextual information - Whether or not the validator can execute. - - - - Determines whether or not a rule should execute. - - The rule - Property path (eg Customer.Address.Line1) - Contextual information - Whether or not the validator can execute. - - - - Custom IValidationRule for performing custom logic. - - - - - - Defines a rule associated with a property which can have multiple validators. - - - - - Performs validation using a validation context and returns a collection of Validation Failures. - - Validation Context - A collection of validation failures - - - - The validators that are grouped under this rule. - - - - - Name of the rule-set to which this rule belongs. - - - - - Creates a new DelegateValidator using the specified function to perform validation. - - - - - Creates a new DelegateValidator using the specified function to perform validation. - - - - - Performs validation using a validation context and returns a collection of Validation Failures. - - Validation Context - A collection of validation failures - - - - Performs validation using a validation context and returns a collection of Validation Failures. - - Validation Context - A collection of validation failures - - - - Rule set to which this rule belongs. - - - - - The validators that are grouped under this rule. - - - - - Useful extensions - - - - - Gets a MemberInfo from a member expression. - - - - - Gets a MemberInfo from a member expression. - - - - - Splits pascal case, so "FooBar" would become "Foo Bar" - - - - - Helper method to construct a constant expression from a constant. - - Type of object being validated - Type of property being validated - The value being compared - - - - - Based on a child validator and a propery rule, infers whether the validator should be wrapped in a ChildValidatorAdaptor or a CollectionValidatorAdaptor - - - - - Instancace cache. - TODO: This isn't actually completely thread safe. It would be much better to use ConcurrentDictionary, but this isn't available in Silverlight/WP7. - - - - - Gets or creates an instance using Activator.CreateInstance - - The type to instantiate - The instantiated object - - - - Gets or creates an instance using a custom factory - - The type to instantiate - The custom factory - The instantiated object - - - - Selects validators that are associated with a particular property. - - - - - Creates a new instance of MemberNameValidatorSelector. - - - - - Determines whether or not a rule should execute. - - The rule - Property path (eg Customer.Address.Line1) - Contextual information - Whether or not the validator can execute. - - - - Creates a MemberNameValidatorSelector from a collection of expressions. - - - - - Assists in the construction of validation messages. - - - - - Default Property Name placeholder. - - - - - Adds a value for a validation message placeholder. - - - - - - - - Appends a property name to the message. - - The name of the property - - - - - Adds additional arguments to the message for use with standard string placeholders. - - Additional arguments - - - - - Constructs the final message from the specified template. - - Message template - The message with placeholders replaced with their appropriate values - - - - Represents a chain of properties - - - - - Creates a new PropertyChain. - - - - - Creates a new PropertyChain based on another. - - - - - Adds a MemberInfo instance to the chain - - Member to add - - - - Adds a property name to the chain - - Name of the property to add - - - - Adds an indexer to the property chain. For example, if the following chain has been constructed: - Parent.Child - then calling AddIndexer(0) would convert this to: - Parent.Child[0] - - - - - - Creates a string representation of a property chain. - - - - - Checks if the current chain is the child of another chain. - For example, if chain1 were for "Parent.Child" and chain2 were for "Parent.Child.GrandChild" then - chain2.IsChildChainOf(chain1) would be true. - - The parent chain to compare - True if the current chain is the child of the other chain, otherwise false - - - - Builds a property path. - - - - - Defines a rule associated with a property. - - - - - Creates a new property rule. - - Property - Function to get the property value - Lambda expression used to create the rule - Function to get the cascade mode. - Type to validate - Container type that owns the property - - - - Creates a new property rule from a lambda expression. - - - - - Creates a new property rule from a lambda expression. - - - - - Adds a validator to the rule. - - - - - Replaces a validator in this rule. Used to wrap validators. - - - - - Display name for the property. - - - - - Performs validation using a validation context and returns a collection of Validation Failures. - - Validation Context - A collection of validation failures - - - - Invokes a property validator using the specified validation context. - - - - - Property associated with this rule. - - - - - Function that can be invoked to retrieve the value of the property. - - - - - Expression that was used to create the rule. - - - - - String source that can be used to retrieve the display name (if null, falls back to the property name) - - - - - Rule set that this rule belongs to (if specified) - - - - - Function that will be invoked if any of the validators associated with this rule fail. - - - - - The current validator being configured by this rule. - - - - - Type of the property being validated - - - - - Cascade mode for this rule. - - - - - Validators associated with this rule. - - - - - Returns the property name for the property being validated. - Returns null if it is not a property being validated (eg a method call) - - - - - Builds a validation rule and constructs a validator. - - Type of object being validated - Type of property being validated - - - - Rule builder that starts the chain - - - - - - - Creates a new instance of the RuleBuilder class. - - - - - Sets the validator associated with the rule. - - The validator to set - - - - - Sets the validator associated with the rule. Use with complex properties where an IValidator instance is already declared for the property type. - - The validator to set - - - - The rule being created by this RuleBuilder. - - - - - Selects validators that belong to the specified rulesets. - - - - - Creates a new instance of the RulesetValidatorSelector. - - - - - Determines whether or not a rule should execute. - - The rule - Property path (eg Customer.Address.Line1) - Contextual information - Whether or not the validator can execute. - - - - Provides metadata about a validator. - - - - - Gets the name display name for a property. - - - - - Gets a collection of validators grouped by property. - - - - - Gets validators for a particular property. - - - - - Gets rules for a property. - - - - - Builds a delegate for retrieving a localised resource from a resource type and property name. - - - - - Gets a function that can be used to retrieve a message from a resource type and resource name. - - - - - Builds a delegate for retrieving a localised resource from a resource type and property name. - - - - - Builds a function used to retrieve the resource. - - - - - Gets the PropertyInfo for a resource. - ResourceType and ResourceName are ref parameters to allow derived types - to replace the type/name of the resource before the delegate is constructed. - - - - - Implemenetation of IResourceAccessorBuilder that can fall back to the default resource provider. - - - - - Gets the PropertyInfo for a resource. - ResourceType and ResourceName are ref parameters to allow derived types - to replace the type/name of the resource before the delegate is constructed. - - - - - Provides error message templates - - - - - Construct the error message template - - Error message template - - - - The name of the resource if localized. - - - - - The type of the resource provider if localized. - - - - - Represents a localized string. - - - - - Creates a new instance of the LocalizedErrorMessageSource class using the specified resource name and resource type. - - The resource type - The resource name - Strategy used to construct the resource accessor - - - - Creates an IErrorMessageSource from an expression: () => MyResources.SomeResourceName - - The expression - Strategy used to construct the resource accessor - Error message source - - - - Construct the error message template - - Error message template - - - - The name of the resource if localized. - - - - - The type of the resource provider if localized. - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - Looks up a localized string similar to '{PropertyName}' is not a valid credit card number.. - - - - - Looks up a localized string similar to '{PropertyName}' is not a valid email address.. - - - - - Looks up a localized string similar to '{PropertyName}' should be equal to '{PropertyValue}'.. - - - - - Looks up a localized string similar to '{PropertyName}' must be {MaxLength} characters in length. You entered {TotalLength} characters.. - - - - - Looks up a localized string similar to '{PropertyName}' must be between {From} and {To} (exclusive). You entered {Value}.. - - - - - Looks up a localized string similar to '{PropertyName}' must be greater than '{ComparisonValue}'.. - - - - - Looks up a localized string similar to '{PropertyName}' must be greater than or equal to '{ComparisonValue}'.. - - - - - Looks up a localized string similar to '{PropertyName}' must be between {From} and {To}. You entered {Value}.. - - - - - Looks up a localized string similar to '{PropertyName}' must be between {MinLength} and {MaxLength} characters. You entered {TotalLength} characters.. - - - - - Looks up a localized string similar to '{PropertyName}' must be less than '{ComparisonValue}'.. - - - - - Looks up a localized string similar to '{PropertyName}' must be less than or equal to '{ComparisonValue}'.. - - - - - Looks up a localized string similar to '{PropertyName}' should not be empty.. - - - - - Looks up a localized string similar to '{PropertyName}' should not be equal to '{PropertyValue}'.. - - - - - Looks up a localized string similar to '{PropertyName}' must not be empty.. - - - - - Looks up a localized string similar to The specified condition was not met for '{PropertyName}'.. - - - - - Looks up a localized string similar to '{PropertyName}' is not in the correct format.. - - - - - Represents a static string. - - - - - Creates a new StringErrorMessageSource using the specified error message as the error template. - - The error message template. - - - - Construct the error message template - - Error message template - - - - The name of the resource if localized. - - - - - The type of the resource provider if localized. - - - - - Creates a new validation failure. - - - - - Creates a new ValidationFailure. - - - - - Creates a textual representation of the failure. - - - - - The name of the property. - - - - - The error message - - - - - The error code - - - - - The property value that caused the failure. - - - - - Custom state associated with the failure. - - - - - Used for providing metadata about a validator. - - - - - A custom property validator. - This interface should not be implemented directly in your code as it is subject to change. - Please inherit from PropertyValidator instead. - - - - - Creates an error validation result for this validator. - - The validator context - Returns an error validation result. - - - - Ensures that the property value is a valid credit card number. - - - - - Provides access to the anti-forgery system, which provides protection against - Cross-site Request Forgery (XSRF, also called CSRF) attacks. - - - - - Generates an anti-forgery token for this request. This token can - be validated by calling the Validate() method. - - An HTML string corresponding to an <input type="hidden"> - element. This element should be put inside a <form>. - - This method has a side effect: it may set a response cookie. - - - - - Generates an anti-forgery token pair (cookie and form token) for this request. - This method is similar to GetHtml(), but this method gives the caller control - over how to persist the returned values. To validate these tokens, call the - appropriate overload of Validate. - - The anti-forgery token - if any - that already existed - for this request. May be null. The anti-forgery system will try to reuse this cookie - value when generating a matching form token. - Will contain a new cookie value if the old cookie token - was null or invalid. If this value is non-null when the method completes, the caller - must persist this value in the form of a response cookie, and the existing cookie value - should be discarded. If this value is null when the method completes, the existing - cookie value was valid and needn't be modified. - The value that should be stored in the <form>. The caller - should take care not to accidentally swap the cookie and form tokens. - - Unlike the GetHtml() method, this method has no side effect. The caller - is responsible for setting the response cookie and injecting the returned - form token as appropriate. - - - - - Validates an anti-forgery token that was supplied for this request. - The anti-forgery token may be generated by calling GetHtml(). - - - Throws an HttpAntiForgeryException if validation fails. - - - - - Validates an anti-forgery token pair that was generated by the GetTokens method. - - The token that was supplied in the request cookie. - The token that was supplied in the request form body. - - Throws an HttpAntiForgeryException if validation fails. - - - - - Provides programmatic configuration for the anti-forgery token system. - - - - - Specifies an object that can provide additional data to put into all - generated tokens and that can validate additional data in incoming - tokens. - - - - - Specifies the name of the cookie that is used by the anti-forgery - system. - - - If an explicit name is not provided, the system will automatically - generate a name. - - - - - Specifies whether SSL is required for the anti-forgery system - to operate. If this setting is 'true' and a non-SSL request - comes into the system, all anti-forgery APIs will fail. - - - - - Specifies whether the anti-forgery system should skip checking - for conditions that might indicate misuse of the system. Please - use caution when setting this switch, as improper use could open - security holes in the application. - - - Setting this switch will disable several checks, including: - - Identity.IsAuthenticated = true without Identity.Name being set - - special-casing claims-based identities - - - - - If claims-based authorization is in use, specifies the claim - type from the identity that is used to uniquely identify the - user. If this property is set, all claims-based identities - must return unique values for this claim type. - - - If claims-based authorization is in use and this property has - not been set, the anti-forgery system will automatically look - for claim types "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier" - and "http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider". - - - - - Allows providing or validating additional custom data for anti-forgery tokens. - For example, the developer could use this to supply a nonce when the token is - generated, then he could validate the nonce when the token is validated. - - - The anti-forgery system already embeds the client's username within the - generated tokens. This interface provides and consumes supplemental - data. If an incoming anti-forgery token contains supplemental data but no - additional data provider is configured, the supplemental data will not be - validated. - - - - - Provides additional data to be stored for the anti-forgery tokens generated - during this request. - - Information about the current request. - Supplemental data to embed within the anti-forgery token. - - - - Validates additional data that was embedded inside an incoming anti-forgery - token. - - Information about the current request. - Supplemental data that was embedded within the token. - True if the data is valid; false if the data is invalid. - - - - Initializes a new instance of the class. - - The base scope. - - The dictionary to use as a storage. Since the dictionary would be used as-is, we expect the implementer to - use the same key-value comparison logic as we do here. - - - - - Custom comparer for the context dictionaries - The comparer treats strings as a special case, performing case insesitive comparison. - This guaratees that we remain consistent throughout the chain of contexts since PageData dictionary - behaves in this manner. - - - - - End a ServiceStack Request - - - - - End a ServiceStack Request - - - - - End a HttpHandler Request - - - - - End a HttpHandler Request - - - - - End a ServiceStack Request with no content - - - - - Main container class for components, supporting container hierarchies and - lifetime management of instances. - - - - - Initializes a new empty container. - - - - - Creates a child container of the current one, which exposes its - current service registration to the new child container. - - - - - Disposes the container and all instances owned by it (see - ), as well as all child containers - created through . - - - - - Registers a service instance with the container. This instance - will have and - behavior. - Service instance to use. - - - - Registers a named service instance with the container. This instance - will have and - behavior. - Name of the service to register.Service instance to use. - - - - Retrieves a function that can be used to lazily resolve an instance - of the service when needed. - Type of the service to retrieve.The function that can resolve to the service instance when invoked.The requested service has not been registered previously. - - - - - - - - - - - - - - - - - - - - - - Retrieves a function that can be used to lazily resolve an instance - of the service with the given name when needed. - Type of the service to retrieve.Name of the service to retrieve.The function that can resolve to the service instance with the given name when invoked.The requested service with the given name has not been registered previously. - - - - Retrieves a function that can be used to lazily resolve an instance - of the service of the given type, name and service constructor arguments when needed. - Name of the service to retrieve.The function that can resolve to the service instance with the given and service constructor arguments name when invoked.The requested service with the given name and constructor arguments has not been registered previously. - - - - Retrieves a function that can be used to lazily resolve an instance - of the service of the given type, name and service constructor arguments when needed. - Name of the service to retrieve.The function that can resolve to the service instance with the given and service constructor arguments name when invoked.The requested service with the given name and constructor arguments has not been registered previously. - - - - Retrieves a function that can be used to lazily resolve an instance - of the service of the given type, name and service constructor arguments when needed. - Name of the service to retrieve.The function that can resolve to the service instance with the given and service constructor arguments name when invoked.The requested service with the given name and constructor arguments has not been registered previously. - - - - Retrieves a function that can be used to lazily resolve an instance - of the service of the given type, name and service constructor arguments when needed. - Name of the service to retrieve.The function that can resolve to the service instance with the given and service constructor arguments name when invoked.The requested service with the given name and constructor arguments has not been registered previously. - - - - Retrieves a function that can be used to lazily resolve an instance - of the service of the given type, name and service constructor arguments when needed. - Name of the service to retrieve.The function that can resolve to the service instance with the given and service constructor arguments name when invoked.The requested service with the given name and constructor arguments has not been registered previously. - - - - Retrieves a function that can be used to lazily resolve an instance - of the service of the given type, name and service constructor arguments when needed. - Name of the service to retrieve.The function that can resolve to the service instance with the given and service constructor arguments name when invoked.The requested service with the given name and constructor arguments has not been registered previously. - - - - Registers the given service by providing a factory delegate to - instantiate it. - The service type to register.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.Third argument that should be passed to the factory delegate to create the instace.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.Third argument that should be passed to the factory delegate to create the instace.Fourth argument that should be passed to the factory delegate to create the instace.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.Third argument that should be passed to the factory delegate to create the instace.Fourth argument that should be passed to the factory delegate to create the instace.Fifth argument that should be passed to the factory delegate to create the instace.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.Third argument that should be passed to the factory delegate to create the instace.Fourth argument that should be passed to the factory delegate to create the instace.Fifth argument that should be passed to the factory delegate to create the instace.Sixth argument that should be passed to the factory delegate to create the instace.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given named service by providing a factory delegate to - instantiate it. - The service type to register.A name used to differenciate this service registration.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given named service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.A name used to differenciate this service registration.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given named service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.A name used to differenciate this service registration.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given named service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.Third argument that should be passed to the factory delegate to create the instace.A name used to differenciate this service registration.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given named service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.Third argument that should be passed to the factory delegate to create the instace.Fourth argument that should be passed to the factory delegate to create the instace.A name used to differenciate this service registration.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given named service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.Third argument that should be passed to the factory delegate to create the instace.Fourth argument that should be passed to the factory delegate to create the instace.Fifth argument that should be passed to the factory delegate to create the instace.A name used to differenciate this service registration.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Registers the given named service by providing a factory delegate that receives arguments to - instantiate it. - The service type to register.First argument that should be passed to the factory delegate to create the instace.Second argument that should be passed to the factory delegate to create the instace.Third argument that should be passed to the factory delegate to create the instace.Fourth argument that should be passed to the factory delegate to create the instace.Fifth argument that should be passed to the factory delegate to create the instace.Sixth argument that should be passed to the factory delegate to create the instace.A name used to differenciate this service registration.The factory delegate to initialize new instances of the service when needed.The registration object to perform further configuration via its fluent interface. - - - - Resolves the given service by type, without passing any arguments for - its construction. - Type of the service to retrieve.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.Fifth argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.Fifth argument to pass to the factory delegate that may create the instace.Sixth argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type and name, without passing arguments for its initialization. - Type of the service to retrieve.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type and name, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type and name, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type and name, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type and name, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type and name, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.Fifth argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Resolves the given service by type and name, passing the given arguments - for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.Fifth argument to pass to the factory delegate that may create the instace.Sixth argument to pass to the factory delegate that may create the instace.The resolved service instance.The given service could not be resolved. - - - - Attempts to resolve the given service by type, without passing arguments for its initialization. - Type of the service to retrieve. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.Fifth argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.Fifth argument to pass to the factory delegate that may create the instace.Sixth argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type and name, without passing - arguments arguments for its initialization. - Type of the service to retrieve. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type and name, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type and name, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type and name, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type and name, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type and name, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.Fifth argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Attempts to resolve the given service by type and name, passing the - given arguments arguments for its initialization. - Type of the service to retrieve.First argument to pass to the factory delegate that may create the instace.Second argument to pass to the factory delegate that may create the instace.Third argument to pass to the factory delegate that may create the instace.Fourth argument to pass to the factory delegate that may create the instace.Fifth argument to pass to the factory delegate that may create the instace.Sixth argument to pass to the factory delegate that may create the instace. - The resolved service instance or if it cannot be resolved. - - - - - Register an autowired dependency - - - - - - Register an autowired dependency as a separate type - - - - - - Alias for RegisterAutoWiredAs - - - - - - Auto-wires an existing instance, - ie all public properties are tried to be resolved. - - - - - - Generates a function which creates and auto-wires . - - - - - - - - Auto-wires an existing instance of a specific type. - The auto-wiring progress is also cached to be faster - when calling next time with the same type. - - - - - - Default owner for new registrations. by default. - - - - - Default reuse scope for new registrations. by default. - - - - - Enable the Registration feature and configure the RegistrationService. - - - - - Registers the type in the IoC container and - adds auto-wiring to the specified type. - - - - - - - Registers the type in the IoC container and - adds auto-wiring to the specified type. - The reuse scope is set to none (transient). - - - - - - Registers the types in the IoC container and - adds auto-wiring to the specified types. - The reuse scope is set to none (transient). - - - - - - Register a singleton instance as a runtime type - - - - - Encapsulates a method that has five parameters and returns a value of the - type specified by the parameter. - - - - - Encapsulates a method that has six parameters and returns a value of the - type specified by the parameter. - - - - - Encapsulates a method that has seven parameters and returns a value of the - type specified by the parameter. - - - - - Helper interface used to hide the base - members from the fluent API to make for much cleaner - Visual Studio intellisense experience. - - - - - - - - - - - - - - - - - Funqlets are a set of components provided as a package - to an existing container (like a module). - - - - - Configure the given container with the - registrations provided by the funqlet. - - Container to register. - - - - Interface used by plugins to contribute registrations - to an existing container. - - - - - Determines who is responsible for disposing instances - registered with a container. - - - - - Container should dispose provided instances when it is disposed. This is the - default. - - - - - Container does not dispose provided instances. - - - - - Default owner, which equals . - - - - - Exception thrown by the container when a service cannot be resolved. - - - - - Initializes the exception with the service that could not be resolved. - - - - - Initializes the exception with the service (and its name) that could not be resolved. - - - - - Initializes the exception with an arbitrary message. - - - - - Determines visibility and reuse of instances provided by the container. - - - - - Instances are reused within a container hierarchy. Instances - are created (if necessary) in the container where the registration - was performed, and are reused by all descendent containers. - - - - - Instances are reused only at the given container. Descendent - containers do not reuse parent container instances and get - a new instance at their level. - - - - - Each request to resolve the dependency will result in a new - instance being returned. - - - - - Instaces are reused within the given request - - - - - Default scope, which equals . - - - - - Fluent API for customizing the registration of a service. - - - - - Fluent API that exposes both - and owner (). - - - - - Fluent API that allows specifying the reuse instances. - - - - - Specifies how instances are reused within a container or hierarchy. Default - scope is . - - - - - Fluent API that allows specifying the owner of instances - created from a registration. - - - - - Specifies the owner of instances created from this registration. Default - owner is . - - - - - Ownership setting for the service. - - - - - Reuse scope setting for the service. - - - - - The container where the entry was registered. - - - - - Specifies the owner for instances, which determines how - they will be disposed. - - - - - Specifies the scope for instances, which determines - visibility of instances across containers and hierarchies. - - - - - Fluent API for customizing the registration of a service. - - - - - Fluent API that allows registering an initializer for the - service. - - - - - Specifies an initializer that should be invoked after - the service instance has been created by the factory. - - - - - The Func delegate that creates instances of the service. - - - - - The cached service instance if the scope is or - . - - - - - The Func delegate that initializes the object after creation. - - - - - Clones the service entry assigning the to the - . Does not copy the . - - - - - BaseProfilerProvider. This providers some helper methods which provide access to - internals not otherwise available. - To use, override the , and - methods. - - - - - A provider used to create instances and maintain the current instance. - - - - - Starts a new MiniProfiler and sets it to be current. By the end of this method - should return the new MiniProfiler. - - - - - Ends the current profiling session, if one exists. - - - When true, clears the for this HttpContext, allowing profiling to - be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled. - - - - - Returns the current MiniProfiler. This is used by . - - - - - - Starts a new MiniProfiler and sets it to be current. By the end of this method - should return the new MiniProfiler. - - - - - Stops the current MiniProfiler (if any is currently running). - should be called if is false - - If true, any current results will be thrown away and nothing saved - - - - Returns the current MiniProfiler. This is used by . - - - - - - Sets to be active (read to start profiling) - This should be called once a new MiniProfiler has been created. - - The profiler to set to active - If is null - - - - Stops the profiler and marks it as inactive. - - The profiler to stop - True if successful, false if Stop had previously been called on this profiler - If is null - - - - Calls to save the current - profiler using the current storage settings - - - - - - Categories of sql statements. - - - - - Unknown - - - - - DML statements that alter database state, e.g. INSERT, UPDATE - - - - - Statements that return a single record - - - - - Statements that iterate over a result set - - - - - A callback for ProfiledDbConnection and family - - - - - Called when a command starts executing - - - - - - - Called when a reader finishes executing - - - - - - - - Called when a reader is done iterating through the data - - - - - - Called when an error happens during execution of a command - - - - - - - - True if the profiler instance is active - - - - - This is a micro-cache; suitable when the number of terms is controllable (a few hundred, for example), - and strictly append-only; you cannot change existing values. All key matches are on **REFERENCE** - equality. The type is fully thread-safe. - - - - - If the underlying command supports BindByName, this sets/clears the underlying - implementation accordingly. This is required to support OracleCommand from dapper-dot-net - - - - - Wraps a database connection, allowing sql execution timings to be collected when a session is started. - - - - - This will be made private; use - - - - - This will be made private; use - - - - - Returns a new that wraps , - providing query execution profiling. If profiler is null, no profiling will occur. - - Your provider-specific flavor of connection, e.g. SqlConnection, OracleConnection - The currently started or null. - Determines whether the ProfiledDbConnection will dispose the underlying connection. - - - - The underlying, real database connection to your db provider. - - - - - The current profiler instance; could be null. - - - - - The raw connection this is wrapping - - - - - Wrapper for a db provider factory to enable profiling - - - - - Every provider factory must have an Instance public field - - - - - Used for db provider apis internally - - - - - Allow to re-init the provider factory. - - - - - - - proxy - - - - - - - proxy - - - - - proxy - - - - - proxy - - - - - proxy - - - - - proxy - - - - - proxy - - - - - proxy - - - - - proxy - - - - - proxy - - - - - Common extension methods to use only in this project - - - - - Answers true if this String is either null or empty. - - - - - Answers true if this String is neither null or empty. - - - - - Removes trailing / characters from a path and leaves just one - - - - - Removes any leading / characters from a path - - - - - Removes any leading / characters from a path - - - - - Serializes to a json string. - - - - - Gets part of a stack trace containing only methods we care about. - - - - - Gets the current formatted and filted stack trace. - - Space separated list of methods - - - - Identifies users based on ip address. - - - - - Provides functionality to identify which user is profiling a request. - - - - - Returns a string to identify the user profiling the current 'request'. - - The current HttpRequest being profiled. - - - - Returns the paramter HttpRequest's client ip address. - - - - - A single MiniProfiler can be used to represent any number of steps/levels in a call-graph, via Step() - - Totally baller. - - - - Starts when this profiler is instantiated. Each step will use this Stopwatch's current ticks as - their starting time. - - - - - Creates and starts a new MiniProfiler for the root , filtering steps to . - - - - - Returns the 's and this profiler recorded. - - - - - Returns true if Ids match. - - - - - Returns hashcode of Id. - - - - - Obsolete - used for serialization. - - - - - Walks the hierarchy contained in this profiler, starting with , and returns each Timing found. - - - - - Returns milliseconds based on Stopwatch's Frequency. - - - - - Starts a new MiniProfiler based on the current . This new profiler can be accessed by - - - - - - Ends the current profiling session, if one exists. - - - When true, clears the for this HttpContext, allowing profiling to - be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled. - - - - - Returns an that will time the code between its creation and disposal. Use this method when you - do not wish to include the MvcMiniProfiler namespace for the extension method. - - A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime. - This step's visibility level; allows filtering when is called. - - - - Returns the css and javascript includes needed to display the MiniProfiler results UI. - - Which side of the page the profiler popup button should be displayed on (defaults to left) - Whether to show trivial timings by default (defaults to false) - Whether to show time the time with children column by default (defaults to false) - The maximum number of trace popups to show before removing the oldest (defaults to 15) - xhtml rendering mode, ensure script tag is closed ... etc - when true, shows buttons to minimize and clear MiniProfiler results - Script and link elements normally; an empty string when there is no active profiling session. - - - - Renders the current to json. - - - - - Renders the parameter to json. - - - - - Deserializes the json string parameter to a . - - - - - Create a DEEP clone of this object - - - - - - Returns all currently open commands on this connection - - - - - Returns all results contained in all child steps. - - - - - Contains any sql statements that are executed, along with how many times those statements are executed. - - - - - Adds to the current . - - - - - Returns the number of sql statements of that were executed in all s. - - - - - Identifies this Profiler so it may be stored/cached. - - - - - A display name for this profiling session. - - - - - When this profiler was instantiated. - - - - - Where this profiler was run. - - - - - Allows filtering of steps based on what - the steps are created with. - - - - - The first that is created and started when this profiler is instantiated. - All other s will be children of this one. - - - - - A string identifying the user/client that is profiling this request. Set - with an -implementing class to provide a custom value. - - - If this is not set manually at some point, the implementation will be used; - by default, this will be the current request's ip address. - - - - - Returns true when this MiniProfiler has been viewed by the that recorded it. - - - Allows POSTs that result in a redirect to be profiled. implementation - will keep a list of all profilers that haven't been fetched down. - - - - - For unit testing, returns the timer. - - - - - Milliseconds, to one decimal place, that this MiniProfiler ran. - - - - - Returns true when or any of its are . - - - - - Returns true when all child s are . - - - - - Any Timing step with a duration less than or equal to this will be hidden by default in the UI; defaults to 2.0 ms. - - - - - Ticks since this MiniProfiler was started. - - - - - Points to the currently executing Timing. - - - - - Gets the currently running MiniProfiler for the current HttpContext; null if no MiniProfiler was ed. - - - - - Contains information about queries executed during this profiling session. - - - - - Milliseconds, to one decimal place, that this MiniProfiler was executing sql. - - - - - Returns true when we have profiled queries. - - - - - Returns true when any child Timings have duplicate queries. - - - - - How many sql data readers were executed in all steps. - - - - - How many sql scalar queries were executed in all steps. - - - - - How many sql non-query statements were executed in all steps. - - - - - Various configuration properties. - - - - - Excludes the specified assembly from the stack trace output. - - The short name of the assembly. AssemblyName.Name - - - - Excludes the specified type from the stack trace output. - - The System.Type name to exclude - - - - Excludes the specified method name from the stack trace output. - - The name of the method - - - - Make sure we can at least store profiler results to the http runtime cache. - - - - - Assemblies to exclude from the stack trace report. - - - - - Types to exclude from the stack trace report. - - - - - Methods to exclude from the stack trace report. - - - - - The max length of the stack string to report back; defaults to 120 chars. - - - - - Any Timing step with a duration less than or equal to this will be hidden by default in the UI; defaults to 2.0 ms. - - - - - Dictates if the "time with children" column is displayed by default, defaults to false. - For a per-page override you can use .RenderIncludes(showTimeWithChildren: true/false) - - - - - Dictates if trivial timings are displayed by default, defaults to false. - For a per-page override you can use .RenderIncludes(showTrivial: true/false) - - - - - Determines how many traces to show before removing the oldest; defaults to 15. - For a per-page override you can use .RenderIncludes(maxTracesToShow: 10) - - - - - Dictates on which side of the page the profiler popup button is displayed; defaults to left. - For a per-page override you can use .RenderIncludes(position: RenderPosition.Left/Right) - - - - - Determines if min-max, clear, etc are rendered; defaults to false. - For a per-page override you can use .RenderIncludes(showControls: true/false) - - - - - By default, SqlTimings will grab a stack trace to help locate where queries are being executed. - When this setting is true, no stack trace will be collected, possibly improving profiler performance. - - - - - When is called, if the current request url contains any items in this property, - no profiler will be instantiated and no results will be displayed. - Default value is { "/ssr-", "/content/", "/scripts/", "/favicon.ico" }. - - - - - The path under which ALL routes are registered in, defaults to the application root. For example, "~/myDirectory/" would yield - "/myDirectory/ssr-includes.js" rather than just "/mini-profiler-includes.js" - Any setting here should be in APP RELATIVE FORM, e.g. "~/myDirectory/" - - - - - Understands how to save and load MiniProfilers. Used for caching between when - a profiling session ends and results can be fetched to the client, and for showing shared, full-page results. - - - The normal profiling session life-cycle is as follows: - 1) request begins - 2) profiler is started - 3) normal page/controller/request execution - 4) profiler is stopped - 5) profiler is cached with 's implementation of - 6) request ends - 7) page is displayed and profiling results are ajax-fetched down, pulling cached results from - 's implementation of - - - - - The formatter applied to the SQL being rendered (used only for UI) - - - - - Assembly version of this dank MiniProfiler. - - - - - The provider used to provider the current instance of a provider - This is also - - - - - A function that determines who can access the MiniProfiler results url. It should return true when - the request client has access, false for a 401 to be returned. HttpRequest parameter is the current request and - MiniProfiler parameter is the results that were profiled. - - - Both the HttpRequest and MiniProfiler parameters that will be passed into this function should never be null. - - - - - Allows switching out stopwatches for unit testing. - - - - - Categorizes individual steps to allow filtering. - - - - - Default level given to Timings. - - - - - Useful when profiling many items in a loop, but you don't wish to always see this detail. - - - - - Dictates on which side of the page the profiler popup button is displayed; defaults to left. - - - - - Profiler popup button is displayed on the left. - - - - - Profiler popup button is displayed on the right. - - - - - Contains helper methods that ease working with null s. - - - - - Wraps in a call and executes it, returning its result. - - The current profiling session or null. - Method to execute and profile. - The step name used to label the profiler results. - - - - - Returns an that will time the code between its creation and disposal. - - The current profiling session or null. - A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime. - This step's visibility level; allows filtering when is called. - - - - Adds 's hierarchy to this profiler's current Timing step, - allowing other threads, remote calls, etc. to be profiled and joined into this profiling session. - - - - - Returns an html-encoded string with a text-representation of ; returns "" when profiler is null. - - The current profiling session or null. - - - - Formats any SQL query with inline parameters, optionally including the value type - - - - - Takes a SqlTiming and returns a formatted SQL string, for parameter replacement, etc. - - - - - Return SQL the way you want it to look on the in the trace. Usually used to format parameters - - - Formatted SQL - - - - Creates a new Inline SQL Formatter, optionally including the parameter type info in comments beside the replaced value - - whether to include a comment after the value, indicating the type, e.g. /* @myParam DbType.Int32 */ - - - - Formats the SQL in a generic frieldly format, including the parameter type information in a comment if it was specified in the InlineFormatter constructor - - The SqlTiming to format - A formatted SQL string - - - - Returns a string representation of the parameter's value, including the type - - The parameter to get a value for - - - - - NOT IMPLEMENTED - will format statements with paramters in an Oracle friendly way - - - - - Does NOTHING, implement me! - - - - - Formats SQL server queries with a DECLARE up top for parameter values - - - - - Formats the SQL in a SQL-Server friendly way, with DECLARE statements for the parameters up top. - - The SqlTiming to format - A formatted SQL string - - - - Contains helper code to time sql statements. - - - - - Returns a new SqlProfiler to be used in the 'profiler' session. - - - - - Tracks when 'command' is started. - - - - - Returns all currently open commands on this connection - - - - - Finishes profiling for 'command', recording durations. - - - - - Called when 'reader' finishes its iterations and is closed. - - - - - The profiling session this SqlProfiler is part of. - - - - - Helper methods that allow operation on SqlProfilers, regardless of their instantiation. - - - - - Tracks when 'command' is started. - - - - - Finishes profiling for 'command', recording durations. - - - - - Called when 'reader' finishes its iterations and is closed. - - - - - Profiles a single sql execution. - - - - - Creates a new SqlTiming to profile 'command'. - - - - - Obsolete - used for serialization. - - - - - Returns a snippet of the sql command and the duration. - - - - - Returns true if Ids match. - - - - - Returns hashcode of Id. - - - - - Called when command execution is finished to determine this SqlTiming's duration. - - - - - Called when database reader is closed, ending profiling for SqlTimings. - - - - - To help with display, put some space around sammiched commas - - - - - Unique identifier for this SqlTiming. - - - - - Category of sql statement executed. - - - - - The sql that was executed. - - - - - The command string with special formatting applied based on MiniProfiler.Settings.SqlFormatter - - - - - Roughly where in the calling code that this sql was executed. - - - - - Offset from main MiniProfiler start that this sql began. - - - - - How long this sql statement took to execute. - - - - - When executing readers, how long it took to come back initially from the database, - before all records are fetched and reader is closed. - - - - - Stores any parameter names and values used by the profiled DbCommand. - - - - - Id of the Timing this statement was executed in. - - - Needed for database deserialization. - - - - - The Timing step that this sql execution occurred in. - - - - - True when other identical sql statements have been executed during this MiniProfiler session. - - - - - Information about a DbParameter used in the sql statement profiled by SqlTiming. - - - - - Returns true if this has the same parent , and as . - - - - - Returns the XOR of certain properties. - - - - - Which SqlTiming this Parameter was executed with. - - - - - Parameter name, e.g. "@routeName" - - - - - The value submitted to the database. - - - - - System.Data.DbType, e.g. "String", "Bit" - - - - - How large the type is, e.g. for string, size could be 4000 - - - - - Understands how to save MiniProfiler results to a MSSQL database, allowing more permanent storage and - querying of slow results. - - - - - Provides saving and loading s to a storage medium. - - - - - Stores under its . - - The results of a profiling session. - - Should also ensure the profiler is stored as being unviewed by its profiling . - - - - - Returns a from storage based on , which should map to . - - - Should also update that the resulting profiler has been marked as viewed by its profiling . - - - - - Returns a list of s that haven't been seen by . - - User identified by the current . - - - - Returns a new SqlServerDatabaseStorage object that will insert into the database identified by connectionString. - - - - - Saves 'profiler' to a database under its . - - - - - Returns the MiniProfiler identified by 'id' from the database or null when no MiniProfiler exists under that 'id'. - - - - - Returns a list of s that haven't been seen by . - - User identified by the current . - - - - Returns a DbConnection for your specific provider. - - - - - Returns a DbConnection already opened for execution. - - - - - Giving freshly selected collections, this method puts them in the correct - hierarchy under the 'result' MiniProfiler. - - - - - How we connect to the database used to save/load MiniProfiler results. - - - - - Understands how to store a to the with absolute expiration. - - - - - The string that prefixes all keys that MiniProfilers are saved under, e.g. - "mini-profiler-ecfb0050-7ce8-4bf1-bf82-2cb38e90e31e". - - - - - Returns a new HttpRuntimeCacheStorage class that will cache MiniProfilers for the specified duration. - - - - - Saves to the HttpRuntime.Cache under a key concated with - and the parameter's . - - - - - Returns the saved identified by . Also marks the resulting - profiler to true. - - - - - Returns a list of s that haven't been seen by . - - User identified by the current . - - - - Syncs access to runtime cache when adding a new list of ids for a user. - - - - - How long to cache each for (i.e. the absolute expiration parameter of - ) - - - - - An individual profiling step that can contain child steps. - - - - - Rebuilds all the parent timings on deserialization calls - - - - - Offset from parent MiniProfiler's creation that this Timing was created. - - - - - Creates a new Timing named 'name' in the 'profiler's session, with 'parent' as this Timing's immediate ancestor. - - - - - Obsolete - used for serialization. - - - - - Returns this Timing's Name. - - - - - Returns true if Ids match. - - - - - Returns hashcode of Id. - - - - - Adds arbitrary string 'value' under 'key', allowing custom properties to be stored in this Timing step. - - - - - Completes this Timing's duration and sets the MiniProfiler's Head up one level. - - - - - Add the parameter 'timing' to this Timing's Children collection. - - - Used outside this assembly for custom deserialization when creating an implementation. - - - - - Adds the parameter 'sqlTiming' to this Timing's SqlTimings collection. - - A sql statement profiling that was executed in this Timing step. - - Used outside this assembly for custom deserialization when creating an implementation. - - - - - Returns the number of sql statements of that were executed in this . - - - - - Unique identifer for this timing; set during construction. - - - - - Text displayed when this Timing is rendered. - - - - - How long this Timing step took in ms; includes any Timings' durations. - - - - - The offset from the start of profiling. - - - - - All sub-steps that occur within this Timing step. Add new children through - - - - - Stores arbitrary key/value strings on this Timing step. Add new tuples through . - - - - - Any queries that occurred during this Timing step. - - - - - Needed for database deserialization and JSON serialization. - - - - - Which Timing this Timing is under - the duration that this step takes will be added to its parent's duration. - - This will be null for the root (initial) Timing. - - - - Gets the elapsed milliseconds in this step without any children's durations. - - - - - Gets the aggregate elapsed milliseconds of all SqlTimings executed in this Timing, excluding Children Timings. - - - - - Returns true when this is less than the configured - , by default 2.0 ms. - - - - - Reference to the containing profiler, allowing this Timing to affect the Head and get Stopwatch readings. - - - - - Returns true when this Timing has inner Timing steps. - - - - - Returns true if this Timing step collected sql execution timings. - - - - - Returns true if any s executed in this step are detected as duplicate statements. - - - - - Returns true when this Timing is the first one created in a MiniProfiler session. - - - - - How far away this Timing is from the Profiler's Root. - - - - - How many sql data readers were executed in this Timing step. Does not include queries in any child Timings. - - - - - How many sql scalar queries were executed in this Timing step. Does not include queries in any child Timings. - - - - - How many sql non-query statements were executed in this Timing step. Does not include queries in any child Timings. - - - - - Understands how to route and respond to MiniProfiler UI urls. - - - - - Returns either includes' css/javascript or results' html. - - - - - Handles rendering static content files. - - - - - Handles rendering a previous MiniProfiler session, identified by its "?id=GUID" on the query. - - - - - Embedded resource contents keyed by filename. - - - - - Helper method that sets a proper 404 response code. - - - - - Try to keep everything static so we can easily be reused. - - - - - HttpContext based profiler provider. This is the default provider to use in a web context. - The current profiler is associated with a HttpContext.Current ensuring that profilers are - specific to a individual HttpRequest. - - - - - Public constructor. This also registers any UI routes needed to display results - - - - - Starts a new MiniProfiler and associates it with the current . - - - - - Ends the current profiling session, if one exists. - - - When true, clears the for this HttpContext, allowing profiling to - be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled. - - - - - Makes sure 'profiler' has a Name, pulling it from route data or url. - - - - - Returns the current profiler - - - - - - Gets the currently running MiniProfiler for the current HttpContext; null if no MiniProfiler was ed. - - - - - WebRequestProfilerProvider specific configurations - - - - - Provides user identification for a given profiling request. - - - - - Indicates that the request dto, which is associated with this attribute, - can only execute, if the user has specific permissions. - - - - - Indicates that the request dto, which is associated with this attribute, - can only execute, if the user has specific roles. - - - - - Check all session is in all supplied roles otherwise a 401 HttpError is thrown - - - - - - - Indicates that the request dto, which is associated with this attribute, - can only execute, if the user has specific permissions. - - - - - Indicates that the request dto, which is associated with this attribute, - can only execute, if the user has any of the specified roles. - - - - - Check all session is in any supplied roles otherwise a 401 HttpError is thrown - - - - - - - Base class to create response filter attributes only for specific HTTP methods (GET, POST...) - - - - - Creates a new - - Defines when the filter should be executed - - - - This method is only executed if the HTTP method matches the property. - - The http request wrapper - The http response wrapper - The response DTO - - - - Create a ShallowCopy of this instance. - - - - - - If they don't have an ICacheClient configured use an In Memory one. - - - - - Creates instance using straight Resolve approach. - This will throw an exception if resolution fails - - - - - Creates instance using the TryResolve approach if tryResolve = true. - Otherwise uses Resolve approach, which will throw an exception if resolution fails - - - - - Sets a persistent cookie which never expires - - - - - Sets a session cookie which expires after the browser session closes - - - - - Deletes a specified cookie by setting its value to empty and expiration to -1 days - - - - - Lets you Register new Services and the optional restPaths will be registered against - this default Request Type - - - - - ASP.NET or HttpListener ServiceStack host - - - - - Register dependency in AppHost IOC on Startup - - - - - AutoWired Registration of an interface with a concrete type in AppHost IOC on Startup. - - - - - Allows the clean up for executed autowired services and filters. - Calls directly after services and filters are executed. - - - - - Called at the end of each request. Enables Request Scope. - - - - - Register an Adhoc web service on Startup - - - - - Apply plugins to this AppHost - - - - - Create a service runner for IService actions - - - - - Resolve the absolute url for this request - - - - - Resolve localized text, returns itself by default. - - - - - Register user-defined custom routes. - - - - - Register custom ContentType serializers - - - - - Add Request Filters, to be applied before the dto is deserialized - - - - - Add Request Filters for HTTP Requests - - - - - Add Response Filters for HTTP Responses - - - - - Add Request Filters for MQ/TCP Requests - - - - - Add Response Filters for MQ/TCP Responses - - - - - Add alternative HTML View Engines - - - - - Provide an exception handler for unhandled exceptions - - - - - Provide an exception handler for un-caught exceptions - - - - - Skip the ServiceStack Request Pipeline and process the returned IHttpHandler instead - - - - - Provide a catch-all handler that doesn't match any routes - - - - - Use a Custom Error Handler for handling specific error HttpStatusCodes - - - - - Provide a custom model minder for a specific Request DTO - - - - - The AppHost config - - - - - List of pre-registered and user-defined plugins to be enabled in this AppHost - - - - - Virtual access to file resources - - - - - Executed immediately before a Service is executed. Use return to change the request DTO used, must be of the same type. - - - - - Executed immediately after a service is executed. Use return to change response used. - - - - - Occurs when the Service throws an Exception. - - - - - Occurs when an exception is thrown whilst processing a request. - - - - - Apply PreRequest Filters for participating Custom Handlers, e.g. RazorFormat, MarkdownFormat, etc - - - - - Applies the raw request filters. Returns whether or not the request has been handled - and no more processing should be done. - - - - - - Applies the request filters. Returns whether or not the request has been handled - and no more processing should be done. - - - - - - Applies the response filters. Returns whether or not the request has been handled - and no more processing should be done. - - - - - - The AppHost.Container. Note: it is not thread safe to register dependencies after AppStart. - - - - - Naming convention for the ResponseStatus property name on the response DTO - - - - - Create an instance of the service response dto type and inject it with the supplied responseStatus - - - - - - - - - - - - - - - - - Override to provide additional/less context about the Service Exception. - By default the request is serialized and appended to the ResponseStatus StackTrace. - - - - - Scans the supplied Assemblies to infer REST paths and HTTP verbs. - - The instance. - - The assemblies with REST services. - - The same instance; - never . - - - - Configure ServiceStack to have ISession support - - - - - Create the active Session or Permanent Session Id cookie. - - - - - - Create both Permanent and Session Id cookies and return the active sessionId - - - - - - This class interecepts 401 requests and changes them to 402 errors. When this happens the FormAuthentication module - will no longer hijack it and redirect back to login because it is a 402 error, not a 401. - When the request ends, this class sets the status code back to 401 and everything works as it should. - - PathToSupress is the path inside your website where the above swap should happen. - - If you can build for .net 4.5, you do not have to do this swap. You can take advantage of a new flag (SuppressFormsAuthenticationRedirect) - that tells the FormAuthenticationModule to not redirect, which also means you will not need the EndRequest code. - - - - - Converts the validation result to an error result which will be serialized by ServiceStack in a clean and human-readable way. - - The validation result - - - - - Converts the validation result to an error exception which will be serialized by ServiceStack in a clean and human-readable way - if the returned exception is thrown. - - The validation result - - - - - Creates a new instance of the RulesetValidatorSelector. - - - - - Determines whether or not a rule should execute. - - The rule - Property path (eg Customer.Address.Line1) - Contextual information - Whether or not the validator can execute. - - - - Activate the validation mechanism, so every request DTO with an existing validator - will be validated. - - The app host - - - - Override to provide additional/less context about the Service Exception. - By default the request is serialized and appended to the ResponseStatus StackTrace. - - - - - Auto-scans the provided assemblies for a - and registers it in the provided IoC container. - - The IoC container - The assemblies to scan for a validator - - - - In Memory repository for files. Useful for testing. - - - - - Context to capture IService action - - - - - Get an IAppHost container. - Note: Registering dependencies should only be done during setup/configuration - stage and remain immutable there after for thread-safety. - - - - - - - Ensure the same instance is used for subclasses - - - - - Called before page is executed - - - - - Called after page is executed but before it's merged with the - website template if any. - - - - - Don't HTML encode safe output - - - - - - - Return the output of a different view with the specified name - using the supplied model - - - - - - - - Resolve registered Assemblies - - - - - - Reference to MarkdownViewEngine - - - - - The AppHost so you can access configuration and resolve dependencies, etc. - - - - - This precompiled Markdown page with Metadata - - - - - ASP.NET MVC's HtmlHelper - - - - - All variables passed to and created by your page. - The Response DTO is stored and accessible via the 'Model' variable. - - All variables and outputs created are stored in ScopeArgs which is what's available - to your website template. The Generated page is stored in the 'Body' variable. - - - - - Whether HTML or Markdown output is requested - - - - - The Response DTO - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - Looks up a localized string similar to Container service is built-in and read-only.. - - - - - Looks up a localized string similar to Service type {0} does not inherit or implement {1}.. - - - - - Looks up a localized string similar to Required dependency of type {0} named '{1}' could not be resolved.. - - - - - Looks up a localized string similar to Required dependency of type {0} could not be resolved.. - - - - - Looks up a localized string similar to Unknown scope.. - - - - - Gets string value from Items[name] then Cookies[name] if exists. - Useful when *first* setting the users response cookie in the request filter. - To access the value for this initial request you need to set it in Items[]. - - string value or null if it doesn't exist - - - - Gets request paramater string value by looking in the following order: - - QueryString[name] - - FormData[name] - - Cookies[name] - - Items[name] - - string value or null if it doesn't exist - - - * - Input: http://localhost:96/Cambia3/Temp/Test.aspx/path/info?q=item#fragment - - Some HttpRequest path and URL properties: - Request.ApplicationPath: /Cambia3 - Request.CurrentExecutionFilePath: /Cambia3/Temp/Test.aspx - Request.FilePath: /Cambia3/Temp/Test.aspx - Request.Path: /Cambia3/Temp/Test.aspx/path/info - Request.PathInfo: /path/info - Request.PhysicalApplicationPath: D:\Inetpub\wwwroot\CambiaWeb\Cambia3\ - Request.QueryString: /Cambia3/Temp/Test.aspx/path/info?query=arg - Request.Url.AbsolutePath: /Cambia3/Temp/Test.aspx/path/info - Request.Url.AbsoluteUri: http://localhost:96/Cambia3/Temp/Test.aspx/path/info?query=arg - Request.Url.Fragment: - Request.Url.Host: localhost - Request.Url.LocalPath: /Cambia3/Temp/Test.aspx/path/info - Request.Url.PathAndQuery: /Cambia3/Temp/Test.aspx/path/info?query=arg - Request.Url.Port: 96 - Request.Url.Query: ?query=arg - Request.Url.Scheme: http - Request.Url.Segments: / - Cambia3/ - Temp/ - Test.aspx/ - path/ - info - * - - - - Use this to treat Request.Items[] as a cache by returning pre-computed items to save - calculating them multiple times. - - - - - Sets a persistent cookie which never expires - - - - - Sets a session cookie which expires after the browser session closes - - - - - Sets a persistent cookie which expires after the given time - - - - - Sets a persistent cookie with an expiresAt date - - - - - Deletes a specified cookie by setting its value to empty and expiration to -1 days - - - - - Returns the optimized result for the IRequestContext. - Does not use or store results in any cache. - - - - - - - - Overload for the method returning the most - optimized result based on the MimeType and CompressionType from the IRequestContext. - - - - - Overload for the method returning the most - optimized result based on the MimeType and CompressionType from the IRequestContext. - How long to cache for, null is no expiration - - - - - Clears all the serialized and compressed caches set - by the 'Resolve' method for the cacheKey provided - - - - - - - - Store an entry in the IHttpRequest.Items Dictionary - - - - - Get an entry from the IHttpRequest.Items Dictionary - - - - - For performance withPathInfoParts should already be a lower case string - to minimize redundant matching operations. - - - - - - - - For performance withPathInfoParts should already be a lower case string - to minimize redundant matching operations. - - - - - - - - - The number of segments separated by '/' determinable by path.Split('/').Length - e.g. /path/to/here.ext == 3 - - - - - The total number of segments after subparts have been exploded ('.') - e.g. /path/to/here.ext == 4 - - - - - Provide for quick lookups based on hashes that can be determined from a request url - - - - - Execute MQ - - - - - Execute MQ with requestContext - - - - - Execute using empty RequestContext - - - - - Execute HTTP - - - - - Gets the name of the base most type in the heirachy tree with the same. - - We get an exception when trying to create a schema with multiple types of the same name - like when inheriting from a DataContract with the same name. - - The type. - - - - - Inherit from this class if you want to host your web services inside an - ASP.NET application. - - - - - Inherit from this class if you want to host your web services inside a - Console Application, Windows Service, etc. - - Usage of HttpListener allows you to host webservices on the same port (:80) as IIS - however it requires admin user privillages. - - - - - Wrapper class for the HTTPListener to allow easier access to the - server, for start and stop management and event routing of the actual - inbound requests. - - - - - Starts the Web Service - - - A Uri that acts as the base that the server is listening on. - Format should be: http://127.0.0.1:8080/ or http://127.0.0.1:8080/somevirtual/ - Note: the trailing slash is required! For more info see the - HttpListener.Prefixes property on MSDN. - - - - - Shut down the Web Service - - - - - Overridable method that can be used to implement a custom hnandler - - - - - - Reserves the specified URL for non-administrator users and accounts. - http://msdn.microsoft.com/en-us/library/windows/desktop/cc307223(v=vs.85).aspx - - Reserved Url if the process completes successfully - - - - Exécute les tâches définies par l'application associées à la libération ou à la redéfinition des ressources non managées. - - 2 - - - - Load Embedded Resource Templates in ServiceStack. - To get ServiceStack to use your own instead just add a copy of one or more of the following to your Web Root: - ~/Templates/IndexOperations.html - ~/Templates/OperationControl.html - ~/Templates/HtmlFormat.html - - - - - when true, (most) bare plain URLs are auto-hyperlinked - WARNING: this is a significant deviation from the markdown spec - - - - - when true, RETURN becomes a literal newline - WARNING: this is a significant deviation from the markdown spec - - - - - use ">" for HTML output, or " />" for XHTML output - - - - - when true, problematic URL characters like [, ], (, and so forth will be encoded - WARNING: this is a significant deviation from the markdown spec - - - - - when false, email addresses will never be auto-linked - WARNING: this is a significant deviation from the markdown spec - - - - - when true, bold and italic require non-word characters on either side - WARNING: this is a significant deviation from the markdown spec - - - - - Markdown is a text-to-HTML conversion tool for web writers. - Markdown allows you to write using an easy-to-read, easy-to-write plain text format, - then convert it to structurally valid XHTML (or HTML). - - - - - Tabs are automatically converted to spaces as part of the transform - this constant determines how "wide" those tabs become in spaces - - - - - Create a new Markdown instance using default options - - - - - Create a new Markdown instance and optionally load options from a configuration - file. There they should be stored in the appSettings section, available options are: - - Markdown.StrictBoldItalic (true/false) - Markdown.EmptyElementSuffix (">" or " />" without the quotes) - Markdown.LinkEmails (true/false) - Markdown.AutoNewLines (true/false) - Markdown.AutoHyperlink (true/false) - Markdown.EncodeProblemUrlCharacters (true/false) - - - - - - Create a new Markdown instance and set the options from the MarkdownOptions object. - - - - - maximum nested depth of [] and () supported by the transform; implementation detail - - - - - In the static constuctor we'll initialize what stays the same across all transforms. - - - - - Transforms the provided Markdown-formatted text to HTML; - see http://en.wikipedia.org/wiki/Markdown - - - The order in which other subs are called here is - essential. Link and image substitutions need to happen before - EscapeSpecialChars(), so that any *'s or _'s in the a - and img tags get encoded. - - - - - Perform transformations that form block-level tags like paragraphs, headers, and list items. - - - - - Perform transformations that occur *within* block-level tags like paragraphs, headers, and list items. - - - - - splits on two or more newlines, to form "paragraphs"; - each paragraph is then unhashed (if it is a hash and unhashing isn't turned off) or wrapped in HTML p tag - - - - - Reusable pattern to match balanced [brackets]. See Friedl's - "Mastering Regular Expressions", 2nd Ed., pp. 328-331. - - - - - Reusable pattern to match balanced (parens). See Friedl's - "Mastering Regular Expressions", 2nd Ed., pp. 328-331. - - - - - Strips link definitions from text, stores the URLs and titles in hash references. - - - ^[id]: url "optional title" - - - - - derived pretty much verbatim from PHP Markdown - - - - - replaces any block-level HTML blocks with hash entries - - - - - returns an array of HTML tokens comprising the input string. Each token is - either a tag (possibly with nested, tags contained therein, such - as <a href="<MTFoo>">, or a run of text between tags. Each element of the - array is a two-element array; the first is either 'tag' or 'text'; the second is - the actual value. - - - - - Turn Markdown link shortcuts into HTML anchor tags - - - [link text](url "title") - [link text][id] - [id] - - - - - Turn Markdown image shortcuts into HTML img tags. - - - ![alt text][id] - ![alt text](url "optional title") - - - - - Turn Markdown headers into HTML header tags - - - Header 1 - ======== - - Header 2 - -------- - - # Header 1 - ## Header 2 - ## Header 2 with closing hashes ## - ... - ###### Header 6 - - - - - Turn Markdown horizontal rules into HTML hr tags - - - *** - * * * - --- - - - - - - - - - Turn Markdown lists into HTML ul and ol and li tags - - - - - Process the contents of a single ordered or unordered list, splitting it - into individual list items. - - - - - /// Turn Markdown 4-space indented code into HTML pre code blocks - - - - - Turn Markdown `code spans` into HTML code tags - - - - - Turn Markdown *italics* and **bold** into HTML strong and em tags - - - - - Turn markdown line breaks (two space at end of line) into HTML break tags - - - - - Turn Markdown > quoted blocks into HTML blockquote blocks - - - - - Turn angle-delimited URLs into HTML anchor tags - - - <http://www.example.com> - - - - - Remove one level of line-leading spaces - - - - - encodes email address randomly - roughly 10% raw, 45% hex, 45% dec - note that @ is always encoded and : never is - - - - - Encode/escape certain Markdown characters inside code blocks and spans where they are literals - - - - - Encode any ampersands (that aren't part of an HTML entity) and left or right angle brackets - - - - - Encodes any escaped characters such as \`, \*, \[ etc - - - - - swap back in all the special characters we've hidden - - - - - escapes Bold [ * ] and Italic [ _ ] characters - - - - - hex-encodes some unusual "problem" chars in URLs to avoid URL detection problems - - - - - Within tags -- meaning between < and > -- encode [\ ` * _] so they - don't conflict with their use in Markdown for code, italics and strong. - We're replacing each such character with its corresponding hash - value; this is likely overkill, but it should prevent us from colliding - with the escape values by accident. - - - - - convert all tabs to _tabWidth spaces; - standardizes line endings from DOS (CR LF) or Mac (CR) to UNIX (LF); - makes sure text ends with a couple of newlines; - removes any blank lines (only spaces) in the text - - - - - this is to emulate what's evailable in PHP - - - - - use ">" for HTML output, or " />" for XHTML output - - - - - when false, email addresses will never be auto-linked - WARNING: this is a significant deviation from the markdown spec - - - - - when true, bold and italic require non-word characters on either side - WARNING: this is a significant deviation from the markdown spec - - - - - when true, RETURN becomes a literal newline - WARNING: this is a significant deviation from the markdown spec - - - - - when true, (most) bare plain URLs are auto-hyperlinked - WARNING: this is a significant deviation from the markdown spec - - - - - when true, problematic URL characters like [, ], (, and so forth will be encoded - WARNING: this is a significant deviation from the markdown spec - - - - - current version of MarkdownSharp; - see http://code.google.com/p/markdownsharp/ for the latest code or to contribute - - - - - Render Markdown for text/markdown and text/plain ContentTypes - - - - - Used in Unit tests - - - - - - Non ASP.NET requests - - - - - - - - ASP.NET requests - - - - - - Writes to response. - Response headers are customizable by implementing IHasOptions an returning Dictionary of Http headers. - - The response. - Whether or not it was implicity handled by ServiceStack's built-in handlers. - The default action. - The serialization context. - Add prefix to response body if any - Add suffix to response body if any - - - - - Highly optimized code to find if GZIP is supported from: - - http://dotnetperls.com/gzip-request - - Other resources for GZip, deflate resources: - - http://www.west-wind.com/Weblog/posts/10564.aspx - - http://www.west-wind.com/WebLog/posts/102969.aspx - - ICSharpCode - - - - - Changes the links for the servicestack/metadata page - - - - - Non ASP.NET requests - - - - - ASP.NET requests - - - - - Keep default file contents in-memory - - - - - - Call to signal the completion of a ServiceStack-handled Request - - - - - Resolves and auto-wires a ServiceStack Service from a ASP.NET HttpContext. - - - - - Resolves and auto-wires a ServiceStack Service from a HttpListenerContext. - - - - - Resolves and auto-wires a ServiceStack Service. - - - - diff --git a/lib/signed/System.Web.Razor.dll b/lib/signed/System.Web.Razor.dll deleted file mode 100644 index 8668fb6ba57..00000000000 Binary files a/lib/signed/System.Web.Razor.dll and /dev/null differ diff --git a/lib/signed/System.Web.Razor.xml b/lib/signed/System.Web.Razor.xml deleted file mode 100644 index b42f27cb916..00000000000 --- a/lib/signed/System.Web.Razor.xml +++ /dev/null @@ -1,4359 +0,0 @@ - - - - System.Web.Razor - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - . - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - Enumerates the list of Visual Basic keywords. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. - - - \ No newline at end of file diff --git a/lib/sl5/ServiceStack.Client.dll b/lib/sl5/ServiceStack.Client.dll deleted file mode 100644 index a636b5b09de..00000000000 Binary files a/lib/sl5/ServiceStack.Client.dll and /dev/null differ diff --git a/lib/sl5/ServiceStack.Text.dll b/lib/sl5/ServiceStack.Text.dll deleted file mode 100644 index c939c6df59c..00000000000 Binary files a/lib/sl5/ServiceStack.Text.dll and /dev/null differ diff --git a/lib/sl5/ServiceStack.Text.pdb b/lib/sl5/ServiceStack.Text.pdb deleted file mode 100644 index 36e53a6e54e..00000000000 Binary files a/lib/sl5/ServiceStack.Text.pdb and /dev/null differ diff --git a/lib/sl5/ServiceStack.Text.xml b/lib/sl5/ServiceStack.Text.xml deleted file mode 100644 index cc924f71f6a..00000000000 --- a/lib/sl5/ServiceStack.Text.xml +++ /dev/null @@ -1,2212 +0,0 @@ - - - - ServiceStack.Text - - - - - Utils to load types - - - - - Find the type from the name supplied - - [typeName] or [typeName, assemblyName] - - - - - The top-most interface of the given type, if any. - - - - - Find type if it exists - - - - The type if it exists - - - - Populate an object with Example data. - - - - - - - Populates the object with example data. - - - Tracks how deeply nested we are - - - - - Search key structure for - - Type of the key. - Type of the value. - - - - A Concurrent implementation. - - Type of the keys. - Type of the values. - - This class is threadsafe and highly concurrent. This means that multiple threads can do lookup and insert operations - on this dictionary simultaneously. - It is not guaranteed that collisions will not occur. The dictionary is partitioned in segments. A segment contains - a set of items based on a hash of those items. The more segments there are and the beter the hash, the fewer collisions will occur. - This means that a nearly empty ConcurrentDictionary is not as concurrent as one containing many items. - - - - - Base class for concurrent hashtable implementations - - Type of the items stored in the hashtable. - Type of the key to search with. - - - - Constructor (protected) - - Use Initialize method after construction. - - - - Initialize the newly created ConcurrentHashtable. Invoke in final (sealed) constructor - or Create method. - - - - - Create a segment range - - Number of segments in range. - Number of slots allocated initialy in each segment. - The created instance. - - - - While adjusting the segmentation, _NewRange will hold a reference to the new range of segments. - when the adjustment is complete this reference will be copied to _CurrentRange. - - - - - Will hold the most current reange of segments. When busy adjusting the segmentation, this - field will hold a reference to the old range. - - - - - While adjusting the segmentation this field will hold a boundary. - Clients accessing items with a key hash value below this boundary (unsigned compared) - will access _NewRange. The others will access _CurrentRange - - - - - Get a hashcode for given storeable item. - - Reference to the item to get a hash value for. - The hash value as an . - - The hash returned should be properly randomized hash. The standard GetItemHashCode methods are usually not good enough. - A storeable item and a matching search key should return the same hash code. - So the statement ItemEqualsItem(storeableItem, searchKey) ? GetItemHashCode(storeableItem) == GetItemHashCode(searchKey) : true should always be true; - - - - - Get a hashcode for given search key. - - Reference to the key to get a hash value for. - The hash value as an . - - The hash returned should be properly randomized hash. The standard GetItemHashCode methods are usually not good enough. - A storeable item and a matching search key should return the same hash code. - So the statement ItemEqualsItem(storeableItem, searchKey) ? GetItemHashCode(storeableItem) == GetItemHashCode(searchKey) : true should always be true; - - - - - Compares a storeable item to a search key. Should return true if they match. - - Reference to the storeable item to compare. - Reference to the search key to compare. - True if the storeable item and search key match; false otherwise. - - - - Compares two storeable items for equality. - - Reference to the first storeable item to compare. - Reference to the second storeable item to compare. - True if the two soreable items should be regarded as equal. - - - - Indicates if a specific item reference contains a valid item. - - The storeable item reference to check. - True if the reference doesn't refer to a valid item; false otherwise. - The statement IsEmpty(default(TStoredI)) should always be true. - - - - Returns the type of the key value or object. - - The stored item to get the type of the key for. - The actual type of the key or null if it can not be determined. - - Used for diagnostics purposes. - - - - - Gets a segment out of either _NewRange or _CurrentRange based on the hash value. - - - - - - - Gets a LOCKED segment out of either _NewRange or _CurrentRange based on the hash value. - Unlock needs to be called on this segment before it can be used by other clients. - - - - - - - Gets a LOCKED segment out of either _NewRange or _CurrentRange based on the hash value. - Unlock needs to be called on this segment before it can be used by other clients. - - - - - - - Finds an item in the table collection that maches the given searchKey - - The key to the item. - Out reference to a field that will receive the found item. - A boolean that will be true if an item has been found and false otherwise. - - - - Looks for an existing item in the table contents using an alternative copy. If it can be found it will be returned. - If not then the alternative copy will be added to the table contents and the alternative copy will be returned. - - A copy to search an already existing instance with - Out reference to receive the found item or the alternative copy - A boolean that will be true if an existing copy was found and false otherwise. - - - - Replaces and existing item - - - - - true is the existing item was successfully replaced. - - - - Inserts an item in the table contents possibly replacing an existing item. - - The item to insert in the table - Out reference to a field that will receive any possibly replaced item. - A boolean that will be true if an existing copy was found and replaced and false otherwise. - - - - Removes an item from the table contents. - - The key to find the item with. - Out reference to a field that will receive the found and removed item. - A boolean that will be rue if an item was found and removed and false otherwise. - - - - Enumerates all segments in _CurrentRange and locking them before yielding them and resleasing the lock afterwards - The order in which the segments are returned is undefined. - Lock SyncRoot before using this enumerable. - - - - - - Removes all items from the collection. - Aquires a lock on SyncRoot before it does it's thing. - When this method returns and multiple threads have access to this table it - is not guaranteed that the table is actually empty. - - - - - Determines if a segmentation adjustment is needed. - - True - - - - Bool as int (for interlocked functions) that is true if a Segmentation assesment is pending. - - - - - The total allocated number of item slots. Filled with nonempty items or not. - - - - - When a segment resizes it uses this method to inform the hashtable of the change in allocated space. - - - - - - Schedule a call to the AssessSegmentation() method. - - - - - Checks if segmentation needs to be adjusted and if so performs the adjustment. - - - - - - This method is called when a re-segmentation is expected to be needed. It checks if it actually is needed and, if so, performs the re-segementation. - - - - - Adjusts the segmentation to the new segment count - - The new number of segments to use. This must be a power of 2. - The number of item slots to reserve in each segment. - - - - Returns an object that serves as a lock for range operations - - - Clients use this primarily for enumerating over the Tables contents. - Locking doesn't guarantee that the contents don't change, but prevents operations that would - disrupt the enumeration process. - Operations that use this lock: - Count, Clear, DisposeGarbage and AssessSegmentation. - Keeping this lock will prevent the table from re-segmenting. - - - - - Gets an IEnumerable to iterate over all items in all segments. - - - - A lock should be aquired and held on SyncRoot while this IEnumerable is being used. - The order in which the items are returned is undetermined. - - - - - Returns a count of all items in teh collection. This may not be - aqurate when multiple threads are accessing this table. - Aquires a lock on SyncRoot before it does it's thing. - - - - - Gives the minimum number of segments a hashtable can contain. This should be 1 or more and always a power of 2. - - - - - Gives the minimum number of allocated item slots per segment. This should be 1 or more, always a power of 2 - and less than 1/2 of MeanSegmentAllocatedSpace. - - - - - Gives the prefered number of allocated item slots per segment. This should be 4 or more and always a power of 2. - - - - - Constructs a instance using the default to compare keys. - - - - - Constructs a instance using the specified to compare keys. - - The tp compare keys with. - is null. - - - - Get a hashcode for given storeable item. - - Reference to the item to get a hash value for. - The hash value as an . - - The hash returned should be properly randomized hash. The standard GetItemHashCode methods are usually not good enough. - A storeable item and a matching search key should return the same hash code. - So the statement ItemEqualsItem(storeableItem, searchKey) ? GetItemHashCode(storeableItem) == GetItemHashCode(searchKey) : true should always be true; - - - - - Get a hashcode for given search key. - - Reference to the key to get a hash value for. - The hash value as an . - - The hash returned should be properly randomized hash. The standard GetItemHashCode methods are usually not good enough. - A storeable item and a matching search key should return the same hash code. - So the statement ItemEqualsItem(storeableItem, searchKey) ? GetItemHashCode(storeableItem) == GetItemHashCode(searchKey) : true should always be true; - - - - - Compares a storeable item to a search key. Should return true if they match. - - Reference to the storeable item to compare. - Reference to the search key to compare. - True if the storeable item and search key match; false otherwise. - - - - Compares two storeable items for equality. - - Reference to the first storeable item to compare. - Reference to the second storeable item to compare. - True if the two soreable items should be regarded as equal. - - - - Indicates if a specific item reference contains a valid item. - - The storeable item reference to check. - True if the reference doesn't refer to a valid item; false otherwise. - The statement IsEmpty(default(TStoredI)) should always be true. - - - - Adds an element with the provided key and value to the dictionary. - - The object to use as the key of the element to add. - The object to use as the value of the element to add. - An element with the same key already exists in the dictionary. - - - - Determines whether the dictionary - contains an element with the specified key. - - The key to locate in the dictionary. - true if the dictionary contains - an element with the key; otherwise, false. - - - - Removes the element with the specified key from the dictionary. - - The key of the element to remove. - true if the element is successfully removed; otherwise, false. This method - also returns false if key was not found in the original dictionary. - - - - Gets the value associated with the specified key. - - The key whose value to get. - - When this method returns, the value associated with the specified key, if - the key is found; otherwise, the default value for the type of the value - parameter. This parameter is passed uninitialized. - - - true if the dictionary contains an element with the specified key; otherwise, false. - - - - - Adds an association to the dictionary. - - A that represents the association to add. - An association with an equal key already exists in the dicitonary. - - - - Removes all items from the dictionary. - - WHen working with multiple threads, that each can add items to this dictionary, it is not guaranteed that the dictionary will be empty when this method returns. - - - - Determines whether the specified association exists in the dictionary. - - The key-value association to search fo in the dicionary. - True if item is found in the dictionary; otherwise, false. - - This method compares both key and value. It uses the default equality comparer to compare values. - - - - - Copies all associations of the dictionary to an - , starting at a particular index. - - The one-dimensional that is the destination of the associations - copied from . The must - have zero-based indexing. - The zero-based index in at which copying begins. - is null. - is less than 0. - is equal to or greater than the length of . - The number of associations to be copied - is greater than the available space from to the end of the destination - . - - - - Removes the specified association from the , comparing both key and value. - - A representing the association to remove. - true if the association was successfully removed from the ; - otherwise, false. This method also returns false if the association is not found in - the original . - - - - - Returns an enumerator that iterates through all associations in the at the moment of invocation. - - A that can be used to iterate through the associations. - - - - Returns an enumerator that iterates through all associations in the at the moment of invocation. - - A that can be used to iterate through the associations. - - - - Gives the of TKey that is used to compare keys. - - - - - Gets an containing the keys of - the dictionary. - - An containing the keys of the dictionary. - This property takes a snapshot of the current keys collection of the dictionary at the moment of invocation. - - - - Gets an containing the values in - the dictionary. - - - An containing the values in the dictionary. - - This property takes a snapshot of the current keys collection of the dictionary at the moment of invocation. - - - - Gets or sets the value associated with the specified key. - - The key of the value to get or set. - The value associated with the specified key. If the specified key is not found, a get operation throws a KeyNotFoundException, and a set operation creates a new element with the specified key. - - When working with multiple threads, that can each potentialy remove the searched for item, a can always be expected. - - - - - Gets the number of elements contained in the . - - - - - Gets a value indicating whether the is read-only, which is always false. - - - - - Initialize the segment. - - - - - - When segment gets introduced into hashtable then its allocated space should be added to the - total allocated space. - Single threaded access or locking is needed - - - - - - When segment gets removed from hashtable then its allocated space should be subtracted to the - total allocated space. - Single threaded access or locking is needed - - - - - - Array with 'slots'. Each slot can be filled or empty. - - - - - Inserts an item into a *not empty* spot given by position i. It moves items forward until an empty spot is found. - - - - - - - - - Find item in segment. - - Reference to the search key to use. - Out reference to store the found item in. - Object that tells this segment how to treat items and keys. - True if an item could be found, otherwise false. - - - - Find an existing item or, if it can't be found, insert a new item. - - Reference to the item that will be inserted if an existing item can't be found. It will also be used to search with. - Out reference to store the found item or, if it can not be found, the new inserted item. - Object that tells this segment how to treat items and keys. - True if an existing item could be found, otherwise false. - - - - Inserts an item in the segment, possibly replacing an equal existing item. - - A reference to the item to insert. - An out reference where any replaced item will be written to, if no item was replaced the new item will be written to this reference. - Object that tells this segment how to treat items and keys. - True if an existing item could be found and is replaced, otherwise false. - - - - Removes an item from the segment. - - A reference to the key to search with. - An out reference where the removed item will be stored or default() if no item to remove can be found. - Object that tells this segment how to treat items and keys. - True if an item could be found and is removed, false otherwise. - - - - Iterate over items in the segment. - - Position beyond which the next filled slot will be found and the item in that slot returned. (Starting with -1) - Out reference where the next item will be stored or default if the end of the segment is reached. - Object that tells this segment how to treat items and keys. - The index position the next item has been found or -1 otherwise. - - - - Total numer of filled slots in _List. - - - - - Remove any excess allocated space - - - - - - Boolean value indicating if this segment has not been trashed yet. - - - - - Release a reader lock - - - - - Release a writer lock - - - - - Aquire a reader lock. Wait until lock is aquired. - - - - - Aquire a reader lock. - - True if to wait until lock aquired, False to return immediately. - Boolean indicating if lock was successfuly aquired. - - - - Aquire a writer lock. Wait until lock is aquired. - - - - - Aquire a writer lock. - - True if to wait until lock aquired, False to return immediately. - Boolean indicating if lock was successfuly aquired. - - - - If AlwaysUseUtc is set to true then convert all DateTime to UTC. - - - - - - - Repairs an out-of-spec XML date/time string which incorrectly uses a space instead of a 'T' to separate the date from the time. - These string are occasionally generated by SQLite and can cause errors in OrmLite when reading these columns from the DB. - - The XML date/time string to repair - The repaired string. If no repairs were made, the original string is returned. - - - - WCF Json format: /Date(unixts+0000)/ - - - - - - - WCF Json format: /Date(unixts+0000)/ - - - - - - - Get the type(string) constructor if exists - - The type. - - - - - micro optimizations: using flags instead of value.IndexOfAny(EscapeChars) - - - - - - - Class to hold - - - - - - A fast, standards-based, serialization-issue free DateTime serailizer. - - - - - Determines whether this serializer can create the specified type from a string. - - The type. - - true if this instance [can create from string] the specified type; otherwise, false. - - - - - Parses the specified value. - - The value. - - - - - Deserializes from reader. - - The reader. - - - - - Serializes to string. - - The value. - - - - - Serializes to writer. - - The value. - The writer. - - - - Sets which format to use when serializing TimeSpans - - - - - if the is configured - to take advantage of specification, - to support user-friendly serialized formats, ie emitting camelCasing for JSON - and parsing member names and enum values in a case-insensitive manner. - - - - - if the is configured - to support web-friendly serialized formats, ie emitting lowercase_underscore_casing for JSON - - - - - Define how property names are mapped during deserialization - - - - - Gets or sets a value indicating if the framework should throw serialization exceptions - or continue regardless of deserialization errors. If the framework - will throw; otherwise, it will parse as many fields as possible. The default is . - - - - - Gets or sets a value indicating if the framework should always convert to UTC format instead of local time. - - - - - Gets or sets a value indicating if the framework should always assume is in UTC format if Kind is Unspecified. - - - - - Gets or sets whether we should append the Utc offset when we serialize Utc dates. Defaults to no. - Only supported for when the JsConfig.DateHandler == JsonDateHandler.TimestampOffset - - - - - Gets or sets a value indicating if unicode symbols should be serialized as "\uXXXX". - - - - - If set to true, Interface types will be prefered over concrete types when serializing. - - - - - Sets the maximum depth to avoid circular dependencies - - - - - Set this to enable your own type construction provider. - This is helpful for integration with IoC containers where you need to call the container constructor. - Return null if you don't know how to construct the type and the parameterless constructor will be used. - - - - - If set to true, Interface types will be prefered over concrete types when serializing. - - - - - Always emit type info for this type. Takes precedence over ExcludeTypeInfo - - - - - Never emit type info for this type - - - - - if the is configured - to take advantage of specification, - to support user-friendly serialized formats, ie emitting camelCasing for JSON - and parsing member names and enum values in a case-insensitive manner. - - - - - Define custom serialization fn for BCL Structs - - - - - Define custom raw serialization fn - - - - - Define custom serialization hook - - - - - Define custom deserialization fn for BCL Structs - - - - - Define custom raw deserialization fn for objects - - - - - Exclude specific properties of this type from being serialized - - - - - Opt-in flag to set some Value Types to be treated as a Ref Type - - - - - Whether there is a fn (raw or otherwise) - - - - - The property names on target types must match property names in the JSON source - - - - - The property names on target types may not match the property names in the JSON source - - - - - Uses the xsd format like PT15H10M20S - - - - - Uses the standard .net ToString method of the TimeSpan class - - - - - Get JSON string value converted to T - - - - - Get JSON string value - - - - - Get unescaped string value - - - - - Get unescaped string value - - - - - Write JSON Array, Object, bool or number values as raw string - - - - - Get JSON string value - - - - - Creates an instance of a Type from a string value - - - - - Parses the specified value. - - The value. - - - - - Shortcut escape when we're sure value doesn't contain any escaped chars - - - - - - - Given a character as utf32, returns the equivalent string provided that the character - is legal json. - - - - - - - micro optimizations: using flags instead of value.IndexOfAny(EscapeChars) - - - - - - - Implement the serializer using a more static approach - - - - - - Implement the serializer using a more static approach - - - - - - Public Code API to register commercial license for ServiceStack. - - - - - Internal Utilities to verify licensing - - - - - Pretty Thread-Safe cache class from: - http://code.google.com/p/dapper-dot-net/source/browse/Dapper/SqlMapper.cs - - This is a micro-cache; suitable when the number of terms is controllable (a few hundred, for example), - and strictly append-only; you cannot change existing values. All key matches are on **REFERENCE** - equality. The type is fully thread-safe. - - - - - Maps the path of a file in the context of a VS project - - the relative path - the absolute path - Assumes static content is two directories above the /bin/ directory, - eg. in a unit test scenario the assembly would be in /bin/Debug/. - - - - Maps the path of a file in a self-hosted scenario - - the relative path - the absolute path - Assumes static content is copied to /bin/ folder with the assemblies - - - - Maps the path of a file in an Asp.Net hosted scenario - - the relative path - the absolute path - Assumes static content is in the parent folder of the /bin/ directory - - - - Implement the serializer using a more static approach - - - - - - Creates a new instance of type. - First looks at JsConfig.ModelFactory before falling back to CreateInstance - - - - - Creates a new instance of type. - First looks at JsConfig.ModelFactory before falling back to CreateInstance - - - - - Creates a new instance from the default constructor of type - - - - - Add a Property attribute at runtime. - Not threadsafe, should only add attributes on Startup. - - - - - Add a Property attribute at runtime. - Not threadsafe, should only add attributes on Startup. - - - - - BigInteger library by Chew Keong TAN (See project source for info). - - - - - Interface which must be implemented by all custom padding providers. - Padding is used to provide randomness and unpredictability to the data - before it is encrypted. - - - - - Adds padding to the input data and returns the padded data. - - Data to be padded prior to encryption - RSA Parameters used for padding computation - Padded message - - - - Removes padding that was added to the unencrypted data prior to encryption. - - Data to have padding removed - RSA Parameters used for padding computation - Unpadded message - - - - Gets the maximum message length for this padding provider. - - RSA Parameters used for padding computation - Max message length - - - - Uses PKCS#1 v 1.5 padding scheme to pad the data. - - - - - - Default constructor. - - - - - Adds padding to the input data and returns the padded data. - - Data to be padded prior to encryption - RSA Parameters used for padding computation - Padded message - - - - Removes padding that was added to the unencrypted data prior to encryption. - - Data to have padding removed - RSA Parameters used for padding computation - Unpadded message - - - - Gets the maximum message length for this padding provider. - - RSA Parameters used for padding computation - Max message length - - - - The NoPadding class does not add any padding to the data. - This is not recommended. - - - - - Default constructor. - - - - - Adds padding to the input data and returns the padded data. - - Data to be padded prior to encryption - RSA Parameters used for padding computation - Padded message - - - - Removes padding that was added to the unencrypted data prior to encryption. - - Data to have padding removed - RSA Parameters used for padding computation - Unpadded message - - - - Gets the maximum message length for this padding provider. - - RSA Parameters used for padding computation - Max message length - - - - Uses OAEP Padding defined in PKCS#1 v 2.1. Uses the - default standard SHA1 hash. This padding provider is - compatible with .NET's OAEP implementation. - - - - - Default constructor. Uses the default SHA1 Hash for OAEP hash calculation. - - - - - Internal constructor (used to perform OAEP with a different hash and hash output length - - - - - - - Adds padding to the input data and returns the padded data. - - Data to be padded prior to encryption - RSA Parameters used for padding computation - Padded message - - - - Removes padding that was added to the unencrypted data prior to encryption. - - Data to have padding removed - RSA Parameters used for padding computation - Unpadded message - - - - Gets the maximum message length for this padding provider. - - RSA Parameters used for padding computation - Max message length - - - - Uses OAEP Padding Scheme defined in PKCS#1 v 2.1. Uses a - SHA256 hash. This padding provider is currently - not compatible with .NET's OAEP implementation. - - - - - Default constructor. Uses a SHA256 Hash for OAEP hash calculation. - This PaddingProvider provides added security to message padding, - however it requires the data to be encrypted to be shorter and - is not compatible with the RSACryptoServiceProvider's implementation - of OAEP. - - - - - Adds padding to the input data and returns the padded data. - - Data to be padded prior to encryption - RSA Parameters used for padding computation - Padded message - - - - Removes padding that was added to the unencrypted data prior to encryption. - - Data to have padding removed - RSA Parameters used for padding computation - Unpadded message - - - - Gets the maximum message length for this padding provider. - - RSA Parameters used for padding computation - Max message length - - - - All custom signature providers must implement this interface. The - RSACrypto class handles encryption and decryption of data. The - SignatureProvider is intended to provide the hashing and signature - generation mechanism used to create the comparison data. - - - - - Generates a hash for the input data. - - Data to be signed - RSA Parameters used for signature calculation - Computed signature (pre-encryption) - - - - Verifies the signed data against the unsigned data after decryption. - - Unsigned data - Signed data (after decryption) - RSAParameters used for signature computation - Boolean representing whether the input data matches the signed data - - - - Uses the DER (Distinguished Encoding Rules) - and the SHA1 hash provider for encoding generation. - - - - - Default constructor - - - - - Hashes and encodes the signature for encryption. Uses the DER (Distinguished Encoding Rules) - and the SHA1 hash provider for encoding generation. - - Data to be signed - RSA Parameters used for signature calculation - Computed signature (pre-encryption) - - - - Verifies the signed data against the unsigned data after decryption. - - Unsigned data - Signed data (after decryption) - RSAParameters used for signature computation - Boolean representing whether the input data matches the signed data - - - - Uses the DER (Distinguished Encoding Rules) - and the SHA256 hash provider for encoding generation. - - - - - Default constructor - - - - - Hashes and encodes the signature for encryption. Uses the DER (Distinguished Encoding Rules) - and the SHA256 hash provider for encoding generation. - - Data to be signed - RSA Parameters used for signature calculation - Computed signature (pre-encryption) - - - - Verifies the signed data against the unsigned data after decryption. - - Unsigned data - Signed data (after decryption) - RSAParameters used for signature computation - Boolean representing whether the input data matches the signed data - - - - Base interface that must be implemented by all hash providers. - - - - - Compute the hash of the input byte array and return the hashed value as a byte array. - - Input data - Hashed data. - - - - Hash provider based on SHA256 - - - - - Default constructor. - - - - - Compute the hash of the input byte array and return the hashed value as a byte array. - - Input data - SHA256 Hashed data - - - - Hash provider based on HMACSHA256 to allow inclusion of a hash seed value - - - - - Constructor accepting a private key (seed) value - - Byte array containing the private hash seed - - - - Compute the hash of the input byte array and return the hashed value as a byte array. - - Input data - HMACSHA256 Hashed data. - - - - Hash provider based on SHA1 - - - - - Default constructor. - - - - - Compute the hash of the input byte array and return the hashed value as a byte array. - - Input data - SHA1 Hashed data. - - - - Hash provider based on HMACSHA1 to allow inclusion of a hash seed value - - - - - Constructor accepting a private key (seed) value - - Byte array containing the private hash seed - - - - Compute the hash of the input byte array and return the hashed value as a byte array. - - Input data - HMACSHA1 Hashed data. - - - - RSA Cryptography class - - - - - Default constructor for the RSA Class. A cipher strength of 1024-bit will used by default. To specify - a higher cipher strength, please use the alternate RSACrypto(cipherStrength) constructor. - - - - - RSA Class Constructor - - - Cipher strength in bits. 2048 is recommended. Must be a multiple of 8. - Max supported by this class is 4096. Minimum is 256. Cipher strength only - needs to be specified if generating new key pairs. It is not necessary to - know the cipher strength when importing existing key pairs. - - - - - Return the currently loaded key as XML. This method will automatically - return an empty string if no key has been loaded. - - Signals whether to include the private key in the output data. - XML String with the key data. - - - - Sets the current class internal variables based on the supplied XML. - Attempts to validate the XML prior to setting. - - XML String containing key info - - - - - Import an existing set of RSA Parameters. If only the public key is to be loaded, - Do not set the P, Q, DP, DQ, IQ or D values. If P, Q or D are set, the parameters - will automatically be validated for existence of private key. - - RSAParameters object containing key data. - - - - Returns an RSAParameters object that contains the key data for the currently loaded key. - - Instance of the currently loaded RSAParameters object or null if no key is loaded - - - - - Imports a blob that represents asymmetric key information. - - A byte array that represents an asymmetric key blob. - Invalid key blob data - Initialized RSAParameters structure - - - - Exports a blob that contains the key information associated with an AsymmetricAlgorithm object. - - true to include the private key; otherwise, false. - A byte array that contains the key information associated with an AsymmetricAlgorithm object - - - - Generate the RSA Key Pair using the default exponent of 65537. - - - - - Generate the RSA Key Pair using a supplied cipher strength and the default - exponent value of 65537. If a cipherStrength was specified in the constructor, - the supplied value will override it. - - The strength of the cipher in bits. Must be a multiple of 8 - and between 256 and 4096 - - - - Generate the RSA Key Pair using a supplied cipher strength value and exponent value. - A prime number value between 3 and 65537 is recommended for the exponent. Larger - exponents can increase security but also increase encryption time. Your supplied - exponent may be automatically adjusted to ensure compatibility with the RSA algorithm - security requirements. If a cipherStrength was specified in the constructor, - the supplied value will override it. - - The strength of the cipher in bits. Must be a multiple of 8 - and between 256 and 4096 - Custom exponent value to be used for RSA Calculation - - - - Encrypt input bytes with the public key. Data can only be decrypted with - the private key. If no PaddingProvider is set, the default padding provider of OAEP will be assumed. To - specify a different padding algorithm, make sure you set the PaddingProvider property. - - Data bytes to be encrypted - Encrypted byte array - Key generation is CPU intensive. It is highly recommended that you create - your key pair in advance and use a predetermined key pair. If you do choose to allow - the key pair to be automatically generated, it can be exported to XML or an RSAParameter - set after the encryption is complete. - - - - Run the encryption routine using the private key for encryption. While this may be useful in some - fringe scenarios, if simple verification is needed it is recommended that you use the Sign() method - instead, which signs a hashed version of your data. If no PaddingProvider is set, the default padding - provider of OAEP will be assumed. To specify a different padding algorithm, make sure you set the - PaddingProvider property. - - Data to be encrypted with the private key - Encrypted data bytes - - This method uses the PaddingProvider for message verification. To create signature - hashes, please use the SignData and VerifyData methods. - Data encrypted this way can be decrypted using your PUBLIC KEY. This method of encryption is meant - for verification purposes only and does not secure your data against decryption. - - - - - Sign a hash of the input data using the supplied Signature Provider and encrypt with the private key. - - Data to be hashed and signed - The signature provider to use for signature generation. - Signed hash bytes - - - - Decrypt data that was encrypted using the Public Key. If no PaddingProvider is set, the default - padding provider of OAEP will be assumed. To specify a different padding algorithm, make sure - you set the PaddingProvider property. - - Encrypted bytes - Decrypted bytes - - - - Decrypt data that was encrypted with the Private Key. NOTE: This method - uses the PaddingProvider for message decoding. To create signature - hashes, please use the SignData and VerifyData methods. If no PaddingProvider is set, the default - padding provider of OAEP will be assumed. To specify a different padding algorithm, make sure - you set the PaddingProvider property. - - Encrypted bytes - Decrypted bytes - - - - Verify the signature against the unsigned data. The encryptedData is decrypted using the public key and - the unsignedData is hashed and compared to the un-encrypted signed data using the supplied SignatureProvider. - - The raw, unencrypted data to be hashed and compared. - The data that has been hashed and encrypted with the private key. - The signature provider that matches the algorithm used to generate the original signature - Boolean representing whether the signature was valid (verified) - - - - Different versions of RSA use different padding schemes. This property allows you to - set the padding scheme you wish to use. If not set, the default of OAEP will be - used. While PKCS1 v1.5 is supported, OAEP is the recommended padding scheme to use. - You can create your own padding schemes by implementing the IPaddingProvider interface. - - Padding provider instance - Current padding provider - - - - Based on the padding provider, messages are stricted to certain lengths for encryption. Also, - ensure that the key pair has either been generated or imported. - - - - - Fires when key generation is complete. - - - - - Delegate for OnKeysGenerated event - - Object - - - - Cryptographic Exception - - - - - Constructor - - Error Message - - - - Constructor - - Error Message - Inner Exception - - - - CALG_RSA_KEYX = (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_RSA|ALG_SID_RSA_ANY) - - - - - Simple Key BLOB - - - - - Public Key BLOB - - - - - Private Key BLOB - - - - - PlainText Key BLOB - - - - - Opaque Key BLOB - - - - - Public Key BLOB Extended - - - - - Symmetric Wrap Key BLOB - - - - - A BLOBHEADER / PUBLICKEYSTRUC structure (Import from WinCrypt.h) - - http://msdn.microsoft.com/en-us/library/ms884652.aspx - - - - Key BLOB type. The only BLOB types currently defined are PUBLICKEYBLOB, PRIVATEKEYBLOB, and SIMPLEBLOB. Other key BLOB types will be defined as needed. - - - - - Version number of the key BLOB format. This member currently must always have a value of 0x02. - - - - - Reserved for future use. This member must be set to zero. - - - - - Algorithm identifier for the key contained by the key BLOB structure - - - - - Create and initialize structure from binary data - - On validate errors - Initialized structure - - - - Serializes structure as binary data - - - - - Create and initialize structure from RSAParameters - - Initialized structure - - - - Returns a that represents this instance. - - - A that represents this instance. - - - - - RSA public key data - - http://msdn.microsoft.com/en-us/library/aa387685(v=VS.85).aspx - - - - The magic member must be set to 0x31415352 (public only) / 0x32415352 (including private). This hex value is the ASCII encoding of RSA1 / RSA2. - - - - - # of bits in modulus - - - - - Public exponent - - - - - Create and initialize structure from binary data - - On validate errors - Initialized structure - - - - Serializes structure as binary data - - - - - Create and initialize structure from RSAParameters - - Initialized structure - - - - Create and initialize RSAParameters structure - - Initialized structure - http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsaparameters.aspx - - - - Returns a that represents this instance. - - - A that represents this instance. - - - - - Private-key BLOBs, type PRIVATEKEYBLOB, are used to store private keys outside a CSP. Extended provider private-key BLOBs have the following format. - - - - - BLOB Header - - - - - RSA public key data - - - - - The modulus. This has a value of prime1 * prime2 and is often known as n. - - - - - Prime number 1, often known as p. - - - - - Prime number 2, often known as q. - - - - - Exponent 1. This has a numeric value of d mod (p - 1). - - - - - Exponent 2. This has a numeric value of d mod (q - 1). - - - - - Coefficient. This has a numeric value of (inverse of q mod p). - - - - - Private exponent, often known as d. - - - - - Create and initialize structure from binary data - - On validate errors - Initialized structure - - - - Create and initialize structure from binary data with defined header - - On validate errors - Initialized structure - - - - Serializes structure as binary data - - - - - Create and initialize structure from RSAParameters - - Initialized structure - http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsaparameters.aspx - - - - Create and initialize RSAParameters structure - - Initialized structure - http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsaparameters.aspx - - - - Returns a that represents this instance. - - - A that represents this instance. - - - - - Public-key BLOBs, type PUBLICKEYBLOB, are used to store public keys outside a CSP. Extended provider public-key BLOBs have the following format. - - - - - BLOB Header - - - - - RSA public key data - - - - - The public-key modulus data - - - - - Create and initialize structure from binary data - - On validate errors - Initialized structure - - - - Create and initialize structure from binary data with defined header - - On validate errors - Initialized structure - - - - Serializes structure as binary data - - - - - Create and initialize structure from RSAParameters - - Initialized structure - http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsaparameters.aspx - - - - Create and initialize RSAParameters structure - - Initialized structure - http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsaparameters.aspx - - - - Returns a that represents this instance. - - - A that represents this instance. - - - - - RSAParameters for Import / Export - - - - - Parameter value E - - - - - Parameter value N - - - - - Parameter value P - - - - - Parameter value Q - - - - - Parameter value DP - - - - - Parameter value DQ - - - - - Parameter value IQ - - - - - Parameter value D - - - - - Parameter value Phi - - - - - Bitwise XOR for 2 byte arrays. Arrays must be the same length. - - Left side for comparison - Right side for comparison - Resulting byte array - - - - Bitwise XOR for 2 Bytes. - - Left side for comparison - Right side for comparison - Resulting byte - - - - Convert the input Integer to an Octet String. - - input integer - size in octets (bytes) - Resulting byte array of specified length - - - - Mask generation function. - - Seed - Length of generated mask - Length of the hash produced by the supplied hash provider - Hash provider to use in mask generation - Generated mask of specified length - - - - @jonskeet: Collection of utility methods which operate on streams. - r285, February 26th 2009: http://www.yoda.arachsys.com/csharp/miscutil/ - - - - - Reads the given stream up to the end, returning the data as a byte - array. - - - - - Reads the given stream up to the end, returning the data as a byte - array, using the given buffer size. - - - - - Reads the given stream up to the end, returning the data as a byte - array, using the given buffer for transferring data. Note that the - current contents of the buffer is ignored, so the buffer needn't - be cleared beforehand. - - - - - Copies all the data from one stream into another. - - - - - Copies all the data from one stream into another, using a buffer - of the given size. - - - - - Copies all the data from one stream into another, using the given - buffer for transferring data. Note that the current contents of - the buffer is ignored, so the buffer needn't be cleared beforehand. - - - - - Reads exactly the given number of bytes from the specified stream. - If the end of the stream is reached before the specified amount - of data is read, an exception is thrown. - - - - - Reads into a buffer, filling it completely. - - - - - Reads exactly the given number of bytes from the specified stream, - into the given buffer, starting at position 0 of the array. - - - - - Reads exactly the given number of bytes from the specified stream, - into the given buffer, starting at position 0 of the array. - - - - - Same as ReadExactly, but without the argument checks. - - - - - Converts from base: 0 - 62 - - The source. - From. - To. - - - - - Skip the encoding process for 'safe strings' - - - - - - - A class to allow the conversion of doubles to string representations of - their exact decimal values. The implementation aims for readability over - efficiency. - - Courtesy of @JonSkeet - http://www.yoda.arachsys.com/csharp/DoubleConverter.cs - - - - - - - - How many digits are *after* the decimal point - - - - - Constructs an arbitrary decimal expansion from the given long. - The long must not be negative. - - - - - Multiplies the current expansion by the given amount, which should - only be 2 or 5. - - - - - Shifts the decimal point; a negative value makes - the decimal expansion bigger (as fewer digits come after the - decimal place) and a positive value makes the decimal - expansion smaller. - - - - - Removes leading/trailing zeroes from the expansion. - - - - - Converts the value to a proper decimal string representation. - - - - - Creates an instance of a Type from a string value - - - - - Determines whether the specified type is convertible from string. - - The type. - - true if the specified type is convertible from string; otherwise, false. - - - - - Parses the specified value. - - The value. - - - - - Parses the specified type. - - The type. - The value. - - - - - Useful extension method to get the Dictionary[string,string] representation of any POCO type. - - - - - - Recursively prints the contents of any POCO object in a human-friendly, readable format - - - - - - Print Dump to Console.WriteLine - - - - - Print string.Format to Console.WriteLine - - - - - Parses the specified value. - - The value. - - - - diff --git a/lib/sqlite3.def b/lib/sqlite3.def deleted file mode 100644 index 251d5bb5613..00000000000 --- a/lib/sqlite3.def +++ /dev/null @@ -1,210 +0,0 @@ -EXPORTS -sqlite3_aggregate_context -sqlite3_aggregate_count -sqlite3_auto_extension -sqlite3_backup_finish -sqlite3_backup_init -sqlite3_backup_pagecount -sqlite3_backup_remaining -sqlite3_backup_step -sqlite3_bind_blob -sqlite3_bind_double -sqlite3_bind_int -sqlite3_bind_int64 -sqlite3_bind_null -sqlite3_bind_parameter_count -sqlite3_bind_parameter_index -sqlite3_bind_parameter_name -sqlite3_bind_text -sqlite3_bind_text16 -sqlite3_bind_value -sqlite3_bind_zeroblob -sqlite3_blob_bytes -sqlite3_blob_close -sqlite3_blob_open -sqlite3_blob_read -sqlite3_blob_reopen -sqlite3_blob_write -sqlite3_busy_handler -sqlite3_busy_timeout -sqlite3_cancel_auto_extension -sqlite3_changes -sqlite3_clear_bindings -sqlite3_close -sqlite3_close_v2 -sqlite3_collation_needed -sqlite3_collation_needed16 -sqlite3_column_blob -sqlite3_column_bytes -sqlite3_column_bytes16 -sqlite3_column_count -sqlite3_column_database_name -sqlite3_column_database_name16 -sqlite3_column_decltype -sqlite3_column_decltype16 -sqlite3_column_double -sqlite3_column_int -sqlite3_column_int64 -sqlite3_column_name -sqlite3_column_name16 -sqlite3_column_origin_name -sqlite3_column_origin_name16 -sqlite3_column_table_name -sqlite3_column_table_name16 -sqlite3_column_text -sqlite3_column_text16 -sqlite3_column_type -sqlite3_column_value -sqlite3_commit_hook -sqlite3_compileoption_get -sqlite3_compileoption_used -sqlite3_complete -sqlite3_complete16 -sqlite3_config -sqlite3_context_db_handle -sqlite3_create_collation -sqlite3_create_collation16 -sqlite3_create_collation_v2 -sqlite3_create_function -sqlite3_create_function16 -sqlite3_create_function_v2 -sqlite3_create_module -sqlite3_create_module_v2 -sqlite3_data_count -sqlite3_db_config -sqlite3_db_filename -sqlite3_db_handle -sqlite3_db_mutex -sqlite3_db_readonly -sqlite3_db_release_memory -sqlite3_db_status -sqlite3_declare_vtab -sqlite3_enable_load_extension -sqlite3_enable_shared_cache -sqlite3_errcode -sqlite3_errmsg -sqlite3_errmsg16 -sqlite3_errstr -sqlite3_exec -sqlite3_expired -sqlite3_extended_errcode -sqlite3_extended_result_codes -sqlite3_file_control -sqlite3_finalize -sqlite3_free -sqlite3_free_table -sqlite3_get_autocommit -sqlite3_get_auxdata -sqlite3_get_table -sqlite3_global_recover -sqlite3_initialize -sqlite3_interrupt -sqlite3_last_insert_rowid -sqlite3_libversion -sqlite3_libversion_number -sqlite3_limit -sqlite3_load_extension -sqlite3_log -sqlite3_malloc -sqlite3_memory_alarm -sqlite3_memory_highwater -sqlite3_memory_used -sqlite3_mprintf -sqlite3_mutex_alloc -sqlite3_mutex_enter -sqlite3_mutex_free -sqlite3_mutex_leave -sqlite3_mutex_try -sqlite3_next_stmt -sqlite3_open -sqlite3_open16 -sqlite3_open_v2 -sqlite3_os_end -sqlite3_os_init -sqlite3_overload_function -sqlite3_prepare -sqlite3_prepare16 -sqlite3_prepare16_v2 -sqlite3_prepare_v2 -sqlite3_profile -sqlite3_progress_handler -sqlite3_randomness -sqlite3_realloc -sqlite3_release_memory -sqlite3_reset -sqlite3_reset_auto_extension -sqlite3_result_blob -sqlite3_result_double -sqlite3_result_error -sqlite3_result_error16 -sqlite3_result_error_code -sqlite3_result_error_nomem -sqlite3_result_error_toobig -sqlite3_result_int -sqlite3_result_int64 -sqlite3_result_null -sqlite3_result_text -sqlite3_result_text16 -sqlite3_result_text16be -sqlite3_result_text16le -sqlite3_result_value -sqlite3_result_zeroblob -sqlite3_rollback_hook -sqlite3_rtree_geometry_callback -sqlite3_set_authorizer -sqlite3_set_auxdata -sqlite3_shutdown -sqlite3_sleep -sqlite3_snprintf -sqlite3_soft_heap_limit -sqlite3_soft_heap_limit64 -sqlite3_sourceid -sqlite3_sql -sqlite3_status -sqlite3_step -sqlite3_stmt_busy -sqlite3_stmt_readonly -sqlite3_stmt_status -sqlite3_strglob -sqlite3_stricmp -sqlite3_strnicmp -sqlite3_table_column_metadata -sqlite3_test_control -sqlite3_thread_cleanup -sqlite3_threadsafe -sqlite3_total_changes -sqlite3_trace -sqlite3_transfer_bindings -sqlite3_update_hook -sqlite3_uri_boolean -sqlite3_uri_int64 -sqlite3_uri_parameter -sqlite3_user_data -sqlite3_value_blob -sqlite3_value_bytes -sqlite3_value_bytes16 -sqlite3_value_double -sqlite3_value_int -sqlite3_value_int64 -sqlite3_value_numeric_type -sqlite3_value_text -sqlite3_value_text16 -sqlite3_value_text16be -sqlite3_value_text16le -sqlite3_value_type -sqlite3_vfs_find -sqlite3_vfs_register -sqlite3_vfs_unregister -sqlite3_vmprintf -sqlite3_vsnprintf -sqlite3_vtab_config -sqlite3_vtab_on_conflict -sqlite3_wal_autocheckpoint -sqlite3_wal_checkpoint -sqlite3_wal_checkpoint_v2 -sqlite3_wal_hook -sqlite3_win32_mbcs_to_utf8 -sqlite3_win32_set_directory -sqlite3_win32_sleep -sqlite3_win32_utf8_to_mbcs -sqlite3_win32_write_debug diff --git a/lib/sqlite3.dll b/lib/sqlite3.dll deleted file mode 100644 index 1058a2b1737..00000000000 Binary files a/lib/sqlite3.dll and /dev/null differ diff --git a/lib/tests/Mono.Data.Sqlite.dll b/lib/tests/Mono.Data.Sqlite.dll deleted file mode 100644 index dad79f065d7..00000000000 Binary files a/lib/tests/Mono.Data.Sqlite.dll and /dev/null differ diff --git a/lib/tests/Moq.dll b/lib/tests/Moq.dll deleted file mode 100644 index abcb72ee64c..00000000000 Binary files a/lib/tests/Moq.dll and /dev/null differ diff --git a/lib/tests/Moq.pdb b/lib/tests/Moq.pdb deleted file mode 100644 index 034ab186e52..00000000000 Binary files a/lib/tests/Moq.pdb and /dev/null differ diff --git a/lib/tests/Moq.xml b/lib/tests/Moq.xml deleted file mode 100644 index a29e2306a7c..00000000000 --- a/lib/tests/Moq.xml +++ /dev/null @@ -1,2930 +0,0 @@ - - - - Moq - - - - - A that returns an empty default value - for invocations that do not have expectations or return values, with loose mocks. - This is the default behavior for a mock. - - - - - Interface to be implemented by classes that determine the - default value of non-expected invocations. - - - - - Provides a value for the given member and arguments. - - The member to provide a default - value for. - Optional arguments passed in - to the call that requires a default value. - - - Type to mock, which can be an interface or a class. - - Provides a mock implementation of . - - - Only abstract and virtual members of classes can be mocked. - - The behavior of the mock with regards to the expectations and the actual calls is determined - by the optional that can be passed to the - constructor. - - - - The following example shows setting expectations with specific values - for method invocations: - - //setup - data - var order = new Order(TALISKER, 50); - var mock = new Mock<IWarehouse>(); - - //setup - expectations - mock.Expect(x => x.HasInventory(TALISKER, 50)).Returns(true); - - //exercise - order.Fill(mock.Object); - - //verify - Assert.True(order.IsFilled); - - The following example shows how to use the class - to specify conditions for arguments instead of specific values: - - //setup - data - var order = new Order(TALISKER, 50); - var mock = new Mock<IWarehouse>(); - - //setup - expectations - //shows how to expect a value within a range - mock.Expect(x => x.HasInventory( - It.IsAny<string>(), - It.IsInRange(0, 100, Range.Inclusive))) - .Returns(false); - - //shows how to throw for unexpected calls. contrast with the "verify" approach of other mock libraries. - mock.Expect(x => x.Remove( - It.IsAny<string>(), - It.IsAny<int>())) - .Throws(new InvalidOperationException()); - - //exercise - order.Fill(mock.Object); - - //verify - Assert.False(order.IsFilled); - - - - - - Helper interface used to hide the base - members from the fluent API to make it much cleaner - in Visual Studio intellisense. - - - - - - - - - - - - - - - - - Adds an interface implementation to the mock, - allowing expectations to be set for it. - - - This method can only be called before the first use - of the mock property, at which - point the runtime type has already been generated - and no more interfaces can be added to it. - - Also, must be an - interface and not a class, which must be specified - when creating the mock instead. - - - The mock type - has already been generated by accessing the property. - The specified - is not an interface. - - The following example creates a mock for the main interface - and later adds to it to verify - it's called by the consumer code: - - var mock = new Mock<IProcessor>(); - mock.Expect(x => x.Execute("ping")); - - // add IDisposable interface - var disposable = mock.As<IDisposable>(); - disposable.Expect(d => d.Dispose()).Verifiable(); - - - Type of interface to cast the mock to. - - - - Sets an expectation on the mocked type for a call to - to a value returning method. - - Type of the return value. Typically omitted as it can be inferred from the expression. - - If more than one expectation is set for the same method or property, - the latest one wins and is the one that will be executed. - - Lambda expression that specifies the expected method invocation. - - - mock.Expect(x => x.HasInventory("Talisker", 50)).Returns(true); - - - - - - Sets an expectation on the mocked type for a call to - to a void method. - - - If more than one expectation is set for the same method or property, - the latest one wins and is the one that will be executed. - - Lambda expression that specifies the expected method invocation. - - - var mock = new Mock<IProcessor>(); - mock.Expect(x => x.Execute("ping")); - - - - - - Sets an expectation on the mocked type for a call to - to a property getter. - - - If more than one expectation is set for the same property getter, - the latest one wins and is the one that will be executed. - - Type of the property. Typically omitted as it can be inferred from the expression. - Lambda expression that specifies the expected property getter. - - - mock.ExpectGet(x => x.Suspended) - .Returns(true); - - - - - - Sets an expectation on the mocked type for a call to - to a property setter. - - - If more than one expectation is set for the same property setter, - the latest one wins and is the one that will be executed. - - Type of the property. Typically omitted as it can be inferred from the expression. - Lambda expression that specifies the expected property setter. - - - mock.ExpectSet(x => x.Suspended); - - - - - - Sets an expectation on the mocked type for a call to - to a property setter with a specific value. - - - More than one expectation can be set for the setter with - different values. - - Type of the property. Typically omitted as it can be inferred from the expression. - Lambda expression that specifies the expected property setter. - The value expected to be set for the property. - - - mock.ExpectSet(x => x.Suspended, true); - - - - - - Implements . - - - - - Implements . - - - - - Verifies that a specific invocation matching the given - expression was performed on the mock. Use in conjuntion - with the default . - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IProcessor>(); - // exercise mock - //... - // Will throw if the test code didn't call Execute with a "ping" string argument. - mock.Verify(proc => proc.Execute("ping")); - - - The invocation was not performed on the mock. - Expression to verify. - - - - Verifies that a specific invocation matching the given - expression was performed on the mock. Use in conjuntion - with the default . - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't call HasInventory. - mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50)); - - - The invocation was not performed on the mock. - Expression to verify. - Type of return value from the expression. - - - - Verifies that a property was read on the mock. - Use in conjuntion with the default . - - - This example assumes that the mock has been used, - and later we want to verify that a given property - was retrieved from it: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't retrieve the IsClosed property. - mock.VerifyGet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Verifies that a property has been set on the mock. - Use in conjuntion with the default . - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Verifies that a property has been set on the mock to the given value. - Use in conjuntion with the default . - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property to true - mock.VerifySet(warehouse => warehouse.IsClosed, true); - - - The invocation was not performed on the mock. - Expression to verify. - The value that should have been set on the property. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Exposes the mocked object instance. - - - - - Specifies the behavior to use when returning default values for - unexpected invocations. - - - - - Behavior of the mock, according to the value set in the constructor. - - - - - Implements the fluent API. - - - - - Defines the Callback verb and overloads. - - - - - Specifies a callback to invoke when the method is called. - - Callback method to invoke. - - The following example specifies a callback to set a boolean - value that can be used later: - - bool called = false; - mock.Expect(x => x.Execute()) - .Callback(() => called = true); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - Argument type of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation argument value. - - Notice how the specific string argument is retrieved by simply declaring - it as part of the lambda expression for the callback: - - - mock.Expect(x => x.Execute(It.IsAny<string>())) - .Callback((string command) => Console.WriteLine(command)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - Type of the first argument of the invoked method. - Type of the second argument of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Expect(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - Type of the first argument of the invoked method. - Type of the second argument of the invoked method. - Type of the third argument of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Expect(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<int>())) - .Callback((string arg1, string arg2, int arg3) => Console.WriteLine(arg1 + arg2 + arg3)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - Type of the first argument of the invoked method. - Type of the second argument of the invoked method. - Type of the third argument of the invoked method. - Type of the fourth argument of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Expect(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<int>(), - It.IsAny<bool>())) - .Callback((string arg1, string arg2, int arg3, bool arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)); - - - - - - Defines occurrence members to constraint expectations. - - - - - The expected invocation can happen at most once. - - - - var mock = new Mock<ICommand>(); - mock.Expect(foo => foo.Execute("ping")) - .AtMostOnce(); - - - - - - The expected invocation can happen at most specified number of times. - - - - var mock = new Mock<ICommand>(); - mock.Expect(foo => foo.Execute("ping")) - .AtMost( 5 ); - - - - - - Defines the Verifiable verb. - - - - - Marks the expectation as verifiable, meaning that a call - to will check if this particular - expectation was met. - - - The following example marks the expectation as verifiable: - - mock.Expect(x => x.Execute("ping")) - .Returns(true) - .Verifiable(); - - - - - - Defines the Raises verb. - - - - - Specifies the mocked event that will be raised - when the expectation is met. - - The mocked event, retrieved from - or . - - The event args to pass when raising the event. - - The following example shows how to set an expectation that will - raise an event when it's met: - - var mock = new Mock<IContainer>(); - // create handler to associate with the event to raise - var handler = mock.CreateEventHandler(); - // associate the handler with the event to raise - mock.Object.Added += handler; - // set the expectation and the handler to raise - mock.Expect(add => add.Add(It.IsAny<string>(), It.IsAny<object>())) - .Raises(handler, EventArgs.Empty); - - - - - - Specifies the mocked event that will be raised - when the expectation is met. - - The mocked event, retrieved from - or . - - A function that will build the - to pass when raising the event. - - - - - Specifies the mocked event that will be raised - when the expectation is met. - - The mocked event, retrieved from - or . - - A function that will build the - to pass when raising the event. - Type of the argument received by the expected invocation. - - - - - Specifies the mocked event that will be raised - when the expectation is met. - - The mocked event, retrieved from - or . - - A function that will build the - to pass when raising the event. - Type of the first argument received by the expected invocation. - Type of the second argument received by the expected invocation. - - - - - Specifies the mocked event that will be raised - when the expectation is met. - - The mocked event, retrieved from - or . - - A function that will build the - to pass when raising the event. - Type of the first argument received by the expected invocation. - Type of the second argument received by the expected invocation. - Type of the third argument received by the expected invocation. - - - - - Specifies the mocked event that will be raised - when the expectation is met. - - The mocked event, retrieved from - or . - - A function that will build the - to pass when raising the event. - Type of the first argument received by the expected invocation. - Type of the second argument received by the expected invocation. - Type of the third argument received by the expected invocation. - Type of the fourth argument received by the expected invocation. - - - - - Marks a method as a matcher, which allows complete replacement - of the built-in class with your own argument - matching rules. - - - The argument matching is used to determine whether a concrete - invocation in the mock matches a given expectation. This - matching mechanism is fully extensible. - - There are two parts of a matcher: the compiler matcher - and the runtime matcher. - - - Compiler matcher - Used to satisfy the compiler requirements for the - argument. Needs to be a method optionally receiving any arguments - you might need for the matching, but with a return type that - matches that of the argument. - - Let's say I want to match a lists of orders that contains - a particular one. I might create a compiler matcher like the following: - - - public static class Orders - { - [Matcher] - public static IEnumerable<Order> Contains(Order order) - { - return null; - } - } - - Now we can invoke this static method instead of an argument in an - invocation: - - var order = new Order { ... }; - var mock = new Mock<IRepository<Order>>(); - - mock.Expect(x => x.Save(Orders.Contains(order))) - .Throws<ArgumentException>(); - - Note that the return value from the compiler matcher is irrelevant. - This method will never be called, and is just used to satisfy the - compiler and to signal Moq that this is not a method that we want - to be invoked at runtime. - - - - Runtime matcher - - The runtime matcher is the one that will actually perform evaluation - when the test is run, and is defined by convention to have the - same signature as the compiler matcher, but where the return - value is the first argument to the call, which contains the - object received by the actual invocation at runtime: - - public static bool Contains(IEnumerable<Order> orders, Order order) - { - return orders.Contains(order); - } - - At runtime, the mocked method will be invoked with a specific - list of orders. This value will be passed to this runtime - matcher as the first argument, while the second argument is the - one specified in the expectation (x.Save(Orders.Contains(order))). - - The boolean returned determines whether the given argument has been - matched. If all arguments to the expected method are matched, then - the expectation is verified. - - - - - - Using this extensible infrastructure, you can easily replace the entire - set of matchers with your own. You can also avoid the - typical (and annoying) lengthy expressions that result when you have - multiple arguments that use generics. - - - The following is the complete example explained above: - - public static class Orders - { - [Matcher] - public static IEnumerable<Order> Contains(Order order) - { - return null; - } - - public static bool Contains(IEnumerable<Order> orders, Order order) - { - return orders.Contains(order); - } - } - - And the concrete test using this matcher: - - var order = new Order { ... }; - var mock = new Mock<IRepository<Order>>(); - - mock.Expect(x => x.Save(Orders.Contains(order))) - .Throws<ArgumentException>(); - - // use mock, invoke Save, and have the matcher filter. - - - - - - Casts the expression to a lambda expression, removing - a cast if there's any. - - - - - Casts the body of the lambda expression to a . - - If the body is not a method call. - - - - Converts the body of the lambda expression into the referenced by it. - - - - - Checks whether the body of the lambda expression is a property access. - - - - - Checks whether the expression is a property access. - - - - - Checks whether the body of the lambda expression is a property indexer, which is true - when the expression is an whose - has - equal to . - - - - - Checks whether the expression is a property indexer, which is true - when the expression is an whose - has - equal to . - - - - - Creates an expression that casts the given expression to the - type. - - - - - TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583 - is fixed. - - - - - Base class for visitors of expression trees. - - - Provides the functionality of the internal visitor base class that - comes with Linq. - Matt's comments on the implementation: - - In this variant there is only one visitor class that dispatches calls to the general - Visit function out to specific VisitXXX methods corresponding to different node types. - Note not every node type gets it own method, for example all binary operators are - treated in one VisitBinary method. The nodes themselves do not directly participate - in the visitation process. They are treated as just data. - The reason for this is that the quantity of visitors is actually open ended. - You can write your own. Therefore no semantics of visiting is coupled into the node classes. - It’s all in the visitors. The default visit behavior for node XXX is baked into the base - class’s version of VisitXXX. - - - Another variant is that all VisitXXX methods return a node. - The Expression tree nodes are immutable. In order to change the tree you must construct - a new one. The default VisitXXX methods will construct a new node if any of its sub-trees change. - If no changes are made then the same node is returned. That way if you make a change - to a node (by making a new node) deep down in a tree, the rest of the tree is rebuilt - automatically for you. - - See: http://blogs.msdn.com/mattwar/archive/2007/07/31/linq-building-an-iqueryable-provider-part-ii.aspx. - - Matt Warren: http://blogs.msdn.com/mattwar - Documented by InSTEDD: http://www.instedd.org - - - - Default constructor used by derived visitors. - - - - - Visits the , determining which - of the concrete Visit methods to call. - - - - - Visits the generic , determining and - calling the appropriate Visit method according to the - , which will result - in calls to , - or . - - - - - - - Visits the initializer by - calling the for the - . - - - - - Visits the expression by - calling with the expression. - - - - - Visits the by calling - with the , - and - expressions. - - - - - Visits the by calling - with the - expression. - - - - - Visits the , by default returning the - same without further behavior. - - - - - Visits the by calling - with the , - and - expressions. - - - - - Visits the returning it - by default without further behavior. - - - - - Visits the by calling - with the - expression. - - - - - Visits the by calling - with the expression, - and then with the . - - - - - - - Visits the by iterating - the list and visiting each in it. - - - - - - - Visits the by calling - with the expression. - - - - - - - Visits the by calling - with the . - - - - - - - Visits the by calling - with the - . - - - - - - - Visits the by - calling for each in the - collection. - - - - - - - Visits the by - calling for each - in the collection. - - - - - - - Visits the by calling - with the expression. - - - - - - - Visits the by calling - with the - expressions. - - - - - - - Visits the by calling - with the - expression, then with the - . - - - - - Visits the by calling - with the - expression, and then with the - . - - - - - - - Visits the by calling - with the - expressions. - - - - - - - Visits the by calling - with the - expressions. - - - - - - - Provides partial evaluation of subtrees, whenever they can be evaluated locally. - - Matt Warren: http://blogs.msdn.com/mattwar - Documented by InSTEDD: http://www.instedd.org - - - - Performs evaluation and replacement of independent sub-trees - - The root of the expression tree. - A function that decides whether a given expression - node can be part of the local function. - A new tree with sub-trees evaluated and replaced. - - - - Performs evaluation and replacement of independent sub-trees - - The root of the expression tree. - A new tree with sub-trees evaluated and replaced. - - - - Evaluates and replaces sub-trees when first candidate is reached (top-down) - - - - - Performs bottom-up analysis to determine which nodes can possibly - be part of an evaluated sub-tree. - - - - - Checks an argument to ensure it isn't null. - - The argument value to check. - The name of the argument. - - - - Checks a string argument to ensure it isn't null or empty. - - The argument value to check. - The name of the argument. - - - - Defines the Returns verb for property get expectations. - - Type of the property. - - - - Base interface for . - - - - - Specifies the value to return. - - The value to return, or . - - Return a true value from the property getter call: - - mock.ExpectGet(x => x.Suspended) - .Returns(true); - - - - - - Specifies a function that will calculate the value to return for the property. - - The function that will calculate the return value. - - Return a calculated value when the property is retrieved: - - mock.ExpectGet(x => x.Suspended) - .Returns(() => returnValues[0]); - - The lambda expression to retrieve the return value is lazy-executed, - meaning that its value may change depending on the moment the property - is retrieved and the value the returnValues array has at - that moment. - - - - - Defines the Callback verb for property getter expectations. - - - Type of the property. - - - - Specifies a callback to invoke when the property is retrieved. - - Callback method to invoke. - - Invokes the given callback with the property value being set. - - mock.ExpectGet(x => x.Suspended) - .Callback(() => called = true) - .Returns(true); - - - - - - Implements the fluent API. - - - - - Implements the fluent API. - - - - - Defines the Returns verb. - - Type of the return value from the expression. - - - - Specifies the value to return. - - The value to return, or . - - Return a true value from the method call: - - mock.Expect(x => x.Execute("ping")) - .Returns(true); - - - - - - Specifies a function that will calculate the value to return from the method. - - The function that will calculate the return value. - - Return a calculated value when the method is called: - - mock.Expect(x => x.Execute("ping")) - .Returns(() => returnValues[0]); - - The lambda expression to retrieve the return value is lazy-executed, - meaning that its value may change depending on the moment the method - is executed and the value the returnValues array has at - that moment. - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - Type of the argument of the invoked method. - The function that will calculate the return value. - - Return a calculated value which is evaluated lazily at the time of the invocation. - - The lookup list can change between invocations and the expectation - will return different values accordingly. Also, notice how the specific - string argument is retrieved by simply declaring it as part of the lambda - expression: - - - mock.Expect(x => x.Execute(It.IsAny<string>())) - .Returns((string command) => returnValues[command]); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - Type of the first argument of the invoked method. - Type of the second argument of the invoked method. - The function that will calculate the return value. - - Return a calculated value which is evaluated lazily at the time of the invocation. - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Expect(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>())) - .Returns((string arg1, string arg2) => arg1 + arg2); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - Type of the first argument of the invoked method. - Type of the second argument of the invoked method. - Type of the third argument of the invoked method. - The function that will calculate the return value. - - Return a calculated value which is evaluated lazily at the time of the invocation. - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Expect(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, int arg3) => arg1 + arg2 + arg3); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - Type of the first argument of the invoked method. - Type of the second argument of the invoked method. - Type of the third argument of the invoked method. - Type of the fourth argument of the invoked method. - The function that will calculate the return value. - - Return a calculated value which is evaluated lazily at the time of the invocation. - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Expect(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<int>(), - It.IsAny<bool>())) - .Returns((string arg1, string arg2, int arg3, bool arg4) => arg1 + arg2 + arg3 + arg4); - - - - - - Defines the Throws verb. - - - - - Specifies the exception to throw when the method is invoked. - - Exception instance to throw. - - This example shows how to throw an exception when the method is - invoked with an empty string argument: - - mock.Expect(x => x.Execute("")) - .Throws(new ArgumentException()); - - - - - - Specifies the type of exception to throw when the method is invoked. - - Type of exception to instantiate and throw when the expectation is met. - - This example shows how to throw an exception when the method is - invoked with an empty string argument: - - mock.Expect(x => x.Execute("")) - .Throws<ArgumentException>(); - - - - - - Implements the fluent API. - - - - - Implements the fluent API. - - - - - Defines the Callback verb and overloads for callbacks on - expectations that return a value. - - Type of the return value of the expectation. - - - - Specifies a callback to invoke when the method is called. - - Callback method to invoke. - - The following example specifies a callback to set a boolean - value that can be used later: - - bool called = false; - mock.Expect(x => x.Execute()) - .Callback(() => called = true) - .Returns(true); - - Note that in the case of value-returning methods, after the Callback - call you can still specify the return value. - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - Type of the argument of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation argument value. - - Notice how the specific string argument is retrieved by simply declaring - it as part of the lambda expression for the callback: - - - mock.Expect(x => x.Execute(It.IsAny<string>())) - .Callback((string command) => Console.WriteLine(command)) - .Returns(true); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - Type of the first argument of the invoked method. - Type of the second argument of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Expect(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2)) - .Returns(true); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - Type of the first argument of the invoked method. - Type of the second argument of the invoked method. - Type of the third argument of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Expect(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<int>())) - .Callback((string arg1, string arg2, int arg3) => Console.WriteLine(arg1 + arg2 + arg3)) - .Returns(true); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - Type of the first argument of the invoked method. - Type of the second argument of the invoked method. - Type of the third argument of the invoked method. - Type of the fourth argument of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Expect(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<int>(), - It.IsAny<bool>())) - .Callback((string arg1, string arg2, int arg3, bool arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)) - .Returns(true); - - - - - - Implemented by all generated mock object instances. - - - - - Implemented by all generated mock object instances. - - - - - Reference the Mock that contains this as the mock.Object value. - - - - - Reference the Mock that contains this as the mock.Object value. - - - - - Implements the actual interception and method invocation for - all mocks. - - - - - Get an eventInfo for a given event name. Search type ancestors depth first if necessary. - - Name of the event, with the set_ or get_ prefix already removed - - - - Given a type return all of its ancestors, both types and interfaces. - - The type to find immediate ancestors of - - - - Implements the fluent API. - - - - - Defines the Never verb. - - - - - The expected invocation is never expected to happen. - - - - var mock = new Mock<ICommand>(); - mock.Expect(foo => foo.Execute("ping")) - .Never(); - - - - is always verified inmediately as - the invocations are performed, like strict mocks do - with unexpected invocations. - - - - - Implements the fluent API. - - - - - Implements the fluent API. - - - - - Implements the fluent API. - - - - - Defines the Callback verb for property setter expectations. - - - - Type of the property. - - - - Specifies a callback to invoke when the property is set that receives the - property value being set. - - Callback method to invoke. - - Invokes the given callback with the property value being set. - - mock.ExpectSet(x => x.Suspended) - .Callback((bool state) => Console.WriteLine(state)); - - - - - - Allows the specification of a matching condition for an - argument in a method invocation, rather than a specific - argument value. "It" refers to the argument being matched. - - - This class allows the expectation to match a method invocation - with an arbitrary value, with a value in a specified range, or - even one that matches a given predicate. - - - - - Matches any value of the given type. - - - Typically used when the actual argument value for a method - call is not relevant. - - - - // Throws an exception for a call to Remove with any string value. - mock.Expect(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException()); - - - Type of the value. - - - - Matches any value that satisfies the given predicate. - - Type of the argument to check. - The predicate used to match the method argument. - - Allows the specification of a predicate to perform matching - of method call arguments. - - - This example shows how to return the value 1 whenever the argument to the - Do method is an even number. - - mock.Expect(x => x.Do(It.Is<int>(i => i % 2 == 0))) - .Returns(1); - - This example shows how to throw an exception if the argument to the - method is a negative number: - - mock.Expect(x => x.GetUser(It.Is<int>(i => i < 0))) - .Throws(new ArgumentException()); - - - - - - Matches any value that is in the range specified. - - Type of the argument to check. - The lower bound of the range. - The upper bound of the range. - The kind of range. See . - - The following example shows how to expect a method call - with an integer argument within the 0..100 range. - - mock.Expect(x => x.HasInventory( - It.IsAny<string>(), - It.IsInRange(0, 100, Range.Inclusive))) - .Returns(false); - - - - - - Matches a string argument if it matches the given regular expression pattern. - - The pattern to use to match the string argument value. - - The following example shows how to expect a call to a method where the - string argument matches the given regular expression: - - mock.Expect(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1); - - - - - - Matches a string argument if it matches the given regular expression pattern. - - The pattern to use to match the string argument value. - The options used to interpret the pattern. - - The following example shows how to expect a call to a method where the - string argument matches the given regular expression, in a case insensitive way: - - mock.Expect(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1); - - - - - - Matcher to treat static functions as matchers. - - mock.Expect(x => x.StringMethod(A.MagicString())); - - pbulic static class A - { - [Matcher] - public static string MagicString() { return null; } - public static bool MagicString(string arg) - { - return arg == "magic"; - } - } - - Will success if: mock.Object.StringMethod("magic"); - and fail with any other call. - - - - - We need this non-generics base class so that - we can use from - generic code. - - - - - Base class for mocks and static helper class with methods that - apply to mocked objects, such as to - retrieve a from an object instance. - - - - - Base mock interface exposing non-generic members. - - - - - Creates a handler that can be associated to an event receiving - the given and can be used - to raise the event. - - Type of - data passed in to the event. - - This example shows how to invoke an event with a custom event arguments - class in a view that will cause its corresponding presenter to - react by changing its state: - - var mockView = new Mock<IOrdersView>(); - var mockedEvent = mockView.CreateEventHandler<OrderEventArgs>(); - - var presenter = new OrdersPresenter(mockView.Object); - - // Check that the presenter has no selection by default - Assert.Null(presenter.SelectedOrder); - - // Create a mock event handler of the appropriate type - var handler = mockView.CreateEventHandler<OrderEventArgs>(); - // Associate it with the event we want to raise - mockView.Object.Cancel += handler; - // Finally raise the event with a specific arguments data - handler.Raise(new OrderEventArgs { Order = new Order("moq", 500) }); - - // Now the presenter reacted to the event, and we have a selected order - Assert.NotNull(presenter.SelectedOrder); - Assert.Equal("moq", presenter.SelectedOrder.ProductName); - - - - - - Creates a handler that can be associated to an event receiving - a generic and can be used - to raise the event. - - - This example shows how to invoke a generic event in a view that will - cause its corresponding presenter to react by changing its state: - - var mockView = new Mock<IOrdersView>(); - var mockedEvent = mockView.CreateEventHandler(); - - var presenter = new OrdersPresenter(mockView.Object); - - // Check that the presenter is not in the "Canceled" state - Assert.False(presenter.IsCanceled); - - // Create a mock event handler of the appropriate type - var handler = mockView.CreateEventHandler(); - // Associate it with the event we want to raise - mockView.Object.Cancel += handler; - // Finally raise the event - handler.Raise(EventArgs.Empty); - - // Now the presenter reacted to the event, and changed its state - Assert.True(presenter.IsCanceled); - - - - - - Verifies that all verifiable expectations have been met. - - - This example sets up an expectation and marks it as verifiable. After - the mock is used, a call is issued on the mock - to ensure the method in the expectation was invoked: - - var mock = new Mock<IWarehouse>(); - mock.Expect(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true); - ... - // other test code - ... - // Will throw if the test code has didn't call HasInventory. - mock.Verify(); - - - Not all verifiable expectations were met. - - - - Verifies all expectations regardless of whether they have - been flagged as verifiable. - - - This example sets up an expectation without marking it as verifiable. After - the mock is used, a call is issued on the mock - to ensure that all expectations are met: - - var mock = new Mock<IWarehouse>(); - mock.Expect(x => x.HasInventory(TALISKER, 50)).Returns(true); - ... - // other test code - ... - // Will throw if the test code has didn't call HasInventory, even - // that expectation was not marked as verifiable. - mock.VerifyAll(); - - - At least one expectation was not met. - - - - Whether the base member virtual implementation will be called - for mocked classes if no expectation is met. Defaults to . - - - - - Determines how to generate default values for loose mocks on - unexpected invocations. - - - - - The mocked object instance. - - - - - Retrieves the mock object for the given object instance. - - Type of the mock to retrieve. Can be omitted as it's inferred - from the object instance passed in as the instance. - The instance of the mocked object. - The mock associated with the mocked object. - The received instance - was not created by Moq. - - The following example shows how to add a new expectation to an object - instance which is not the original but rather - the object associated with it: - - // Typed instance, not the mock, is retrieved from some test API. - HttpContextBase context = GetMockContext(); - - // context.Request is the typed object from the "real" API - // so in order to add an expectation to it, we need to get - // the mock that "owns" it - Mock<HttpRequestBase> request = Mock.Get(context.Request); - mock.Expect(req => req.AppRelativeCurrentExecutionFilePath) - .Returns(tempUrl); - - - - - - Initializes the mock - - - - - Returns the mocked object value. - - - - - Implements . - - - - - Implements . - - - - - Gets the interceptor target for the given expression and root mock, - building the intermediate hierarchy of mock objects if necessary. - - - - - Implements . - - Type of event argument class. - - - - Implements - - - - - Base class for mocks and static helper class with methods that - apply to mocked objects, such as to - retrieve a from an object instance. - - - - - Exposes the list of extra interfaces implemented by the mock. - - - - - Implements . - - - - - Implements . - - - - - Implements . - - - - - Specifies the class that will determine the default - value to return when invocations are made that - have no expectations and need to return a default - value (for loose mocks). - - - - - The mocked object instance. Implements . - - - - - Retrieves the type of the mocked object, its generic type argument. - This is used in the auto-mocking of hierarchy access. - - - - - Represents a generic event that has been mocked and can - be rised. - - - - - Provided solely to allow the interceptor to determine when the attached - handler is coming from this mocked event so we can assign the - corresponding EventInfo for it. - - - - - Raises the associated event with the given - event argument data. - - - - - Provides support for attaching a to - a generic event. - - Event to convert. - - - - Event raised whenever the mocked event is rised. - - - - - Options to customize the behavior of the mock. - - - - - Causes the mock to always throw - an exception for invocations that don't have a - corresponding expectation. - - - - - Will never throw exceptions, returning default - values when necessary (null for reference types, - zero for value types or empty enumerables and arrays). - - - - - Default mock behavior, which equals . - - - - - Exception thrown by mocks when expectations are not met, - the mock is not properly setup, etc. - - - A distinct exception type is provided so that exceptions - thrown by the mock can be differentiated in tests that - expect other exceptions to be thrown (i.e. ArgumentException). - - Richer exception hierarchy/types are not provided as - tests typically should not catch or expect exceptions - from the mocks. These are typically the result of changes - in the tested class or its collaborators implementation, and - result in fixes in the mock setup so that they dissapear and - allow the test to pass. - - - - - - Supports the serialization infrastructure. - - Serialization information. - Streaming context. - - - - Supports the serialization infrastructure. - - Serialization information. - Streaming context. - - - - Made internal as it's of no use for - consumers, but it's important for - our own tests. - - - - - Used by the mock factory to accumulate verification - failures. - - - - - Supports the serialization infrastructure. - - - - - Utility factory class to use to construct multiple - mocks when consistent verification is - desired for all of them. - - - If multiple mocks will be created during a test, passing - the desired (if different than the - or the one - passed to the factory constructor) and later verifying each - mock can become repetitive and tedious. - - This factory class helps in that scenario by providing a - simplified creation of multiple mocks with a default - (unless overriden by calling - ) and posterior verification. - - - - The following is a straightforward example on how to - create and automatically verify strict mocks using a : - - var factory = new MockFactory(MockBehavior.Strict); - - var foo = factory.Create<IFoo>(); - var bar = factory.Create<IBar>(); - - // no need to call Verifiable() on the expectation - // as we'll be validating all expectations anyway. - foo.Expect(f => f.Do()); - bar.Expect(b => b.Redo()); - - // exercise the mocks here - - factory.VerifyAll(); - // At this point all expectations are already checked - // and an optional MockException might be thrown. - // Note also that because the mocks are strict, any invocation - // that doesn't have a matching expectation will also throw a MockException. - - The following examples shows how to setup the factory - to create loose mocks and later verify only verifiable expectations: - - var factory = new MockFactory(MockBehavior.Loose); - - var foo = factory.Create<IFoo>(); - var bar = factory.Create<IBar>(); - - // this expectation will be verified at the end of the "using" block - foo.Expect(f => f.Do()).Verifiable(); - - // this expectation will NOT be verified - foo.Expect(f => f.Calculate()); - - // this expectation will be verified at the end of the "using" block - bar.Expect(b => b.Redo()).Verifiable(); - - // exercise the mocks here - // note that because the mocks are Loose, members - // called in the interfaces for which no matching - // expectations exist will NOT throw exceptions, - // and will rather return default values. - - factory.Verify(); - // At this point verifiable expectations are already checked - // and an optional MockException might be thrown. - - The following examples shows how to setup the factory with a - default strict behavior, overriding that default for a - specific mock: - - var factory = new MockFactory(MockBehavior.Strict); - - // this particular one we want loose - var foo = factory.Create<IFoo>(MockBehavior.Loose); - var bar = factory.Create<IBar>(); - - // set expectations - - // exercise the mocks here - - factory.Verify(); - - - - - - - Initializes the factory with the given - for newly created mocks from the factory. - - The behavior to use for mocks created - using the factory method if not overriden - by using the overload. - - - - Creates a new mock with the default - specified at factory construction time. - - Type to mock. - A new . - - - var factory = new MockFactory(MockBehavior.Strict); - - var foo = factory.Create<IFoo>(); - // use mock on tests - - factory.VerifyAll(); - - - - - - Creates a new mock with the default - specified at factory construction time and with the - the given constructor arguments for the class. - - - The mock will try to find the best match constructor given the - constructor arguments, and invoke that to initialize the instance. - This applies only to classes, not interfaces. - - Type to mock. - Constructor arguments for mocked classes. - A new . - - - var factory = new MockFactory(MockBehavior.Default); - - var mock = factory.Create<MyBase>("Foo", 25, true); - // use mock on tests - - factory.Verify(); - - - - - - Creates a new mock with the given . - - Type to mock. - Behavior to use for the mock, which overrides - the default behavior specified at factory construction time. - A new . - - The following example shows how to create a mock with a different - behavior to that specified as the default for the factory: - - var factory = new MockFactory(MockBehavior.Strict); - - var foo = factory.Create<IFoo>(MockBehavior.Loose); - - - - - - Creates a new mock with the given - and with the the given constructor arguments for the class. - - - The mock will try to find the best match constructor given the - constructor arguments, and invoke that to initialize the instance. - This applies only to classes, not interfaces. - - Type to mock. - Behavior to use for the mock, which overrides - the default behavior specified at factory construction time. - Constructor arguments for mocked classes. - A new . - - The following example shows how to create a mock with a different - behavior to that specified as the default for the factory, passing - constructor arguments: - - var factory = new MockFactory(MockBehavior.Default); - - var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true); - - - - - - Implements creation of a new mock within the factory. - - Type to mock. - The behavior for the new mock. - Optional arguments for the construction of the mock. - - - - Verifies all verifiable expectations on all mocks created - by this factory. - - - One or more mocks had expectations that were not satisfied. - - - - Verifies all verifiable expectations on all mocks created - by this factory. - - - One or more mocks had expectations that were not satisfied. - - - - Invokes for each mock - in , and accumulates the resulting - that might be - thrown from the action. - - The action to execute against - each mock. - - - - Whether the base member virtual implementation will be called - for mocked classes if no expectation is met. Defaults to . - - - - - Specifies the behavior to use when returning default values for - unexpected invocations on loose mocks. - - - - - Gets the mocks that have been created by this factory and - that will get verified together. - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - Looks up a localized string similar to Mock type has already been initialized by accessing its Object property. Adding interfaces must be done before that.. - - - - - Looks up a localized string similar to Can only add interfaces to the mock.. - - - - - Looks up a localized string similar to Can't set return value for void method {0}.. - - - - - Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks.. - - - - - Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type.. - - - - - Looks up a localized string similar to Invalid expectation on a non-overridable member: - {0}. - - - - - Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>.. - - - - - Looks up a localized string similar to Invocation {0} should not have been made.. - - - - - Looks up a localized string similar to Expression is not a method invocation: {0}. - - - - - Looks up a localized string similar to Expression is not a property access: {0}. - - - - - Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead.. - - - - - Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. . - - - - - Looks up a localized string similar to Cannot retrieve a mock with the given object type {0} as it's not the main type of the mock or any of its additional interfaces. - Please cast the argument to one of the supported types: {1}. - Remember that there's no generics covariance in the CLR, so your object must be one of these types in order for the call to succeed.. - - - - - Looks up a localized string similar to Member {0}.{1} does not exist.. - - - - - Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead: - mock.Expect(x => x.{1}()); - . - - - - - Looks up a localized string similar to {0} invocation failed with mock behavior {1}. - {2}. - - - - - Looks up a localized string similar to Expected only {0} calls to {1}.. - - - - - Looks up a localized string similar to Expected only one call to {0}.. - - - - - Looks up a localized string similar to All invocations on the mock must have a corresponding expectation.. - - - - - Looks up a localized string similar to The given invocation was not performed on the mock.. - - - - - Looks up a localized string similar to Object instance was not created by Moq.. - - - - - Looks up a localized string similar to Property {0}.{1} does not exist.. - - - - - Looks up a localized string similar to Property {0}.{1} is write-only.. - - - - - Looks up a localized string similar to Property {0}.{1} is read-only.. - - - - - Looks up a localized string similar to Cannot raise a mocked event unless it has been associated (attached) to a concrete event in a mocked object.. - - - - - Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding expectation that provides it.. - - - - - Looks up a localized string similar to To set expectations for public property {0}.{1}, use the typed overloads, such as: - mock.Expect(x => x.{1}).Returns(value); - mock.ExpectGet(x => x.{1}).Returns(value); //equivalent to previous one - mock.ExpectSet(x => x.{1}).Callback(callbackDelegate); - . - - - - - Looks up a localized string similar to Expression {0} is not supported.. - - - - - Looks up a localized string similar to Only property accesses are supported in intermediate invocations on an expectation. Unsupported expression {0}.. - - - - - Looks up a localized string similar to Expression contains intermediate property access {0}.{1} which is of type {2} and cannot be mocked. Unsupported expression {3}.. - - - - - Looks up a localized string similar to Member {0} is not supported for protected mocking.. - - - - - Looks up a localized string similar to To set expectations for protected property {0}.{1}, use: - mock.Expect<{2}>(x => x.{1}).Returns(value); - mock.ExpectGet(x => x.{1}).Returns(value); //equivalent to previous one - mock.ExpectSet(x => x.{1}).Callback(callbackDelegate);. - - - - - Looks up a localized string similar to The following expectations were not met: - {0}. - - - - - Allows expectations to be set for protected members by using their - name as a string, rather than strong-typing them which is not possible - due to their visibility. - - - - - Sets an expectation on the void method with the given - , optionally specifying - arguments for the method call. - - Name of the void method to be invoke. - Optional arguments for the invocation. - - - - Sets an expectation on a property or a non void method with the given - , optionally specifying - arguments for the method call. - - Name of the method or property to be invoke. - Optional arguments for the invocation. - Return type of the method or property. - - - - Sets an expectation on a property getter with the given - . - - Name of the property. - Type of the property. - - - - Sets an expectation on a property setter with the given - . - - Name of the property. - Type of the property. - - - - Allows the specification of a matching condition for an - argument in a protected member expectation, rather than a specific - argument value. "ItExpr" refers to the argument being matched. - - - Use this variant of argument matching instead of - for protected expectations. - This class allows the expectation to match a method invocation - with an arbitrary value, with a value in a specified range, or - even one that matches a given predicate. - - - - - Matches any value of the given type. - - - Typically used when the actual argument value for a method - call is not relevant. - - - - // Throws an exception for a call to Remove with any string value. - mock.Protected() - .Expect("Remove", ItExpr.IsAny<string>()) - .Throws(new InvalidOperationException()); - - - Type of the value. - - - - Matches any value that satisfies the given predicate. - - Type of the argument to check. - The predicate used to match the method argument. - - Allows the specification of a predicate to perform matching - of method call arguments. - - - This example shows how to return the value 1 whenever the argument to the - Do method is an even number. - - mock.Protected() - .Expect("Do", ItExpr.Is<int>(i => i % 2 == 0)) - .Returns(1); - - This example shows how to throw an exception if the argument to the - method is a negative number: - - mock.Protected() - .Expect("GetUser", ItExpr.Is<int>(i => i < 0)) - .Throws(new ArgumentException()); - - - - - - Matches any value that is in the range specified. - - Type of the argument to check. - The lower bound of the range. - The upper bound of the range. - The kind of range. See . - - The following example shows how to expect a method call - with an integer argument within the 0..100 range. - - mock.Protected() - .Expect("HasInventory", - ItExpr.IsAny<string>(), - ItExpr.IsInRange(0, 100, Range.Inclusive)) - .Returns(false); - - - - - - Matches a string argument if it matches the given regular expression pattern. - - The pattern to use to match the string argument value. - - The following example shows how to expect a call to a method where the - string argument matches the given regular expression: - - mock.Protected() - .Expect("Check", ItExpr.IsRegex("[a-z]+")) - .Returns(1); - - - - - - Matches a string argument if it matches the given regular expression pattern. - - The pattern to use to match the string argument value. - The options used to interpret the pattern. - - The following example shows how to expect a call to a method where the - string argument matches the given regular expression, in a case insensitive way: - - mock.Protected() - .Expect("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase)) - .Returns(1); - - - - - - Enables the Protected() method on , - allowing expectations to be set for protected members by using their - name as a string, rather than strong-typing them which is not possible - due to their visibility. - - - - - Enable protected expectations for the mock. - - Mocked object type. Typically omitted as it can be inferred from the mock instance. - The mock to set the protected expectations on. - - - - - - - - - - - - Kind of range to use in a filter specified through - . - - - - - The range includes the to and - from values. - - - - - The range does not include the to and - from values. - - - - - Determines the way default values are generated - calculated for loose mocks. - - - - - Default behavior, which generates empty values for - value types (i.e. default(int)), empty array and - enumerables, and nulls for all other reference types. - - - - - Whenever the default value generated by - is null, replaces this value with a mock (if the type - can be mocked). - - - For sealed classes, a null value will be generated. - - - - - Core implementation of the interface. - - - Type to mock. - - - - Initializes an instance of the mock with default behavior and with - the given constructor arguments for the class. (Only valid when is a class) - - - The mock will try to find the best match constructor given the constructor arguments, and invoke that - to initialize the instance. This applies only for classes, not interfaces. - - - var mock = new Mock<MyProvider>(someArgument, 25); - - Optional constructor arguments if the mocked type is a class. - - - - Initializes an instance of the mock with default behavior. - - - var mock = new Mock<IFormatProvider>(); - - - - - Initializes an instance of the mock with the specified behavior. - - - var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed); - - Behavior of the mock. - - - - Initializes an instance of the mock with a specific behavior with - the given constructor arguments for the class. - - - The mock will try to find the best match constructor given the constructor arguments, and invoke that - to initialize the instance. This applies only to classes, not interfaces. - - - var mock = new Mock<MyProvider>(someArgument, 25); - - Behavior of the mock. - Optional constructor arguments if the mocked type is a class. - - - - Returns the mocked object value. - - - - - Implements . - - Lambda expression that specifies the expected method invocation. - - - - Implements . - - Type of the return value. Typically omitted as it can be inferred from the expression. - Lambda expression that specifies the expected method invocation. - - - - Implements . - - Type of the property. Typically omitted as it can be inferred from the expression. - Lambda expression that specifies the expected property getter. - - - - Implements . - - Type of the property. Typically omitted as it can be inferred from the expression. - Lambda expression that specifies the expected property setter. - - - - Implements . - - Type of the property. Typically omitted as it can be inferred from the expression. - Lambda expression that specifies the expected property setter. - The value expected to be set for the property. - - - - Implements . - - Expression to verify. - - - - Implements . - - Expression to verify. - Type of return value from the expression. - - - - Implements . - - Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Implements . - - Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Implements . - - Expression to verify. - The value that should have been set on the property. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Implements . - - - - - Implements . - - - - - Implements . - - Type of interface to cast the mock to. - - - - Exposes the mocked object instance. - - - - - A that returns an empty default value - for non-mockeable types, and mocks for all other types (interfaces and - non-sealed classes) that can be mocked. - - - - - Provides a typed for a - specific type of . - - The type of event arguments required by the event. - - The mocked event can either be a or custom - event handler which follows .NET practice of providing object sender, EventArgs args - kind of signature. - - - - - Raises the associated event with the given - event argument data. - - Data to pass to the event. - - - - Provides support for attaching a to - a generic event. - - Event to convert. - - - - Provided solely to allow the interceptor to determine when the attached - handler is coming from this mocked event so we can assign the - corresponding EventInfo for it. - - - - - Adds Stub extension method to a mock so that you can - stub properties. - - - - - Specifies that the given property should have stub behavior, - meaning that setting its value will cause it to be saved and - later returned when the property is requested. - - Mocked type, inferred from the object - where this method is being applied (does not need to be specified). - Type of the property, inferred from the property - expression (does not need to be specified). - The instance to stub. - Property expression to stub. - - If you have an interface with an int property Value, you might - stub it using the following straightforward call: - - var mock = new Mock<IHaveValue>(); - mock.Stub(v => v.Value); - - After the Stub call has been issued, setting and - retrieving the object value will behave as expected: - - IHaveValue v = mock.Object; - - v.Value = 5; - Assert.Equal(5, v.Value); - - - - - - Specifies that the given property should have stub behavior, - meaning that setting its value will cause it to be saved and - later returned when the property is requested. This overload - allows setting the initial value for the property. - - Mocked type, inferred from the object - where this method is being applied (does not need to be specified). - Type of the property, inferred from the property - expression (does not need to be specified). - The instance to stub. - Property expression to stub. - Initial value for the property. - - If you have an interface with an int property Value, you might - stub it using the following straightforward call: - - var mock = new Mock<IHaveValue>(); - mock.Stub(v => v.Value, 5); - - After the Stub call has been issued, setting and - retrieving the object value will behave as expected: - - IHaveValue v = mock.Object; - // Initial value was stored - Assert.Equal(5, v.Value); - - // New value set which changes the initial value - v.Value = 6; - Assert.Equal(6, v.Value); - - - - - - Stubs all properties on the mock, setting the default value to - the one generated as specified by the - property. - - Mocked type, typically omitted as it can be inferred from the mock argument. - The mock to stub. - - If the mock is set to , - the mocked default values will also be stubbed recursively. - - - - diff --git a/lib/tests/Northwind.Common.dll b/lib/tests/Northwind.Common.dll deleted file mode 100644 index b33ffb1092a..00000000000 Binary files a/lib/tests/Northwind.Common.dll and /dev/null differ diff --git a/lib/tests/ServiceStack.Mvc.Stubs.Tests.dll b/lib/tests/ServiceStack.Mvc.Stubs.Tests.dll deleted file mode 100644 index d9833edd1b3..00000000000 Binary files a/lib/tests/ServiceStack.Mvc.Stubs.Tests.dll and /dev/null differ diff --git a/lib/tests/nunit-console-runner.dll b/lib/tests/nunit-console-runner.dll deleted file mode 100644 index e637d6523b6..00000000000 Binary files a/lib/tests/nunit-console-runner.dll and /dev/null differ diff --git a/lib/tests/nunit-console-x86.exe b/lib/tests/nunit-console-x86.exe deleted file mode 100644 index 0f9a832d3be..00000000000 Binary files a/lib/tests/nunit-console-x86.exe and /dev/null differ diff --git a/lib/tests/nunit-console-x86.exe.config b/lib/tests/nunit-console-x86.exe.config deleted file mode 100644 index 8a6a2a6a669..00000000000 --- a/lib/tests/nunit-console-x86.exe.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/tests/nunit-console.exe b/lib/tests/nunit-console.exe deleted file mode 100644 index db1700badd1..00000000000 Binary files a/lib/tests/nunit-console.exe and /dev/null differ diff --git a/lib/tests/nunit-console.exe.config b/lib/tests/nunit-console.exe.config deleted file mode 100644 index 8a6a2a6a669..00000000000 --- a/lib/tests/nunit-console.exe.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/tests/nunit.core.dll b/lib/tests/nunit.core.dll deleted file mode 100644 index 1c57782550d..00000000000 Binary files a/lib/tests/nunit.core.dll and /dev/null differ diff --git a/lib/tests/nunit.core.interfaces.dll b/lib/tests/nunit.core.interfaces.dll deleted file mode 100644 index 941d4931d98..00000000000 Binary files a/lib/tests/nunit.core.interfaces.dll and /dev/null differ diff --git a/lib/tests/nunit.framework.dll b/lib/tests/nunit.framework.dll deleted file mode 100644 index 215767d2fb3..00000000000 Binary files a/lib/tests/nunit.framework.dll and /dev/null differ diff --git a/lib/tests/nunit.framework.extensions.dll b/lib/tests/nunit.framework.extensions.dll deleted file mode 100644 index 91e05857a68..00000000000 Binary files a/lib/tests/nunit.framework.extensions.dll and /dev/null differ diff --git a/lib/tests/nunit.framework.xml b/lib/tests/nunit.framework.xml deleted file mode 100644 index 7b0e798cada..00000000000 --- a/lib/tests/nunit.framework.xml +++ /dev/null @@ -1,10892 +0,0 @@ - - - - nunit.framework - - - - - Attribute used to apply a category to a test - - - - - The name of the category - - - - - Construct attribute for a given category based on - a name. The name may not contain the characters ',', - '+', '-' or '!'. However, this is not checked in the - constructor since it would cause an error to arise at - as the test was loaded without giving a clear indication - of where the problem is located. The error is handled - in NUnitFramework.cs by marking the test as not - runnable. - - The name of the category - - - - Protected constructor uses the Type name as the name - of the category. - - - - - The name of the category - - - - - Used to mark a field for use as a datapoint when executing a theory - within the same fixture that requires an argument of the field's Type. - - - - - Used to mark an array as containing a set of datapoints to be used - executing a theory within the same fixture that requires an argument - of the Type of the array elements. - - - - - Attribute used to provide descriptive text about a - test case or fixture. - - - - - Construct the attribute - - Text describing the test - - - - Gets the test description - - - - - Enumeration indicating how the expected message parameter is to be used - - - - Expect an exact match - - - Expect a message containing the parameter string - - - Match the regular expression provided as a parameter - - - Expect a message that starts with the parameter string - - - - ExpectedExceptionAttribute - - - - - - Constructor for a non-specific exception - - - - - Constructor for a given type of exception - - The type of the expected exception - - - - Constructor for a given exception name - - The full name of the expected exception - - - - Gets or sets the expected exception type - - - - - Gets or sets the full Type name of the expected exception - - - - - Gets or sets the expected message text - - - - - Gets or sets the user message displayed in case of failure - - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets the name of a method to be used as an exception handler - - - - - ExplicitAttribute marks a test or test fixture so that it will - only be run if explicitly executed from the gui or command line - or if it is included by use of a filter. The test will not be - run simply because an enclosing suite is run. - - - - - Default constructor - - - - - Constructor with a reason - - The reason test is marked explicit - - - - The reason test is marked explicit - - - - - Attribute used to mark a test that is to be ignored. - Ignored tests result in a warning message when the - tests are run. - - - - - Constructs the attribute without giving a reason - for ignoring the test. - - - - - Constructs the attribute giving a reason for ignoring the test - - The reason for ignoring the test - - - - The reason for ignoring a test - - - - - Abstract base for Attributes that are used to include tests - in the test run based on environmental settings. - - - - - Constructor with no included items specified, for use - with named property syntax. - - - - - Constructor taking one or more included items - - Comma-delimited list of included items - - - - Name of the item that is needed in order for - a test to run. Multiple itemss may be given, - separated by a comma. - - - - - Name of the item to be excluded. Multiple items - may be given, separated by a comma. - - - - - The reason for including or excluding the test - - - - - PlatformAttribute is used to mark a test fixture or an - individual method as applying to a particular platform only. - - - - - Constructor with no platforms specified, for use - with named property syntax. - - - - - Constructor taking one or more platforms - - Comma-deliminted list of platforms - - - - CultureAttribute is used to mark a test fixture or an - individual method as applying to a particular Culture only. - - - - - Constructor with no cultures specified, for use - with named property syntax. - - - - - Constructor taking one or more cultures - - Comma-deliminted list of cultures - - - - Marks a test to use a combinatorial join of any argument data - provided. NUnit will create a test case for every combination of - the arguments provided. This can result in a large number of test - cases and so should be used judiciously. This is the default join - type, so the attribute need not be used except as documentation. - - - - - PropertyAttribute is used to attach information to a test as a name/value pair.. - - - - - Construct a PropertyAttribute with a name and string value - - The name of the property - The property value - - - - Construct a PropertyAttribute with a name and int value - - The name of the property - The property value - - - - Construct a PropertyAttribute with a name and double value - - The name of the property - The property value - - - - Constructor for derived classes that set the - property dictionary directly. - - - - - Constructor for use by derived classes that use the - name of the type as the property name. Derived classes - must ensure that the Type of the property value is - a standard type supported by the BCL. Any custom - types will cause a serialization Exception when - in the client. - - - - - Gets the property dictionary for this attribute - - - - - Default constructor - - - - - Marks a test to use pairwise join of any argument data provided. - NUnit will attempt too excercise every pair of argument values at - least once, using as small a number of test cases as it can. With - only two arguments, this is the same as a combinatorial join. - - - - - Default constructor - - - - - Marks a test to use a sequential join of any argument data - provided. NUnit will use arguements for each parameter in - sequence, generating test cases up to the largest number - of argument values provided and using null for any arguments - for which it runs out of values. Normally, this should be - used with the same number of arguments for each parameter. - - - - - Default constructor - - - - - Summary description for MaxTimeAttribute. - - - - - Construct a MaxTimeAttribute, given a time in milliseconds. - - The maximum elapsed time in milliseconds - - - - RandomAttribute is used to supply a set of random values - to a single parameter of a parameterized test. - - - - - ValuesAttribute is used to provide literal arguments for - an individual parameter of a test. - - - - - Abstract base class for attributes that apply to parameters - and supply data for the parameter. - - - - - Gets the data to be provided to the specified parameter - - - - - The collection of data to be returned. Must - be set by any derived attribute classes. - We use an object[] so that the individual - elements may have their type changed in GetData - if necessary. - - - - - Construct with one argument - - - - - - Construct with two arguments - - - - - - - Construct with three arguments - - - - - - - - Construct with an array of arguments - - - - - - Get the collection of values to be used as arguments - - - - - Construct a set of doubles from 0.0 to 1.0, - specifying only the count. - - - - - - Construct a set of doubles from min to max - - - - - - - - Construct a set of ints from min to max - - - - - - - - Get the collection of values to be used as arguments - - - - - RangeAttribute is used to supply a range of values to an - individual parameter of a parameterized test. - - - - - Construct a range of ints using default step of 1 - - - - - - - Construct a range of ints specifying the step size - - - - - - - - Construct a range of longs - - - - - - - - Construct a range of doubles - - - - - - - - Construct a range of floats - - - - - - - - RepeatAttribute may be applied to test case in order - to run it multiple times. - - - - - Construct a RepeatAttribute - - The number of times to run the test - - - - RequiredAddinAttribute may be used to indicate the names of any addins - that must be present in order to run some or all of the tests in an - assembly. If the addin is not loaded, the entire assembly is marked - as NotRunnable. - - - - - Initializes a new instance of the class. - - The required addin. - - - - Gets the name of required addin. - - The required addin name. - - - - Summary description for SetCultureAttribute. - - - - - Construct given the name of a culture - - - - - - Summary description for SetUICultureAttribute. - - - - - Construct given the name of a culture - - - - - - SetUpAttribute is used in a TestFixture to identify a method - that is called immediately before each test is run. It is - also used in a SetUpFixture to identify the method that is - called once, before any of the subordinate tests are run. - - - - - Attribute used to mark a class that contains one-time SetUp - and/or TearDown methods that apply to all the tests in a - namespace or an assembly. - - - - - Attribute used to mark a static (shared in VB) property - that returns a list of tests. - - - - - Attribute used in a TestFixture to identify a method that is - called immediately after each test is run. It is also used - in a SetUpFixture to identify the method that is called once, - after all subordinate tests have run. In either case, the method - is guaranteed to be called, even if an exception is thrown. - - - - - Provide actions to execute before and after tests. - - - - - When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. - - - - - Executed before each test is run - - Provides details about the test that is going to be run. - - - - Executed after each test is run - - Provides details about the test that has just been run. - - - - Provides the target for the action attribute - - The target for the action attribute - - - - Adding this attribute to a method within a - class makes the method callable from the NUnit test runner. There is a property - called Description which is optional which you can provide a more detailed test - description. This class cannot be inherited. - - - - [TestFixture] - public class Fixture - { - [Test] - public void MethodToTest() - {} - - [Test(Description = "more detailed description")] - publc void TestDescriptionMethod() - {} - } - - - - - - Descriptive text for this test - - - - - TestCaseAttribute is used to mark parameterized test cases - and provide them with their arguments. - - - - - The ITestCaseData interface is implemented by a class - that is able to return complete testcases for use by - a parameterized test method. - - NOTE: This interface is used in both the framework - and the core, even though that results in two different - types. However, sharing the source code guarantees that - the various implementations will be compatible and that - the core is able to reflect successfully over the - framework implementations of ITestCaseData. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Indicates whether a result has been specified. - This is necessary because the result may be - null, so it's value cannot be checked. - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets a value indicating whether this is explicit. - - true if explicit; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - Construct a TestCaseAttribute with a list of arguments. - This constructor is not CLS-Compliant - - - - - - Construct a TestCaseAttribute with a single argument - - - - - - Construct a TestCaseAttribute with a two arguments - - - - - - - Construct a TestCaseAttribute with a three arguments - - - - - - - - Gets the list of arguments to a test case - - - - - Gets or sets the expected result. - - The result. - - - - Gets the expected result. - - The result. - - - - Gets a flag indicating whether an expected - result has been set. - - - - - Gets a list of categories associated with this test; - - - - - Gets or sets the category associated with this test. - May be a single category or a comma-separated list. - - - - - Gets or sets the expected exception. - - The expected exception. - - - - Gets or sets the name the expected exception. - - The expected name of the exception. - - - - Gets or sets the expected message of the expected exception - - The expected message of the exception. - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets or sets the description. - - The description. - - - - Gets or sets the name of the test. - - The name of the test. - - - - Gets or sets the ignored status of the test - - - - - Gets or sets the ignored status of the test - - - - - Gets or sets the explicit status of the test - - - - - Gets or sets the reason for not running the test - - - - - Gets or sets the reason for not running the test. - Set has the side effect of marking the test as ignored. - - The ignore reason. - - - - FactoryAttribute indicates the source to be used to - provide test cases for a test method. - - - - - Construct with the name of the factory - for use with languages - that don't support params arrays. - - An array of the names of the factories that will provide data - - - - Construct with a Type and name - for use with languages - that don't support params arrays. - - The Type that will provide data - The name of the method, property or field that will provide data - - - - The name of a the method, property or fiend to be used as a source - - - - - A Type to be used as a source - - - - - Gets or sets the category associated with this test. - May be a single category or a comma-separated list. - - - - - [TestFixture] - public class ExampleClass - {} - - - - - Default constructor - - - - - Construct with a object[] representing a set of arguments. - In .NET 2.0, the arguments may later be separated into - type arguments and constructor arguments. - - - - - - Descriptive text for this fixture - - - - - Gets and sets the category for this fixture. - May be a comma-separated list of categories. - - - - - Gets a list of categories for this fixture - - - - - The arguments originally provided to the attribute - - - - - Gets or sets a value indicating whether this should be ignored. - - true if ignore; otherwise, false. - - - - Gets or sets the ignore reason. May set Ignored as a side effect. - - The ignore reason. - - - - Get or set the type arguments. If not set - explicitly, any leading arguments that are - Types are taken as type arguments. - - - - - Attribute used to identify a method that is - called before any tests in a fixture are run. - - - - - Attribute used to identify a method that is called after - all the tests in a fixture have run. The method is - guaranteed to be called, even if an exception is thrown. - - - - - Adding this attribute to a method within a - class makes the method callable from the NUnit test runner. There is a property - called Description which is optional which you can provide a more detailed test - description. This class cannot be inherited. - - - - [TestFixture] - public class Fixture - { - [Test] - public void MethodToTest() - {} - - [Test(Description = "more detailed description")] - publc void TestDescriptionMethod() - {} - } - - - - - - Used on a method, marks the test with a timeout value in milliseconds. - The test will be run in a separate thread and is cancelled if the timeout - is exceeded. Used on a method or assembly, sets the default timeout - for all contained test methods. - - - - - Construct a TimeoutAttribute given a time in milliseconds - - The timeout value in milliseconds - - - - Marks a test that must run in the STA, causing it - to run in a separate thread if necessary. - - On methods, you may also use STAThreadAttribute - to serve the same purpose. - - - - - Construct a RequiresSTAAttribute - - - - - Marks a test that must run in the MTA, causing it - to run in a separate thread if necessary. - - On methods, you may also use MTAThreadAttribute - to serve the same purpose. - - - - - Construct a RequiresMTAAttribute - - - - - Marks a test that must run on a separate thread. - - - - - Construct a RequiresThreadAttribute - - - - - Construct a RequiresThreadAttribute, specifying the apartment - - - - - ValueSourceAttribute indicates the source to be used to - provide data for one parameter of a test method. - - - - - Construct with the name of the factory - for use with languages - that don't support params arrays. - - The name of the data source to be used - - - - Construct with a Type and name - for use with languages - that don't support params arrays. - - The Type that will provide data - The name of the method, property or field that will provide data - - - - The name of a the method, property or fiend to be used as a source - - - - - A Type to be used as a source - - - - - AttributeExistsConstraint tests for the presence of a - specified attribute on a Type. - - - - - The Constraint class is the base of all built-in constraints - within NUnit. It provides the operator overloads used to combine - constraints. - - - - - The IConstraintExpression interface is implemented by all - complete and resolvable constraints and expressions. - - - - - Return the top-level constraint for this expression - - - - - - Static UnsetObject used to detect derived constraints - failing to set the actual value. - - - - - The actual value being tested against a constraint - - - - - The display name of this Constraint for use by ToString() - - - - - Argument fields used by ToString(); - - - - - The builder holding this constraint - - - - - Construct a constraint with no arguments - - - - - Construct a constraint with one argument - - - - - Construct a constraint with two arguments - - - - - Sets the ConstraintBuilder holding this constraint - - - - - Write the failure message to the MessageWriter provided - as an argument. The default implementation simply passes - the constraint and the actual value to the writer, which - then displays the constraint description and the value. - - Constraints that need to provide additional details, - such as where the error occured can override this. - - The MessageWriter on which to display the message - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Test whether the constraint is satisfied by an - ActualValueDelegate that returns the value to be tested. - The default implementation simply evaluates the delegate - but derived classes may override it to provide for delayed - processing. - - An ActualValueDelegate - True for success, false for failure - - - - Test whether the constraint is satisfied by a given reference. - The default implementation simply dereferences the value but - derived classes may override it to provide for delayed processing. - - A reference to the value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Default override of ToString returns the constraint DisplayName - followed by any arguments within angle brackets. - - - - - - Returns the string representation of this constraint - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if the - argument constraint is not satisfied. - - - - - Returns a DelayedConstraint with the specified delay time. - - The delay in milliseconds. - - - - - Returns a DelayedConstraint with the specified delay time - and polling interval. - - The delay in milliseconds. - The interval at which to test the constraint. - - - - - The display name of this Constraint for use by ToString(). - The default value is the name of the constraint with - trailing "Constraint" removed. Derived classes may set - this to another name in their constructors. - - - - - Returns a ConstraintExpression by appending And - to the current constraint. - - - - - Returns a ConstraintExpression by appending And - to the current constraint. - - - - - Returns a ConstraintExpression by appending Or - to the current constraint. - - - - - Class used to detect any derived constraints - that fail to set the actual value in their - Matches override. - - - - - Constructs an AttributeExistsConstraint for a specific attribute Type - - - - - - Tests whether the object provides the expected attribute. - - A Type, MethodInfo, or other ICustomAttributeProvider - True if the expected attribute is present, otherwise false - - - - Writes the description of the constraint to the specified writer - - - - - AttributeConstraint tests that a specified attribute is present - on a Type or other provider and that the value of the attribute - satisfies some other constraint. - - - - - Abstract base class used for prefixes - - - - - The base constraint - - - - - Construct given a base constraint - - - - - - Constructs an AttributeConstraint for a specified attriute - Type and base constraint. - - - - - - - Determines whether the Type or other provider has the - expected attribute and if its value matches the - additional constraint specified. - - - - - Writes a description of the attribute to the specified writer. - - - - - Writes the actual value supplied to the specified writer. - - - - - Returns a string representation of the constraint. - - - - - BasicConstraint is the abstract base for constraints that - perform a simple comparison to a constant value. - - - - - Initializes a new instance of the class. - - The expected. - The description. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - NullConstraint tests that the actual value is null - - - - - Initializes a new instance of the class. - - - - - TrueConstraint tests that the actual value is true - - - - - Initializes a new instance of the class. - - - - - FalseConstraint tests that the actual value is false - - - - - Initializes a new instance of the class. - - - - - NaNConstraint tests that the actual value is a double or float NaN - - - - - Test that the actual value is an NaN - - - - - - - Write the constraint description to a specified writer - - - - - - BinaryConstraint is the abstract base of all constraints - that combine two other constraints in some fashion. - - - - - The first constraint being combined - - - - - The second constraint being combined - - - - - Construct a BinaryConstraint from two other constraints - - The first constraint - The second constraint - - - - AndConstraint succeeds only if both members succeed. - - - - - Create an AndConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply both member constraints to an actual value, succeeding - succeeding only if both of them succeed. - - The actual value - True if the constraints both succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - OrConstraint succeeds if either member succeeds - - - - - Create an OrConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply the member constraints to an actual value, succeeding - succeeding as soon as one of them succeeds. - - The actual value - True if either constraint succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - CollectionConstraint is the abstract base class for - constraints that operate on collections. - - - - - Construct an empty CollectionConstraint - - - - - Construct a CollectionConstraint - - - - - - Determines whether the specified enumerable is empty. - - The enumerable. - - true if the specified enumerable is empty; otherwise, false. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Protected method to be implemented by derived classes - - - - - - - CollectionItemsEqualConstraint is the abstract base class for all - collection constraints that apply some notion of item equality - as a part of their operation. - - - - - Construct an empty CollectionConstraint - - - - - Construct a CollectionConstraint - - - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Compares two collection members for equality - - - - - Return a new CollectionTally for use in making tests - - The collection to be included in the tally - - - - Flag the constraint to ignore case and return self. - - - - - EmptyCollectionConstraint tests whether a collection is empty. - - - - - Check that the collection is empty - - - - - - - Write the constraint description to a MessageWriter - - - - - - UniqueItemsConstraint tests whether all the items in a - collection are unique. - - - - - Check that all items are unique. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionContainsConstraint is used to test whether a collection - contains an expected object as a member. - - - - - Construct a CollectionContainsConstraint - - - - - - Test whether the expected item is contained in the collection - - - - - - - Write a descripton of the constraint to a MessageWriter - - - - - - CollectionEquivalentCOnstraint is used to determine whether two - collections are equivalent. - - - - - Construct a CollectionEquivalentConstraint - - - - - - Test whether two collections are equivalent - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionSubsetConstraint is used to determine whether - one collection is a subset of another - - - - - Construct a CollectionSubsetConstraint - - The collection that the actual value is expected to be a subset of - - - - Test whether the actual collection is a subset of - the expected collection provided. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionOrderedConstraint is used to test whether a collection is ordered. - - - - - Construct a CollectionOrderedConstraint - - - - - Modifies the constraint to use an IComparer and returns self. - - - - - Modifies the constraint to use an IComparer<T> and returns self. - - - - - Modifies the constraint to use a Comparison<T> and returns self. - - - - - Modifies the constraint to test ordering by the value of - a specified property and returns self. - - - - - Test whether the collection is ordered - - - - - - - Write a description of the constraint to a MessageWriter - - - - - - Returns the string representation of the constraint. - - - - - - If used performs a reverse comparison - - - - - CollectionTally counts (tallies) the number of - occurences of each object in one or more enumerations. - - - - - Construct a CollectionTally object from a comparer and a collection - - - - - Try to remove an object from the tally - - The object to remove - True if successful, false if the object was not found - - - - Try to remove a set of objects from the tally - - The objects to remove - True if successful, false if any object was not found - - - - The number of objects remaining in the tally - - - - - ComparisonAdapter class centralizes all comparisons of - values in NUnit, adapting to the use of any provided - IComparer, IComparer<T> or Comparison<T> - - - - - Returns a ComparisonAdapter that wraps an IComparer - - - - - Returns a ComparisonAdapter that wraps an IComparer<T> - - - - - Returns a ComparisonAdapter that wraps a Comparison<T> - - - - - Compares two objects - - - - - Gets the default ComparisonAdapter, which wraps an - NUnitComparer object. - - - - - Construct a ComparisonAdapter for an IComparer - - - - - Compares two objects - - - - - - - - Construct a default ComparisonAdapter - - - - - ComparisonAdapter<T> extends ComparisonAdapter and - allows use of an IComparer<T> or Comparison<T> - to actually perform the comparison. - - - - - Construct a ComparisonAdapter for an IComparer<T> - - - - - Compare a Type T to an object - - - - - Construct a ComparisonAdapter for a Comparison<T> - - - - - Compare a Type T to an object - - - - - Abstract base class for constraints that compare values to - determine if one is greater than, equal to or less than - the other. This class supplies the Using modifiers. - - - - - ComparisonAdapter to be used in making the comparison - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - - - Modifies the constraint to use an IComparer and returns self - - - - - Modifies the constraint to use an IComparer<T> and returns self - - - - - Modifies the constraint to use a Comparison<T> and returns self - - - - - Delegate used to delay evaluation of the actual value - to be used in evaluating a constraint - - - - - ConstraintBuilder maintains the stacks that are used in - processing a ConstraintExpression. An OperatorStack - is used to hold operators that are waiting for their - operands to be reognized. a ConstraintStack holds - input constraints as well as the results of each - operator applied. - - - - - Initializes a new instance of the class. - - - - - Appends the specified operator to the expression by first - reducing the operator stack and then pushing the new - operator on the stack. - - The operator to push. - - - - Appends the specified constraint to the expresson by pushing - it on the constraint stack. - - The constraint to push. - - - - Sets the top operator right context. - - The right context. - - - - Reduces the operator stack until the topmost item - precedence is greater than or equal to the target precedence. - - The target precedence. - - - - Resolves this instance, returning a Constraint. If the builder - is not currently in a resolvable state, an exception is thrown. - - The resolved constraint - - - - Gets a value indicating whether this instance is resolvable. - - - true if this instance is resolvable; otherwise, false. - - - - - OperatorStack is a type-safe stack for holding ConstraintOperators - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified operator onto the stack. - - The op. - - - - Pops the topmost operator from the stack. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost operator without modifying the stack. - - The top. - - - - ConstraintStack is a type-safe stack for holding Constraints - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified constraint. As a side effect, - the constraint's builder field is set to the - ConstraintBuilder owning this stack. - - The constraint. - - - - Pops this topmost constrait from the stack. - As a side effect, the constraint's builder - field is set to null. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost constraint without modifying the stack. - - The topmost constraint - - - - ConstraintExpression represents a compound constraint in the - process of being constructed from a series of syntactic elements. - - Individual elements are appended to the expression as they are - reognized. Once an actual Constraint is appended, the expression - returns a resolvable Constraint. - - - - - ConstraintExpressionBase is the abstract base class for the - ConstraintExpression class, which represents a - compound constraint in the process of being constructed - from a series of syntactic elements. - - NOTE: ConstraintExpressionBase is separate because the - ConstraintExpression class was generated in earlier - versions of NUnit. The two classes may be combined - in a future version. - - - - - The ConstraintBuilder holding the elements recognized so far - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the - class passing in a ConstraintBuilder, which may be pre-populated. - - The builder. - - - - Returns a string representation of the expression as it - currently stands. This should only be used for testing, - since it has the side-effect of resolving the expression. - - - - - - Appends an operator to the expression and returns the - resulting expression itself. - - - - - Appends a self-resolving operator to the expression and - returns a new ResolvableConstraintExpression. - - - - - Appends a constraint to the expression and returns that - constraint, which is associated with the current state - of the expression being built. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the - class passing in a ConstraintBuilder, which may be pre-populated. - - The builder. - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding only if a specified number of them succeed. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns the constraint provided as an argument - used to allow custom - custom constraints to easily participate in the syntax. - - - - - Returns the constraint provided as an argument - used to allow custom - custom constraints to easily participate in the syntax. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new ContainsConstraint. This constraint - will, in turn, make use of the appropriate second-level - constraint, depending on the type of the actual argument. - This overload is only used if the item sought is a string, - since any other type implies that we are looking for a - collection member. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - With is currently a NOP - reserved for future use. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for a positive value - - - - - Returns a constraint that tests for a negative value - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding only if a specified number of them succeed. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new ContainsConstraint. This constraint - will, in turn, make use of the appropriate second-level - constraint, depending on the type of the actual argument. - This overload is only used if the item sought is a string, - since any other type implies that we are looking for a - collection member. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that fails if the actual - value matches the pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for a positive value - - - - - Returns a constraint that tests for a negative value - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - The ConstraintOperator class is used internally by a - ConstraintBuilder to represent an operator that - modifies or combines constraints. - - Constraint operators use left and right precedence - values to determine whether the top operator on the - stack should be reduced before pushing a new operator. - - - - - The precedence value used when the operator - is about to be pushed to the stack. - - - - - The precedence value used when the operator - is on the top of the stack. - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - The syntax element preceding this operator - - - - - The syntax element folowing this operator - - - - - The precedence value used when the operator - is about to be pushed to the stack. - - - - - The precedence value used when the operator - is on the top of the stack. - - - - - PrefixOperator takes a single constraint and modifies - it's action in some way. - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Returns the constraint created by applying this - prefix to another constraint. - - - - - - - Negates the test of the constraint it wraps. - - - - - Constructs a new NotOperator - - - - - Returns a NotConstraint applied to its argument. - - - - - Abstract base for operators that indicate how to - apply a constraint to items in a collection. - - - - - Constructs a CollectionOperator - - - - - Represents a constraint that succeeds if all the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - they all succeed. - - - - - Represents a constraint that succeeds if any of the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - any of them succeed. - - - - - Represents a constraint that succeeds if none of the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - none of them succeed. - - - - - Represents a constraint that succeeds if the specified - count of members of a collection match a base constraint. - - - - - Construct an ExactCountOperator for a specified count - - The expected count - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - none of them succeed. - - - - - Represents a constraint that simply wraps the - constraint provided as an argument, without any - further functionality, but which modifes the - order of evaluation because of its precedence. - - - - - Constructor for the WithOperator - - - - - Returns a constraint that wraps its argument - - - - - Abstract base class for operators that are able to reduce to a - constraint whether or not another syntactic element follows. - - - - - Operator used to test for the presence of a named Property - on an object and optionally apply further tests to the - value of that property. - - - - - Constructs a PropOperator for a particular named property - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Gets the name of the property to which the operator applies - - - - - Operator that tests for the presence of a particular attribute - on a type and optionally applies further tests to the attribute. - - - - - Construct an AttributeOperator for a particular Type - - The Type of attribute tested - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - Operator that tests that an exception is thrown and - optionally applies further tests to the exception. - - - - - Construct a ThrowsOperator - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - Abstract base class for all binary operators - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Abstract method that produces a constraint by applying - the operator to its left and right constraint arguments. - - - - - Gets the left precedence of the operator - - - - - Gets the right precedence of the operator - - - - - Operator that requires both it's arguments to succeed - - - - - Construct an AndOperator - - - - - Apply the operator to produce an AndConstraint - - - - - Operator that requires at least one of it's arguments to succeed - - - - - Construct an OrOperator - - - - - Apply the operator to produce an OrConstraint - - - - - ContainsConstraint tests a whether a string contains a substring - or a collection contains an object. It postpones the decision of - which test to use until the type of the actual argument is known. - This allows testing whether a string is contained in a collection - or as a substring of another string using the same syntax. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to ignore case and return self. - - - - - Applies a delay to the match so that a match can be evaluated in the future. - - - - - Creates a new DelayedConstraint - - The inner constraint two decorate - The time interval after which the match is performed - If the value of is less than 0 - - - - Creates a new DelayedConstraint - - The inner constraint two decorate - The time interval after which the match is performed - The time interval used for polling - If the value of is less than 0 - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for if the base constraint fails, false if it succeeds - - - - Test whether the constraint is satisfied by a delegate - - The delegate whose value is to be tested - True for if the base constraint fails, false if it succeeds - - - - Test whether the constraint is satisfied by a given reference. - Overridden to wait for the specified delay period before - calling the base constraint with the dereferenced value. - - A reference to the value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - EmptyDirectoryConstraint is used to test that a directory is empty - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - EmptyConstraint tests a whether a string or collection is empty, - postponing the decision about which test is applied until the - type of the actual argument is known. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EqualConstraint is able to compare an actual value with the - expected value provided in its constructor. Two objects are - considered equal if both are null, or if both have the same - value. NUnit has special semantics for some object types. - - - - - If true, strings in error messages will be clipped - - - - - NUnitEqualityComparer used to test equality. - - - - - Initializes a new instance of the class. - - The expected value. - - - - Flag the constraint to use a tolerance when determining equality. - - Tolerance value to be used - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write a failure message. Overridden to provide custom - failure messages for EqualConstraint. - - The MessageWriter to write to - - - - Write description of this constraint - - The MessageWriter to write to - - - - Display the failure information for two collections that did not match. - - The MessageWriter on which to display - The expected collection. - The actual collection - The depth of this failure in a set of nested collections - - - - Displays a single line showing the types and sizes of the expected - and actual enumerations, collections or arrays. If both are identical, - the value is only shown once. - - The MessageWriter on which to display - The expected collection or array - The actual collection or array - The indentation level for the message line - - - - Displays a single line showing the point in the expected and actual - arrays at which the comparison failed. If the arrays have different - structures or dimensions, both values are shown. - - The MessageWriter on which to display - The expected array - The actual array - Index of the failure point in the underlying collections - The indentation level for the message line - - - - Display the failure information for two IEnumerables that did not match. - - The MessageWriter on which to display - The expected enumeration. - The actual enumeration - The depth of this failure in a set of nested collections - - - - Flag the constraint to ignore case and return self. - - - - - Flag the constraint to suppress string clipping - and return self. - - - - - Flag the constraint to compare arrays as collections - and return self. - - - - - Switches the .Within() modifier to interpret its tolerance as - a distance in representable values (see remarks). - - Self. - - Ulp stands for "unit in the last place" and describes the minimum - amount a given value can change. For any integers, an ulp is 1 whole - digit. For floating point values, the accuracy of which is better - for smaller numbers and worse for larger numbers, an ulp depends - on the size of the number. Using ulps for comparison of floating - point results instead of fixed tolerances is safer because it will - automatically compensate for the added inaccuracy of larger numbers. - - - - - Switches the .Within() modifier to interpret its tolerance as - a percentage that the actual values is allowed to deviate from - the expected value. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in days. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in hours. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in minutes. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in seconds. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in milliseconds. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in clock ticks. - - Self - - - - EqualityAdapter class handles all equality comparisons - that use an IEqualityComparer, IEqualityComparer<T> - or a ComparisonAdapter. - - - - - Compares two objects, returning true if they are equal - - - - - Returns true if the two objects can be compared by this adapter. - The base adapter cannot handle IEnumerables except for strings. - - - - - Returns an EqualityAdapter that wraps an IComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer<T>. - - - - - Returns an EqualityAdapter that wraps an IComparer<T>. - - - - - Returns an EqualityAdapter that wraps a Comparison<T>. - - - - - EqualityAdapter that wraps an IComparer. - - - - - Returns true if the two objects can be compared by this adapter. - Generic adapter requires objects of the specified type. - - - - - EqualityAdapter that wraps an IComparer. - - - - Helper routines for working with floating point numbers - - - The floating point comparison code is based on this excellent article: - http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm - - - "ULP" means Unit in the Last Place and in the context of this library refers to - the distance between two adjacent floating point numbers. IEEE floating point - numbers can only represent a finite subset of natural numbers, with greater - accuracy for smaller numbers and lower accuracy for very large numbers. - - - If a comparison is allowed "2 ulps" of deviation, that means the values are - allowed to deviate by up to 2 adjacent floating point values, which might be - as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. - - - - - Compares two floating point values for equality - First floating point value to be compared - Second floating point value t be compared - - Maximum number of representable floating point values that are allowed to - be between the left and the right floating point values - - True if both numbers are equal or close to being equal - - - Floating point values can only represent a finite subset of natural numbers. - For example, the values 2.00000000 and 2.00000024 can be stored in a float, - but nothing inbetween them. - - - This comparison will count how many possible floating point values are between - the left and the right number. If the number of possible values between both - numbers is less than or equal to maxUlps, then the numbers are considered as - being equal. - - - Implementation partially follows the code outlined here: - http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ - - - - - Compares two double precision floating point values for equality - First double precision floating point value to be compared - Second double precision floating point value t be compared - - Maximum number of representable double precision floating point values that are - allowed to be between the left and the right double precision floating point values - - True if both numbers are equal or close to being equal - - - Double precision floating point values can only represent a limited series of - natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004 - can be stored in a double, but nothing inbetween them. - - - This comparison will count how many possible double precision floating point - values are between the left and the right number. If the number of possible - values between both numbers is less than or equal to maxUlps, then the numbers - are considered as being equal. - - - Implementation partially follows the code outlined here: - http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ - - - - - - Reinterprets the memory contents of a floating point value as an integer value - - - Floating point value whose memory contents to reinterpret - - - The memory contents of the floating point value interpreted as an integer - - - - - Reinterprets the memory contents of a double precision floating point - value as an integer value - - - Double precision floating point value whose memory contents to reinterpret - - - The memory contents of the double precision floating point value - interpreted as an integer - - - - - Reinterprets the memory contents of an integer as a floating point value - - Integer value whose memory contents to reinterpret - - The memory contents of the integer value interpreted as a floating point value - - - - - Reinterprets the memory contents of an integer value as a double precision - floating point value - - Integer whose memory contents to reinterpret - - The memory contents of the integer interpreted as a double precision - floating point value - - - - Union of a floating point variable and an integer - - - The union's value as a floating point variable - - - The union's value as an integer - - - The union's value as an unsigned integer - - - Union of a double precision floating point variable and a long - - - The union's value as a double precision floating point variable - - - The union's value as a long - - - The union's value as an unsigned long - - - - Tests whether a value is greater than the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Tests whether a value is greater than or equal to the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Tests whether a value is less than the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Tests whether a value is less than or equal to the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - MessageWriter is the abstract base for classes that write - constraint descriptions and messages in some form. The - class has separate methods for writing various components - of a message, allowing implementations to tailor the - presentation as needed. - - - - - Construct a MessageWriter given a culture - - - - - Method to write single line message with optional args, usually - written to precede the general failure message. - - The message to be written - Any arguments used in formatting the message - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the Expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in locating the point where the strings differ - If true, the strings should be clipped to fit the line - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for a modifier - - The modifier. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Abstract method to get the max line length - - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Returns the representation of a type as used in NUnitLite. - This is the same as Type.ToString() except for arrays, - which are displayed with their declared sizes. - - - - - - - Converts any control characters in a string - to their escaped representation. - - The string to be converted - The converted string - - - - Return the a string representation for a set of indices into an array - - Array of indices for which a string is needed - - - - Get an array of indices representing the point in a enumerable, - collection or array corresponding to a single int index into the - collection. - - The collection to which the indices apply - Index in the collection - Array of indices - - - - Clip a string to a given length, starting at a particular offset, returning the clipped - string with ellipses representing the removed parts - - The string to be clipped - The maximum permitted length of the result string - The point at which to start clipping - The clipped string - - - - Clip the expected and actual strings in a coordinated fashion, - so that they may be displayed together. - - - - - - - - - Shows the position two strings start to differ. Comparison - starts at the start index. - - The expected string - The actual string - The index in the strings at which comparison should start - Boolean indicating whether case should be ignored - -1 if no mismatch found, or the index where mismatch found - - - - The Numerics class contains common operations on numeric values. - - - - - Checks the type of the object, returning true if - the object is a numeric type. - - The object to check - true if the object is a numeric type - - - - Checks the type of the object, returning true if - the object is a floating point numeric type. - - The object to check - true if the object is a floating point numeric type - - - - Checks the type of the object, returning true if - the object is a fixed point numeric type. - - The object to check - true if the object is a fixed point numeric type - - - - Test two numeric values for equality, performing the usual numeric - conversions and using a provided or default tolerance. If the tolerance - provided is Empty, this method may set it to a default tolerance. - - The expected value - The actual value - A reference to the tolerance in effect - True if the values are equal - - - - Compare two numeric values, performing the usual numeric conversions. - - The expected value - The actual value - The relationship of the values to each other - - - - NUnitComparer encapsulates NUnit's default behavior - in comparing two objects. - - - - - Compares two objects - - - - - - - - Returns the default NUnitComparer. - - - - - Generic version of NUnitComparer - - - - - - Compare two objects of the same type - - - - - NUnitEqualityComparer encapsulates NUnit's handling of - equality tests between objects. - - - - - - - - - - Compares two objects for equality within a tolerance - - The first object to compare - The second object to compare - The tolerance to use in the comparison - - - - - If true, all string comparisons will ignore case - - - - - If true, arrays will be treated as collections, allowing - those of different dimensions to be compared - - - - - Comparison objects used in comparisons for some constraints. - - - - - Compares two objects for equality within a tolerance. - - - - - Helper method to compare two arrays - - - - - Method to compare two DirectoryInfo objects - - first directory to compare - second directory to compare - true if equivalent, false if not - - - - Returns the default NUnitEqualityComparer - - - - - Gets and sets a flag indicating whether case should - be ignored in determining equality. - - - - - Gets and sets a flag indicating that arrays should be - compared as collections, without regard to their shape. - - - - - Gets and sets an external comparer to be used to - test for equality. It is applied to members of - collections, in place of NUnit's own logic. - - - - - Gets the list of failure points for the last Match performed. - - - - - FailurePoint class represents one point of failure - in an equality test. - - - - - The location of the failure - - - - - The expected value - - - - - The actual value - - - - - Indicates whether the expected value is valid - - - - - Indicates whether the actual value is valid - - - - - PathConstraint serves as the abstract base of constraints - that operate on paths and provides several helper methods. - - - - - The expected path used in the constraint - - - - - The actual path being tested - - - - - Flag indicating whether a caseInsensitive comparison should be made - - - - - Construct a PathConstraint for a give expected path - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Returns true if the expected path and actual path match - - - - - Returns the string representation of this constraint - - - - - Canonicalize the provided path - - - The path in standardized form - - - - Test whether two paths are the same - - The first path - The second path - Indicates whether case should be ignored - - - - - Test whether one path is under another path - - The first path - supposed to be the parent path - The second path - supposed to be the child path - Indicates whether case should be ignored - - - - - Test whether one path is the same as or under another path - - The first path - supposed to be the parent path - The second path - supposed to be the child path - - - - - Modifies the current instance to be case-insensitve - and returns it. - - - - - Modifies the current instance to be case-sensitve - and returns it. - - - - - Summary description for SamePathConstraint. - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubPathConstraint tests that the actual path is under the expected path - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SamePathOrUnderConstraint tests that one path is under another - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Predicate constraint wraps a Predicate in a constraint, - returning success if the predicate is true. - - - - - Construct a PredicateConstraint from a predicate - - - - - Determines whether the predicate succeeds when applied - to the actual value. - - - - - Writes the description to a MessageWriter - - - - - NotConstraint negates the effect of some other constraint - - - - - Initializes a new instance of the class. - - The base constraint to be negated. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for if the base constraint fails, false if it succeeds - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - AllItemsConstraint applies another constraint to each - item in a collection, succeeding if they all succeed. - - - - - Construct an AllItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - SomeItemsConstraint applies another constraint to each - item in a collection, succeeding if any of them succeeds. - - - - - Construct a SomeItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - succeeding if any item succeeds. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - NoItemConstraint applies another constraint to each - item in a collection, failing if any of them succeeds. - - - - - Construct a NoItemConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - ExactCoutConstraint applies another constraint to each - item in a collection, succeeding only if a specified - number of items succeed. - - - - - Construct an ExactCountConstraint on top of an existing constraint - - - - - - - Apply the item constraint to each item in the collection, - succeeding only if the expected number of items pass. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - PropertyExistsConstraint tests that a named property - exists on the object provided through Match. - - Originally, PropertyConstraint provided this feature - in addition to making optional tests on the vaue - of the property. The two constraints are now separate. - - - - - Initializes a new instance of the class. - - The name of the property. - - - - Test whether the property exists for a given object - - The object to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - - PropertyConstraint extracts a named property and uses - its value as the actual value for a chained constraint. - - - - - Initializes a new instance of the class. - - The name. - The constraint to apply to the property. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - - RangeConstraint tests whethe two values are within a - specified range. - - - - - Initializes a new instance of the class. - - From. - To. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - ResolvableConstraintExpression is used to represent a compound - constraint being constructed at a point where the last operator - may either terminate the expression or may have additional - qualifying constraints added to it. - - It is used, for example, for a Property element or for - an Exception element, either of which may be optionally - followed by constraints that apply to the property or - exception. - - - - - Create a new instance of ResolvableConstraintExpression - - - - - Create a new instance of ResolvableConstraintExpression, - passing in a pre-populated ConstraintBuilder. - - - - - Resolve the current expression to a Constraint - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if the - argument constraint is not satisfied. - - - - - Appends an And Operator to the expression - - - - - Appends an Or operator to the expression. - - - - - ReusableConstraint wraps a resolved constraint so that it - may be saved and reused as needed. - - - - - Construct a ReusableConstraint - - The constraint or expression to be reused - - - - Conversion operator from a normal constraint to a ReusableConstraint. - - The original constraint to be wrapped as a ReusableConstraint - - - - - Returns the string representation of the constraint. - - A string representing the constraint - - - - Resolves the ReusableConstraint by returning the constraint - that it originally wrapped. - - A resolved constraint - - - - SameAsConstraint tests whether an object is identical to - the object passed to its constructor - - - - - Initializes a new instance of the class. - - The expected object. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - BinarySerializableConstraint tests whether - an object is serializable in binary format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation - - - - - BinarySerializableConstraint tests whether - an object is serializable in binary format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of this constraint - - - - - StringConstraint is the abstract base for constraints - that operate on strings. It supports the IgnoreCase - modifier for string operations. - - - - - The expected value - - - - - Indicates whether tests should be case-insensitive - - - - - Constructs a StringConstraint given an expected value - - The expected value - - - - Modify the constraint to ignore case in matching. - - - - - EmptyStringConstraint tests whether a string is empty. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - NullEmptyStringConstraint tests whether a string is either null or empty. - - - - - Constructs a new NullOrEmptyStringConstraint - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubstringConstraint can test whether a string contains - the expected substring. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - StartsWithConstraint can test whether a string starts - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EndsWithConstraint can test whether a string ends - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - RegexConstraint can test whether a string matches - the pattern provided. - - - - - Initializes a new instance of the class. - - The pattern. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - ThrowsConstraint is used to test the exception thrown by - a delegate by applying a constraint to it. - - - - - Initializes a new instance of the class, - using a constraint to be applied to the exception. - - A constraint to apply to the caught exception. - - - - Executes the code of the delegate and captures any exception. - If a non-null base constraint was provided, it applies that - constraint to the exception. - - A delegate representing the code to be tested - True if an exception is thrown and the constraint succeeds, otherwise false - - - - Converts an ActualValueDelegate to a TestDelegate - before calling the primary overload. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of this constraint - - - - - Get the actual exception thrown - used by Assert.Throws. - - - - - ThrowsNothingConstraint tests that a delegate does not - throw an exception. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True if no exception is thrown, otherwise false - - - - Converts an ActualValueDelegate to a TestDelegate - before calling the primary overload. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Modes in which the tolerance value for a comparison can - be interpreted. - - - - - The tolerance was created with a value, without specifying - how the value would be used. This is used to prevent setting - the mode more than once and is generally changed to Linear - upon execution of the test. - - - - - The tolerance is used as a numeric range within which - two compared values are considered to be equal. - - - - - Interprets the tolerance as the percentage by which - the two compared values my deviate from each other. - - - - - Compares two values based in their distance in - representable numbers. - - - - - The Tolerance class generalizes the notion of a tolerance - within which an equality test succeeds. Normally, it is - used with numeric types, but it can be used with any - type that supports taking a difference between two - objects and comparing that difference to a value. - - - - - Constructs a linear tolerance of a specdified amount - - - - - Constructs a tolerance given an amount and ToleranceMode - - - - - Tests that the current Tolerance is linear with a - numeric value, throwing an exception if it is not. - - - - - Returns an empty Tolerance object, equivalent to - specifying no tolerance. In most cases, it results - in an exact match but for floats and doubles a - default tolerance may be used. - - - - - Returns a zero Tolerance object, equivalent to - specifying an exact match. - - - - - Gets the ToleranceMode for the current Tolerance - - - - - Gets the value of the current Tolerance instance. - - - - - Returns a new tolerance, using the current amount as a percentage. - - - - - Returns a new tolerance, using the current amount in Ulps. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of days. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of hours. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of minutes. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of seconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of milliseconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of clock ticks. - - - - - Returns true if the current tolerance is empty. - - - - - TypeConstraint is the abstract base for constraints - that take a Type as their expected value. - - - - - The expected Type used by the constraint - - - - - Construct a TypeConstraint for a given Type - - - - - - Write the actual value for a failing constraint test to a - MessageWriter. TypeConstraints override this method to write - the name of the type. - - The writer on which the actual value is displayed - - - - ExactTypeConstraint is used to test that an object - is of the exact type provided in the constructor - - - - - Construct an ExactTypeConstraint for a given Type - - The expected Type. - - - - Test that an object is of the exact type specified - - The actual value. - True if the tested object is of the exact type provided, otherwise false. - - - - Write the description of this constraint to a MessageWriter - - The MessageWriter to use - - - - ExceptionTypeConstraint is a special version of ExactTypeConstraint - used to provided detailed info about the exception thrown in - an error message. - - - - - Constructs an ExceptionTypeConstraint - - - - - Write the actual value for a failing constraint test to a - MessageWriter. Overriden to write additional information - in the case of an Exception. - - The MessageWriter to use - - - - InstanceOfTypeConstraint is used to test that an object - is of the same type provided or derived from it. - - - - - Construct an InstanceOfTypeConstraint for the type provided - - The expected Type - - - - Test whether an object is of the specified type or a derived type - - The object to be tested - True if the object is of the provided type or derives from it, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - AssignableFromConstraint is used to test that an object - can be assigned from a given Type. - - - - - Construct an AssignableFromConstraint for the type provided - - - - - - Test whether an object can be assigned from the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - AssignableToConstraint is used to test that an object - can be assigned to a given Type. - - - - - Construct an AssignableToConstraint for the type provided - - - - - - Test whether an object can be assigned to the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - Thrown when an assertion failed. - - - - - The error message that explains - the reason for the exception - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when a test executes inconclusively. - - - - - The error message that explains - the reason for the exception - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - - - - - - - Compares two objects of a given Type for equality within a tolerance - - The first object to compare - The second object to compare - The tolerance to use in the comparison - - - - - The different targets a test action attribute can be applied to - - - - - Default target, which is determined by where the action attribute is attached - - - - - Target a individual test case - - - - - Target a suite of test cases - - - - - Delegate used by tests that execute code and - capture any thrown exception. - - - - - The Assert class contains a collection of static methods that - implement the most common assertions used in NUnit. - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Helper for Assert.AreEqual(double expected, double actual, ...) - allowing code generation to work consistently. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - The message to initialize the with. - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - - - - Throws an with the message and arguments - that are passed in. This is used by the other Assert functions. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This is used by the other Assert functions. - - The message to initialize the with. - - - - Throws an . - This is used by the other Assert functions. - - - - - Throws an with the message and arguments - that are passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - - - - Throws an . - This causes the test to be reported as ignored. - - - - - Throws an with the message and arguments - that are passed in. This causes the test to be reported as inconclusive. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This causes the test to be reported as inconclusive. - - The message to initialize the with. - - - - Throws an . - This causes the test to be reported as Inconclusive. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - Used as a synonym for That in rare cases where a private setter - causes a Visual Basic compilation error. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - Used as a synonym for That in rare cases where a private setter - causes a Visual Basic compilation error. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - Used as a synonym for That in rare cases where a private setter - causes a Visual Basic compilation error. - - - This method is provided for use by VB developers needing to test - the value of properties with private setters. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - - - - Verifies that a delegate does not throw an exception - - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate does not throw an exception. - - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate does not throw an exception. - - A TestSnippet delegate - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - - - - Assert that a string is not null or empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is not null or empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is not null or empty - - The string to be tested - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - - - - Gets the number of assertions executed so far and - resets the counter to zero. - - - - - AssertionHelper is an optional base class for user tests, - allowing the use of shorter names for constraints and - asserts and avoiding conflict with the definition of - , from which it inherits much of its - behavior, in certain mock object frameworks. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to Assert.That - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to Assert.That. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to Assert.That - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to Assert.That. - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to Assert.That. - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically Assert.That. - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - Returns a ListMapper based on a collection. - - The original collection - - - - - Provides static methods to express the assumptions - that must be met for a test to give a meaningful - result. If an assumption is not met, the test - should produce an inconclusive result. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the - method throws an . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - A set of Assert methods operationg on one or more collections - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - The message that will be displayed on failure - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - The message to be displayed on failure - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - - - - Static helper class used in the constraint-based syntax - - - - - Creates a new SubstringConstraint - - The value of the substring - A SubstringConstraint - - - - Creates a new CollectionContainsConstraint. - - The item that should be found. - A new CollectionContainsConstraint - - - - Summary description for DirectoryAssert - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are equal - Arguments to be used in formatting the message - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are equal - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Summary description for FileAssert. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if objects are not equal - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the two Stream are the same. - Arguments to be used in formatting the message - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the Streams are the same. - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - GlobalSettings is a place for setting default values used - by the framework in performing asserts. - - - - - Default tolerance for floating point equality - - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding only if a specified number of them succeed. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - Interface implemented by a user fixture in order to - validate any expected exceptions. It is only called - for test methods marked with the ExpectedException - attribute. - - - - - Method to handle an expected exception - - The exception to be handled - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for a positive value - - - - - Returns a constraint that tests for a negative value - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - The Iz class is a synonym for Is intended for use in VB, - which regards Is as a keyword. - - - - - The List class is a helper class with properties and methods - that supply a number of constraints used with lists and collections. - - - - - List.Map returns a ListMapper, which can be used to map - the original collection to another collection. - - - - - - - ListMapper is used to transform a collection used as an actual argument - producing another collection to be used in the assertion. - - - - - Construct a ListMapper based on a collection - - The collection to be transformed - - - - Produces a collection containing all the values of a property - - The collection of property values - - - - - Randomizer returns a set of random values in a repeatable - way, to allow re-running of tests if necessary. - - - - - Get a randomizer for a particular member, returning - one that has already been created if it exists. - This ensures that the same values are generated - each time the tests are reloaded. - - - - - Get a randomizer for a particular parameter, returning - one that has already been created if it exists. - This ensures that the same values are generated - each time the tests are reloaded. - - - - - Construct a randomizer using a random seed - - - - - Construct a randomizer using a specified seed - - - - - Return an array of random doubles between 0.0 and 1.0. - - - - - - - Return an array of random doubles with values in a specified range. - - - - - Return an array of random ints with values in a specified range. - - - - - Get a random seed for use in creating a randomizer. - - - - - The SpecialValue enum is used to represent TestCase arguments - that cannot be used as arguments to an Attribute. - - - - - Null represents a null value, which cannot be used as an - argument to an attriute under .NET 1.x - - - - - Basic Asserts on strings. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - - - - Asserts that a string is not found within another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - - - - Asserts that two strings are not equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that two strings are Notequal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - Asserts that two strings are not equal, without regard to case. - - The expected string - The actual string - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - The message to display in case of failure - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - The message to display in case of failure - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - - - - The TestCaseData class represents a set of arguments - and other parameter info to be used for a parameterized - test case. It provides a number of instance modifiers - for use in initializing the test case. - - Note: Instance modifiers are getters that return - the same instance after modifying it's state. - - - - - The argument list to be provided to the test - - - - - The expected result to be returned - - - - - Set to true if this has an expected result - - - - - The expected exception Type - - - - - The FullName of the expected exception - - - - - The name to be used for the test - - - - - The description of the test - - - - - A dictionary of properties, used to add information - to tests without requiring the class to change. - - - - - If true, indicates that the test case is to be ignored - - - - - If true, indicates that the test case is marked explicit - - - - - The reason for ignoring a test case - - - - - Initializes a new instance of the class. - - The arguments. - - - - Initializes a new instance of the class. - - The argument. - - - - Initializes a new instance of the class. - - The first argument. - The second argument. - - - - Initializes a new instance of the class. - - The first argument. - The second argument. - The third argument. - - - - Sets the expected result for the test - - The expected result - A modified TestCaseData - - - - Sets the expected exception type for the test - - Type of the expected exception. - The modified TestCaseData instance - - - - Sets the expected exception type for the test - - FullName of the expected exception. - The modified TestCaseData instance - - - - Sets the name of the test case - - The modified TestCaseData instance - - - - Sets the description for the test case - being constructed. - - The description. - The modified TestCaseData instance. - - - - Applies a category to the test - - - - - - - Applies a named property to the test - - - - - - - - Applies a named property to the test - - - - - - - - Applies a named property to the test - - - - - - - - Ignores this TestCase. - - - - - - Ignores this TestCase, specifying the reason. - - The reason. - - - - - Marks this TestCase as Explicit - - - - - - Marks this TestCase as Explicit, specifying the reason. - - The reason. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Returns true if the result has been set - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets a value indicating whether this is explicit. - - true if explicit; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - Gets a list of categories associated with this test. - - - - - Gets the property dictionary for this test - - - - - Provide the context information of the current test - - - - - Constructs a TestContext using the provided context dictionary - - A context dictionary - - - - Get the current test context. This is created - as needed. The user may save the context for - use within a test, but it should not be used - outside the test for which it is created. - - - - - Gets a TestAdapter representing the currently executing test in this context. - - - - - Gets a ResultAdapter representing the current result for the test - executing in this context. - - - - - Gets the directory containing the current test assembly. - - - - - Gets the directory to be used for outputing files created - by this test run. - - - - - TestAdapter adapts a Test for consumption by - the user test code. - - - - - Constructs a TestAdapter for this context - - The context dictionary - - - - The name of the test. - - - - - The FullName of the test - - - - - The properties of the test. - - - - - ResultAdapter adapts a TestResult for consumption by - the user test code. - - - - - Construct a ResultAdapter for a context - - The context holding the result - - - - The TestState of current test. This maps to the ResultState - used in nunit.core and is subject to change in the future. - - - - - The TestStatus of current test. This enum will be used - in future versions of NUnit and so is to be preferred - to the TestState value. - - - - - Provides details about a test - - - - - Creates an instance of TestDetails - - The fixture that the test is a member of, if available. - The method that implements the test, if available. - The full name of the test. - A string representing the type of test, e.g. "Test Case". - Indicates if the test represents a suite of tests. - - - - The fixture that the test is a member of, if available. - - - - - The method that implements the test, if available. - - - - - The full name of the test. - - - - - A string representing the type of test, e.g. "Test Case". - - - - - Indicates if the test represents a suite of tests. - - - - - The ResultState enum indicates the result of running a test - - - - - The result is inconclusive - - - - - The test was not runnable. - - - - - The test has been skipped. - - - - - The test has been ignored. - - - - - The test succeeded - - - - - The test failed - - - - - The test encountered an unexpected exception - - - - - The test was cancelled by the user - - - - - The TestStatus enum indicates the result of running a test - - - - - The test was inconclusive - - - - - The test has skipped - - - - - The test succeeded - - - - - The test failed - - - - - Helper class with static methods used to supply constraints - that operate on strings. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that fails if the actual - value matches the pattern supplied as an argument. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - TextMessageWriter writes constraint descriptions and messages - in displayable form as a text stream. It tailors the display - of individual message components to form the standard message - format of NUnit assertion failure messages. - - - - - Prefix used for the expected value line of a message - - - - - Prefix used for the actual value line of a message - - - - - Length of a message prefix - - - - - Construct a TextMessageWriter - - - - - Construct a TextMessageWriter, specifying a user message - and optional formatting arguments. - - - - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in string comparisons - If true, clip the strings to fit the max line length - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Write the text for a modifier. - - The modifier. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Write the generic 'Expected' line for a constraint - - The constraint that failed - - - - Write the generic 'Expected' line for a given value - - The expected value - - - - Write the generic 'Expected' line for a given value - and tolerance. - - The expected value - The tolerance within which the test was made - - - - Write the generic 'Actual' line for a constraint - - The constraint for which the actual value is to be written - - - - Write the generic 'Actual' line for a given value - - The actual value causing a failure - - - - Gets or sets the maximum line length for this writer - - - - - Helper class with properties and methods that supply - constraints that operate on exceptions. - - - - - Creates a constraint specifying the exact type of exception expected - - - - - Creates a constraint specifying the exact type of exception expected - - - - - Creates a constraint specifying the type of exception expected - - - - - Creates a constraint specifying the type of exception expected - - - - - Creates a constraint specifying an expected exception - - - - - Creates a constraint specifying an exception with a given InnerException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying that no exception is thrown - - - - diff --git a/lib/tests/nunit.util.dll b/lib/tests/nunit.util.dll deleted file mode 100644 index c837e9ecf06..00000000000 Binary files a/lib/tests/nunit.util.dll and /dev/null differ diff --git a/lib/tests/old/sqlite3.def b/lib/tests/old/sqlite3.def deleted file mode 100644 index cffe677f2f7..00000000000 --- a/lib/tests/old/sqlite3.def +++ /dev/null @@ -1,179 +0,0 @@ -EXPORTS -sqlite3_aggregate_context -sqlite3_aggregate_count -sqlite3_auto_extension -sqlite3_backup_finish -sqlite3_backup_init -sqlite3_backup_pagecount -sqlite3_backup_remaining -sqlite3_backup_step -sqlite3_bind_blob -sqlite3_bind_double -sqlite3_bind_int -sqlite3_bind_int64 -sqlite3_bind_null -sqlite3_bind_parameter_count -sqlite3_bind_parameter_index -sqlite3_bind_parameter_name -sqlite3_bind_text -sqlite3_bind_text16 -sqlite3_bind_value -sqlite3_bind_zeroblob -sqlite3_blob_bytes -sqlite3_blob_close -sqlite3_blob_open -sqlite3_blob_read -sqlite3_blob_write -sqlite3_busy_handler -sqlite3_busy_timeout -sqlite3_changes -sqlite3_clear_bindings -sqlite3_close -sqlite3_collation_needed -sqlite3_collation_needed16 -sqlite3_column_blob -sqlite3_column_bytes -sqlite3_column_bytes16 -sqlite3_column_count -sqlite3_column_database_name -sqlite3_column_database_name16 -sqlite3_column_decltype -sqlite3_column_decltype16 -sqlite3_column_double -sqlite3_column_int -sqlite3_column_int64 -sqlite3_column_name -sqlite3_column_name16 -sqlite3_column_origin_name -sqlite3_column_origin_name16 -sqlite3_column_table_name -sqlite3_column_table_name16 -sqlite3_column_text -sqlite3_column_text16 -sqlite3_column_type -sqlite3_column_value -sqlite3_commit_hook -sqlite3_complete -sqlite3_complete16 -sqlite3_config -sqlite3_context_db_handle -sqlite3_create_collation -sqlite3_create_collation16 -sqlite3_create_collation_v2 -sqlite3_create_function -sqlite3_create_function16 -sqlite3_create_module -sqlite3_create_module_v2 -sqlite3_data_count -sqlite3_db_config -sqlite3_db_handle -sqlite3_db_mutex -sqlite3_db_status -sqlite3_declare_vtab -sqlite3_enable_load_extension -sqlite3_enable_shared_cache -sqlite3_errcode -sqlite3_errmsg -sqlite3_errmsg16 -sqlite3_exec -sqlite3_expired -sqlite3_extended_errcode -sqlite3_extended_result_codes -sqlite3_file_control -sqlite3_finalize -sqlite3_free -sqlite3_free_table -sqlite3_get_autocommit -sqlite3_get_auxdata -sqlite3_get_table -sqlite3_global_recover -sqlite3_initialize -sqlite3_interrupt -sqlite3_last_insert_rowid -sqlite3_libversion -sqlite3_libversion_number -sqlite3_limit -sqlite3_load_extension -sqlite3_malloc -sqlite3_memory_alarm -sqlite3_memory_highwater -sqlite3_memory_used -sqlite3_mprintf -sqlite3_mutex_alloc -sqlite3_mutex_enter -sqlite3_mutex_free -sqlite3_mutex_leave -sqlite3_mutex_try -sqlite3_next_stmt -sqlite3_open -sqlite3_open16 -sqlite3_open_v2 -sqlite3_os_end -sqlite3_os_init -sqlite3_overload_function -sqlite3_prepare -sqlite3_prepare16 -sqlite3_prepare16_v2 -sqlite3_prepare_v2 -sqlite3_profile -sqlite3_progress_handler -sqlite3_randomness -sqlite3_realloc -sqlite3_release_memory -sqlite3_reset -sqlite3_reset_auto_extension -sqlite3_result_blob -sqlite3_result_double -sqlite3_result_error -sqlite3_result_error16 -sqlite3_result_error_code -sqlite3_result_error_nomem -sqlite3_result_error_toobig -sqlite3_result_int -sqlite3_result_int64 -sqlite3_result_null -sqlite3_result_text -sqlite3_result_text16 -sqlite3_result_text16be -sqlite3_result_text16le -sqlite3_result_value -sqlite3_result_zeroblob -sqlite3_rollback_hook -sqlite3_set_authorizer -sqlite3_set_auxdata -sqlite3_shutdown -sqlite3_sleep -sqlite3_snprintf -sqlite3_soft_heap_limit -sqlite3_sql -sqlite3_status -sqlite3_step -sqlite3_stmt_status -sqlite3_strnicmp -sqlite3_table_column_metadata -sqlite3_test_control -sqlite3_thread_cleanup -sqlite3_threadsafe -sqlite3_total_changes -sqlite3_trace -sqlite3_transfer_bindings -sqlite3_update_hook -sqlite3_user_data -sqlite3_value_blob -sqlite3_value_bytes -sqlite3_value_bytes16 -sqlite3_value_double -sqlite3_value_int -sqlite3_value_int64 -sqlite3_value_numeric_type -sqlite3_value_text -sqlite3_value_text16 -sqlite3_value_text16be -sqlite3_value_text16le -sqlite3_value_type -sqlite3_version -sqlite3_vfs_find -sqlite3_vfs_register -sqlite3_vfs_unregister -sqlite3_vmprintf -sqlite3_win32_mbcs_to_utf8 diff --git a/lib/tests/old/sqlite3.dll b/lib/tests/old/sqlite3.dll deleted file mode 100644 index 321d48d31cf..00000000000 Binary files a/lib/tests/old/sqlite3.dll and /dev/null differ diff --git a/lib/tests/protobuf-net.dll b/lib/tests/protobuf-net.dll deleted file mode 100644 index 99bbb956f80..00000000000 Binary files a/lib/tests/protobuf-net.dll and /dev/null differ diff --git a/lib/x64/ServiceStack.OrmLite.SqliteNET.dll b/lib/x64/ServiceStack.OrmLite.SqliteNET.dll deleted file mode 100644 index e27d2e7c8f9..00000000000 Binary files a/lib/x64/ServiceStack.OrmLite.SqliteNET.dll and /dev/null differ diff --git a/lib/x86/ServiceStack.OrmLite.SqliteNET.dll b/lib/x86/ServiceStack.OrmLite.SqliteNET.dll deleted file mode 100644 index 720408e9dd3..00000000000 Binary files a/lib/x86/ServiceStack.OrmLite.SqliteNET.dll and /dev/null differ diff --git a/license.txt b/license.txt index 99429afd850..ba621930133 100644 --- a/license.txt +++ b/license.txt @@ -1,5 +1,5 @@ ServiceStack -Copyright (c) 2013 Service Stack +Copyright (c) 2013-present, ServiceStack =============================================================================== This program is free software: you can redistribute it and/or modify it @@ -35,7 +35,7 @@ work and are not dervied from the Software. - If you violate any of the terms in this Exception, you lose all rights granted to you by the Exception and revert to the terms of AGPLv3. -Service Stack reserves all rights not expressly granted in these terms and conditions. +ServiceStack reserves all rights not expressly granted in these terms and conditions. Open Source License List @@ -65,5 +65,5 @@ Zlib/libpng License - Commercial License =========================================================================== -In addition to this license, ServiceStack is offered under a commerical license. +In addition to this license, ServiceStack is offered under a commercial license. see https://servicestack.net/pricing for details. diff --git a/release-notes.md b/release-notes.md deleted file mode 100644 index 08e689ca172..00000000000 --- a/release-notes.md +++ /dev/null @@ -1,4972 +0,0 @@ -# v4.0.33 Release Notes - -## OrmLite now supports Async! - -Another [major feature request](http://servicestack.uservoice.com/forums/176786-feature-requests/suggestions/6217167-provider-async-support-for-ormlite) -is ticked off in this release with the new **Async support available in OrmLite!** - -A quick overview of the new Async API's added can be seen in the class diagram below: - -![OrmLite Async APIs](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/ormlite/OrmLiteApiAsync.png) - -Basically most of OrmLite public API's now have async equivalents of the same name and an additional conventional `*Async` suffix. -The Async API's also take an optional `CancellationToken` making converting sync code trivial, where you just need to -add the `Async` suffix and **await** keyword, as can be seen in the -[Customer Orders UseCase upgrade to Async diff](https://github.com/ServiceStack/ServiceStack.OrmLite/commit/c1ce6f0eac99133fc232b263c26c42379d4c5f48). - -> Effectively the only Data Access API's that doesn't have async equivalents are `*Lazy` APIs yielding a lazy -> sequence (incompatible with async) as well as **Schema** DDL API's which are typically not used at runtime. - -For a quick preview of many of the new Async API's in action, checkout -[ApiSqlServerTestsAsync.cs](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLiteV45.Tests/ApiSqlServerTestsAsync.cs). - -### Async RDBMS Providers - -Currently only a limited number of RDBMS providers offer async API's which are only available in their **.NET 4.5** builds, which at this time are only: - - - [SQL Server .NET 4.5+](https://www.nuget.org/packages/ServiceStack.OrmLite.SqlServer) - - [MySQL .NET 4.5+](https://www.nuget.org/packages/ServiceStack.OrmLite.MySql) - -We've also added a -[.NET 4.5 build for Sqlite](https://www.nuget.org/packages/ServiceStack.OrmLite.Sqlite.Mono) -as it's a common use-case to swapout to use Sqlite's in-memory provider for faster tests. -But as Sqlite doesn't provide async API's under-the-hood we fallback to *pseudo async* support where we just wrap its synchronous responses in `Task` results. - -Regardless of whether the RDBMS provider offers Async API's, you still can use the same OrmLite async API's with all providers as seen with the Async API -examples below where the same Async API's can also be used in DB Providers that doesn't natively support Async (i.e. Sqlite): - - - [ApiSqlServerTestsAsync.cs](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLiteV45.Tests/ApiSqlServerTestsAsync.cs) - - [ApiMySqlTestsAsync.cs](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLiteV45.Tests/ApiMySqlTestsAsync.cs) - - [ApiSqliteTestsAsync.cs](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLiteV45.Tests/ApiSqliteTestsAsync.cs) - -Only when these Async API's are run on an RDBMS provider with native async support (i.e. .NET 4.5 SqlServer or MySql) will you benefit from true -non-blocking Async I/O, otherwise it fallsback to *pseudo async* support, i.e. synchronous I/O datasets wrapped in `Task` Results. - -### Multiple Self References - -OrmLite's [POCO Reference conventions](https://github.com/ServiceStack/ServiceStack.OrmLite#reference-conventions) -has been expanded to include support for multiple Self References. - -The example below shows a customer with multiple `CustomerAddress` references which are able to be matched with -the `{PropertyReference}Id` naming convention, e.g: - -```csharp -public class Customer -{ - [AutoIncrement] - public int Id { get; set; } - public string Name { get; set; } - - [References(typeof(CustomerAddress))] - public int? HomeAddressId { get; set; } - - [References(typeof(CustomerAddress))] - public int? WorkAddressId { get; set; } - - [Reference] - public CustomerAddress HomeAddress { get; set; } - - [Reference] - public CustomerAddress WorkAddress { get; set; } -} -``` - -Once defined, it can be saved and loaded via OrmLite's normal Reference and Select API's, e.g: - -```csharp -var customer = new Customer -{ - Name = "Z Customer", - HomeAddress = new CustomerAddress { - Address = "1 Home Street", - Country = "US" - }, - WorkAddress = new CustomerAddress { - Address = "2 Work Road", - Country = "UK" - }, -}; - -db.Save(customer, references:true); - -var c = db.LoadSelect(q => q.Name == "Z Customer"); -c.WorkAddress.Address.Print(); // 2 Work Road - -var ukAddress = db.Single(q => q.Country == "UK"); -ukAddress.Address.Print(); // 2 Work Road -``` - -## [ServiceStack.Redis SSL Support](https://github.com/ServiceStack/ServiceStack/wiki/Secure-SSL-Redis-connections-to-Azure-Redis) - -The [most requested feature for ServiceStack.Redis](http://servicestack.uservoice.com/forums/176786-feature-requests/suggestions/6093693-support-ssl-connection-to-redis-instances-hosted-a) -has also been realized in this release with **ServiceStack.Redis** now supporting **SSL connections** making it suitable for accessing -remote Redis server instances over a **secure SSL connection**. - -![Azure Redis Cache](https://github.com/ServiceStack/Assets/raw/master/img/wikis/redis/azure-redis-instance.png) - -### Redis Use Cases - -Redis is normally used as a back-end datastore whose access is typically limited to Internal networks or authorized networks protected via firewalls. -The new SSL Support in the Redis Client also enables secure access to a redis-server instance over the Internet and public networks as well, -a scenario that's been recently popularized by Cloud hosting environments like Azure Redis Cache. - -### [Connecting to Azure Redis](https://github.com/ServiceStack/ServiceStack/wiki/Secure-SSL-Redis-connections-to-Azure-Redis) - -As connecting to [Azure Redis Cache](http://azure.microsoft.com/en-us/services/cache/) via SSL was the primary use-case for this feature, -we've added a new -[Getting connected to Azure Redis via SSL](https://github.com/ServiceStack/ServiceStack/wiki/Secure-SSL-Redis-connections-to-Azure-Redis) -to help you get started. - -### Redis Connection Strings - -Redis Connection strings have been expanded to support the more versatile URI format which is now able to capture most of Redis Client settings in a -single connection string (akin to DB Connection strings). - -Redis Connection Strings supports multiple URI-like formats, from a simple **hostname** or **IP Address and port** pair to a fully-qualified **URL** -with multiple options specified on the QueryString. - -Some examples of supported formats: - - localhost - 127.0.0.1:6379 - redis://localhost:6379 - password@localhost:6379 - clientid:password@localhost:6379 - redis://clientid:password@localhost:6380?ssl=true&db=1 - -> More examples can be seen in -[ConfigTests.cs](https://github.com/ServiceStack/ServiceStack.Redis/blob/master/tests/ServiceStack.Redis.Tests/ConfigTests.cs) - -Any additional configuration can be specified as QueryString parameters. The full list of options that can be specified include: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SslboolIf this is an SSL connection
      DbintThe Redis DB this connection should be set to
      ClientstringA text alias to specify for this connection for analytic purposes
      PasswordstringUrlEncoded version of the Password for this connection
      ConnectTimeoutintTimeout in ms for making a TCP Socket connection
      SendTimeoutintTimeout in ms for making a synchronous TCP Socket Send
      ReceiveTimeoutintTimeout in ms for waiting for a synchronous TCP Socket Receive
      IdleTimeOutSecsintTimeout in Seconds for an Idle connection to be considered active
      NamespacePrefixstringUse a custom prefix for ServiceStack.Redis internal index colletions
      - -### New `RedisManagerPool` Client Manager - -With the introduction of Redis URI Connection Strings we've been able to simplify and streamline the existing `PooledRedisClientManager` -implementation that's been extracted out into clients manager called `RedisManagerPool`. -In addition to removing all above options on the Client Manager itself, we've also removed readonly connection strings so the configuration is -much simpler and more aligned with the common use-case. - -In most cases, `PooledRedisClientManager` is substitutable with `RedisManagerPool` e.g: - -```csharp -container.Register(c => - new RedisManagerPool(redisConnectionString)); -``` - -### New Generic API's for calling Custom Redis commands - -Most of the time when waiting to use a new [Redis Command](http://redis.io/commands) you'll need to wait for an updated version of -**ServiceStack.Redis** to add support for the new commands likewise there are times when the Redis Client doesn't offer every permutation -that redis-server supports. - -With the new `Custom` and `RawCommand` API's on `IRedisClient` and `IRedisNativeClient` you can now use the RedisClient to send your own -custom commands that can call adhoc Redis commands: - -```csharp -public interface IRedisClient -{ - ... - RedisText Custom(params object[] cmdWithArgs); -} - -public interface IRedisNativeClient -{ - ... - RedisData RawCommand(params object[] cmdWithArgs); - RedisData RawCommand(params byte[][] cmdWithBinaryArgs); -} -``` - -These API's return Custom Results in the generic data structures below: - -```csharp -public class RedisText -{ - public string Text { get; set; } - public List Children { get; set; } -} - -public class RedisData -{ - public byte[] Data { get; set; } - public List Children { get; set; } -} -``` - -These Custom API's take a flexible `object[]` arguments which accepts any serializable value e.g. -`byte[]`, `string`, `int` as well as any user-defined Complex Types which are transparently serialized -as JSON and send across the wire as UTF-8 bytes. - -```csharp -var ret = Redis.Custom("SET", "foo", 1); // ret.Text = "OK" - -byte[] cmdSet = Commands.Set; -ret = Redis.Custom(cmdSet, "bar", "b"); // ret.Text = "OK" - -ret = Redis.Custom("GET", "foo"); // ret.Text = "1" -``` - -There are also -[convenient extension methods](https://github.com/ServiceStack/ServiceStack.Redis/blob/master/src/ServiceStack.Redis/RedisDataExtensions.cs) -on `RedisData` and `RedisText` that make it easy to access structured data, e.g: - -```csharp -var ret = Redis.Custom(Commands.Keys, "*"); -var keys = ret.GetResults(); // keys = ["foo", "bar"] - -ret = Redis.Custom(Commands.MGet, "foo", "bar"); -var values = ret.GetResults(); // values = ["1", "b"] - -Enum.GetNames(typeof(DayOfWeek)).ToList() - .ForEach(x => Redis.Custom(Commands.RPush, "DaysOfWeek", x)); -ret = Redis.Custom(Commands.LRange, "DaysOfWeek", 1, -2); -var weekDays = ret.GetResults(); - -weekDays.PrintDump(); // ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"] -``` - -and some more examples using Complex Types with the Custom API's: - -```csharp -var ret = Redis.Custom(Commands.Set, "foo", new Poco { Name = "Bar" }); // ret.Text = "OK" - -ret = Redis.Custom(Commands.Get, "foo"); // ret.Text = {"Name":"Bar"} -Poco dto = ret.GetResult(); - -dto.Name.Print(); // Bar -``` - -### New Config, Role and Client commands - -A number of New API's added in this can be seen below: - -```csharp -public interface IRedisClient -{ - ... - RedisText GetServerRoleInfo(); - string GetConfig(string item); - void SetConfig(string item, string value); - void SaveConfig(); - void ResetInfoStats(); - - string GetClient(); - void SetClient(string name); - void KillClient(string address); - long KillClients(string fromAddress = null, - string withId = null, RedisClientType? ofType = null, bool? skipMe = null); - List> GetClientsInfo(); - void PauseAllClients(TimeSpan duration); -} - -public interface IRedisNativeClient -{ - ... - void ConfigRewrite(); - RedisText Role(); - string ClientGetName(); - void ClientSetName(string client); - void ClientKill(string host); - long ClientKill(string addr = null, string id = null, string type = null, string skipMe = null); - byte[] ClientList(); - void ClientPause(int timeOutMs); -} -``` - -## [New VB.NET Add ServiceStack Reference!](https://github.com/ServiceStack/ServiceStack/wiki/VB.Net-Add-ServiceStack-Reference) - -This release also adds [Add ServiceStack Reference](https://github.com/ServiceStack/ServiceStack/wiki/Add-ServiceStack-Reference) -support for the last remaining major .NET language with the new first-class support for -[VB.NET Add ServiceStack Reference](https://github.com/ServiceStack/ServiceStack/wiki/VB.Net-Add-ServiceStack-Reference)! - -This now allows any C#, F# or VB.NET client project to be able generate and end-to-end typed API for your services by just providing the -url of your remote ServiceStack instance, directly from within VS.NET! - -![Add ServiceStack Reference](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/apps/StackApis/add-service-ref-flow.png) - -After clicking OK, the servers DTO's and **ServiceStack.Client** NuGet package are added to the project, providing an instant typed API: - -![Calling a ServiceStack Service from VB.NET](https://github.com/ServiceStack/Assets/raw/master/img/apps/StackApis/call-service-vb.png) - -Thanks to the close semantics between the C# and VB.NET languages, we're able to add support for all C# -[customization options in VB.NET](https://github.com/ServiceStack/ServiceStack/wiki/VB.Net-Add-ServiceStack-Reference#dto-customization-options). - -Much of the new VB.NET NativeTypes provider is thanks to the efforts of [@KevinHoward](https://github.com/KevinHoward). - -### [Upgrade ServiceStackVS](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project) - -To take advantage of VB.NET Add ServiceStack Reference feature, -[Upgrade or Install ServiceStackVS](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project) VS.NET Extension. -If you already have **ServiceStackVS** installed, uninstall it first from `Tools -> Extensions and Updates... -> ServiceStackVS -> Uninstall`. - -## Simplified Add ServiceStack Reference UX for all languages - -In our first iteration of **Add ServiceStack Reference** for C# we used a **T4 Template** to make it easy for clients to view all the Customization -options available and to be able to auto-generate the Server DTO's by modifying and saving (or re-running) the T4 template. - -Since F# projects doesn't support T4 Templates, when adding support for -[F# Add ServiceStack Reference](https://github.com/ServiceStack/ServiceStack/wiki/FSharp-Add-ServiceStack-Reference) -we had to skip the T4 template and add the server-generated DTO's source file directly to the project. -Ditching the T4 Template ended up having a nice benefit as there was less moving parts and the UX ended up being simpler and more user-friendly -and transparent for the default case of generating client DTO's using the -[Default Server Configuration](https://github.com/ServiceStack/ServiceStack/wiki/CSharp-Add-ServiceStack-Reference#change-default-server-configuration). - -With the latest **ServiceStackVS** you can now update the Server DTO's in all projects by clicking on `Update ServiceStack Reference` -on the context-menu, e.g: - -![Update ServiceStack Reference](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/servicestack%20reference/updateref-vbnet.gif) - -### Single Generated DTOs Source File - -We've decided to embrace and provide a better user story around the single source file approach and use it for all C#, F# and VB.NET projects, -which resulted in a more consistent and simpler UX for all project types. - -Now to [customize the generated DTO's](https://github.com/ServiceStack/ServiceStack/wiki/CSharp-Add-ServiceStack-Reference#dto-customization-options) -on the client you can just uncomment the option you want to change in the **header comments** and hit save. **ServiceStackVS** automatically watches -for any changes to the generated dto source files (i.e. ending with `.dtos.cs`) and will automatically send the uncommented options to the -remote server referenced by the `BaseUrl` and replace the existing file with the updated DTOs instantly! - -Taking the example below once we uncomment the `MakePartial` option and save the file, **ServiceStackVS** automatically sends a new request for -updated to the remote ServiceStack instance, passing in the `?MakePartial=False` option: - -```csharp -/* Options: -Date: 2014-10-21 00:44:24 -Version: 1 -BaseUrl: http://stackapis.servicestack.net - -MakePartial: False -//MakeVirtual: True -//MakeDataContractsExtensible: False -//AddReturnMarker: True -//AddDescriptionAsComments: True -//AddDataContractAttributes: False -//AddIndexesToDataMembers: False -//AddResponseStatus: False -//AddImplicitVersion: -//InitializeCollections: True -//AddDefaultXmlNamespace: http://schemas.servicestack.net/types -*/ -``` - -After saving you'll be able to notice the DTO's are updated instantly with the `Date:` changing to reflect the current time and the new -generated DTO's no longer containing `partial` classes. - -### ServiceStack.Text - -New `JsConfig.OnDeserializing` and dynamic `ShouldSerialize(string field)` customization options were added to ServiceStack's JSON and JSV -Text serializers by [@pavelsavara](https://twitter.com/pavelsavara). An example of these new customization options in action is visible below: - -```csharp -[DataContract] -public class CustomSerializedPoco -{ - [IgnoreDataMember] - public HashSet hasAttribute; - - [DataMember(EmitDefaultValue = false, IsRequired = false)] - public int A { get; set; } - - [DataMember(EmitDefaultValue = false, IsRequired = false)] - public int? B { get; set; } - - public bool? ShouldSerialize(string fieldName) - { - return hasAttribute == null - ? null - : hasAttribute.Contains(fieldName); - } - - public object OnDeserializing(string fieldName, object value) - { - if (hasAttribute == null) - hasAttribute = new HashSet(); - hasAttribute.Add(fieldName); - return value; - } -} -``` - -This change makes it possible to create dynamic POCO's that behave in a similar way that dynamic languages can, -e.g. After deserialization you can detect which fields were deserialized by inspecting the `hasAttribute` collection. - -The `ShouldSerialize` API, closely follows the existing `ShouldSerialize{X}` convention but instead allows for a single API -to handle all serializable properties. - -The API returns a `bool?` which has the following meaning: - - `true` - Should be emitted - - `false` - Should not be emitted - - `null` - Use default behavior - -This allows us to implement a custom type that can support full round-trip when the field on the original JSON payload allowing use to -implement a custom type with similar functionality to `IExtensibleDataObject` which allows survival and forwarding of unknown properties, but for JSON. - -## RabbitMQ - -RabbitMQ Server and Client now have optional `PublishMessageFilter` and `GetMessageFilter` callbacks which can be used to intercept -outgoing and incoming messages, the `IBasicProperties.Type` is also pre-populated with the Type name of the message body that was published, e.g: - -```csharp -var mqServer = new RabbitMqServer("localhost") -{ - PublishMessageFilter = (queueName, properties, msg) => { - properties.AppId = "app:{0}".Fmt(queueName); - }, - GetMessageFilter = (queueName, basicMsg) => { - var props = basicMsg.BasicProperties; - receivedMsgType = props.Type; //automatically added by RabbitMqProducer - receivedMsgApp = props.AppId; - } -}; - -using (var mqClient = mqServer.CreateMessageQueueClient()) -{ - mqClient.Publish(new Hello { Name = "Bugs Bunny" }); -} - -receivedMsgApp.Print(); // app:mq:Hello.In -receivedMsgType.Print(); // Hello -``` - -## Other Minor Changes - - - ServerEvents Server now echoes heartbeat messages through the listening connection, - `ServerEventsClient` only fires the `OnHeartbeat` callback when it's receives the `cmd.Heartbeat` command message - - Request binding for `Path` and `QueryString` variables are added to DTO's with Request DTO's providing their own [custom body deserialization](https://github.com/ServiceStack/ServiceStack/wiki/Serialization-deserialization) by implementing `IRequiresRequestStream` - - New `IAppHost.OnDisposeCallbacks` available allowing **Plugins** to register callbacks when `AppHost` is disposed - - `Config.UseHttpsLinks` now modifies generated BaseUrl of all links to use `https` - - The `ResponseStatus` on Custom DTO's are now preserved when thrown inside a custom `HttpError` response - - Equality members added to `[Route]`, `[Authenticate]`, `[RequiredRole]` and `[RequiredPermission]` attributes - - `ToOptimizedResultUsingCache` no longer double-encodes raw `string` responses - - `MvcHtmlString` was moved to `ServiceStack.Html` namespace - - New `StaticFileHandler.ResponseFilter` added to be able to modify custom headers returned on static files - - Many of OrmLite's static Extension method classes were renamed into a more logical grouping. - These changes are source compatible for typical usage of OrmLite API's, i.e. referenced as extension methods - -## Breaking changes - -### Added new .NET 4.5 Builds - -In preparation for introducing Async API's we've added new .NET 4.5 builds for the following packages: - - - ServiceStack.OrmLite - - ServiceStack.OrmLite.Sqlite.Mono - - ServiceStack.OrmLite.SqlServer - - ServiceStack.OrmLite.MySql - - ServiceStack.Server - -When adding ServiceStack NuGet Packages to a **.NET 4.5** project you will now get these .NET 4.5 builds instead. -You could run into issues if mixing .NET v4.0 and v4.5 builds as all dependencies need to reference the same build version. -The easiest way to fix any versioning issues is to make sure all projects use the same .NET Framework version (e.g. .NET 4.5) -and then just uninstall and re-install the ServiceStack NuGet packages. - -### Removed ThreadStatic OrmLite Configuration - -We've also removed our existing ThreadStatic config variables (used to temporarily override global configuration). -Most per-connection state is now stored on the connection e.g. `CommandTimeout` was previously overridden with: - -```csharp -var hold = OrmLiteConfig.TSCommandTimeout; -try { - OrmLiteConfig.TSCommandTimeout = 60; - db.Select(...); -} finally { - OrmLiteConfig.TSCommandTimeout = hold; -} -``` - -Is now set directly on the connection (and only applies to that connection), e.g: - -```csharp -using (var db = DbFactory.Open()) -{ - db.SetCommandTimeout(60); - db.Select(...); -} -``` - -Likewise if you ever need to access the current `OrmLiteConfig.DialectProvider`, it should now be retrieved from the `IDbConnection`, i.e: - -```csharp -db.GetDialectProvider(); -``` - -and if you ever need to access the underlying ADO.NET `IDbConnection` or `IDbCommand` you can use the following APIs: - -```csharp -IDbConnection adoDb = db.ToDbConnection(); -IDbCommand adoDbCmd = dmCmd.ToDbCommand(); -``` - -### IReturnVoid now returns void - -All `IReturnVoid` API's on Service Clients have been changed to return `void` instead of -`HttpWebResponse` which needed to be explicitly disposed by the callee. - -To access the `HttpWebResponse`, Request DTO's can be changed to `IReturn` - -```csharp -public class EmptyResponse : IReturn { ... } -``` - -Alternatively the Response can be specified on the call-site: - -```csharp -HttpWebResponse response = client.Get(new EmptyResponse()); -``` - -# v4.0.32 Release Notes - -## FSharp Add ServiceStack Reference! - -We're happy to announce that the next language supported by [Add ServiceStack Reference](https://github.com/ServiceStack/ServiceStack/wiki/Add-ServiceStack-Reference) is F#! - -For a quick overview, [Add ServiceStack Reference](https://github.com/ServiceStack/ServiceStack/wiki/Add-ServiceStack-Reference) is a simple solution to WCF's Add Service Reference that provides a flexible alternative to sharing your compiled server DTO's assembly with clients. Now F# clients can easily add a reference to a remote ServiceStack instance and update typed DTO's directly from within VS.NET - reducing the burden and effort required to consume ServiceStack Services. - -### Example Usage - -The easiest way to Add a ServiceStack reference to your project is to right-click on your project to bring up [ServiceStackVS's](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project) **Add ServiceStack Reference** context-menu item. This opens a dialog where you can add the url of the ServiceStack instance you want to typed DTO's for, as well as the name of the T4 template that's added to your project. - -[![Add ServiceStack Reference](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/apps/StackApis/add-service-ref-flow.png)](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/apps/StackApis/add-service-ref-flow.png) - -After clicking OK, the servers DTO's and [ServiceStack.Client](https://www.nuget.org/packages/ServiceStack.Client) NuGet package are added to the project, providing an instant typed API: - -[![Calling ServiceStack Service with FSharp](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/fsharp-add-servicestack-reference.png)](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/fsharp-add-servicestack-reference.png) - -### Updating a ServiceStack Reference - -Updating a ServiceStack reference works intuitively where you can right-click on the DTO's you want to update and click **Update ServiceStack Reference** on the context menu: - -[![Calling ServiceStack Service with FSharp](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/fsharp-update-servicestack-reference.png)](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/fsharp-update-servicestack-reference.png) - -### F# Client Example - -Just like with C#, F# Native Types can be used in ServiceStack's [Generic Service Clients](https://github.com/ServiceStack/ServiceStack/wiki/C%23-client) providing and end-to-end Typed API whose PCL support also allows F# to be used in [mobile clients apps](https://github.com/ServiceStackApps/HelloMobile) as well. The basic [stackapis.servicestack.net](http://stackapis.servicestack.net/) Services example in F# looks like: - -```fsharp -let client = new JsonServiceClient("http://stackapis.servicestack.net") -let response = client.Get(new SearchQuestions( - Tags = new List([ "redis"; "ormlite" ]))) - -TypeSerializer.PrintDump(response) -``` - -## FSharp Native Types Notes - -Add ServiceStack Reference in FSharp projects works a little different to C# projects which [utilizes VS.NET's built-in T4 support](https://github.com/ServiceStack/ServiceStack/wiki/Add-ServiceStack-Reference#add-servicestack-reference) to provide customization of DTO's on the client that auto-runs the T4 template implicitly on **Save** or explicitly with the **Run Custom Tool** context menu item. - -Since there's no support for T4 templates in F# Projects, clicking **Add ServiceStack Reference** skips the T4 template and just adds the generated F# Types using the server defaults. This ends up providing a simpler experience for F# clients in the default case. Customization of default behavior can still be done on the Server: - -### Change Default Server Configuration - -The above defaults are also overridable on the ServiceStack Server by modifying the default config on the `NativeTypesFeature` Plugin, e.g: - -```csharp -var typesConfig = this.GetPlugin().MetadataTypesConfig; -typesConfig.AddDataContractAttributes = false; -... -``` - -## F# Native Types Constraints - -As the ordering constraint in F# conflicted with the ordering of types by C# namespaces, the cleanest approach was to add all DTO's under a single namespace. By default the namespace used will be the base **ServiceModel** namespace which is overridable with the `GlobalNamespace` Config: - -```csharp -typesConfig.GlobalNamespace = "Client.Namespace"; -``` - -This does mean that each DTO type name needs to be unique which is a best-practice that's now a requirement in order to make use of F# native types. Another semantic difference is that any C# partial classes are converted into top-level classes in F#. - -For more documentation about F# Native Types including info on each of the config options supported checkout the [F# Add ServiceStack Reference wiki](https://github.com/ServiceStack/ServiceStack/wiki/FSharp-Add-ServiceStack-Reference). - -### [Upgrade ServiceStackVS](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project) - -To take advantage of this F# Add ServiceStack Reference [Upgrade or Install ServiceStackVS](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project) VS.NET Extension. If you already have **ServiceStackVS** installed, uninstall it first from `Tools -> Extensions and Updates... -> ServiceStackVS -> Uninstall`. - -### Nested classes and Enums - -Support for Enums and Nested classes are now supported on both C# and F# Native Types. - -## Improved integration with MVC and ASP.NET - -We've improved integration for making use of ServiceStack components in existing ASP.NET MVC and WebForms Web Applications. The internals of `ServiceStackController` have been rewritten to share a common code-base with the new WebForms `ServiceStackPage` WebForms base page, both provide easy access to the same clean, high-performance components found in ServiceStack's `Service` base class, directly from within your MVC Controllers and WebForm pages. - -This is an outline of the API's found in MVC's `ServiceStackController` and WebForms `ServiceStackPage`: - -```csharp -public class ServiceStackController : Controller -{ - //... - IServiceStackProvider ServiceStackProvider { get; set; } - IAppSettings AppSettings { get; set; } - IHttpRequest ServiceStackRequest { get; set; } - IHttpResponse ServiceStackResponse { get; set; } - ICacheClient Cache { get; set; } - IDbConnection Db { get; set; } - IRedisClient Redis { get; set; } - IMessageFactory MessageFactory { get; set; } - IMessageProducer MessageProducer { get; set; } - ISessionFactory SessionFactory { get; set; } - ISession SessionBag { get; set; } - bool IsAuthenticated { get; set; } - - T TryResolve(); - T ResolveService(); - object Execute(object requestDto); - object ForwardRequestToServiceStack(IRequest request=null); - IAuthSession GetSession(bool reload = true); - TUserSession SessionAs(); - void ClearSession(); - void PublishMessage(T message); -} -``` - -### Use ServiceStack Authentication - -One benefit of integration with ServiceStack is to be able to make use of ServiceStack's simple and flexible [Authentication Providers](https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization) which require minimal configuration and supports a number of different [Session Providers](https://github.com/ServiceStack/ServiceStack/wiki/Caching) and persistent [Data Store back-ends](https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization#userauth-persistence---the-iuserauthrepository) to make it easy to integrate with an existing environment. - -### New MVC and WebForms Examples - -To illustrate the seamless integration with ServiceStack, we've created 2 new authentication-enabled example websites: - - - **ASP.NET MVC** Live Demo: [mvc.servicestack.net](http://mvc.servicestack.net/) and [source code](https://github.com/ServiceStack/Test/tree/master/src/Mvc) - - **ASP.NET WebForms** Live Demo: [webforms.servicestack.net](http://webforms.servicestack.net/) and [source code](https://github.com/ServiceStack/Test/tree/master/src/WebForms) - -![MVC with ServiceStack Authentication](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/mvc-integration.png) - -### Integrating with ServiceStack from MVC or WebForms - -We'll go through the MVC example to showcase the different ways you can integrate with ServiceStack from an external Web Framework. - -#### Using ResolveService to call Services directly - -The `Login` Action is a standard MVC Action handling HTML Form input accepting 3 parameters, a `userName`, `password` as well as a relative `redirect` url to redirect to when authentication is successful. Login uses the `ResolveService` API which just resolves an auto-wired instance of the ServiceStack `AuthenticateService` from the IOC and injects the current HTTP Request context, which we then use to call a method on the Service directly: - -```csharp -public ActionResult Login(string userName, string password, string redirect=null) -{ - if (ModelState.IsValid) - { - try - { - using (var authService = ResolveService()) - { - var response = authService.Authenticate(new Authenticate { - provider = CredentialsAuthProvider.Name, - UserName = userName, - Password = password, - RememberMe = true, - }); - - // add ASP.NET auth cookie - FormsAuthentication.SetAuthCookie(userName, true); - - return Redirect(string.IsNullOrEmpty(redirect) ? "/" : redirect); - } - } - catch (Exception ex) - { - ModelState.AddModelError(string.Empty, ex.Message); - } - } - - return View("Index", GetViewModel()); -} -``` - -> Since the above example calls the Service method directly any exceptions raised by the Service implementation are thrown and caught as normal. - -#### Using Execute to process Request DTO's - -The `Logout()` MVC Action uses ServiceStack's `Execute()` API which can call the desired ServiceStack Service with just a populated Request DTO: - -```csharp -public ActionResult Logout() -{ - Execute(new Authenticate { provider = "logout" }); - FormsAuthentication.SignOut(); - - return Redirect("/"); -} -``` - -#### Using ForwardRequestToServiceStack to proxy HTTP Requests - -The `ForwardingController` handles OAuth callbacks that have been configured to callback to `/auth/*` route which is handled by MVC as ServiceStack is mounted at and only configured to handle `/api` requests. - -Instead of creating new OAuth Applications with each provider to use the new `/api/auth/*` callback url so ServiceStack can handle the OAuth callback, we can use just use the new `ForwardRequestToServiceStack()` which just forwards the incoming HTTP Request from MVC to ServiceStack to process, effectively acting as a proxy: - -```csharp -routes.MapRoute("Forwarding", "auth/{*pathinfo}", - new { controller = "Forwarding", action = "Index" }); -... - -public class ForwardingController : ServiceStackController -{ - public ActionResult Index() - { - var response = ForwardRequestToServiceStack(); - if (ServiceStackResponse.IsClosed) return new EmptyResult(); - - string redirectUrl; - var httpResult = response as IHttpResult; - if (httpResult != null && httpResult.Headers.TryGetValue(HttpHeaders.Location, out redirectUrl)) - return Redirect(redirectUrl); - - return Redirect("/"); - } -} -``` - -The `Execute()` and `ForwardRequestToServiceStack()` are high-level API's that call into ServiceStack's internal Request pipeline, executing any Action Filters and also converts any exceptions into a populated serializable Response DTO with a populated `ResponseStatus` as would be returned to Service Clients. - -### Authentication Attributes - -Since we're using ServiceStack for Authentication, we're also able to re-use ServiceStack's Authentication Attribute Filters directly on MVC Controllers and WebForm Pages just as if they were ServiceStack Services, e.g: - -```csharp -[Authenticate] -public class AuthOnlyController : ServiceStackController -{ - public ActionResult Index() - { - return View(SessionAs()); - } -} -``` - -The above controller hanldes the [mvc.servicestack.net/AuthOnly](http://mvc.servicestack.net/AuthOnly) route which only allows access to Authorized users. If a user is not authenticated they're automatically redirected to [/?redirect=/AuthOnly#f=Unauthorized](http://mvc.servicestack.net/?redirect=%2fAuthOnly#f=Unauthorized) to prompt the user to login, after successfully logging in it will redirect back to the original `/AuthOnly` url. - -### Required Role or Permission - -The `[RequiredRole]` and `[RequiredPermission]` attributes work similar to the `[Authentication]` attribute except they also assert that the user is a member of the specified role: - -```csharp -[RequiredRole("TheRole")] -public class RequiresRoleController : ServiceStackController -{ - public ActionResult Index() - { - return View(SessionAs()); - } -} -``` - -The above Controller handles the [/RequiresRole](http://mvc.servicestack.net/RequiresRole) Route and will only grant access if the Authenticated User is also a member of the **TheRole**. - -### Calling ServiceStack Services Directly - -The simplest way to consume ServiceStack Services requiring the least effort and moving parts is to call them directly: - -#### Using ServiceStack OAuth in MVC - -Integrating with ServiceStack's OAuth providers requires the least effort as they're linkable directly in the format `/api/auth/{provider}` which is handled by ServiceStack's OAuth Service who initiates the Authentication process by redirecting to the selected OAuth provider: - -![MVC OAuth with HTML](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/mvc-auth.png) - -#### Calling ServiceStack with Ajax in MVC - -Posting HTML Forms directly to ServiceStack Services isn't that much more effort, Start with a plain HTML Form with field names that match with the Services property names: - -![MVC Register with HTML](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/mvc-register.png) - -We can then use ServiceStack's built-in [ss-utils.js JavaScript Libraray](https://github.com/ServiceStack/ServiceStack/wiki/ss-utils.js-JavaScript-Client-Library) to take care of Ajaxifying, auto-binding and submitting the form via Ajax. It also has built-in support for [Bootstrap Forms Field Validation conventions](https://github.com/ServiceStack/ServiceStack/wiki/ss-utils.js-JavaScript-Client-Library#bootstrap-forms) to automatically bind errors to the appropriate fields. The only custom code required is to bind the form is then: - -```javascript -$("#form-register").bindForm({ - success: function (r) { location.href = '/'; } -}); -``` - -In this case we've added a success callback to redirect to the home page if the registration was successful which will either be authenticated with the newly registered user if **Auto Login** was checked, otherwise you can use the login form to Sign in as the newly registered user. - -## [Server Events](https://github.com/ServiceStack/ServiceStack/wiki/Server-Events) - -There are new custom hooks on `ServerEventsFeature` to allow for further customization and deeper introspection of ServiceStack's Server Events: - - - `OnInit` - Invoked when clients first connect to the `event-stream`, can be used to add additional HTTP Headers back to the client - - `OnPublish` - Fired after each message is published with the active Response and the raw message that was published - -### Add Authentication support to .NET ServerEvents Client - -There are new explicit `Authenticate` and `AuthenticateAsync` API's which can be used to authenticate the ServerEvents ServiceClient which now **shares cookies** with the WebRequest that connects to the `/event-stream` so authenticating with the Server Events ServiceClient will also authenticate the `/event-stream` HTTP Connection: - -```csharp -client.Authenticate(new Authenticate { - provider = CredentialsAuthProvider.Name, - UserName = "user", - Password = "pass", - RememberMe = true, -}); - -client.Start(); -``` - -Which is also equivalent to: - -```csharp -client.ServiceClient.Post(new Authenticate { - provider = CredentialsAuthProvider.Name, - UserName = "user", - Password = "pass", - RememberMe = true, -}); -``` - -### Limiting Server Events to Authenticated Clients Only - -There's a new `LimitToAuthenticatedUsers` option in `ServerEventsFeature` to limit access to authenticated clients only: - -```csharp -Plugins.Add(new ServerEventsFeature { - LimitToAuthenticatedUsers = true, -}); -``` - -When enabled it will return a `401 Unauthorized` for non-authenticated clients. - -### JavaScript ServerEvents Client - -The [Server Events JavaScript Client](https://github.com/ServiceStack/ServiceStack/wiki/JavaScript-Server-Events-Client) now auto-reconnects when a heartbeat request fails by calling the new `$.ss.reconnectServerEvents()` API. - -## Funq IOC - -Funq now supports Lazy dependencies where you can `Func` factories to delay the resolution of dependencies to only when the Service is needed. The factories also support Multiple lazy arguments (up to 3 args): - -```csharp -container.RegisterAutoWiredAs(); -container.RegisterAutoWiredAs(); -container.RegisterAutoWiredAs(); - -container.RegisterAutoWired(); - -public class Dependency -{ - Func ctorFoo; - public Dependency(Func ctorFoo) - { - this.ctorFoo = ctorFoo; - } - - public Func Foo { get; set; } - - public Func FooBar { get; set; } - - public Func FooBarBaz { get; set; } - - public object Execute() - { - int total = 0; - var foo = ctorFoo(); - var bar = FooBar(foo); - var baz = FooBarBaz(foo, bar); - return bax.Execute(); - } -} -``` - -An alternative approach to resolving lazy dependency is to use a Lazy Property which is our preferred approach since allows the call-site to be transparent and retain a clean API, e.g: - -```csharp -public virtual IDbConnectionFactory DbFactory { get; set; } - -IDbConnection db; -public virtual IDbConnection Db -{ - get { return db ?? (db = DbFactory.OpenDbConnection()); } -} -``` - -This technique is used in the built-in [Repository Base](https://github.com/ServiceStack/ServiceStack/blob/8dcbbdb7dbe20fd3201cde100370564e8577a019/src/ServiceStack/ILogic.cs#L38) and [Logic Base](https://github.com/ServiceStack/ServiceStack/blob/8dcbbdb7dbe20fd3201cde100370564e8577a019/src/ServiceStack/ILogic.cs#L55) base classes which your dependencies can inherit from to enable lazy access to common ServiceStack providers. - -## App Settings - -### New Providers - -There's a new `EnvironmentVariableSettings` AppSettings provider to source configuration from Environment variables as well as a new `MultiAppSettings` AppSettings provider that enables reading configuration from multiple configuration sources. - -With these new providers we can setup a cascading configuration that first checks Environment variables, then looks in a local `~/appsettings.txt` plain-text file before falling back to `Web.config`: - -```csharp -AppSettings = new MultiAppSettings( - new EnvironmentVariableSettings(), - new TextFileSettings("~/appsettings.txt".MapHostAbsolutePath()), - new AppSettings()); -``` - -### New Apis - -New `GetAllKeys()` and `Exists()` were added to all `IAppSettings` providers: - -```csharp -public interface IAppSettings -{ - List GetAllKeys(); - bool Exists(string key); - //... -} -``` - -This makes it easy to scan and retrieve all related keys, e.g: - -```csharp -var devKeys = appSettings.GetAllKeys().Where(x => x.Matches("Dev.*")); -``` - -## [Session](https://github.com/ServiceStack/ServiceStack/wiki/Sessions) - -### Use HTTP Headers to Send Session Cookies - -You can now make a Session-enabled request with HTTP Headers instead of Cookies. The Session HTTP Headers have a `X-` prefix before the Session Id, i.e: `X-ss-id`, `X-ss-pid` and `X-ss-opts` - -### New API's for Session Bag - -New API's for storing and retrieving POCO's in a session bag without specifying a key (key defaults to Type Name): - -```csharp -SessionBag.Set(unAuthInfo); -var unAuthInfo = SessionBag.Get(); -``` - -New `GetSessionBag()` extension methods on `IRequest` and `IServiceBase` make it easier to access the users dynamic Session Bag from outside of a Service. E.g the example below shows how to copy any Anonymous User Session info into the Users typed Session when they Sign In: - -```csharp -public class CustomUserSession : AuthUserSession -{ - [DataMember] - public string UnAuthInfo { get; set; } - - public override void OnAuthenticated(IServiceBase authService, IAuthSession session, - IAuthTokens tokens, Dictionary authInfo) - { - UnAuthInfo = authService.GetSessionBag().Get(); - } -} -``` - -## OrmLite - -### New OrderBy API's for Joined Tables - -You can now Order By fields from Joined Tables in an SqlExpression: - -```csharp -var q = db.From() - .Join() - .OrderBy(x => x.Name); -``` - -### Count Queries - - - New `RowCount()` API added to return the number of rows in a query - - Aggregate `Count()` queries that return more than a single row are summed together - -### SelectInto Mapping - - - You no longer need to repeat `[Alias]` attributes when projecting results into different types with `db.SelectInto` API's as fields are now mapped by POCO Property names - -## ServiceStack.Text - - - Default delimiter of `ParseKeyValueText` changed from `:` to ` ` (space) - - New `string.Matches()` extension method to perform Glob-style matches - - `GetGenericType()` extension has been renamed to the more appropriate `FirstGenericType()` - - The `__type` info for late-bound types is no longer affected by white-space - -## Other - - - Metadata detail pages now include any types referenced in the Request and Response DTOs - - Rabbit MQ Clients no longer auto-declare Server Named Queues `amq.*` - -## Community - -### New [ServiceStack Succinctly](http://www.agile-code.com/blog/servicestack-succinctly-free-e-book/) Free e-book! - -[ServiceStack Succinctly](http://www.agile-code.com/blog/servicestack-succinctly-free-e-book/) is a new free e-book by [Zoran Maksimovic](https://twitter.com/zoranmax) which runs through the basics of creating and implementing a simple order management system with ServiceStack: - -Free ServiceStack Succinctly e-book - -### Table of Contents - - 1. ServiceStack Overview - 2. ServiceStack Basics - 3. Order Management System - 4. Solution Configuration - 5. Service Implementation - 6. Pagination - 7. Authentication - 8. Caching - 9. Logging - 10. Profiling - 11. Extending ServiceStack - 12. Documenting Web Services - -# v4.0.31 Release Notes - -The most requested feature since our last release was to expand our last releases support for [Server Sent Events](https://github.com/ServiceStackApps/Chat#server-sent-events) with both a scale-out **Redis ServerEvents back-end** for use in load-balanced App Servers scenarios as well as a **typed C# ServerEvents Client** - we're happy to announce we've been able to deliver both features in this release! - -#### Major features in this release - - - Server Events - - [Redis ServerEvents](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#redis-serverevents) - - [C# ServerEvents Client](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#c-serverevents-client) - - Redis - - [Redis Pub/Sub Server](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#redis-pubsub-server) - - AppSettings - - [First-class AppSettings](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#first-class-appsettings) - - [Writable AppSettings API](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#appsettings-are-now-writable) - - [Metadata Pages](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#metadata-pages) - - Authentication - - [WebSudo](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#web-sudo) - - [Auth Events](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#auth-events) - - [OrmLite](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#ormlite) - - [Text](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#text) - - Community - - [ServiceStack MiniProfiler Toolkit](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#servicestack-miniprofiler-toolkit) - -## Redis ServerEvents - -One limitation the default `MemoryServerEvents` implementation has is being limited for use within a single App Server where all client connections are maintained. This is no longer a limitation with the new **Redis ServerEvents back-end** which utilizes a distributed redis-server back-end to provide a scale-out option capable of serving fan-out/load-balanced App Servers. If you're familiar with SignalR, this is akin to [SignalR's scaleout with Redis back-end](http://www.asp.net/signalr/overview/signalr-20/performance-and-scaling/scaleout-with-redis). - -`RedisServerEvents` is a drop-in replacement for the built-in `MemoryServerEvents` that's effectively a transparent implementation detail, invisible to Server or Client API's where both implementations even [share the same integration Tests](https://github.com/ServiceStack/ServiceStack/blob/b9eb34eb80ff64fa1171d2f7f29ef359c3580eed/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventTests.cs#L169-L189). - -![Redis ServerEvents Scale Out](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/gap/Chat/redis-scaleout.png) - -### Enabling RedisServer Events - -As a drop-in replacement it can easily be configured with just a few lines of code, as seen in the updated Chat App which can run on either [Memory or Redis ServerEvents providers](https://github.com/ServiceStackApps/Chat/blob/326617e88272d7cc0a8b7513272cf055378957e2/src/Chat/Global.asax.cs#L46-L54): - -```csharp -var redisHost = AppSettings.GetString("RedisHost"); -if (redisHost != null) -{ - container.Register(new PooledRedisClientManager(redisHost)); - - container.Register(c => - new RedisServerEvents(c.Resolve())); - - container.Resolve().Start(); -} -``` - -The above configuration will use Redis ServerEvents if there's a `RedisHost` **appSetting** in Chat's [Web.config](https://github.com/ServiceStackApps/Chat/blob/326617e88272d7cc0a8b7513272cf055378957e2/src/Chat/Web.config#L21): - -```xml - -``` - -### Cross-platform Memory and Redis ServerEvent Enabled Chat.exe - -To showcase Redis ServerEvents in action, we've prepared a stand-alone [ServiceStack.Gap](https://github.com/ServiceStack/ServiceStack.Gap) version of [Chat](http://chat.servicestack.net) compiled down into a single **Chat.exe** that can run on either Windows and OSX with Mono which can be downloaded from: - -### [Chat.zip](https://github.com/ServiceStack/ServiceStack.Gap/raw/master/deploy/Chat.zip) (1.2MB) - -[![Redis ServerEvents Preview](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/redis-server-events.gif)](https://github.com/ServiceStack/ServiceStack.Gap/raw/master/deploy/Chat.zip) - -> As Chat only runs on **2 back-end Services**, it fits well within [ServiceStack's Free Quota's](https://servicestack.net/download#free-quotas) which can be further customized and enhanced without a commercial license. - -Running **Chat.exe** without any arguments will run Chat using the default **Memory ServerEvents**. This can be changed to use **Redis ServerEvents** by [un-commenting this line in appsettings.txt](https://github.com/ServiceStack/ServiceStack.Gap/blob/master/src/Chat/Chat/appsettings.txt#L5): - -``` -#redis localhost -``` - -This will require a **redis-server** running on `localhost`. If you don't have redis yet, [download redis-server for Windows](https://github.com/ServiceStack/redis-windows). - -Alternatively you can specify which **port** to run Chat on and change it to use Redis ServerEvents by specifying the **redis** instance it should connect to on the command-line with: - -``` -Chat.exe /port=1337 /redis=localhost -``` - -Also included in `Chat.zip` are [test-fanout-redis-events.bat](https://github.com/ServiceStack/ServiceStack.Gap/blob/master/src/Chat/build/test-fanout-redis-events.bat) and equivalent [test-fanout-redis-events.sh](https://github.com/ServiceStack/ServiceStack.Gap/blob/master/src/Chat/build/test-fanout-redis-events.sh) helper scripts for **spawning multiple versions of Chat.exe** on different ports (and backgrounds) for **Windows or OSX**, showing how multiple clients are able to send messages to each other via Redis whilst being subscribed to different HTTP Servers: - -``` -START Chat.exe /port=1337 /redis=localhost -START Chat.exe /port=2337 /redis=localhost /background=http://bit.ly/1oQqhtm -START Chat.exe /port=3337 /redis=localhost /background=http://bit.ly/1yIJOBH -``` - -This script was used to create the animated gif above to launch **3 self-hosting instances of Chat.exe** running on **different ports**, all connected to each other via Redis. This enables some interesting peer-to-peer scenarios where users are able to run a network of (CPU/resource isolated) decentralized stand-alone HTTP Servers on their local machines, but can still communicate with each other via redis. - -## C# ServerEvents Client - -Like ServiceStack's other [C# Service Clients](https://github.com/ServiceStack/ServiceStack/wiki/C%23-client), the new `ServerEventsClient` is a [portable library](https://github.com/ServiceStackApps/HelloMobile) contained in the `ServiceStack.Client` NuGet package: - -``` -PM> Install-Package ServiceStack.Client -``` - -And like the Service Clients it requires the `BaseUri` of your ServiceStack instance as well as an optional `channel` for the client to subscribe to: - -```csharp -var client = new ServerEventsClient("http://chat.servicestack.net", channel:"home"); -``` - -### Managed Connection - -The **C# ServerEvent Client** is a managed .NET client with feature parity with the [ServiceStack's JavaScript client](https://github.com/ServiceStackApps/Chat#client-bindings---ss-utilsjs) that **auto-reconnects** when a connection is lost, **sends periodic heartbeats** to maintain an active subscription as well as **auto-unregistering** once the client stops listening for messages, or gets disposed. - -### Handling Server Events - -Unlike other C# clients, the ServerEvents Client is mainly reactive in that it's primarily waiting for Server Events to be initiated from a remote server instead of the typical scenario in which requests are initiated by clients. To maximize utility, there are a number of different API's to receive and process messages: - -### Assigning Callback Handlers - -One way to receive messages (useful in long-running clients) is to assign handlers for each of the different events that are fired. This example shows how to capture all the different events a Client can receive: - -```csharp -ServerEventConnect connectMsg = null; -var msgs = new List(); -var commands = new List(); -var errors = new List(); - -var client = new ServerEventsClient(baseUri) { - OnConnect = e => connectMsg = e, - OnCommand = commands.Add, - OnMessage = msgs.Add, - OnException = errors.Add, -}.Start(); -``` - -Once the Client is configured, calling `Start()` will start listening for messages and calling `Stop()` or `Dispose()` will cancel the background HTTP connection and stop it listening for server events. - -### Customizing Metadata sent to clients - -As ServerEvents have deep integration with the rest of ServiceStack we're able to offer [Typed Messages](https://github.com/ServiceStack/ServiceStack/blob/71b51d231d1ddb2ba7da39613e216ab75fd181c0/src/ServiceStack.Client/ServerEventsClient.cs#L14-L44) containing the users `UserAuthId`, `DisplayName` and `ProfileUrl` of the users avatar when it's available. The typed messages also offer an extensible `Dictionary Meta` collection for maintaining custom metadata that can be sent to clients by appending to them in the ServerEventsFeature hooks, which can be defined when registering `ServerEventsFeature`: - -```csharp -Plugins.Add(new ServerEventsFeature { - // private Connect args - OnConnect = (subscription,httpReq) => AppendTo(subscription.Meta), - - // public Join/Leave args - OnCreated = (subscription,httpReq) => AppendTo(subscription.Meta), -}) -``` - -### Using C# Async/Await friendly API's - -Depending on your use-case, if you only want to use the ServerEvent Client for a short-time to listen for predictable responses (i.e. waiting for a Server callback on a pending request) you can alternatively use the Task-based API's letting you to participate in C# async/await workflows: - -```csharp -var client = new ServerEventsClient(baseUri, channel="Home"); - -// Wait to receive onConnect event -ServerEventConnect connectMsg = await client.Connect(); - -// Wait to receive onJoin command event -ServerEventCommand joinMsg = await client.WaitForNextCommand(); - -// Hold a future task to get notified once a msg has been received -Task msgTask = client1.WaitForNextMessage(); - -// Send a Web Service Request using the built-in JsonServiceClient -client.ServiceClient.Post(new PostChatToChannel { - Channel = client.Channel, // The channel we're listening on - From = client.SubscriptionId, // SubscriptionId Populated after Connect() - Message = "Hello, World!", -}); - -// Wait till we receive the chat Msg event we sent earlier -ServerEventMessage msg = await msgTask; -``` - -The above example showcases the **3 Task-based API's** available: - - 1. `Connect()` wait till receiving confirmation of a successful event subscription - 2. `WaitForNextCommand()` wait for the next `onJoin` or `onLeave` subscription events - 3. `WaitForNextMessage()` wait for the next message published to the channel - -The `ServiceClient` property lets you access a `JsonServiceClient` that's pre-configured with the clients `BaseUri` so that is primed for Sending Web Service Requests with. - -After the ServerEvent Client has connected, the `ConnectionInfo` property is populated with the typed `ServerEventConnect` response. - -### Message Event Handlers - -The above examples show generic API's for receiving any type of message, but just like in the JavaScript client, more fine-grained API's are available for handling specific message types. - -The `Handlers` dictionary is akin to the JavaScript Client's [Global Event Handlers](https://github.com/ServiceStackApps/Chat#global-event-handlers) which specify lambda's to be executed when messages are sent with the `cmd.*` selector: - -```csharp -client.Handlers["chat"] = (client, msg) => { - var chatMsg = msg.Json.FromJson(); //Deserialize JSON string to typed DTO - "Received '{0}' from '{1}'".Print(chatMsg.Message, chatMsg.FromName); -}; -``` - -Roughly translates to the equivalent JavaScript below: - -```javascript -$(source).handleServerEvents({ - handlers: { - chat: function (msg, event) { - console.log("Received " + msg.message + " from " + msg.fromName); - } - } -}); -``` - -Where both methods handle the `ChatMessage` sent with the `cmd.chat` selector. - -### Named Receivers - -Whilst handlers provide a light way to handle loose-typed messages, there's a more structured and typed option that works similar to ServiceStack's `IService` classes but are used to instead handle typed Server Event Messages. - -To be able to handle messages with your own classes, get them to implement the `IReceiver` empty marker interface: - -```csharp -public interface IReceiver -{ - void NoSuchMethod(string selector, object message); -} -``` - -Whilst primarily a marker interface, `IReceiver` does include a `NoSuchMethod` API to be able to handle messages sent with a unknown selector **target** that doesn't match any defined method or property. - -**Named Receivers** are equivalent to [Receivers](https://github.com/ServiceStackApps/Chat#receivers) in the JavaScript client which can be assigned to handle all messages sent to a receiver with the selector format: - -``` -{receiver}.{target} -``` - -A Named Receiver can be registered with the API below: - -```csharp -client.RegisterNamedReceiver("test"); -``` - -Which will forward all messages with a `test.*` selector to an instance of the `TestNamedReceiver` Type - -```csharp -public class TestNamedReceiver : ServerEventReceiver -{ - public void FooMethod(CustomType request) {} // void return type - - public CustomType BarMethod(CustomType request) - { - return request; // works with any return type, which are ignored - } - - public CustomType BazSetter { get; set; } // Auto populate properties - - public override void NoSuchMethod(string selector, object message) - { - var msg = (ServerEventMessage)message; - var nonExistentMethodCustomType = msg.Json.FromJson(); - } -} -``` - -This is roughly equivalent to the following JavaScript code: - -```javascript -$(source).handleServerEvents({ - receivers: { - test: { - FooMethod: function (msg, event) { ... }, - BarMethod: function (msg, event) { ... }, - BazSetter: null, - } - } -}); -``` - -> The [ServerEventReceiver](https://github.com/ServiceStack/ServiceStack/blob/68c7159037e7cf2a519d482b7dae524ca073da20/src/ServiceStack.Client/ServerEventsClient.Receiver.cs#L16-L28) is a convenient base class that in addition to implementing `IReceiver` interface, gets injected with the `Client` as well as additional context about the raw message available in `base.Request`. - -#### Unknown Message Handling - -One difference in the JavaScript client is that messages with **unknown** targets are assigned as properties on the `test` receiver, e.g `test.QuxTarget = {..}`. - -### Sending messages to Named Receivers - -Once registered, an instance of `TestNamedReceiver` will process messages sent with a `test.*` selector. The example below shows how to send a DTO to each of `TestNamedReceiver` defined methods and properties: - -```csharp -public class MyEventServices : Service -{ - public IServerEvents ServerEvents { get; set; } - - public void Any(CustomType request) - { - ServerEvents.NotifyChannel("home", "test.FooMethod", request); - ServerEvents.NotifyChannel("home", "test.BarMethod", request); - ServerEvents.NotifyChannel("home", "test.BazSetter", request); - - ServerEvents.NotifyChannel("home", "test.QuxTarget", request); - } -} -``` - -### Life-cycle of Receivers - -Similar to **Services** in ServiceStack, each message is processed with an instance of the Receiver that's resolved from `ServerEventsClient.Resolver` which by default uses the [NewInstanceResolver](https://github.com/ServiceStack/ServiceStack/blob/ec0226b97227048c3bd7c24667a71e7af7e1ff31/src/ServiceStack.Client/ServerEventsClient.Receiver.cs#L30-L36) to execute messages using a new instance of the Receiver Type: - -```csharp -public class NewInstanceResolver : IResolver -{ - public T TryResolve() - { - return typeof(T).CreateInstance(); - } -} -``` - -This can be changed to re-use the same instance by assigning a [SingletonInstanceResolver](https://github.com/ServiceStack/ServiceStack/blob/ec0226b97227048c3bd7c24667a71e7af7e1ff31/src/ServiceStack.Client/ServerEventsClient.Receiver.cs#L38-L46) instead: - -```csharp -public class SingletonInstanceResolver : IResolver -{ - ConcurrentDictionary Cache = new ConcurrentDictionary(); - - public T TryResolve() - { - return (T)Cache.GetOrAdd(typeof(T), type => type.CreateInstance()); - } -} - -client.Resolver = new SingletonInstanceResolver(); -``` - -We can also have it resolve instances from your preferred IOC. Here's an example showing how to register all Receiver Types, auto-wire them with any custom dependencies, and instruct the client to resolve instances from our IOC: - -```csharp -// Register all Receivers: -client.RegisterNamedReceiver("test"); -... - -// Register all dependencies used in a new Funq.Container: -var container = new Container(); -container.RegisterAs(); - -// Go through an auto-wire all Registered Receiver Types with Funq: -container.RegisterAutoWiredTypes(client.ReceiverTypes); - -// Change the client to resolve receivers from the new Funq Container: -client.Resolver = container; -``` - -We can assign `Funq.Container` directly as it already implements the [IResolver](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Configuration/IResolver.cs) interface, whilst you can re-use the existing IOC **Container Adapters** to [enable support for other IOCs](https://github.com/ServiceStack/ServiceStack/wiki/The-IoC-container#use-another-ioc-container). - -### The Global Receiver - -Whilst Named Receivers are used to handle messages sent to a specific namespaced selector, the client also supports registering a **Global Receiver** for handling messages sent with the special `cmd.*` selector. - -#### Handling Messages with the Default Selector - -All `IServerEvents` Notify API's inlcudes [overloads for sending messages without a selector](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/ServerEventsFeature.cs#L743-L771) that by convention will take the format `cmd.{TypeName}`. - -These events can be handled with a Global Receiver **based on Message type**, e.g: - -```csharp -public class GlobalReceiver : ServerEventReceiver -{ - public SetterType AnyNamedProperty { get; set; } - - public void AnyNamedMethod(CustomType request) - { - ... - } -} - -client.RegisterReceiver(); -``` - -Which will be called when messages are sent without a selector, e.g: - -```csharp -public class MyServices : Service -{ - public IServerEvents ServerEvents { get; set; } - - public void Any(Request request) - { - ServerEvents.NotifyChannel("home", new CustomType { ... }); - ServerEvents.NotifyChannel("home", new SetterType { ... }); - } -} -``` - -As Global Receivers handle other messages sent with the `cmd.*` selector and can be re-used as a named receiver, we can define a single class to handle all the different custom messages sent in [chat.servicestack.net](http://chat.servicestack.net) App, E.g: - -``` -cmd.chat Hi -cmd.announce This is your captain speaking... -cmd.toggle#channels -css.background-image url(https://servicestack.net/img/bg.jpg) -... -``` - -The above messages can all be handled with the Receiver below: - -```csharp -public class JavaScriptReceiver : ServerEventReceiver -{ - public void Chat(ChatMessage message) { ... } - public void Announce(string message) { ... } - public void Toggle(string message) { ... } - public void BackgroundImage(string cssRule) { ... } -} - -client.RegisterNamedReceiver(); -client.RegisterNamedReceiver("css"); -``` - -As seen above the **target** names are **case-insensitive** and `-` are collapsed to cater for JavaScript/CSS naming conventions. - -## ServiceStack.Redis - -### Redis Pub/Sub Server - -To power RedisServerEvents we've extracted the managed Pub/Sub long-running message-loop originally built for [Redis MQ](https://github.com/ServiceStack/ServiceStack/wiki/Messaging-and-Redis) and encapsulated it into a re-usable class that can be used independently for handling messages published to specific [Redis Pub/Sub](http://redis.io/commands#pubsub) channels. - -`RedisPubSubServer` processes messages in a managed background thread that **automatically reconnects** when the redis-server connection fails and works like an independent background Service that can be stopped and started on command. - -The public API is captured in the [IRedisPubSubServer](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Redis/IRedisPubSubServer.cs) interface: - -```csharp -public interface IRedisPubSubServer : IDisposable -{ - IRedisClientsManager ClientsManager { get; } - // What Channels it's subscribed to - string[] Channels { get; } - - // Run once on initial StartUp - Action OnInit { get; set; } - // Called each time a new Connection is Started - Action OnStart { get; set; } - // Invoked when Connection is broken or Stopped - Action OnStop { get; set; } - // Invoked after Dispose() - Action OnDispose { get; set; } - - // Fired when each message is received - Action OnMessage { get; set; } - // Fired after successfully subscribing to the specified channels - Action OnUnSubscribe { get; set; } - // Called when an exception occurs - Action OnError { get; set; } - // Called before attempting to Failover to a new redis master - Action OnFailover { get; set; } - - int? KeepAliveRetryAfterMs { get; set; } - // The Current Time for RedisServer - DateTime CurrentServerTime { get; } - - // Current Status: Starting, Started, Stopping, Stopped, Disposed - string GetStatus(); - // Different life-cycle stats - string GetStatsDescription(); - - // Subscribe to specified Channels and listening for new messages - IRedisPubSubServer Start(); - // Close active Connection and stop running background thread - void Stop(); - // Stop than Start - void Restart(); -} -``` - -To use `RedisPubSubServer`, initialize it with the channels you want to subscribe to and assign handlers for each of the events you want to handle. At a minimum you'll want to handle `OnMessage`: - -```csharp -var clientsManager = new PooledRedisClientManager(); -var redisPubSub = new RedisPubSubServer(clientsManager, "channel-1", "channel-2") { - OnMessage = (channel, msg) => "Received '{0}' from '{1}'".Print(msg, channel) - }.Start(); -``` - -Calling `Start()` after it's initialized will get it to start listening and processing any messages published to the subscribed channels. - -## [App Settings](https://github.com/ServiceStack/ServiceStack/wiki/AppSettings) - -For many years our solution against using .NET's complex XML configuration for App configuration is to store structured configuration in the **Web.config** appSettings which thanks to the [JSV Format](https://github.com/ServiceStack/ServiceStack.Text/wiki/JSV-Format) makes it easy to read and write structured data from a single string value, e.g: - -```xml - - - - - - - -``` - -This can be easily parsed into C# types with the [IAppSettings](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Configuration/IAppSettings.cs) API: - -```csharp -IAppSettings settings = new AppSettings(); - -string value = settings.Get("String"); -int value = settings.Get("Int", defaultValue:1); -List values = settings.GetList("List"); -Dictionary valuesMap = settings.GetDictionary("Dict"); -MyConfig config = settings.Get("Poco", new MyConfig { Foo = "Baz" }); -``` - -Like other ServiceStack providers, `IAppSettings` is a clean interface with multiple providers letting you easily change or override where you want to source your App configuration from: - - - **DictionarySettings** - Maintain settings in an in-memory Dictionary - - **TextFileSettings** - Maintain settings in a plain-text file - - **OrmLiteAppSettings** - Maintain settings in any RDBMS `Config` table - -We take advantage of this in our [public OSS projects](https://github.com/ServiceStackApps/Chat) when we want to override [public appSettings with production settings](https://github.com/ServiceStackApps/HttpBenchmarks/blob/master/src/BenchmarksAnalyzer/Global.asax.cs#L29-L32) or in our [stand-alone Applications](https://github.com/ServiceStack/ServiceStack.Gap) by allowing us to ship our applications with more end-user friendly **plain-text config file** whose defaults are embedded in the stand-alone **.exe**, exporting it if it doesn't exist - letting us achieve a single, portable **.exe** that can be xcopy'ed and run as-is. - -### First class AppSettings - -After proving its value over the years we've decided to make it a first-class property on `IAppHost.AppSettings` which defaults to looking at .NET's App/Web.config's. - -The new [Chat.zip](https://github.com/ServiceStack/ServiceStack.Gap/raw/master/deploy/Chat.zip) App explores different ways AppSettings can be used: - -If there's an existing `appsettings.txt` file where the **.exe** is run it will use that, otherwise it falls back to **Web.config** appSettings: - -```csharp -public AppHost() : base("Chat", typeof (ServerEventsServices).Assembly) -{ - var customSettings = new FileInfo("appsettings.txt"); - AppSettings = customSettings.Exists - ? (IAppSettings)new TextFileSettings(customSettings.FullName) - : new AppSettings(); -} -``` - -As a normal property in your AppHost, AppSettings can be accessed directly in `AppHost.Configure()`: - -```csharp -public void Configure(Container container) -{ - ... - var redisHost = AppSettings.GetString("RedisHost"); - if (redisHost != null) - { - container.Register(c => - new RedisServerEvents(new PooledRedisClientManager(redisHost))); - - container.Resolve().Start(); - } -} -``` - -Inside your services or IOC dependencies, like any other auto-wired dependency: - -```csharp -public class ServerEventsServices : Service -{ - public IAppSettings AppSettings { get; set; } - - public void Any(PostRawToChannel request) - { - if (!IsAuthenticated && AppSettings.Get("LimitRemoteControlToAuthenticatedUsers", false)) - throw new HttpError(HttpStatusCode.Forbidden, "You must be authenticated to use remote control."); - ... - } -} -``` - -Directly within Razor views: - -```html - -``` - -As well as outside ServiceStack, via the `HostContext` static class: - -```csharp -var redisHost = HostContext.AppSettings.GetString("redis"); -``` - -### AppSettings are now writable - -A new `Set()` API was added to [IAppSettings](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Configuration/IAppSettings.cs) letting you save any serializable property that works for all providers: - -```csharp -public interface IAppSettings -{ - void Set(string key, T value); - ... -} - -AppSettings.Set("Poco", new MyConfig { Foo = "Baz" }); -``` - -In providers that support writable configuration natively like `OrmLiteAppSettings` and `DictionarySettings`, the settings get written through to the underlying provider. For read-only providers like Web.config's `AppSettings` or `TextFileSettings` a **shadowed** cache is kept that works similar to prototypal shadowing in JavaScript where if a property doesn't exist, setting a property will be stored on the top-level object instance which also takes precedence on subsequent property access. - -## [Metadata Pages](https://github.com/ServiceStack/ServiceStack/wiki/Metadata-Page) - -The metadata pages have been expanded to include some of [Swagger API Attribute annotations](https://github.com/ServiceStack/ServiceStack/wiki/Swagger-API#swagger-attributes) which now shows the parameters for the Request and Response DTO's as well as any other DTO's used in each metadata operation page: - -![Metadata Type Info](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/metadata-swagger-api.png) - -When annotated the Description also shows any **allowable Enum values** or **range limits** when provided. - -#### HtmlFormat - -The humanize feature in [Auto HtmlFormat](https://github.com/ServiceStack/ServiceStack/wiki/HTML5ReportFormat) for splitting JoinedCase words with spaces can be disabled for all pages with: - -```csharp -HtmlFormat.Humanize = false; -``` - -Or on adhoc pages by adding `#dehumanize` hash param. - -## [Authentication](https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization) - -### Web Sudo - -A common UX in some websites is to add an extra layer of protection for **super protected** functionality by getting users to re-confirm their password verifying it's still them using the website, common in places like confirming a financial transaction. - -**WebSudo** (by [@tvjames](https://github.com/tvjames)) is a new feature similar in spirit requiring users to re-authenticate when accessing Services annotated with the `[WebSudoRequired]` attribute. To make use of WebSudo, first register the plugin: - -```csharp -Plugins.Add(new WebSudoFeature()); -``` - -You can then apply WebSudo behavior to existing services by annotating them with `[WebSudoRequired]`: - -```csharp -[WebSudoRequired] -public class RequiresWebSudoService : Service -{ - public object Any(RequiresWebSudo request) - { - return request; - } -} -``` - -Once enabled this will throw a **402 Web Sudo Required** HTTP Error the first time the service is called: - -```csharp -var requiresWebSudo = new RequiresWebSudo { Name = "test" }; -try -{ - client.Send(requiresWebSudo); //throws -} -catch (WebServiceException) -{ - client.Send(authRequest); //re-authenticate - var response = client.Send(requiresWebSudo); //success! -} -``` - -Re-authenticating afterwards will allow access to the WebSudo service. - -### Auth Events - -In order to enable functionality like **WebSudo** we've added additional hooks into the Authentication process with `IAuthEvents`: - -```csharp -public interface IAuthEvents -{ - void OnRegistered(IRequest httpReq, IAuthSession session, IServiceBase registrationService); - - void OnAuthenticated(IRequest httpReq, IAuthSession session, IServiceBase authService, - IAuthTokens tokens, Dictionary authInfo); - - void OnLogout(IRequest httpReq, IAuthSession session, IServiceBase authService); - - void OnCreated(IRequest httpReq, IAuthSession session); -} -``` - -These are the same authentication hooks that were previously only available when creating a **Custom UserSession** by inheriting [AuthUserSession](https://github.com/ServiceStack/ServiceStack/wiki/Sessions#session-events). The new AuthEvents API provide a loose-typed way where plugins can tap into the same hooks by registering it with `AuthFeature.AuthEvents`, e.g: - -```csharp -public class WebSudoFeature : IPlugin, IAuthEvents -{ - public void Register(IAppHost appHost) - { - ... - var authFeature = appHost.GetPlugin(); - authFeature.AuthEvents.Add(this); - } - - // Add implementations on `IAuthEvents` handlers - public void OnCreated(IRequest httpReq, IAuthSession session) - { - ... - } - ... -} -``` - -An alternative way for accessing `IAuthEvents` is to register it like a normal dependency, e.g: - -```csharp -container.RegisterAs(); -``` - -To simplify custom implementations you can inherit from the empty concrete [AuthEvents](https://github.com/ServiceStack/ServiceStack/blob/7eb3a34a2e545a54c2591665328c16c5d398d37a/src/ServiceStack/Auth/AuthEvents.cs#L18-L25) and choose to only implement the callbacks you're interested in, e.g: - -```csharp -public class LogAuthEvents : AuthEvents -{ - public static ILog Log = LogManager.GetLogger(typeof(LogAuthEvents)); - - public override void OnLogout(IRequest httpReq, IAuthSession session, IServiceBase authService) - { - Log.DebugFormat("User #{0} {1} has logged out", session.UserAuthId, session.UserName); - } -} -``` - -## OrmLite - - - Added new `db.ColumnLazy` API for lazily fetching a column of data - - Added `db.TableExists` for a typed API to detect whether a table exists - - Added `INamingStrategy.GetSequenceName()` to [override how sequence names in Oracle are generated](http://stackoverflow.com/a/25611452/85785) - - Upgraded PostgreSql Provider to **Npgsql 2.2.0** and Sqlite to **Sqlite.Core 1.0.93.0** - -## Text - - - Added `JsConfig.ParsePrimitiveIntegerTypes` and `JsConfig.ParsePrimitiveFloatingPointTypes` to [change preferences on what primitive numeric types should be converted to](https://github.com/ServiceStack/ServiceStack.Text/pull/428). - - Added `JsConfig.IgnoreAttributesNamed` to [change what attributes are used to ignore properties](https://github.com/ServiceStack/ServiceStack.Text/commit/3b9972fbd61ce000f9af72d74d79b30eb0d2f45b) - - Added [string.CountOccurancesOf() extension method](https://github.com/ServiceStack/ServiceStack.Text/commit/d41d7fb879d68e5a4ccb529e3cc6ed7d3ce937a2) - - Added [Image MimeTypes](https://github.com/ServiceStack/ServiceStack.Text/commit/b07cf033d7b4735b0249850769b119be0c857b9d) - -## Community - -## [ServiceStack MiniProfiler Toolkit](https://bitbucket.org/migajek/miniprofilingtoolkit) - -From the wider ServiceStack Community, [Michał Gajek](https://plus.google.com/u/0/+Micha%C5%82Gajek/auto) has developed an alternative analyzer of ServiceStack's MiniProfiler results in a comprehensive UI that allows deep introspection of your running Services. From the Project's description: - -### Description - -This project intends to provide tools for collecting & analyzing profiling results of ServiceStack-based apps. -Not only this makes profiling possible in the scenario when no built-in web-frontend is available (like Single Page Applications), but also has several advantages over it: - - - collects & persists the results - - allows the "background" profiling (example: production environment) - - it's better to analyze large amounts of collected profiling results, not just focusing on single execution timings - - helps finding time-consuming queries - -### Screenshots - -![](http://i.imgur.com/Ybpx4xg.png) - -![](http://i.imgur.com/BA4Mc68.png) - -![](http://i.imgur.com/US4Gk6s.png) - -![](http://i.imgur.com/bILdbQc.png) - - -### Install - -``` -PM> Install-Package Migajek.MiniProfiling.ServiceStack.RemoteStorage -``` - -### Register the Plugin: - -```csharp -Plugins.Add(new Migajek.Profiling.ServiceStackProfiler.MiniProfilingToolkit("http://url/", "ProjectName")); -``` - -# v4.0.30 Release Notes - -## [Add ServiceStack Reference](https://github.com/ServiceStack/ServiceStack/wiki/Add-ServiceStack-Reference) - -We have an exciting feature in this release showcasing our initial support for generating Native Types from client VS.NET projects using [ServiceStackVS](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project#step-1-download-and-install-servicestackvs) new **Add ServiceStack Reference** feature. It provides a simpler, cleaner and more versatile alternative to WCF's **Add Service Reference** in VS.NET. - -Our goal with Native Types is to provide an alternative for sharing DTO dlls, that can enable a better dev workflow for external clients who are now able to generate (and update) Typed APIs for your Services from a remote url - reducing the burden and effort required to consume ServiceStack Services whilst benefiting from clients native language strong-typing feedback. - -This is just the beginning, whilst C# is the first language supported it lays the groundwork and signals our approach on adding support for typed API's in other languages in future. Add a [feature request for your favorite language](http://servicestack.uservoice.com/forums/176786-feature-requests) to prioritize support for it sooner! - -### Example Usage - -The easiest way to Add a ServiceStack reference to your project is to right-click on your project to bring up [ServiceStackVS's](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project) `Add ServiceStack Reference` context-menu item. This opens a dialog where you can add the url of the ServiceStack instance you want to typed DTO's for, as well as the name of the T4 template that's added to your project. - -![Add ServiceStack Reference](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/apps/StackApis/add-service-ref-flow.png) - -After clicking OK, the servers DTO's and [ServiceStack.Client](https://www.nuget.org/packages/ServiceStack.Client) NuGet package are added to the project, providing an instant typed API: - -![Calling ServiceStack Service](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/apps/StackApis/call-service.png) - -### Consuming Services from Mobile Clients now Easier than Ever! - -In addition with our improved PCL Support in this release, it's never been easier to create an instant Typed API for a remote Service consumable from any Xamarin.Android, Xamarin.iOS, Silverlgiht 5, Windows Store or .full NET4.0+ platforms - Here's a quick demo of it working in Android: - -![Android Add ServiceStack Reference](https://raw.githubusercontent.com/ServiceStack/ServiceStackVS/master/Images/android-add-ref-demo.gif) - -### Advantages over WCF - - - **Simple** Uses a small T4 template to save generated POCO Types. Updating as easy as re-running T4 template - - **Versatile** Clean DTOs works in all JSON, XML, JSV, MsgPack and ProtoBuf [generic service clients](https://github.com/ServiceStack/ServiceStack/wiki/C%23-client#built-in-clients) - - **Reusable** Generated DTO's are not coupled to any endpoint or format. Defaults are both partial and virtual for maximum re-use - - **Resilient** Messaging-based services offer a number of [advantages over RPC Services](https://github.com/ServiceStack/ServiceStack/wiki/Advantages-of-message-based-web-services) - - **Flexible** DTO generation is customizable, Server and Clients can override built-in defaults - - **Integrated** Rich Service metadata annotated on DTO's, [Internal Services](https://github.com/ServiceStack/ServiceStack/wiki/Restricting-Services) are excluded when accessed externally - -### Available from v4.0.30+ ServiceStack Projects - -Native Types is now available by default on all **v4.0.30+** ServiceStack projects. It can be disabled by removing the `NativeTypesFeature` plugin with: - -```csharp -Plugins.RemoveAll(x => x is NativeTypesFeature); -``` - -For detailed info on how NativeTypesFeature works, its different customization options and improvements over WCF, checkout the [Add ServiceStack Reference](https://github.com/ServiceStack/ServiceStack/wiki/Add-ServiceStack-Reference) docs. - -### [Upgrade ServiceStackVS](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project) - -To take advantage of this feature [Upgrade or Install ServiceStackVS](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project) VS.NET Extension. If you already have **ServiceStackVS** installed, uninstall it first from `Tools -> Extensions and Updates... -> ServiceStackVS -> Uninstall`. - -## Improved PCL Story - -Our [PCL Story](https://github.com/ServiceStackApps/HelloMobile) has been greatly improved in this release now that `ServiceStack.Interfaces` has been converted into a pure PCL dll. This now lets you maintain your server DTO's in a pure PCL DLL that can be shared as-is on most supported platforms (Profile136): - - - Xamarin.iOS - - Xamarin.Android - - Windows Store - - WPF app using .NET 4.0 PCL support - - Silverlight 5 - -Whilst our impl-free `ServiceStack.Interfaces.dll` was able to be converted into a pure PCL dll, our Client libraries have instead resorted to using [PCL's Bait and Switch technique](http://log.paulbetts.org/the-bait-and-switch-pcl-trick/) to provide platform-specific extensions and optimizations. The one outlier is Silverlight5 which remains a custom (non-PCL) SL5 build, that whilst can now share DTO's, still can't support projects with dependencies on the PCL-compatible version of **ServiceStack.Client**. - -As of this release all PCL, platform and Silverlight dlls are now merged into the main [ServiceStack.Client](https://www.nuget.org/packages/ServiceStack.Client) NuGet packages so now any clients need only reference the main Client NuGet package: - -``` -Install-Package ServiceStack.Client -``` - -The [Hello PCL](https://github.com/ServiceStackApps/HelloMobile) project now contains examples of reusing a Server DTO project with all supported client platforms as well as showing re-use of a high-level `SharedGateway` which referenes `ServiceStack.Client` that's shared between all PCL-compatible platforms. - -### New ServiceStack + AngularJS Example - [StackApis](http://stackapis.servicestack.net) - -[![StackApis Home](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/apps/StackApis/stackapis-home.png)](http://stackapis.servicestack.net/) - -[StackApis](http://stackapis.servicestack.net/) is a simple new ServiceStack + AngularJS example project created with [ServiceStackVS AngularJS Template](https://github.com/ServiceStack/ServiceStackVS#servicestackvs) showcasing how quick and easy it is to create responsive feature-rich Single Page Apps with AngularJS and [AutoQuery](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query). StackApis is powered by a Sqlite database containing [snapshot of ServiceStack questions from StackOverflow APIs](https://github.com/ServiceStackApps/StackApis/blob/master/src/StackApis.Tests/UnitTests.cs#L67) that's [persisted in an sqlite database](https://github.com/ServiceStackApps/StackApis/blob/master/src/StackApis.Tests/UnitTests.cs#L119-L124) using [OrmLite](https://github.com/ServiceStack/ServiceStack.OrmLite/). - -### StackApis AutoQuery Service - -The [Home Page](https://github.com/ServiceStackApps/StackApis/blob/master/src/StackApis/default.cshtml) is built with less than **<50 Lines** of JavaScript which thanks to [AutoQuery](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query) routes all requests to the single AutoQuery Service below: - -```csharp -[Route("/questions")] -public class StackOverflowQuery : QueryBase -{ - public int? ScoreGreaterThan { get; set; } -} -``` - -> Not even `ScoreGreaterThan` is a required property, it's just an example of a [formalized convention](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query#advantages-of-well-defined-service-contracts) enabling queries from Typed Service Clients. - -Feel free to play around with a deployed version of StackApis at [stackapis.servicestack.net](http://stackapis.servicestack.net/). - -You can also use the public `http://stackapis.servicestack.net/` url to test out ServiceStack's new **Add ServiceStack Reference** feature :) - -## [Swagger Support](https://github.com/ServiceStack/ServiceStack/wiki/Swagger-API) - -### All static resources are now embedded - -ServiceStack's [Swagger Support](https://github.com/ServiceStack/ServiceStack/wiki/Swagger-API) received some welcomed enhancements thanks to [@tvjames](https://github.com/tvjames) and [@tyst](https://github.com/tyst)'s efforts which now sees all of Swagger's static resources embedded into a single `ServiceStack.Api.Swagger.dll`, taking advantage of the Virtual File Systems [transparent support for Embedded Resources](https://github.com/ServiceStack/ServiceStack.Gap#creating-an-embedded-servicestack-app), making it easier to manage and upgrade Swagger as a self-contained unit. - -### New Bootstrap theme for Swagger - -A new attractive Bootstrap Theme was also added to Swagger, available from [/swagger-ui-bootstrap/](http://stackapis.servicestack.net/swagger-ui-bootstrap/): - -[![Swagger Bootstrap](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/apps/StackApis/stackapis-swagger-bootstrap.png)](http://stackapis.servicestack.net/swagger-ui-bootstrap/) - -You can change the [metadata page plugin link](https://github.com/ServiceStack/ServiceStack/wiki/Metadata-page#adding-links-to-metadata-page) to point to this new theme with: - -```csharp -Plugins.Add(new SwaggerFeature { - UseBootstrapTheme = true, - LogoUrl = "your-logo.png" //optional use your own logo -}); -``` - -Swagger was also been updated to the latest version. - -## Authentication - -### Unique Emails - -ServiceStack now verifies emails returned by OAuth providers are now unique where if there's already another UserAuth with an existing email, authentication will fail and redirect (for HTML/Web Browser requests) with the Error token: - - /#f=EmailAlreadyExists - -This behavior is in-line with ServiceStack's other AuthProviders. If this change causes any issues, it can be disabled with: - -```csharp -AuthProvider.ValidateUniqueEmails = false; -``` - -> This doesn't apply to Users who login with multiple OAuth Providers as there accounts automatically get merged into a single UserAuth entity. - -### CustomValidationFilter - -A new `CustomValidationFilter` was added to all AuthProviders which can be used to return a `IHttpResult` to control what error response is returned, e.g: - -```csharp -Plugins.Add(new AuthFeature( - () => new CustomUserSession(), - new IAuthProvider[] { - new FacebookAuthProvider(appSettings) { - CustomValidationFilter = authCtx => - CustomIsValid(authCtx) - ? authCtx.Service.Redirect(authCtx.Session.ReferrerUrl - .AddHashParam("f","CustomErrorCode")) - : null, - }, - })); -``` - -## Breaking Changes - -### Upgrade all ServiceStack NuGet packages - -The primary breaking change was converting ServiceStack's core `ServiceStack.Interfaces.dll` into a pure portable class library which as it's incompatible with the previous non-PCL ServiceStack.Interfaces.dll requires that all NuGet dependenices (inc. transitive dependencies) be upgraded to **v4.0.30**. The version number was bumped to **v4.0.30** specifically to stress that it's incompatible with any ** - -Chat is another ServiceStack Single Page App Special showing how you can get a lot done with minimal effort and dependencies which delivers all these features in a tiny footprint built with vanilla jQuery and weighing just: - - - [1 default.cshtml page](https://github.com/ServiceStackApps/Chat/blob/master/src/Chat/default.cshtml) with under **170 lines of JavaScript** and **70 lines** of HTML - - [2 ServiceStack Services](https://github.com/ServiceStackApps/Chat/blob/master/src/Chat/Global.asax.cs) entire backend in 1 `.cs` file - - 1 ASP.NET Web Application project requiring only a sane **9 .NET dll** references - -### Remote control - -Chat features the ability to remotely control other users chat window with the client bindings in `/js/ss-utils.js`, providing a number of different ways to interact and modify a live webapp by either: - - - Invoking Global Event Handlers - - Modifying CSS via jQuery - - Sending messages to Receivers - - Raising jQuery Events - -All options above are designed to integrate with an apps existing functionality by providing the ability to invoke predefined handlers and exported object instances as well as modify jQuery CSS and raising DOM events. - -The [complete documentation](https://github.com/ServiceStackApps/Chat) in Chat is the recommended way to learn more about Server Events which goes through and explains how to use its Server and Client features. - -## [ServiceStackVS](https://github.com/ServiceStack/ServiceStackVS) - ServiceStack's VS.NET Extension - -Another exciting announcement is the initial release of [ServiceStackVS](https://github.com/ServiceStack/ServiceStackVS) - our VS.NET ServiceStack Extension containing the most popular starting templates for ServiceStack powered solutions: - -![Visual Studio Templates](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/servicestackvs/vs-templates.png) - -Each project template supports our [recommended multi-project structure](https://github.com/ServiceStack/ServiceStack/wiki/Physical-project-structure) promoting a clean architecture and Web Services best-practices, previously [documented in Email Contacts](https://github.com/ServiceStack/EmailContacts/#creating-emailcontacts-solution-from-scratch). - -This is now the fastest way to get up and running with ServiceStack. With these new templates you can now create a new ServiceStack Razor, AngularJS and Bootstrap enabled WebApp, pre-wired end-to-end in seconds: - -![AngularJS WalkThrough](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/servicestackvs/angularjs-overview.gif) - - - -### Get the [Learning AngularJS for .NET Developers](http://www.packtpub.com/learning-angularjs-for-net-developers/book) Book! - -On ServiceStack and AngularJS front, we also have great content coming from the ServiceStack community as -**[Learning AngularJS for .NET Developers](http://www.packtpub.com/learning-angularjs-for-net-developers/book)**, -a new book by [Alex Pop](https://twitter.com/AlexandruVPop) has just been made available. - -More details about the book as well as downloadable code-samples is available on -[Alex's announcement blog post](http://alexvpop.blogspot.co.uk/2014/06/announcing-learning-angularjs-dotnet.html). - -### Download ServiceStackVS - -ServiceStackVS supports both VS.NET 2013 and 2012 and can be [downloaded from the Visual Studio Gallery](http://visualstudiogallery.msdn.microsoft.com/5bd40817-0986-444d-a77d-482e43a48da7) - -[![VS.NET Gallery Download](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/servicestackvs/vsgallery-download.png)](http://visualstudiogallery.msdn.microsoft.com/5bd40817-0986-444d-a77d-482e43a48da7) - -### VS.NET 2012 Prerequisites - - - VS.NET 2012 Users must install the [Microsoft Visual Studio Shell Redistributable](http://www.microsoft.com/en-au/download/details.aspx?id=40764) - - It's also highly recommended to [Update to the latest NuGet](http://docs.nuget.org/docs/start-here/installing-nuget). - -> Alternatively if continuing to use an older version of the **NuGet Package Manager** you will need to click on **Enable NuGet Package Restore** after creating a new project to ensure its NuGet dependencies are installed. - -### Feedback - -We hope **ServiceStackVS** helps make ServiceStack developers more productive than ever and we'll look at continue improving it with new features in future. [Suggestions and feedback are welcome](http://servicestack.uservoice.com/forums/176786-feature-requests). - -## [Authentication](https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization) - -### Saving User Profile Images - -To make it easier to build Social Apps like [Chat](https://github.com/ServiceStackApps/Chat) with ServiceStack we've started saving profile image urls (aka avatars) for the following popular OAuth providers: - - - Twitter - - Facebook - - GitHub - - Google OAuth2 - - LinkedIn OAuth2 - -The users profile url can be accessed in your services using the `IAuthSession.GetProfileUrl()` extension method which goes through the new `IAuthMetadataProvider` which by default looks in `UserAuthDetails.Items["profileUrl"]`. - -### New IAuthMetadataProvider - -A new [IAuthMetadataProvider](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/Auth/AuthMetadataProvider.cs) has been added that provides a way to customize the `authInfo` in all AuthProviders. It also allows overriding of how extended Auth metadata like `profileUrl` is returned. - -```csharp -public interface IAuthMetadataProvider -{ - void AddMetadata(IAuthTokens tokens, Dictionary authInfo); - - string GetProfileUrl(IAuthSession authSession, string defaultUrl = null); -} -``` - -> To override with a custom implementation, register `IAuthMetadataProvider` in the IOC - -### Saving OAuth Metadata - - -The new `SaveExtendedUserInfo` property (enabled by default) on all OAuth providers let you control whether to save the extended OAuth metadata available (into `UserAuthDetails.Items`) when logging in via OAuth. - -## [OrmLite](https://github.com/ServiceStack/ServiceStack.OrmLite/) - -### Loading of References in Multi-Select Queries - -Previous support of pre-loading of references were limited to a single entity using `LoadSingleById` to automatically fetch all child references, e.g: - -```csharp -public class Customer -{ - [AutoIncrement] - public int Id { get; set; } - public string Name { get; set; } - - [Reference] // Save in CustomerAddress table - public CustomerAddress PrimaryAddress { get; set; } - - [Reference] // Save in Order table - public List Orders { get; set; } -} - -var customer = db.LoadSingleById(request.Id); -customer.PrimaryAddress // Loads 1:1 CustomerAddress record -customer.Orders // Loads 1:M Order records -``` - -We've now also added support for pre-loading of references for multiple resultsets as well with `LoadSelect` which loads references for all results, e.g: - -```csharp -var customers = db.LoadSelect(q => q.Name.StartsWith("A")); -``` - -This is implemented efficiently behind the scenes where only 1 additional SQL Query is performed for each defined reference. - -> As a design goal none of OrmLite Query API's perform N+1 queries. - -### Self References - -We've extended OrmLite [References support](https://github.com/ServiceStack/ServiceStack.OrmLite/#reference-support-poco-style) to support Self References for **1:1** relations where the foreign key property can be on the parent table, e.g: - -```csharp -public class Customer -{ - ... - public int CustomerAddressId { get; set; } - - [Reference] - public CustomerAddress PrimaryAddress { get; set; } -} -``` - -Which maintains the same relationship as having the Foreign Key column on the child table instead, i,e: - -```csharp -public class CustomerAddress -{ - public int CustomerId { get; set; } -} -``` - -### Support Foreign Key Attributes to specify Reference Fields - -Previously definitions of references relied on [Reference Conventions](https://github.com/ServiceStack/ServiceStack.OrmLite/#reference-conventions) using either the C# Property Name or Property Aliases. You can now also use the [References and ForeignKey attributes](https://github.com/ServiceStack/ServiceStack.OrmLite/#new-foreign-key-attribute-for-referential-actions-on-updatedeletes) to specify Reference Properties, e.g: - -```csharp -public class Customer -{ - [Reference(typeof(CustomerAddress))] - public int PrimaryAddressId { get; set; } - - [Reference] - public CustomerAddress PrimaryAddress { get; set; } -} -``` - -> Reference Attributes take precedence over naming conventions - -### Support for Stored Procedures with out params - -A new `SqlProc` API was added returning an `IDbCommand` which can be used to customize the Stored Procedure call letting you add custom out parameters. The example below shows - -```csharp -string spSql = @"DROP PROCEDURE IF EXISTS spSearchLetters; - CREATE PROCEDURE spSearchLetters (IN pLetter varchar(10), OUT pTotal int) - BEGIN - SELECT COUNT(*) FROM LetterFrequency WHERE Letter = pLetter INTO pTotal; - SELECT * FROM LetterFrequency WHERE Letter = pLetter; - END"; - -db.ExecuteSql(spSql); - -var cmd = db.SqlProc("spSearchLetters", new { pLetter = "C" }); -var pTotal = cmd.AddParam("pTotal", direction: ParameterDirection.Output); - -var results = cmd.ConvertToList(); -var total = pTotal.Value; -``` - -An alternative approach is to use the new overload added to the raw SQL API `SqlList` that lets you customize the Stored Procedure using a filter, e.g: - -```csharp -IDbDataParameter pTotal = null; -var results = db.SqlList("spSearchLetters", cmd => { - cmd.CommandType = CommandType.StoredProcedure; - cmd.AddParam("pLetter", "C"); - pTotal = cmd.AddParam("pTotal", direction: ParameterDirection.Output); - }); -var total = pTotal.Value; -``` - -### Minor OrmLite Features - - - Use `OrmLiteConfig.DisableColumnGuessFallback=false` to disable fallback matching heuristics - - Added [GenericTableExpressions](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/Expression/GenericTableExpressions.cs) example showing how to extend OrmLite to support different runtime table names on a single schema type. - -## [AutoQuery](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query) - -### Support for loading References - -AutoQuery now takes advantage of OrmLite's new support for loading child references where marking your Query DTO with `[Reference]` will automatically load its related data, e.g: - -```csharp -public class Rockstar -{ - public int Id { get; set; } - public string FirstName { get; set; } - public string LastName { get; set; } - public int? Age { get; set; } - - [Reference] - public List Albums { get; set; } -} -``` - -### Improved OrderBy - -Add support for inverting sort direction of individual orderBy fields using '-' prefix e.g: - -```csharp -// ?orderBy=Rating,-ImdbId -var movies = client.Get(new SearchMovies { OrderBy = "Rating,-ImdbId" }); - -// ?orderByDesc=-Rating,ImdbId -var movies = client.Get(new SearchMovies { OrderByDesc = "-Rating,ImdbId" }); -``` - -## ServiceStack.Text - - - Added support for `OrderedDictionary` and other uncommon `IDictionary` types - - WCF-style `JsConfig.OnSerializedFn` custom hook has been added - - `JsConfig.ReuseStringBuffer` is enabled by default for faster JSON/JSV text serialization - - Properties can also be ignored with `[JsonIgnore]` attribute - -## Other Features - - - New `[Exclude(Feature.Soap)]` attribute can be used to exclude types from XSD/WSDL's - - XSD/WSDL's no longer including open generic types - - Added `$.ss.getSelection()`, `$.ss.queryString()`, `$.ss.splitOnFirst()`, `$.ss.splitOnLast()` to /ss-utils.js - - `TwitterAuthProvider` now makes authenticated v1.1 API requests to fetch user metadata - - -# v4.0.23 Release Notes - -## [AutoQuery](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query) - -The big ticket feature in this release is the new [AutoQuery](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query) feature - with our approach of enabling Queryable Data Services, that's designed to avoid [OData's anti-patterns and pitfalls](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query#why-not-odata). - - - Simple, intuitive and easy to use! - - Works with all OrmLite's [supported RDBMS providers](https://github.com/ServiceStack/ServiceStack.OrmLite/#download) - - Supports multiple table JOINs and custom responses - - Code-first, declarative programming model - - Promotes clean, intent-based self-describing API's - - Highly extensible, implementations are completely overridable - - Configurable Adhoc, Explicit and Implicit conventions - - Allows preemptive client queries - - New `GetLazy()` API in Service Clients allow transparently streaming of paged queries - - Raw SqlFilters available if required - -#### AutoQuery Services are normal ServiceStack Services - -AutoQuery also benefits from just being normal ServiceStack Services where you can re-use existing knowledge in implementing, customizing, introspecting and consuming ServiceStack services, i.e: - - - Utilizes the same customizable [Request Pipeline](https://github.com/ServiceStack/ServiceStack/wiki/Order-of-Operations) - - AutoQuery services can be mapped to any [user-defined route](https://github.com/ServiceStack/ServiceStack/wiki/Routing) - - Is available in all [registered formats](https://github.com/ServiceStack/ServiceStack/wiki/Formats) - - The [CSV Format](https://github.com/ServiceStack/ServiceStack/wiki/ServiceStack-CSV-Format) especially shines in AutoQuery who's tabular result-set are perfect for CSV - - Can be [consumed from typed Service Clients](https://github.com/ServiceStack/ServiceStack/wiki/Clients-overview) allowing an end-to-end API without code-gen in [PCL client platforms as well](https://github.com/ServiceStackApps/HelloMobile) - -### Getting Started - -AutoQuery uses your Services existing OrmLite DB registration, the example below registers an InMemory Sqlite Provider: - -```csharp -container.Register( - new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); -``` - -There are no additional dependencies, enabling AutoQuery is as easy as registering the AutoQueryFeature Plugin: - -```csharp -Plugins.Add(new AutoQueryFeature { MaxLimit = 100 }); -``` - -The configuration above limits all queries to a maximum of **100** results. - -The minimum code to expose a Query Service for the `Rockstar` table under a user-defined Route is just: - -```csharp -[Route("/rockstars")] -public class FindRockstars : QueryBase {} -``` - -With no additional code, this allows you to use any of the registered built-in conventions, e.g: - - /rockstars?Ids=1,2,3 - /rockstars?AgeOlderThan=42 - /rockstars?AgeGreaterThanOrEqualTo=42 - /rockstars?FirstNameIn=Jim,Kurt - /rockstars?FirstNameBetween=A,F - /rockstars?FirstNameStartsWith=Jim - /rockstars?LastNameEndsWith=son - /rockstars?IdAbove=1000 - -You're also able to formalize your API by adding concrete properties to your Request DTO: - -```csharp -public class QueryRockstars : QueryBase -{ - public int? AgeOlderThan { get; set; } -} -``` - -Which now lets you access AutoQuery Services from the ServiceStack's [Typed Service Clients](https://github.com/ServiceStack/ServiceStack/wiki/C%23-client): - -```csharp -client.Get(new QueryRockstars { AgeOlderThan = 42 }); -``` - -You can also take advantage of the new `GetLazy()` API to transparently stream large result-sets in managable-sized chunks: - -```csharp -var results = client.GetLazy(new QueryMovies { Ratings = new[]{"G","PG-13"}}).ToList(); -``` - -As GetLazy returns a lazy `IEnumerable` sequence it can be used within LINQ expressions: - -```csharp -var top250 = client.GetLazy(new QueryMovies { Ratings = new[]{ "G", "PG-13" } }) - .Take(250) - .ConvertTo(x => x.Title); -``` - -This is just a sampler, for a more complete guide to AutoQuery checkout the [AutoQuery wiki](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query). - -## New VistaDB OrmLite Provider! - -Also in this release is a preview release of OrmLite's new support for [VistaDB](http://www.gibraltarsoftware.com/) thanks to the efforts of [Ilya Lukyanov](https://github.com/ilyalukyanov). - -[VistaDB](http://www.gibraltarsoftware.com/) is a commercial easy-to-deploy SQL Server-compatible embedded database for .NET that provides a good alternative to Sqlite for embedded scenarios. - -To use first download and install [VistaDB](http://www.gibraltarsoftware.com/) itself, then grab OrmLite's VistaDB provider from NuGet: - - PM> Install-Package ServiceStack.OrmLite.VistaDb - -Then register the VistaDB Provider and the filename of what embedded database to use with: - -```csharp -VistaDbDialect.Provider.UseLibraryFromGac = true; - -container.Register( - new OrmLiteConnectionFactory("Data Source=db.vb5;", VistaDbDialect.Provider)); -``` - -The VistaDB provider is almost a complete OrmLite provider, the one major missing feature is OrmLite's new support for [Optimistic Concurrency](https://github.com/ServiceStack/ServiceStack.OrmLite/#optimistic-concurrency) which is missing in VistaDB which doesn't support normal Database triggers but we're still researching the most optimal way to implement this in VistaDB. - -## Improved AspNetWindowsAuthProvider - -A new `LoadUserAuthFilter` was added to allow `AspNetWindowsAuthProvider` to retrieve more detailed information about Windows Authenticated users by using the .NET's ActiveDirectory services, e.g: - -```csharp -public void LoadUserAuthInfo(AuthUserSession userSession, - IAuthTokens tokens, Dictionary authInfo) -{ - if (userSession == null) return; - using (PrincipalContext pc = new PrincipalContext(ContextType.Domain)) - { - var user = UserPrincipal.FindByIdentity(pc, userSession.UserAuthName); - tokens.DisplayName = user.DisplayName; - tokens.Email = user.EmailAddress; - tokens.FirstName = user.GivenName; - tokens.LastName = user.Surname; - tokens.FullName = (String.IsNullOrWhiteSpace(user.MiddleName)) - ? "{0} {1}".Fmt(user.GivenName, user.Surname) - : "{0} {1} {2}".Fmt(user.GivenName, user.MiddleName, user.Surname); - tokens.PhoneNumber = user.VoiceTelephoneNumber; - } -} -``` - -Then to use the above custom filter register it in AspNetWindowsAuthProvider with: - -```csharp -Plugins.Add(new AuthFeature( - () => new CustomUserSession(), - new IAuthProvider[] { - new AspNetWindowsAuthProvider(this) { - LoadUserAuthFilter = LoadUserAuthInfo - } - )); -``` - -Above example kindly provided by [Kevin Howard](https://github.com/KevinHoward). - -## Other features - - - [OrmLite's T4 Templates](https://github.com/ServiceStack/ServiceStack.OrmLite/#t4-template-support) were improved by [Darren Reid](https://github.com/Layoric) - - ApiVersion added to Swaggers ResourcesResponse DTO - - `Uri` in RedisClient allows passwords - -# v4.0.22 Release Notes - -## OrmLite - -This was primarily an OrmLite-focused release with the introduction of major new features: - -### Typed SQL Expressions now support Joins! - -Another [highly requested feature](http://servicestack.uservoice.com/forums/176786-feature-requests/suggestions/4459040-enhance-ormlite-with-common-data-usage-patterns) has been realized in this release with OrmLite's typed SqlExpressions extended to add support for Joins. - -The new JOIN support follows OrmLite's traditional approach of a providing a DRY, typed RDBMS-agnostic wrapper that retains a high affinity with SQL, providing an intuitive API that generates predictable SQL and a light-weight mapping to clean POCO's. - -### Basic Example - -Starting with the most basic example you can simply specify the table you want to join with: - -```csharp -var dbCustomers = db.Select(q => q.Join()); -``` - -This query rougly maps to the following SQL: - -```sql -SELECT Customer.* - FROM Customer - INNER JOIN - CustomerAddress ON (Customer.Id == CustomerAddress.Id) -``` - -Just like before `q` is an instance of `SqlExpression` which is bounded to the base `Customer` type (and what any subsequent implicit API's apply to). - -To better illustrate the above query, lets expand it to the equivalent explicit query: - -```csharp -SqlExpression q = db.From(); -q.Join(); - -List dbCustomers = db.Select(q); -``` - -### Reference Conventions - -The above query joins together the `Customer` and `CustomerAddress` POCO's using the same relationship convention used in [OrmLite's support for References](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/LoadReferencesTests.cs), i.e. using the referenced table `{ParentType}Id` property convention. - -An example of what this looks like can be seen the POCO's below: - -```csharp -class Customer { - public Id { get; set; } - ... -} -class CustomerAddress { - public Id { get; set; } - public CustomerId { get; set; } // Reference based on Property name convention -} -``` - -References based on matching alias names is also supported, e.g: - -```csharp -[Alias("LegacyCustomer")] -class Customer { - public Id { get; set; } - ... -} -class CustomerAddress { - public Id { get; set; } - - [Alias("LegacyCustomerId")] // Matches `LegacyCustomer` Alias - public RenamedCustomerId { get; set; } // Reference based on Alias Convention -} -``` - -Either convention lets you save a POCO and all its entity references with `db.Save()`, e.g: - -```csharp -var customer = new Customer { - Name = "Customer 1", - PrimaryAddress = new CustomerAddress { - AddressLine1 = "1 Australia Street", - Country = "Australia" - }, -}; -db.Save(customer, references:true); -``` - -Going back to the above example: - -```csharp -q.Join(); -``` - -Uses the implicit join in the above reference convention to expand into the equivalent explicit API: - -```csharp -q.Join((customer,address) => customer.Id == address.CustomerId); -``` - -### Selecting multiple columns across joined tables - -Another behaviour implicit when selecting from a typed SqlExpression is that results are mapped to the `Customer` POCO. To change this default we just need to explicitly specify what POCO it should map to instead: - -```csharp -List customers = db.Select( - db.From().Join()); -``` - -Where `FullCustomerInfo` is any POCO that contains a combination of properties matching any of the joined tables in the query. - -The above example is also equivalent to the shorthand `db.Select()` API: - -```csharp -var customers = db.Select(q => q.Join()); -``` - -Rules for how results are mapped is simply each property on `FullCustomerInfo` is mapped to the first matching property in any of the tables in the order they were added to the SqlExpression. - -As most OrmLite tables have a primary key property named `Id`, the auto-mapping includes a fallback for mapping to a full namespaced Id property in the same `{Type}Id` format. This allows you to auto-populate `CustomerId`, `CustomerAddressId` and `OrderId` columns even though they aren't a match to any of the fields in any of the joined tables. - -### Advanced Example - -Seeing how the SqlExpression is constructed, joined and mapped, we can take a look at a more advanced example to showcase more of the new API's available: - -```csharp -List rows = db.Select( // Map results to FullCustomerInfo POCO - db.From() // Create typed Customer SqlExpression - .LeftJoin() // Implict left join with base table - .Join((c,o) => c.Id == o.CustomerId) // Explicit join and condition - .Where(c => c.Name == "Customer 1") // Implicit condition on base table - .And(o => o.Cost < 2) // Explicit condition on joined Table - .Or((c,o) => c.Name == o.LineItem)); // Explicit condition with joined Tables -``` - -The comments next to each line document each Type of API used. Some of the new API's introduced in this example include: - - - Usage of `LeftJoin` for LEFT JOIN'S, `RightJoin` and `FullJoin` also available - - Usage of `And()`, to specify a condition on a Joined table - - Usage of `Or`, to specify a condition against 2 joined tables - -More code examples of References and Joined tables are available in: - - - [LoadReferencesTests.cs](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/LoadReferencesTests.cs) - - [LoadReferencesJoinTests.cs](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/LoadReferencesJoinTests.cs) - -## Optimistic Concurrency - -Another major feature added to OrmLite is support for optimistic concurrency which can be added to any table by adding a `ulong RowVersion { get; set; }` property, e.g: - -```csharp -public class Poco -{ - ... - public ulong RowVersion { get; set; } -} -``` - -RowVersion is implemented efficiently in all major RDBMS's, i.e: - - - Uses `rowversion` datatype in SqlServer - - Uses PostgreSql's `xmin` system column (no column on table required) - - Uses UPDATE triggers on MySql, Sqlite and Oracle whose lifetime is attached to Create/Drop tables APIs - -Despite their differing implementations each provider works the same way where the `RowVersion` property is populated when the record is selected and only updates the record if the RowVersion matches with what's in the database, e.g: - -```csharp -var rowId = db.Insert(new Poco { Text = "Text" }, selectIdentity:true); - -var row = db.SingleById(rowId); -row.Text += " Updated"; -db.Update(row); //success! - -row.Text += "Attempting to update stale record"; - -//Can't update stale record -Assert.Throws(() => - db.Update(row)); - -//Can update latest version -var updatedRow = db.SingleById(rowId); // fresh version -updatedRow.Text += "Update Success!"; -db.Update(updatedRow); - -updatedRow = db.SingleById(rowId); -db.Delete(updatedRow); // can delete fresh version -``` - -Optimistic concurrency is only verified on API's that update or delete an entire entity, i.e. it's not enforced in partial updates. There's also an Alternative API available for DELETE's: - -```csharp -db.DeleteById(id:updatedRow.Id, rowversion:updatedRow.RowVersion) -``` - -### Other OrmLite features - - - New [Limit API's added to JoinSqlBuilder](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/Expression/SqlExpressionTests.cs#L126-L168) - - SqlExpression's are now tied to the dialect provider at time of creation - -## ServiceStack.Text - -A new `JsConfig.ReuseStringBuffer` performance config option is available to JSON and JSV Text Serializers which lets you re-use ThreadStatic StringBuilder when serializing to a string. In initial benchmarks (both synchronous and parallel) it shows around a **~%30 increase in performance** for small POCO's. It can be enabled with: - -```csharp -JsConfig.ReuseStringBuffer = true; -``` - -Default enum values can be excluded from being serialized with: - -```csharp -JsConfig.IncludeDefaultEnums = false; -``` - -## ServiceStack - -### [Messaging](https://github.com/ServiceStack/ServiceStack/wiki/Messaging) - -Improved support for the MQ Request/Reply pattern with the new `GetTempQueueName()` API now available in all MQ Clients which returns a temporary queue (prefixed with `mq:tmp:`) suitable for use as the ReplyTo queue in Request/Reply scenarios: - -```csharp -mqServer.RegisterHandler(m => - new HelloResponse { Result = "Hello, {0}!".Fmt(m.GetBody().Name) }); -mqServer.Start(); - -using (var mqClient = mqServer.CreateMessageQueueClient()) -{ - var replyToMq = mqClient.GetTempQueueName(); - mqClient.Publish(new Message(new Hello { Name = "World" }) { - ReplyTo = replyToMq - }); - - IMessage responseMsg = mqClient.Get(replyToMq); - mqClient.Ack(responseMsg); - var responseDto = responseMsg.GetBody(); -} -``` - -On [Rabbit MQ](https://github.com/ServiceStack/ServiceStack/wiki/Rabbit-MQ) it creates an exclusive non-durable queue. - -In [Redis MQ](https://github.com/ServiceStack/ServiceStack/wiki/Messaging-and-Redis) there's a new `RedisMqServer.ExpireTemporaryQueues()` API which can be used on StartUp to expire temporary queues after a given period. - -Synchronous and Parallel tests for this feature is available in [MqRequestReplyTests.cs](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.Server.Tests/Messaging/MqRequestReplyTests.cs). - -## New NuGet packages - - - [ServiceStack.Authentication.LightSpeed](https://www.nuget.org/packages/ServiceStack.Authentication.LightSpeed/) is a new User Auth Repository created by [Herdy Handoko](https://plus.google.com/u/0/+HerdyHandoko/posts) providing a new persistence option for User Authentication backed by [Mindscape's LightSpeed ORM](http://www.mindscapehq.com/products/lightspeed). Checkout the [GitHub Project](https://github.com/hhandoko/ServiceStack.Authentication.LightSpeed) for more info. - -### Other Framework Features - - - Added support for locking users in all AuthProviders by populating `UserAuth.LockedDate`, effective from next login attempt - - Reduced dependencies on all Logging providers, now only depends on `ServiceStack.Interfaces` - - ContentLength is written where possible allowing [Async Progress callbacks on new payloads](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncProgressTests.cs) - - Non authenticated requests to `/auth` throw a 401 (otherwise returns basic session info) - - Metadata filter now supports IE8/IE9 - - `CopyTo` and `WriteTo` Stream extensions now return bytes transferred - -# v4.0.21 Release Notes - -## Authentication - -### Windows Auth Provider for ASP.NET - -An ASP.NET WindowsAuth Provider preview is available. This essentially wraps the existing Windows Auth support baked into ASP.NET and adds an adapter for [ServiceStack's Multi-Provider Authentication model](https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization). - -It can be registered just like any other Auth Provider, i.e. in the AuthFeature plugin: - -```csharp -Plugins.Add(new AuthFeature( - () => new CustomUserSession(), - new IAuthProvider[] { - new AspNetWindowsAuthProvider(this) { AllowAllWindowsAuthUsers = true }, - } -)); -``` - -By default it only allows access to users in `AspNetWindowsAuthProvider.LimitAccessToRoles`, but can be overridden with `AllowAllWindowsAuthUsers=true` to allow access to all Windows Auth users as seen in the example above. - -Credentials can be attached to ServiceStack's Service Clients the same way [as .NET WebRequest's](http://stackoverflow.com/a/3563033/85785) by assingning the `Credentials` property, e.g: - -```csharp -var client = new JsonServiceClient(BaseUri) { - Credentials = CredentialCache.DefaultCredentials, -}; - -var response = client.Get(new RequiresAuth { Name = "Haz Access!" }); -``` - -To help with debugging, [?debug=requestinfo](https://github.com/ServiceStack/ServiceStack/wiki/Debugging#request-info) has been extended to include the Request's current Logon User info: - -![WindowsAuth DebugInfo](https://github.com/ServiceStack/Assets/raw/master/img/release-notes/debuginfo-windowsauth.png) - -> We're interested in hearing future use-cases this can support, feedback on this and future integration with Windows Auth are welcomed on [the Active Directory Integration feature request](http://servicestack.uservoice.com/forums/176786-feature-requests/suggestions/4725924-built-in-active-directory-authentication-suport). - -### New GitHub and other OAuth Providers available - -Thanks to [Rouslan Grabar](https://github.com/iamruss) we now have a number of new OAuth providers built into ServiceStack, including authentication with GitHub, Russia's most popular search engine [Yandex](http://www.yandex.ru/) and Europe's largest Social Networks after Facebook, [VK](http://vk.com) and [Odnoklassniki](http://odnoklassniki.ru/): - -```csharp -Plugins.Add(new AuthFeature( - () => new CustomUserSession(), - new IAuthProvider[] { - new GithubAuthProvider(appSettings), - new YandexAuthProvider(appSettings), - new VkAuthProvider(appSettings), - new OdnoklassnikiAuthProvider(appSettings), - } -)); -``` - -### Extended Auth DTO's - -You can now test whether a user is authenticated by calling the Auth Service without any parameters, e.g. `/auth` which will return summary auth info of the currently authenticated user or a `401` if the user is not authenticated. A `DisplayName` property was added to `AuthenticateResponse` to return a friendly name of the currently authenticated user. - -## [Portable ServiceStack](https://github.com/ServiceStack/ServiceStack.Gap) - -A new [ServiceStack.Gap](https://github.com/ServiceStack/ServiceStack.Gap) Repository and NuGet package was added to help with creating ServiceStack-powered Desktop applications. - -ServiceStack has a number of features that's particularly well-suited for these kind of apps: - - - It allows your services to be self-hosted using .NET's HTTP Listener - - It supports pre-compiled Razor Views - - It supports Embedded resources - - It supports an embedded database in Sqlite and OrmLite - - It can be ILMerged into a single .exe - -Combined together this allows you to encapsulate your ServiceStack application into a single cross-platform .exe that can run on Windows or OSX. - -To illustrate the potential of embedded ServiceStack solutions, a portable version [httpbenchmarks.servicestack.net](https://httpbenchmarks.servicestack.net) was created targetting a number of platforms below: - -> **[BenchmarksAnalyzer.zip](https://github.com/ServiceStack/ServiceStack.Gap/raw/master/deploy/BenchmarksAnalyzer.zip)** - Single .exe that opens the BenchmarksAnalyzer app in the users browser - -[![Partial Console Screenshot](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/gap/partial-exe.png)](https://github.com/ServiceStack/ServiceStack.Gap/raw/master/deploy/BenchmarksAnalyzer.zip) - -> **[BenchmarksAnalyzer.Mac.zip](https://github.com/ServiceStack/ServiceStack.Gap/raw/master/deploy/BenchmarksAnalyzer.Mac.zip)** - Self-hosted app running inside a OSX Cocoa App Web Browser - -[![Partial OSX Screenshot](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/gap/partial-osx.png)](https://github.com/ServiceStack/ServiceStack.Gap/raw/master/deploy/BenchmarksAnalyzer.Mac.zip) - -> **[BenchmarksAnalyzer.Windows.zip](https://github.com/ServiceStack/ServiceStack.Gap/raw/master/deploy/BenchmarksAnalyzer.Windows.zip)** - Self-hosted app running inside a Native WinForms app inside [CEF](https://code.google.com/p/chromiumembedded/) - -[![Partial Windows Screenshot](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/gap/partial-win.png)](https://github.com/ServiceStack/ServiceStack.Gap/raw/master/deploy/BenchmarksAnalyzer.Windows.zip) - -### Usage - -By default `BenchmarksAnalyzer.exe` will scan the directory where it's run from, it also supports being called with the path to `.txt` or `.zip` files to view or even a directory where output files are located. Given this there are a few popular ways to use Benchmarks Analyzer: - - - Drop `BenchmarksAnalyzer.exe` into a directory of benchmark outputs before running it - - Drop a `.zip` or folder onto the `BenchmarksAnalyzer.exe` to view those results - -> Note: It can also be specified as a command-line argument, e.g: "BenchmarksAnalyzer.exe path\to\outputs" - -![Benchmarks Analyzer Usage](https://github.com/ServiceStack/Assets/raw/master/img/gap/benchmarksanalyzer-usage.gif) - -### ServiceStack.Gap Developer Guide - -The guides on how each application was created is on [ServiceStack.Gap](https://github.com/ServiceStack/ServiceStack.Gap) site, i.e: - - - [Self-Hosting Console App](https://github.com/ServiceStack/ServiceStack.Gap#self-hosting-console-app) - - [Windows Forms App with Chromium Embedded Framework and CefSharp](https://github.com/ServiceStack/ServiceStack.Gap#winforms-with-chromium-embedded-framework) - - [Mac OSX Cocoa App with Xmarain.Mac](https://github.com/ServiceStack/ServiceStack.Gap#mac-osx-cocoa-app-with-xmarainmac) - -## Other Framework Features - -### Filtering support added to Metadata pages - -You can now filter services on ServiceStack's `/metadata` page: - -![Metadata Filter](https://github.com/ServiceStack/Assets/raw/master/img/release-notes/metadata-filter.png) - -### Typed Request Filters - -A more typed API to register Global Request and Response filters per Request DTO Type are available under the `RegisterTyped*` API's in AppHost. These can be used to provide more flexibility in multi-tenant solutions by attaching custom data on incoming requests, e.g: - -```csharp -public override void Configure(Container container) -{ - RegisterTypedRequestFilter((req, res, dto) => - { - var route = req.GetRoute(); - if (route != null && route.Path == "/tenant/{TenantName}/resource") - { - dto.SubResourceName = "CustomResource"; - } - }); -} -``` - -Typed Filters can also be used to apply custom behavior on Request DTO's sharing a common interface, e.g: - -```csharp -public override void Configure(Container container) -{ - RegisterTypedRequestFilter((req, res, dtoInterface) => { - dtoInterface.SharedProperty = "Is Shared"; - }); -} -``` - -### Buffered Stream option has now added to Response - -Response streams can be buffered in the same way as you can buffer Request streams by setting `UseBufferedStream=true`, e.g: - -```csharp -appHost.PreRequestFilters.Add((httpReq, httpRes) => { - httpReq.UseBufferedStream = true; - httpRes.UseBufferedStream = true; -}); - -``` - -### AfterInitCallbacks added to AppHost - -You can register callbacks to add custom logic straight after the AppHost has finished initializing. E.g. you can find all Roles specified in `[RequiredRole]` attributes with: - -```csharp -appHost.AfterInitCallbacks.Add(host => -{ - var allRoleNames = host.Metadata.OperationsMap - .SelectMany(x => x.Key.AllAttributes() - .Concat(x.Value.ServiceType.AllAttributes())) - .SelectMany(x => x.RequiredRoles); -}); -``` - -### Request Scopes can be configured to use ThreadStatic - -Request Scoped dependencies are stored in `HttpRequest.Items` for ASP.NET hosts and uses Remoting's `CallContext.LogicalData` API's in self-hosts. Using the Remoting API's can be problematic in old versions of Mono or when executed in test runners. - -If this is an issue the RequestContext can be configured to use ThreadStatic with: - -```csharp -RequestContext.UseThreadStatic = true; -``` - -### Logging - -Updated Logging providers to allow `debugEnabled` in their LogFactory constructor, e.g: - -```csharp -LogFactory.LogManager = new NullLogFactory(debugEnabled:false); -LogFactory.LogManager = new ConsoleLogFactory(debugEnabled:true); -LogFactory.LogManager = new DebugLogFactory(debugEnabled:true); -``` - -Detailed command logging is now enabled in OrmLite and Redis when `debugEnabled=true`. The external Logging provider NuGet packages have also been updated to use their latest version. - -### Razor - - - Enabled support for Razor `@helpers` and `@functions` in Razor Views - - Direct access to Razor Views in `/Views` is now denied by default - -### Service Clients - - - Change Silverlight to auto emulate HTTP Verbs for non GET or POST requests - - Shorter aliases added on `PostFileWithRequest` which uses the Request DTO's auto-generated url - - The [PCL version of ServiceStack.Interfaces](https://github.com/ServiceStackApps/HelloMobile) now supports a min version of .NET 4.0 - -## OrmLite - -### Exec and Result Filters - -A new `CaptureSqlFilter` Results Filter has been added which shows some of the power of OrmLite's Result filters by being able to capture SQL Statements without running them, e.g: - -```csharp -public class CaptureSqlFilter : OrmLiteResultsFilter -{ - public CaptureSqlFilter() - { - SqlFilter = CaptureSql; - SqlStatements = new List(); - } - - private void CaptureSql(string sql) - { - SqlStatements.Add(sql); - } - - public List SqlStatements { get; set; } -} -``` - -This can then be wrapped around existing database calls to capture and print the generated SQL, e.g: - -```csharp -using (var captured = new CaptureSqlFilter()) -using (var db = OpenDbConnection()) -{ - db.CreateTable(); - db.Count(x => x.Age < 50); - db.Insert(new Person { Id = 1, FirstName = "Jimi", LastName = "Hendrix" }); - db.Delete(new { FirstName = "Jimi", Age = 27 }); - - var sql = string.Join(";\n", captured.SqlStatements.ToArray()); - sql.Print(); -} -``` - -#### Exec filters can be limited to specific Dialect Providers - -```csharp -OrmLiteConfig.DialectProvider.ExecFilter = execFilter; -``` - -### OrmLite's custom SqlBuilders now implement ISqlExpression - -OrmLite provides good support in integrating with external or custom SQL builders that implement OrmLite's simple `ISqlExpression` interface which can be passed directly to `db.Select()` API. This has now been added to OrmLite's other built-in SQL Builders, e.g: - -#### Using JoinSqlBuilder - -```csharp -var joinQuery = new JoinSqlBuilder() - .LeftJoin(x => x.Id, x => x.UserId, - sourceWhere: x => x.Age > 18, - destinationWhere: x => x.Country == "Italy"); - -var results = db.Select(joinQuery); -``` - -#### Using SqlBuilder - -```csharp -var tmpl = sb.AddTemplate( - "SELECT * FROM User u INNER JOIN Address a on a.UserId = u.Id /**where**/"); -sb.Where("Age > @age", new { age = 18 }); -sb.Where("Countryalias = @country", new { country = "Italy" }); - -var results = db.Select(tmpl, tmpl.Parameters); -``` - -### Other Changes - - - OrmLite can create tables with any numeric type in all providers. Fallbacks were added on ADO.NET providers that don't support the numeric type natively - - Load/Save Reference property conventions can be [inferred on either aliases or C# property names](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/LoadReferencesTests.cs#L207) - - OrmLite can create tables from types with Indexers - - Can use `OrmLiteConfig.StripUpperInLike=true` to [remove use of upper() in Sql Expressions](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/Expression/SelectExpressionTests.cs#L205) - -## Redis - -A new `TrackingRedisClientsManager` client manager has been added by [Thomas James](https://github.com/tvjames) to help diagnose Apps that are leaking redis connections. - -# v4.0.19 Release Notes - -## Embedded ServiceStack - -This release has put all the final touches together to open up interesting new use-cases for deploying ServiceStack solutions into a single self-contained, cross-platform, xcopy-able executable. - -By leveraging ServiceStack's support for [self-hosting](https://github.com/ServiceStack/ServiceStack/wiki/Self-hosting), the [Virtual File System](https://github.com/ServiceStack/ServiceStack/wiki/Virtual-file-system) support for Embedded Resources and the new support for [Compiled Razor Views](#compiled-razor-views), we can embed all images/js/css Razor views and Markdown Razor assets into a single dll that can be ILMerged with the preferred ServiceStack dependencies (inc. OrmLite.Sqlite) into a single cross-platform .NET exe: - -### Razor Rockstars - Embedded Edition - -To showcase its potential we've compiled the entire [Razor Rockstars](http://razor.servicestack.net/) website into a [single dll](https://github.com/ServiceStack/RazorRockstars/tree/master/src/RazorRockstars.CompiledViews) that's referenced them in the multiple use-case scenarios below: - -> Note: all demo apps are unsigned so will require ignoring security warnings to run. - -### As a Single Self-Hosted .exe - -The examples below merges Razor Rockstars and ServiceStack into a Single, cross-platform, self-hosting Console App, that opens up Razor Rockstars homepage in the users default web browser when launched: - -> [RazorRockstars.exe](https://github.com/ServiceStack/RazorRockstars/raw/master/build/RazorRockstars.exe) - Self-Host running in a Console App - -> [WindowlessRockstars.exe](https://github.com/ServiceStack/RazorRockstars/raw/master/build/WindowlessRockstars.exe) - Headless Self-Hosted Console App running in the background - -[![SelfHost](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/self-host.png)](https://github.com/ServiceStack/RazorRockstars/raw/master/build/RazorRockstars.exe) - -> The total size for the entire uncompressed **RazorRockstars.exe** ServiceStack website comes down to just **4.8MB** (lighter than the 5MB footprint of EntityFramework.dll) that includes **1.5MB** for RazorRockstars html/img/js/css website assets and **630kb** for native Windows sqlite3.dll. - -### Running inside Windows and OSX Native Desktop Apps - -You can also achieve a [PhoneGap-like experience](http://phonegap.com/) by hosting ServiceStack inside native .NET Desktop App shells for OSX and Windows: - -> [RazorRockstars.MacHost.app](https://github.com/ServiceStack/RazorRockstars/raw/master/build/RazorRockstars.MacHost.app.zip) - Running inside a Desktop Cocoa OSX app using [Xamarin.Mac](https://xamarin.com/mac) - -[![OSX Cocoa App](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/osx-host.png)](https://github.com/ServiceStack/RazorRockstars/raw/master/build/RazorRockstars.MacHost.app.zip) - -> [WpfHost.zip](https://github.com/ServiceStack/RazorRockstars/raw/master/build/WpfHost.zip) - Running inside a WPF Desktop app - -[![WPF App](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/wpf-host.png)](https://github.com/ServiceStack/RazorRockstars/raw/master/build/WpfHost.zip) - -Surprisingly .NET Desktop apps built with [Xamarin.Mac on OSX](https://xamarin.com/mac) using Cocoa's WebKit-based WebView widget provides a superior experience over WPF's built-in WebBrowser widget which renders in an old behind-the-times version of IE. To improve the experience on Windows we're exploring better experiences on Windows by researching options around the [Chromium Embedded Framework](https://code.google.com/p/chromiumembedded/) and the existing managed .NET wrappers: [CefGlue](http://xilium.bitbucket.org/cefglue/) and [CefSharp](https://github.com/cefsharp/CefSharp). - -**Xamarin.Mac** can deliver an even better end-user experience by bundling the Mono runtime with the app avoiding the need for users to have Mono runtime installed. Incidentally this is the same approach used to deploy .NET OSX apps to the [Mac AppStore](http://www.apple.com/osx/apps/app-store.html). - -### Standard Web Hosts - -As the only differences when using the embedded .dll is that it embeds all img/js/css/etc assets as embedded resources and makes use of compiled razor views, it can also be used in standard web hosts configurations which are effectively just lightweight wrappers containing the App configuration and references to external dependencies: - - - [CompiledViews in SelfHost](https://github.com/ServiceStack/RazorRockstars/tree/master/src/RazorRockstars.CompiledViews.SelfHost) - - [CompiledViews in ASP.NET Web Host](https://github.com/ServiceStack/RazorRockstars/tree/master/src/RazorRockstars.CompiledViews.WebHost) - -Benefits of Web Hosts referencing embedded dlls include easier updates by being able to update a websites core functionality by copying over a single **.dll** as well as improved performance for Razor views by eliminating Razor compile times. - -### ILMerging - -Creating the single **RazorRockstars.exe** is simply a matter of [ILMerging all the self-host project dlls](https://github.com/ServiceStack/RazorRockstars/blob/master/build/ilmerge.bat) into a single executable. - -There are only a couple of issues that need to be addressed when running in a single ILMerged .exe: - -Assembly names are merged together so all registration of assemblies in `Config.EmbeddedResourceSources` end up referencing the same assembly which results in only serving embedded resources in the host assembly namespace. To workaround this behavior we've added a more specific way to reference assemblies in `Config.EmbeddedResourceBaseTypes`, e.g: - - ```csharp - SetConfig(new HostConfig { - DebugMode = true, - EmbeddedResourceBaseTypes = { GetType(), typeof(BaseTypeMarker) }, -}); -``` - -Where `BaseTypeMarker` is just a dummy class that sits on the base namespace of the class library that's used to preserve the Assembly namespace. - -The other limitation is not being able to merge unmanaged .dll's, which is what's needed for RazorRockstars as it makes use of the native `sqlite3.dll`. An easy workaround for this is to make `sqlite3.dll` an embedded resource then simply write it out to the current directory where OrmLite.Sqlite can find it when it first makes an sqlite connection, e.g: - - ```csharp -public static void ExportWindowsSqliteDll() -{ - if (Env.IsMono) - return; //Uses system sqlite3.so or sqlite3.dylib on Linux/OSX - - var resPath = "{0}.sqlite3.dll".Fmt(typeof(AppHost).Namespace); - - var resInfo = typeof(AppHost).Assembly.GetManifestResourceInfo(resPath); - if (resInfo == null) - throw new Exception("Couldn't load sqlite3.dll"); - - var dllBytes = typeof(AppHost).Assembly.GetManifestResourceStream(resPath).ReadFully(); - var dirPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - - var filePath = Path.Combine(dirPath, "sqlite3.dll"); - - File.WriteAllBytes(filePath, dllBytes); -} -``` - -This isn't required for Mono as it's able to make use of the preinstalled version of sqlite on OSX and Linux platforms. - -### Compiled Razor Views - -Support for Compiled Razor Views has landed in ServiceStack thanks to the efforts of [Carl Healy](https://github.com/Tyst). - -The primary benefits of compiled views is improved performance by eliminating compile times of Razor views. They also provide static compilation benefits by highlighting compile errors during development and also save you from deploying multiple `*.cshtml` files with your app since they all end up pre-compiled in your Assembly. - -Enabling compiled views is fairly transparent where you only need to install the new [Razor.BuildTask NuGet Package](https://www.nuget.org/packages/ServiceStack.Razor.BuildTask/) to the project containing your `.cshtml` Razor Views you want to compile: - - PM> Install-Package ServiceStack.Razor.BuildTask - -This doesn't add any additional dlls to your project, instead it just sets the **BuildAction** to all `*.cshtml` pages to `Content` and adds an MSBuild task to your project file to pre-compile razor views on every build. - -Then to register assemblies containing compiled razor views with Razor Format you just need to add it to `RazorFormat.LoadFromAssemblies`, e.g: - -```csharp -Plugins.Add(new RazorFormat { - LoadFromAssemblies = { typeof(RockstarsService).Assembly } -}); -``` - -The Compiled Views support continues to keep a great development experience in [DebugMode](https://github.com/ServiceStack/ServiceStack/wiki/Debugging#debugmode) where all Razor Views are initially loaded from the Assembly but then continues to monitor the file system for modified views, automatically compiling and loading them on the fly. - -## [Postman Support](http://www.getpostman.com/) - -We've added great support for the very popular [Postman Rest Client](http://www.getpostman.com/) in this release which is easily enabled by just registering the plugins below: - -```csharp -Plugins.Add(new PostmanFeature()); -Plugins.Add(new CorsFeature()); -``` - -> As it makes cross-site requests, Postman also requires CORS support. - -Once enabled, a link with appear in your metadata page: - -![Postman Metadata link](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/postman-metadata.png) - -Which by default is a link to `/postman` route that returns a JSON postman collection that can be imported into postman by clicking on **import collections** icon at the top: - -![Postman Screenshot](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/postman.png) - -Once imported it will populate a list of available routes which you can select and easily call from the Postman UI. Just like the [Swagger Support](https://github.com/ServiceStack/ServiceStack/wiki/Swagger-API) the list of operations returned respects the [Restriction Attributes](https://github.com/ServiceStack/ServiceStack/wiki/Restricting-Services) and only shows the operations each user is allowed to see. - -The above screenshot shows how to call the `SearchRockstars` Route `/rockstars/{Id}` which returns the rockstar with the matching id. - -The screenshot above also illustrates some of the customization that's available with the [Email Contacts](https://github.com/ServiceStack/EmailContacts/) metadata imported with the default settings and the Razor Rockstars metadata imported with a customized label: - - /postman?label=type,+,route - -The `label` param accepts a collection of string tokens that controls how the label is formatted.The `type` and `route` are special tokens that get replaced by the **Request DTO name** and **Route** respectively. Everything else are just added string literals including the `+` character which is just a url-encoded version of ` ` space character. - -Here are some examples using the example definition below: - -```csharp -[Route("/contacts/{Id}")] -public class GetContact { ... } -``` - -
      - - - - - - - - - - - - - - - - -
      /postman?label=typeGetContact
      /postman?label=route/contacts/{Id}
      /postman?label=type:englishGet contact
      /postman?label=type:english,+(,route,)Get contact (/contacts/{Id})
      - -The default label format can also be configured when registering the Postman plugin, e.g: - -```csharp -Plugins.Add(new PostmanFeature { - DefaultLabelFmt = new List { "type:english", " ", "route" } -}); -``` - -### Support for authenticated requests - -We've also made it easy to call authentication-only services with the `/postman?exportSession=true` parameter which will redirect to a url that captures your session cookies into a deep-linkable url like `/postman?ssopt=temp&ssid={key}&sspid={key}` that can be copied into Postman. - -This lets you replace your session cookies with the session ids on the url, effectively allowing you to take over someone elses session, in this case telling Postman to make requests on your behalf using your authenticated session cookies. - -As this functionality is potentially dangerous it's only enabled by default in **DebugMode** but can be overridden with: - -```csharp -Plugins.Add(new PostmanFeature { - EnableSessionExport = true -}); -``` - -### Other Customizations - -Other options include hosting postman on an alternate path, adding custom HTTP Headers for each Postman request and providing friendly aliases for Request DTO Property Types that you want to appear to external users, in this case we can show `DateTime` types as `Date` in Postmans UI: - -```csharp -Plugins.Add(new PostmanFeature { - AtRestPath = "/alt-postman-link", - Headers = "X-Custom-Header: Value\nXCustom2: Value2", - FriendlyTypeNames = { {"DateTime", "Date"} }, -}); -``` - -## [Cascading layout templates](http://razor.servicestack.net/#no-ceremony) - -Support for [Cascading layout templates](http://razor.servicestack.net/#no-ceremony) for Razor ViewPages inside `/Views` were added in this release by [@Its-Tyson](https://github.com/Its-Tyson). - -This works the same intuitive way it does for external Razor Content pages where the `_Layout.cshtml` nearest to the selected View will be used by default, e.g: - - /Views/_Layout.cshtml - /Views/Public.cshtml - /Views/Admin/_Layout.cshtml - /Views/Admin/Dashboard.cshtml - -Where `/Views/Admin/Dashboard.cshtml` by default uses the `/Views/Admin/_Layout.cshtml` template. - -## Async APIs added to HTTP Utils - -The following Async versions of [HTTP Utils](https://github.com/ServiceStack/ServiceStack/wiki/Http-Utils) have been added to ServiceStack.Text by [Kyle Gobel](https://github.com/KyleGobel): - -```csharp -Task GetStringFromUrlAsync(...) -Task PostStringToUrlAsync(...) -Task PostToUrlAsync(...) -Task PostJsonToUrlAsync(...) -Task PostXmlToUrlAsync(...) -Task PutStringToUrlAsync(...) -Task PutToUrlAsync(...) -Task PutJsonToUrlAsync(...) -Task PutXmlToUrlAsync(...) -Task DeleteFromUrlAsync(...) -Task OptionsFromUrlAsync(...) -Task HeadFromUrlAsync(...) -Task SendStringToUrlAsync(...) -``` - -## Redis - -The latest [stable release of redis-server](http://download.redis.io/redis-stable/00-RELEASENOTES) includes support for the new [ZRANGEBYLEX](http://redis.io/commands/zrangebylex) sorted set operations allowing you to query a sorted set lexically. A good showcase for this is available on [autocomplete.redis.io](http://autocomplete.redis.io/) that shows a demo querying all 8 millions of unique lines of the Linux kernel source code in a fraction of a second. - -These new operations are available as a 1:1 mapping with redis-server on IRedisNativeClient: - -```csharp -public interface IRedisNativeClient -{ - ... - byte[][] ZRangeByLex(string setId, string min, string max, int? skip = null, int? take = null); - long ZLexCount(string setId, string min, string max); - long ZRemRangeByLex(string setId, string min, string max); -} -``` - -As well as under more user-friendly APIs under IRedisClient: - -```csharp -public interface IRedisClient -{ - ... - List SearchSortedSet(string setId, string start=null, string end=null, int? skip=null, int? take=null); - long SearchSortedSetCount(string setId, string start=null, string end=null); - long RemoveRangeFromSortedSetBySearch(string setId, string start=null, string end=null); -} -``` - -Just like NuGet version matchers, Redis uses `[` char to express inclusiveness and `(` char for exclusiveness. -Since the `IRedisClient` APIs defaults to inclusive searches, these two APIs are the same: - -```csharp -Redis.SearchSortedSetCount("zset", "a", "c") -Redis.SearchSortedSetCount("zset", "[a", "[c") -``` - -Alternatively you can specify one or both bounds to be exclusive by using the `(` prefix, e.g: - -```csharp -Redis.SearchSortedSetCount("zset", "a", "(c") -Redis.SearchSortedSetCount("zset", "(a", "(c") -``` - -More API examples are available in [LexTests.cs](https://github.com/ServiceStack/ServiceStack.Redis/blob/master/tests/ServiceStack.Redis.Tests/LexTests.cs). - -### Twemproxy support - -This release also includes better support for [twemproxy](https://github.com/twitter/twemproxy), working around missing server commands sent upon connection. - -## OrmLite - -New support for StringFilter allowing you apply custom filter on string values, e.g [remove trailing whitespace](http://stackoverflow.com/a/23261868/85785): - -```csharp -OrmLiteConfig.StringFilter = s => s.TrimEnd(); - -db.Insert(new Poco { Name = "Value with trailing " }); -Assert.That(db.Select().First().Name, Is.EqualTo("Value with trailing")); -``` - -Added implicit support for [escaping wildcards in typed expressions](http://stackoverflow.com/a/23435975/85785) that make use of LIKE, namely `StartsWith`, `EndsWith` and `Contains`, e.g: - -```csharp -db.Insert(new Poco { Name = "ab" }); -db.Insert(new Poco { Name = "a%" }); -db.Insert(new Poco { Name = "a%b" }); - -db.Count(q => q.Name.StartsWith("a_")); //0 -db.Count(q => q.Name.StartsWith("a%")); //2 -``` - -OrmLite also underwent some internal refactoring to remove duplicate code and re-use existing code-paths. - -### Other Features - - - Allow overriding of `HttpListenerBase.CreateRequest()` for controlling creation of Self-Hosting requests allowing you to force a [Character encoding to override the built-in heuristics](http://stackoverflow.com/a/23381383/85785) for detecting non UTF-8 character encodings - - Support for retrieving untyped `base.UserSession` when inheriting from an untyped MVC `ServiceStackController` - - Added `@Html.RenderErrorIfAny()` to render a pretty bootstrap-styled exception response in a razor view - - The generated WSDL output now replaces all occurances of `http://schemas.servicestack.net/types` with `Config.WsdlServiceNamespace` - - Initialize the CompressedResult Status code with the current HTTP ResponseStatus code - - Plugins implementing `IPreInitPlugin` are now configured immediately after `AppHost.Configure()` - - HttpListeners now unwrap async Aggregate exceptions containing only a Single Exception for better error reporting - - HttpListeners now shares the same behavior as IIS for [redirecting requests for directories without a trailing slash](https://github.com/ServiceStack/ServiceStack/commit/a0a2857721656c7161fcd83eb07609ae4239ea2a) - - [Debug Request Info](https://github.com/ServiceStack/ServiceStack/wiki/Debugging#request-info) now shows file listing of the configured VirtualPathProvider - - Resource Virtual Directories are no longer case-sensitive - - Added new `Config.ExcludeAutoRegisteringServiceTypes` option to exclude services from being implicitly auto registered from assembly scanning. All built-in services in ServiceStack.dll now excluded by default which removes unintentional registration of services from ILMerging. - -# New HTTP Benchmarks example project - -[![HTTP Benchmarks](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/benchmarks-admin-ui.png)](https://httpbenchmarks.servicestack.net/) - -Following the release of the [Email Contacts](https://github.com/ServiceStack/EmailContacts/) solution, a new documented ServiceStack example project allowing you to uploaded Apache HTTP Benchmarks to visualize and analyze their results has been released at: [github.com/ServiceStack/HttpBenchmarks](https://github.com/ServiceStack/HttpBenchmarks) and is hosted at [httpbenchmarks.servicestack.net](https://httpbenchmarks.servicestack.net/). - -### Example Results - - - [Performance of different RDBMS in an ASP.NET Host](https://httpbenchmarks.servicestack.net/databases-in-asp-net) - - [Performance of different ServiceStack Hosts](https://httpbenchmarks.servicestack.net/servicestack-hosts) - -The documentation includes a development guide that walks through the projects different features: - - - Integration with `Glimpse` with support for `DotNetOpenAuth` - - Allow authentication with Twitter, Facebook, Google and LinkedIn OAuth providers - - Enables registration of new user accounts - - Use of `[FallbackRoute]` attribute to allow users to create top-level routes (e.g. twitter.com/name) - - Explains why you want to aim for minimal JS dependencies - - Introduction of **Really Simple MV Pattern** using plain JavaScript - - Integration with multi-file Uploader `FineUploader` - - Processes multiple file uploads including files in **.zip** packages using `DotNetZip` - - Integration with `Highcharts.js` - - Hosting differences of ASP.NET with AWS - - Deploying to AWS and creating customized deployment packages with MSDeploy - - Configuring SSL - - Forcing SSL Redirects - -The repository also includes benchmark scripts and host projects of [all ServiceStack HTTP Hosts](https://github.com/ServiceStack/HttpBenchmarks/tree/master/servers -), which all support runtime configuration of different RDBMS's: - -# v4.0.18 Release Notes - -## New, much faster Self-Host! - -Prior to this release ServiceStack had 2 self-hosting options with different [Concurrency Models](https://github.com/ServiceStack/ServiceStack/wiki/Concurrency-model): - -- `AppHostHttpListenerBase` - Executes requests on the IO callback thread -- `AppHostHttpListenerPoolBase` - Executes requests on .NET's built-in ThreadPool - -Where in typical scenarios (i.e. CPU intensive or blocking IO), executing on .NET's Thread Pool provides better performance. - -This [Self-hosting performance analysis](http://en.rdebug.com/2013/05/06/servicestack-selfhosted-performance-boost/) from the ServiceStack community shows we're able to achieve even better performance by utilizing the excellent [Smart Thread Pool](http://www.codeproject.com/Articles/7933/Smart-Thread-Pool) instead, which is now available in the `AppHostHttpListenerSmartPoolBase` base class. - -The new Smart Pool self-host routinely outperforms all other self hosting options, and does especially well in heavy IO scenarios as seen in the benchmarks below: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Self HostASP.NET/IIS ExpressHttpListener PoolHttpListener
      Database updates1x1.9x2x4.1x
      Single database query1x1.2x1.5x2.6x
      Multiple database queries1x1.2x1.4x2.6x
      Plaintext1x2.3x2.4x1.6x
      Fortunes Razor View1x1.2x1.5x1.8x
      JSON serialization1x1.2x1.4x1x
      - -### Using different Self Host options - -You can easily switch between the different self-hosting options by simply changing your AppHost's base class, e.g: - -```csharp -public class AppHost : AppHostHttpListenerBase { ... } -public class AppHost : AppHostHttpListenerPoolBase { ... } -public class AppHost : AppHostHttpListenerSmartPoolBase { ... } -``` - -Both the HttpListener Pool and SmartPool hosts have configurable pool sizes that can be tweaked to perform better under different scenarios. - -### Optimal Self Hosted option - -As the number of self-hosts grow, we've added a new `AppSelfHostBase` base class that represents an alias for the highest performing self-hosting option with an optimal configuration that we'll continue to tune for performance against typical scenarios. Unless you've identified specific configurations that performs better for your use-case, the recommendation is for new self-hosts to inherit this configuration: - -```csharp -public class AppHost : AppSelfHostBase { ... } -``` - -## OrmLite - -OrmLite received a lot more attention this release with a number of value-added additions: - -### Improved Oracle RDBMS provider - -The OrmLite Oracle Provider has been significantly improved thanks to [Bruce Cowen](https://github.com/BruceCowan-AI) efforts who's brought the quality in-line with other RDBMS providers which now passes OrmLite's test suite. As part of this change, the Oracle Provider now depends on [Oracle's Data Provider for .NET](http://www.oracle.com/technetwork/topics/dotnet/index-085163.html) and can be installed with: - - PM> Install-Package ServiceStack.OrmLite.Oracle - PM> Install-Package ServiceStack.OrmLite.Oracle.Signed - -More notes about the Oracle provider are maintained in the [OrmLite Release Notes](https://github.com/ServiceStack/ServiceStack.OrmLite/#oracle-provider-notes). - -### Improved Typed SqlExpressions - -The existing `db.SqlExpression()` API has a more readable alias in: - -```csharp -db.From(); -``` - -Which now supports an optional SQL **FROM** fragment that can be used to specify table joins, e.g: - - var results = db.Select(db.From("Person INNER JOIN Band ON Person.Id = Band.PersonId")); - -#### New ISqlExpression API - -OrmLite API's have overloads to execute any SQL builders that implement the simple `ISqlExpression` API, i.e: - -```csharp -public interface ISqlExpression -{ - string ToSelectStatement(); -} -``` - -This allows for more readable code when using a decoupled Sql Builder, e.g: - -```csharp -int over40s = db.Scalar(db.From().Select(Sql.Count("*")).Where(q => q.Age > 40)); - -List lastNames = db.Column(db.From().Select(x => x.LastName).Where(q => q.Age == 27)); - -HashSet uniqueAges = db.ColumnDistinct(db.From().Select(x => x.Age).Where(q => q.Age < 50)); - -Dictionary map = db.Dictionary(db.From().Select(x => new {x.Id, x.LastName})); -``` - -#### Partial Selects - -This also improves the APIs for partial SELECT queries, which originally required the use of custom SQL: - -```csharp -var partialColumns = db.SelectFmt(typeof(Shipper), "ShipperTypeId = {0}", 2); -``` - -But can now be expressed in any of the more typed examples below: - -```csharp -var partialColumns = db.Select(db.From().Where(q => q.ShipperTypeId == 2)); -``` - -Or partially populating the same POCO with only the columns specified: - -```csharp -var partialColumns = db.Select(q => q.Select(x => new { x.Phone, x.CompanyName }) - .Where(x => x.ShipperTypeId == 2)); - -var partialColumns = db.Select(q => q.Select("Phone, CompanyName") - .Where(x => x.ShipperTypeId == 2)); -``` - -#### Nullable Limit APIs - -The Limit API's now accept `int?` making it easier to apply paging in your ServiceStack services, e.g: - -```csharp -public Request -{ - public int? Skip { get; set; } - public int? Take { get; set; } -} - -public List
      Any(Request request) -{ - return Db.Select(db.From
      .Limit(request.Skip, request.Take)); -} -``` - -Which will only filter the results for the values provided. Aliases for `Skip()` and `Take()` are also available if LINQ naming is preferred. - -#### New AliasNamingStrategy - -A new alias naming strategy was added (in addition to `[Alias]` attribute) that lets you specify a dictionary of Table and Column aliases OrmLite should used instead, e.g: - -```csharp -OrmLiteConfig.DialectProvider.NamingStrategy = new AliasNamingStrategy { - TableAliases = { { "MyTable", "TableAlias" } }, - ColumnAliases = { { "MyField", "ColumnAlias" } }, -}; -``` - -Which OrmLite will use instead, e.g when creating a table: - -```csharp -db.CreateTable(); -``` - -Aliases can also be referenced when creating custom SQL using the `SqlTable()` and `SqlColumn()` extension methods, e.g: - -```csharp -var result = db.SqlList( - "SELECT * FROM {0} WHERE {1} = {2}".Fmt( - "MyTable".SqlTable(), - "MyField".SqlColumn(), "foo".SqlValue())); -``` - -#### New Exists APIs - -Nicer if you just need to check for existence, instead of retrieving a full result-set e.g: - -```csharp -bool hasUnder50s = db.Exists(x => x.Age < 50); -bool hasUnder50s = db.Exists(db.From().Where(x => x.Age < 50)); -``` - -## Redis - -### New Scan APIs Added - -Redis v2.8 introduced a beautiful new [SCAN](http://redis.io/commands/scan) operation that provides an optimal strategy for traversing a redis instance entire keyset in managable-size chunks utilizing only a client-side cursor and without introducing any server state. It's a higher performance alternative and should be used instead of [KEYS](http://redis.io/commands/keys) in application code. SCAN and its related operations for traversing members of Sets, Sorted Sets and Hashes are now available in the Redis Client in the following API's: - -```csharp -public interface IRedisClient -{ - ... - IEnumerable ScanAllKeys(string pattern = null, int pageSize = 1000); - IEnumerable ScanAllSetItems(string setId, string pattern = null, int pageSize = 1000); - IEnumerable> ScanAllSortedSetItems(string setId, string pattern = null, int pageSize = 1000); - IEnumerable> ScanAllHashEntries(string hashId, string pattern = null, int pageSize = 1000); -} - -//Low-level API -public interface IRedisNativeClient -{ - ... - ScanResult Scan(ulong cursor, int count = 10, string match = null); - ScanResult SScan(string setId, ulong cursor, int count = 10, string match = null); - ScanResult ZScan(string setId, ulong cursor, int count = 10, string match = null); - ScanResult HScan(string hashId, ulong cursor, int count = 10, string match = null); -} -``` - -The `IRedisClient` provides a higher-level API that abstracts away the client cursor to expose a lazy Enumerable sequence to provide an optimal way to stream scanned results that integrates nicely with LINQ, e.g: - -```csharp -var scanUsers = Redis.ScanAllKeys("urn:User:*"); -var sampleUsers = scanUsers.Take(10000).ToList(); //Stop after retrieving 10000 user keys -``` - -### New HyperLog API - -The development branch of Redis server (available when v3.0 is released) includes an ingenious algorithm to approximate the unique elements in a set with maximum space and time efficiency. For details about how it works see Redis's creator Salvatore's blog who [explains it in great detail](http://antirez.com/news/75). Essentially it lets you maintain an efficient way to count and merge unique elements in a set without having to store its elements. -A Simple example of it in action: - -```csharp -redis.AddToHyperLog("set1", "a", "b", "c"); -redis.AddToHyperLog("set1", "c", "d"); -var count = redis.CountHyperLog("set1"); //4 - -redis.AddToHyperLog("set2", "c", "d", "e", "f"); - -redis.MergeHyperLogs("mergedset", "set1", "set2"); - -var mergeCount = redis.CountHyperLog("mergedset"); //6 -``` - -## HTTP and MQ Service Clients - -### Substitutable OneWay MQ and HTTP Service Clients - -Service Clients and MQ Clients have become a lot more interoperable where all MQ Clients now implement the Service Clients `IOneWayClient` API which enables writing code that works with both HTTP and MQ Clients: - -```csharp -IOneWayClient client = GetClient(); -client.SendOneWay(new RequestDto { ... }); -``` - -Likewise the HTTP Service Clients implement the Messaging API `IMessageProducer`: - -```csharp -void Publish(T requestDto); -void Publish(IMessage message); -``` - -When publishing a `IMessage` the message metadata are sent as HTTP Headers with an `X-` prefix. - -### UploadProgress added on Service Clients - -Which works similar to [OnDownloadProgress](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncProgressTests.cs) where you can specify a callback to provide UX Progress updates, e.g: - -```csharp -client.OnUploadProgress = (bytesWritten, total) => "Written {0}/{1} bytes...".Print(bytesWritten, total); - -client.PostFileWithRequest(url, new FileInfo(path), new Upload { CreatedBy = "Me" }); -``` - -## Razor Support - -Our support for [No Ceremony Razor pages](https://github.com/ServiceStack/EmailContacts/#the-no-ceremony-option---dynamic-pages-without-controllers) has been very well received which has all but alleviated the need of requiring services / controllers for dynamic html pages. One of the areas where a Service may be required is for execution any custom request filters, which we've now added support for by letting you choose to execute all request filters for a specific Request with: - -```csharp -@{ - ApplyRequestFilters(new RequestDto()); -} -``` - -This will execute all the Request Filters applied to the specified Request DTO. Any one of the filters ends the request (e.g. with a redirect) and the rest of the Razor page will stop execution. - -Likewise it's possible to redirect from within Razor with: - -```csharp -@{ - if (!IsAuthenticated) { - Response.RedirectToUrl("/login"); - throw new StopExecutionException(); - } -} -``` -An alternative to `StopExecutionException` is to have an explicit `return;`, the difference being that it will continue to execute the remainder of the page, although neither approach will emit any Razor output to the response. - -As redirecting non-authenticated users is a common use-case it's also available as a one-liner: - -```csharp -@{ - RedirectIfNotAuthenticated(); -} -``` - -Which if no url is specified it will redirect to the path configured on `AuthFeature.HtmlRedirect`. - -### ss-utils.js - -A few enhancements were added to ServiceStack's **/js/ss-utils.js** is ServiceStack's built-in JS library, first demonstrated in [Email Contacts solution](https://github.com/ServiceStack/EmailContacts/#servicestack-javascript-utils---jsss-utilsjs): - -Declarative event handlers can send multiple arguments: - -```html -
        -
      • Foo
      • -
      • Bar
      • -
      -``` - -```javascript -$(document).bindHandlers({ - single: function(){ - var li = this; - }, - multiple: function(arg1, arg2) { - var li = this; - } -}); -``` - -Trigger client-side validation errors with `setFieldError()`: - -```javascript -$("form").bindForm({ - validate: function(){ - var params = $(this).serializeMap(); - if (params.Password != params.Confirm){ - $(this).setFieldError('Password', 'Passwords to not match'); - return false; - } - } -}); -``` - -Model binding now also populates `data-href` and `data-src` attributes e.g: - -```html - -``` - -```javascript -$("form").applyValues({ FieldName: imgUrl }); -``` -## Other Changes - -### Restriction attributes allowed on Services - -Restriction attributes can be added on Service classes in addition to Request DTOs (which still take precedence). - -```csharp -[Restrict(LocalhostOnly = true)] -public class LocalHostOnlyServices : Service { ... } -``` - -## AppSettings - -### New OrmLiteAppSettings - -Added new read/write AppSettings config option utilizing OrmLite as the back-end. -This now lets you maintain your applications configuration in any [RDBMS back-end OrmLite supports](https://github.com/ServiceStack/ServiceStack.OrmLite/#download). It basically works like a mini Key/Value database in which can store any serializable value against any key which is maintained into the simple Id/Value `ConfigSettings` table. - -#### Usage - -Registration just uses an OrmLite DB Factory, e.g: - -```csharp -container.Register(c => new OrmLiteAppSettings(c.Resolve())); -var appSettings = container.Resolve(); -appSettings.InitSchema(); //Create the ConfigSettings table if it doesn't exist -``` - -It then can be accessed like any [AppSetting APIs](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.Common.Tests/Configuration/AppSettingsTests.cs): - -```csharp -//Read the `MyConfig` POCO stored at `config` otherwise use default value if it doesn't exist -MyConfig config = appSettings.Get("config", new MyConfig { Key = "DefaultValue" }); -``` - -It also supports writing config values in addition to the AppSettings read-only API's, e.g: - -```csharp -var latestStats = appSettings.GetOrCreate("stats", () => statsProvider.GetLatest()); -``` - -### Extract key / value settings from text file - -The new ParseKeyValueText extension method lets you extract key / value data from text, e.g: - -```csharp -var configText = @" -StringKey string value -IntKey 42 -ListKey A,B,C,D,E -DictionaryKey A:1,B:2,C:3,D:4,E:5 -PocoKey {Foo:Bar,Key:Value}"; - -Dictionary configMap = configText.ParseKeyValueText(delimiter:" "); -``` - -When combined with the existing `DictionarySettings`, enables a rich, simple and clean alternative to .NET's App.config config section for reading structured configuration into clean data structures, e.g: - -```csharp -IAppSettings appSettings = new DictionarySettings(configMap); - -string value = appSettings.Get("StringKey"); - -int value = appSettings.Get("IntKey", defaultValue:1); - -List values = appSettings.GetList("ListKey"); - -Dictionary valuesMap = appSettings.GetList("DictionaryKey"); - -MyConfig config = appSettings.Get("PocoKey", new MyConfig { Key = "DefaultValue"}); -``` - -As we expect this to be a popular combination we've combined them into a single class that accepts a filePath, providing a simple alternative to custom Web.config configurations: - -```csharp -var appSettings = new TextFileSettings("~/app.settings".MapHostAbsolutePath()); -``` - -### PerfUtils - -We've included the [C# Benchmark Utils](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Common/PerfUtils.cs) previously used in [Sudoku Benchmarks](https://github.com/dartist/sudoku_solver#benchmarks) originally inspired from [Dart's benchmark_harness](https://github.com/dart-lang/benchmark_harness). Unlike other benchmark utils, it runs for a specified period of time (2000ms by default) then returns the avg iteration time in microseconds. Here's an example usage comparing performance of maintaining a unique int collection between HashSet vs List: - -```csharp -var rand = new Random(); -var set = new HashSet(); -var avgMicroSecs = PerfUtils.Measure( - () => set.Add(rand.Next(0, 1000)), runForMs:2000); - -"HashSet: {0}us".Print(avgMicroSecs); - -var list = new List(); -avgMicroSecs = PerfUtils.Measure(() => { - int i = rand.Next(0, 1000); - if (!list.Contains(i)) - list.Add(i); - }, runForMs: 2000); - -"List: {0}us".Print(avgMicroSecs); -``` - -### Minor Changes - -- Numeric type mismatches between POCOs used in OrmLite and underlying RDBMS Tables are transparently coerced -- `Vary: Accept` is included in Global HTTP Headers to resolve browsers caching different Content-Type for the same url -- Razor configuration removes references to a specific version of ASP.NET Web Pages and adds `System` to default namespaces -- Swagger API emits an ApiVersion, configurable with `Config.ApiVersion` that defaults to "1.0" -- Partials now render inside user-defined Razor sections -- Added `email.ToGravatarUrl()` extension method to retrieve avatar url from an email -- Replaced self-hosts use of ThreadStatics with CallContext to preserve Request scope in async requests -- Avoid runtime razor exceptions in Mono by not registering duplicate assemblies (i.e. from GAC) in RazorHost -- AppHostHttpListenerPoolBase self-host has a default pool size of `16 x Environment.ProcessorCount` -- ServiceStack's `IAppHost.CustomErrorHttpHandlers` can now override built-in HTTP Error handlers and fallback to generic error responses - -### New Signed Projects - -- [ServiceStack.ProtoBuf.Signed](https://www.nuget.org/packages/ServiceStack.ProtoBuf.Signed) - -### Breaking Changes - -- Moved `Config.GlobalHtmlErrorHttpHandler` to `IAppHost.GlobalHtmlErrorHttpHandler` - - -# v4.0.15 Release Notes - -### Individual Products now available - -In this release we've added the most requested "non-technical feature" by creating new licenses for [individual ServiceStack products](https://servicestack.net/#products) which provide -much better value when only using one of ServiceStack's stand-alone libraries on their own. - -New products available: - - - [servicestack.net/text](https://servicestack.net/text) - - [servicestack.net/redis](https://servicestack.net/redis) - - [servicestack.net/ormlite](https://servicestack.net/ormlite) - -> Both OrmLite and Redis includes an implicit license for ServiceStack.Text - -### ServiceStack - - - Upgraded ServiceStack's external dependencies to use latest version on NuGet - - Modified [ServiceStack.RabbitMq](http://www.nuget.org/packages/ServiceStack.RabbitMq) to only depend on **ServiceStack** instead of **ServiceStack.Server** - - Added optional `fieldName` property to ServiceClient [PostFileWithRequest](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/IRestClient.cs#L52-L55) - - Changed exceptions in FileSystem scanning to be logged as warnings, fixes issues with NTFS symbolic links - - Pass through Thread CurrentCulture when executing a sync request in a new Task - - Added Evaluator.NamespaceAssemblies to specify alternate default namespace for Assemblies - - Changed to use OrdinalIgnoreCase instead of InvariantCultureIgnoreCase when possible - -### OrmLite - -#### OrmLite's core Exec functions are now overridable as a Filter - -Continuing in efforts to make OrmLite more introspectable and configurable, OrmLite's core Exec functions -[have been re-factored out into a substitutable Exec Filter](https://github.com/ServiceStack/ServiceStack.OrmLite/commit/fa55404200f4a319eae3a298b648462dadafce5e). - -This now makes it possible to inject a custom managed exec function where you can inject your own behavior, tracing, profiling, etc. - -It comes in useful for situations when you want to use SqlServer in production but use an `in-memory` Sqlite database in tests and you want to emulate any missing SQL Server Stored Procedures in code: - -```csharp -public class MockStoredProcExecFilter : OrmLiteExecFilter -{ - public override T Exec(IDbConnection dbConn, Func filter) - { - try - { - return base.Exec(dbConn, filter); - } - catch (Exception ex) - { - if (dbConn.GetLastSql() == "exec sp_name @firstName, @age") - return (T)(object)new Person { FirstName = "Mocked" }; - throw; - } - } -} - -OrmLiteConfig.ExecFilter = new MockStoredProcExecFilter(); - -using (var db = OpenDbConnection()) -{ - var person = db.SqlScalar("exec sp_name @firstName, @age", - new { firstName = "aName", age = 1 }); - - person.FirstName.Print(); //Mocked -} -``` -Or if you want to do things like executing each operation multiple times, e.g: - -```csharp -public class ReplayOrmLiteExecFilter : OrmLiteExecFilter -{ - public int ReplayTimes { get; set; } - - public override T Exec(IDbConnection dbConn, Func filter) - { - var holdProvider = OrmLiteConfig.DialectProvider; - var dbCmd = CreateCommand(dbConn); - try - { - var ret = default(T); - for (var i = 0; i < ReplayTimes; i++) - { - ret = filter(dbCmd); - } - return ret; - } - finally - { - DisposeCommand(dbCmd); - OrmLiteConfig.DialectProvider = holdProvider; - } - } -} - -OrmLiteConfig.ExecFilter = new ReplayOrmLiteExecFilter { ReplayTimes = 3 }; - -using (var db = OpenDbConnection()) -{ - db.DropAndCreateTable(); - db.Insert(new PocoTable { Name = "Multiplicity" }); - - var rowsInserted = db.Count(q => q.Name == "Multiplicity"); //3 -} -``` - -#### Other improvements - - - Added [SqlVerifyFragment string extension](https://github.com/ServiceStack/ServiceStack.OrmLite/commit/7f0711aa3368087037d8b7b84cf9f70f1ea2b191) to verify sql fragments where free-text is allowed in SqlExpression APIs - - Change MySql to create TimeSpan's column as INT to store ticks - -### Redis - - - Add new Increment by double and long methods to Redis Client - -### Text - - - Added [T.PopulateFromPropertiesWithoutAttribute](https://github.com/ServiceStack/ServiceStack.Text/commit/9bd0cc35c0a4e3ddcb7e6b6b88e760f45496145b) Auto Mapping method - -### New Signed NuGet Packages - - - [ServiceStack.OrmLite.Sqlite.Windows.Signed](http://www.nuget.org/packages/ServiceStack.OrmLite.Sqlite.Windows.Signed) - -# v4.0.12 Release Notes - -## New [Email Contact Services](https://github.com/ServiceStack/EmailContacts/) - -A new ServiceStack guidance is available detailing the recommended setup and physical layout structure of typical medium-sized ServiceStack projects. -It includes the complete documentation going through how to create the solution from scratch, and explains all the ServiceStack hidden features it makes use of along the way. - -[![EmailContacts Screenshot](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/email-contacts.png)](https://github.com/ServiceStack/EmailContacts/) - -[EmailContacts](https://github.com/ServiceStack/EmailContacts/) is a Single Page App built using just ServiceStack, -jQuery and Bootstrap that showcases some of ServiceStack's built-in features, useful in the reducing the effort for -developing medium-sized Web Applications. - -The purpose of EmailContacts is to manage contacts (in [any RDBMS](https://github.com/ServiceStack/ServiceStack.OrmLite/#download)), -provide a form to be able to send them messages and maintain a rolling history of any emails sent. -The application also provides an option to have emails instead sent and processed via [Rabbit MQ](https://github.com/ServiceStack/ServiceStack/wiki/Rabbit-MQ). - -#### Functional Single Page App in under 130 Lines of HTML and 70 Lines JS - -The entire EmailContacts UI is maintained in a single -[default.cshtml](https://github.com/ServiceStack/EmailContacts/blob/master/src/EmailContacts/default.cshtml) -requiring just 70 lines of JavaScript to render the dynamic UI, -bind server validation errors and provide real-time UX feedback. -The Application also follows an API-First development style where the Ajax UI calls only published APIs allowing -all services to be immediately available, naturally, via an end-to-end typed API to Mobile and Desktop .NET clients. - -### Example Projects - -During this release all Example projects, Demos, Starter Templates, etc in the -[ServiceStack.Example](https://github.com/ServiceStack/ServiceStack.Examples) and -[ServiceStack.UseCases](https://github.com/ServiceStack/ServiceStack.UseCases/) -master repositories were upgraded to ServiceStack v4. A new [ServiceStack + MVC5 project](https://github.com/ServiceStack/ServiceStack.UseCases/tree/master/Mvc5) -was also added to UseCases, it just follows the instructions at [MVC Integration](https://github.com/ServiceStack/ServiceStack/wiki/Mvc-integration) wiki, but starts with an empty MVC5 project. - -### Added new OrmLiteCacheClient - -A new `OrmLiteCacheClient` [Caching Provider](https://github.com/ServiceStack/ServiceStack/wiki/Caching) -was added to the **ServiceStack.Server** NuGet pacakge. -This provides a lot of utility by supporting -[OrmLite's RDBMS providers](https://github.com/ServiceStack/ServiceStack.OrmLite/#download) -allowing utilization of existing RDBMS's as a distributed cache, potentially saving an infrastructure dependency. - -Registration is simply: - -```csharp -//Register OrmLite Db Factory if not already -container.Register(c => - new OrmLiteConnectionFactory(connString, SqlServerDialect.Provider)); - -container.RegisterAs(); - -//Create 'CacheEntry' RDBMS table if it doesn't exist already -container.Resolve().InitSchema(); -``` - -### Service Clients - - - Added `CaptureSynchronizationContext` option to get Async Service Clients to execute responses on the same SynchronizationContext as their call-site - - Added `UserAgent` option, now defaults with the ServiceStack .NET client version - -### Minor features - - - Allow unrestricted access for Redis MQ and Rabbit MQ clients within free-quotas - - SessionIds are no longer created with Url Unfriendly chars `+`, `/` - - Add typed `ToOneWayUrl()` and `ToReplyUrl()` extension method for generating predefined urls - - Add Test showing how to use `ExecAllAndWait` extension method to [easily run synch operations in parallel](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.Common.Tests/ActionExecTests.cs) - - Added configurable BufferSize in StaticFileHandler - - All CacheClients can now store AuthUserSessions when `JsConfig.ExcludeTypeInfo=true` - - Allow RegistrationService to be used for PUT requests to updates User Registration info - - Elmah Logger now takes in a `HttpApplication` so it can use `ErrorSignal.Get(application).Raise()` allowing modules such as ErrorMail and ErrorPost (ElmahR) to be notified - -## OrmLite - - - Add support for [cloning SqlExpressions](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/Expression/ExpressionChainingUseCase.cs#L192-L207) - - Add example of [migrating SqlServer TIME column to BigInteger](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/AdoNetDataAccessTests.cs) - - Add example of [calling Stored Procedures with OrmLite vs ADO.NET](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/TypeWithByteArrayFieldTests.cs#L55-L147) - - Add support for [MaxText in all DB providers](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/TypeDescriptorMetadataTests.cs#L57-L96) with `[StringLength(StringLengthAttribute.MaxText)]` - - Capture the LastSql Run even for queries with exceptions - -## Redis - - - Use enhanced functionality for when newer versions of redis-server exists - - i.e. Use more precise EXPIRE operations when server supports it - - Add `GetServerTime()` - -## ServiceStack.Text - - - Moved `JsConfig.RegisterForAot()` to `PclExport.RegisterForAot()` - - Fine-grained AOT hints available on `IosPclExport` static methods in PCL builds - -## Breaking Changes - -The [ServiceStack.Stripe](https://www.nuget.org/packages/ServiceStack.Stripe/) NuGet package is now a normal .NET 4.0 release. A new portable NuGet package was created for PCL clients at [ServiceStack.Stripe.Pcl](https://www.nuget.org/packages/ServiceStack.Stripe.Pcl/). - -# v4.0.11 Release Notes - -## OrmLite - -This release saw a lot of effort towards adding new features to OrmLite: - -### Pluggable Complex Type Serializers - -One of the [most requested features](http://servicestack.uservoice.com/forums/176786-feature-requests/suggestions/4738945-allow-ormlite-to-store-complex-blobs-as-json) -to enable pluggable serialization for complex types in OrmLite is now supported. This can be used to specify different serialization strategies for each -available RDBMS provider, e.g: - -```csharp -//ServiceStack's JSON and JSV Format -SqliteDialect.Provider.StringSerializer = new JsvStringSerializer(); -PostgreSqlDialect.Provider.StringSerializer = new JsonStringSerializer(); -//.NET's XML and JSON DataContract serializers -SqlServerDialect.Provider.StringSerializer = new DataContractSerializer(); -MySqlDialect.Provider.StringSerializer = new JsonDataContractSerializer(); -//.NET XmlSerializer -OracleDialect.Provider.StringSerializer = new XmlSerializableSerializer(); -``` -You can also provide a custom serialization strategy by implementing -[IStringSerializer](https://github.com/ServiceStack/ServiceStack.Text/blob/master/src/ServiceStack.Text/IStringSerializer.cs). - -By default all dialects use the existing JsvStringSerializer, except for PostgreSQL which due to its built-in support for JSON, now uses the JSON format by default. - -#### Breaking Change - -Using JSON as a default for PostgreSQL may cause issues if you already have complex types blobbed with the previous JSV Format. -You can revert back to the old behavior by resetting it back to the JSV format with: - -```csharp -PostgreSqlDialect.Provider.StringSerializer = new JsvStringSerializer(); -``` - -### New Global Insert / Update Filters - -Similar to interceptors in some heavy ORM's, new Insert and Update filters were added which get fired just before any **insert** or **update** operation using OrmLite's typed API's (i.e. not dynamic SQL or partial updates using anon types). -This functionality can be used for easily auto-maintaining Audit information for your POCO data models, e.g: - -```csharp -public interface IAudit -{ - DateTime CreatedDate { get; set; } - DateTime ModifiedDate { get; set; } - string ModifiedBy { get; set; } -} - -OrmLiteConfig.InsertFilter = (dbCmd, row) => { - var auditRow = row as IAudit; - if (auditRow != null) - auditRow.CreatedDate = auditRow.ModifiedDate = DateTime.UtcNow; -}; - -OrmLiteConfig.UpdateFilter = (dbCmd, row) => { - var auditRow = row as IAudit; - if (auditRow != null) - auditRow.ModifiedDate = DateTime.UtcNow; -}; -``` - -Which will ensure that the `CreatedDate` and `ModifiedDate` fields are populated on every insert and update. - -### Validation - -The filters can also be used for validation where throwing an exception will prevent the operation and bubble the exception, e.g: - -```csharp -OrmLiteConfig.InsertFilter = OrmLiteConfig.UpdateFilter = (dbCmd, row) => { - var auditRow = row as IAudit; - if (auditRow != null && auditRow.ModifiedBy == null) - throw new ArgumentNullException("ModifiedBy"); -}; - -try -{ - db.Insert(new AuditTable()); -} -catch (ArgumentNullException) { - //throws ArgumentNullException -} - -db.Insert(new AuditTable { ModifiedBy = "Me!" }); //succeeds -``` - -### Custom SQL Customizations - -A number of new hooks were added to provide more flexibility when creating and dropping your RDBMS tables. - -#### Custom Field Declarations - -The new `[CustomField]` can be used for specifying custom field declarations in the generated Create table DDL statements, e.g: - -```csharp -public class PocoTable -{ - public int Id { get; set; } - - [CustomField("CHAR(20)")] - public string CharColumn { get; set; } - - [CustomField("DECIMAL(18,4)")] - public decimal? DecimalColumn { get; set; } -} - -db.CreateTable(); -``` - -Generates and executes the following SQL: - -```sql -CREATE TABLE "PocoTable" -( - "Id" INTEGER PRIMARY KEY, - "CharColumn" CHAR(20) NULL, - "DecimalColumn" DECIMAL(18,4) NULL -); -``` - -#### Pre / Post Custom SQL Hooks when Creating and Dropping tables - -A number of custom SQL hooks were added that allow you to inject custom SQL before and after tables are created or dropped, e.g: - -```csharp -[PostCreateTable("INSERT INTO TableWithSeedData (Name) VALUES ('Foo');" + - "INSERT INTO TableWithSeedData (Name) VALUES ('Bar');")] -public class TableWithSeedData -{ - [AutoIncrement] - public int Id { get; set; } - public string Name { get; set; } -} -``` - -And just like other ServiceStack attributes, they can also be added dynamically, e.g: - -```csharp -typeof(TableWithSeedData) - .AddAttributes(new PostCreateTableAttribute( - "INSERT INTO TableWithSeedData (Name) VALUES ('Foo');" + - "INSERT INTO TableWithSeedData (Name) VALUES ('Bar');")); -``` - -Custom SQL Hooks are now available to execute custom SQL before and after a table has been created or dropped, i.e: - -```csharp -[PreCreateTable(runSqlBeforeTableCreated)] -[PostCreateTable(runSqlAfterTableCreated)] -[PreDropTable(runSqlBeforeTableDropped)] -[PostDropTable(runSqlAfterTableDropped)] -public class Table {} -``` - -### Re-factoring OrmLite's SQLite NuGet Packages - -In their latest release, the SQLite dev team maintaining the [core SQLite NuGet packages](https://www.nuget.org/profiles/mistachkin/) -have added a dependency to Entity Framework on their existing Sqlite NuGet packages forcing the installation of Entity Framework for users of OrmLite Sqlite. -This change also caused some users to see invalid web.config sections after applying the new web.config.transforms. -After speaking to the maintainers they've created a new -[System.Data.SQLite.Core](http://www.nuget.org/packages/System.Data.SQLite.Core) -NuGet package without the entity framework dependency and the problematic web.config.transforms. - -Unfortunately this was only added for their bundled x86/x64 NuGet package and not their other -[System.Data.SQLite.x86](http://www.nuget.org/packages/System.Data.SQLite.x86/) and -[System.Data.SQLite.x64](http://www.nuget.org/packages/System.Data.SQLite.x64/) which the team have indicated should be deprecated -in favor of the x86/x64 bundled **System.Data.SQLite.Core** package. - -As a result of this we're removing the dependency to the Sqlite NuGet packages in both architecture specific -[ServiceStack.OrmLite.Sqlite32](http://www.nuget.org/packages/ServiceStack.OrmLite.Sqlite32/) and -[ServiceStack.OrmLite.Sqlite64](http://www.nuget.org/packages/ServiceStack.OrmLite.Sqlite64/) packages and have -instead embedded the Sqlite binaries directly, which will solve the current issues and shield them from any future changes/updates -from the upstream Sqlite packages. - -#### New ServiceStack.OrmLite.Sqlite.Windows NuGet package - -Both these arch-specific packages should now be deprecated in favour of a new Sqlite NuGet package supporting both x86/x64 architectures on Windows: - - PM> Install-Package ServiceStack.OrmLite.Sqlite.Windows - -Which should now be used for future (or existing) projects previously using the old -[OrmLite.Sqlite32](http://www.nuget.org/packages/ServiceStack.OrmLite.Sqlite32/) and -[OrmLite.Sqlite64](http://www.nuget.org/packages/ServiceStack.OrmLite.Sqlite64/) packages. - -The Windows-specific package was added in addition to our existing Mono and Windows compatible release: - - PM> Install-Package ServiceStack.OrmLite.Sqlite.Mono - -Which works cross-platform on Windows and Linux/OSX with Mono should you need cross-platform support. - -## .NET Service Clients - -New async API's were added for requests marked with returning `IReturnVoid`. -This provides a typed API for executing services with no response that was previously missing, e.g: - -```csharp -public class Request : IReturnVoid {} - -await client.PostAsync(new Request()); -``` - -The API's for all sync and async REST operations have been changed to return `HttpWebResponse` which now lets you query the returned HTTP Response, e.g: -```csharp -HttpWebResponse response = await client.PostAsync(new Request()); -var api = response.Headers["X-Api"]; -``` - -## Authentication - -### New IManageRoles API - -A new [IManageRoles API](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/Auth/IAuthRepository.cs#L26) -was added that IAuthRepository's can implement in order to provide an alternative strategy for querying and managing Users' -Roles and permissions. - -This new API is being used in the `OrmLiteAuthRepository` to provide an alternative way to store -Roles and Permission in their own distinct table rather than being blobbed with the rest of the User Auth data. -You can enable this new behavior by specifying `UseDistinctRoleTables=true` when registering the OrmLiteAuthRepository, e.g: - -```csharp -container.Register(c => -new OrmLiteAuthRepository(c.Resolve()) { - UseDistinctRoleTables = true, -}); -``` - -When enabled, roles and permissions are persisted in the distinct **UserAuthRole** table. -This behavior is integrated with the rest of ServiceStack including the Users Session, RequiredRole/RequiredPermission attributes and the AssignRoles/UnAssignRoles authentication services. -Examples of this can be seen in [ManageRolesTests.cs](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.Common.Tests/ManageRolesTests.cs). - -## [Messaging](https://github.com/ServiceStack/ServiceStack/wiki/Messaging) - -### Flexible Queue Name strategies - -There are now more flexible options for specifying the Queue Names used in [ServiceStack's MQ Servers](https://github.com/ServiceStack/ServiceStack/wiki/Messaging). -You can categorize queue names or avoid conflicts with other MQ services by specifying a global prefix to be used for all Queue Names, e.g: - -```csharp -QueueNames.SetQueuePrefix("site1."); - -QueueNames.In //= site1.mq:Hello.inq -``` - -Or to gain complete control of each queue name used, provide a custom QueueName strategy, e.g: - -```csharp -QueueNames.ResolveQueueNameFn = (typeName, suffix) => - "SITE.{0}{1}".Fmt(typeName.ToLower(), suffix.ToUpper()); - -QueueNames.In //= SITE.hello.INQ -``` - -> Note: Custom QueueNames need to be declared on both MQ Client in addition to ServiceStack Hosts. - -# v4.10 Release Notes - -## Debug Links - -To provide better visibility to the hidden functionality in ServiceStack we've added **Debug Info** links section to the `/metadata` page which add links to any Plugins with Web UI's, e.g: - -![Debug Info Links](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/debug-links.png) - -The Debug Links section is only available in **DebugMode** (recap: set by default in Debug builds or explicitly with `Config.DebugMode = true`). In addition, users with the **Admin** role (or if `Config.AdminAuthSecret` is enabled) can also view the debug Plugins UI's in production. - -You can add links to your own [Plugins](https://github.com/ServiceStack/ServiceStack/wiki/Plugins) in the metadata pages with: - -```csharp -appHost.GetPlugin().AddPluginLink("swagger-ui/", "Swagger UI"); -appHost.GetPlugin().AddDebugLink("?debug=requestinfo", "Request Info"); -``` - -`AddPluginLink` adds links under the **Plugin Links** section and should be used if your plugin is publicly visible, otherwise use `AddDebugLink` for plugins only available during debugging or development. - -## [Auto Mapping](https://github.com/ServiceStack/ServiceStack/wiki/Auto-mapping) - -#### Improved Support for non-POCO types -Previously you could only map between top-level POCO models, now you can map between scalars and collections directly, e.g: - -```csharp -var intVal = 2L.ConvertTo(); -var decimalVal = 4.4d.ConvertTo(); -var usersSet = new[] { new User(1), new User(2) }.ConvertTo>(); -``` - -#### Improved Auto-Mapping Performance - -A better caching strategy is used for conversions paths and now mapping fields utilize cached Delegate expressions so POCO's with fields Map much faster. - -## Async Support - -#### Consistent handling of Async Responses - -Previously Response Filters were called with the Task response returned from async services for the Response DTO, e.g. `Task`. The response filters are now chained to the task so Response filters see the same native `TResponse` DTO that are passed in from Sync services. - -#### Async services can now be used in MQ Servers - -Async responses now block for results which is in-line with sync Services behavior where Message Queue Handlers only process one message at a time for each worker thread assigned to the Request type. - -## NuGet packages specify min versions - -To ensure NuGet pulls the latest dependencies when installing any ServiceStack package, a minimum version is now specified for all NuGet package dependencies. This [should alleviate dependency issues](http://stackoverflow.com/a/21670294/85785) people are seeing from NuGet's default behavior of pulling down old packages. - -# v4.09 Release Notes - -## Rabbit MQ Support - -The biggest feature in this release is ServiceStack's new support for -[hosting Services via a Rabbit MQ Server](https://github.com/ServiceStack/ServiceStack/wiki/Rabbit-MQ), -expanding on our existing [Redis MQ and In Memory messaging](https://github.com/ServiceStack/ServiceStack/wiki/Messaging) options -with a new durable MQ option in the robust and popular [Rabbit MQ](http://www.rabbitmq.com). -ServiceStack's Rabbit MQ support is available on NuGet with: - - PM> Install-Package ServiceStack.RabbitMq - -A new [Rabbit MQ on Windows installation and setup guide](https://github.com/mythz/rabbitmq-windows) was published containing -code samples for working with Rabbit MQ from C#/.NET. - -### Configurable Metadata Pages - -New customizable filters were added to the `MetadataFeature` plugin to allow customization of the Master and detail metadata pages before they're rendered. -E.g. you can reverse the order of operation names with: - -```csharp -var metadata = (MetadataFeature)Plugins.First(x => x is MetadataFeature); -metadata.IndexPageFilter = page => { - page.OperationNames.Sort((x,y) => y.CompareTo(x)); -}; -``` - -### OrmLite new runtime typed API - -The [IUntypedApi](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/src/ServiceStack.OrmLite/IUntypedApi.cs) interface is useful for when you only have access to a late-bound object runtime type which is accessible via `db.CreateTypedApi`, e.g: - -```csharp -public class BaseClass -{ - public int Id { get; set; } -} - -public class Target : BaseClass -{ - public string Name { get; set; } -} - -var row = (BaseClass)new Target { Id = 1, Name = "Foo" }; - -var useType = row.GetType(); -var typedApi = db.CreateTypedApi(useType); - -db.DropAndCreateTables(useType); - -typedApi.Save(row); - -var typedRow = db.SingleById(1); -typedRow.Name //= Foo - -var updateRow = (BaseClass)new Target { Id = 1, Name = "Bar" }; - -typedApi.Update(updateRow); - -typedRow = db.SingleById(1); -typedRow.Name //= Bar - -typedApi.Delete(typedRow, new { Id = 1 }); - -typedRow = db.SingleById(1); //= null -``` - -#### OrmLite Create Table Support - - - Added NonClustered and Clustered options to `[Index]` attribute - -## Breaking changes - -### Messaging - -In order to support Rabbit MQ Server some changes were made to -[ServiceStack's Messaging API](https://github.com/ServiceStack/ServiceStack/wiki/Messaging) to support all MQ options, namely: - - - `IMessageQueueClient` now exposes high-level `IMessage` API's instead of raw `byte[]` - - The `IMessage.Error` property is now a `ResponseStatus` type (same used in Web Services) - - **Ack** / **Nak** APIs were also added to `IMessageQueueClient` - - All MQ Brokers now have a default `RetryCount=1` - -### ServiceStack.Text - - - UrlEncode extension method now encodes spaces with `+` instead of `%20` to match default `HttpUtility.UrlEncode` behavior - -### OrmLite - - - MySql and Sqlite providers now treat GUID's as `char(36)` - -# v4.08 Release Notes - -Added new [ServiceStack/Stripe](https://github.com/ServiceStack/Stripe) GitHub repository containing a PCL typed, message-based API client gateway for [Stripe's REST API](https://stripe.com/docs/api/). Install from NuGet with: - - Install-Package ServiceStack.Stripe - -New in this release: - - - .NET 4.0 build of **ServiceStack.Razor** now available (in addition to .NET 4.5) - - New **Signed** NuGet packages published for - - [ServiceStack.Api.Swagger.Signed](https://www.nuget.org/packages/ServiceStack.Api.Swagger.Signed/) - - [ServiceStack.OrmLite.Oracle.Signed](https://www.nuget.org/packages/ServiceStack.OrmLite.Oracle.Signed/) - - Updated Swagger UI content files - - Added MiniProfiler SqlServerStorage adapter to **ServiceStack.Server** - - The [Razor Rockstars](https://github.com/ServiceStack/RazorRockstars/) and [Social Bootstrap Api](https://github.com/ServiceStack/SocialBootstrapApi/) projects have both been upgraded to v4 - -### OrmLite - - - Enums with `[Flag]` attribute (aka Enum flags) now stored as ints - - `TimeSpan` now stores ticks as longs for all DB providers (Breaking change for Sqlite) - -# v4.06 Release Notes - -## Portable Class Library Clients! - -The biggest feature of this release is the release of the new Portable Client NuGet packages: - -[![Portable Class Library Support](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/release-notes/hello-pcl.png)](https://github.com/ServiceStackApps/HelloMobile) - - - ServiceStack.Interfaces.Pcl - - PCL Profiles: iOS, Android, Windows8, .NET 4.5, Silverlight5, WP8 - - ServiceStack.Client.Pcl - - PCL Profiles: iOS, Android, Windows8, .NET 4.5 - - Custom builds: Silverlight 5 - - ServiceStack.Text.Pcl - - PCL Profiles: iOS, Android, Windows8, .NET 4.5 - - Custom builds: Silverlight 5 - -This now allows sharing binaries between the above platforms. To illustrate this a new [Hello Repository](https://github.com/ServiceStackApps/HelloMobile) was created to show how to use the same portable class libraries and DTO's across the different client platforms above. - -#### Breaking Changes - -Adding PCL support to the client libraries involved a lot of internal re-factoring which caused a few external user-facing changes: - - - The `IDbConnectionFactory` and `IHasDbConnection` interfaces referencing System.Data was moved to ServiceStack.Common - - Properties exposing the concrete `NameValueCollection` are now behind an `INameValueCollection` interface - - Dynamic classes like `DynamicJson` have been moved under the `ServiceStack` namespace - -### Improved SOAP Support - -For maximum compatibility with different SOAP clients, SOAP Exceptions are now treated as "Soft HTTP Errors" where exceptions -are automatically converted to a **200 OK** but returns the original Status Code in the `X-Status` HTTP Response header or `X-Status` SOAP Header. - -Errors can be detected by looking at the X-Status headers or by checking the **ResponseStatus.ErrorCode** property on the Response DTO. -This is transparently handled in ServiceStack's built-in SoapClients which automatically converts Response Errors into populated -C# WebServiceExceptions, retaining the same behavior of ServiceStack's other typed clients, as seen in -[WebServicesTests](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/AlwaysThrowsService.cs#L162). - -IHttpRequest.OperationName now reports the Request DTO name for SOAP requests as well, which it gets from the SOAPAction HTTP Header in SOAP 1.1 requests or the **Action** SOAP Header for SOAP 1.2 Requests. - -# ServiceStack V4 Release Notes - -We're happy to announce that after months of intense development, v4-beta of ServiceStack has finally been released to NuGet! - -As [announced in August](https://plus.google.com/+DemisBellot/posts/g8TcZaE7bv9) to ensure it's continued development, ServiceStack has moved to a self-sustaining commercial model for commercial usage of ServiceStack from **v4+ onwards**. It's the first time we've been able to commit full-time resources to the project and is what has ensured continued investment and enabled v4 to be possible, with even more exciting features in the pipeline and roadmap for 2014. - -## [Introductory Offer](https://servicestack.net/pricing) - -For our early supporters we're launching the new [servicestack.net](https://servicestack.net) website with [attractive introductory pricing](https://servicestack.net/pricing) available during the beta between **33-40% off** royalty-free/per-developer perpetual licensing and **20% off** our unlimited-developers/per-core subscriptions. There's also an additional **60 days free** maintenance and updates covering the beta period, available in 2013. These discounts are intended to be grandfathered-in and carried over for any future renewals, making the v4-beta the best time to get ServiceStack. For US Customers we also have free ServiceStack T-Shirts and stickers whilst stocks last - If you'd like them, add your preferred T-Shirt sizes in the Order notes. - -#### Free Usage for Small and OSS Projects - -We're also happy to announce that v4 includes [free quotas](https://servicestack.net/download#free-quotas) allowing the free usage of all of ServiceStack for small projects and evaluation purposes. Whilst OSS projects are able to use the source code on GitHub under the [AGPL/FOSS License Exception](https://github.com/ServiceStack/ServiceStack/blob/master/license.txt), and the older [v3 of ServiceStack](https://github.com/ServiceStackV3/ServiceStackV3) continues to be available under the [BSD license](https://github.com/ServiceStack/ServiceStack/blob/v3/LICENSE). - -#### Upgrading from v3 - -Whilst we recommend starting with **v4** for greenfield projects, v4 has seen significant changes since v3 that will require some development effort to upgrade. During the upgrade we recommend using a tool like [ReSharper](http://www.jetbrains.com/resharper/) to be able to easily find and update reference of any types that have moved. - -# What's new in v4 - -The major version upgrade of ServiceStack to v4 has provided us a long sought **breaking window** opportunity allowing us to re-factor, simplify, clean-up and fix all the warts and cruft that has been lingering in the ServiceStack code-base since its beginning - that due to backwards compatibility we were reluctant to remove. Whilst v4 has seen significant changes to the code-base, all existing tests are passing again with additional tests added for new functionality. - -We managed to retain a lot of the user-facing API's (E.g New API, AppHost, Config) which were already considered ideal so ideally upgrading shouldn't be too disruptive in the normal use-cases. - -v4 provides us a great foundation to build on that will be further improved during the beta by focusing on stability and fixing any reported issues as well as updating existing documentation to match v4's implementation and publish new examples showcasing v4's new features. - -## The big refactor of v4 - -This was the biggest re-factor in ServiceStack's history which at the end resulted in a much leaner, simplified, consistent and internal logically-structured code-base that's much easier to reason about, where even before adding any features the main ServiceStack repository saw: - - 1,192 changed files with 18,325 additions and 29,505 deletions. - -The number of deletions is indicative of how much legacy code was able to be removed, with much of the internals having been heavily restructured. Some of the highlights during the re-factor include: - - - All projects have been upgraded to .NET 4.0, except ServiceStack.Razor which is .NET 4.5 to use the latest version of Razor - - All obsolete/unused/shims/duplicate functionality and built-up cruft has now been removed (inc. the Old Api). - - State and configuration are now cohesively organized where now all AppHost's share the same `ServiceStackHost` base class which now maintains all state in ServiceStack, inc. the empty `BasicAppHost` that's used for unit testing which now shares much of the same state/context as Integration tests. - - Many namespaces and some concepts have been collapsed (e.g 'Endpoint'), resulting in ServiceStack projects requiring fewer namespaces - - All DTO's and extension methods and common user-facing classes have been moved to the base `ServiceStack` namespace - allowing them to be much easier to find. - - Re-organization of projects, **NuGet packages now map 1:1 with ServiceStack projects** for finer-grained control of dependencies: - + **ServiceStack.Interfaces** NuGet project created and ServiceInterface has been merged into **ServiceStack** - + **ServiceStack** NuGet package now only depends **ServiceStack.Common** and **ServiceStack.Client** - + A new **ServiceStack.Server** project exists for functionality requiring dependencies on OrmLite or Redis, inc. RedisMqServer and OrmLiteAuthRepository. - + **ServiceStack.Client** contains all the HTTP, SOAP and MQ Service Clients that have been split from **ServiceStack.Common** and only depends on ServiceStack.Interfaces and ServiceStack.Text (making it easier to maintain custom builds in future). - - EndpointHostConfig is now `HostConfig` and is limited to just Configuration, e.g. handlers like `CustomErrorHttpHandlers`, `RawHttpHandlers`, `GlobalHtmlErrorHttpHandler` have been moved to ServiceStackHost. - - EndpointHost is gone and replaced by the static `HostContext` class which doesn't contain any state itself, it's just a static convenience wrapper around `ServiceStackHost.Instance` (where all state is maintained). - - Removed all 'where T:' constraints where possible - - Removed `ConfigurationResourceManager`, use `AppSettings` instead - - The `ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory` used in Web.config's handler mapping has been renamed to just `ServiceStack.HttpHandlerFactory` - - `Config.ServiceStackHandlerFactoryPath` has been renamed to `Config.HandlerFactoryPath`. - - Predefined routes have been renamed from `/syncreply`, `/asynconeway` to just `/reply`, `/oneway` - - ServiceManager has been merged into `ServiceController`. - - The **ServiceStack.Logging** and **ServiceStack.Contrib** v4 projects have been merged into the major ServiceStack repo. - - The dynamic session `base.Session` has been renamed to `base.SessionBag` to better reflect its semantics. - - The [Auto Mapping](https://github.com/ServiceStack/ServiceStack/wiki/Auto-mapping) Utils extension methods were renamed from `TFrom.TranslateTo()` to `TFrom.ConvertTo()`. - - The `RequestFilters` and `ResponseFilters` were renamed to `GlobalRequestFilters` and `GlobalResponseFilters` which matches naming in the client `ServiceClientBase.GlobalRequestFilter`. - - New `GlobalMessageRequestFilters` and `GlobalMessageResponseFilters` have been added which are instead used by non-HTTP endpoints use, e.g. MQ. - - `CustomHttpHandlers` has been renamed to `CustomErrorHttpHandlers` - - The **LocalHttpWebRequestFilter** and **LocalHttpWebResponseFilter** in the Service Clients were renamed to just `RequestFilter` and `ResponseFilter` - - The Global **HttpWebRequestFilter** and **HttpWebResponseFilter** filters were also renamed to `GlobalRequestFilter` and `GlobalResponseFilter` respectively. - -### RequestContext now merged into new IRequest / IResponse classes: - -An annoyance remaining in the ServiceStack code-base was RequestContext and its relationship with its IHttpRequest and IHttpResponse classes. This was originally modeled after ASP.NET's relationship with HttpContext and its child HttpRequest/HttpResponse classes. Pragmatically speaking this model isn't ideal, as there was functionality spread across all 3 classes, many times duplicated. It was also not obvious how to retrieve IHttpRequest/IHttpResponse classes from a RequestContext and creating a RequestContext from outside of ServiceStack required more knowledge and effort than it should have. - -The new model adopts a flattened structure similar to Dart's server HttpRequest (http://bit.ly/19WUxLJ) which sees the `IRequestContext` eliminated in favour of a single `IRequest` class that also makes available direct access to the Response. - -This now becomes much easier to create a Request from outside of ServiceStack with an ASP.NET or HttpListener HttpContext e.g: - -```csharp -var service = new MyService { - Request = HttpContext.Current.ToRequest() -} - -var service = new MyService { - Request = httpListenerContext.ToRequest() -} -``` - -There's also direct access to the Response from a Request with: - -```csharp -IResponse response = Request.Response; -``` - -#### ASP.NET wrappers now only depends on HttpContextBase - -Also the ASP.NET `IHttpRequest` wrappers bind to the newer and mockable HttpContextBase / HttpRequestBase / HttpResponseBase classes which now makes it easier to call services from newer web frameworks like MVC with: - -```csharp -var service = new MyService { - Request = base.HttpContext.ToRequest() -} -``` - -The biggest user-facing change was renaming the IHttpRequest/IHttpResponse classes to IRequest/IResponse which is more indicative to what they represent, i.e. the Request and Response classes for all endpoints including MQ and future TCP endpoints. Now only HTTP Requests implement IHttpRequest/IHttpResponse which lets you add logic targeting only HTTP Services with a simple type check: - -```csharp -var httpReq = request as IHttpRequest; -if (httpReq != null) { - //Add logic for HTTP Requests... -} -``` - -Accessing the IHttpResponse works the same way, e.g: - -```csharp -var httpRes = Request.Response as IHttpResponse; -if (httpRes != null) { - //... -} -``` - -We're still going to add extension methods on IRequest/IResponse to make it easier to discover new functionality, but for HTTP functionality on non-HTTP requests these would just be a NO-OP rather than throw an exception. - -### Community v4 migration notes - - - [Upgrading Servicestack to 4.0 – Notes](http://www.binoot.com/2014/02/23/upgrading-servicestack-to-4-0-notes/) by [@binu_thayamkery](https://twitter.com/binu_thayamkery) - - [Upgrading OrmLite and ServiceStack to v4](http://camtucker.blogspot.ca/2014/01/updating-to-servicestack-v40.html?view=classic) by [@camtucker](http://camtucker.blogspot.ca/) - ----- - -# New Features in v4 - - -## Server-side Async Support - -The [most requested feature](http://bit.ly/16qCiy1), Server-side async support has now been implemented! This was surprisingly easy to do where now all HttpHandlers in ServiceStack inherit from a common `HttpAsyncTaskHandler` base class that now implements `IHttpAsyncHandler`. This lets you return an async Task from your Service in any number of ways as shown in http://bit.ly/1cOJ3hR - -E.g. Services can now have either an object, Task or async Task return types that can return a started or non-started task (which we'll start ourselves). This transition went as smooth as it could where all existing services continuing to work as before and all tests passing. - -## [ServiceStack Client](https://github.com/ServiceStack/ServiceStack/wiki/C%23-client) Task-based Async - -In matching the new server-side async story and now that all projects have been upgraded to .NET 4.0, all Service Clients have been changed to return .NET 4.0 Task's for all async operations so they can be used in C#'s async/await methods. Some examples of Async in action: http://bit.ly/17ps94C - -The Async API's also provide a **OnDownloadProgress** callback which you can tap into to provide a progress indicator in your UI, E.g: http://bit.ly/19ALXUW - -#### Use any Request DTO in Client API's - -ServiceClient API's that used to only accept Request DTO's with a `IReturn` marker, now have `object` overloads so they can be used for unmarked Request DTO's as well. - -### Custom Silverlight and Android builds - -We've added custom **Silverlight** and **Android** automated builds for ServiceStack.Client allowing the client libraries to be available in even more environments - with more to follow. - -## Signed NuGet Packages - -The following Signed NuGet packages are available for core ServiceStack projects in separate NuGet packages using the .Signed suffix: - - - ServiceStack.Client.Signed - - ServiceStack.Text.Signed - - ServiceStack.Redis.Signed - - ServiceStack.OrmLite.Signed - - ServiceStack.OrmLite.SqlServer.Signed - - ServiceStack.ServiceStack.Signed - - ServiceStack.ServiceStack.Razor.Signed - - ServiceStack.ServiceStack.Server.Signed - - ServiceStack.Common.Signed - -### ServiceStack.Interfaces is now strong-named - -In order to be able to have signed clients sharing types with non-signed ServiceStack instances, the DTO models and ServiceStack.Interfaces need to be signed. It was added in the most defensive way possible where **ServiceStack.Interfaces.dll** is the only dll that's strong-named by default. This should cause minimal friction as it is an impl-free assembly that rarely sees any changes. We're also keeping the AssemblyVersion which makes up the strong-name at a constant `4.0` whilst the benign AssemblyFileVersion will report the true version number. - -### Add Code-first Attributes at runtime, de-coupled from POCO's - -Inspection of all Metadata attributes in ServiceStack now uses ServiceStack.Text's attribute reflection API's which support adding of type and property metadata attributes dynamically. This now lets you add the same behavior normally only available via attributes, dynamically at StartUp. Some benefits of this include: being able to keep [unattributed data model POCOs in OrmLite](http://bit.ly/1e5IQqS) or to [extend built-in and external Request DTOs and Services](https://github.com/ServiceStack/ServiceStack/blob/d93ad805c8c8ffce8e32365e4217c65c19069cf0/tests/ServiceStack.WebHost.Endpoints.Tests/RuntimeAttributeTests.cs) with enhanced functionality that was previously only available using attributes. - -#### Fluent route configuration available in [Reverse Routing](https://github.com/ServiceStack/ServiceStack/wiki/Routing#reverse-routing) - -Leveraging the dynamic attribute support, we now include fluent Route definitions when retrieving relative or absolute urls in [Reverse Routing](https://github.com/ServiceStack/ServiceStack/wiki/Routing#reverse-routing), which can be used in Services when returning urls in responses and is also used in Service Clients to determine which routes to use. Note: as Fluent Routes are defined in the AppHost, they aren't registered and therefore not available in disconnected .NET client applications - so using `[Route]` attributes on Request DTO's remains the best way to share route definitions on both client and server. - -Priority was added to `[Route]` attributes so auto-generated routes are given less precedence than explicit user-defined custom routes when selecting the best matching route to use. - -### The Virtual FileSystem - -The Virtual FileSystem is now fully integrated into the rest of ServiceStack, this enables a few interesting things: - - - The `Config.WebHostPhysicalPath` sets where you want physical files in ServiceStack to be served from - - You can now access static files when ServiceStack is mounted at a custom path, e.g. /api/default.html will serve the static file at ~/default.html - - By Default, ServiceStack falls back (i.e when no physical file exists) to looking for Embedded Resource Files inside dlls. - - You can specify the number and precedence of which Assemblies it looks at with `Config.EmbeddedResourceSources` which by default looks at: - - The assembly that contains your AppHost - - **ServiceStack.dll** - -The VFS now elegantly lets you replace built-in ServiceStack templates with your own by simply copying the metadata or [HtmlFormat Template files](http://bit.ly/164YbrQ) you want to customize and placing them in your folder at: - - /Templates/HtmlFormat.html // The auto HtmlFormat template - /Templates/IndexOperations.html // The /metadata template - /Templates/OperationControl.html // Individual operation template - -This works because the ServiceStack.dll is the last assembly in `Config.EmbeddedResourceSources`. - -## API-first development - -We're starting to optimize ServiceStack's HTML story around an **API-first** style of web development (particularly well suited to ServiceStack) in which services are developed so they naturally support both web and native clients from the start. Effectively this means that the HTML views are just another client that escapes C# earlier and leverages JS+Ajax to provide its dynamic functionality, and any HTML-specific functionality is encouraged to be kept in Razor views rather than using post backs to generate different server-side HTML representations. - -Having developed the new [servicestack.net website](https://servicestack.net) in this way, we've found it to be a lot more productive and responsive than standard server-side MVC development that we we're accustomed to in .NET as JavaScript ends up being more mallable and flexible language with a smaller and reflective surface type area making it better suited in string manipulation, generating HTML views, consuming ajax services, event handling, DOM binding and manipulation, etc. - -We've begun taking advantage of the Virtual FileSystem to ship embedded resources enhancing ServiceStack's JS integration with client-side libraries like [ss-utils.js](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/js/ss-utils.js) that we maintain and update alongside the rest of ServiceStack's dlls. Whilst we intend to create more examples in the near future showcasing this functionality, here's an overview of what's been added: - - - ss-utils.js available in your local ServiceStack webhost at `/js/ss-utils.js` - - Inspired by AngularJS we've added **declarative** support over jQuery, letting you declaratively register and trigger events, bind values to HTML elements, register document handlers, etc, saving a lot of boilerplate than normal jQuery (more on this soon) - - Enhanced HTML forms with integration with ServiceStack validation, adds responsive UX/behavior, follows soft redirects - - Server-side responses can be decorated with Soft redirects with `HttpResult.SoftRedirect` or client events with `HttpResult.TriggerEvent` - - Use `("a").setActiveLinks()` to automatically set the active link and containing menu items for the current page - - Use `$("input").change($.ss.clearAdjacentError)` to clear highlighted errors as users correct their inputs - - Use `T.AsRawJson()` extension method to serialize C# models into JSON literals that are natively accessible in JS - - Use `T.ToGetUrl()`, `T.ToPostUrl()` to resolve service urls from typed Request DTOs (no code-gen required) - -## Improved Razor Support - -#### Improved Server-side validation - -The server-side validation story has also been improved with MVC's HTML INPUT and Validation Helpers rewritten to look at ServiceStack error responses (earlier lost in the upgrade to Razor 2.0) and making use of the same bootstrap conventional classes that the client-side Ajax validation uses letting you maintain a single style of error feedback for both validation styles. It also now looks at state contained in the POST'ed data when rendering the HTML INPUT controls. - -#### Fallback Routes - -The default Razor views are now also processed by the `FallbackRoute` if one exists, enhancing the story for Single Page Apps who want requests to un-specified routes to be handled by client-side routing instead of returning 404's. - -#### Pre-Request filters - -Direct (i.e. No Controller) Razor views and static file handlers now have pre-request filters applied to them, so they can be used for adding global behavior across all ServiceStack service and page requests. - -#### Precompilation option for Razor Views - -New options have been added to RazorFormat `PrecompilePages` and `WaitForPrecompilationOnStartup` that allow you to precompile razor views on startup and specify whether or not you want to wait for compilation to complete are now options available when registering the `RazorFormat`. As these can slow down dev iteration times they are not done when `Config.DebugMode` (aka development mode), but are otherwise enabled by default for production. - -#### Other Razor Improvements - - - More functionality was added to Razor Views matching the same API's available in ServiceStack's base `Service` class - - RenderSection/IsSectionDefined now looks in all connected views. - - `GetAbsoluteUrl`, `IsPostBack`, `GetErrorStatus()`, `GetErrorMessage()` convience methods added - -### CORS Feature - -CorsFeature now by default automatically handles all HTTP `OPTIONS` requests so you no longer have to explicitly allow for OPTION requests in your routes: http://bit.ly/19HbMVf - -Can be disabled with: - -```csharp -Plugins.Add(new CorsFeature { AutoHandleOptionsRequests = false }) -``` - -## Authentication - -The Auth Tables are now called **UserAuth** and **UserAuthDetails** and implements the IUserAuth and IUserAuthDetails interfaces. For advanced customization, these tables can now be extended using custom models inheriting these interfaces by using the generic AuthRepository types, e.g: - - - OrmLiteAuthRepository - - RedisAuthRepository - -Where the common non-generic **OrmLiteAuthRepository** is just a concrete impl inheriting from `OrmLiteAuthRepository`. Use `InitSchema()` to ensure missing Auth Tables are created at registration. - -#### New optional UserAuthRole table added - -A new `UserAuthRole` class was created for users who would prefer roles to be managed in separate tables rather than blobbed with the UserAuth table and session. E.g. You can change your custom session to check the database for asserting required users and permissions with: - -```csharp -public class CustomUserSession : AuthUserSession -{ - public override bool HasRole(string role) - { - using (var db = HostContext.TryResolve().Open()) - { - return db.Count(q => - q.UserAuthId == int.Parse(UserAuthId) && q.Role == role) > 0; - } - } - - public override bool HasPermission(string permission) - { - using (var db = HostContext.TryResolve().Open()) - { - return db.Count(q => - q.UserAuthId == int.Parse(UserAuthId) && q.Permission == permission) > 0; - } - } -} -``` - -#### Support for Max Login Attempts - -The `OrmLiteAuthRepository` now supports automatically locking out user accounts after reaching the maximum number of Login attempts which can be specified at registration, e.g: - -```csharp -container.Register(c => - new OrmLiteAuthRepository(c.Resolve()) { - MaxLoginAttempts = appSettings.Get("MaxLoginAttempts", 5) - }); -``` - -To opt-in to use the new locking behavior provide a value for `MaxLoginAttempts` as shown above. The above registration first uses the value overridable in appSettings if it exists, otherwise it defaults to a Maximum of 5 login attempts. - -#### Adhoc locking of User Accounts - -The `CredentialsAuthProvider` also supports locking user accounts by populating the `UserAuth.LockedDate` column with a non-null value. Set it back to null to unlock the account. - -#### Initializing Auth Repository Schemas - -Some Auth Repositories like OrmLite require an existing schema before they can be used, this can be done in the AppHost with: - -```csharp -//Create missing Auth Tables in any Auth Repositories that need them -container.Resolve().InitSchema(); -``` -This was previously named `CreateMissingTables()` and is safe to always run as it's a NO-OP for Auth repositories that don't require a schema and only creates missing tables, so is idempotent/non-destructive on subsequent runs. - -#### New AuthWeb Test project - -A new test project testing all Authentication providers within the same ServiceStack ASP.NET Web Application is in [ServiceStack.AuthWeb.Tests](https://github.com/ServiceStack/ServiceStack/tree/master/tests/ServiceStack.AuthWeb.Tests). - -### AppSettings - -AppSettings can now be passed a tier in the constructor, e.g. `new AppSettings(tier: "Live")` which it uses as a prefix to reference Tier-specific appSettings first, e.g: - - - -Before falling back to the common key without the prefix, i.e: - - - -AppSettings now allows a Parsing Strategy, e.g. You can collapse new lines when reading a complex configuration object in Web.Config `` with: - -```csharp -var appSettings = new AppSettings { - ParsingStrategy = AppSettingsStrategy.CollapseNewLines -}; -``` - -### Nested Request DTOs - -Using [nested types as Request DTO's](https://github.com/ServiceStack/ServiceStack/commit/376ca38f604214f4d12e2f7803d8e7cfc271b725) are now supported. -Nested Request DTO types include the names of their containing class to form their unique name, allowing the use of multiple nested types with the same name, which is potentially interesting to be used as a versioning strategy. - -### Localized symbols - -I've added `IAppHost.ResolveLocalizedString` support in [this commit](http://bit.ly/181q0eP) which lets you override the built-in English symbols used in ServiceStack, e.g. this lets you change built-in ServiceStack routes, e.g: `/auth`, `/assignroles`, `?redirect=`, etc. into something more appropriate for your language. - -## Other New Web Framework Features - - - Added convenient [Repository and Logic base classes](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/ILogic.cs) to reduce boilerplate when extracting logic from services into custom classes - - Added `IAppHost.OnExceptionTypeFilter` to be able to customize ResponseStatus based on Exception types. Used to change the [default behavior of ArgumentExceptions](https://github.com/ServiceStack/ServiceStack/commit/17985239ed6f84b3126c651dbacd0c760a4d2951) so that they're converted to field errors - - Added `IAppHost.OnServiceException` so service exceptions can be intercepted and converted to different responses - - Add `ConvertHtmlCodes` extension method converting HTML entities to hex-encoded entities - - Add `Config.ScanSkipPaths` option to skip any plugins using the VFS to scan the filesystem (e.g. Razor/Markdown feature) from scanning specified directories, `/bin/` and `/obj/` are added by default. - - Added a pre-defined `/swagger-ui/` route that loads the Swagger UI and auto configures it to look at ServiceStack services. A link to this is on the metadata page under **Plugin Links** heading. - - Added `ModelFilter` and `ModelPropertyFilter` to allow fine-grained custom control on what's displayed in the Swagger API - - Wrappers around .NET's JSON and XML DataContract Serializers now share the same `IStringSerializer` interface - - Added ToMsgPack/FromMsgPack and ToProtoBuf/FromProtoBuf extension methods - - Improved support for stripping App Virtual Paths when Resolving Absolute Urls useful when applications are hosted with virtual app paths as done in Amazon Web Services. This behavior can be enabled with `Config.StripApplicationVirtualPath = true`. - - Support for explicitly referencing ignored DTO properties in Route PathInfo definitions, but not QueryStrings - - Add support for getting Id property from runtime object type - - Added support for registering a singleton instance as a runtime type - - Added new [IRestGateway](https://github.com/ServiceStack/ServiceStack/commit/29d60dfa22424fe20ba35c8603686c05f88a6c25) interface that typed 3rd Party gateways can use to retain a consistent and mockable interface. Specialized MockRestGateway added to stub or mock out gateways to 3rd Party services - - `__requestinfo` is now available on any request with `?debug=requestinfo` and is accessible to administrators or when in **DebugMode**, and provides in-depth diagnostics about the details of the current request and the configured AppHost including Startup errors (if any). - - Plugins can register startup exceptions with `IAppHost.NotifyStartupException` - - Added new HTTP Headers on IHttpRequest for `XForwardedPort` and `XForwardedProtocol` - - Added `[EnsureHttps]` Request Filter to automatically redirect request if service was not requested under a Secure Connection with options to **SkipIfDebugMode** or **SkipIfXForwardedFor** to allow local development and requests via proxies / load-balancers in HTTP. - - Users in the **Admin** role have super-user access giving them access to all protected resources. You can also use `Config.AdminAuthSecret` to specify a special string to give you admin access without having to login by adding `?authsecret=xxx` to the query string. - ------ - -## OrmLite - -### Improved Consistency - -As the API surface of OrmLite expands it became a lot more important to focus on better consistency which now sees all alternative aliases having been removed in favor of standardized naming around SQL equivalents (e.g Select,Insert,etc). Also the parameterized APIs and the C#-like string.Format API's have now been merged with the parameterized APIs now being the default and the string.Format API having a 'Fmt' suffix. - -Most of these APIs now have XML docs and Examples for a better Intelli-sense experience. We've also provided them in a list along side it's generated SQL in [these API tests](http://bit.ly/1gmrnwe) - -Some notes: - - - `Select` returns a List - - `Single` returns 1 row (or null) if it doesn't exist - - `Scalar` returns a single a scalar value (e.g. int, long) - - `Where` is a short-hand for 'Select' that takes a single filter - - `Count` is a convenience that performs an aggregate SQL Count - - `Exists` returns true if there were any results - - `Lazy` suffix indicates the results are lazily streamed - - `Column` returns the first column results in a List - - `ColumnDistinct` returns the first column unique results in a HashSet - - `Dictionary` returns a Dictionary made up from the first 2 columns - - `Lookup` returns a LINQ-like grouping in a Dictionary> - - `NonDefaults` suffix indicates only non-null values are used in qry - - `Only` suffix allows you to specify fields used on the call-site - - `Sql` prefix are helpers for reading and querying arbitrary raw SQL - - `Save` is a convenience that inserts or updates depending if it exists or not. It also now populates AutoIncrementing Id's on Inserts. - - All batch operations like `InsertAll`, `UpdateAll`, `DeleteAll`, `SaveAll` participate in an existing transaction if 1 exists, otherwise a new one - - Removed all 'where T:' constraints where possible - - `OrDefault` APIs removed, All APIs now return null instead of throwing - - autoDisposeConnection removed. false for ":memory:" otherwise true - - Now that all OrmLite's parameterized `Query*` APIs have been merged (above), any `Query` APIs are from Dapper's extension method, which is also included in OrmLite under ServiceStack.OrmLite.Dapper namespace. - - All remaining OrmLIte Attributes have been moved to ServiceStack.Interfaces, which in future will be the only dependency needed by your data models and DTOs. - -### OrmLite extension methods are now mockable - -OrmLite API's can now be mocked by injecting a ResultsFilter letting you mock the results return by OrmLite which it will use instead of hitting the database. You can also mock with a filter function and it also supports nesting, see examples at: http://bit.ly/1aldecK - -This will be useful in Unit Testing Services that access OrmLite directly instead of using a repository. - -### Support for references, POCO style - -We've added a cool new feature to Store and Load related entities that works great on POCO which are enabled when you use the `[Reference]` attribute, e.g: http://bit.ly/1gmvtV6 - -Unlike normal complex properties in OrmLite: - - - Doesn't persist as complex type blob - - Doesn't impact normal querying - - Saves and loads references independently from itself - - Populated references get serialized in Text serializers (only populated are visible). - - Data is only loaded 1-reference-level deep - - Reference Fields require consistent `(T)Id` naming - -Basically it provides a better story when dealing with referential data that doesn't impact the POCO's ability to be used as DTO's. At the moment it's limited to loading and saving on a Single instance. We'll look at optimizations for batches on this in future. - -We're going to be giving OrmLite a lot more attention from now on given that we're working full-time on ServiceStack and are using it exclusively for our .NET RDBMS peristence. We also intend on adding specialized support to take advantage of PostgreSQL's new features like their HStore and native JSON support. PostgreSQL has been offering the best features of both RDBMS and NoSQL worlds lately and has recently become a particularly attractive option now that AWS is offering first-class support for PostgreSQL in both their RDS and Redshift services. - ------ -## ServiceStack.Text - - - Allow adding metadata attributes to types or attributes at runtime - - Add JsConfig.ExcludeTypes option to skip serialization of non-serializable properties like Streams - - Change QueryString's to also adopt the configured `JsConfig.PropertyConvention` and `JsConfig.EmitLowercaseUnderscoreNames` behavior - - Added an injectable ComplexTypeStrategy to the QueryStringSerializer that allows customizing the generation of complex types, e.g. can use a hash literal notation strategy with `QueryStringStrategy.FormUrlEncoded`. - - Added `typeof(T).New()` extension method providing a fast way of creating new instances of static or runtime types that will use factory functions registered in the centralized `JsConfig.ModelFactory` (if configured). - - The string "on" (i.e. the default value for HTML checkbox) is considered a **true** value for booleans (same with '1') - - The JSON serializers can be configured to support UnixTime and UnixTimeMs for DateTime's - - Renamed JsonDateHandler to `DateHandler` and JsonPropertyConvention to `PropertyConvention` - -### HTTP Utils are now mockable - -Following in the steps of now being able to Mock OrmLite, the [HTTP Utils](https://github.com/ServiceStack/ServiceStack/wiki/Http-Utils) extension methods (http://bit.ly/WyV2tn) are now mockable, e.g: - - using (new HttpResultsFilter { - StringResult = "mocked" - }) - { - //All return "mocked" - "http://google.com".GetJsonFromUrl(); - "http://google.com".GetXmlFromUrl(); - "http://google.com".GetStringFromUrl(accept: "text/csv"); - "http://google.com".PostJsonToUrl(json: "{\"postdata\":1}"); - } - -More examples showing how all HTTP Apis can be mocked are at: http://bit.ly/HdWmgm - ------ - -## New pre-release MyGet Feeds - -Instead of publishing pre-release packages on NuGet, we're instead going to release our interim packages to [MyGet](https://www.myget.org/) first which provides greater control and allows better management of packages. - -The Instructions to add ServiceStack's MyGet feed to VS.NET are: - - 1. Go to Tools -> Options -> Package Manager -> Package Sources - 2. Add the Source **https://www.myget.org/F/servicestack** with the name of your choice, e.g. _ServiceStack MyGet feed_ - ------ - -## [Older v3 Release Notes](https://github.com/ServiceStack/ServiceStack/wiki/Release-Notes-v3) diff --git a/src/.nuget/NuGet.config b/src/.nuget/NuGet.config index 67f8ea046ef..fe6a62c920d 100644 --- a/src/.nuget/NuGet.config +++ b/src/.nuget/NuGet.config @@ -3,4 +3,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/.nuget/NuGet.exe b/src/.nuget/NuGet.exe old mode 100644 new mode 100755 index ed2b0a22192..856263ded82 Binary files a/src/.nuget/NuGet.exe and b/src/.nuget/NuGet.exe differ diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 00000000000..5e8bf6fc362 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,50 @@ + + + + 5.9.2 + ServiceStack + ServiceStack, Inc. + © 2008-2019 ServiceStack, Inc + true + https://github.com/ServiceStack/ServiceStack + https://servicestack.net/terms + https://servicestack.net/img/logo-64.png + https://docs.servicestack.net/release-notes-history + git + https://github.com/ServiceStack/ServiceStack.git + embedded + latest + true + true + false + + + + true + true + + + + $(DefineConstants);NET45 + True + False + ../servicestack.snk + + + + $(DefineConstants);NETSTANDARD;NETSTANDARD2_0 + + + + $(DefineConstants);NETSTANDARD;NETSTANDARD2_1 + + + + + + + + DEBUG + + + diff --git a/src/ServiceStack.Android.sln b/src/ServiceStack.Android.sln deleted file mode 100644 index 4313e911556..00000000000 --- a/src/ServiceStack.Android.sln +++ /dev/null @@ -1,32 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Client.Android", "ServiceStack.Client\ServiceStack.Client.Android.csproj", "{42E1C8C0-A163-44CC-92B1-8F416F2C0B01}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Interfaces.Android", "ServiceStack.Interfaces\ServiceStack.Interfaces.Android.csproj", "{854FB3DA-8C75-4DCC-B96E-FBD36A7AF2BC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.Android", "..\..\ServiceStack.Text\src\ServiceStack.Text\ServiceStack.Text.Android.csproj", "{579B3FDB-CDAD-44E1-8417-885C38E49A0E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Debug|Any CPU.Build.0 = Debug|Any CPU - {42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Release|Any CPU.ActiveCfg = Release|Any CPU - {42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Release|Any CPU.Build.0 = Release|Any CPU - {854FB3DA-8C75-4DCC-B96E-FBD36A7AF2BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {854FB3DA-8C75-4DCC-B96E-FBD36A7AF2BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {854FB3DA-8C75-4DCC-B96E-FBD36A7AF2BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {854FB3DA-8C75-4DCC-B96E-FBD36A7AF2BC}.Release|Any CPU.Build.0 = Release|Any CPU - {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/ServiceStack.AndroidIndie.sln b/src/ServiceStack.AndroidIndie.sln deleted file mode 100644 index 278dd57512f..00000000000 --- a/src/ServiceStack.AndroidIndie.sln +++ /dev/null @@ -1,32 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Interfaces.AndroidIndie", "ServiceStack.Interfaces\ServiceStack.Interfaces.AndroidIndie.csproj", "{42E1C8C0-A163-44CC-92B1-8F416F2C0B01}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Client.AndroidIndie", "ServiceStack.Client\ServiceStack.Client.AndroidIndie.csproj", "{923E3732-3AEE-42B3-96AB-D3235DAADD48}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.AndroidIndie", "..\..\ServiceStack.Text\src\ServiceStack.Text\ServiceStack.Text.AndroidIndie.csproj", "{579B3FDB-CDAD-44E1-8417-885C38E49A0E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Debug|Any CPU.Build.0 = Debug|Any CPU - {42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Release|Any CPU.ActiveCfg = Release|Any CPU - {42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Release|Any CPU.Build.0 = Release|Any CPU - {923E3732-3AEE-42B3-96AB-D3235DAADD48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {923E3732-3AEE-42B3-96AB-D3235DAADD48}.Debug|Any CPU.Build.0 = Debug|Any CPU - {923E3732-3AEE-42B3-96AB-D3235DAADD48}.Release|Any CPU.ActiveCfg = Release|Any CPU - {923E3732-3AEE-42B3-96AB-D3235DAADD48}.Release|Any CPU.Build.0 = Release|Any CPU - {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/ServiceStack.Api.OpenApi/OpenApiFeature.cs b/src/ServiceStack.Api.OpenApi/OpenApiFeature.cs new file mode 100644 index 00000000000..d26359685e1 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/OpenApiFeature.cs @@ -0,0 +1,189 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using ServiceStack.Host.Handlers; +using ServiceStack.IO; +using ServiceStack.Api.OpenApi.Specification; +using ServiceStack.Auth; + +namespace ServiceStack.Api.OpenApi +{ + public class OpenApiFeature : IPlugin, IPreInitPlugin, Model.IHasStringId + { + public string Id { get; set; } = Plugins.OpenApi; + /// + /// Gets or sets pattern to filter available resources. + /// + public string ResourceFilterPattern { get; set; } + + public bool UseCamelCaseSchemaPropertyNames { get; set; } + + public bool UseLowercaseUnderscoreSchemaPropertyNames { get; set; } + + public bool DisableAutoDtoInBodyParam { get; set; } + + public string LogoUrl { get; set; } + + public string LogoHref { get; set; } + + public Action ApiDeclarationFilter { get; set; } + + /// + /// Operation filter. Action takes a verb and operation as parameters + /// + public Action OperationFilter { get; set; } + + public Action SchemaFilter { get; set; } + + public Action SchemaPropertyFilter { get; set; } + + public List Tags { get; set; } + + public List AnyRouteVerbs { get; set; } + + public List InlineSchemaTypesInNamespaces { get; set; } + + public bool DisableSwaggerUI { get; set; } + + public Dictionary SecurityDefinitions { get; set; } + + public Dictionary> OperationSecurity { get; set; } + + public bool UseBearerSecurity + { + set + { + SecurityDefinitions = new Dictionary { + { "Bearer", new OpenApiSecuritySchema { + Type = "apiKey", + Name = "Authorization", + In = "header", + } } + }; + OperationSecurity = new Dictionary> { + { "Bearer", new List() } + }; + } + } + + public bool UseBasicSecurity + { + set + { + SecurityDefinitions = new Dictionary { + { "basic", new OpenApiSecuritySchema { Type = "basic" } } + }; + OperationSecurity = new Dictionary> { + { "basic", new List() } + }; + } + } + + public OpenApiFeature() + { + Tags = new List(); + AnyRouteVerbs = new List { HttpMethods.Get, HttpMethods.Post, HttpMethods.Put, HttpMethods.Delete }; + InlineSchemaTypesInNamespaces = new List(); + } + + public void BeforePluginsLoaded(IAppHost appHost) + { + appHost.Config.EmbeddedResourceSources.Add(typeof(OpenApiFeature).Assembly); + } + + public void Register(IAppHost appHost) + { + if (ResourceFilterPattern != null) + OpenApiService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled); + + if (SecurityDefinitions == null && OperationSecurity == null) + { + var useBasicAuth = appHost.GetPlugin()?.AuthProviders + ?.Any(x => x.Provider == AuthenticateService.BasicProvider) == true; + if (!useBasicAuth) + UseBearerSecurity = true; + else + UseBasicSecurity = true; + } + + OpenApiService.UseCamelCaseSchemaPropertyNames = UseCamelCaseSchemaPropertyNames; + OpenApiService.UseLowercaseUnderscoreSchemaPropertyNames = UseLowercaseUnderscoreSchemaPropertyNames; + OpenApiService.DisableAutoDtoInBodyParam = DisableAutoDtoInBodyParam; + OpenApiService.ApiDeclarationFilter = ApiDeclarationFilter; + OpenApiService.OperationFilter = OperationFilter; + OpenApiService.SchemaFilter = SchemaFilter; + OpenApiService.SchemaPropertyFilter = SchemaPropertyFilter; + OpenApiService.AnyRouteVerbs = AnyRouteVerbs.ToArray(); + OpenApiService.InlineSchemaTypesInNamespaces = InlineSchemaTypesInNamespaces.ToArray(); + OpenApiService.SecurityDefinitions = SecurityDefinitions; + OpenApiService.OperationSecurity = OperationSecurity; + + appHost.RegisterService(typeof(OpenApiService), "/openapi"); + + if (!DisableSwaggerUI) + { + var swaggerUrl = "swagger-ui/"; + + appHost.GetPlugin() + .AddPluginLink(swaggerUrl, "Swagger UI"); + + appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) => + { + IVirtualFile indexFile; + IVirtualFile patchFile = null; + IVirtualFile patchPreLoadFile = null; + switch (pathInfo) + { + case "/swagger-ui/": + case "/swagger-ui/default.html": + indexFile = appHost.VirtualFileSources.GetFile("/swagger-ui/index.html"); + patchFile = appHost.VirtualFileSources.GetFile("/swagger-ui/patch.js"); + patchPreLoadFile = appHost.VirtualFileSources.GetFile("/swagger-ui/patch-preload.js"); + break; + default: + indexFile = null; + break; + } + if (indexFile != null) + { + var html = indexFile.ReadAllText(); + var injectJs = patchFile?.ReadAllText(); + var injectPreloadJs = patchPreLoadFile?.ReadAllText(); + + return new CustomResponseHandler((req, res) => + { + res.ContentType = MimeTypes.HtmlUtf8; //use alt HTML ContentType so it's not overridden when Feature.Html is removed + var resourcesUrl = req.ResolveAbsoluteUrl("~/openapi"); + html = html.Replace("http://petstore.swagger.io/v2/swagger.json", resourcesUrl) + .Replace("ApiDocs", HostContext.ServiceName) + .Replace("swagger", $"{HostContext.ServiceName}") + .Replace("http://swagger.io", LogoHref ?? "./"); + + if (LogoUrl != null) + html = html.Replace("images/logo_small.png", LogoUrl); + + if (injectPreloadJs != null) + { + html = html.Replace("window.swaggerUi.load();", injectPreloadJs + "\n\n window.swaggerUi.load();"); + } + + if (injectJs != null) + { + html = html.Replace("", + ""); + } + + return html; + }); + } + return pathInfo.StartsWith("/swagger-ui/") + ? new StaticFileHandler() + : null; + }); + } + } + + public static bool IsEnabled => HostContext.HasPlugin(); + } +} \ No newline at end of file diff --git a/src/ServiceStack.Api.OpenApi/OpenApiService.cs b/src/ServiceStack.Api.OpenApi/OpenApiService.cs new file mode 100644 index 00000000000..28219b558b4 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/OpenApiService.cs @@ -0,0 +1,1062 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Text.RegularExpressions; +using ServiceStack.DataAnnotations; +using ServiceStack.Host; +using ServiceStack.NativeTypes; +using ServiceStack.Text; +using ServiceStack.Web; +using ServiceStack.Api.OpenApi.Support; +using ServiceStack.Api.OpenApi.Specification; + +namespace ServiceStack.Api.OpenApi +{ + [DataContract] + [Exclude(Feature.Soap)] + public class OpenApiSpecification : IReturn + { + [DataMember(Name = "apiKey")] + public string ApiKey { get; set; } + } + + [AddHeader(DefaultContentType = MimeTypes.Json)] + [DefaultRequest(typeof(OpenApiSpecification))] + [Restrict(VisibilityTo = RequestAttributes.None)] + public class OpenApiService : Service + { + internal static bool UseCamelCaseSchemaPropertyNames { get; set; } + internal static bool UseLowercaseUnderscoreSchemaPropertyNames { get; set; } + internal static bool DisableAutoDtoInBodyParam { get; set; } + + internal static Regex resourceFilterRegex; + + internal static Action ApiDeclarationFilter { get; set; } + internal static Action OperationFilter { get; set; } + internal static Action SchemaFilter { get; set; } + internal static Action SchemaPropertyFilter { get; set; } + internal static string[] AnyRouteVerbs { get; set; } + internal static string[] InlineSchemaTypesInNamespaces { get; set; } + + public static Dictionary SecurityDefinitions { get; set; } + public static Dictionary> OperationSecurity { get; set; } + + public object Get(OpenApiSpecification request) + { + var map = HostContext.ServiceController.RestPathMap; + var paths = new List(); + + var basePath = new Uri(base.Request.GetBaseUrl()); + + var meta = HostContext.Metadata; + + foreach (var key in map.Keys) + { + var restPaths = map[key]; + var visiblePaths = restPaths.Where(x => meta.IsVisible(Request, Format.Json, x.RequestType.Name)); + paths.AddRange(visiblePaths); + } + + var definitions = new Dictionary + { + { "Object", new OpenApiSchema { Description = "Object", Type = OpenApiType.Object, Properties = new OrderedDictionary() } }, + }; + + foreach (var restPath in paths.SelectMany(x => x.Verbs.Select(y => new { Value = x, Verb = y }))) + { + ParseDefinitions(definitions, restPath.Value.RequestType, restPath.Value.Path, restPath.Verb); + } + + var tags = new Dictionary(); + var apiPaths = ParseOperations(paths, definitions, tags); + + var result = new OpenApiDeclaration + { + Info = new OpenApiInfo + { + Title = HostContext.ServiceName, + Version = HostContext.Config.ApiVersion, + }, + Paths = apiPaths, + BasePath = basePath.AbsolutePath, + Schemes = new List { basePath.Scheme }, //TODO: get https from config + Host = basePath.Authority, + Consumes = new List { "application/json" }, + Produces = new List { "application/json" }, + Definitions = definitions.Where(x => !SchemaIdToClrType.ContainsKey(x.Key) || !IsInlineSchema(SchemaIdToClrType[x.Key])).ToDictionary(x => x.Key, x => x.Value), + Tags = tags.Values.OrderBy(x => x.Name).ToList(), + Parameters = new Dictionary { { "Accept", GetAcceptHeaderParameter() } }, + SecurityDefinitions = SecurityDefinitions, + }; + + if (OperationFilter != null) + apiPaths.Each(x => GetOperations(x.Value).Each(o => OperationFilter(o.Item1, o.Item2))); + + ApiDeclarationFilter?.Invoke(result); + + return new HttpResult(result) + { + ResultScope = () => JsConfig.With(new Config + { + IncludeNullValues = false, + IncludeNullValuesInDictionaries = false, + IncludeTypeInfo = false, + ExcludeTypeInfo = true, + }) + }; + } + + private IEnumerable> GetOperations(OpenApiPath value) + { + if (value.Get != null) yield return new Tuple("GET", value.Get); + if (value.Post != null) yield return new Tuple("POST", value.Post); + if (value.Put != null) yield return new Tuple("PUT", value.Put); + if (value.Patch != null) yield return new Tuple("PATCH", value.Patch); + if (value.Delete != null) yield return new Tuple("DELETE", value.Delete); + if (value.Head != null) yield return new Tuple("HEAD", value.Head); + if (value.Options != null) yield return new Tuple("OPTIONS", value.Options); + } + + private static readonly Dictionary ClrTypesToSwaggerScalarTypes = new Dictionary { + {typeof(byte[]), OpenApiType.String}, + {typeof(sbyte[]), OpenApiType.String}, + {typeof(byte), OpenApiType.Integer}, + {typeof(sbyte), OpenApiType.Integer}, + {typeof(bool), OpenApiType.Boolean}, + {typeof(short), OpenApiType.Integer}, + {typeof(ushort), OpenApiType.Integer}, + {typeof(int), OpenApiType.Integer}, + {typeof(uint), OpenApiType.Integer}, + {typeof(long), OpenApiType.Integer}, + {typeof(ulong), OpenApiType.Integer}, + {typeof(float), OpenApiType.Number}, + {typeof(double), OpenApiType.Number}, + {typeof(decimal), OpenApiType.Number}, + {typeof(string), OpenApiType.String}, + {typeof(DateTime), OpenApiType.String}, + {typeof(DateTimeOffset), OpenApiType.String}, + }; + + private static readonly Dictionary ClrTypesToSwaggerScalarFormats = new Dictionary { + {typeof(byte[]), OpenApiTypeFormat.Byte}, + {typeof(sbyte[]), OpenApiTypeFormat.Byte}, + {typeof(byte), OpenApiTypeFormat.Int}, + {typeof(sbyte), OpenApiTypeFormat.Int}, + {typeof(short), OpenApiTypeFormat.Int}, + {typeof(ushort), OpenApiTypeFormat.Int}, + {typeof(int), OpenApiTypeFormat.Int}, + {typeof(uint), OpenApiTypeFormat.Int}, + {typeof(long), OpenApiTypeFormat.Long}, + {typeof(ulong), OpenApiTypeFormat.Long}, + {typeof(float), OpenApiTypeFormat.Float}, + {typeof(double), OpenApiTypeFormat.Double}, + {typeof(decimal), OpenApiTypeFormat.Double}, + {typeof(DateTime), OpenApiTypeFormat.DateTime}, + {typeof(DateTimeOffset), OpenApiTypeFormat.DateTime}, + }; + + private static bool IsSwaggerScalarType(Type type) + { + return ClrTypesToSwaggerScalarTypes.ContainsKey(type) + || (Nullable.GetUnderlyingType(type) ?? type).IsEnum + || (type.IsValueType && !IsKeyValuePairType(type)) + || type.IsNullableType(); + } + + private static string GetSwaggerTypeName(Type type) + { + var lookupType = Nullable.GetUnderlyingType(type) ?? type; + + return ClrTypesToSwaggerScalarTypes.ContainsKey(lookupType) + ? ClrTypesToSwaggerScalarTypes[lookupType] + : GetSchemaTypeName(lookupType); + } + + private static string GetSwaggerTypeFormat(Type type, string route = null, string verb = null) + { + var lookupType = Nullable.GetUnderlyingType(type) ?? type; + + //special case for response types byte[]. If byte[] is in response + //then we should use `binary` swagger type, because it's octet-encoded + //otherwise we use `byte` swagger type for base64-encoded input + if (route == null && verb == null && type == typeof(byte[])) + return OpenApiTypeFormat.Binary; + + return ClrTypesToSwaggerScalarFormats.TryGetValue(lookupType, out var format) ? format : null; + } + + private static Type GetListElementType(Type type) + { + if (type.IsArray) return type.GetElementType(); + + if (!type.IsGenericType) return null; + var genericType = type.GetGenericTypeDefinition(); + if (genericType == typeof(List<>) || genericType == typeof(IList<>) || genericType == typeof(IEnumerable<>)) + return type.GetGenericArguments()[0]; + return null; + } + + private static bool IsListType(Type type) + { + //Swagger2 specification has a special data format for type byte[] ('byte', 'binary' or 'file'), so it's not a list + if (type == typeof(byte[])) + return false; + + return GetListElementType(type) != null; + } + + private Dictionary GetOpenApiListItems(Type listItemType, string route, string verb, ApiAllowableValuesAttribute allowableValueAttrs = null) + { + var items = new Dictionary(); + + if (IsSwaggerScalarType(listItemType)) + { + items.Add("type", GetSwaggerTypeName(listItemType)); + items.Add("format", GetSwaggerTypeFormat(listItemType, route, verb)); + if (IsRequiredType(listItemType)) + { + items.Add("x-nullable", false); + } + var enumValues = GetEnumValues(allowableValueAttrs); + if (enumValues?.Count > 0) + { + items.Add("enum", enumValues); + } + } + else + { + items.Add("$ref", "#/definitions/" + GetSchemaTypeName(listItemType)); + } + + return items; + } + + private OpenApiSchema GetListSchema(IDictionary schemas, Type schemaType, string route, string verb) + { + if (!IsListType(schemaType)) + return null; + + var listItemType = GetListElementType(schemaType); + ParseDefinitions(schemas, listItemType, route, verb); + + return new OpenApiSchema + { + Title = GetSchemaTypeName(schemaType), + Type = OpenApiType.Array, + Items = GetOpenApiListItems(listItemType, route, verb) + }; + } + + private static bool IsDictionaryType(Type type) + { + if (!type.IsGenericType) return false; + + var genericType = type.GetGenericTypeDefinition(); + if (genericType == typeof(Dictionary<,>) + || genericType == typeof(IDictionary<,>) + || genericType == typeof(IReadOnlyDictionary<,>) + || genericType == typeof(SortedDictionary<,>)) + { + return true; + } + + return false; + } + + private OpenApiSchema GetDictionarySchema(IDictionary schemas, Type schemaType, string route, string verb) + { + if (!IsDictionaryType(schemaType)) + return null; + + var valueType = schemaType.GetGenericArguments()[1]; + + ParseDefinitions(schemas, valueType, route, verb); + + return new OpenApiSchema + { + Title = GetSchemaTypeName(schemaType), + Type = OpenApiType.Object, + Description = schemaType.GetDescription() ?? GetSchemaTypeName(schemaType), + AdditionalProperties = GetOpenApiProperty(schemas, valueType, route, verb) + }; + } + + private static bool IsKeyValuePairType(Type type) + { + return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(KeyValuePair<,>); + } + + private OpenApiSchema GetKeyValuePairSchema(IDictionary schemas, Type schemaType, string route, string verb) + { + if (!IsKeyValuePairType(schemaType)) + return null; + + var keyType = schemaType.GetGenericArguments()[0]; + var valueType = schemaType.GetGenericArguments()[1]; + + return new OpenApiSchema + { + Type = OpenApiType.Object, + Title = GetSchemaTypeName(schemaType), + Description = schemaType.GetDescription() ?? GetSchemaTypeName(schemaType), + Properties = new OrderedDictionary + { + { "Key", GetOpenApiProperty(schemas, keyType, route, verb) }, + { "Value", GetOpenApiProperty(schemas, valueType, route, verb) } + } + }; + } + + private static bool IsRequiredType(Type type) + { + return !type.IsNullableType() && type != typeof(string); + } + + private static string GetSchemaTypeName(Type schemaType) + { + if ((!IsKeyValuePairType(schemaType) && schemaType.IsValueType) || schemaType.IsNullableType()) + return OpenApiType.String; + + if (!schemaType.IsGenericType) + return schemaType.Name; + + var typeName = schemaType.ToPrettyName(); + return typeName; + } + + private static string GetSchemaDefinitionRef(Type schemaType) => + swaggerRefRegex.Replace(GetSchemaTypeName(schemaType), "_"); + + private static readonly Regex swaggerRefRegex = new Regex("[^A-Za-z0-9\\.\\-_]", RegexOptions.Compiled); + + private OpenApiProperty GetOpenApiProperty(IDictionary schemas, PropertyInfo pi, string route, string verb) + { + var ret = GetOpenApiProperty(schemas, pi.PropertyType, route, verb); + ret.PropertyInfo = pi; + return ret; + } + + private OpenApiProperty GetOpenApiProperty(IDictionary schemas, Type propertyType, string route, string verb) + { + var schemaProp = new OpenApiProperty { + PropertyType = propertyType, + }; + + if (IsKeyValuePairType(propertyType)) + { + if (IsInlineSchema(propertyType)) + { + ParseDefinitions(schemas, propertyType, route, verb); + InlineSchema(schemas[GetSchemaTypeName(propertyType)], schemaProp); + } + else + { + ParseDefinitions(schemas, propertyType, route, verb); + schemaProp.Ref = "#/definitions/" + GetSchemaDefinitionRef(propertyType); + } + } + else if (IsListType(propertyType)) + { + schemaProp.Type = OpenApiType.Array; + var listItemType = GetListElementType(propertyType); + if (IsSwaggerScalarType(listItemType)) + { + schemaProp.Items = new Dictionary + { + { "type", GetSwaggerTypeName(listItemType) }, + { "format", GetSwaggerTypeFormat(listItemType, route, verb) } + }; + if (IsRequiredType(listItemType)) + { + schemaProp.Items.Add("x-nullable", false); + //schemaProp.Items.Add("required", "true"); + } + ParseDefinitions(schemas, listItemType, route, verb); + } + else if (IsInlineSchema(listItemType)) + { + ParseDefinitions(schemas, listItemType, route, verb); + InlineSchema(schemas[GetSchemaTypeName(listItemType)], schemaProp); + } + else + { + schemaProp.Items = new Dictionary { { "$ref", "#/definitions/" + GetSchemaDefinitionRef(listItemType) } }; + ParseDefinitions(schemas, listItemType, route, verb); + } + } + else if ((Nullable.GetUnderlyingType(propertyType) ?? propertyType).IsEnum) + { + var enumType = Nullable.GetUnderlyingType(propertyType) ?? propertyType; + if (enumType.IsNumericType()) + { + var underlyingType = Enum.GetUnderlyingType(enumType); + schemaProp.Type = GetSwaggerTypeName(underlyingType); + schemaProp.Format = GetSwaggerTypeFormat(underlyingType, route, verb); + schemaProp.Enum = GetNumericValues(enumType, underlyingType).ToList(); + } + else + { + schemaProp.Type = OpenApiType.String; + schemaProp.Enum = Enum.GetNames(enumType).ToList(); + } + } + else if (IsSwaggerScalarType(propertyType)) + { + schemaProp.Type = GetSwaggerTypeName(propertyType); + schemaProp.Format = GetSwaggerTypeFormat(propertyType, route, verb); + schemaProp.Nullable = IsRequiredType(propertyType) ? false : (bool?)null; + //schemaProp.Required = IsRequiredType(propertyType) ? true : (bool?)null; + } + else if (IsInlineSchema(propertyType)) + { + ParseDefinitions(schemas, propertyType, route, verb); + InlineSchema(schemas[GetSchemaTypeName(propertyType)], schemaProp); + } + else + { + ParseDefinitions(schemas, propertyType, route, verb); + schemaProp.Ref = "#/definitions/" + GetSchemaDefinitionRef(propertyType); + } + + return schemaProp; + } + + private static void InlineSchema(OpenApiSchema schema, OpenApiProperty schemaProp) + { + schemaProp.Items = new Dictionary + { + {"title", schema.Title}, + {"discriminator", schema.Discriminator}, + {"readOnly", schema.ReadOnly}, + {"xml", schema.Xml}, + {"externalDocs", schema.ExternalDocs}, + {"example", schema.Example}, + {"required", schema.Required}, + {"allOf", schema.AllOf}, + {"properties", schema.Properties}, + {"additionalProperties", schema.AdditionalProperties}, + {"description", schema.Description}, + {"type", schema.Type}, + {"format", schema.Format}, + {"items", schema.Items}, + {"collectionFormat", schema.CollectionFormat}, + {"default", schema.Default}, + {"maximum", schema.Maximum}, + {"exclusiveMaximum", schema.ExclusiveMaximum}, + {"exclusiveMinimum", schema.ExclusiveMinimum}, + {"maxLength", schema.MaxLength}, + {"minLength", schema.MinLength}, + {"pattern", schema.Pattern}, + {"maxItems", schema.MaxItems}, + {"minItems", schema.MinItems}, + {"uniqueItems", schema.UniqueItems}, + {"maxProperties", schema.MaxProperties}, + {"minProperties", schema.MinProperties}, + {"enum", schema.Enum}, + {"multipleOf", schema.MultipleOf}, + {"x-nullable", schema.Nullable} + }; + } + + protected bool IsInlineSchema(Type schemaType) + { + return InlineSchemaTypesInNamespaces.Contains(schemaType.Namespace); + } + + public Dictionary SchemaIdToClrType { get; } = new Dictionary(); + + private void ParseDefinitions(IDictionary schemas, Type schemaType, string route, string verb) + { + if (IsSwaggerScalarType(schemaType) || schemaType.ExcludesFeature(Feature.Metadata)) return; + + var schemaId = GetSchemaDefinitionRef(schemaType); + if (schemas.ContainsKey(schemaId)) return; + + var schema = GetDictionarySchema(schemas, schemaType, route, verb) + ?? GetKeyValuePairSchema(schemas, schemaType, route, verb) + ?? GetListSchema(schemas, schemaType, route, verb); + + bool parseProperties = false; + + if (schema == null) + { + schema = new OpenApiSchema + { + Type = OpenApiType.Object, + Title = schemaType.Name, + Description = schemaType.GetDescription() ?? GetSchemaTypeName(schemaType), + Properties = new OrderedDictionary() + }; + parseProperties = schemaType.IsUserType(); + } + schemas[schemaId] = schema; + SchemaIdToClrType[schemaId] = schemaType; + + var properties = schemaType.GetProperties(); + + // Order schema properties by DataMember.Order if [DataContract] and [DataMember](s) defined + // Ordering defined by: http://msdn.microsoft.com/en-us/library/ms729813.aspx + var dataContractAttr = schemaType.FirstAttribute(); + if (dataContractAttr != null && properties.Any(prop => prop.IsDefined(typeof(DataMemberAttribute), true))) + { + var typeOrder = new List { schemaType }; + var baseType = schemaType.BaseType; + while (baseType != null) + { + typeOrder.Add(baseType); + baseType = baseType.BaseType; + } + + var propsWithDataMember = properties.Where(prop => prop.IsDefined(typeof(DataMemberAttribute), true)); + var propDataMemberAttrs = properties.ToDictionary(prop => prop, prop => prop.FirstAttribute()); + + properties = propsWithDataMember + .OrderBy(prop => propDataMemberAttrs[prop].Order) // Order by DataMember.Order + .ThenByDescending(prop => typeOrder.IndexOf(prop.DeclaringType)) // Then by BaseTypes First + .ThenBy(prop => // Then by [DataMember].Name / prop.Name + { + var name = propDataMemberAttrs[prop].Name; + return name.IsNullOrEmpty() ? prop.Name : name; + }).ToArray(); + } + + if (parseProperties) + { + foreach (var prop in properties) + { + if (prop.HasAttribute()) + continue; + + var apiMembers = prop + .AllAttributes() + .OrderByDescending(attr => attr.Route) + .ToList(); + var apiDoc = apiMembers + .Where(attr => string.IsNullOrEmpty(verb) || string.IsNullOrEmpty(attr.Verb) || (verb ?? "").Equals(attr.Verb)) + .Where(attr => string.IsNullOrEmpty(route) || string.IsNullOrEmpty(attr.Route) || (route ?? "").StartsWith(attr.Route)) + .FirstOrDefault(attr => attr.ParameterType == "body" || attr.ParameterType == "model"); + + if (apiMembers.Any(x => x.ExcludeInSchema)) + continue; + var schemaProperty = GetOpenApiProperty(schemas, prop, route, verb); + var schemaPropertyName = GetSchemaPropertyName(prop); + + schemaProperty.Description = prop.GetDescription() ?? apiDoc?.Description; + + var propAttr = prop.FirstAttribute(); + if (propAttr != null) + { + if (propAttr.DataType != null) + schemaProperty.Type = propAttr.DataType; + + if (propAttr.Format != null) + schemaProperty.Format = propAttr.Format; + + if (propAttr.IsRequired) + { + if (schema.Required == null) + schema.Required = new List(); + schema.Required.Add(schemaPropertyName); + } + } + + schemaProperty.Enum = GetEnumValues(prop.FirstAttribute()); + + SchemaPropertyFilter?.Invoke(schemaProperty); + + schema.Properties[schemaPropertyName] = schemaProperty; + } + } + } + + private static string GetSchemaPropertyName(PropertyInfo prop) + { + var dataMemberAttr = prop.FirstAttribute(); + if (dataMemberAttr != null && !dataMemberAttr.Name.IsNullOrEmpty()) + return dataMemberAttr.Name; + + return UseCamelCaseSchemaPropertyNames + ? (UseLowercaseUnderscoreSchemaPropertyNames ? prop.Name.ToLowercaseUnderscore() : prop.Name.ToCamelCase()) + : prop.Name; + } + + private static IEnumerable GetNumericValues(Type propertyType, Type underlyingType) + { + var values = Enum.GetValues(propertyType) + .Map(x => $"{Convert.ChangeType(x, underlyingType)} ({x})"); + + return values; + } + + private OpenApiSchema GetResponseSchema(IRestPath restPath, IDictionary schemas, out string schemaDescription) + { + schemaDescription = string.Empty; + + // Given: class MyDto : IReturn. Determine the type X. + foreach (var i in restPath.RequestType.GetInterfaces()) + { + if (i == typeof(IReturnVoid)) + return GetSchemaForResponseType(typeof(void), schemas, out schemaDescription); + + if (i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IReturn<>)) + { + var schemaType = i.GetGenericArguments()[0]; + return GetSchemaForResponseType(schemaType, schemas, out schemaDescription); + } + } + + return new OpenApiSchema { Ref = "#/definitions/Object" }; + } + + private OpenApiSchema GetSchemaForResponseType(Type schemaType, IDictionary schemas, out string schemaDescription) + { + if (schemaType == typeof(IReturnVoid) || schemaType == typeof(void)) + { + schemaDescription = "No Content"; + return null; + } + + ParseDefinitions(schemas, schemaType, null, null); + + var schema = GetDictionarySchema(schemas, schemaType, null, null) + ?? GetKeyValuePairSchema(schemas, schemaType, null, null) + ?? GetListSchema(schemas, schemaType, null, null) + ?? (IsSwaggerScalarType(schemaType) + ? new OpenApiSchema + { + Title = GetSchemaTypeName(schemaType), + Type = GetSwaggerTypeName(schemaType), + Format = GetSwaggerTypeFormat(schemaType) + } + : IsInlineSchema(schemaType) + ? schemas[GetSchemaTypeName(schemaType)] + : new OpenApiSchema { Ref = "#/definitions/" + GetSchemaDefinitionRef(schemaType) }); + + schemaDescription = schema.Description ?? schemaType.GetDescription() ?? string.Empty; + + return schema; + } + + private OrderedDictionary GetMethodResponseCodes(IRestPath restPath, IDictionary schemas, Type requestType) + { + var responses = new OrderedDictionary(); + + var responseSchema = GetResponseSchema(restPath, schemas, out string schemaDescription); + //schema is null when return type is IReturnVoid + var statusCode = responseSchema == null && HostConfig.Instance.Return204NoContentForEmptyResponse + ? ((int)HttpStatusCode.NoContent).ToString() + : ((int)HttpStatusCode.OK).ToString(); + + responses.Add(statusCode, new OpenApiResponse + { + Schema = responseSchema, + Description = !string.IsNullOrEmpty(schemaDescription) ? schemaDescription : "Success" + }); + + foreach (var attr in requestType.AllAttributes()) + { + string apiSchemaDescription = string.Empty; + + var response = new OpenApiResponse + { + Schema = attr.ResponseType != null + ? GetSchemaForResponseType(attr.ResponseType, schemas, out apiSchemaDescription) + : responseSchema, + Description = attr.Description ?? apiSchemaDescription + }; + + statusCode = attr.IsDefaultResponse ? "default" : attr.StatusCode.ToString(); + if (!responses.ContainsKey(statusCode)) + responses.Add(statusCode, response); + else + responses[statusCode] = response; + } + + return responses; + } + + private OrderedDictionary ParseOperations(List restPaths, Dictionary schemas, Dictionary tags) + { + var feature = HostContext.GetPlugin(); + var apiPaths = new OrderedDictionary(); + + foreach (var restPath in restPaths) + { + var verbs = new List(); + var summary = restPath.Summary ?? restPath.RequestType.GetDescription(); + + verbs.AddRange(restPath.AllowsAllVerbs + ? AnyRouteVerbs + : restPath.Verbs); + + var routePath = restPath.Path.Replace("*", ""); + var requestType = restPath.RequestType; + + if (!apiPaths.TryGetValue(restPath.Path, out var curPath)) + { + curPath = new OpenApiPath + { + Parameters = new List + { + new OpenApiParameter { Ref = "#/parameters/Accept" } + } + }; + apiPaths.Add(restPath.Path, curPath); + } + + var op = HostContext.Metadata.OperationsMap[requestType]; + var actions = HostContext.Metadata.GetImplementedActions(op.ServiceType, op.RequestType); + + var authAttrs = new[] { op.ServiceType, op.RequestType } + .SelectMany(x => x.AllAttributes().OfType()).ToList(); + + authAttrs.AddRange(actions + .Where(x => x.Name.ToUpperInvariant() == ActionContext.AnyAction) + .SelectMany(x => x.AllAttributes()) + ); + + var annotatingTagAttributes = requestType.AllAttributes(); + + foreach (var verb in verbs) + { + var needAuth = authAttrs.Count > 0 + || actions.Where(x => x.Name.ToUpperInvariant() == verb) + .SelectMany(x => x.AllAttributes()).Any(); + + var userTags = new List(); + if (ApplyToUtils.VerbsApplyTo.TryGetValue(verb, out var applyToVerb)) + { + userTags = annotatingTagAttributes.Where(x => x.ApplyTo.HasFlag(applyToVerb)).Select(x => x.Name).ToList(); + } + + var operation = new OpenApiOperation + { + RequestType = requestType.Name, + Summary = summary, + Description = restPath.Notes ?? summary, + OperationId = GetOperationName(requestType.Name, routePath, verb), + Parameters = ParseParameters(schemas, requestType, routePath, verb), + Responses = GetMethodResponseCodes(restPath, schemas, requestType), + Consumes = new List { "application/json" }, + Produces = new List { "application/json" }, + Tags = userTags.Count > 0 ? userTags : GetTags(restPath.Path), + Deprecated = requestType.HasAttribute(), + Security = needAuth ? new List>> { + OperationSecurity + } : null + }; + + if (HasFormData(verb, operation.Parameters)) + operation.Consumes = new List { "application/x-www-form-urlencoded" }; + + foreach (var tag in operation.Tags) + { + if (!tags.ContainsKey(tag)) + { + var tagObject = feature.Tags.FirstOrDefault(x => x.Name == tag) + ?? new OpenApiTag { Name = tag }; + + tags.Add(tag, tagObject); + } + } + + switch (verb) + { + case HttpMethods.Get: curPath.Get = operation; break; + case HttpMethods.Post: curPath.Post = operation; break; + case HttpMethods.Put: curPath.Put = operation; break; + case HttpMethods.Delete: curPath.Delete = operation; break; + case HttpMethods.Patch: curPath.Patch = operation; break; + case HttpMethods.Head: curPath.Head = operation; break; + case HttpMethods.Options: curPath.Options = operation; break; + } + } + } + + return apiPaths; + } + + private bool IsFormData(string verb, ApiAttribute apiAttr) + { + if (verb != HttpMethods.Post && verb != HttpMethods.Put) + return false; + + if (apiAttr?.BodyParameter == GenerateBodyParameter.Always + || (!DisableAutoDtoInBodyParam && apiAttr?.BodyParameter != GenerateBodyParameter.Never)) + return false; + + return true; + } + + private bool HasFormData(string verb, List parameters) + { + return (verb == HttpMethods.Post || verb == HttpMethods.Put) && parameters.Any(p => p.In == "formData"); + } + + static readonly Dictionary postfixes = new Dictionary() + { + { HttpMethods.Get, "_Get" }, //'Get' or 'List' to pass Autorest validation + { HttpMethods.Put, "_Create" }, //'Create' to pass Autorest validation + { HttpMethods.Post, "_Post" }, + { HttpMethods.Patch, "_Update" }, //'Update' to pass Autorest validation + { HttpMethods.Delete, "_Delete" } //'Delete' to pass Autorest validation + }; + + + HashSet operationIds = new HashSet(); + + /// Returns operation postfix to make operationId unique and swagger json be validable + private string GetOperationName(string name, string route, string verb) + { + string pathPostfix = string.Empty; + + var entries = route.Replace("{", string.Empty) + .Replace("}", string.Empty) + .Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + + if (entries.Length > 1) + pathPostfix = string.Join(string.Empty, entries, 1, entries.Length - 1); + + postfixes.TryGetValue(verb, out var verbPostfix); + verbPostfix = verbPostfix ?? string.Empty; + + var operationId = name + pathPostfix + verbPostfix; + + int num = 2; + while (operationIds.Contains(operationId)) + { + operationId = name + pathPostfix + num + verbPostfix; + num++; + } + + operationIds.Add(operationId); + + return operationId; + } + + private static List GetEnumValues(ApiAllowableValuesAttribute attr) + { + return attr?.Values?.ToList(); + } + + private List ParseParameters(IDictionary schemas, Type operationType, string route, string verb) + { + var hasDataContract = operationType.HasAttribute(); + var apiAttr = operationType.FirstAttribute(); + + var properties = operationType.GetProperties(); + var paramAttrs = new Dictionary(); + var propertyTypes = new Dictionary(); + var allowableParams = new List(); + var defaultOperationParameters = new List(); + + var hasApiMembers = false; + + foreach (var property in properties) + { + if (property.HasAttribute()) + continue; + + var attr = hasDataContract + ? property.FirstAttribute() + : null; + + var propertyName = attr?.Name ?? property.Name; + + var apiMembers = property.AllAttributes(); + if (apiMembers.Length > 0) + hasApiMembers = true; + + paramAttrs[propertyName] = apiMembers; + propertyTypes[propertyName] = property.PropertyType; + var allowableValuesAttrs = property.AllAttributes(); + allowableParams.AddRange(allowableValuesAttrs); + + if (hasDataContract && attr == null) + continue; + + var inPath = (route ?? "").ToLowerInvariant().Contains("{" + propertyName.ToLowerInvariant() + "}"); + var paramType = inPath + ? "path" + : IsFormData(verb, apiAttr) ? "formData" : "query"; + + + var parameter = GetParameter(schemas, property.PropertyType, + route, verb, + propertyName, paramType, + allowableValuesAttrs.FirstOrDefault()); + + defaultOperationParameters.Add(parameter); + } + + var methodOperationParameters = defaultOperationParameters; + if (hasApiMembers) + { + methodOperationParameters = new List(); + foreach (var key in paramAttrs.Keys) + { + var apiMembers = paramAttrs[key]; + foreach (var member in apiMembers) + { + if ((member.Verb == null || string.Compare(member.Verb, verb, StringComparison.OrdinalIgnoreCase) == 0) + && (member.Route == null || (route ?? "").StartsWith(member.Route)) + && !string.Equals(member.ParameterType, "model") + && methodOperationParameters.All(x => x.Name != (member.Name ?? key))) + { + var p = GetParameter(schemas, propertyTypes[key], route, verb, + member.Name ?? key, + member.GetParamType(operationType, member.Verb ?? verb), + allowableParams.FirstOrDefault(attr => attr.Name == (member.Name ?? key)), + true + ); + p.Type = member.DataType ?? p.Type; + p.Format = member.Format ?? p.Format; + p.Required = p.In =="path" || member.IsRequired; + p.Description = member.Description ?? p.Description; + + //Fix old Swagger 1.2 parameter type + if (p.In == "form") + p.In = "formData"; + + methodOperationParameters.Add(p); + } + } + } + } + + if (apiAttr?.BodyParameter == GenerateBodyParameter.Always + || (!DisableAutoDtoInBodyParam && apiAttr?.BodyParameter != GenerateBodyParameter.Never)) + { + if (!HttpMethods.Get.EqualsIgnoreCase(verb) && !HttpMethods.Delete.EqualsIgnoreCase(verb) + && !methodOperationParameters.Any(p => "body".EqualsIgnoreCase(p.In))) + { + ParseDefinitions(schemas, operationType, route, verb); + + var parameter = GetParameter(schemas, operationType, route, verb, "body", "body"); + + if (apiAttr?.IsRequired == true) + parameter.Required = true; + + methodOperationParameters.Add(parameter); + } + } + + return methodOperationParameters; + } + + private OpenApiParameter GetParameter(IDictionary schemas, Type schemaType, string route, string verb, string paramName, string paramIn, ApiAllowableValuesAttribute allowableValueAttrs = null, bool isApiMember = false) + { + //Compatibility: replace old Swagger ParamType to new Open API + if (paramIn == "form") paramIn = "formData"; + + if (IsSwaggerScalarType(schemaType)) + { + return new OpenApiParameter + { + In = paramIn, + Name = paramName, + Type = GetSwaggerTypeName(schemaType), + Format = GetSwaggerTypeFormat(schemaType, route, verb), + Enum = GetEnumValues(allowableValueAttrs), + Nullable = IsRequiredType(schemaType) ? false : (bool?)null, + Required = paramIn == "path" ? true : (bool?)null + }; + } + + if (paramIn != "body" && !isApiMember) + { + return new OpenApiParameter + { + In = paramIn, + Name = paramName, + Type = OpenApiType.String, + Required = paramIn == "path" ? true : (bool?)null + }; + } + + if (IsDictionaryType(schemaType)) + { + return new OpenApiParameter + { + In = paramIn, + Name = paramName, + Schema = GetDictionarySchema(schemas, schemaType, route, verb) + }; + } + + if (IsListType(schemaType)) + { + return GetListParameter(schemas, schemaType, route, verb, paramName, paramIn, allowableValueAttrs); + } + + OpenApiSchema openApiSchema; + + if (IsInlineSchema(schemaType)) + { + openApiSchema = schemas[GetSchemaTypeName(schemaType)]; + } + else + { + openApiSchema = new OpenApiSchema {Ref = "#/definitions/" + GetSchemaTypeName(schemaType)}; + } + + return new OpenApiParameter + { + In = paramIn, + Name = paramName, + Schema = openApiSchema + }; + } + + private List GetTags(string path) + { + var tagName = GetTagName(path); + return tagName != null ? new List { tagName } : null; + } + + private string GetTagName(string path) + { + var tags = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + + return tags.Length > 0 ? tags[0] : null; + } + + private OpenApiParameter GetListParameter(IDictionary schemas, Type listType, string route, string verb, string paramName, string paramIn, ApiAllowableValuesAttribute allowableValueAttrs = null) + { + if (!IsListType(listType)) + return null; + + var parameter = new OpenApiParameter + { + Type = OpenApiType.Array, + CollectionFormat = "multi", + Description = listType.GetDescription(), + Name = paramName, + In = paramIn, + Required = paramIn == "path" + }; + + var listItemType = GetListElementType(listType); + ParseDefinitions(schemas, listItemType, route, verb); + parameter.Items = GetOpenApiListItems(listItemType, route, verb, allowableValueAttrs); + + return parameter; + } + + private OpenApiParameter GetAcceptHeaderParameter() + { + return new OpenApiParameter + { + Type = OpenApiType.String, + Name = "Accept", + Description = "Accept Header", + Enum = new List { "application/json" }, + In = "header", + Required = true, + }; + } + } +} \ No newline at end of file diff --git a/src/ServiceStack.Api.OpenApi/Properties/AssemblyInfo.cs b/src/ServiceStack.Api.OpenApi/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..745290a6ee4 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +[assembly: System.Runtime.InteropServices.ComVisible(false)] +[assembly: System.Runtime.InteropServices.Guid("1dfebd7c-72e5-423e-8e0b-6da176ba34b8")] +[assembly: System.Reflection.AssemblyVersion("5.0.0.0")] + +[assembly: System.Runtime.Serialization.ContractNamespace("http://schemas.servicestack.net/types", + ClrNamespace = "ServiceStack.Api.OpenApi")] diff --git a/src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.Core.csproj b/src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.Core.csproj new file mode 100644 index 00000000000..1df8727f59a --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.Core.csproj @@ -0,0 +1,34 @@ + + + + ServiceStack.Api.OpenApi.Core + ServiceStack.Api.OpenApi + ServiceStack.Api.OpenApi + netstandard2.0 + ServiceStack.Api.OpenApi .NET Standard 2.0 + + Implements v2.0 of the Open API Specification (https://www.openapis.org). + Open API is a specification and complete framework implementation for describing, producing, consuming, and visualizing RESTful web services. + + OpenAPI;metadata;Swagger;API;REST;Metadata;Docs;ServiceStack + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.Source.csproj b/src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.Source.csproj new file mode 100644 index 00000000000..ea843f12962 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.Source.csproj @@ -0,0 +1,40 @@ + + + + ServiceStack.Api.OpenApi + ServiceStack.Api.OpenApi + ServiceStack.Api.OpenApi + net45;netstandard2.0 + ServiceStack support for Open API v2.0 and integrated Swagger UI + + Implements v2.0 of the Open API Specification (https://www.openapis.org). + Open API is a specification and complete framework implementation for describing, producing, consuming, and visualizing RESTful web services. + + OpenAPI;metadata;Swagger;API;REST;Metadata;Docs;ServiceStack + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.csproj b/src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.csproj new file mode 100644 index 00000000000..da0208283bc --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.csproj @@ -0,0 +1,38 @@ + + + + ServiceStack.Api.OpenApi + ServiceStack.Api.OpenApi + net45;netstandard2.0 + ServiceStack support for Open API v2.0 and integrated Swagger UI + + Implements v2.0 of the Open API Specification (https://www.openapis.org). + Open API is a specification and complete framework implementation for describing, producing, consuming, and visualizing RESTful web services. + + OpenAPI;metadata;Swagger;API;REST;Metadata;Docs;ServiceStack + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiContact.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiContact.cs new file mode 100644 index 00000000000..c0f4709154b --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiContact.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiContact + { + [DataMember(Name = "name")] + public string Name { get; set; } + [DataMember(Name = "url")] + public string Url { get; set; } + [DataMember(Name = "email")] + public string Email { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiDataTypeSchema.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiDataTypeSchema.cs new file mode 100644 index 00000000000..2a99a2dd8b8 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiDataTypeSchema.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + //from https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#user-content-parameterMaximum + [DataContract] + public abstract class OpenApiDataTypeSchema + { + [DataMember(Name = "$ref")] + public string Ref { get; set; } + [DataMember(Name = "description")] + public string Description { get; set; } + [DataMember(Name = "type")] + public string Type { get; set; } + [DataMember(Name = "format")] + public string Format { get; set; } + [DataMember(Name = "items")] + public Dictionary Items { get; set; } + [DataMember(Name = "collectionFormat")] + public string CollectionFormat { get; set; } + [DataMember(Name = "default")] + public string Default { get; set; } + [DataMember(Name = "maximum")] + public double? Maximum { get; set; } + [DataMember(Name = "exclusiveMaximum")] + public bool? ExclusiveMaximum { get; set; } + [DataMember(Name = "minimum")] + public double? Minimum { get; set; } + [DataMember(Name = "exclusiveMinimum")] + public bool? ExclusiveMinimum { get; set; } + [DataMember(Name = "maxLength")] + public int? MaxLength { get; set; } + [DataMember(Name = "minLength")] + public int? MinLength { get; set; } + [DataMember(Name = "pattern")] + public string Pattern { get; set; } + [DataMember(Name = "maxItems")] + public int? MaxItems { get; set; } + [DataMember(Name = "minItems")] + public int? MinItems { get; set; } + [DataMember(Name = "uniqueItems")] + public bool? UniqueItems { get; set; } + [DataMember(Name = "maxProperties")] + public string MaxProperties { get; set; } + [DataMember(Name = "minProperties")] + public string MinProperties { get; set; } + [DataMember(Name = "required")] + public bool? Required { get; set; } + [DataMember(Name = "enum")] + public List Enum { get; set; } + [DataMember(Name = "multipleOf")] + public double? MultipleOf { get; set; } + [DataMember(Name = "x-nullable")] + public bool? Nullable { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiDeclaration.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiDeclaration.cs new file mode 100644 index 00000000000..7c35c51e7e4 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiDeclaration.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; +using ServiceStack.Api.OpenApi.Support; +using ServiceStack.DataAnnotations; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + [Exclude(Feature.Soap)] + public class OpenApiDeclaration + { + [DataMember(Name = "swagger")] + public string Swagger => "2.0"; + + [DataMember(Name = "info")] + public OpenApiInfo Info { get; set; } + + [DataMember(Name = "host")] + public string Host { get; set; } + + [DataMember(Name = "basePath")] + public string BasePath { get; set; } + + [DataMember(Name = "schemes")] + public List Schemes { get; set; } + + [DataMember(Name = "consumes")] + public List Consumes { get; set; } + + [DataMember(Name = "produces")] + public List Produces { get; set; } + + [DataMember(Name = "paths")] + public OrderedDictionary Paths { get; set; } + + [DataMember(Name = "definitions")] + public Dictionary Definitions { get; set; } + + [DataMember(Name = "parameters")] + public Dictionary Parameters { get; set; } + + [DataMember(Name = "responses")] + public OrderedDictionary Responses { get; set; } + + [DataMember(Name = "securityDefinitions")] + public Dictionary SecurityDefinitions { get; set; } + + [DataMember(Name = "security")] + public List>> Security { get; set; } + + [DataMember(Name = "tags")] + public List Tags { get; set; } + + [DataMember(Name = "externalDocs")] + public OpenApiExternalDocumentation ExternalDocs { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiExternalDocumentation.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiExternalDocumentation.cs new file mode 100644 index 00000000000..2ea7854ce05 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiExternalDocumentation.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiExternalDocumentation + { + [DataMember(Name = "description")] + public string Description { get; set; } + [DataMember(Name = "url")] + public string Url { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiInfo.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiInfo.cs new file mode 100644 index 00000000000..a688a559878 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiInfo.cs @@ -0,0 +1,21 @@ +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiInfo + { + [DataMember(Name = "title")] + public string Title { get; set; } + [DataMember(Name = "description")] + public string Description { get; set; } + [DataMember(Name = "termsOfServiceUrl")] + public string TermsOfServiceUrl { get; set; } + [DataMember(Name = "contact")] + public OpenApiContact Contact { get; set; } + [DataMember(Name = "license")] + public OpenApiLicense License { get; set; } + [DataMember(Name = "version")] + public string Version { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiLicense.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiLicense.cs new file mode 100644 index 00000000000..811de391ac6 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiLicense.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiLicense + { + [DataMember(Name = "name")] + public string Name { get; set; } + [DataMember(Name = "url")] + public string Url { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiOperation.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiOperation.cs new file mode 100644 index 00000000000..0dcbdc0f6f8 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiOperation.cs @@ -0,0 +1,40 @@ +using ServiceStack.Api.OpenApi.Support; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiOperation + { + //Custom: Request DTO Name to help with custom filtering + [IgnoreDataMember] + public string RequestType { get; set; } + + [DataMember(Name = "tags")] + public List Tags { get; set; } + [DataMember(Name = "summary")] + public string Summary { get; set; } + [DataMember(Name = "description")] + public string Description { get; set; } + [DataMember(Name = "externalDocs")] + public OpenApiExternalDocumentation ExternalDocs { get; set; } + [DataMember(Name = "operationId")] + public string OperationId { get; set; } + [DataMember(Name = "consumes")] + public List Consumes { get; set; } + [DataMember(Name = "produces")] + public List Produces { get; set; } + [DataMember(Name = "parameters")] + public List Parameters { get; set; } + [DataMember(Name = "responses")] + public OrderedDictionary Responses { get; set; } + [DataMember(Name = "schemes")] + public List Schemes { get; set; } + [DataMember(Name = "deprecated")] + public bool Deprecated { get; set; } + [DataMember(Name = "security")] + public List>> Security { get; set; } + } + +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiParameter.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiParameter.cs new file mode 100644 index 00000000000..7b004e51267 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiParameter.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiParameter : OpenApiDataTypeSchema + { + [DataMember(Name = "name")] + public string Name { get; set; } + [DataMember(Name = "in")] + public string In { get; set; } + [DataMember(Name = "schema")] + public OpenApiSchema Schema { get; set; } + [DataMember(Name = "allowEmptyValue")] + public bool? AllowEmptyValue { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiPath.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiPath.cs new file mode 100644 index 00000000000..675d9a5dd87 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiPath.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiPath + { + [DataMember(Name = "$ref")] + public string Ref { get; set; } + [DataMember(Name = "get")] + public OpenApiOperation Get { get; set; } + [DataMember(Name = "put")] + public OpenApiOperation Put { get; set; } + [DataMember(Name = "post")] + public OpenApiOperation Post { get; set; } + [DataMember(Name = "delete")] + public OpenApiOperation Delete { get; set; } + [DataMember(Name = "options")] + public OpenApiOperation Options { get; set; } + [DataMember(Name = "head")] + public OpenApiOperation Head { get; set; } + [DataMember(Name = "patch")] + public OpenApiOperation Patch { get; set; } + [DataMember(Name = "parameters")] + public List Parameters { get; set; } + } + +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiProperty.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiProperty.cs new file mode 100644 index 00000000000..2eef9d4e561 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiProperty.cs @@ -0,0 +1,15 @@ +using System; +using System.Reflection; +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiProperty : OpenApiDataTypeSchema + { + [IgnoreDataMember] + public PropertyInfo PropertyInfo { get; set; } + [IgnoreDataMember] + public Type PropertyType { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiResponse.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiResponse.cs new file mode 100644 index 00000000000..0e0578b8f0b --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiResponse.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiResponse + { + [DataMember(Name = "description")] + public string Description { get; set; } + [DataMember(Name = "schema")] + public OpenApiSchema Schema { get; set; } + [DataMember(Name = "headers")] + public Dictionary Headers { get; set; } + [DataMember(Name = "examples")] + public Dictionary Examples { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiSchema.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiSchema.cs new file mode 100644 index 00000000000..3ffa870e02f --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiSchema.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using ServiceStack.Api.OpenApi.Support; +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiSchema : OpenApiDataTypeSchema + { + [DataMember(Name = "title")] + public string Title { get; set; } + [DataMember(Name = "discriminator")] + public string Discriminator { get; set; } + [DataMember(Name = "readOnly")] + public bool? ReadOnly { get; set; } + [DataMember(Name = "xml")] + public OpenApiXmlObject Xml { get; set; } + [DataMember(Name = "externalDocs")] + public OpenApiExternalDocumentation ExternalDocs { get; set; } + [DataMember(Name = "example")] + public string Example { get; set; } + + [DataMember(Name = "required")] + public new List Required { get; set; } + + [DataMember(Name = "allOf")] + public OpenApiSchema AllOf { get; set; } + [DataMember(Name = "properties")] + public OrderedDictionary Properties { get; set; } + [DataMember(Name = "additionalProperties")] + public OpenApiProperty AdditionalProperties { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiSecurity.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiSecurity.cs new file mode 100644 index 00000000000..931a89078ae --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiSecurity.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiSecurity + { + [DataMember(Name = "name")] + public string Name { get; set; } + [DataMember(Name = "description")] + public string Description { get; set; } + [DataMember(Name = "externalDocs")] + public OpenApiExternalDocumentation ExternalDocs { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiSecuritySchema.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiSecuritySchema.cs new file mode 100644 index 00000000000..2b83208f06a --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiSecuritySchema.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiSecuritySchema + { + [DataMember(Name = "type")] + public string Type { get; set; } + [DataMember(Name = "description")] + public string Description { get; set; } + [DataMember(Name = "name")] + public string Name { get; set; } + [DataMember(Name = "in")] + public string In { get; set; } + [DataMember(Name = "flow")] + public string Flow { get; set; } + [DataMember(Name = "authorizationUrl")] + public string AuthorizationUrl { get; set; } + [DataMember(Name = "tokenUrl")] + public string TokenUrl { get; set; } + [DataMember(Name = "scopes")] + public Dictionary Scopes { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiTag.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiTag.cs new file mode 100644 index 00000000000..bfa7433c02d --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiTag.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiTag + { + [DataMember(Name = "name")] + public string Name { get; set; } + + [DataMember(Name = "description")] + public string Description { get; set; } + + [DataMember(Name = "externalDocs")] + public OpenApiExternalDocumentation ExternalDocs { get; set; } + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiType.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiType.cs new file mode 100644 index 00000000000..cd02aabf0d9 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiType.cs @@ -0,0 +1,26 @@ +namespace ServiceStack.Api.OpenApi.Specification +{ + public static class OpenApiType + { + public const string Array = "array"; + public const string Boolean = "boolean"; + public const string Number = "number"; + public const string Integer = "integer"; + public const string String = "string"; + public const string Object = "object"; + } + + public static class OpenApiTypeFormat + { + public const string Array = "int32"; + public const string Byte = "byte"; + public const string Binary = "binary"; + public const string Date = "date"; + public const string DateTime = "date-time"; + public const string Double = "double"; + public const string Float = "float"; + public const string Int = "int32"; + public const string Long = "int64"; + public const string Password = "password"; + } +} diff --git a/src/ServiceStack.Api.OpenApi/Specification/OpenApiXmlObject.cs b/src/ServiceStack.Api.OpenApi/Specification/OpenApiXmlObject.cs new file mode 100644 index 00000000000..a01f72efe3b --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Specification/OpenApiXmlObject.cs @@ -0,0 +1,20 @@ +using System.Runtime.Serialization; + +namespace ServiceStack.Api.OpenApi.Specification +{ + [DataContract] + public class OpenApiXmlObject + { + [DataMember(Name = "name")] + public string Name { get; set; } + [DataMember(Name = "namespace")] + public string Namespace { get; set; } + [DataMember(Name = "prefix")] + public string Prefix { get; set; } + [DataMember(Name = "attribute")] + public bool Attribute { get; set; } + [DataMember(Name = "wrapped")] + public bool Wrapped { get; set; } + } + +} diff --git a/src/ServiceStack.Api.OpenApi/Support/IOrderedDictionary.cs b/src/ServiceStack.Api.OpenApi/Support/IOrderedDictionary.cs new file mode 100644 index 00000000000..23703a0073e --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Support/IOrderedDictionary.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; + +namespace ServiceStack.Api.OpenApi.Support +{ + /// + /// Represents a generic collection of key/value pairs that are ordered independently of the key and value. + /// + /// The type of the keys in the dictionary + /// The type of the values in the dictionary + public interface IOrderedDictionary + : IOrderedDictionary, IDictionary + { + /// + /// Adds an entry with the specified key and value into the IOrderedDictionary<TKey,TValue> collection with the lowest available index. + /// + /// The key of the entry to add. + /// The value of the entry to add. + /// The index of the newly added entry + /// + /// You can also use the property to add new elements by setting the value of a key that does not exist in the IOrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the IOrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. + /// An element with the same key already exists in the IOrderedDictionary<TKey,TValue> + /// The IOrderedDictionary<TKey,TValue> is read-only.
      + /// -or-
      + /// The IOrderedDictionary<TKey,TValue> has a fized size.
      + new int Add(TKey key, TValue value); + + /// + /// Inserts a new entry into the IOrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. + /// + /// The zero-based index at which the element should be inserted. + /// The key of the entry to add. + /// The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. + /// is less than 0.
      + /// -or-
      + /// is greater than .
      + /// An element with the same key already exists in the IOrderedDictionary<TKey,TValue>. + /// The IOrderedDictionary<TKey,TValue> is read-only.
      + /// -or-
      + /// The IOrderedDictionary<TKey,TValue> has a fized size.
      + void Insert(int index, TKey key, TValue value); + + /// + /// Gets or sets the value at the specified index. + /// + /// The zero-based index of the value to get or set. + /// The value of the item at the specified index. + /// is less than 0.
      + /// -or-
      + /// is equal to or greater than .
      + new TValue this[int index] + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/ServiceStack.Api.OpenApi/Support/OrderedDictionary.cs b/src/ServiceStack.Api.OpenApi/Support/OrderedDictionary.cs new file mode 100644 index 00000000000..2ce188fe01f --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/Support/OrderedDictionary.cs @@ -0,0 +1,642 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; + +namespace ServiceStack.Api.OpenApi.Support +{ + /// + /// Represents a generic collection of key/value pairs that are ordered independently of the key and value. + /// + /// The type of the keys in the dictionary + /// The type of the values in the dictionary + public class OrderedDictionary : IOrderedDictionary + { + private const int DefaultInitialCapacity = 0; + + private static readonly string KeyTypeName = typeof(TKey).FullName; + private static readonly string ValueTypeName = typeof(TValue).FullName; + private static readonly bool ValueTypeIsReferenceType = !typeof(ValueType).IsAssignableFrom(typeof(TValue)); + + private Dictionary dictionary; + private List> list; + private readonly IEqualityComparer comparer; + private object syncRoot; + private readonly int initialCapacity; + + /// + /// Initializes a new instance of the OrderedDictionary<TKey,TValue> class. + /// + public OrderedDictionary() + : this(DefaultInitialCapacity, null) + { + } + + /// + /// Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified initial capacity. + /// + /// The initial number of elements that the OrderedDictionary<TKey,TValue> can contain. + /// is less than 0 + public OrderedDictionary(int capacity) + : this(capacity, null) + { + } + + /// + /// Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified comparer. + /// + /// The IEqualityComparer<TKey> to use when comparing keys, or to use the default EqualityComparer<TKey> for the type of the key. + public OrderedDictionary(IEqualityComparer comparer) + : this(DefaultInitialCapacity, comparer) + { + } + + /// + /// Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified initial capacity and comparer. + /// + /// The initial number of elements that the OrderedDictionary<TKey,TValue> collection can contain. + /// The IEqualityComparer<TKey> to use when comparing keys, or to use the default EqualityComparer<TKey> for the type of the key. + /// is less than 0 + public OrderedDictionary(int capacity, IEqualityComparer comparer) + { + if (0 > capacity) + throw new ArgumentOutOfRangeException("capacity", "'capacity' must be non-negative"); + + initialCapacity = capacity; + this.comparer = comparer; + } + + /// + /// Converts the object passed as a key to the key type of the dictionary + /// + /// The key object to check + /// The key object, cast as the key type of the dictionary + /// is . + /// The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . + private static TKey ConvertToKeyType(object keyObject) + { + if (null == keyObject) + { + throw new ArgumentNullException("key"); + } + else + { + if (keyObject is TKey) + return (TKey)keyObject; + } + throw new ArgumentException("'key' must be of type " + KeyTypeName, "key"); + } + + /// + /// Converts the object passed as a value to the value type of the dictionary + /// + /// The object to convert to the value type of the dictionary + /// The value object, converted to the value type of the dictionary + /// is , and the value type of the OrderedDictionary<TKey,TValue> is a value type. + /// The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . + private static TValue ConvertToValueType(object value) + { + if (null == value) + { + if (ValueTypeIsReferenceType) + return default(TValue); + else + throw new ArgumentNullException("value"); + } + else + { + if (value is TValue) + return (TValue)value; + } + throw new ArgumentException("'value' must be of type " + ValueTypeName, "value"); + } + + /// + /// Gets the dictionary object that stores the keys and values + /// + /// The dictionary object that stores the keys and values for the OrderedDictionary<TKey,TValue> + /// Accessing this property will create the dictionary object if necessary + private Dictionary Dictionary + { + get + { + if (null == dictionary) + { + dictionary = new Dictionary(initialCapacity, comparer); + } + return dictionary; + } + } + + /// + /// Gets the list object that stores the key/value pairs. + /// + /// The list object that stores the key/value pairs for the OrderedDictionary<TKey,TValue> + /// Accessing this property will create the list object if necessary. + private List> List + { + get + { + if (null == list) + { + list = new List>(initialCapacity); + } + return list; + } + } + + IDictionaryEnumerator IOrderedDictionary.GetEnumerator() + { + return Dictionary.GetEnumerator(); + } + + IDictionaryEnumerator IDictionary.GetEnumerator() + { + return Dictionary.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return List.GetEnumerator(); + } + + IEnumerator> IEnumerable>.GetEnumerator() + { + return List.GetEnumerator(); + } + + /// + /// Inserts a new entry into the OrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. + /// + /// The zero-based index at which the element should be inserted. + /// The key of the entry to add. + /// The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. + /// is less than 0.
      + /// -or-
      + /// is greater than .
      + /// is . + /// An element with the same key already exists in the OrderedDictionary<TKey,TValue>. + public void Insert(int index, TKey key, TValue value) + { + if (index > Count || index < 0) + throw new ArgumentOutOfRangeException("index"); + + Dictionary.Add(key, value); + List.Insert(index, new KeyValuePair(key, value)); + } + + /// + /// Inserts a new entry into the OrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. + /// + /// The zero-based index at which the element should be inserted. + /// The key of the entry to add. + /// The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. + /// is less than 0.
      + /// -or-
      + /// is greater than .
      + /// is .
      + /// -or-
      + /// is , and the value type of the OrderedDictionary<TKey,TValue> is a value type.
      + /// The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      + /// -or-
      + /// The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      + /// -or-
      + /// An element with the same key already exists in the OrderedDictionary<TKey,TValue>.
      + void IOrderedDictionary.Insert(int index, object key, object value) + { + Insert(index, ConvertToKeyType(key), ConvertToValueType(value)); + } + + /// + /// Removes the entry at the specified index from the OrderedDictionary<TKey,TValue> collection. + /// + /// The zero-based index of the entry to remove. + /// is less than 0.
      + /// -or-
      + /// index is equal to or greater than .
      + public void RemoveAt(int index) + { + if (index >= Count || index < 0) + throw new ArgumentOutOfRangeException("index", "'index' must be non-negative and less than the size of the collection"); + + TKey key = List[index].Key; + + List.RemoveAt(index); + Dictionary.Remove(key); + } + + /// + /// Gets or sets the value at the specified index. + /// + /// The zero-based index of the value to get or set. + /// The value of the item at the specified index. + /// is less than 0.
      + /// -or-
      + /// index is equal to or greater than .
      + public TValue this[int index] + { + get + { + return List[index].Value; + } + + set + { + if (index >= Count || index < 0) + throw new ArgumentOutOfRangeException("index", "'index' must be non-negative and less than the size of the collection"); + + TKey key = List[index].Key; + + List[index] = new KeyValuePair(key, value); + Dictionary[key] = value; + } + } + + /// + /// Gets or sets the value at the specified index. + /// + /// The zero-based index of the value to get or set. + /// The value of the item at the specified index. + /// is less than 0.
      + /// -or-
      + /// index is equal to or greater than .
      + /// is a null reference, and the value type of the OrderedDictionary<TKey,TValue> is a value type. + /// The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . + object IOrderedDictionary.this[int index] + { + get + { + return this[index]; + } + + set + { + this[index] = ConvertToValueType(value); + } + } + + /// + /// Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. + /// + /// The key of the entry to add. + /// The value of the entry to add. This value can be . + /// A key cannot be , but a value can be. + /// You can also use the property to add new elements by setting the value of a key that does not exist in the OrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the OrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. + /// is + /// An element with the same key already exists in the OrderedDictionary<TKey,TValue> + void IDictionary.Add(TKey key, TValue value) + { + Add(key, value); + } + + /// + /// Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. + /// + /// The key of the entry to add. + /// The value of the entry to add. This value can be . + /// The index of the newly added entry + /// A key cannot be , but a value can be. + /// You can also use the property to add new elements by setting the value of a key that does not exist in the OrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the OrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. + /// is + /// An element with the same key already exists in the OrderedDictionary<TKey,TValue> + public int Add(TKey key, TValue value) + { + Dictionary.Add(key, value); + List.Add(new KeyValuePair(key, value)); + return Count - 1; + } + + /// + /// Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. + /// + /// The key of the entry to add. + /// The value of the entry to add. This value can be . + /// is .
      + /// -or-
      + /// is , and the value type of the OrderedDictionary<TKey,TValue> is a value type.
      + /// The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      + /// -or-
      + /// The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
      + void IDictionary.Add(object key, object value) + { + Add(ConvertToKeyType(key), ConvertToValueType(value)); + } + + /// + /// Removes all elements from the OrderedDictionary<TKey,TValue> collection. + /// + /// The capacity is not changed as a result of calling this method. + public void Clear() + { + Dictionary.Clear(); + List.Clear(); + } + + /// + /// Determines whether the OrderedDictionary<TKey,TValue> collection contains a specific key. + /// + /// The key to locate in the OrderedDictionary<TKey,TValue> collection. + /// if the OrderedDictionary<TKey,TValue> collection contains an element with the specified key; otherwise, . + /// is + public bool ContainsKey(TKey key) + { + return Dictionary.ContainsKey(key); + } + /// + /// Determines whether the OrderedDictionary<TKey,TValue> collection contains a specific key. + /// + /// The key to locate in the OrderedDictionary<TKey,TValue> collection. + /// if the OrderedDictionary<TKey,TValue> collection contains an element with the specified key; otherwise, . + /// is + /// The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . + bool IDictionary.Contains(object key) + { + return ContainsKey(ConvertToKeyType(key)); + } + + /// + /// Gets a value indicating whether the OrderedDictionary<TKey,TValue> has a fixed size. + /// + /// if the OrderedDictionary<TKey,TValue> has a fixed size; otherwise, . The default is . + bool IDictionary.IsFixedSize + { + get + { + return false; + } + } + + /// + /// Gets a value indicating whether the OrderedDictionary<TKey,TValue> collection is read-only. + /// + /// if the OrderedDictionary<TKey,TValue> is read-only; otherwise, . The default is . + /// + /// A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created. + /// A collection that is read-only is simply a collection with a wrapper that prevents modification of the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes. + /// + public bool IsReadOnly + { + get + { + return false; + } + } + + /// + /// Gets an object containing the keys in the OrderedDictionary<TKey,TValue>. + /// + /// An object containing the keys in the OrderedDictionary<TKey,TValue>. + /// The returned object is not a static copy; instead, the collection refers back to the keys in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the key collection. + ICollection IDictionary.Keys + { + get + { + return (ICollection)Keys; + } + } + + /// + /// Returns the zero-based index of the specified key in the OrderedDictionary<TKey,TValue> + /// + /// The key to locate in the OrderedDictionary<TKey,TValue> + /// The zero-based index of , if is found in the OrderedDictionary<TKey,TValue>; otherwise, -1 + /// This method performs a linear search; therefore it has a cost of O(n) at worst. + public int IndexOfKey(TKey key) + { + if (null == key) + throw new ArgumentNullException("key"); + + for (int index = 0; index < List.Count; index++) + { + KeyValuePair entry = List[index]; + TKey next = entry.Key; + if (null != comparer) + { + if (comparer.Equals(next, key)) + { + return index; + } + } + else if (next.Equals(key)) + { + return index; + } + } + + return -1; + } + + /// + /// Removes the entry with the specified key from the OrderedDictionary<TKey,TValue> collection. + /// + /// The key of the entry to remove + /// if the key was found and the corresponding element was removed; otherwise, + public bool Remove(TKey key) + { + if (null == key) + throw new ArgumentNullException("key"); + + int index = IndexOfKey(key); + if (index >= 0) + { + if (Dictionary.Remove(key)) + { + List.RemoveAt(index); + return true; + } + } + return false; + } + + /// + /// Removes the entry with the specified key from the OrderedDictionary<TKey,TValue> collection. + /// + /// The key of the entry to remove + void IDictionary.Remove(object key) + { + Remove(ConvertToKeyType(key)); + } + + /// + /// Gets an object containing the values in the OrderedDictionary<TKey,TValue> collection. + /// + /// An object containing the values in the OrderedDictionary<TKey,TValue> collection. + /// The returned object is not a static copy; instead, the refers back to the values in the original OrderedDictionary<TKey,TValue> collection. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the . + ICollection IDictionary.Values + { + get + { + return (ICollection)Values; + } + } + + /// + /// Gets or sets the value with the specified key. + /// + /// The key of the value to get or set. + /// The value associated with the specified key. If the specified key is not found, attempting to get it returns , and attempting to set it creates a new element using the specified key. + public TValue this[TKey key] + { + get + { + return Dictionary[key]; + } + set + { + if (Dictionary.ContainsKey(key)) + { + Dictionary[key] = value; + List[IndexOfKey(key)] = new KeyValuePair(key, value); + } + else + { + Add(key, value); + } + } + } + + /// + /// Gets or sets the value with the specified key. + /// + /// The key of the value to get or set. + /// The value associated with the specified key. If the specified key is not found, attempting to get it returns , and attempting to set it creates a new element using the specified key. + object IDictionary.this[object key] + { + get + { + return this[ConvertToKeyType(key)]; + } + set + { + this[ConvertToKeyType(key)] = ConvertToValueType(value); + } + } + + /// + /// Copies the elements of the OrderedDictionary<TKey,TValue> elements to a one-dimensional Array object at the specified index. + /// + /// The one-dimensional object that is the destination of the objects copied from the OrderedDictionary<TKey,TValue>. The must have zero-based indexing. + /// The zero-based index in at which copying begins. + /// The method preserves the order of the elements in the OrderedDictionary<TKey,TValue> + void ICollection.CopyTo(Array array, int index) + { + ((ICollection)List).CopyTo(array, index); + } + + /// + /// Gets the number of key/values pairs contained in the OrderedDictionary<TKey,TValue> collection. + /// + /// The number of key/value pairs contained in the OrderedDictionary<TKey,TValue> collection. + public int Count + { + get + { + return List.Count; + } + } + + /// + /// Gets a value indicating whether access to the OrderedDictionary<TKey,TValue> object is synchronized (thread-safe). + /// + /// This method always returns false. + bool ICollection.IsSynchronized + { + get + { + return false; + } + } + + /// + /// Gets an object that can be used to synchronize access to the OrderedDictionary<TKey,TValue> object. + /// + /// An object that can be used to synchronize access to the OrderedDictionary<TKey,TValue> object. + object ICollection.SyncRoot + { + get + { + if (this.syncRoot == null) + { + System.Threading.Interlocked.CompareExchange(ref this.syncRoot, new object(), null); + } + return this.syncRoot; + } + } + + /// + /// Gets an ICollection<TKey> object containing the keys in the OrderedDictionary<TKey,TValue>. + /// + /// An ICollection<TKey> object containing the keys in the OrderedDictionary<TKey,TValue>. + /// The returned ICollection<TKey> object is not a static copy; instead, the collection refers back to the keys in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the key collection. + public ICollection Keys + { + get + { + return Dictionary.Keys; + } + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key of the value to get. + /// When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of . This parameter can be passed uninitialized. + /// if the OrderedDictionary<TKey,TValue> contains an element with the specified key; otherwise, . + public bool TryGetValue(TKey key, out TValue value) + { + return Dictionary.TryGetValue(key, out value); + } + + /// + /// Gets an ICollection<TValue> object containing the values in the OrderedDictionary<TKey,TValue>. + /// + /// An ICollection<TValue> object containing the values in the OrderedDictionary<TKey,TValue>. + /// The returned ICollection<TKey> object is not a static copy; instead, the collection refers back to the values in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the value collection. + public ICollection Values + { + get + { + return Dictionary.Values; + } + } + + /// + /// Adds the specified value to the OrderedDictionary<TKey,TValue> with the specified key. + /// + /// The KeyValuePair<TKey,TValue> structure representing the key and value to add to the OrderedDictionary<TKey,TValue>. + void ICollection>.Add(KeyValuePair item) + { + Add(item.Key, item.Value); + } + + /// + /// Determines whether the OrderedDictionary<TKey,TValue> contains a specific key and value. + /// + /// The KeyValuePair<TKey,TValue> structure to locate in the OrderedDictionary<TKey,TValue>. + /// if is found in the OrderedDictionary<TKey,TValue>; otherwise, . + bool ICollection>.Contains(KeyValuePair item) + { + return ((ICollection>)Dictionary).Contains(item); + } + + /// + /// Copies the elements of the OrderedDictionary<TKey,TValue> to an array of type , starting at the specified index. + /// + /// The one-dimensional array of type KeyValuePair<TKey,TValue> that is the destination of the KeyValuePair<TKey,TValue> elements copied from the OrderedDictionary<TKey,TValue>. The array must have zero-based indexing. + /// The zero-based index in at which copying begins. + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) + { + ((ICollection>)Dictionary).CopyTo(array, arrayIndex); + } + + /// + /// Removes a key and value from the dictionary. + /// + /// The KeyValuePair<TKey,TValue> structure representing the key and value to remove from the OrderedDictionary<TKey,TValue>. + /// if the key and value represented by is successfully found and removed; otherwise, . This method returns if is not found in the OrderedDictionary<TKey,TValue>. + bool ICollection>.Remove(KeyValuePair item) + { + return Remove(item.Key); + } + } +} diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/css/print.css b/src/ServiceStack.Api.OpenApi/swagger-ui/css/print.css new file mode 100644 index 00000000000..f2e8446445c --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/css/print.css @@ -0,0 +1 @@ +.swagger-section pre code{display:block;padding:.5em;background:#f0f0f0}.swagger-section pre .clojure .built_in,.swagger-section pre .lisp .title,.swagger-section pre .nginx .title,.swagger-section pre .subst,.swagger-section pre .tag .title,.swagger-section pre code{color:#000}.swagger-section pre .addition,.swagger-section pre .aggregate,.swagger-section pre .apache .cbracket,.swagger-section pre .apache .tag,.swagger-section pre .bash .variable,.swagger-section pre .constant,.swagger-section pre .django .variable,.swagger-section pre .erlang_repl .function_or_atom,.swagger-section pre .flow,.swagger-section pre .markdown .header,.swagger-section pre .parent,.swagger-section pre .preprocessor,.swagger-section pre .ruby .symbol,.swagger-section pre .ruby .symbol .string,.swagger-section pre .rules .value,.swagger-section pre .rules .value .number,.swagger-section pre .smalltalk .class,.swagger-section pre .stream,.swagger-section pre .string,.swagger-section pre .tag .value,.swagger-section pre .template_tag,.swagger-section pre .tex .command,.swagger-section pre .tex .special,.swagger-section pre .title{color:#800}.swagger-section pre .annotation,.swagger-section pre .chunk,.swagger-section pre .comment,.swagger-section pre .diff .header,.swagger-section pre .markdown .blockquote,.swagger-section pre .template_comment{color:#888}.swagger-section pre .change,.swagger-section pre .date,.swagger-section pre .go .constant,.swagger-section pre .literal,.swagger-section pre .markdown .bullet,.swagger-section pre .markdown .link_url,.swagger-section pre .number,.swagger-section pre .regexp,.swagger-section pre .smalltalk .char,.swagger-section pre .smalltalk .symbol{color:#080}.swagger-section pre .apache .sqbracket,.swagger-section pre .array,.swagger-section pre .attr_selector,.swagger-section pre .clojure .attribute,.swagger-section pre .coffeescript .property,.swagger-section pre .decorator,.swagger-section pre .deletion,.swagger-section pre .doctype,.swagger-section pre .envvar,.swagger-section pre .erlang_repl .reserved,.swagger-section pre .filter .argument,.swagger-section pre .important,.swagger-section pre .javadoc,.swagger-section pre .label,.swagger-section pre .localvars,.swagger-section pre .markdown .link_label,.swagger-section pre .nginx .built_in,.swagger-section pre .pi,.swagger-section pre .prompt,.swagger-section pre .pseudo,.swagger-section pre .ruby .string,.swagger-section pre .shebang,.swagger-section pre .tex .formula,.swagger-section pre .vhdl .attribute{color:#88f}.swagger-section pre .aggregate,.swagger-section pre .apache .tag,.swagger-section pre .bash .variable,.swagger-section pre .built_in,.swagger-section pre .css .tag,.swagger-section pre .go .typename,.swagger-section pre .id,.swagger-section pre .javadoctag,.swagger-section pre .keyword,.swagger-section pre .markdown .strong,.swagger-section pre .phpdoc,.swagger-section pre .request,.swagger-section pre .smalltalk .class,.swagger-section pre .status,.swagger-section pre .tex .command,.swagger-section pre .title,.swagger-section pre .winutils,.swagger-section pre .yardoctag{font-weight:700}.swagger-section pre .markdown .emphasis{font-style:italic}.swagger-section pre .nginx .built_in{font-weight:400}.swagger-section pre .coffeescript .javascript,.swagger-section pre .javascript .xml,.swagger-section pre .tex .formula,.swagger-section pre .xml .cdata,.swagger-section pre .xml .css,.swagger-section pre .xml .javascript,.swagger-section pre .xml .vbscript{opacity:.5}.swagger-section .hljs{display:block;overflow-x:auto;padding:.5em;background:#f0f0f0}.swagger-section .hljs,.swagger-section .hljs-subst{color:#444}.swagger-section .hljs-attribute,.swagger-section .hljs-doctag,.swagger-section .hljs-keyword,.swagger-section .hljs-meta-keyword,.swagger-section .hljs-name,.swagger-section .hljs-selector-tag{font-weight:700}.swagger-section .hljs-addition,.swagger-section .hljs-built_in,.swagger-section .hljs-bullet,.swagger-section .hljs-code,.swagger-section .hljs-literal{color:#1f811f}.swagger-section .hljs-link,.swagger-section .hljs-regexp,.swagger-section .hljs-selector-attr,.swagger-section .hljs-selector-pseudo,.swagger-section .hljs-symbol,.swagger-section .hljs-template-variable,.swagger-section .hljs-variable{color:#bc6060}.swagger-section .hljs-deletion,.swagger-section .hljs-number,.swagger-section .hljs-quote,.swagger-section .hljs-selector-class,.swagger-section .hljs-selector-id,.swagger-section .hljs-string,.swagger-section .hljs-template-tag,.swagger-section .hljs-type{color:#800}.swagger-section .hljs-section,.swagger-section .hljs-title{color:#800;font-weight:700}.swagger-section .hljs-comment{color:#888}.swagger-section .hljs-meta{color:#2b6ea1}.swagger-section .hljs-emphasis{font-style:italic}.swagger-section .hljs-strong{font-weight:700}.swagger-section .swagger-ui-wrap{line-height:1;font-family:Droid Sans,sans-serif;min-width:760px;max-width:960px;margin-left:auto;margin-right:auto}.swagger-section .swagger-ui-wrap b,.swagger-section .swagger-ui-wrap strong{font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap blockquote,.swagger-section .swagger-ui-wrap q{quotes:none}.swagger-section .swagger-ui-wrap p{line-height:1.4em;padding:0 0 10px;color:#333}.swagger-section .swagger-ui-wrap blockquote:after,.swagger-section .swagger-ui-wrap blockquote:before,.swagger-section .swagger-ui-wrap q:after,.swagger-section .swagger-ui-wrap q:before{content:none}.swagger-section .swagger-ui-wrap .heading_with_menu h1,.swagger-section .swagger-ui-wrap .heading_with_menu h2,.swagger-section .swagger-ui-wrap .heading_with_menu h3,.swagger-section .swagger-ui-wrap .heading_with_menu h4,.swagger-section .swagger-ui-wrap .heading_with_menu h5,.swagger-section .swagger-ui-wrap .heading_with_menu h6{display:block;clear:none;float:left;-ms-box-sizing:border-box;box-sizing:border-box;width:60%}.swagger-section .swagger-ui-wrap table{border-collapse:collapse;border-spacing:0}.swagger-section .swagger-ui-wrap table thead tr th{padding:5px;font-size:.9em;color:#666;border-bottom:1px solid #999}.swagger-section .swagger-ui-wrap table tbody tr:last-child td{border-bottom:none}.swagger-section .swagger-ui-wrap table tbody tr.offset{background-color:#f0f0f0}.swagger-section .swagger-ui-wrap table tbody tr td{padding:6px;font-size:.9em;border-bottom:1px solid #ccc;vertical-align:top;line-height:1.3em}.swagger-section .swagger-ui-wrap ol{margin:0 0 10px;padding:0 0 0 18px;list-style-type:decimal}.swagger-section .swagger-ui-wrap ol li{padding:5px 0;font-size:.9em;color:#333}.swagger-section .swagger-ui-wrap ol,.swagger-section .swagger-ui-wrap ul{list-style:none}.swagger-section .swagger-ui-wrap h1 a,.swagger-section .swagger-ui-wrap h2 a,.swagger-section .swagger-ui-wrap h3 a,.swagger-section .swagger-ui-wrap h4 a,.swagger-section .swagger-ui-wrap h5 a,.swagger-section .swagger-ui-wrap h6 a{text-decoration:none}.swagger-section .swagger-ui-wrap h1 a:hover,.swagger-section .swagger-ui-wrap h2 a:hover,.swagger-section .swagger-ui-wrap h3 a:hover,.swagger-section .swagger-ui-wrap h4 a:hover,.swagger-section .swagger-ui-wrap h5 a:hover,.swagger-section .swagger-ui-wrap h6 a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap h1 span.divider,.swagger-section .swagger-ui-wrap h2 span.divider,.swagger-section .swagger-ui-wrap h3 span.divider,.swagger-section .swagger-ui-wrap h4 span.divider,.swagger-section .swagger-ui-wrap h5 span.divider,.swagger-section .swagger-ui-wrap h6 span.divider{color:#aaa}.swagger-section .swagger-ui-wrap a{color:#547f00}.swagger-section .swagger-ui-wrap a img{border:none}.swagger-section .swagger-ui-wrap article,.swagger-section .swagger-ui-wrap aside,.swagger-section .swagger-ui-wrap details,.swagger-section .swagger-ui-wrap figcaption,.swagger-section .swagger-ui-wrap figure,.swagger-section .swagger-ui-wrap footer,.swagger-section .swagger-ui-wrap header,.swagger-section .swagger-ui-wrap hgroup,.swagger-section .swagger-ui-wrap menu,.swagger-section .swagger-ui-wrap nav,.swagger-section .swagger-ui-wrap section,.swagger-section .swagger-ui-wrap summary{display:block}.swagger-section .swagger-ui-wrap pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#fcf6db;border:1px solid #e5e0c6;padding:10px}.swagger-section .swagger-ui-wrap pre code{line-height:1.6em;background:none}.swagger-section .swagger-ui-wrap .content>.content-type>div>label{clear:both;display:block;color:#0f6ab4;font-size:1.1em;margin:0;padding:15px 0 5px}.swagger-section .swagger-ui-wrap .content pre{font-size:12px;margin-top:5px;padding:5px}.swagger-section .swagger-ui-wrap .icon-btn{cursor:pointer}.swagger-section .swagger-ui-wrap .info_title{padding-bottom:10px;font-weight:700;font-size:25px}.swagger-section .swagger-ui-wrap .footer{margin-top:20px}.swagger-section .swagger-ui-wrap div.big p,.swagger-section .swagger-ui-wrap p.big{font-size:1em;margin-bottom:10px}.swagger-section .swagger-ui-wrap form.fullwidth ol li.numeric input,.swagger-section .swagger-ui-wrap form.fullwidth ol li.string input,.swagger-section .swagger-ui-wrap form.fullwidth ol li.text textarea,.swagger-section .swagger-ui-wrap form.fullwidth ol li.url input{width:500px!important}.swagger-section .swagger-ui-wrap .info_license,.swagger-section .swagger-ui-wrap .info_tos{padding-bottom:5px}.swagger-section .swagger-ui-wrap .message-fail{color:#c00}.swagger-section .swagger-ui-wrap .info_email,.swagger-section .swagger-ui-wrap .info_name,.swagger-section .swagger-ui-wrap .info_url{padding-bottom:5px}.swagger-section .swagger-ui-wrap .info_description{padding-bottom:10px;font-size:15px}.swagger-section .swagger-ui-wrap .markdown ol li,.swagger-section .swagger-ui-wrap .markdown ul li{padding:3px 0;line-height:1.4em;color:#333}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input{display:block;padding:4px;width:auto;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input.title,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input.title,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input.title{font-size:1.3em}.swagger-section .swagger-ui-wrap table.fullwidth{width:100%}.swagger-section .swagger-ui-wrap .model-signature{font-family:Droid Sans,sans-serif;font-size:1em;line-height:1.5em}.swagger-section .swagger-ui-wrap .model-signature .signature-nav a{text-decoration:none;color:#aaa}.swagger-section .swagger-ui-wrap .model-signature .signature-nav a:hover{text-decoration:underline;color:#000}.swagger-section .swagger-ui-wrap .model-signature .signature-nav .selected{color:#000;text-decoration:none}.swagger-section .swagger-ui-wrap .model-signature .propType{color:#55a}.swagger-section .swagger-ui-wrap .model-signature pre:hover{background-color:#ffd}.swagger-section .swagger-ui-wrap .model-signature pre{font-size:.85em;line-height:1.2em;overflow:auto;height:200px;resize:vertical;cursor:pointer}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav{display:block;min-width:230px;margin:0;padding:0}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li{float:left;margin:0 5px 5px 0;padding:2px 5px 2px 0;border-right:1px solid #ddd}.swagger-section .swagger-ui-wrap .model-signature .propOpt{color:#555}.swagger-section .swagger-ui-wrap .model-signature .snippet small{font-size:.75em}.swagger-section .swagger-ui-wrap .model-signature .propOptKey{font-style:italic}.swagger-section .swagger-ui-wrap .model-signature .description .strong{font-weight:700;color:#000;font-size:.9em}.swagger-section .swagger-ui-wrap .model-signature .description div{font-size:.9em;line-height:1.5em;margin-left:1em}.swagger-section .swagger-ui-wrap .model-signature .description .stronger{font-weight:700;color:#000}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper{border-spacing:0;position:absolute;background-color:#fff;border:1px solid #bbb;display:none;font-size:11px;max-width:400px;line-height:30px;color:#000;padding:5px;margin-left:10px}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper th{text-align:center;background-color:#eee;border:1px solid #bbb;font-size:11px;color:#666;font-weight:700;padding:5px;line-height:15px}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper .optionName{font-weight:700}.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:first-child,.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:last-child{display:inline}.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:not(:first-child):before{display:block;content:''}.swagger-section .swagger-ui-wrap .model-signature .description span:last-of-type.propDesc.markdown>p:only-child{margin-right:-3px}.swagger-section .swagger-ui-wrap .model-signature .propName{font-weight:700}.swagger-section .swagger-ui-wrap .model-signature .signature-container{clear:both}.swagger-section .swagger-ui-wrap .body-textarea{width:300px;height:100px;border:1px solid #aaa}.swagger-section .swagger-ui-wrap .markdown li code,.swagger-section .swagger-ui-wrap .markdown p code{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#f0f0f0;color:#000;padding:1px 3px}.swagger-section .swagger-ui-wrap .required{font-weight:700}.swagger-section .swagger-ui-wrap .editor_holder{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em}.swagger-section .swagger-ui-wrap .editor_holder label{font-weight:400!important}.swagger-section .swagger-ui-wrap .editor_holder label.required{font-weight:700!important}.swagger-section .swagger-ui-wrap input.parameter{width:300px;border:1px solid #aaa}.swagger-section .swagger-ui-wrap h1{color:#000;font-size:1.5em;line-height:1.3em;padding:10px 0;font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap .heading_with_menu{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap .heading_with_menu ul{display:block;clear:none;float:right;-ms-box-sizing:border-box;box-sizing:border-box;margin-top:10px}.swagger-section .swagger-ui-wrap h2{color:#000;font-size:1.3em;padding:10px 0}.swagger-section .swagger-ui-wrap h2 a{color:#000}.swagger-section .swagger-ui-wrap h2 span.sub{font-size:.7em;color:#999;font-style:italic}.swagger-section .swagger-ui-wrap h2 span.sub a{color:#777}.swagger-section .swagger-ui-wrap span.weak{color:#666}.swagger-section .swagger-ui-wrap .message-success{color:#89bf04}.swagger-section .swagger-ui-wrap caption,.swagger-section .swagger-ui-wrap td,.swagger-section .swagger-ui-wrap th{text-align:left;font-weight:400;vertical-align:middle}.swagger-section .swagger-ui-wrap .code{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.text textarea{font-family:Droid Sans,sans-serif;height:250px;padding:4px;display:block;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.select select{display:block;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean label{display:block;float:left;clear:none;margin:0;padding:0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean input{display:block;float:left;clear:none;margin:0 5px 0 0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.required label{color:#000}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label{display:block;clear:both;width:auto;padding:0 0 3px;color:#666}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label abbr{padding-left:3px;color:#888}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li p.inline-hints{margin-left:0;font-style:italic;font-size:.9em;margin:0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.buttons{margin:0;padding:0}.swagger-section .swagger-ui-wrap span.blank,.swagger-section .swagger-ui-wrap span.empty{color:#888;font-style:italic}.swagger-section .swagger-ui-wrap .markdown h3{color:#547f00}.swagger-section .swagger-ui-wrap .markdown h4{color:#666}.swagger-section .swagger-ui-wrap .markdown pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#fcf6db;border:1px solid #e5e0c6;padding:10px;margin:0 0 10px}.swagger-section .swagger-ui-wrap .markdown pre code{line-height:1.6em;overflow:auto}.swagger-section .swagger-ui-wrap div.gist{margin:20px 0 25px!important}.swagger-section .swagger-ui-wrap ul#resources{font-family:Droid Sans,sans-serif;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource{border-bottom:1px solid #ddd}.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading h2 a,.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading h2 a{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading ul.options li a,.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading ul.options li a{color:#555}.swagger-section .swagger-ui-wrap ul#resources li.resource:last-child{border-bottom:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading{border:1px solid transparent;float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options{overflow:hidden;padding:0;display:block;clear:none;float:right;margin:14px 10px 0 0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li{float:left;clear:none;margin:0;padding:2px 10px;border-right:1px solid #ddd;color:#666;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a{color:#aaa;text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover{text-decoration:underline;color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a.active,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:active,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.first,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:first-child{padding-left:0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options.first,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options:first-child{padding-left:0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#999;padding-left:0;display:block;clear:none;float:left;font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#999}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation{float:none;clear:both;overflow:hidden;display:block;margin:0 0 10px;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading{float:none;clear:both;overflow:hidden;display:block;margin:0;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3{display:block;clear:none;float:left;width:auto;margin:0;padding:0;line-height:1.1em;color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path{padding-left:10px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a{color:#000;text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a.toggleOperation.deprecated{text-decoration:line-through}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.http_method a{text-transform:uppercase;text-decoration:none;color:#fff;display:inline-block;width:50px;font-size:.7em;text-align:center;padding:7px 0 4px;border-radius:2px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span{margin:0;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options{overflow:hidden;padding:0;display:block;clear:none;float:right;margin:6px 10px 0 0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li{float:left;clear:none;margin:0;padding:2px 10px;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a{text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .markdown p{color:inherit;padding:0;line-height:inherit}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .nickname{color:#aaa;padding:0;line-height:inherit}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content{border-top:none;padding:10px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;margin:0 0 20px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content h4{font-size:1.1em;margin:0;padding:15px 0 5px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header a{padding:4px 0 0 10px;display:inline-block;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit{display:block;clear:none;float:left;padding:6px 8px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber{background-image:url(../images/throbber.gif);width:128px;height:16px;display:block;clear:none;float:right}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type=text].error{outline:2px solid #000;outline-color:#c00}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form select[name=parameterContentType]{max-width:300px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.response div.block pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;padding:10px;font-size:.9em;max-height:400px;overflow-y:auto}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading{background-color:#f9f2e9;border:1px solid #f0e0ca}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a{background-color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#f0e0ca;color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li a{color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content{background-color:#faf5ee;border:1px solid #f0e0ca}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content h4{color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content div.sandbox_header a{color:#dcb67f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading{background-color:#fcffcd;border:1px solid #000;border-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading h3 span.http_method a{text-transform:uppercase;background-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#ffd20f;color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li a{color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content{background-color:#fcffcd;border:1px solid #000;border-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content h4{color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a{color:#6fc992}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading{background-color:#f5e8e8;border:1px solid #e8c6c7}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading h3 span.http_method a{text-transform:uppercase;background-color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#e8c6c7;color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li a{color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content{background-color:#f7eded;border:1px solid #e8c6c7}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content h4{color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a{color:#c8787a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading{background-color:#e7f6ec;border:1px solid #c3e8d1}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading h3 span.http_method a{background-color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3e8d1;color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li a{color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content{background-color:#ebf7f0;border:1px solid #c3e8d1}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content h4{color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content div.sandbox_header a{color:#6fc992}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading{background-color:#fce9e3;border:1px solid #f5d5c3}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading h3 span.http_method a{background-color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#f0cecb;color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li a{color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content{background-color:#faf0ef;border:1px solid #f0cecb}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content h4{color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content div.sandbox_header a{color:#dcb67f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading{background-color:#e7f0f7;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading h3 span.http_method a{background-color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3d9ec;color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li a{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content{background-color:#ebf3f9;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content h4{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content div.sandbox_header a{color:#6fa5d2}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading{background-color:#e7f0f7;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading h3 span.http_method a{background-color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3d9ec;color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li a{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content{background-color:#ebf3f9;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content h4{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content div.sandbox_header a{color:#6fa5d2}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content{border-top:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a.active,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations.first,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations:first-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li.first,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child{padding-left:0}.swagger-section .swagger-ui-wrap p#colophon{margin:0 15px 40px;padding:10px 0;font-size:.8em;border-top:1px solid #ddd;font-family:Droid Sans,sans-serif;color:#999;font-style:italic}.swagger-section .swagger-ui-wrap p#colophon a{text-decoration:none;color:#547f00}.swagger-section .swagger-ui-wrap h3{color:#000;font-size:1.1em;padding:10px 0}.swagger-section .swagger-ui-wrap .markdown ol,.swagger-section .swagger-ui-wrap .markdown ul{font-family:Droid Sans,sans-serif;margin:5px 0 10px;padding:0 0 0 18px;list-style-type:disc}.swagger-section .swagger-ui-wrap form.form_box{background-color:#ebf3f9;border:1px solid #c3d9ec;padding:10px}.swagger-section .swagger-ui-wrap form.form_box label{color:#0f6ab4!important}.swagger-section .swagger-ui-wrap form.form_box input[type=submit]{display:block;padding:10px}.swagger-section .swagger-ui-wrap form.form_box p.weak{font-size:.8em}.swagger-section .swagger-ui-wrap form.form_box p{font-size:.9em;padding:0 0 15px;color:#7e7b6d}.swagger-section .swagger-ui-wrap form.form_box p a{color:#646257}.swagger-section .swagger-ui-wrap form.form_box p strong{color:#000}.swagger-section .swagger-ui-wrap .operation-status td.markdown>p:last-child{padding-bottom:0}.swagger-section .title{font-style:bold}.swagger-section .secondary_form{display:none}.swagger-section .main_image{display:block;margin-left:auto;margin-right:auto}.swagger-section .oauth_body{margin-left:100px;margin-right:100px}.swagger-section .oauth_submit{text-align:center;display:inline-block}.swagger-section .authorize-wrapper{margin:15px 0 10px}.swagger-section .authorize-wrapper_operation{float:right}.swagger-section .authorize__btn:hover{text-decoration:underline;cursor:pointer}.swagger-section .authorize__btn_operation:hover .authorize-scopes{display:block}.swagger-section .authorize-scopes{position:absolute;margin-top:20px;background:#fff;border:1px solid #ccc;border-radius:5px;display:none;font-size:13px;max-width:300px;line-height:30px;color:#000;padding:5px}.swagger-section .authorize-scopes .authorize__scope{text-decoration:none}.swagger-section .authorize__btn_operation{height:18px;vertical-align:middle;display:inline-block;background:url(../images/explorer_icons.png) no-repeat}.swagger-section .authorize__btn_operation_login{background-position:0 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .authorize__btn_operation_logout{background-position:-30px 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section #auth_container{color:#fff;display:inline-block;border:none;padding:5px;width:87px;height:13px}.swagger-section #auth_container .authorize__btn{color:#fff}.swagger-section .auth_container{padding:0 0 10px;margin-bottom:5px;border-bottom:1px solid #ccc;font-size:.9em}.swagger-section .auth_container .auth__title{color:#547f00;font-size:1.2em}.swagger-section .auth_container .basic_auth__label{display:inline-block;width:60px}.swagger-section .auth_container .auth__description{color:#999;margin-bottom:5px}.swagger-section .auth_container .auth__button{margin-top:10px;height:30px}.swagger-section .auth_container .key_auth__field{margin:5px 0}.swagger-section .auth_container .key_auth__label{display:inline-block;width:60px}.swagger-section .api-popup-dialog{position:absolute;display:none}.swagger-section .api-popup-dialog-wrapper{z-index:2;width:500px;background:#fff;padding:20px;border:1px solid #ccc;border-radius:5px;font-size:13px;color:#777;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.swagger-section .api-popup-dialog-shadow{position:fixed;top:0;left:0;width:100%;height:100%;opacity:.2;background-color:gray;z-index:1}.swagger-section .api-popup-dialog .api-popup-title{font-size:24px;padding:10px 0}.swagger-section .api-popup-dialog .error-msg{padding-left:5px;padding-bottom:5px}.swagger-section .api-popup-dialog .api-popup-content{max-height:500px;overflow-y:auto}.swagger-section .api-popup-dialog .api-popup-authbtn,.swagger-section .api-popup-dialog .api-popup-cancel{height:30px}.swagger-section .api-popup-scopes{padding:10px 20px}.swagger-section .api-popup-scopes li{padding:5px 0;line-height:20px}.swagger-section .api-popup-scopes li input{position:relative;top:2px}.swagger-section .api-popup-scopes .api-scope-desc{padding-left:20px;font-style:italic}.swagger-section .api-popup-actions{padding-top:10px}.swagger-section fieldset{padding-bottom:10px;padding-left:20px}#header{display:none}.swagger-section .swagger-ui-wrap .model-signature pre{max-height:none}.swagger-section .swagger-ui-wrap .body-textarea,.swagger-section .swagger-ui-wrap input.parameter{width:100px}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options{display:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content{display:block!important} \ No newline at end of file diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/css/reset.css b/src/ServiceStack.Api.OpenApi/swagger-ui/css/reset.css new file mode 100644 index 00000000000..40dc8301c57 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/css/reset.css @@ -0,0 +1 @@ +a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0} \ No newline at end of file diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/css/screen.css b/src/ServiceStack.Api.OpenApi/swagger-ui/css/screen.css new file mode 100644 index 00000000000..1f069f6abe3 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/css/screen.css @@ -0,0 +1 @@ +.swagger-section pre code{display:block;padding:.5em;background:#f0f0f0}.swagger-section pre .clojure .built_in,.swagger-section pre .lisp .title,.swagger-section pre .nginx .title,.swagger-section pre .subst,.swagger-section pre .tag .title,.swagger-section pre code{color:#000}.swagger-section pre .addition,.swagger-section pre .aggregate,.swagger-section pre .apache .cbracket,.swagger-section pre .apache .tag,.swagger-section pre .bash .variable,.swagger-section pre .constant,.swagger-section pre .django .variable,.swagger-section pre .erlang_repl .function_or_atom,.swagger-section pre .flow,.swagger-section pre .markdown .header,.swagger-section pre .parent,.swagger-section pre .preprocessor,.swagger-section pre .ruby .symbol,.swagger-section pre .ruby .symbol .string,.swagger-section pre .rules .value,.swagger-section pre .rules .value .number,.swagger-section pre .smalltalk .class,.swagger-section pre .stream,.swagger-section pre .string,.swagger-section pre .tag .value,.swagger-section pre .template_tag,.swagger-section pre .tex .command,.swagger-section pre .tex .special,.swagger-section pre .title{color:#800}.swagger-section pre .annotation,.swagger-section pre .chunk,.swagger-section pre .comment,.swagger-section pre .diff .header,.swagger-section pre .markdown .blockquote,.swagger-section pre .template_comment{color:#888}.swagger-section pre .change,.swagger-section pre .date,.swagger-section pre .go .constant,.swagger-section pre .literal,.swagger-section pre .markdown .bullet,.swagger-section pre .markdown .link_url,.swagger-section pre .number,.swagger-section pre .regexp,.swagger-section pre .smalltalk .char,.swagger-section pre .smalltalk .symbol{color:#080}.swagger-section pre .apache .sqbracket,.swagger-section pre .array,.swagger-section pre .attr_selector,.swagger-section pre .clojure .attribute,.swagger-section pre .coffeescript .property,.swagger-section pre .decorator,.swagger-section pre .deletion,.swagger-section pre .doctype,.swagger-section pre .envvar,.swagger-section pre .erlang_repl .reserved,.swagger-section pre .filter .argument,.swagger-section pre .important,.swagger-section pre .javadoc,.swagger-section pre .label,.swagger-section pre .localvars,.swagger-section pre .markdown .link_label,.swagger-section pre .nginx .built_in,.swagger-section pre .pi,.swagger-section pre .prompt,.swagger-section pre .pseudo,.swagger-section pre .ruby .string,.swagger-section pre .shebang,.swagger-section pre .tex .formula,.swagger-section pre .vhdl .attribute{color:#88f}.swagger-section pre .aggregate,.swagger-section pre .apache .tag,.swagger-section pre .bash .variable,.swagger-section pre .built_in,.swagger-section pre .css .tag,.swagger-section pre .go .typename,.swagger-section pre .id,.swagger-section pre .javadoctag,.swagger-section pre .keyword,.swagger-section pre .markdown .strong,.swagger-section pre .phpdoc,.swagger-section pre .request,.swagger-section pre .smalltalk .class,.swagger-section pre .status,.swagger-section pre .tex .command,.swagger-section pre .title,.swagger-section pre .winutils,.swagger-section pre .yardoctag{font-weight:700}.swagger-section pre .markdown .emphasis{font-style:italic}.swagger-section pre .nginx .built_in{font-weight:400}.swagger-section pre .coffeescript .javascript,.swagger-section pre .javascript .xml,.swagger-section pre .tex .formula,.swagger-section pre .xml .cdata,.swagger-section pre .xml .css,.swagger-section pre .xml .javascript,.swagger-section pre .xml .vbscript{opacity:.5}.swagger-section .hljs{display:block;overflow-x:auto;padding:.5em;background:#f0f0f0}.swagger-section .hljs,.swagger-section .hljs-subst{color:#444}.swagger-section .hljs-attribute,.swagger-section .hljs-doctag,.swagger-section .hljs-keyword,.swagger-section .hljs-meta-keyword,.swagger-section .hljs-name,.swagger-section .hljs-selector-tag{font-weight:700}.swagger-section .hljs-addition,.swagger-section .hljs-built_in,.swagger-section .hljs-bullet,.swagger-section .hljs-code,.swagger-section .hljs-literal{color:#1f811f}.swagger-section .hljs-link,.swagger-section .hljs-regexp,.swagger-section .hljs-selector-attr,.swagger-section .hljs-selector-pseudo,.swagger-section .hljs-symbol,.swagger-section .hljs-template-variable,.swagger-section .hljs-variable{color:#bc6060}.swagger-section .hljs-deletion,.swagger-section .hljs-number,.swagger-section .hljs-quote,.swagger-section .hljs-selector-class,.swagger-section .hljs-selector-id,.swagger-section .hljs-string,.swagger-section .hljs-template-tag,.swagger-section .hljs-type{color:#800}.swagger-section .hljs-section,.swagger-section .hljs-title{color:#800;font-weight:700}.swagger-section .hljs-comment{color:#888}.swagger-section .hljs-meta{color:#2b6ea1}.swagger-section .hljs-emphasis{font-style:italic}.swagger-section .hljs-strong{font-weight:700}.swagger-section .swagger-ui-wrap{line-height:1;font-family:Droid Sans,sans-serif;min-width:760px;max-width:960px;margin-left:auto;margin-right:auto}.swagger-section .swagger-ui-wrap b,.swagger-section .swagger-ui-wrap strong{font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap blockquote,.swagger-section .swagger-ui-wrap q{quotes:none}.swagger-section .swagger-ui-wrap p{line-height:1.4em;padding:0 0 10px;color:#333}.swagger-section .swagger-ui-wrap blockquote:after,.swagger-section .swagger-ui-wrap blockquote:before,.swagger-section .swagger-ui-wrap q:after,.swagger-section .swagger-ui-wrap q:before{content:none}.swagger-section .swagger-ui-wrap .heading_with_menu h1,.swagger-section .swagger-ui-wrap .heading_with_menu h2,.swagger-section .swagger-ui-wrap .heading_with_menu h3,.swagger-section .swagger-ui-wrap .heading_with_menu h4,.swagger-section .swagger-ui-wrap .heading_with_menu h5,.swagger-section .swagger-ui-wrap .heading_with_menu h6{display:block;clear:none;float:left;-ms-box-sizing:border-box;box-sizing:border-box;width:60%}.swagger-section .swagger-ui-wrap table{border-collapse:collapse;border-spacing:0}.swagger-section .swagger-ui-wrap table thead tr th{padding:5px;font-size:.9em;color:#666;border-bottom:1px solid #999}.swagger-section .swagger-ui-wrap table tbody tr:last-child td{border-bottom:none}.swagger-section .swagger-ui-wrap table tbody tr.offset{background-color:#f0f0f0}.swagger-section .swagger-ui-wrap table tbody tr td{padding:6px;font-size:.9em;border-bottom:1px solid #ccc;vertical-align:top;line-height:1.3em}.swagger-section .swagger-ui-wrap ol{margin:0 0 10px;padding:0 0 0 18px;list-style-type:decimal}.swagger-section .swagger-ui-wrap ol li{padding:5px 0;font-size:.9em;color:#333}.swagger-section .swagger-ui-wrap ol,.swagger-section .swagger-ui-wrap ul{list-style:none}.swagger-section .swagger-ui-wrap h1 a,.swagger-section .swagger-ui-wrap h2 a,.swagger-section .swagger-ui-wrap h3 a,.swagger-section .swagger-ui-wrap h4 a,.swagger-section .swagger-ui-wrap h5 a,.swagger-section .swagger-ui-wrap h6 a{text-decoration:none}.swagger-section .swagger-ui-wrap h1 a:hover,.swagger-section .swagger-ui-wrap h2 a:hover,.swagger-section .swagger-ui-wrap h3 a:hover,.swagger-section .swagger-ui-wrap h4 a:hover,.swagger-section .swagger-ui-wrap h5 a:hover,.swagger-section .swagger-ui-wrap h6 a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap h1 span.divider,.swagger-section .swagger-ui-wrap h2 span.divider,.swagger-section .swagger-ui-wrap h3 span.divider,.swagger-section .swagger-ui-wrap h4 span.divider,.swagger-section .swagger-ui-wrap h5 span.divider,.swagger-section .swagger-ui-wrap h6 span.divider{color:#aaa}.swagger-section .swagger-ui-wrap a{color:#547f00}.swagger-section .swagger-ui-wrap a img{border:none}.swagger-section .swagger-ui-wrap article,.swagger-section .swagger-ui-wrap aside,.swagger-section .swagger-ui-wrap details,.swagger-section .swagger-ui-wrap figcaption,.swagger-section .swagger-ui-wrap figure,.swagger-section .swagger-ui-wrap footer,.swagger-section .swagger-ui-wrap header,.swagger-section .swagger-ui-wrap hgroup,.swagger-section .swagger-ui-wrap menu,.swagger-section .swagger-ui-wrap nav,.swagger-section .swagger-ui-wrap section,.swagger-section .swagger-ui-wrap summary{display:block}.swagger-section .swagger-ui-wrap pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#fcf6db;border:1px solid #e5e0c6;padding:10px}.swagger-section .swagger-ui-wrap pre code{line-height:1.6em;background:none}.swagger-section .swagger-ui-wrap .content>.content-type>div>label{clear:both;display:block;color:#0f6ab4;font-size:1.1em;margin:0;padding:15px 0 5px}.swagger-section .swagger-ui-wrap .content pre{font-size:12px;margin-top:5px;padding:5px}.swagger-section .swagger-ui-wrap .icon-btn{cursor:pointer}.swagger-section .swagger-ui-wrap .info_title{padding-bottom:10px;font-weight:700;font-size:25px}.swagger-section .swagger-ui-wrap .footer{margin-top:20px}.swagger-section .swagger-ui-wrap div.big p,.swagger-section .swagger-ui-wrap p.big{font-size:1em;margin-bottom:10px}.swagger-section .swagger-ui-wrap form.fullwidth ol li.numeric input,.swagger-section .swagger-ui-wrap form.fullwidth ol li.string input,.swagger-section .swagger-ui-wrap form.fullwidth ol li.text textarea,.swagger-section .swagger-ui-wrap form.fullwidth ol li.url input{width:500px!important}.swagger-section .swagger-ui-wrap .info_license,.swagger-section .swagger-ui-wrap .info_tos{padding-bottom:5px}.swagger-section .swagger-ui-wrap .message-fail{color:#c00}.swagger-section .swagger-ui-wrap .info_email,.swagger-section .swagger-ui-wrap .info_name,.swagger-section .swagger-ui-wrap .info_url{padding-bottom:5px}.swagger-section .swagger-ui-wrap .info_description{padding-bottom:10px;font-size:15px}.swagger-section .swagger-ui-wrap .markdown ol li,.swagger-section .swagger-ui-wrap .markdown ul li{padding:3px 0;line-height:1.4em;color:#333}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input{display:block;padding:4px;width:auto;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input.title,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input.title,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input.title{font-size:1.3em}.swagger-section .swagger-ui-wrap table.fullwidth{width:100%}.swagger-section .swagger-ui-wrap .model-signature{font-family:Droid Sans,sans-serif;font-size:1em;line-height:1.5em}.swagger-section .swagger-ui-wrap .model-signature .signature-nav a{text-decoration:none;color:#aaa}.swagger-section .swagger-ui-wrap .model-signature .signature-nav a:hover{text-decoration:underline;color:#000}.swagger-section .swagger-ui-wrap .model-signature .signature-nav .selected{color:#000;text-decoration:none}.swagger-section .swagger-ui-wrap .model-signature .propType{color:#55a}.swagger-section .swagger-ui-wrap .model-signature pre:hover{background-color:#ffd}.swagger-section .swagger-ui-wrap .model-signature pre{font-size:.85em;line-height:1.2em;overflow:auto;height:200px;resize:vertical;cursor:pointer}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav{display:block;min-width:230px;margin:0;padding:0}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li{float:left;margin:0 5px 5px 0;padding:2px 5px 2px 0;border-right:1px solid #ddd}.swagger-section .swagger-ui-wrap .model-signature .propOpt{color:#555}.swagger-section .swagger-ui-wrap .model-signature .snippet small{font-size:.75em}.swagger-section .swagger-ui-wrap .model-signature .propOptKey{font-style:italic}.swagger-section .swagger-ui-wrap .model-signature .description .strong{font-weight:700;color:#000;font-size:.9em}.swagger-section .swagger-ui-wrap .model-signature .description div{font-size:.9em;line-height:1.5em;margin-left:1em}.swagger-section .swagger-ui-wrap .model-signature .description .stronger{font-weight:700;color:#000}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper{border-spacing:0;position:absolute;background-color:#fff;border:1px solid #bbb;display:none;font-size:11px;max-width:400px;line-height:30px;color:#000;padding:5px;margin-left:10px}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper th{text-align:center;background-color:#eee;border:1px solid #bbb;font-size:11px;color:#666;font-weight:700;padding:5px;line-height:15px}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper .optionName{font-weight:700}.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:first-child,.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:last-child{display:inline}.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:not(:first-child):before{display:block;content:''}.swagger-section .swagger-ui-wrap .model-signature .description span:last-of-type.propDesc.markdown>p:only-child{margin-right:-3px}.swagger-section .swagger-ui-wrap .model-signature .propName{font-weight:700}.swagger-section .swagger-ui-wrap .model-signature .signature-container{clear:both}.swagger-section .swagger-ui-wrap .body-textarea{width:300px;height:100px;border:1px solid #aaa}.swagger-section .swagger-ui-wrap .markdown li code,.swagger-section .swagger-ui-wrap .markdown p code{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#f0f0f0;color:#000;padding:1px 3px}.swagger-section .swagger-ui-wrap .required{font-weight:700}.swagger-section .swagger-ui-wrap .editor_holder{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em}.swagger-section .swagger-ui-wrap .editor_holder label{font-weight:400!important}.swagger-section .swagger-ui-wrap .editor_holder label.required{font-weight:700!important}.swagger-section .swagger-ui-wrap input.parameter{width:300px;border:1px solid #aaa}.swagger-section .swagger-ui-wrap h1{color:#000;font-size:1.5em;line-height:1.3em;padding:10px 0;font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap .heading_with_menu{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap .heading_with_menu ul{display:block;clear:none;float:right;-ms-box-sizing:border-box;box-sizing:border-box;margin-top:10px}.swagger-section .swagger-ui-wrap h2{color:#000;font-size:1.3em;padding:10px 0}.swagger-section .swagger-ui-wrap h2 a{color:#000}.swagger-section .swagger-ui-wrap h2 span.sub{font-size:.7em;color:#999;font-style:italic}.swagger-section .swagger-ui-wrap h2 span.sub a{color:#777}.swagger-section .swagger-ui-wrap span.weak{color:#666}.swagger-section .swagger-ui-wrap .message-success{color:#89bf04}.swagger-section .swagger-ui-wrap caption,.swagger-section .swagger-ui-wrap td,.swagger-section .swagger-ui-wrap th{text-align:left;font-weight:400;vertical-align:middle}.swagger-section .swagger-ui-wrap .code{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.text textarea{font-family:Droid Sans,sans-serif;height:250px;padding:4px;display:block;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.select select{display:block;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean label{display:block;float:left;clear:none;margin:0;padding:0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean input{display:block;float:left;clear:none;margin:0 5px 0 0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.required label{color:#000}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label{display:block;clear:both;width:auto;padding:0 0 3px;color:#666}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label abbr{padding-left:3px;color:#888}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li p.inline-hints{margin-left:0;font-style:italic;font-size:.9em;margin:0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.buttons{margin:0;padding:0}.swagger-section .swagger-ui-wrap span.blank,.swagger-section .swagger-ui-wrap span.empty{color:#888;font-style:italic}.swagger-section .swagger-ui-wrap .markdown h3{color:#547f00}.swagger-section .swagger-ui-wrap .markdown h4{color:#666}.swagger-section .swagger-ui-wrap .markdown pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#fcf6db;border:1px solid #e5e0c6;padding:10px;margin:0 0 10px}.swagger-section .swagger-ui-wrap .markdown pre code{line-height:1.6em;overflow:auto}.swagger-section .swagger-ui-wrap div.gist{margin:20px 0 25px!important}.swagger-section .swagger-ui-wrap ul#resources{font-family:Droid Sans,sans-serif;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource{border-bottom:1px solid #ddd}.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading h2 a,.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading h2 a{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading ul.options li a,.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading ul.options li a{color:#555}.swagger-section .swagger-ui-wrap ul#resources li.resource:last-child{border-bottom:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading{border:1px solid transparent;float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options{overflow:hidden;padding:0;display:block;clear:none;float:right;margin:14px 10px 0 0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li{float:left;clear:none;margin:0;padding:2px 10px;border-right:1px solid #ddd;color:#666;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a{color:#aaa;text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover{text-decoration:underline;color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a.active,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:active,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.first,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:first-child{padding-left:0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options.first,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options:first-child{padding-left:0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#999;padding-left:0;display:block;clear:none;float:left;font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#999}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation{float:none;clear:both;overflow:hidden;display:block;margin:0 0 10px;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading{float:none;clear:both;overflow:hidden;display:block;margin:0;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3{display:block;clear:none;float:left;width:auto;margin:0;padding:0;line-height:1.1em;color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path{padding-left:10px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a{color:#000;text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a.toggleOperation.deprecated{text-decoration:line-through}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.http_method a{text-transform:uppercase;text-decoration:none;color:#fff;display:inline-block;width:50px;font-size:.7em;text-align:center;padding:7px 0 4px;border-radius:2px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span{margin:0;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options{overflow:hidden;padding:0;display:block;clear:none;float:right;margin:6px 10px 0 0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li{float:left;clear:none;margin:0;padding:2px 10px;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a{text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .markdown p{color:inherit;padding:0;line-height:inherit}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .nickname{color:#aaa;padding:0;line-height:inherit}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content{border-top:none;padding:10px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;margin:0 0 20px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content h4{font-size:1.1em;margin:0;padding:15px 0 5px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header a{padding:4px 0 0 10px;display:inline-block;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit{display:block;clear:none;float:left;padding:6px 8px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber{background-image:url(../images/throbber.gif);width:128px;height:16px;display:block;clear:none;float:right}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type=text].error{outline:2px solid #000;outline-color:#c00}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form select[name=parameterContentType]{max-width:300px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.response div.block pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;padding:10px;font-size:.9em;max-height:400px;overflow-y:auto}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading{background-color:#f9f2e9;border:1px solid #f0e0ca}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a{background-color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#f0e0ca;color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li a{color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content{background-color:#faf5ee;border:1px solid #f0e0ca}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content h4{color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content div.sandbox_header a{color:#dcb67f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading{background-color:#fcffcd;border:1px solid #000;border-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading h3 span.http_method a{text-transform:uppercase;background-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#ffd20f;color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li a{color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content{background-color:#fcffcd;border:1px solid #000;border-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content h4{color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a{color:#6fc992}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading{background-color:#f5e8e8;border:1px solid #e8c6c7}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading h3 span.http_method a{text-transform:uppercase;background-color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#e8c6c7;color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li a{color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content{background-color:#f7eded;border:1px solid #e8c6c7}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content h4{color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a{color:#c8787a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading{background-color:#e7f6ec;border:1px solid #c3e8d1}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading h3 span.http_method a{background-color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3e8d1;color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li a{color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content{background-color:#ebf7f0;border:1px solid #c3e8d1}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content h4{color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content div.sandbox_header a{color:#6fc992}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading{background-color:#fce9e3;border:1px solid #f5d5c3}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading h3 span.http_method a{background-color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#f0cecb;color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li a{color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content{background-color:#faf0ef;border:1px solid #f0cecb}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content h4{color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content div.sandbox_header a{color:#dcb67f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading{background-color:#e7f0f7;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading h3 span.http_method a{background-color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3d9ec;color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li a{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content{background-color:#ebf3f9;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content h4{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content div.sandbox_header a{color:#6fa5d2}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading{background-color:#e7f0f7;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading h3 span.http_method a{background-color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3d9ec;color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li a{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content{background-color:#ebf3f9;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content h4{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content div.sandbox_header a{color:#6fa5d2}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content{border-top:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a.active,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations.first,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations:first-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li.first,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child{padding-left:0}.swagger-section .swagger-ui-wrap p#colophon{margin:0 15px 40px;padding:10px 0;font-size:.8em;border-top:1px solid #ddd;font-family:Droid Sans,sans-serif;color:#999;font-style:italic}.swagger-section .swagger-ui-wrap p#colophon a{text-decoration:none;color:#547f00}.swagger-section .swagger-ui-wrap h3{color:#000;font-size:1.1em;padding:10px 0}.swagger-section .swagger-ui-wrap .markdown ol,.swagger-section .swagger-ui-wrap .markdown ul{font-family:Droid Sans,sans-serif;margin:5px 0 10px;padding:0 0 0 18px;list-style-type:disc}.swagger-section .swagger-ui-wrap form.form_box{background-color:#ebf3f9;border:1px solid #c3d9ec;padding:10px}.swagger-section .swagger-ui-wrap form.form_box label{color:#0f6ab4!important}.swagger-section .swagger-ui-wrap form.form_box input[type=submit]{display:block;padding:10px}.swagger-section .swagger-ui-wrap form.form_box p.weak{font-size:.8em}.swagger-section .swagger-ui-wrap form.form_box p{font-size:.9em;padding:0 0 15px;color:#7e7b6d}.swagger-section .swagger-ui-wrap form.form_box p a{color:#646257}.swagger-section .swagger-ui-wrap form.form_box p strong{color:#000}.swagger-section .swagger-ui-wrap .operation-status td.markdown>p:last-child{padding-bottom:0}.swagger-section .title{font-style:bold}.swagger-section .secondary_form{display:none}.swagger-section .main_image{display:block;margin-left:auto;margin-right:auto}.swagger-section .oauth_body{margin-left:100px;margin-right:100px}.swagger-section .oauth_submit{text-align:center;display:inline-block}.swagger-section .authorize-wrapper{margin:15px 0 10px}.swagger-section .authorize-wrapper_operation{float:right}.swagger-section .authorize__btn:hover{text-decoration:underline;cursor:pointer}.swagger-section .authorize__btn_operation:hover .authorize-scopes{display:block}.swagger-section .authorize-scopes{position:absolute;margin-top:20px;background:#fff;border:1px solid #ccc;border-radius:5px;display:none;font-size:13px;max-width:300px;line-height:30px;color:#000;padding:5px}.swagger-section .authorize-scopes .authorize__scope{text-decoration:none}.swagger-section .authorize__btn_operation{height:18px;vertical-align:middle;display:inline-block;background:url(../images/explorer_icons.png) no-repeat}.swagger-section .authorize__btn_operation_login{background-position:0 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .authorize__btn_operation_logout{background-position:-30px 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section #auth_container{color:#fff;display:inline-block;border:none;padding:5px;width:87px;height:13px}.swagger-section #auth_container .authorize__btn{color:#fff}.swagger-section .auth_container{padding:0 0 10px;margin-bottom:5px;border-bottom:1px solid #ccc;font-size:.9em}.swagger-section .auth_container .auth__title{color:#547f00;font-size:1.2em}.swagger-section .auth_container .basic_auth__label{display:inline-block;width:60px}.swagger-section .auth_container .auth__description{color:#999;margin-bottom:5px}.swagger-section .auth_container .auth__button{margin-top:10px;height:30px}.swagger-section .auth_container .key_auth__field{margin:5px 0}.swagger-section .auth_container .key_auth__label{display:inline-block;width:60px}.swagger-section .api-popup-dialog{position:absolute;display:none}.swagger-section .api-popup-dialog-wrapper{z-index:2;width:500px;background:#fff;padding:20px;border:1px solid #ccc;border-radius:5px;font-size:13px;color:#777;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.swagger-section .api-popup-dialog-shadow{position:fixed;top:0;left:0;width:100%;height:100%;opacity:.2;background-color:gray;z-index:1}.swagger-section .api-popup-dialog .api-popup-title{font-size:24px;padding:10px 0}.swagger-section .api-popup-dialog .error-msg{padding-left:5px;padding-bottom:5px}.swagger-section .api-popup-dialog .api-popup-content{max-height:500px;overflow-y:auto}.swagger-section .api-popup-dialog .api-popup-authbtn,.swagger-section .api-popup-dialog .api-popup-cancel{height:30px}.swagger-section .api-popup-scopes{padding:10px 20px}.swagger-section .api-popup-scopes li{padding:5px 0;line-height:20px}.swagger-section .api-popup-scopes li input{position:relative;top:2px}.swagger-section .api-popup-scopes .api-scope-desc{padding-left:20px;font-style:italic}.swagger-section .api-popup-actions{padding-top:10px}.swagger-section fieldset{padding-bottom:10px;padding-left:20px}.swagger-section .access,.swagger-section .auth{float:right}.swagger-section .api-ic{height:18px;vertical-align:middle;display:inline-block;background:url(../images/explorer_icons.png) no-repeat}.swagger-section .api-ic .api_information_panel{position:relative;margin-top:20px;margin-left:-5px;background:#fff;border:1px solid #ccc;border-radius:5px;display:none;font-size:13px;max-width:300px;line-height:30px;color:#000;padding:5px}.swagger-section .api-ic .api_information_panel p .api-msg-enabled{color:green}.swagger-section .api-ic .api_information_panel p .api-msg-disabled{color:red}.swagger-section .api-ic:hover .api_information_panel{position:absolute;display:block}.swagger-section .ic-info{background-position:0 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .ic-warning{background-position:-60px 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .ic-error{background-position:-30px 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .ic-off{background-position:-90px 0;width:58px;margin-top:-4px;cursor:pointer}.swagger-section .ic-on{background-position:-160px 0;width:58px;margin-top:-4px;cursor:pointer}.swagger-section #header{background-color:#89bf04;padding:9px 14px 19px;height:23px;min-width:775px}.swagger-section #input_baseUrl{width:400px}.swagger-section #api_selector{display:block;clear:none;float:right}.swagger-section #api_selector .input{display:inline-block;clear:none;margin:0 10px 0 0}.swagger-section #api_selector input{font-size:.9em;padding:3px;margin:0}.swagger-section #input_apiKey{width:200px}.swagger-section #auth_container .authorize__btn,.swagger-section #explore{display:block;text-decoration:none;font-weight:700;padding:6px 8px;font-size:.9em;color:#fff;background-color:#547f00;border-radius:4px}.swagger-section #auth_container .authorize__btn:hover,.swagger-section #explore:hover{background-color:#547f00}.swagger-section #header #logo{font-size:1.5em;font-weight:700;text-decoration:none;color:#fff}.swagger-section #header #logo .logo__img{display:block;float:left;margin-top:2px}.swagger-section #header #logo .logo__title{display:inline-block;padding:5px 0 0 10px}.swagger-section #content_message{margin:10px 15px;font-style:italic;color:#999}.swagger-section #message-bar{min-height:30px;text-align:center;padding-top:10px}.swagger-section .swagger-collapse:before{content:"-"}.swagger-section .swagger-expand:before{content:"+"}.swagger-section .error{outline-color:#c00;background-color:#f2dede} \ No newline at end of file diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/css/style.css b/src/ServiceStack.Api.OpenApi/swagger-ui/css/style.css new file mode 100644 index 00000000000..52907e46365 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/css/style.css @@ -0,0 +1 @@ +.swagger-section #header a#logo{font-size:1.5em;font-weight:700;text-decoration:none;padding:20px 0 20px 40px}#text-head{font-size:80px;font-family:Roboto,sans-serif;color:#fff;float:right;margin-right:20%}.navbar-fixed-top .navbar-brand,.navbar-fixed-top .navbar-nav,.navbar-header{height:auto}.navbar-inverse{background-color:#000;border-color:#000}#navbar-brand{margin-left:20%}.navtext{font-size:10px}.h1,h1{font-size:60px}.navbar-default .navbar-header .navbar-brand{color:#a2dfee}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#393939;font-family:Arvo,serif;font-size:1.5em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#525252;padding-left:0;display:block;clear:none;float:left;font-family:Arvo,serif;font-weight:700}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#0a0a0a}.container1{width:1500px;margin:auto;margin-top:0;background-repeat:no-repeat;background-position:-40px -20px;margin-bottom:210px}.container-inner{width:1200px;margin:auto;background-color:hsla(192,8%,88%,.75);padding-bottom:40px;padding-top:40px;border-radius:15px}.header-content{padding:0;width:1000px}.title1{font-size:80px;font-family:Vollkorn,serif;color:#404040;text-align:center;padding-top:40px;padding-bottom:100px}#icon{margin-top:-18px}.subtext{font-size:25px;font-style:italic;color:#08b;text-align:right;padding-right:250px}.bg-primary{background-color:#00468b}.navbar-default .nav>li>a,.navbar-default .nav>li>a:focus,.navbar-default .nav>li>a:focus:hover,.navbar-default .nav>li>a:hover{color:#08b}.text-faded{font-size:25px;font-family:Vollkorn,serif}.section-heading{font-family:Vollkorn,serif;font-size:45px;padding-bottom:10px}hr{border-color:#00468b;padding-bottom:10px}.description{margin-top:20px;padding-bottom:200px}.description li{font-family:Vollkorn,serif;font-size:25px;color:#525252;margin-left:28%;padding-top:5px}.gap{margin-top:200px}.troubleshootingtext{color:hsla(0,0%,100%,.7);padding-left:30%}.troubleshootingtext li{list-style-type:circle;font-size:25px;padding-bottom:5px}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}.block.response_body.json:hover{cursor:pointer}.backdrop{color:blue}#myModal{height:100%}.modal-backdrop{bottom:0;position:fixed}.curl{padding:10px;font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em;max-height:400px;margin-top:5px;overflow-y:auto;background-color:#fcf6db;border:1px solid #e5e0c6;border-radius:4px}.curl_title{font-size:1.1em;margin:0;padding:15px 0 5px;font-family:Open Sans,Helvetica Neue,Arial,sans-serif;font-weight:500;line-height:1.1}.footer{display:none}.swagger-section .swagger-ui-wrap h2{padding:0}h2{margin:0;margin-bottom:5px}.markdown p,.swagger-section .swagger-ui-wrap .code{font-size:15px;font-family:Arvo,serif}.swagger-section .swagger-ui-wrap b{font-family:Arvo,serif}#signin:hover{cursor:pointer}.dropdown-menu{padding:15px}.navbar-right .dropdown-menu{left:0;right:auto}#signinbutton{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b}.navbar-default .nav>li .details{color:#000;text-transform:none;font-size:15px;font-weight:400;font-family:Open Sans,sans-serif;font-style:italic;line-height:20px;top:-2px}.navbar-default .nav>li .details:hover{color:#000}#signout{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b} \ No newline at end of file diff --git a/lib/ServiceStack.Client.dll.lastcodeanalysissucceeded b/src/ServiceStack.Api.OpenApi/swagger-ui/css/typography.css similarity index 100% rename from lib/ServiceStack.Client.dll.lastcodeanalysissucceeded rename to src/ServiceStack.Api.OpenApi/swagger-ui/css/typography.css diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/fonts/DroidSans-Bold.ttf b/src/ServiceStack.Api.OpenApi/swagger-ui/fonts/DroidSans-Bold.ttf new file mode 100644 index 00000000000..036c4d135bf Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/fonts/DroidSans-Bold.ttf differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/fonts/DroidSans.ttf b/src/ServiceStack.Api.OpenApi/swagger-ui/fonts/DroidSans.ttf new file mode 100644 index 00000000000..e517a0c5b9d Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/fonts/DroidSans.ttf differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/collapse.gif b/src/ServiceStack.Api.OpenApi/swagger-ui/images/collapse.gif new file mode 100644 index 00000000000..8843e8ce5a4 Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/collapse.gif differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/expand.gif b/src/ServiceStack.Api.OpenApi/swagger-ui/images/expand.gif new file mode 100644 index 00000000000..477bf13718d Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/expand.gif differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/explorer_icons.png b/src/ServiceStack.Api.OpenApi/swagger-ui/images/explorer_icons.png new file mode 100644 index 00000000000..be43b273940 Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/explorer_icons.png differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/favicon-16x16.png b/src/ServiceStack.Api.OpenApi/swagger-ui/images/favicon-16x16.png new file mode 100644 index 00000000000..0f7e13b0d99 Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/favicon-16x16.png differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/favicon-32x32.png b/src/ServiceStack.Api.OpenApi/swagger-ui/images/favicon-32x32.png new file mode 100644 index 00000000000..b0a3352ffd3 Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/favicon-32x32.png differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/favicon.ico b/src/ServiceStack.Api.OpenApi/swagger-ui/images/favicon.ico new file mode 100644 index 00000000000..8b60bcf06a7 Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/favicon.ico differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/logo_small.png b/src/ServiceStack.Api.OpenApi/swagger-ui/images/logo_small.png new file mode 100644 index 00000000000..0e071cd228e Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/logo_small.png differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/logo_small_swagger.png b/src/ServiceStack.Api.OpenApi/swagger-ui/images/logo_small_swagger.png new file mode 100644 index 00000000000..ce3908e3f27 Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/logo_small_swagger.png differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/pet_store_api.png b/src/ServiceStack.Api.OpenApi/swagger-ui/images/pet_store_api.png new file mode 100644 index 00000000000..1192ad8cd6a Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/pet_store_api.png differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/throbber.gif b/src/ServiceStack.Api.OpenApi/swagger-ui/images/throbber.gif new file mode 100644 index 00000000000..06393889242 Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/throbber.gif differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/images/wordnik_api.png b/src/ServiceStack.Api.OpenApi/swagger-ui/images/wordnik_api.png new file mode 100644 index 00000000000..dc0ddab138f Binary files /dev/null and b/src/ServiceStack.Api.OpenApi/swagger-ui/images/wordnik_api.png differ diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/index.html b/src/ServiceStack.Api.OpenApi/swagger-ui/index.html new file mode 100644 index 00000000000..14232f9f4e7 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/index.html @@ -0,0 +1,108 @@ + + + + + + Swagger UI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
       
      +
      + + diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ca.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ca.js new file mode 100644 index 00000000000..f8c815aa92c --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ca.js @@ -0,0 +1,53 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Advertència: Obsolet", + "Implementation Notes":"Notes d'implementació", + "Response Class":"Classe de la Resposta", + "Status":"Estatus", + "Parameters":"Paràmetres", + "Parameter":"Paràmetre", + "Value":"Valor", + "Description":"Descripció", + "Parameter Type":"Tipus del Paràmetre", + "Data Type":"Tipus de la Dada", + "Response Messages":"Missatges de la Resposta", + "HTTP Status Code":"Codi d'Estatus HTTP", + "Reason":"Raó", + "Response Model":"Model de la Resposta", + "Request URL":"URL de la Sol·licitud", + "Response Body":"Cos de la Resposta", + "Response Code":"Codi de la Resposta", + "Response Headers":"Capçaleres de la Resposta", + "Hide Response":"Amagar Resposta", + "Try it out!":"Prova-ho!", + "Show/Hide":"Mostrar/Amagar", + "List Operations":"Llista Operacions", + "Expand Operations":"Expandir Operacions", + "Raw":"Cru", + "can't parse JSON. Raw result":"no puc analitzar el JSON. Resultat cru", + "Example Value":"Valor d'Exemple", + "Model Schema":"Esquema del Model", + "Model":"Model", + "apply":"aplicar", + "Username":"Nom d'usuari", + "Password":"Contrasenya", + "Terms of service":"Termes del servei", + "Created by":"Creat per", + "See more at":"Veure més en", + "Contact the developer":"Contactar amb el desenvolupador", + "api version":"versió de la api", + "Response Content Type":"Tipus de Contingut de la Resposta", + "fetching resource":"recollint recurs", + "fetching resource list":"recollins llista de recursos", + "Explore":"Explorant", + "Show Swagger Petstore Example Apis":"Mostrar API d'Exemple Swagger Petstore", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"No es pot llegir del servidor. Potser no teniu la configuració de control d'accés apropiada.", + "Please specify the protocol for":"Si us plau, especifiqueu el protocol per a", + "Can't read swagger JSON from":"No es pot llegir el JSON de swagger des de", + "Finished Loading Resource Information. Rendering Swagger UI":"Finalitzada la càrrega del recurs informatiu. Renderitzant Swagger UI", + "Unable to read api":"No es pot llegir l'api", + "from path":"des de la ruta", + "server returned":"el servidor ha retornat" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/el.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/el.js new file mode 100644 index 00000000000..fcd1ffdd5a9 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/el.js @@ -0,0 +1,56 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Προειδοποίηση: Έχει αποσυρθεί", + "Implementation Notes":"Σημειώσεις Υλοποίησης", + "Response Class":"Απόκριση", + "Status":"Κατάσταση", + "Parameters":"Παράμετροι", + "Parameter":"Παράμετρος", + "Value":"Τιμή", + "Description":"Περιγραφή", + "Parameter Type":"Τύπος Παραμέτρου", + "Data Type":"Τύπος Δεδομένων", + "Response Messages":"Μηνύματα Απόκρισης", + "HTTP Status Code":"Κωδικός Κατάστασης HTTP", + "Reason":"Αιτιολογία", + "Response Model":"Μοντέλο Απόκρισης", + "Request URL":"URL Αιτήματος", + "Response Body":"Σώμα Απόκρισης", + "Response Code":"Κωδικός Απόκρισης", + "Response Headers":"Επικεφαλίδες Απόκρισης", + "Hide Response":"Απόκρυψη Απόκρισης", + "Headers":"Επικεφαλίδες", + "Try it out!":"Δοκιμάστε το!", + "Show/Hide":"Εμφάνιση/Απόκρυψη", + "List Operations":"Λίστα Λειτουργιών", + "Expand Operations":"Ανάπτυξη Λειτουργιών", + "Raw":"Ακατέργαστο", + "can't parse JSON. Raw result":"αδυναμία ανάλυσης JSON. Ακατέργαστο αποτέλεσμα", + "Example Value":"Παράδειγμα Τιμής", + "Model Schema":"Σχήμα Μοντέλου", + "Model":"Μοντέλο", + "Click to set as parameter value":"Πατήστε για να θέσετε τιμή παραμέτρου", + "apply":"εφαρμογή", + "Username":"Όνομα χρήση", + "Password":"Κωδικός πρόσβασης", + "Terms of service":"Όροι χρήσης", + "Created by":"Δημιουργήθηκε από", + "See more at":"Δείτε περισσότερα στο", + "Contact the developer":"Επικοινωνήστε με τον προγραμματιστή", + "api version":"έκδοση api", + "Response Content Type":"Τύπος Περιεχομένου Απόκρισης", + "Parameter content type:":"Τύπος περιεχομένου παραμέτρου:", + "fetching resource":"παραλαβή πόρου", + "fetching resource list":"παραλαβή λίστας πόρων", + "Explore":"Εξερεύνηση", + "Show Swagger Petstore Example Apis":"Εμφάνιση Api Δειγμάτων Petstore του Swagger", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"Αδυναμία ανάγνωσης από τον εξυπηρετητή. Μπορεί να μην έχει κατάλληλες ρυθμίσεις για access-control-origin.", + "Please specify the protocol for":"Παρακαλώ προσδιορίστε το πρωτόκολλο για", + "Can't read swagger JSON from":"Αδυναμία ανάγνωσης swagger JSON από", + "Finished Loading Resource Information. Rendering Swagger UI":"Ολοκλήρωση Φόρτωσης Πληροφορικών Πόρου. Παρουσίαση Swagger UI", + "Unable to read api":"Αδυναμία ανάγνωσης api", + "from path":"από το μονοπάτι", + "server returned":"ο εξυπηρετηρής επέστρεψε" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/en.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/en.js new file mode 100644 index 00000000000..918313665db --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/en.js @@ -0,0 +1,56 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Warning: Deprecated", + "Implementation Notes":"Implementation Notes", + "Response Class":"Response Class", + "Status":"Status", + "Parameters":"Parameters", + "Parameter":"Parameter", + "Value":"Value", + "Description":"Description", + "Parameter Type":"Parameter Type", + "Data Type":"Data Type", + "Response Messages":"Response Messages", + "HTTP Status Code":"HTTP Status Code", + "Reason":"Reason", + "Response Model":"Response Model", + "Request URL":"Request URL", + "Response Body":"Response Body", + "Response Code":"Response Code", + "Response Headers":"Response Headers", + "Hide Response":"Hide Response", + "Headers":"Headers", + "Try it out!":"Try it out!", + "Show/Hide":"Show/Hide", + "List Operations":"List Operations", + "Expand Operations":"Expand Operations", + "Raw":"Raw", + "can't parse JSON. Raw result":"can't parse JSON. Raw result", + "Example Value":"Example Value", + "Model Schema":"Model Schema", + "Model":"Model", + "Click to set as parameter value":"Click to set as parameter value", + "apply":"apply", + "Username":"Username", + "Password":"Password", + "Terms of service":"Terms of service", + "Created by":"Created by", + "See more at":"See more at", + "Contact the developer":"Contact the developer", + "api version":"api version", + "Response Content Type":"Response Content Type", + "Parameter content type:":"Parameter content type:", + "fetching resource":"fetching resource", + "fetching resource list":"fetching resource list", + "Explore":"Explore", + "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.", + "Please specify the protocol for":"Please specify the protocol for", + "Can't read swagger JSON from":"Can't read swagger JSON from", + "Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI", + "Unable to read api":"Unable to read api", + "from path":"from path", + "server returned":"server returned" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/es.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/es.js new file mode 100644 index 00000000000..13fa015e6df --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/es.js @@ -0,0 +1,53 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Advertencia: Obsoleto", + "Implementation Notes":"Notas de implementación", + "Response Class":"Clase de la Respuesta", + "Status":"Status", + "Parameters":"Parámetros", + "Parameter":"Parámetro", + "Value":"Valor", + "Description":"Descripción", + "Parameter Type":"Tipo del Parámetro", + "Data Type":"Tipo del Dato", + "Response Messages":"Mensajes de la Respuesta", + "HTTP Status Code":"Código de Status HTTP", + "Reason":"Razón", + "Response Model":"Modelo de la Respuesta", + "Request URL":"URL de la Solicitud", + "Response Body":"Cuerpo de la Respuesta", + "Response Code":"Código de la Respuesta", + "Response Headers":"Encabezados de la Respuesta", + "Hide Response":"Ocultar Respuesta", + "Try it out!":"Pruébalo!", + "Show/Hide":"Mostrar/Ocultar", + "List Operations":"Listar Operaciones", + "Expand Operations":"Expandir Operaciones", + "Raw":"Crudo", + "can't parse JSON. Raw result":"no puede parsear el JSON. Resultado crudo", + "Example Value":"Valor de Ejemplo", + "Model Schema":"Esquema del Modelo", + "Model":"Modelo", + "apply":"aplicar", + "Username":"Nombre de usuario", + "Password":"Contraseña", + "Terms of service":"Términos de Servicio", + "Created by":"Creado por", + "See more at":"Ver más en", + "Contact the developer":"Contactar al desarrollador", + "api version":"versión de la api", + "Response Content Type":"Tipo de Contenido (Content Type) de la Respuesta", + "fetching resource":"buscando recurso", + "fetching resource list":"buscando lista del recurso", + "Explore":"Explorar", + "Show Swagger Petstore Example Apis":"Mostrar Api Ejemplo de Swagger Petstore", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"No se puede leer del servidor. Tal vez no tiene la configuración de control de acceso de origen (access-control-origin) apropiado.", + "Please specify the protocol for":"Por favor, especificar el protocola para", + "Can't read swagger JSON from":"No se puede leer el JSON de swagger desde", + "Finished Loading Resource Information. Rendering Swagger UI":"Finalizada la carga del recurso de Información. Mostrando Swagger UI", + "Unable to read api":"No se puede leer la api", + "from path":"desde ruta", + "server returned":"el servidor retornó" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/fr.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/fr.js new file mode 100644 index 00000000000..388dff14bac --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/fr.js @@ -0,0 +1,54 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Avertissement : Obsolète", + "Implementation Notes":"Notes d'implémentation", + "Response Class":"Classe de la réponse", + "Status":"Statut", + "Parameters":"Paramètres", + "Parameter":"Paramètre", + "Value":"Valeur", + "Description":"Description", + "Parameter Type":"Type du paramètre", + "Data Type":"Type de données", + "Response Messages":"Messages de la réponse", + "HTTP Status Code":"Code de statut HTTP", + "Reason":"Raison", + "Response Model":"Modèle de réponse", + "Request URL":"URL appelée", + "Response Body":"Corps de la réponse", + "Response Code":"Code de la réponse", + "Response Headers":"En-têtes de la réponse", + "Hide Response":"Cacher la réponse", + "Headers":"En-têtes", + "Try it out!":"Testez !", + "Show/Hide":"Afficher/Masquer", + "List Operations":"Liste des opérations", + "Expand Operations":"Développer les opérations", + "Raw":"Brut", + "can't parse JSON. Raw result":"impossible de décoder le JSON. Résultat brut", + "Example Value":"Exemple la valeur", + "Model Schema":"Définition du modèle", + "Model":"Modèle", + "apply":"appliquer", + "Username":"Nom d'utilisateur", + "Password":"Mot de passe", + "Terms of service":"Conditions de service", + "Created by":"Créé par", + "See more at":"Voir plus sur", + "Contact the developer":"Contacter le développeur", + "api version":"version de l'api", + "Response Content Type":"Content Type de la réponse", + "fetching resource":"récupération de la ressource", + "fetching resource list":"récupération de la liste de ressources", + "Explore":"Explorer", + "Show Swagger Petstore Example Apis":"Montrer les Apis de l'exemple Petstore de Swagger", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"Impossible de lire à partir du serveur. Il se peut que les réglages access-control-origin ne soient pas appropriés.", + "Please specify the protocol for":"Veuillez spécifier un protocole pour", + "Can't read swagger JSON from":"Impossible de lire le JSON swagger à partir de", + "Finished Loading Resource Information. Rendering Swagger UI":"Chargement des informations terminé. Affichage de Swagger UI", + "Unable to read api":"Impossible de lire l'api", + "from path":"à partir du chemin", + "server returned":"réponse du serveur" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/geo.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/geo.js new file mode 100644 index 00000000000..609c20d9c86 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/geo.js @@ -0,0 +1,56 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"ყურადღება: აღარ გამოიყენება", + "Implementation Notes":"იმპლემენტაციის აღწერა", + "Response Class":"რესპონს კლასი", + "Status":"სტატუსი", + "Parameters":"პარამეტრები", + "Parameter":"პარამეტრი", + "Value":"მნიშვნელობა", + "Description":"აღწერა", + "Parameter Type":"პარამეტრის ტიპი", + "Data Type":"მონაცემის ტიპი", + "Response Messages":"პასუხი", + "HTTP Status Code":"HTTP სტატუსი", + "Reason":"მიზეზი", + "Response Model":"რესპონს მოდელი", + "Request URL":"მოთხოვნის URL", + "Response Body":"პასუხის სხეული", + "Response Code":"პასუხის კოდი", + "Response Headers":"პასუხის ჰედერები", + "Hide Response":"დამალე პასუხი", + "Headers":"ჰედერები", + "Try it out!":"ცადე !", + "Show/Hide":"გამოჩენა/დამალვა", + "List Operations":"ოპერაციების სია", + "Expand Operations":"ოპერაციები ვრცლად", + "Raw":"ნედლი", + "can't parse JSON. Raw result":"JSON-ის დამუშავება ვერ მოხერხდა. ნედლი პასუხი", + "Example Value":"მაგალითი", + "Model Schema":"მოდელის სტრუქტურა", + "Model":"მოდელი", + "Click to set as parameter value":"პარამეტრისთვის მნიშვნელობის მისანიჭებლად, დააკლიკე", + "apply":"გამოყენება", + "Username":"მოხმარებელი", + "Password":"პაროლი", + "Terms of service":"მომსახურების პირობები", + "Created by":"შექმნა", + "See more at":"ნახე ვრცლად", + "Contact the developer":"დაუკავშირდი დეველოპერს", + "api version":"api ვერსია", + "Response Content Type":"პასუხის კონტენტის ტიპი", + "Parameter content type:":"პარამეტრის კონტენტის ტიპი:", + "fetching resource":"რესურსების მიღება", + "fetching resource list":"რესურსების სიის მიღება", + "Explore":"ნახვა", + "Show Swagger Petstore Example Apis":"ნახე Swagger Petstore სამაგალითო Api", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"სერვერთან დაკავშირება ვერ ხერხდება. შეამოწმეთ access-control-origin.", + "Please specify the protocol for":"მიუთითეთ პროტოკოლი", + "Can't read swagger JSON from":"swagger JSON წაკითხვა ვერ მოხერხდა", + "Finished Loading Resource Information. Rendering Swagger UI":"რესურსების ჩატვირთვა სრულდება. Swagger UI რენდერდება", + "Unable to read api":"api წაკითხვა ვერ მოხერხდა", + "from path":"მისამართიდან", + "server returned":"სერვერმა დააბრუნა" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/it.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/it.js new file mode 100644 index 00000000000..8529c2a90bc --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/it.js @@ -0,0 +1,52 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Attenzione: Deprecato", + "Implementation Notes":"Note di implementazione", + "Response Class":"Classe della risposta", + "Status":"Stato", + "Parameters":"Parametri", + "Parameter":"Parametro", + "Value":"Valore", + "Description":"Descrizione", + "Parameter Type":"Tipo di parametro", + "Data Type":"Tipo di dato", + "Response Messages":"Messaggi della risposta", + "HTTP Status Code":"Codice stato HTTP", + "Reason":"Motivo", + "Response Model":"Modello di risposta", + "Request URL":"URL della richiesta", + "Response Body":"Corpo della risposta", + "Response Code":"Oggetto della risposta", + "Response Headers":"Intestazioni della risposta", + "Hide Response":"Nascondi risposta", + "Try it out!":"Provalo!", + "Show/Hide":"Mostra/Nascondi", + "List Operations":"Mostra operazioni", + "Expand Operations":"Espandi operazioni", + "Raw":"Grezzo (raw)", + "can't parse JSON. Raw result":"non è possibile parsare il JSON. Risultato grezzo (raw).", + "Model Schema":"Schema del modello", + "Model":"Modello", + "apply":"applica", + "Username":"Nome utente", + "Password":"Password", + "Terms of service":"Condizioni del servizio", + "Created by":"Creato da", + "See more at":"Informazioni aggiuntive:", + "Contact the developer":"Contatta lo sviluppatore", + "api version":"versione api", + "Response Content Type":"Tipo di contenuto (content type) della risposta", + "fetching resource":"recuperando la risorsa", + "fetching resource list":"recuperando lista risorse", + "Explore":"Esplora", + "Show Swagger Petstore Example Apis":"Mostra le api di esempio di Swagger Petstore", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"Non è possibile leggere dal server. Potrebbe non avere le impostazioni di controllo accesso origine (access-control-origin) appropriate.", + "Please specify the protocol for":"Si prega di specificare il protocollo per", + "Can't read swagger JSON from":"Impossibile leggere JSON swagger da:", + "Finished Loading Resource Information. Rendering Swagger UI":"Lettura informazioni risorse termianta. Swagger UI viene mostrata", + "Unable to read api":"Impossibile leggere la api", + "from path":"da cartella", + "server returned":"il server ha restituito" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ja.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ja.js new file mode 100644 index 00000000000..1cbeb374ac1 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ja.js @@ -0,0 +1,56 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"警告: 廃止予定", + "Implementation Notes":"実装メモ", + "Response Class":"レスポンスクラス", + "Status":"ステータス", + "Parameters":"パラメータ群", + "Parameter":"パラメータ", + "Value":"値", + "Description":"説明", + "Parameter Type":"パラメータタイプ", + "Data Type":"データタイプ", + "Response Messages":"レスポンスメッセージ", + "HTTP Status Code":"HTTPステータスコード", + "Reason":"理由", + "Response Model":"レスポンスモデル", + "Request URL":"リクエストURL", + "Response Body":"レスポンスボディ", + "Response Code":"レスポンスコード", + "Response Headers":"レスポンスヘッダ", + "Hide Response":"レスポンスを隠す", + "Headers":"ヘッダ", + "Try it out!":"実際に実行!", + "Show/Hide":"表示/非表示", + "List Operations":"操作一覧", + "Expand Operations":"操作の展開", + "Raw":"未加工", + "can't parse JSON. Raw result":"JSONへ解釈できません. 未加工の結果", + "Example Value":"値の例", + "Model Schema":"モデルスキーマ", + "Model":"モデル", + "Click to set as parameter value":"パラメータ値と設定するにはクリック", + "apply":"実行", + "Username":"ユーザ名", + "Password":"パスワード", + "Terms of service":"サービス利用規約", + "Created by":"Created by", + "See more at":"詳細を見る", + "Contact the developer":"開発者に連絡", + "api version":"APIバージョン", + "Response Content Type":"レスポンス コンテンツタイプ", + "Parameter content type:":"パラメータコンテンツタイプ:", + "fetching resource":"リソースの取得", + "fetching resource list":"リソース一覧の取得", + "Explore":"調査", + "Show Swagger Petstore Example Apis":"SwaggerペットストアAPIの表示", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"サーバから読み込めません. 適切なaccess-control-origin設定を持っていない可能性があります.", + "Please specify the protocol for":"プロトコルを指定してください", + "Can't read swagger JSON from":"次からswagger JSONを読み込めません", + "Finished Loading Resource Information. Rendering Swagger UI":"リソース情報の読み込みが完了しました. Swagger UIを描画しています", + "Unable to read api":"APIを読み込めません", + "from path":"次のパスから", + "server returned":"サーバからの返答" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ko-kr.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ko-kr.js new file mode 100644 index 00000000000..03c7626d7f9 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ko-kr.js @@ -0,0 +1,53 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"경고:폐기예정됨", + "Implementation Notes":"구현 노트", + "Response Class":"응답 클래스", + "Status":"상태", + "Parameters":"매개변수들", + "Parameter":"매개변수", + "Value":"값", + "Description":"설명", + "Parameter Type":"매개변수 타입", + "Data Type":"데이터 타입", + "Response Messages":"응답 메세지", + "HTTP Status Code":"HTTP 상태 코드", + "Reason":"원인", + "Response Model":"응답 모델", + "Request URL":"요청 URL", + "Response Body":"응답 본문", + "Response Code":"응답 코드", + "Response Headers":"응답 헤더", + "Hide Response":"응답 숨기기", + "Headers":"헤더", + "Try it out!":"써보기!", + "Show/Hide":"보이기/숨기기", + "List Operations":"목록 작업", + "Expand Operations":"전개 작업", + "Raw":"원본", + "can't parse JSON. Raw result":"JSON을 파싱할수 없음. 원본결과:", + "Model Schema":"모델 스키마", + "Model":"모델", + "apply":"적용", + "Username":"사용자 이름", + "Password":"암호", + "Terms of service":"이용약관", + "Created by":"작성자", + "See more at":"추가정보:", + "Contact the developer":"개발자에게 문의", + "api version":"api버전", + "Response Content Type":"응답Content Type", + "fetching resource":"리소스 가져오기", + "fetching resource list":"리소스 목록 가져오기", + "Explore":"탐색", + "Show Swagger Petstore Example Apis":"Swagger Petstore 예제 보기", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"서버로부터 읽어들일수 없습니다. access-control-origin 설정이 올바르지 않을수 있습니다.", + "Please specify the protocol for":"다음을 위한 프로토콜을 정하세요", + "Can't read swagger JSON from":"swagger JSON 을 다음으로 부터 읽을수 없습니다", + "Finished Loading Resource Information. Rendering Swagger UI":"리소스 정보 불러오기 완료. Swagger UI 랜더링", + "Unable to read api":"api를 읽을 수 없습니다.", + "from path":"다음 경로로 부터", + "server returned":"서버 응답함." +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/pl.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/pl.js new file mode 100644 index 00000000000..ce41e91799d --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/pl.js @@ -0,0 +1,53 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Uwaga: Wycofane", + "Implementation Notes":"Uwagi Implementacji", + "Response Class":"Klasa Odpowiedzi", + "Status":"Status", + "Parameters":"Parametry", + "Parameter":"Parametr", + "Value":"Wartość", + "Description":"Opis", + "Parameter Type":"Typ Parametru", + "Data Type":"Typ Danych", + "Response Messages":"Wiadomości Odpowiedzi", + "HTTP Status Code":"Kod Statusu HTTP", + "Reason":"Przyczyna", + "Response Model":"Model Odpowiedzi", + "Request URL":"URL Wywołania", + "Response Body":"Treść Odpowiedzi", + "Response Code":"Kod Odpowiedzi", + "Response Headers":"Nagłówki Odpowiedzi", + "Hide Response":"Ukryj Odpowiedź", + "Headers":"Nagłówki", + "Try it out!":"Wypróbuj!", + "Show/Hide":"Pokaż/Ukryj", + "List Operations":"Lista Operacji", + "Expand Operations":"Rozwiń Operacje", + "Raw":"Nieprzetworzone", + "can't parse JSON. Raw result":"nie można przetworzyć pliku JSON. Nieprzetworzone dane", + "Model Schema":"Schemat Modelu", + "Model":"Model", + "apply":"użyj", + "Username":"Nazwa użytkownika", + "Password":"Hasło", + "Terms of service":"Warunki używania", + "Created by":"Utworzone przez", + "See more at":"Zobacz więcej na", + "Contact the developer":"Kontakt z deweloperem", + "api version":"wersja api", + "Response Content Type":"Typ Zasobu Odpowiedzi", + "fetching resource":"ładowanie zasobu", + "fetching resource list":"ładowanie listy zasobów", + "Explore":"Eksploruj", + "Show Swagger Petstore Example Apis":"Pokaż Przykładowe Api Swagger Petstore", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"Brak połączenia z serwerem. Może on nie mieć odpowiednich ustawień access-control-origin.", + "Please specify the protocol for":"Proszę podać protokół dla", + "Can't read swagger JSON from":"Nie można odczytać swagger JSON z", + "Finished Loading Resource Information. Rendering Swagger UI":"Ukończono Ładowanie Informacji o Zasobie. Renderowanie Swagger UI", + "Unable to read api":"Nie można odczytać api", + "from path":"ze ścieżki", + "server returned":"serwer zwrócił" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/pt.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/pt.js new file mode 100644 index 00000000000..f2e7c13d413 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/pt.js @@ -0,0 +1,53 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Aviso: Depreciado", + "Implementation Notes":"Notas de Implementação", + "Response Class":"Classe de resposta", + "Status":"Status", + "Parameters":"Parâmetros", + "Parameter":"Parâmetro", + "Value":"Valor", + "Description":"Descrição", + "Parameter Type":"Tipo de parâmetro", + "Data Type":"Tipo de dados", + "Response Messages":"Mensagens de resposta", + "HTTP Status Code":"Código de status HTTP", + "Reason":"Razão", + "Response Model":"Modelo resposta", + "Request URL":"URL requisição", + "Response Body":"Corpo da resposta", + "Response Code":"Código da resposta", + "Response Headers":"Cabeçalho da resposta", + "Headers":"Cabeçalhos", + "Hide Response":"Esconder resposta", + "Try it out!":"Tente agora!", + "Show/Hide":"Mostrar/Esconder", + "List Operations":"Listar operações", + "Expand Operations":"Expandir operações", + "Raw":"Cru", + "can't parse JSON. Raw result":"Falha ao analisar JSON. Resulto cru", + "Model Schema":"Modelo esquema", + "Model":"Modelo", + "apply":"Aplicar", + "Username":"Usuário", + "Password":"Senha", + "Terms of service":"Termos do serviço", + "Created by":"Criado por", + "See more at":"Veja mais em", + "Contact the developer":"Contate o desenvolvedor", + "api version":"Versão api", + "Response Content Type":"Tipo de conteúdo da resposta", + "fetching resource":"busca recurso", + "fetching resource list":"buscando lista de recursos", + "Explore":"Explorar", + "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"Não é possível ler do servidor. Pode não ter as apropriadas configurações access-control-origin", + "Please specify the protocol for":"Por favor especifique o protocolo", + "Can't read swagger JSON from":"Não é possível ler o JSON Swagger de", + "Finished Loading Resource Information. Rendering Swagger UI":"Carregar informação de recurso finalizada. Renderizando Swagger UI", + "Unable to read api":"Não foi possível ler api", + "from path":"do caminho", + "server returned":"servidor retornou" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ru.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ru.js new file mode 100644 index 00000000000..592744e957f --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/ru.js @@ -0,0 +1,56 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Предупреждение: Устарело", + "Implementation Notes":"Заметки", + "Response Class":"Пример ответа", + "Status":"Статус", + "Parameters":"Параметры", + "Parameter":"Параметр", + "Value":"Значение", + "Description":"Описание", + "Parameter Type":"Тип параметра", + "Data Type":"Тип данных", + "HTTP Status Code":"HTTP код", + "Reason":"Причина", + "Response Model":"Структура ответа", + "Request URL":"URL запроса", + "Response Body":"Тело ответа", + "Response Code":"HTTP код ответа", + "Response Headers":"Заголовки ответа", + "Hide Response":"Спрятать ответ", + "Headers":"Заголовки", + "Response Messages":"Что может прийти в ответ", + "Try it out!":"Попробовать!", + "Show/Hide":"Показать/Скрыть", + "List Operations":"Операции кратко", + "Expand Operations":"Операции подробно", + "Raw":"В сыром виде", + "can't parse JSON. Raw result":"Не удается распарсить ответ:", + "Example Value":"Пример", + "Model Schema":"Структура", + "Model":"Описание", + "Click to set as parameter value":"Нажмите, чтобы испльзовать в качестве значения параметра", + "apply":"применить", + "Username":"Имя пользователя", + "Password":"Пароль", + "Terms of service":"Условия использования", + "Created by":"Разработано", + "See more at":"Еще тут", + "Contact the developer":"Связаться с разработчиком", + "api version":"Версия API", + "Response Content Type":"Content Type ответа", + "Parameter content type:":"Content Type параметра:", + "fetching resource":"Получение ресурса", + "fetching resource list":"Получение ресурсов", + "Explore":"Показать", + "Show Swagger Petstore Example Apis":"Показать примеры АПИ", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, проблема с настройками доступа", + "Please specify the protocol for":"Пожалуйста, укажите протокол для", + "Can't read swagger JSON from":"Не получается прочитать swagger json из", + "Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим", + "Unable to read api":"Не удалось прочитать api", + "from path":"по адресу", + "server returned":"сервер сказал" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/tr.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/tr.js new file mode 100644 index 00000000000..16426a9c34b --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/tr.js @@ -0,0 +1,53 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Uyarı: Deprecated", + "Implementation Notes":"Gerçekleştirim Notları", + "Response Class":"Dönen Sınıf", + "Status":"Statü", + "Parameters":"Parametreler", + "Parameter":"Parametre", + "Value":"Değer", + "Description":"Açıklama", + "Parameter Type":"Parametre Tipi", + "Data Type":"Veri Tipi", + "Response Messages":"Dönüş Mesajı", + "HTTP Status Code":"HTTP Statü Kodu", + "Reason":"Gerekçe", + "Response Model":"Dönüş Modeli", + "Request URL":"İstek URL", + "Response Body":"Dönüş İçeriği", + "Response Code":"Dönüş Kodu", + "Response Headers":"Dönüş Üst Bilgileri", + "Hide Response":"Dönüşü Gizle", + "Headers":"Üst Bilgiler", + "Try it out!":"Dene!", + "Show/Hide":"Göster/Gizle", + "List Operations":"Operasyonları Listele", + "Expand Operations":"Operasyonları Aç", + "Raw":"Ham", + "can't parse JSON. Raw result":"JSON çözümlenemiyor. Ham sonuç", + "Model Schema":"Model Şema", + "Model":"Model", + "apply":"uygula", + "Username":"Kullanıcı Adı", + "Password":"Parola", + "Terms of service":"Servis şartları", + "Created by":"Oluşturan", + "See more at":"Daha fazlası için", + "Contact the developer":"Geliştirici ile İletişime Geçin", + "api version":"api versiyon", + "Response Content Type":"Dönüş İçerik Tipi", + "fetching resource":"kaynak getiriliyor", + "fetching resource list":"kaynak listesi getiriliyor", + "Explore":"Keşfet", + "Show Swagger Petstore Example Apis":"Swagger Petstore Örnek Api'yi Gör", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"Sunucudan okuma yapılamıyor. Sunucu access-control-origin ayarlarınızı kontrol edin.", + "Please specify the protocol for":"Lütfen istenen adres için protokol belirtiniz", + "Can't read swagger JSON from":"Swagger JSON bu kaynaktan okunamıyor", + "Finished Loading Resource Information. Rendering Swagger UI":"Kaynak baglantısı tamamlandı. Swagger UI gösterime hazırlanıyor", + "Unable to read api":"api okunamadı", + "from path":"yoldan", + "server returned":"sunucuya dönüldü" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/translator.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/translator.js new file mode 100644 index 00000000000..ffb879f9a27 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/translator.js @@ -0,0 +1,39 @@ +'use strict'; + +/** + * Translator for documentation pages. + * + * To enable translation you should include one of language-files in your index.html + * after . + * For example - + * + * If you wish to translate some new texts you should do two things: + * 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too. + * 2. Mark that text it templates this way New Phrase or . + * The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate. + * + */ +window.SwaggerTranslator = { + + _words:[], + + translate: function(sel) { + var $this = this; + sel = sel || '[data-sw-translate]'; + + $(sel).each(function() { + $(this).html($this._tryTranslate($(this).html())); + + $(this).val($this._tryTranslate($(this).val())); + $(this).attr('title', $this._tryTranslate($(this).attr('title'))); + }); + }, + + _tryTranslate: function(word) { + return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; + }, + + learn: function(wordsMap) { + this._words = wordsMap; + } +}; diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lang/zh-cn.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/zh-cn.js new file mode 100644 index 00000000000..3af61ad6e4c --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lang/zh-cn.js @@ -0,0 +1,56 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"警告:已过时", + "Implementation Notes":"实现备注", + "Response Class":"响应类", + "Status":"状态", + "Parameters":"参数", + "Parameter":"参数", + "Value":"值", + "Description":"描述", + "Parameter Type":"参数类型", + "Data Type":"数据类型", + "Response Messages":"响应消息", + "HTTP Status Code":"HTTP状态码", + "Reason":"原因", + "Response Model":"响应模型", + "Request URL":"请求URL", + "Response Body":"响应体", + "Response Code":"响应码", + "Response Headers":"响应头", + "Hide Response":"隐藏响应", + "Headers":"头", + "Try it out!":"试一下!", + "Show/Hide":"显示/隐藏", + "List Operations":"显示操作", + "Expand Operations":"展开操作", + "Raw":"原始", + "can't parse JSON. Raw result":"无法解析JSON. 原始结果", + "Example Value":"示例", + "Click to set as parameter value":"点击设置参数", + "Model Schema":"模型架构", + "Model":"模型", + "apply":"应用", + "Username":"用户名", + "Password":"密码", + "Terms of service":"服务条款", + "Created by":"创建者", + "See more at":"查看更多:", + "Contact the developer":"联系开发者", + "api version":"api版本", + "Response Content Type":"响应Content Type", + "Parameter content type:":"参数类型:", + "fetching resource":"正在获取资源", + "fetching resource list":"正在获取资源列表", + "Explore":"浏览", + "Show Swagger Petstore Example Apis":"显示 Swagger Petstore 示例 Apis", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"无法从服务器读取。可能没有正确设置access-control-origin。", + "Please specify the protocol for":"请指定协议:", + "Can't read swagger JSON from":"无法读取swagger JSON于", + "Finished Loading Resource Information. Rendering Swagger UI":"已加载资源信息。正在渲染Swagger UI", + "Unable to read api":"无法读取api", + "from path":"从路径", + "server returned":"服务器返回" +}); diff --git a/src/ServiceStack.Api.OpenApi/swagger-ui/lib/backbone-min.js b/src/ServiceStack.Api.OpenApi/swagger-ui/lib/backbone-min.js new file mode 100644 index 00000000000..8eff02e9842 --- /dev/null +++ b/src/ServiceStack.Api.OpenApi/swagger-ui/lib/backbone-min.js @@ -0,0 +1 @@ +!function(t,e){if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(i,n,s){t.Backbone=e(t,s,i,n)});else if("undefined"!=typeof exports){var i=require("underscore");e(t,exports,i)}else t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}(this,function(t,e,i,n){var s=t.Backbone,r=[],a=(r.push,r.slice);r.splice;e.VERSION="1.1.2",e.$=n,e.noConflict=function(){return t.Backbone=s,this},e.emulateHTTP=!1,e.emulateJSON=!1;var o=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var n=this._events[t]||(this._events[t]=[]);return n.push({callback:e,context:i,ctx:i||this}),this},once:function(t,e,n){if(!c(this,"once",t,[e,n])||!e)return this;var s=this,r=i.once(function(){s.off(t,r),e.apply(this,arguments)});return r._callback=e,this.on(t,r,n)},off:function(t,e,n){var s,r,a,o,h,u,l,d;if(!this._events||!c(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events=void 0,this;for(o=t?[t]:i.keys(this._events),h=0,u=o.length;h").attr(t);this.setElement(n,!1)}}}),e.sync=function(t,n,s){var r=E[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:r,dataType:"json"};if(s.url||(a.url=i.result(n,"url")||j()),null!=s.data||!n||"create"!==t&&"update"!==t&&"patch"!==t||(a.contentType="application/json",a.data=JSON.stringify(s.attrs||n.toJSON(s))),s.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),s.emulateHTTP&&("PUT"===r||"DELETE"===r||"PATCH"===r)){a.type="POST",s.emulateJSON&&(a.data._method=r);var o=s.beforeSend;s.beforeSend=function(t){if(t.setRequestHeader("X-HTTP-Method-Override",r),o)return o.apply(this,arguments)}}"GET"===a.type||s.emulateJSON||(a.processData=!1),"PATCH"===a.type&&x&&(a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var h=s.xhr=e.ajax(i.extend(a,s));return n.trigger("request",n,h,s),h};var x=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),E={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var k=e.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},T=/\((.*?)\)/g,$=/(\(\?)?:\w+/g,S=/\*\w+/g,H=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(k.prototype,o,{initialize:function(){},route:function(t,n,s){i.isRegExp(t)||(t=this._routeToRegExp(t)),i.isFunction(n)&&(s=n,n=""),s||(s=this[n]);var r=this;return e.history.route(t,function(i){var a=r._extractParameters(t,i);r.execute(s,a),r.trigger.apply(r,["route:"+n].concat(a)),r.trigger("route",n,a),e.history.trigger("route",r,n,a)}),this},execute:function(t,e){t&&t.apply(this,e)},navigate:function(t,i){return e.history.navigate(t,i),this},_bindRoutes:function(){if(this.routes){this.routes=i.result(this,"routes");for(var t,e=i.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(H,"\\$&").replace(T,"(?:$1)?").replace($,function(t,e){return e?t:"([^/?]+)"}).replace(S,"([^?]*?)"),new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var n=t.exec(e).slice(1);return i.map(n,function(t,e){return e===n.length-1?t||null:t?decodeURIComponent(t):null})}});var A=e.History=function(){this.handlers=[],i.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},I=/^[#\/]|\s+$/g,N=/^\/+|\/+$/g,R=/msie [\w.]+/,O=/\/$/,P=/#.*$/;A.started=!1,i.extend(A.prototype,o,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(null==t)if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(O,"");t.indexOf(i)||(t=t.slice(i.length))}else t=this.getHash();return t.replace(I,"")},start:function(t){if(A.started)throw new Error("Backbone.history has already been started");A.started=!0,this.options=i.extend({root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var n=this.getFragment(),s=document.documentMode,r=R.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);if(this.root=("/"+this.root+"/").replace(N,"/"),r&&this._wantsHashChange){var a=e.$('', + generic: '' + }; + + $(document).bindHandlers({ + announce: function (msg) { + $("#announce").html(msg).fadeIn('fast'); + setTimeout(function () { $("#announce").fadeOut('slow'); }, 2000); + }, + toggle: function () { + $(this).toggle(); + }, + sendCommand: function () { + $("#txtMsg").val($(this).html()).focus(); + }, + privateMsg: function () { + $txtMsg.val("@@" + this.innerHTML + " ").focus(); + }, + removeReceiver: function (name) { + delete $.ss.eventReceivers[name]; + }, + addReceiver: function (name) { + $.ss.eventReceivers[name] = window[name]; + }, + toggleExamples: function () { + var willHide = this.innerHTML == "hide"; + $(this).html(willHide ? "show" : "hide").parent().css({ height: willHide ? '25px' : 'auto' }); + }, + changeChannel: function (channel) { + $("[data-channel]").removeClass('selected'); + $("[data-channel=" + channel + "]").addClass('selected'); + $("#txtMsg").focus(); + }, + startListening: function() { $.ss.reconnectServerEvents(); } + }).on('customEvent', function (e, msg, msgEvent) { + addEntry({ msg: "[event " + e.type + " message: " + msg + "]", cls: "event", channel: msgEvent.channel }); + }); + $.ss.handlers["changeChannel"](channels[channels.length-1]); + + function addEntry(o) { + console.log("addEntry", o); + var id = "u_" + o.userId + ""; + var skipUser = $("#log .msg:last-child b").hasClass(id); + var inactive = $(createUser($.extend(o, { displayName: o.userName }))).html(); + var user = o.userId && !skipUser ? "" + ($("#users ." + id).html() || inactive) + "" : " "; + var time = "" + $.ss.tfmt12(new Date()) + ""; + var highlight = o.msg.indexOf(activeSub.displayName.replace(" ", "")) >= 0 ? "highlight " : ""; + var filter = o.channel ? "=" + o.channel : ""; + $("#logs [data-channel" + filter + "]").append("
      " + + user + time + "
      " + o.msg + "
      " + "
      ").scrollTop(1E10); + } + function createUser(user) { + return "
      " + user.displayName + "
      "; + } + + var msgHistory = [], historyIndex = -1; + function postMsg() { + var msg = $txtMsg.val(), parts, to = null; + msgHistory.push(msg); + + if (msg[0] == "@@") { + parts = $.ss.splitOnFirst(msg, " "); + var toName = parts[0].substring(1); + if (toName == "me") { + to = activeSub.userId; + } else { + var matches = $.grep($("#users .user span"), + function (x) { return x.innerHTML.replace(" ", "").toLowerCase() === toName.toLowerCase(); }); + to = matches.length > 0 ? matches[0].getAttribute("data-id") : null; + } + msg = parts[1]; + } + if (!msg || !activeSub) return; + var onError = function (e) { + if (e.responseJSON && e.responseJSON.responseStatus) + $.ss.handlers["announce"](e.responseJSON.responseStatus.message); + }; + var channel = selectedChannel(); + if (msg[0] == "/") { + parts = $.ss.splitOnFirst(msg, " "); + $.post("/channels/" + channel + "/raw", { from: activeSub.id, toUserId: to, message: parts[1], selector: parts[0].substring(1) }, function () { }).fail(onError); + } else { + $.post("/channels/" + channel + "/chat", { from: activeSub.id, toUserId: to, message: msg, selector: "cmd.chat" }, function () { }).fail(onError); + } + $txtMsg.val(""); + } + $("#btnSend").click(postMsg); + + $txtMsg.keydown(function (e) { + var keycode = (e.keyCode ? e.keyCode : e.which); + if ($.ss.getSelection()) { + if (keycode == '9' || keycode == '13' || keycode == '32' || keycode == '39') { + this.value += " "; + if (this.setSelectionRange) this.setSelectionRange(this.value.length, this.value.length); + return false; + } + } + if (keycode == '13') { //enter + postMsg(); + } else if (keycode == '38') { //up arrow + historyIndex = Math.min(++historyIndex, msgHistory.length); + $txtMsg.val(msgHistory[msgHistory.length - 1 - historyIndex]); + return false; + } + else if (keycode == '40') { //down arrow + historyIndex = Math.max(--historyIndex, -1); + $txtMsg.val(msgHistory[msgHistory.length - 1 - historyIndex]); + } else { + historyIndex = -1; + } + }).keyup(function (e) { + if (!$.ss.getSelection() && this.value[0] == '@@' && this.value.indexOf(' ') < 0) { + var partialVal = this.value.substring(1); + var matchingNames = $.grep($("#users .user span") + .map(function () { return this.innerHTML.replace(" ", ""); }), function (x) { + return x.substring(0, partialVal.length).toLowerCase() === partialVal.toLowerCase() + && x.toLowerCase() != activeSub.displayName.toLowerCase(); + }); + + if (matchingNames.length > 0) { + this.value += matchingNames[0].substring(partialVal.length); + if (this.setSelectionRange) this.setSelectionRange(partialVal.length + 1, this.value.length); + return false; + } + } + }); + + + + \ No newline at end of file diff --git a/tests/ChatSelfHost/wwwroot/default.css b/tests/ChatSelfHost/wwwroot/default.css new file mode 100644 index 00000000000..b7ff3a9e50d --- /dev/null +++ b/tests/ChatSelfHost/wwwroot/default.css @@ -0,0 +1,249 @@ +body { + font: 16px Arial; + overflow: hidden; + padding: 0; + margin: 0; + color: #444; + background: url(https://servicestack.net/img/slide/image01.jpg) no-repeat left center fixed; + background-size: cover; + -webkit-background-size: cover; +} +::-webkit-scrollbar { + width: 6px; +} +::-webkit-scrollbar-button { + width: 6px; + height: 0px; +} +::-webkit-scrollbar-track { + background: #e6e6e6; + border: thin solid lightgray; + border-top: none; + box-shadow: 0px 0px 3px #dfdfdf inset; +} +::-webkit-scrollbar-thumb { + background: #666; + border: thin solid gray; + border-top: none; +} +::-webkit-scrollbar-thumb:hover { + background:#7d7d7d; +} +#top { + z-index: 1; + position: fixed; + top: 0; + width: 100%; + height: 40px; + background: #212121; + opacity: .80; +} +ul { + padding: 0; + margin: 0; + position: absolute; + top: 10px; + left: 10px; + list-style: none; +} +li { + display: block; + float: left; + padding: 4px 30px; + text-align: center; + background: #fff; + font-size: 18px; + cursor: pointer; + margin: 0 5px 0 0; + opacity: .5; +} +a img { + border: none; +} +#channels li.selected { + opacity: .9; +} +li:hover { + opacity: .8; +} +#announce { + z-index: 3; + display: none; + position: absolute; + top: 40px; + line-height: 50px; + width: 100%; + background: #ffc; + text-align: center; + box-shadow: 0px 2px 3px rgba(100, 100, 100, 0.75); +} +#tv { + z-index: 2; + position: absolute; + display: none; + text-align: center; + width: 85%; + top: 40px; +} +#right { + z-index: 1; + position: absolute; + top: 40px; + right: 0; + width: 18%; + min-width: 200px; + height: 100%; + color: #666; + background: #fff; + opacity: .85; + border-left: 1px solid #212121; +} +#examples { + position: fixed; + bottom: 10px; + right: .5%; + width: 17%; + min-width: 190px; + font-size: 12px; + background: #fcfcfc; + overflow: hidden; +} +#examples h4 { + margin: 0; + padding: 5px 10px; + background: #f1f1f1; +} +#examples a { + color: #428bca; + text-decoration: none; + font-size: 13px; +} +#examples a:hover { + color: #2a6496; +} +#examples div { + white-space: nowrap; + overflow: hidden; + cursor: pointer; + padding: 0 5px; + line-height: 28px; +} +#examples div:hover { + background: #ffe; + color: #222; +} +#examples span { + color: #999; + cursor: pointer; +} +#logs { + position: fixed; + left: -2px; + bottom: 50px; + width: 82%; + max-height: 100%; + overflow-y: auto; +} +#logs .channel { + background: #fff; + opacity: .85; + display: none; +} +#logs .channel.selected { + display: block; +} +#users .channel { + display: none; +} +#users .channel.selected { + display: block; +} + +#bottom { + position: fixed; + bottom: 0; + height: 49px; + width: 82%; + background: #212121; + opacity: .80; +} +#bottom input { + font-size: 16px; + margin: 6px 0 0 6px; + padding: 4px 8px; + width: 77%; +} +#bottom button { + padding: 4px 8px; +} +.open div { + color: green; +} +.error div { + color: red; +} +.event div { + color: blue; +} +#social { + float: right; + padding: 5px; +} +#social a { + display: inline-block; + width: 77px; + height: 20px; + margin: 5px 5px 0 0; +} +.twitter { background: url(/img/twitter_normal.png) no-repeat; } +.facebook { background: url(/img/facebook_normal.png) no-repeat; } +.github { background: url(/img/github_normal.png) no-repeat; } +#welcome { + float: left; + margin: 0 5px 0 0; + color: #f1f1f1; +} +#welcome span { + line-height: 24px; +} +#welcome img { + height: 24px; + margin: 0 0 0 5px; + vertical-align: bottom; +} +.user img { + height: 24px; + margin: 2px 5px 0 5px; + vertical-align: bottom; +} +.user span { + cursor: pointer; +} +.private { + color: red; +} +.msg { + border-top: 1px solid #eee; +} +.msg b, .msg div, .msg i { + line-height: 30px; + height: 30px; + display: inline-block; + padding: 0 0 0 10px; + font-style: normal; + font-weight: normal; +} +.msg b { + width: 200px; + background: #fafafa; +} +.msg div { +} +.msg i { + color: #999; + float: right; + padding: 0 10px 0 0; +} +.msg.highlight { + background: #ffc; +} diff --git a/tests/ChatSelfHost/wwwroot/img/bg.jpg b/tests/ChatSelfHost/wwwroot/img/bg.jpg new file mode 100644 index 00000000000..ad28842d2c6 Binary files /dev/null and b/tests/ChatSelfHost/wwwroot/img/bg.jpg differ diff --git a/tests/ChatSelfHost/wwwroot/img/facebook_normal.png b/tests/ChatSelfHost/wwwroot/img/facebook_normal.png new file mode 100644 index 00000000000..b32d1948e58 Binary files /dev/null and b/tests/ChatSelfHost/wwwroot/img/facebook_normal.png differ diff --git a/tests/ChatSelfHost/wwwroot/img/favicon.png b/tests/ChatSelfHost/wwwroot/img/favicon.png new file mode 100644 index 00000000000..08e81b4cf92 Binary files /dev/null and b/tests/ChatSelfHost/wwwroot/img/favicon.png differ diff --git a/tests/ChatSelfHost/wwwroot/img/github_normal.png b/tests/ChatSelfHost/wwwroot/img/github_normal.png new file mode 100644 index 00000000000..68f69c869c6 Binary files /dev/null and b/tests/ChatSelfHost/wwwroot/img/github_normal.png differ diff --git a/tests/ChatSelfHost/wwwroot/img/no-profile64.png b/tests/ChatSelfHost/wwwroot/img/no-profile64.png new file mode 100644 index 00000000000..3cdf91c9957 Binary files /dev/null and b/tests/ChatSelfHost/wwwroot/img/no-profile64.png differ diff --git a/tests/ChatSelfHost/wwwroot/img/twitter_normal.png b/tests/ChatSelfHost/wwwroot/img/twitter_normal.png new file mode 100644 index 00000000000..82d9fbde087 Binary files /dev/null and b/tests/ChatSelfHost/wwwroot/img/twitter_normal.png differ diff --git a/tests/ChatSelfHost/wwwroot/jquery-2.1.1.min.js b/tests/ChatSelfHost/wwwroot/jquery-2.1.1.min.js new file mode 100644 index 00000000000..e5ace116b6f --- /dev/null +++ b/tests/ChatSelfHost/wwwroot/jquery-2.1.1.min.js @@ -0,0 +1,4 @@ +/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
      ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) +},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"
      ","
      "],col:[2,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n(" - - - diff --git a/tests/PclTest.SL5.Web/PclTest.SL5TestPage.html b/tests/PclTest.SL5.Web/PclTest.SL5TestPage.html deleted file mode 100644 index e4ab250c544..00000000000 --- a/tests/PclTest.SL5.Web/PclTest.SL5TestPage.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - PclTest.SL5 - - - - - -
      -
      - - - - - - - - Get Microsoft Silverlight - -
      -
      - - diff --git a/tests/PclTest.SL5.Web/Properties/AssemblyInfo.cs b/tests/PclTest.SL5.Web/Properties/AssemblyInfo.cs deleted file mode 100644 index b45b9c7446a..00000000000 --- a/tests/PclTest.SL5.Web/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("PclTest.SL5.Web")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PclTest.SL5.Web")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("84e1fed0-ab76-4db7-9fc0-b3eb8b1f6568")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tests/PclTest.SL5.Web/Silverlight.js b/tests/PclTest.SL5.Web/Silverlight.js deleted file mode 100644 index 80ff39708f6..00000000000 --- a/tests/PclTest.SL5.Web/Silverlight.js +++ /dev/null @@ -1,2 +0,0 @@ -//v2.0.30511.0 -if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.__onSilverlightInstalledCalled=false;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.__installationEventFired=false;Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};Silverlight.isInstalled=function(b){if(b==undefined)b=null;var a=false,m=null;try{var i=null,j=false;if(window.ActiveXObject)try{i=new ActiveXObject("AgControl.AgControl");if(b===null)a=true;else if(i.IsVersionSupported(b))a=true;i=null}catch(l){j=true}else j=true;if(j){var k=navigator.plugins["Silverlight Plug-In"];if(k)if(b===null)a=true;else{var h=k.description;if(h==="1.0.30226.2")h="2.0.30226.2";var c=h.split(".");while(c.length>3)c.pop();while(c.length<4)c.push(0);var e=b.split(".");while(e.length>4)e.pop();var d,g,f=0;do{d=parseInt(e[f]);g=parseInt(c[f]);f++}while(f");delete a.id;delete a.width;delete a.height;for(var c in a)if(a[c])b.push('');b.push("");return b.join("")};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(b){var a="",d=Silverlight.fwlinkRoot,c=b.version;if(b.alt)a=b.alt;else{if(!c)c="";a="Get Microsoft Silverlight";a=a.replace("{1}",c);a=a.replace("{2}",d+"108181")}return a};Silverlight.getSilverlight=function(e){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var b="",a=String(e).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2)b="1.0";else b=a[0]+"."+a[1]}var d="";if(b.match(/^\d+\056\d+$/))d="&v="+b;Silverlight.followFWLink("149156"+d)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+"&#"+a+";"}return b};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+" \n";a+="Message: "+b.ErrorMessage+" \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+" \n";a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}a+="MethodName: "+b.methodName+" \n"}alert(a)};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--)window["__slEvent"+a]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.__getHandlerName=function(b){var a="";if(typeof b=="string")a=b;else if(typeof b=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var c=Silverlight._silverlightCount++;a="__slEvent"+c;window[a]=b}else a=null;return a};Silverlight.onRequiredVersionAvailable=function(){};Silverlight.onRestartRequired=function(){};Silverlight.onUpgradeRequired=function(){};Silverlight.onInstallRequired=function(){};Silverlight.IsVersionAvailableOnError=function(d,a){var b=false;try{if(a.ErrorCode==8001&&!Silverlight.__installationEventFired){Silverlight.onUpgradeRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==8002&&!Silverlight.__installationEventFired){Silverlight.onRestartRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==5014||a.ErrorCode==2106){if(Silverlight.__verifySilverlight2UpgradeSuccess(a.getHost()))b=true}else b=true}catch(c){}return b};Silverlight.IsVersionAvailableOnLoad=function(b){var a=false;try{if(Silverlight.__verifySilverlight2UpgradeSuccess(b.getHost()))a=true}catch(c){}return a};Silverlight.__verifySilverlight2UpgradeSuccess=function(d){var c=false,b="2.0.31005",a=null;try{if(d.IsVersionSupported(b+".99")){a=Silverlight.onRequiredVersionAvailable;c=true}else if(d.IsVersionSupported(b+".0"))a=Silverlight.onRestartRequired;else a=Silverlight.onUpgradeRequired;if(a&&!Silverlight.__installationEventFired){a();Silverlight.__installationEventFired=true}}catch(e){}return c} \ No newline at end of file diff --git a/tests/PclTest.SL5.Web/Web.Debug.config b/tests/PclTest.SL5.Web/Web.Debug.config deleted file mode 100644 index 2e302f9f954..00000000000 --- a/tests/PclTest.SL5.Web/Web.Debug.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/tests/PclTest.SL5.Web/Web.Release.config b/tests/PclTest.SL5.Web/Web.Release.config deleted file mode 100644 index c35844462ba..00000000000 --- a/tests/PclTest.SL5.Web/Web.Release.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/tests/PclTest.SL5.Web/Web.config b/tests/PclTest.SL5.Web/Web.config deleted file mode 100644 index 83d659159a2..00000000000 --- a/tests/PclTest.SL5.Web/Web.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/tests/PclTest.SL5/App.xaml b/tests/PclTest.SL5/App.xaml deleted file mode 100644 index f93b18fa2a5..00000000000 --- a/tests/PclTest.SL5/App.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/tests/PclTest.SL5/App.xaml.cs b/tests/PclTest.SL5/App.xaml.cs deleted file mode 100644 index 5e4a7b61d7a..00000000000 --- a/tests/PclTest.SL5/App.xaml.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; - -namespace PclTest.SL5 -{ - public partial class App : Application - { - - public App() - { - this.Startup += this.Application_Startup; - this.Exit += this.Application_Exit; - this.UnhandledException += this.Application_UnhandledException; - - InitializeComponent(); - } - - private void Application_Startup(object sender, StartupEventArgs e) - { - this.RootVisual = new MainPage(); - } - - private void Application_Exit(object sender, EventArgs e) - { - - } - - private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) - { - // If the app is running outside of the debugger then report the exception using - // the browser's exception mechanism. On IE this will display it a yellow alert - // icon in the status bar and Firefox will display a script error. - if (!System.Diagnostics.Debugger.IsAttached) - { - - // NOTE: This will allow the application to continue running after an exception has been thrown - // but not handled. - // For production applications this error handling should be replaced with something that will - // report the error to the website and stop the application. - e.Handled = true; - Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); - } - } - - private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) - { - try - { - string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; - errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); - - System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); - } - catch (Exception) - { - } - } - } -} diff --git a/tests/PclTest.SL5/MainPage.xaml b/tests/PclTest.SL5/MainPage.xaml deleted file mode 100644 index cfc29cceed3..00000000000 --- a/tests/PclTest.SL5/MainPage.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - + @@ -254,7 +255,12 @@ + + +

      Auth Data

      +
      + +

      Session

      +
      + +

      User Auth

      +
      + +

      Auth Providers

      +
      + +@{ + var session = base.SessionAs(); + if (session.IsAuthenticated) + { +

      Authenticated!

      + + + } + else + { +

      Not Authenticated

      + } +} +
      + +

      Login with Auth Providers

      +
      + +
      +

      Twitter

      + /auth/twitter +
      + +
      +

      Facebook

      + /auth/facebook +
      + +
      +

      Google OpenId

      + /auth/GoogleOpenId +
      + +
      +

      Yahoo

      + /auth/YahooOpenId +
      + +
      +

      Google OAuth

      + /auth/GoogleOAuth +
      + +
      +

      LinkedIn

      + /auth/LinkedIn +
      + +
      +

      GitHub

      + /auth/github +
      + +
      +

      Yandex

      + /auth/Yandex +
      + +
      +

      VK.com

      + /auth/vkcom +
      + +
      +

      Odnoklassniki.ru

      + /auth/Odnoklassniki +
      + +
      +

      Windows Auth

      + /auth/windowsauth +
      + +

      Custom Credentials Auth

      +
      + + + +
      + +

      Register New User

      +
      + + + + + +
      + +
      +

      Reset UserAuth tables and Session

      + /reset-userauth + +

      Lock all Users

      + /lockallusers + +

      Logout

      + /auth/logout +
      + +

      All AuthProviders

      +
      + +

      All User Auths

      +
      + +

      All Auth Providers

      +
      + +
      \ No newline at end of file diff --git a/tests/ServiceStack.AuthWeb.Tests/default.cshtml b/tests/ServiceStack.AuthWeb.Tests/default.cshtml index f6c4f272244..8192296c312 100644 --- a/tests/ServiceStack.AuthWeb.Tests/default.cshtml +++ b/tests/ServiceStack.AuthWeb.Tests/default.cshtml @@ -27,6 +27,7 @@ var session = base.SessionAs(); if (session.IsAuthenticated) { + //requires using OrmLiteAuthRepository var userAuthId = session.UserAuthId.ToInt(); var userAuth = Db.SingleById(userAuthId); var authProviders = Db.Select(x => x.UserAuthId == userAuthId); @@ -60,35 +61,30 @@
      -

      Google OpenId

      - /auth/GoogleOpenId +

      GitHub

      + /auth/github
      -

      Yahoo

      - /auth/YahooOpenId +

      Google

      + /auth/google
      -

      Google OAuth

      - /auth/GoogleOAuth +

      Microsoft Graph

      + /auth/microsoftgraph

      LinkedIn

      - /auth/LinkedIn -
      - - -
      +

      Yandex

      /auth/Yandex
      - +

      VK.com

      /auth/vkcom @@ -103,30 +99,39 @@

      Windows Auth

      /auth/windowsauth
      - +

      Custom Credentials Auth

      - - - + + +
      - + +

      Private Auth

      +
      + + +
      +

      Register New User

      - - - - - + + + + +
      - -
      + +

      Reset UserAuth tables and Session

      /reset-userauth

      Lock all Users

      /lockallusers +

      Convert Session to token

      + /session-to-token +

      Logout

      /auth/logout
      @@ -141,6 +146,7 @@
      @{ + //requires using OrmLiteAuthRepository var allUserAuths = Db.Select(); var allAuthProviders = Db.Select(); diff --git a/tests/ServiceStack.AuthWeb.Tests/packages.config b/tests/ServiceStack.AuthWeb.Tests/packages.config index 1d35987e277..0cd0c21b5b3 100644 --- a/tests/ServiceStack.AuthWeb.Tests/packages.config +++ b/tests/ServiceStack.AuthWeb.Tests/packages.config @@ -1,8 +1,33 @@  - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/ActionExecTests.cs b/tests/ServiceStack.Common.Tests/ActionExecTests.cs index 9b1cb185935..58aebe5712b 100644 --- a/tests/ServiceStack.Common.Tests/ActionExecTests.cs +++ b/tests/ServiceStack.Common.Tests/ActionExecTests.cs @@ -1,4 +1,5 @@ -using System; +#if !NETCORE +using System; using System.Diagnostics; using System.Threading; using NUnit.Framework; @@ -16,7 +17,7 @@ public void Can_run_blocking_options_in_parallel() int i = 0; - Action incrAndBlock = () => { i++; Thread.Sleep(1000); }; + Action incrAndBlock = () => { Interlocked.Increment(ref i); Thread.Sleep(100); }; var actions = new[] { @@ -31,8 +32,9 @@ public void Can_run_blocking_options_in_parallel() actions.ExecAllAndWait(timeout:TimeSpan.FromSeconds(30)); "Took {0}ms".Print(sw.ElapsedMilliseconds); - Assert.That(sw.ElapsedMilliseconds, Is.LessThan(2000)); + Assert.That(sw.ElapsedMilliseconds, Is.LessThan(400)); Assert.That(i, Is.EqualTo(actions.Length)); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/AllowFilesTests.cs b/tests/ServiceStack.Common.Tests/AllowFilesTests.cs new file mode 100644 index 00000000000..2bd304783c5 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/AllowFilesTests.cs @@ -0,0 +1,34 @@ +using NUnit.Framework; +using ServiceStack.Testing; + +namespace ServiceStack.Common.Tests +{ + [TestFixture] + public class AllowFilesTests + { + [Test] + public void Does_allow_valid_FilePaths() + { + using (new BasicAppHost + { + ConfigFilter = config => + { + config.AllowFileExtensions.Add("aaa"); + config.AllowFilePaths.Add("dir/**/*.zzz"); + } + }.Init()) + { + Assert.That(HttpHandlerFactory.ShouldAllow("a.js")); + Assert.That(HttpHandlerFactory.ShouldAllow("a.aaa")); + Assert.That(HttpHandlerFactory.ShouldAllow("dir/a/b/c/a.aaa")); + Assert.That(!HttpHandlerFactory.ShouldAllow("a.zzz")); + Assert.That(HttpHandlerFactory.ShouldAllow("dir/a.zzz")); + Assert.That(HttpHandlerFactory.ShouldAllow("dir/a/b/c/a.zzz")); + + Assert.That(!HttpHandlerFactory.ShouldAllow("a.json")); + Assert.That(HttpHandlerFactory.ShouldAllow("jspm_packages/a.json")); + Assert.That(HttpHandlerFactory.ShouldAllow("jspm_packages/a/b/c/a.json")); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/App.config b/tests/ServiceStack.Common.Tests/App.config new file mode 100644 index 00000000000..be25b8bf498 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/App.config @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/ServiceStack.Common.Tests/AttributeTests.cs b/tests/ServiceStack.Common.Tests/AttributeTests.cs index f750b54faf4..71321248510 100644 --- a/tests/ServiceStack.Common.Tests/AttributeTests.cs +++ b/tests/ServiceStack.Common.Tests/AttributeTests.cs @@ -1,7 +1,7 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt - +#if !NETCORE using System; using System.ComponentModel; using NUnit.Framework; @@ -104,4 +104,5 @@ public void Can_add_attributes_at_runtime_to_BaseAttribute() Assert.That(o.GetType().AllAttributes().Length, Is.EqualTo(3)); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/CheckWebTests.cs b/tests/ServiceStack.Common.Tests/CheckWebTests.cs index 3f720a616b8..1a47fc0cdda 100644 --- a/tests/ServiceStack.Common.Tests/CheckWebTests.cs +++ b/tests/ServiceStack.Common.Tests/CheckWebTests.cs @@ -40,6 +40,7 @@ public class Echoes : IReturn public string Sentence { get; set; } } + [Ignore("Integration Test")] public class CheckWebTests { private const string BaseUri = "http://localhost:55799/"; @@ -50,8 +51,6 @@ public void Can_send_echoes_POST() var client = new JsonServiceClient(BaseUri); var response = client.Post(new Echoes { Sentence = "Foo" }); - - response.PrintDump(); } } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Configuration/AppSettingsTests.cs b/tests/ServiceStack.Common.Tests/Configuration/AppSettingsTests.cs index dc703fc995d..818ca15d0ca 100644 --- a/tests/ServiceStack.Common.Tests/Configuration/AppSettingsTests.cs +++ b/tests/ServiceStack.Common.Tests/Configuration/AppSettingsTests.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Configuration; using System.Linq; using NUnit.Framework; @@ -8,6 +9,63 @@ namespace ServiceStack.Common.Tests { +#if NETCORE_SUPPORT + using Microsoft.Extensions.Configuration; + + public class NetCoreAppSettingsMemoryCollectionTest : AppSettingsTest + { + public override IAppSettings GetAppSettings() + { + var input = new Dictionary + { + {"NullableKey", null}, + {"EmptyKey", string.Empty}, + {"RealKey", "This is a real value"}, + //{"ListKey", "A,B,C,D,E"}, + {"ListKey:0", "A"}, + {"ListKey:1", "B"}, + {"ListKey:2", "C"}, + {"ListKey:3", "D"}, + {"ListKey:4", "E"}, + {"IntKey", "42"}, + {"BadIntegerKey", "This is not an integer"}, + {"DictionaryKey:A", "1"}, + {"DictionaryKey:B", "2"}, + {"DictionaryKey:C", "3"}, + {"DictionaryKey:D", "4"}, + {"DictionaryKey:E", "5"}, + {"BadDictionaryKey", "A1,B"}, + {"ObjectNoLineFeed", "{SomeSetting:Test,SomeOtherSetting:12,FinalSetting:Final}"}, + {"ObjectWithLineFeed", "{SomeSetting:Test,\r\nSomeOtherSetting:12,\r\nFinalSetting:Final}"}, + {"Email:From", "test@email.com"}, + {"Email:Subject", "The Subject"}, + }; + + var configurationBuilder = new ConfigurationBuilder(); + configurationBuilder.AddInMemoryCollection(input); + var config = configurationBuilder.Build(); + var appSettings = new NetCoreAppSettings(config); + return appSettings; + } + + public class EmailConfig + { + public string From { get; set; } + public string Subject { get; set; } + } + + [Test] + public void Can_populate_typed_config() + { + var appSettings = GetAppSettings(); + var emailConfig = appSettings.Get("Email"); + Assert.That(emailConfig.From, Is.EqualTo("test@email.com")); + Assert.That(emailConfig.Subject, Is.EqualTo("The Subject")); + } + + } +#endif + [TestFixture] public class EnvironmentAppSettingsTests { @@ -17,21 +75,18 @@ public void Can_get_environment_variable() var env = new EnvironmentVariableSettings(); var path = env.Get("PATH"); Assert.That(path, Is.Not.Null); - path.Print(); var unknown = env.Get("UNKNOWN"); Assert.That(unknown, Is.Null); var envVars = env.GetAllKeys(); Assert.That(envVars.Count, Is.GreaterThan(0)); - - envVars.PrintDump(); } } public class MultiAppSettingsTest : AppSettingsTest { - public override AppSettingsBase GetAppSettings() + public override IAppSettings GetAppSettings() { return new MultiAppSettings( new DictionarySettings(GetConfigDictionary()), @@ -48,7 +103,7 @@ public override Dictionary GetConfigDictionary() public class AppConfigAppSettingsTest : AppSettingsTest { - public override AppSettingsBase GetAppSettings() + public override IAppSettings GetAppSettings() { return new AppSettings(); } @@ -65,7 +120,7 @@ public class OrmLiteAppSettingsTest : AppSettingsTest { private OrmLiteAppSettings settings; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { settings = new OrmLiteAppSettings( @@ -74,7 +129,7 @@ public void TestFixtureSetUp() settings.InitSchema(); } - public override AppSettingsBase GetAppSettings() + public override IAppSettings GetAppSettings() { var testConfig = (DictionarySettings)base.GetAppSettings(); @@ -91,6 +146,30 @@ public override AppSettingsBase GetAppSettings() return settings; } + [Test] + public void Can_access_ConfigSettings_directly() + { + GetAppSettings(); + using (var db = settings.DbFactory.Open()) + { + var value = db.Scalar( + "SELECT Value FROM ConfigSetting WHERE Id = @id", new { id = "RealKey" }); + + Assert.That(value, Is.EqualTo("This is a real value")); + } + } + + [Test] + public void Can_preload_AppSettings() + { + GetAppSettings(); + + var allSettings = settings.GetAll(); + var cachedSettings = new DictionarySettings(allSettings); + + Assert.That(cachedSettings.Get("RealKey"), Is.EqualTo("This is a real value")); + } + [Test] public void GetString_returns_null_On_Nonexistent_Key() { @@ -100,7 +179,7 @@ public void GetString_returns_null_On_Nonexistent_Key() } [Test] - public void GetList_returns_emtpy_list_On_Null_Key() + public void GetList_returns_empty_list_On_Null_Key() { var appSettings = GetAppSettings(); @@ -123,6 +202,30 @@ public void Does_GetOrCreate_New_Value() result = appSettings.GetOrCreate(key, () => key + ++i); Assert.That(result, Is.EqualTo("key1")); } + + public class AppConfig + { + public int IntValue { get; set; } + public bool BoolValue { get; set; } + } + + [Test] + public void Does_Save_Typed_Poco_Config() + { + var appSettings = (OrmLiteAppSettings)GetAppSettings(); + appSettings.Set("config", new AppConfig { + IntValue = 1, + BoolValue = true + }); + + var config = appSettings.Get("config"); + Assert.That(config.IntValue, Is.EqualTo(1)); + Assert.That(config.BoolValue); + + appSettings.Delete("config"); + config = appSettings.Get("config"); + Assert.That(config, Is.Null); + } } public class DictionarySettingsTest : AppSettingsTest @@ -159,7 +262,7 @@ IntKey 42 Assert.That(appSettings.Get("EmptyKey"), Is.EqualTo("")); Assert.That(appSettings.Get("RealKey"), Is.EqualTo("This is a real value")); - Assert.That(appSettings.Get("IntKey", defaultValue:1), Is.EqualTo(42)); + Assert.That(appSettings.Get("IntKey", defaultValue: 1), Is.EqualTo(42)); var list = appSettings.GetList("ListKey"); Assert.That(list, Has.Count.EqualTo(5)); @@ -177,15 +280,28 @@ IntKey 42 Assert.That(value.SomeOtherSetting, Is.EqualTo(12)); Assert.That(value.SomeSetting, Is.EqualTo("Test")); } + + [Test] + public void Does_parse_byte_array_as_Base64() + { + var authKey = AesUtils.CreateKey(); + + var appSettings = new DictionarySettings(new Dictionary + { + { "AuthKey", Convert.ToBase64String(authKey) } + }); + + Assert.That(appSettings.Get("AuthKey"), Is.EquivalentTo(authKey)); + } } public abstract class AppSettingsTest { - public virtual AppSettingsBase GetAppSettings() + public virtual IAppSettings GetAppSettings() { return new DictionarySettings(GetConfigDictionary()) { - ParsingStrategy = null, + ParsingStrategy = null, }; } @@ -203,6 +319,7 @@ public virtual Dictionary GetConfigDictionary() {"BadDictionaryKey", "A1,B:"}, {"ObjectNoLineFeed", "{SomeSetting:Test,SomeOtherSetting:12,FinalSetting:Final}"}, {"ObjectWithLineFeed", "{SomeSetting:Test,\r\nSomeOtherSetting:12,\r\nFinalSetting:Final}"}, + {"Email","{From:test@email.com,Subject:The Subject}"}, }; } @@ -258,6 +375,19 @@ public void Get_Throws_Exception_On_Bad_Value() } } + [Test] + public void Can_Get_List_From_Setting_using_generics() + { + var appSettings = GetAppSettings(); + var value = appSettings.Get>("ListKey"); + + Assert.That(value, Has.Count.EqualTo(5)); + Assert.That(value, Is.EqualTo(new List { "A", "B", "C", "D", "E" })); + + var valueWithDefault = appSettings.Get("ListKey", new List()); + Assert.That(valueWithDefault, Is.EquivalentTo(valueWithDefault)); + } + [Test] public void GetList_Parses_List_From_Setting() { @@ -278,6 +408,17 @@ public void GetDictionary_Parses_Dictionary_From_Setting() Assert.That(value.Keys, Is.EqualTo(new List { "A", "B", "C", "D", "E" })); Assert.That(value.Values, Is.EqualTo(new List { "1", "2", "3", "4", "5" })); } + + [Test] + public void GetKeyValuePairs_Parses_Dictionary_From_Setting() + { + var appSettings = GetAppSettings(); + var kvps = appSettings.GetKeyValuePairs("DictionaryKey"); + + Assert.That(kvps, Has.Count.EqualTo(5)); + Assert.That(kvps.Map(x => x.Key), Is.EqualTo(new List { "A", "B", "C", "D", "E" })); + Assert.That(kvps.Map(x => x.Value), Is.EqualTo(new List { "1", "2", "3", "4", "5" })); + } [Test] public void GetDictionary_Throws_Exception_On_Null_Key() @@ -310,29 +451,46 @@ public void GetDictionary_Throws_Exception_On_Bad_Value() Assert.That(ex.Message.Contains("BadDictionaryKey")); } } - + [Test] public void Get_Returns_ObjectNoLineFeed() { - var appSettings = GetAppSettings(); + if (!(GetAppSettings() is AppSettingsBase appSettings)) return; + appSettings.ParsingStrategy = AppSettingsStrategy.CollapseNewLines; var value = appSettings.Get("ObjectNoLineFeed", new SimpleAppSettings()); Assert.That(value, Is.Not.Null); Assert.That(value.FinalSetting, Is.EqualTo("Final")); Assert.That(value.SomeOtherSetting, Is.EqualTo(12)); Assert.That(value.SomeSetting, Is.EqualTo("Test")); + + value = appSettings.Get("ObjectNoLineFeed"); + Assert.That(value, Is.Not.Null); + Assert.That(value.FinalSetting, Is.EqualTo("Final")); + Assert.That(value.SomeOtherSetting, Is.EqualTo(12)); + Assert.That(value.SomeSetting, Is.EqualTo("Test")); } [Test] +#if NETCORE + [Ignore("Attribute value already has its new lines collapsed")] +#endif public void Get_Returns_ObjectWithLineFeed() { - var appSettings = GetAppSettings(); + if (!(GetAppSettings() is AppSettingsBase appSettings)) return; + appSettings.ParsingStrategy = AppSettingsStrategy.CollapseNewLines; var value = appSettings.Get("ObjectWithLineFeed", new SimpleAppSettings()); Assert.That(value, Is.Not.Null); Assert.That(value.FinalSetting, Is.EqualTo("Final")); Assert.That(value.SomeOtherSetting, Is.EqualTo(12)); Assert.That(value.SomeSetting, Is.EqualTo("Test")); + + value = appSettings.Get("ObjectWithLineFeed"); + Assert.That(value, Is.Not.Null); + Assert.That(value.FinalSetting, Is.EqualTo("Final")); + Assert.That(value.SomeOtherSetting, Is.EqualTo(12)); + Assert.That(value.SomeSetting, Is.EqualTo("Test")); } [Test] @@ -372,5 +530,19 @@ public void Can_search_all_keys() Assert.That(badKeys, Is.EquivalentTo(new[] { "BadIntegerKey", "BadDictionaryKey" })); } + + [Test] + public void Can_set_and_get_strings() + { + var exampleUrl = "https://www.example.org"; + var appSettings = GetAppSettings(); + appSettings.Set("url", exampleUrl); + var url = appSettings.Get("url"); + + Assert.That(url, Is.EqualTo(exampleUrl)); + + url = appSettings.GetString("url"); + Assert.That(url, Is.EqualTo(exampleUrl)); + } } } diff --git a/tests/ServiceStack.Common.Tests/Configuration/ConfigUtilsTests.cs b/tests/ServiceStack.Common.Tests/Configuration/ConfigUtilsTests.cs new file mode 100644 index 00000000000..b71ca5796cf --- /dev/null +++ b/tests/ServiceStack.Common.Tests/Configuration/ConfigUtilsTests.cs @@ -0,0 +1,44 @@ +using System.Reflection; +using Funq; +using NUnit.Framework; +using ServiceStack.Configuration; +using ServiceStack.Testing; + +namespace ServiceStack.Common.Tests +{ + [TestFixture] + public class ConfigUtilsTests + { + public class AppHostTest : AppSelfHostBase + { + public AppHostTest() + : base("Test Config AppHost", typeof(AppHostTest).Assembly) {} + + public override void Configure(Container container) {} + } + + [Test] + public void Can_parse_AppConfig_AppSettings_with_XmlReader() + { + using (new AppHostTest().Init()) + { + var map = ConfigUtils.GetAppSettingsMap(); + Assert.That(map.Count, Is.EqualTo(11)); + Assert.That(map.Keys, Is.EquivalentTo(new[] { + "servicestack:license", + "EmptyKey", + "RealKey", + "ListKey", + "IntKey", + "BadIntegerKey", + "DictionaryKey", + "BadDictionaryKey", + "ObjectNoLineFeed", + "ObjectWithLineFeed", + "Email", + })); + } + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Configuration/NetCoreAppSettingsTests.cs b/tests/ServiceStack.Common.Tests/Configuration/NetCoreAppSettingsTests.cs new file mode 100644 index 00000000000..d25d1a5f777 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/Configuration/NetCoreAppSettingsTests.cs @@ -0,0 +1,136 @@ +#if NETCORE_SUPPORT +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using ServiceStack.Configuration; +using Microsoft.Extensions.Configuration; + +namespace ServiceStack.Common.Tests +{ + [TestFixture] + public class NetCoreAppSettingsTests + { + public class KeyWithSubkey + { + public string Subkey { get; set; } + } + + public static Dictionary Settings = new Dictionary + { + {"A:A1", "A_A1_Value"}, + {"A:A2:Subkey", "A_A2_Subkey_Value"}, + {"B", "B_Value"}, + {"C:List1:0", "C_List1_Value1"}, + {"C:List1:1", "C_List1_Value2"}, + {"D:Dict1:A", "D_Dict1_ValueA"}, + {"D:Dict1:B", "D_Dict1_ValueB"} + }; + + public IAppSettings GetAppSettings() + { + var configurationBuilder = new ConfigurationBuilder(); + configurationBuilder.AddInMemoryCollection(Settings); + var config = configurationBuilder.Build(); + return new NetCoreAppSettings(config); + } + + [Test] + [TestCaseSource("Settings")] + public void Can_GetString_use_NestedKey(KeyValuePair keyValue) + { + var appSettings = GetAppSettings(); + var child2Value = appSettings.GetString(keyValue.Key); + Assert.That(child2Value, Is.EqualTo(keyValue.Value)); + } + + [Test] + [TestCaseSource("Settings")] + public void Can_Get_use_NestedKey(KeyValuePair keyValue) + { + var appSettings = GetAppSettings(); + var child2Value = appSettings.Get(keyValue.Key); + Assert.That(child2Value, Is.EqualTo(keyValue.Value)); + } + + [Test] + [TestCaseSource("Settings")] + public void Can_GetType_String_with_Default_use_NestedKey(KeyValuePair keyValue) + { + var appSettings = GetAppSettings(); + var value = appSettings.Get(keyValue.Key, "default"); + Assert.That(value, Is.EqualTo(keyValue.Value)); + } + + [Test] + public void Can_GetType_Object_use_NestedKey() + { + var appSettings = GetAppSettings(); + var value = appSettings.Get("A:A2"); + Assert.That(value.Subkey, Is.EqualTo("A_A2_Subkey_Value")); + } + + [Test] + public void Can_GetType_Object_with_Default_use_NestedKey() + { + var appSettings = GetAppSettings(); + var value = appSettings.Get("A:A2", new KeyWithSubkey{ Subkey = "default" }); + Assert.That(value.Subkey, Is.EqualTo("A_A2_Subkey_Value")); + } + + [Test] + public void Can_GetAll_see_NestedKeys() + { + var appSettings = (GetAppSettings() as NetCoreAppSettings).Configuration; + var allKeyValues = appSettings.AsEnumerable(); + foreach (var key in Settings.Keys) + { + Assert.That(allKeyValues.Any(x => x.Key == key)); + } + } + + [Test] + public void Can_GetAllKeys_see_NestedKeys() + { + var appSettings = (GetAppSettings() as NetCoreAppSettings).Configuration; + var allKeyValues = appSettings.AsEnumerable(); + foreach (var key in Settings.Keys) + { + Assert.That(allKeyValues.Any(x => x.Key == key)); + } + } + + [Test] + [TestCaseSource("Settings")] + public void Can_Exists_using_NestedKey(KeyValuePair keyValue) + { + var appSettings = GetAppSettings(); + var keyExists = appSettings.Exists(keyValue.Key); + Assert.That(keyExists, Is.True); + } + + [Test] + public void Can_GetList_using_NestedKey() + { + var appSettings = GetAppSettings(); + var listValues = appSettings.GetList("C:List1"); + Assert.That(listValues, Is.Not.Null.And.Not.Empty.And.Count.EqualTo(2)); + } + + [Test] + public void Can_GetDictionary_using_NestedKey() + { + var appSettings = GetAppSettings(); + var dictValues = appSettings.GetDictionary("D:Dict1"); + Assert.That(dictValues, Is.Not.Null.And.Not.Empty.And.Count.EqualTo(2)); + } + + [Test] + public void Can_GetKeyValuePairs_using_NestedKey() + { + var appSettings = GetAppSettings(); + var dictValues = appSettings.GetKeyValuePairs("D:Dict1"); + Assert.That(dictValues, Is.Not.Null.And.Not.Empty.And.Count.EqualTo(2)); + } + } +} +#endif diff --git a/tests/ServiceStack.Common.Tests/ContainerChildTests.cs b/tests/ServiceStack.Common.Tests/ContainerChildTests.cs new file mode 100644 index 00000000000..0371b0dd46b --- /dev/null +++ b/tests/ServiceStack.Common.Tests/ContainerChildTests.cs @@ -0,0 +1,63 @@ +using Funq; +using NUnit.Framework; + +namespace ServiceStack.Common.Tests +{ + public interface ISomeService + { } + + public class SomeService : ISomeService + { + public readonly Dependency dependancy; + + public SomeService(Dependency dependancy) + { + this.dependancy = dependancy; + } + } + + public class Dependency + { + public readonly string label; + + public Dependency(string label) + { + this.label = label; + } + } + + public class ContainerChildTests + { + [Test] + public void Can_use_child_containers() + { + Container parent = new Container(); + + // Create two childs, each with a specific instance Dependancy + Container child1 = parent.CreateChildContainer(); + Container child2 = parent.CreateChildContainer(); + + child1.Register(new Dependency("First")); + child2.Register(new Dependency("Second")); + + // Now register two factories for ISomeService. + child1.Register(x => Factory(x)); + child2.Register(x => Factory(x)); + + ISomeService resolved1 = child1.Resolve(); + ISomeService resolved2 = child2.Resolve(); + + Assert.That(((SomeService)resolved1).dependancy.label, Is.EqualTo("First")); + Assert.That(((SomeService)resolved2).dependancy.label, Is.EqualTo("Second")); + } + + public static ISomeService Factory(Container c) + { + // Register the service by type... + c.RegisterAutoWiredType(typeof(SomeService), ReuseScope.Hierarchy); + // ... and force auto-wiring to happen. + ISomeService result = (ISomeService)c.TryResolve(typeof(SomeService)); + return result; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/ContainerTests.cs b/tests/ServiceStack.Common.Tests/ContainerTests.cs new file mode 100644 index 00000000000..b0916caa3fe --- /dev/null +++ b/tests/ServiceStack.Common.Tests/ContainerTests.cs @@ -0,0 +1,103 @@ +using Funq; +using NUnit.Framework; +using ServiceStack.Host; +using ServiceStack.Testing; + +namespace ServiceStack.Common.Tests +{ + [TestFixture] + public class ContainerTests + { + class Foo : IFoo + { + private static int Count; + + public Foo() + { + Id = Count++; + } + + public int Id { get; set; } + public IBar Bar { get; set; } + } + + interface IFoo + { + int Id { get; set; } + } + + class Bar : IBar + { + private static int Count; + + public Bar() + { + Count++; + } + + public string Name { get; set; } + } + + interface IBar + { + string Name { get; set; } + } + + [Test] + public void Does_TryResolve_from_delegate_cache() + { + var container = new Container(); + container.Register(c => new Foo { Id = 1 }); + + var instance = (Foo)container.TryResolve(typeof(Foo)); + Assert.That(instance.Id, Is.EqualTo(1)); + + instance = (Foo)container.TryResolve(typeof(Foo)); + Assert.That(instance.Id, Is.EqualTo(1)); + } + + [Test] + public void Can_use_NetCore_APIs_to_register_dependencies() + { + using (var appHost = new BasicAppHost().Init()) + { + var services = appHost.Container; + + services.AddTransient(); + services.AddSingleton(c => new Bar { Name = "bar" }); + + var bar = (Bar)services.GetService(typeof(IBar)); + Assert.That(bar.Name, Is.EqualTo("bar")); + + var foo = (Foo)services.GetService(typeof(IFoo)); + Assert.That(foo.Id, Is.EqualTo(0)); + Assert.That(ReferenceEquals(foo.Bar, bar)); + + foo = (Foo)services.GetService(typeof(IFoo)); + Assert.That(foo.Id, Is.EqualTo(1)); + Assert.That(ReferenceEquals(foo.Bar, bar)); + } + } + + [Test] + public void CreateInstance_throws_on_missing_dependency() + { + using (var appHost = new BasicAppHost().Init()) + { + var services = appHost.Container; + services.AddTransient(); + + var typeFactory = new ContainerResolveCache(appHost.Container); + + var foo = typeFactory.CreateInstance(services, typeof(IFoo), tryResolve: true); + Assert.That(foo, Is.Not.Null); + + var bar = typeFactory.CreateInstance(services, typeof(IBar), tryResolve: true); + Assert.That(bar, Is.Null); + + Assert.Throws(() => + typeFactory.CreateInstance(services, typeof(IBar), tryResolve: false)); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/CryptUtilTest.cs b/tests/ServiceStack.Common.Tests/CryptUtilTest.cs index 502851cd305..1693ffffca6 100644 --- a/tests/ServiceStack.Common.Tests/CryptUtilTest.cs +++ b/tests/ServiceStack.Common.Tests/CryptUtilTest.cs @@ -1,4 +1,5 @@ -using System; +#if !NETCORE_SUPPORT +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -13,8 +14,8 @@ public class CryptUtilsTest [TestCase] public void CanEncryptWithStringExtension() { - CryptUtils.Length = RsaKeyLengths.Bit1024; - CryptUtils.KeyPair = CryptUtils.CreatePublicAndPrivateKeyPair(); + RsaUtils.KeyLength = RsaKeyLengths.Bit1024; + RsaUtils.DefaultKeyPair = RsaUtils.CreatePublicAndPrivateKeyPair(); string TestStart = "Mr. Watson--come here--I want to see you."; string Encrypted; @@ -28,18 +29,21 @@ public void CanEncryptWithStringExtension() } - [TestCase] - [Test, ExpectedException(typeof(ArgumentNullException))] - public void CanEncryptWithStringExtensionFailsWithoutKeyPair() + [Test] + public void Can_sign_data_with_RSA() { - CryptUtils.Length = RsaKeyLengths.Bit1024; - CryptUtils.KeyPair = null; - string TestStart = "Mr. Watson--come here--I want to see you."; - string Encrypted; + var privateKey = RsaUtils.CreatePrivateKeyParams(RsaKeyLengths.Bit2048); + var publicKey = privateKey.ToPublicRsaParameters(); - Encrypted = TestStart.Encrypt(); - + var message = "sign this"; + var data = message.ToUtf8Bytes(); + + var signature = RsaUtils.Authenticate(data, privateKey, "SHA256", RsaKeyLengths.Bit2048); + + var verified = RsaUtils.Verify(data, signature, publicKey, "SHA256", RsaKeyLengths.Bit2048); + Assert.That(verified, Is.True); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/EndpointHandlerBaseTests.cs b/tests/ServiceStack.Common.Tests/EndpointHandlerBaseTests.cs index dd501aba213..472a7eabe26 100644 --- a/tests/ServiceStack.Common.Tests/EndpointHandlerBaseTests.cs +++ b/tests/ServiceStack.Common.Tests/EndpointHandlerBaseTests.cs @@ -1,7 +1,11 @@ -using System; +#if !NETCORE_SUPPORT +using System; +using System.IO; +using System.Linq; using NUnit.Framework; +using ServiceStack.Host; +using ServiceStack.IO; using ServiceStack.Testing; -using ServiceStack.Text; using ServiceStack.Web; namespace ServiceStack.Common.Tests @@ -41,5 +45,61 @@ public void Can_parse_int_enums() Assert.That(result.Has(A.C)); Assert.That(!result.Has(A.D)); } + + [Test] + public void Can_mock_uploading_files() + { + using (new BasicAppHost + { + ConfigureAppHost = host => host.VirtualFiles = new MemoryVirtualFiles(), + }.Init()) + { + var ms = "mocked".ToUtf8Bytes().InMemoryStream(); + var httpFile = new HttpFile + { + ContentType = "application/x-msaccess", + FileName = "C:\\path\\to\\file.txt", + InputStream = ms, + ContentLength = ms.ToArray().Length, + }; + var mockReq = new MockHttpRequest + { + Files = new IHttpFile[] { httpFile }, + }; + //Mock Session + mockReq.Items[Keywords.Session] = new AuthUserSession { Id = "sess-id" }; + + var service = new UploadFileService + { + Request = mockReq + }; + + service.Any(new MockUploadFile()); + + var files = HostContext.VirtualFiles.GetAllFiles().ToList(); + Assert.That(files[0].ReadAllText(), Is.EqualTo("mocked")); + } + } + + public class MockUploadFile { } + + public class UploadFileService : Service + { + public object Any(MockUploadFile request) + { + for (int i = 0; i < Request.Files.Length; i++) + { + var file = Request.Files[i]; + + string fileId = Guid.NewGuid().ToString(); + var session = base.GetSession(); + var fileName = session.Id.CombineWith(fileId); + VirtualFiles.WriteFile(fileName, file.InputStream); + } + + return request; + } + } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/EnumerableExtensionsTests.cs b/tests/ServiceStack.Common.Tests/EnumerableExtensionsTests.cs index 062f7f46263..bb0e09f79fe 100644 --- a/tests/ServiceStack.Common.Tests/EnumerableExtensionsTests.cs +++ b/tests/ServiceStack.Common.Tests/EnumerableExtensionsTests.cs @@ -1,3 +1,6 @@ +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; using NUnit.Framework; using ServiceStack.Common; using System.Linq; @@ -5,84 +8,137 @@ namespace ServiceStack.Common.Tests { - [TestFixture] - public class EnumerableExtensionsTests - { - readonly int[] IntValues = new[] { 1, 2, 3 }; - readonly int[] NoValues = new int[]{}; - readonly int[] DifferentValues = new[] { 5, 6, 7}; - readonly int[] MoreIntValues = new[] { 1, 2, 3, 4 }; - readonly int[] LessIntValues = new[] { 1, 2 }; - readonly int[] UnorderedIntValues = new[] { 3, 2, 1 }; - - readonly string[] StringValues = new[] { "A", "B", "C" }; - readonly string[] NoStringValues = new string[] { }; - - [Test] - public void Can_Join() - { - Assert.That(IntValues.Join(), Is.EqualTo("1,2,3")); - } - - [Test] - public void EquivalentTo_self() - { - Assert.That(IntValues.EquivalentTo(IntValues), Is.True); - } - - [Test] - public void EquivalentTo_List() - { - Assert.That(IntValues.EquivalentTo(IntValues.ToList()), Is.True); - } - - [Test] - public void Not_EquivalentTo_NoValues() - { - Assert.That(IntValues.EquivalentTo(NoValues), Is.False); - } - - [Test] - public void Not_EquivalentTo_DifferentValues() - { - Assert.That(IntValues.EquivalentTo(DifferentValues), Is.False); - } - - [Test] - public void Not_EquivalentTo_LessIntValues() - { - Assert.That(IntValues.EquivalentTo(LessIntValues), Is.False); - } - - [Test] - public void Not_EquivalentTo_MoreIntValues() - { - Assert.That(IntValues.EquivalentTo(MoreIntValues), Is.False); - } - - [Test] - public void Not_EquivalentTo_UnorderedIntValues() - { - Assert.That(IntValues.EquivalentTo(UnorderedIntValues), Is.False); - } - - [Test] - public void Not_EquivalentTo_null() - { - Assert.That(IntValues.EquivalentTo(null), Is.False); - } - - [Test] - public void EquivalentTo_StringValues() - { - Assert.That(StringValues.EquivalentTo(NoStringValues), Is.False); - Assert.That(NoStringValues.EquivalentTo(StringValues), Is.False); - Assert.That(NoStringValues.EquivalentTo(NoStringValues), Is.True); - Assert.That(StringValues.EquivalentTo(StringValues), Is.True); - - Assert.That(StringValues.EquivalentTo(new string[] { null }), Is.False); - Assert.That(new string[] { null }.EquivalentTo(StringValues), Is.False); - } - - } + [TestFixture] + public class EnumerableExtensionsTests + { + readonly int[] IntValues = new[] { 1, 2, 3 }; + readonly int[] NoValues = new int[] { }; + readonly int[] DifferentValues = new[] { 5, 6, 7 }; + readonly int[] MoreIntValues = new[] { 1, 2, 3, 4 }; + readonly int[] LessIntValues = new[] { 1, 2 }; + readonly int[] UnorderedIntValues = new[] { 3, 2, 1 }; + + readonly string[] StringValues = new[] { "A", "B", "C" }; + readonly string[] NoStringValues = new string[] { }; + + [Test] + public void Can_FirstOrDefault() + { + Assert.That(EnumerableUtils.FirstOrDefault(IntValues), Is.EqualTo(1)); + } + + [Test] + public void Can_Skip() + { + Assert.That(EnumerableUtils.Skip(IntValues,1), Is.EqualTo(new[]{ 2, 3 })); + } + + [Test] + public void Can_Take() + { + Assert.That(EnumerableUtils.Take(IntValues, 2), Is.EqualTo(new[]{ 1, 2 })); + } + + [Test] + public void Can_Join() + { + Assert.That(IntValues.Join(), Is.EqualTo("1,2,3")); + } + + [Test] + public void EquivalentTo_self() + { + Assert.That(IntValues.EquivalentTo(IntValues), Is.True); + } + + [Test] + public void EquivalentTo_List() + { + Assert.That(IntValues.EquivalentTo(IntValues.ToList()), Is.True); + } + + [Test] + public void Not_EquivalentTo_NoValues() + { + Assert.That(IntValues.EquivalentTo(NoValues), Is.False); + } + + [Test] + public void Not_EquivalentTo_DifferentValues() + { + Assert.That(IntValues.EquivalentTo(DifferentValues), Is.False); + } + + [Test] + public void Not_EquivalentTo_LessIntValues() + { + Assert.That(IntValues.EquivalentTo(LessIntValues), Is.False); + } + + [Test] + public void Not_EquivalentTo_MoreIntValues() + { + Assert.That(IntValues.EquivalentTo(MoreIntValues), Is.False); + } + + [Test] + public void Not_EquivalentTo_UnorderedIntValues() + { + Assert.That(IntValues.EquivalentTo(UnorderedIntValues), Is.False); + } + + [Test] + public void Not_EquivalentTo_null() + { + Assert.That(IntValues.EquivalentTo(null), Is.False); + } + + [Test] + public void EquivalentTo_StringValues() + { + Assert.That(StringValues.EquivalentTo(NoStringValues), Is.False); + Assert.That(NoStringValues.EquivalentTo(StringValues), Is.False); + Assert.That(NoStringValues.EquivalentTo(NoStringValues), Is.True); + Assert.That(StringValues.EquivalentTo(StringValues), Is.True); + + Assert.That(StringValues.EquivalentTo(new string[] { null }), Is.False); + Assert.That(new string[] { null }.EquivalentTo(StringValues), Is.False); + } + + [Test] + public void EquivalentTo_Dictionary_Ordered() + { + var a = new Dictionary + { + {"A",1}, + {"B",2}, + {"C",3}, + }; + var b = new ConcurrentDictionary(); + b["A"] = 1; + b["B"] = 2; + b["C"] = 3; + + Assert.That(a.EquivalentTo(b)); + } + + [Test] + public void EquivalentTo_Dictionary_Unordered() + { + var a = new Dictionary + { + {"A",1}, + {"B",2}, + {"C",3}, + }; + var b = new Dictionary + { + {"C",3}, + {"A",1}, + {"B",2}, + }; + + Assert.That(a.EquivalentTo(b)); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/ExpressionUtilsTests.cs b/tests/ServiceStack.Common.Tests/ExpressionUtilsTests.cs new file mode 100644 index 00000000000..4a888d13fd3 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/ExpressionUtilsTests.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using NUnit.Framework; +using ServiceStack.Common.Tests.Models; +using ServiceStack.DataAnnotations; +using ServiceStack.Text; + +namespace ServiceStack.Common.Tests +{ + public class ExpressionUtilsTests + { + abstract class AbstractBase + { + public string BaseMember { get; set; } + } + + class Derived : AbstractBase + { + public string DerivedMember { get; set; } + } + + [Test] + public void Does_GetMemberName() + { + Assert.That(ExpressionUtils.GetMemberName((Poco x) => x.Name), + Is.EqualTo("Name")); + + Assert.That(ExpressionUtils.GetMemberName((ModelWithFieldsOfNullableTypes x) => x.NId), + Is.EqualTo("NId")); + } + + public Expression> GetAssignmentExpression(Expression> expr) + { + return expr; + } + + [Test] + public void Can_get_assigned_constants() + { + Assert.That(GetAssignmentExpression(() => new Poco { Name = "Foo" }).AssignedValues(), + Is.EquivalentTo(new Dictionary { + {"Name", "Foo"} + })); + } + + [Test] + public void Can_get_assigned_expressions() + { + 2.Times(i => + { + Assert.That(GetAssignmentExpression(() => new Poco { Name = i % 2 == 0 ? "Foo" : "Bar" }).AssignedValues(), + Is.EquivalentTo(new Dictionary { + { "Name", i % 2 == 0 ? "Foo" : "Bar" } + })); + }); + } + + [Test] + public void Can_get_fields_list_from_property_expression() + { + Assert.That(ExpressionUtils.GetFieldNames((Poco x) => x.Name), + Is.EquivalentTo(new[] { "Name" })); + + Assert.That(ExpressionUtils.GetFieldNames((Poco x) => x.Id), + Is.EquivalentTo(new[] { "Id" })); + } + + [Test] + public void Can_get_fields_list_from_anon_object() + { + Assert.That(ExpressionUtils.GetFieldNames((Poco x) => new { x.Id, x.Name }), + Is.EquivalentTo(new[] { "Id", "Name" })); + } + + [Test] + public void Can_get_fields_list_from_Typed_object() + { + Assert.That(ExpressionUtils.GetFieldNames((Poco x) => new Poco { Id = x.Id, Name = x.Name }), + Is.EquivalentTo(new[] { "Id", "Name" })); + } + + [Test] + public void Can_get_fields_list_from_array() + { + Assert.That(ExpressionUtils.GetFieldNames((Poco x) => new[] { "Id", "Name" }), + Is.EquivalentTo(new[] { "Id", "Name" })); + + var id = "Id"; + + Assert.That(ExpressionUtils.GetFieldNames((Poco x) => new[] { id, "Na" + "me" }), + Is.EquivalentTo(new[] { "Id", "Name" })); + } + + [Test] + public void Can_get_fields_list_from_list() + { + var list = new List { "Id", "Name" }; + + Assert.That(ExpressionUtils.GetFieldNames((Poco x) => list), + Is.EquivalentTo(new[] { "Id", "Name" })); + } + + [Test] + public void Can_get_fields_from_abstract_base_class() + { + Assert.That(ExpressionUtils.GetFieldNames(p => p.BaseMember), + Is.EquivalentTo(new[] {"BaseMember"})); + Assert.That(ExpressionUtils.GetFieldNames(p => p.DerivedMember), + Is.EquivalentTo(new[] { "DerivedMember" })); + } + + public class Question + { + public int Id { get; set; } + public string Text { get; set; } + + [CustomField("json")] + public List Answers { get; set; } + } + + public class Answer + { + public int Id { get; set; } + public string Text { get; set; } + } + + [Test] + public void Can_get_assigned_ComplexTypes() + { + var assignedValues = GetAssignmentExpression(() => new Question + { + Id = 1, + Answers = new List + { + new Answer { Id = 1, Text = "Q1 Answer1" } + } + }).AssignedValues(); + + Assert.That(assignedValues.Count, Is.EqualTo(2)); + var assignedValue = (List)assignedValues["Answers"]; + Assert.That(assignedValue[0].Text, Is.EqualTo("Q1 Answer1")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Expressions/DelegateFactoryTests.cs b/tests/ServiceStack.Common.Tests/Expressions/DelegateFactoryTests.cs index 2518b0ae441..9981ce73225 100644 --- a/tests/ServiceStack.Common.Tests/Expressions/DelegateFactoryTests.cs +++ b/tests/ServiceStack.Common.Tests/Expressions/DelegateFactoryTests.cs @@ -2,81 +2,83 @@ using System.Diagnostics; using NUnit.Framework; using ServiceStack.Reflection; +using System.Linq; +using System.Reflection; namespace ServiceStack.Common.Tests.Expressions { - [TestFixture] - public class DelegateFactoryTests - { - const string TextValue = "Hello, World!"; - private const int Times = 10000; - - [Test] - public void String_test_with_func_call() - { - var stopWatch = new Stopwatch(); - stopWatch.Start(); - - Func action = TextValue.ToUpper; - - for (var i=0; i < Times; i++) - { - action(); - } - - stopWatch.Stop(); - Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); - } - - [Test] - public void String_test_with_direct_call() - { - var stopWatch = new Stopwatch(); - stopWatch.Start(); - - for (var i=0; i < Times; i++) - { - TextValue.ToUpper(); - } - - stopWatch.Stop(); - Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); - } - - [Test] - public void String_test_with_reflection() - { - var stopWatch = new Stopwatch(); - stopWatch.Start(); - - var methodInfo = typeof(string).GetMethod("ToUpper", new Type[] { }); - - for (var i=0; i < Times; i++) - { - methodInfo.Invoke(TextValue, new object[] { }); - } - - stopWatch.Stop(); - Console.WriteLine("Reflection took: {0}ms", stopWatch.ElapsedMilliseconds); - } - - [Test] - public void String_test_with_delegate() - { - var stopWatch = new Stopwatch(); - stopWatch.Start(); - - var methodInfo = typeof (string).GetMethod("ToUpper", new Type[] {}); - var delMethod = DelegateFactory.Create(methodInfo); - - for (var i=0; i < Times; i++) - { - delMethod(TextValue, new object[] { }); - } - - stopWatch.Stop(); - Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); - } - - } + [TestFixture] + public class DelegateFactoryTests + { + const string TextValue = "Hello, World!"; + private const int Times = 10000; + + [Test] + public void String_test_with_func_call() + { + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + Func action = TextValue.ToUpper; + + for (var i = 0; i < Times; i++) + { + action(); + } + + stopWatch.Stop(); + Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); + } + + [Test] + public void String_test_with_direct_call() + { + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + for (var i = 0; i < Times; i++) + { + TextValue.ToUpper(); + } + + stopWatch.Stop(); + Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); + } + + [Test] + public void String_test_with_reflection() + { + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + var methodInfo = typeof(string).GetMethod("ToUpper", new Type[] { }); + + for (var i = 0; i < Times; i++) + { + methodInfo.Invoke(TextValue, new object[] { }); + } + + stopWatch.Stop(); + Console.WriteLine("Reflection took: {0}ms", stopWatch.ElapsedMilliseconds); + } + + [Test] + public void String_test_with_delegate() + { + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + var methodInfo = typeof(string).GetMethod("ToUpper", new Type[] { }); + var delMethod = DelegateFactory.Create(methodInfo); + + for (var i = 0; i < Times; i++) + { + delMethod(TextValue, new object[] { }); + } + + stopWatch.Stop(); + Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Expressions/ExpressionTests.cs b/tests/ServiceStack.Common.Tests/Expressions/ExpressionTests.cs index 4d158b59836..298d34a2b27 100644 --- a/tests/ServiceStack.Common.Tests/Expressions/ExpressionTests.cs +++ b/tests/ServiceStack.Common.Tests/Expressions/ExpressionTests.cs @@ -6,89 +6,89 @@ namespace ServiceStack.Common.Tests.Expressions { - [TestFixture] - public class ExpressionTests - { - - public int AddMethod(int a) - { - return a + 4; - } - - [Test] - public void Simple_func_and_equivalent_expression_tests() - { - Func add = x => x + x; - - Assert.That(add(4), Is.EqualTo(4 + 4)); - - Expression> addExpr = x => x + 4; - - Func addFromExpr = addExpr.Compile(); - - Assert.That(addFromExpr(4), Is.EqualTo(add(4))); - - Func addMethod = AddMethod; - - Assert.That(addMethod(4), Is.EqualTo(add(4))); - - Expression> callAddMethodExpr = x => AddMethod(x); - var addMethodCall = (MethodCallExpression) callAddMethodExpr.Body; - Assert.That(addMethodCall.Method.Name, Is.EqualTo("AddMethod")); - } - - [Test] - public void Simple_func_timing_tests() - { - // 1/5 as expensive as expression - var stopWatch = new Stopwatch(); - stopWatch.Start(); - Func add = x => x + x; - - Assert.That(add(4), Is.EqualTo(4 + 4)); - stopWatch.Stop(); - Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); - } - - [Test] - public void Simple_expression_timing_tests() - { - //5 times more expensive than Func - var stopWatch = new Stopwatch(); - stopWatch.Start(); - Expression> addExpr = x => x + 4; - - Func addFromExpr = addExpr.Compile(); - - Assert.That(addFromExpr(4), Is.EqualTo(4 + 4)); - stopWatch.Stop(); - Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); - } - - - public static int StaticAdd(int a) - { - return a + 4; - } - - [Test] - public void MethodCallExpression_to_call_a_static_method() - { - //Expression> callAddMethodExpr = Expression.Lambda>(Expression.Call(null, (MethodInfo) methodof(ExpressionTests.StaticAdd), - //new Expression[] { CS$0$0000 = Expression.Parameter(typeof(int), "x") }), new ParameterExpression[] { CS$0$0000 }); - - Expression> callAddMethodExpr = x => StaticAdd(x); - var addMethodCall = (MethodCallExpression)callAddMethodExpr.Body; - Assert.That(addMethodCall.Method.Name, Is.EqualTo("StaticAdd")); - } - - [Test] - public void Dynamic_MethodCallExpression_to_call_a_static_method() - { - - //MethodCallExpression.Call(Expression.Call(GetType().GetMethod("StaticAdd", BindingFlags.Static | BindingFlags.Public)); - - //Assert.That(addMethodCall.Method.Name, Is.EqualTo("StaticAdd")); - } - } + [TestFixture] + public class ExpressionTests + { + + public int AddMethod(int a) + { + return a + 4; + } + + [Test] + public void Simple_func_and_equivalent_expression_tests() + { + Func add = x => x + x; + + Assert.That(add(4), Is.EqualTo(4 + 4)); + + Expression> addExpr = x => x + 4; + + Func addFromExpr = addExpr.Compile(); + + Assert.That(addFromExpr(4), Is.EqualTo(add(4))); + + Func addMethod = AddMethod; + + Assert.That(addMethod(4), Is.EqualTo(add(4))); + + Expression> callAddMethodExpr = x => AddMethod(x); + var addMethodCall = (MethodCallExpression)callAddMethodExpr.Body; + Assert.That(addMethodCall.Method.Name, Is.EqualTo("AddMethod")); + } + + [Test] + public void Simple_func_timing_tests() + { + // 1/5 as expensive as expression + var stopWatch = new Stopwatch(); + stopWatch.Start(); + Func add = x => x + x; + + Assert.That(add(4), Is.EqualTo(4 + 4)); + stopWatch.Stop(); + Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); + } + + [Test] + public void Simple_expression_timing_tests() + { + //5 times more expensive than Func + var stopWatch = new Stopwatch(); + stopWatch.Start(); + Expression> addExpr = x => x + 4; + + Func addFromExpr = addExpr.Compile(); + + Assert.That(addFromExpr(4), Is.EqualTo(4 + 4)); + stopWatch.Stop(); + Console.WriteLine("Delegate took: {0}ms", stopWatch.ElapsedMilliseconds); + } + + + public static int StaticAdd(int a) + { + return a + 4; + } + + [Test] + public void MethodCallExpression_to_call_a_static_method() + { + //Expression> callAddMethodExpr = Expression.Lambda>(Expression.Call(null, (MethodInfo) methodof(ExpressionTests.StaticAdd), + //new Expression[] { CS$0$0000 = Expression.Parameter(typeof(int), "x") }), new ParameterExpression[] { CS$0$0000 }); + + Expression> callAddMethodExpr = x => StaticAdd(x); + var addMethodCall = (MethodCallExpression)callAddMethodExpr.Body; + Assert.That(addMethodCall.Method.Name, Is.EqualTo("StaticAdd")); + } + + [Test] + public void Dynamic_MethodCallExpression_to_call_a_static_method() + { + + //MethodCallExpression.Call(Expression.Call(GetType().GetMethod("StaticAdd", BindingFlags.Static | BindingFlags.Public)); + + //Assert.That(addMethodCall.Method.Name, Is.EqualTo("StaticAdd")); + } + } } diff --git a/tests/ServiceStack.Common.Tests/FluentValidation/ErrorCodeTests.cs b/tests/ServiceStack.Common.Tests/FluentValidation/ErrorCodeTests.cs index f14220c991a..b8e6e77fdd6 100644 --- a/tests/ServiceStack.Common.Tests/FluentValidation/ErrorCodeTests.cs +++ b/tests/ServiceStack.Common.Tests/FluentValidation/ErrorCodeTests.cs @@ -54,7 +54,7 @@ public CarValidator() public ValidationResult Result { get; set; } - [TestFixtureSetUp] + [OneTimeSetUp] public void SetUp() { var person = new Person() @@ -120,6 +120,12 @@ public void Length() Assert.IsTrue(Result.Errors.Any(f => f.ErrorCode == ValidationErrors.Length)); } + [Test] + public void LengthContainsPlaceholders() + { + Assert.IsTrue(Result.Errors.Where(f => f.ErrorCode == ValidationErrors.Length).Any(f => f.FormattedMessagePlaceholderValues.ContainsKey("MinLength"))); + } + [Test] public void LessThan() { diff --git a/tests/ServiceStack.Common.Tests/FluentValidation/UserSeverityTests.cs b/tests/ServiceStack.Common.Tests/FluentValidation/UserSeverityTests.cs new file mode 100644 index 00000000000..aeb85738130 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/FluentValidation/UserSeverityTests.cs @@ -0,0 +1,163 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +using Funq; +using ServiceStack.FluentValidation; +using ServiceStack.Testing; +using ServiceStack.Validation; + +namespace ServiceStack.Common.Tests.FluentValidation +{ + namespace ServiceStack.FluentValidation.Tests + { + using System; + using System.Linq; + using NUnit.Framework; + using ServiceStack.FluentValidation; + + public class UserSeverityTests + { + private const string Urlbase = "http://localhost:2001/"; + + [Test] + public void Stores_user_severity_against_validation_failure() + { + var validator = new TestValidator(); + validator.RuleFor(x => x.Lastname).NotNull().WithSeverity(Severity.Info); + var result = validator.Validate(new ErrorCodeTests.Person()); + Assert.AreEqual(Severity.Info, result.Errors.Single().Severity); + } + + [Test] + public void Defaults_user_severity_to_error() + { + var validator = new TestValidator(); + validator.RuleFor(x => x.Lastname).NotNull(); + var result = validator.Validate(new ErrorCodeTests.Person()); + Assert.AreEqual(Severity.Error, result.Errors.Single().Severity); + } + + public class TestValidator : AbstractValidator + { + public TestValidator() + { + } + } + + [Test] + public void Response_returned_when_valid() + { + using (var appHost = new TestAppHost()) + { + appHost.Plugins.Add(new ValidationFeature()); + appHost.Init(); + appHost.Start(Urlbase); + + var sc = new JsonServiceClient(Urlbase); + + var response = sc.Get(new EchoRequest {Day = "Monday", Word = "Word"}); + + Assert.That(response.Day, Is.EqualTo("Monday")); + Assert.That(response.Word, Is.EqualTo("Word")); + } + } + + [Test] + public void Can_treat_warnings_and_info_as_errors() + { + using (var appHost = new TestAppHost()) + { + appHost.Plugins.Add(new ValidationFeature {TreatInfoAndWarningsAsErrors = true}); + appHost.Init(); + appHost.Start(Urlbase); + + var sc = new JsonServiceClient(Urlbase); + + Assert.Throws(() => sc.Get(new EchoRequest {Day = "Monday", Word = ""}), + "'Word' should not be empty."); + } + } + + [Test] + public void Can_return_response_when_no_failed_validations_and_TreatInfoAndWarningsAsErrors_set_false() + { + using (var appHost = new TestAppHost()) + { + appHost.Plugins.Add(new ValidationFeature {TreatInfoAndWarningsAsErrors = false}); + appHost.Init(); + appHost.Start(Urlbase); + + var sc = new JsonServiceClient(Urlbase); + + var resp = sc.Get(new EchoRequest {Day = "Monday", Word = "Word"}); + + Assert.That(resp.ResponseStatus, Is.Null); + } + } + + [Test] + public void Can_ignore_warnings_and_info_as_errors() + { + using (var appHost = new TestAppHost()) + { + appHost.Plugins.Add(new ValidationFeature {TreatInfoAndWarningsAsErrors = false}); + appHost.Init(); + appHost.Start(Urlbase); + + var sc = new JsonServiceClient(Urlbase); + + var response = sc.Get(new EchoRequest {Day = "", Word = ""}); + + Assert.That(response.ResponseStatus, Is.Not.Null); + Assert.That(response.ResponseStatus.Errors, Is.Not.Empty); + Assert.That(response.ResponseStatus.Errors.First().Meta["Severity"], Is.EqualTo("Info")); + Assert.That(response.ResponseStatus.Errors[1].Meta["Severity"], Is.EqualTo("Warning")); + } + } + + internal class TestAppHost : AppSelfHostBase + { + public Action ConfigureContainer { get; set; } + + public TestAppHost() + : base("AppHost for ValidationFeature SeverityTests", typeof(EchoService).Assembly) + { + } + + public override void Configure(Container container) + { + if (ConfigureContainer != null) + this.ConfigureContainer(container); + } + } + } + + public class EchoService : Service + { + public object Any(EchoRequest request) => new EchoResponse {Day = request.Day, Word = request.Word}; + } + + public class EchoRequestValidator : AbstractValidator + { + public EchoRequestValidator() + { + RuleFor(e => e.Word).NotEmpty().WithSeverity(Severity.Info); + RuleFor(e => e.Day).NotEmpty().WithSeverity(Severity.Warning); + } + } + + public class EchoRequest : IReturn + { + public string Word { get; set; } + public string Day { get; set; } + } + + public class EchoResponse : IHasResponseStatus + { + public string Word { get; set; } + public string Day { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/FormatTests.cs b/tests/ServiceStack.Common.Tests/FormatTests.cs index 6df85da4f35..a81ee4b637d 100644 --- a/tests/ServiceStack.Common.Tests/FormatTests.cs +++ b/tests/ServiceStack.Common.Tests/FormatTests.cs @@ -1,11 +1,12 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt - +#if !NETCORE_SUPPORT using System.Runtime.Serialization; using NUnit.Framework; using ServiceStack.MsgPack; using ServiceStack.ProtoBuf; +using ServiceStack.Wire; namespace ServiceStack.Common.Tests { @@ -23,7 +24,7 @@ public class TestModel public class FormatTests { [Test] - public void Can_seraialize_ProtoBuf() + public void Can_serialize_ProtoBuf() { var dto = new TestModel { Id = 1, Name = "Name" }; @@ -36,7 +37,7 @@ public void Can_seraialize_ProtoBuf() } [Test] - public void Can_seraialize_MsgPack() + public void Can_serialize_MsgPack() { var dto = new TestModel { Id = 1, Name = "Name" }; @@ -47,5 +48,19 @@ public void Can_seraialize_MsgPack() Assert.That(fromBytes.Id, Is.EqualTo(dto.Id)); Assert.That(fromBytes.Name, Is.EqualTo(dto.Name)); } + + [Test] + public void Can_serialize_Wire() + { + var dto = new TestModel { Id = 1, Name = "Name" }; + + var bytes = dto.ToWire(); + + var fromBytes = bytes.FromWire(); + + Assert.That(fromBytes.Id, Is.EqualTo(dto.Id)); + Assert.That(fromBytes.Name, Is.EqualTo(dto.Name)); + } } -} \ No newline at end of file +} +#endif diff --git a/tests/ServiceStack.Common.Tests/FunqTests.cs b/tests/ServiceStack.Common.Tests/FunqTests.cs index bad22c64c75..d332e771ebc 100644 --- a/tests/ServiceStack.Common.Tests/FunqTests.cs +++ b/tests/ServiceStack.Common.Tests/FunqTests.cs @@ -29,6 +29,6 @@ public void Test2() container.AutoWire(m); Assert.Throws(() => container.Resolve()); Assert.IsNull(m.Bar); // FAILS HERE - } + } } -} \ No newline at end of file +} diff --git a/tests/ServiceStack.Common.Tests/IocExtensions.cs b/tests/ServiceStack.Common.Tests/IocExtensions.cs new file mode 100644 index 00000000000..1f23cb7c363 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/IocExtensions.cs @@ -0,0 +1,24 @@ +using ServiceStack.Web; + +namespace ServiceStack.Common.Tests +{ + public static class IocExtensions + { + public static void InjectRequestIntoDependencies(this object instance, IRequest req) + { + foreach (var pi in instance.GetType().GetPublicProperties()) + { + var mi = pi.GetGetMethod(); + if (mi == null) + continue; + + var dep = mi.Invoke(instance, new object[0]); + if (dep is IRequiresRequest requiresRequest) + { + requiresRequest.Request = req; + requiresRequest.InjectRequestIntoDependencies(req); + } + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/ManageRolesTests.cs b/tests/ServiceStack.Common.Tests/ManageRolesTests.cs index 31ae6e7873e..ab9f671b6bf 100644 --- a/tests/ServiceStack.Common.Tests/ManageRolesTests.cs +++ b/tests/ServiceStack.Common.Tests/ManageRolesTests.cs @@ -1,7 +1,10 @@ -using System; +#if !NETCORE_SUPPORT +using System; using System.Collections.Generic; +using Amazon.DynamoDBv2; using NUnit.Framework; using ServiceStack.Auth; +using ServiceStack.Aws.DynamoDb; using ServiceStack.Configuration; using ServiceStack.Data; using ServiceStack.Host; @@ -35,9 +38,15 @@ public void By_default_assigned_roles_are_saved_in_UserAuth_table() { using (var appHost = new BasicAppHost { + ConfigureAppHost = host => + { + host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new []{ new BasicAuthProvider() }) + { + IncludeRegistrationService = true, + }); + }, ConfigureContainer = container => { - container.Register(c => new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); @@ -51,8 +60,10 @@ public void By_default_assigned_roles_are_saved_in_UserAuth_table() using (var db = appHost.Container.Resolve().Open()) { var register = CreateNewUserRegistration(); - var req = new BasicRequest(register); - req.QueryString["authSecret"] = appHost.Config.AdminAuthSecret = "allow"; + var req = new BasicRequest(register) + { + QueryString = { ["authSecret"] = appHost.Config.AdminAuthSecret = "allow" } + }; var response = (RegisterResponse)appHost.ExecuteService(register, req); var userAuth = db.SingleById(response.UserId); @@ -89,6 +100,13 @@ public void Can_assign_roles_that_persist_to_UserAuthRole_table() { using (var appHost = new BasicAppHost { + ConfigureAppHost = host => + { + host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new[] { new BasicAuthProvider() }) + { + IncludeRegistrationService = true, + }); + }, ConfigureContainer = container => { container.Register(c => @@ -140,5 +158,67 @@ public void Can_assign_roles_that_persist_to_UserAuthRole_table() } } } + + [Test] + public void Can_assign_roles_that_persist_to_UserAuthRole_table_in_DynamoDb() + { + using (var appHost = new BasicAppHost + { + ConfigureAppHost = host => + { + host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new[] { new BasicAuthProvider() }) + { + IncludeRegistrationService = true, + }); + }, + ConfigureContainer = container => + { + container.Register(c => new PocoDynamo(TestsConfig.CreateDynamoDBClient())); + //DynamoMetadata.Reset(); + container.Resolve().DeleteAllTables(TimeSpan.FromMinutes(1)); + + container.Register(c => new DynamoDbAuthRepository(c.Resolve())); + container.Resolve().InitSchema(); + } + }.Init()) + { + var db = appHost.Container.Resolve(); + + var register = CreateNewUserRegistration(); + var req = new BasicRequest(register); + req.QueryString["authSecret"] = appHost.Config.AdminAuthSecret = "allow"; + + var response = (RegisterResponse)appHost.ExecuteService(register, req); + var userAuth = db.GetItem(response.UserId); + + var assignResponse = (AssignRolesResponse)appHost.ExecuteService(new AssignRoles + { + UserName = userAuth.UserName, + Roles = { "TestRole" }, + Permissions = { "TestPermission" }, + }, req); + Assert.That(assignResponse.AllRoles[0], Is.EqualTo("TestRole")); + Assert.That(assignResponse.AllPermissions[0], Is.EqualTo("TestPermission")); + + Assert.That(userAuth.Roles.Count, Is.EqualTo(0)); + Assert.That(userAuth.Permissions.Count, Is.EqualTo(0)); + + var manageRoles = (IManageRoles)appHost.Container.Resolve(); + Assert.That(manageRoles.HasRole(userAuth.Id.ToString(), "TestRole")); + Assert.That(manageRoles.HasPermission(userAuth.Id.ToString(), "TestPermission")); + + appHost.ExecuteService(new UnAssignRoles + { + UserName = userAuth.UserName, + Roles = { "TestRole" }, + Permissions = { "TestPermission" }, + }, req); + + Assert.That(!manageRoles.HasRole(userAuth.Id.ToString(), "TestRole")); + Assert.That(!manageRoles.HasPermission(userAuth.Id.ToString(), "TestPermission")); + } + } + } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Messaging/MqServerAppHostTests.cs b/tests/ServiceStack.Common.Tests/Messaging/MqServerAppHostTests.cs index 71097e223cf..1c985134982 100644 --- a/tests/ServiceStack.Common.Tests/Messaging/MqServerAppHostTests.cs +++ b/tests/ServiceStack.Common.Tests/Messaging/MqServerAppHostTests.cs @@ -1,7 +1,10 @@ -using System; +#if !NETCORE_SUPPORT +using System; +using System.Collections.Generic; using System.Threading.Tasks; using Funq; using NUnit.Framework; +using ServiceStack.Auth; using ServiceStack.FluentValidation; using ServiceStack.Messaging; using ServiceStack.Messaging.Redis; @@ -9,10 +12,11 @@ using ServiceStack.Redis; using ServiceStack.Text; using ServiceStack.Validation; +using ServiceStack.Web; namespace ServiceStack.Common.Tests.Messaging { - [TestFixture] + [TestFixture, Ignore("Can cause CI to hang")] public class RedisMqServerAppHostTests : MqServerAppHostTests { public RedisMqServerAppHostTests() @@ -27,7 +31,7 @@ public override IMessageService CreateMqServer(int retryCount = 1) } } - [TestFixture] + [TestFixture, Ignore("Can cause CI to hang")] public class RabbitMqServerAppHostTests : MqServerAppHostTests { public RabbitMqServerAppHostTests() @@ -43,12 +47,15 @@ public RabbitMqServerAppHostTests() channel.PurgeQueue(); channel.PurgeQueue(); channel.PurgeQueue(); + channel.PurgeQueue(); } } public override IMessageService CreateMqServer(int retryCount = 1) { - return new RabbitMqServer { RetryCount = 1 }; + return new RabbitMqServer(TestsConfig.RabbitMqHost) { + RetryCount = 1 + }; } } @@ -61,6 +68,15 @@ public override IMessageService CreateMqServer(int retryCount = 1) } } + [TestFixture] + public class BackgroundMqServerAppHostTests : MqServerAppHostTests + { + public override IMessageService CreateMqServer(int retryCount = 1) + { + return new BackgroundMqService { RetryCount = retryCount }; + } + } + public class AnyTestMq { @@ -114,6 +130,11 @@ public ValidateTestMqValidator() } } + public class ThrowVoid + { + public string Content { get; set; } + } + public class TestMqService : IService { public object Any(AnyTestMq request) @@ -123,8 +144,8 @@ public object Any(AnyTestMq request) public async Task Any(AnyTestMqAsync request) { - return await Task.Factory.StartNew(() => - new AnyTestMqResponse {CorrelationId = request.Id}); + return await Task.Factory.StartNew(() => + new AnyTestMqResponse { CorrelationId = request.Id }); } public object Post(PostTestMq request) @@ -141,9 +162,14 @@ public object Post(ThrowGenericError request) { throw new ArgumentException("request"); } + + public void Any(ThrowVoid request) + { + throw new InvalidOperationException("this is an invalid operation"); + } } - public class MqTestsAppHost : AppHostHttpListenerBase + public class MqTestsAppHost : AppSelfHostBase { private readonly Func createMqServerFn; @@ -161,29 +187,29 @@ public override void Configure(Container container) container.Register(c => createMqServerFn()); var mqServer = container.Resolve(); - mqServer.RegisterHandler(ServiceController.ExecuteMessage); - mqServer.RegisterHandler(msg - => ServiceController.ExecuteMessage(msg)); - mqServer.RegisterHandler(ServiceController.ExecuteMessage); - mqServer.RegisterHandler(ServiceController.ExecuteMessage); - mqServer.RegisterHandler(ServiceController.ExecuteMessage); - - mqServer.Start(); + mqServer.RegisterHandler(ExecuteMessage); + mqServer.RegisterHandler(ExecuteMessage); + mqServer.RegisterHandler(ExecuteMessage); + mqServer.RegisterHandler(ExecuteMessage); + mqServer.RegisterHandler(ExecuteMessage); + mqServer.RegisterHandler(ExecuteMessage); + + AfterInitCallbacks.Add(appHost => mqServer.Start()); } } - + [TestFixture] public abstract class MqServerAppHostTests { - protected const string ListeningOn = "http://*:1337/"; - public const string Host = "http://localhost:1337"; + protected const string ListeningOn = "http://*:2001/"; + public const string Host = "http://localhost:2001"; private const string BaseUri = Host + "/"; protected ServiceStackHost appHost; public abstract IMessageService CreateMqServer(int retryCount = 1); - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new MqTestsAppHost(() => CreateMqServer()) @@ -191,12 +217,32 @@ public void TestFixtureSetUp() .Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public virtual void TestFixtureTearDown() { appHost.Dispose(); } + [Test] + public void Does_send_to_DLQ_when_thrown_from_void_Service() + { + using (var mqFactory = appHost.TryResolve()) + { + var request = new ThrowVoid { Content = "Test" }; + + using (var mqProducer = mqFactory.CreateMessageProducer()) + using (var mqClient = mqFactory.CreateMessageQueueClient()) + { + mqProducer.Publish(request); + + var msg = mqClient.Get(QueueNames.Dlq, null); + mqClient.Ack(msg); + + Assert.That(msg.Error.ErrorCode, Is.EqualTo("InvalidOperationException")); + } + } + } + [Test] public void Can_Publish_to_AnyTestMq_Service() { @@ -303,7 +349,6 @@ public void Does_execute_validation_filters() var errorMsg = mqClient.Get(QueueNames.Dlq, null); mqClient.Ack(errorMsg); - errorMsg.GetBody().PrintDump(); Assert.That(errorMsg.Error.ErrorCode, Is.EqualTo("PositiveIntegersOnly")); request = new ValidateTestMq { Id = 10 }; @@ -330,7 +375,6 @@ public void Does_handle_generic_errors() var msg = mqClient.Get(QueueNames.Dlq, null); mqClient.Ack(msg); - msg.PrintDump(); Assert.That(msg.Error.ErrorCode, Is.EqualTo("ArgumentException")); } } @@ -355,7 +399,6 @@ public void Does_execute_ReplyTo_validation_filters() var errorMsg = mqClient.Get(requestMsg.ReplyTo, null); mqClient.Ack(errorMsg); - errorMsg.GetBody().PrintDump(); Assert.That(errorMsg.GetBody().ResponseStatus.ErrorCode, Is.EqualTo("PositiveIntegersOnly")); request = new ValidateTestMq { Id = 10 }; @@ -383,17 +426,17 @@ public void Does_handle_ReplyTo_generic_errors() { var requestMsg = new Message(request) { - ReplyTo = "mq:{0}.replyto".Fmt(request.GetType().Name) + ReplyTo = $"mq:{request.GetType().Name}.replyto" }; mqProducer.Publish(requestMsg); var msg = mqClient.Get(requestMsg.ReplyTo, null); mqClient.Ack(msg); - msg.PrintDump(); Assert.That(msg.GetBody().ResponseStatus.ErrorCode, Is.EqualTo("ArgumentException")); } } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Messaging/RabbitMqTests.cs b/tests/ServiceStack.Common.Tests/Messaging/RabbitMqTests.cs index 11f209a8916..df009b0788f 100644 --- a/tests/ServiceStack.Common.Tests/Messaging/RabbitMqTests.cs +++ b/tests/ServiceStack.Common.Tests/Messaging/RabbitMqTests.cs @@ -1,4 +1,5 @@ -using System; +#if !NETCORE_SUPPORT +using System; using System.Collections.Generic; using System.IO; using System.Threading; @@ -16,16 +17,18 @@ public class HelloRabbit public string Name { get; set; } } - [TestFixture, Explicit] + [TestFixture, Ignore("Integration Test")] public class RabbitMqTests { - private readonly ConnectionFactory mqFactory = new ConnectionFactory { HostName = "localhost" }; + private readonly ConnectionFactory mqFactory = new ConnectionFactory { + HostName = TestsConfig.RabbitMqHost + }; private const string Exchange = "mq:tests"; private const string ExchangeDlq = "mq:tests.dlq"; private const string ExchangeTopic = "mq:tests.topic"; private const string ExchangeFanout = "mq:tests.fanout"; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { using (IConnection connection = mqFactory.CreateConnection()) @@ -85,10 +88,11 @@ public void Can_publish_messages_to_RabbitMQ() using (IConnection connection = mqFactory.CreateConnection()) using (IModel channel = connection.CreateModel()) { - 5.Times(i => { + 5.Times(i => + { byte[] payload = new HelloRabbit { Name = "World! #{0}".Fmt(i) }.ToJson().ToUtf8Bytes(); var props = channel.CreateBasicProperties(); - props.SetPersistent(true); + props.Persistent = true; channel.BasicPublish(exchange: Exchange, routingKey: QueueNames.In, basicProperties: props, body: payload); @@ -109,7 +113,7 @@ public void Can_consume_messages_from_RabbitMQ_with_BasicGet() while (true) { - var basicGetMsg = channel.BasicGet(QueueNames.In, noAck: false); + var basicGetMsg = channel.BasicGet(QueueNames.In, autoAck: false); if (basicGetMsg == null) { @@ -119,8 +123,6 @@ public void Can_consume_messages_from_RabbitMQ_with_BasicGet() var msg = basicGetMsg.Body.FromUtf8Bytes().FromJson(); - msg.PrintDump(); - Thread.Sleep(1000); channel.BasicAck(basicGetMsg.DeliveryTag, multiple: false); @@ -135,10 +137,11 @@ public void Can_consume_messages_from_RabbitMQ_with_BasicConsume() using (IModel channel = connection.CreateModel()) { var consumer = new QueueingBasicConsumer(channel); - var consumerTag = channel.BasicConsume(QueueNames.In, noAck: false, consumer: consumer); + var consumerTag = channel.BasicConsume(QueueNames.In, autoAck: false, consumer: consumer); string recvMsg = null; - ThreadPool.QueueUserWorkItem(_ => { + ThreadPool.QueueUserWorkItem(_ => + { Thread.Sleep(100); PublishHelloRabbit(channel); }); @@ -158,7 +161,7 @@ public void Can_consume_messages_from_RabbitMQ_with_BasicConsume() channel.BasicAck(e.DeliveryTag, multiple: false); break; } - catch (OperationInterruptedException ex) + catch (OperationInterruptedException) { // The consumer was removed, either through // channel or connection closure, or through the @@ -167,7 +170,7 @@ public void Can_consume_messages_from_RabbitMQ_with_BasicConsume() break; } } - + Assert.That(recvMsg, Is.Not.Null); } } @@ -180,19 +183,19 @@ public void Publishing_message_with_routingKey_sends_only_to_registered_queue() { PublishHelloRabbit(channel); - var basicGetMsg = channel.BasicGet(QueueNames.In, noAck: true); + var basicGetMsg = channel.BasicGet(QueueNames.In, autoAck: true); Assert.That(basicGetMsg, Is.Not.Null); - basicGetMsg = channel.BasicGet(QueueNames.Priority, noAck: true); + basicGetMsg = channel.BasicGet(QueueNames.Priority, autoAck: true); Assert.That(basicGetMsg, Is.Null); } } private static void PublishHelloRabbit(IModel channel, string text = "World!") { - byte[] payload = new HelloRabbit {Name = text}.ToJson().ToUtf8Bytes(); + byte[] payload = new HelloRabbit { Name = text }.ToJson().ToUtf8Bytes(); var props = channel.CreateBasicProperties(); - props.SetPersistent(true); + props.Persistent = true; channel.BasicPublish(Exchange, QueueNames.In, props, payload); } @@ -209,14 +212,14 @@ public void Publishing_message_to_fanout_exchange_publishes_to_all_queues() byte[] payload = new HelloRabbit { Name = "World!" }.ToJson().ToUtf8Bytes(); var props = channel.CreateBasicProperties(); - props.SetPersistent(true); + props.Persistent = true; channel.BasicPublish(ExchangeFanout, QueueNames.In, props, payload); - var basicGetMsg = channel.BasicGet(QueueNames.In, noAck: true); + var basicGetMsg = channel.BasicGet(QueueNames.In, autoAck: true); Assert.That(basicGetMsg, Is.Not.Null); - basicGetMsg = channel.BasicGet(QueueNames.Priority, noAck: true); + basicGetMsg = channel.BasicGet(QueueNames.Priority, autoAck: true); Assert.That(basicGetMsg, Is.Not.Null); } } @@ -229,23 +232,23 @@ public void Does_publish_to_dead_letter_exchange() { PublishHelloRabbit(channel); - var basicGetMsg = channel.BasicGet(QueueNames.In, noAck: true); - var dlqBasicMsg = channel.BasicGet(QueueNames.Dlq, noAck: true); + var basicGetMsg = channel.BasicGet(QueueNames.In, autoAck: true); + var dlqBasicMsg = channel.BasicGet(QueueNames.Dlq, autoAck: true); Assert.That(basicGetMsg, Is.Not.Null); Assert.That(dlqBasicMsg, Is.Null); PublishHelloRabbit(channel); - basicGetMsg = channel.BasicGet(QueueNames.In, noAck: false); + basicGetMsg = channel.BasicGet(QueueNames.In, autoAck: false); Thread.Sleep(500); - dlqBasicMsg = channel.BasicGet(QueueNames.Dlq, noAck: false); + dlqBasicMsg = channel.BasicGet(QueueNames.Dlq, autoAck: false); Assert.That(basicGetMsg, Is.Not.Null); Assert.That(dlqBasicMsg, Is.Null); channel.BasicNack(basicGetMsg.DeliveryTag, multiple: false, requeue: false); Thread.Sleep(500); - dlqBasicMsg = channel.BasicGet(QueueNames.Dlq, noAck: true); + dlqBasicMsg = channel.BasicGet(QueueNames.Dlq, autoAck: true); Assert.That(dlqBasicMsg, Is.Not.Null); } } @@ -259,11 +262,12 @@ public void Can_interrupt_BasicConsumer_in_bgthread_by_closing_channel() string recvMsg = null; EndOfStreamException lastEx = null; - var bgThread = new Thread(() => { + var bgThread = new Thread(() => + { try { var consumer = new QueueingBasicConsumer(channel); - channel.BasicConsume(QueueNames.In, noAck: false, consumer: consumer); + channel.BasicConsume(QueueNames.In, autoAck: false, consumer: consumer); while (true) { @@ -288,7 +292,7 @@ public void Can_interrupt_BasicConsumer_in_bgthread_by_closing_channel() } catch (Exception ex) { - "Exception in bgthread: {0}: {1}".Print(ex.GetType().Name,ex.Message); + "Exception in bgthread: {0}: {1}".Print(ex.GetType().Name, ex.Message); } }) { @@ -323,7 +327,8 @@ public void Can_consume_messages_with_BasicConsumer() channel.Close(); - ThreadPool.QueueUserWorkItem(_ => { + ThreadPool.QueueUserWorkItem(_ => + { try { PublishHelloRabbit(channel); @@ -332,7 +337,7 @@ public void Can_consume_messages_with_BasicConsumer() { lastEx = ex as OperationInterruptedException; "Caught {0}: {1}".Print(ex.GetType().Name, ex); - } + } }); Thread.Sleep(1000); @@ -388,4 +393,5 @@ public class Reverse { } public class Rot13 { } public class Wait { } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/MessagingTests.cs b/tests/ServiceStack.Common.Tests/MessagingTests.cs index c188c372363..2d17b332d88 100644 --- a/tests/ServiceStack.Common.Tests/MessagingTests.cs +++ b/tests/ServiceStack.Common.Tests/MessagingTests.cs @@ -1,61 +1,63 @@ -using NUnit.Framework; +#if !NETCORE_SUPPORT +using NUnit.Framework; using ServiceStack.Auth; using ServiceStack.Messaging; using ServiceStack.Text; namespace ServiceStack.Common.Tests { - public class Incr - { - public int Value { get; set; } - } + public class Incr + { + public int Value { get; set; } + } public class TestUserSession : AuthUserSession { } - [TestFixture] - public class MessagingTests - { - [Test] - public void Can_serialize_IMessage_into_typed_Message() - { - var dto = new Incr { Value = 1 }; - IMessage iMsg = MessageFactory.Create(dto); - var json = iMsg.ToJson(); - var typedMessage = json.FromJson>(); - - Assert.That(typedMessage.GetBody().Value, Is.EqualTo(dto.Value)); - } - - [Test] - public void Can_serialize_object_IMessage_into_typed_Message() - { - var dto = new Incr { Value = 1 }; - var iMsg = MessageFactory.Create(dto); - var json = ((object)iMsg).ToJson(); - var typedMessage = json.FromJson>(); - - Assert.That(typedMessage.GetBody().Value, Is.EqualTo(dto.Value)); - } - - [Test] - public void Can_serialize_IMessage_ToBytes_into_typed_Message() - { - var dto = new Incr { Value = 1 }; - var iMsg = MessageFactory.Create(dto); - var bytes = iMsg.ToBytes(); - var typedMessage = bytes.ToMessage(); - - Assert.That(typedMessage.GetBody().Value, Is.EqualTo(dto.Value)); - } - - [Test] - public void Can_deserialize_concrete_type_into_IOAuthSession() - { + [TestFixture] + public class MessagingTests + { + [Test] + public void Can_serialize_IMessage_into_typed_Message() + { + var dto = new Incr { Value = 1 }; + IMessage iMsg = MessageFactory.Create(dto); + var json = iMsg.ToJson(); + var typedMessage = json.FromJson>(); + + Assert.That(typedMessage.GetBody().Value, Is.EqualTo(dto.Value)); + } + + [Test] + public void Can_serialize_object_IMessage_into_typed_Message() + { + var dto = new Incr { Value = 1 }; + var iMsg = MessageFactory.Create(dto); + var json = ((object)iMsg).ToJson(); + var typedMessage = json.FromJson>(); + + Assert.That(typedMessage.GetBody().Value, Is.EqualTo(dto.Value)); + } + + [Test] + public void Can_serialize_IMessage_ToBytes_into_typed_Message() + { + var dto = new Incr { Value = 1 }; + var iMsg = MessageFactory.Create(dto); + var bytes = iMsg.ToBytes(); + var typedMessage = bytes.ToMessage(); + + Assert.That(typedMessage.GetBody().Value, Is.EqualTo(dto.Value)); + } + + [Test] + public void Can_deserialize_concrete_type_into_IOAuthSession() + { var json = "{\"__type\":\"ServiceStack.Common.Tests.TestUserSession, ServiceStack.Common.Tests\",\"ReferrerUrl\":\"http://localhost:4629/oauth\",\"Id\":\"0412cc4654484111b2e7162a24a83753\",\"RequestToken\":\"dw4U1RUBr8r5Bx1oBZfdmNiocsMrAtBmSoFHYCZrr4\",\"RequestTokenSecret\":\"HNvCiD1a61CrutnxZoiJXQlLKNN1GAtWn7pRuafYN0\",\"CreatedAt\":\"\\/Date(1320221243138+0000)\\/\",\"LastModified\":\"\\/Date(1320221243138+0000)\\/\",\"Items\":{}}"; - var fromJson = json.FromJson(); - Assert.That(fromJson, Is.Not.Null); - } - } -} \ No newline at end of file + var fromJson = json.FromJson(); + Assert.That(fromJson, Is.Not.Null); + } + } +} +#endif diff --git a/tests/ServiceStack.Common.Tests/MockRestGatewayTests.cs b/tests/ServiceStack.Common.Tests/MockRestGatewayTests.cs index e23cb5f2223..8c0cf943af3 100644 --- a/tests/ServiceStack.Common.Tests/MockRestGatewayTests.cs +++ b/tests/ServiceStack.Common.Tests/MockRestGatewayTests.cs @@ -1,7 +1,7 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt - +#if !NETCORE_SUPPORT using NUnit.Framework; using ServiceStack.Testing; @@ -64,4 +64,5 @@ public class TestPostResponse public int Id { get; set; } public string Verb { get; set; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/BuiltInsFactory.cs b/tests/ServiceStack.Common.Tests/Models/BuiltInsFactory.cs index 72ed31cb266..4731b2170fb 100644 --- a/tests/ServiceStack.Common.Tests/Models/BuiltInsFactory.cs +++ b/tests/ServiceStack.Common.Tests/Models/BuiltInsFactory.cs @@ -3,52 +3,52 @@ namespace ServiceStack.Common.Tests.Models { - public class BuiltInsFactory - : ModelFactoryBase - { - readonly string[] StringValues = new[] { - "one", "two", "three", "four", - "five", "six", "seven" - }; + public class BuiltInsFactory + : ModelFactoryBase + { + readonly string[] StringValues = new[] { + "one", "two", "three", "four", + "five", "six", "seven" + }; - public override void AssertIsEqual(string actual, string expected) - { - Assert.That(actual, Is.EqualTo(expected)); - } + public override void AssertIsEqual(string actual, string expected) + { + Assert.That(actual, Is.EqualTo(expected)); + } - public override string CreateInstance(int i) - { - return i < StringValues.Length - ? StringValues[i] - : i.ToString(); - } - } + public override string CreateInstance(int i) + { + return i < StringValues.Length + ? StringValues[i] + : i.ToString(); + } + } - public class IntFactory - : ModelFactoryBase - { - public override void AssertIsEqual(int actual, int expected) - { - Assert.That(actual, Is.EqualTo(expected)); - } + public class IntFactory + : ModelFactoryBase + { + public override void AssertIsEqual(int actual, int expected) + { + Assert.That(actual, Is.EqualTo(expected)); + } - public override int CreateInstance(int i) - { - return i; - } - } + public override int CreateInstance(int i) + { + return i; + } + } - public class DateTimeFactory - : ModelFactoryBase - { - public override void AssertIsEqual(DateTime actual, DateTime expected) - { - Assert.That(actual, Is.EqualTo(expected)); - } + public class DateTimeFactory + : ModelFactoryBase + { + public override void AssertIsEqual(DateTime actual, DateTime expected) + { + Assert.That(actual, Is.EqualTo(expected)); + } - public override DateTime CreateInstance(int i) - { - return new DateTime(i, DateTimeKind.Utc); - } - } + public override DateTime CreateInstance(int i) + { + return new DateTime(i, DateTimeKind.Utc); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/DdnContentIngest.cs b/tests/ServiceStack.Common.Tests/Models/DdnContentIngest.cs index 42530c20bd3..d4526665013 100644 --- a/tests/ServiceStack.Common.Tests/Models/DdnContentIngest.cs +++ b/tests/ServiceStack.Common.Tests/Models/DdnContentIngest.cs @@ -6,1113 +6,1110 @@ namespace ServiceStack.Common.Tests.Models { - public interface IExternal - { - string ExternalUrn { get; set; } - } - - public interface IExternalDeletable : IExternal - { - bool Delete { get; set; } - } - - public interface IContent : IExternal - { - Guid Id { get; set; } - string Urn { get; set; } - - DateTime CreatedDate { get; set; } - DateTime ModifiedDate { get; set; } - } - - public interface IContentDeletable : IContent - { - DateTime? DeletedDate { get; set; } - } - - public class MergeList - { - public bool Partial { get; set; } - public List Items { get; set; } - - public MergeList() - { - } - - public MergeList(IEnumerable items) - { - this.Items = new List(items); - } - - public override string ToString() - { - return String.Format("{0} {1} {2}s", this.Partial ? "Partial" : "Full", this.Items.NullableCount(), typeof(T).Name); - } - } - - public class CostPoint - { - public string Campaign { get; set; } - public DateTime StartDate { get; set; } - public string CostCode { get; set; } - } - - public enum ExplicitType - { - Unknown, - NotExplicit, - Explicit, - Cleaned - } - - public enum ReleaseType - { - Single, - Album, - Ep, - BoxedSet - } - - public class Batch - { - public Guid Id { get; set; } - public string Name { get; set; } - public string Path { get; set; } - public string SupplierKeyName { get; set; } - public string SupplierName { get; set; } - public string DeliveryKeyName { get; set; } - public long SequenceNumber { get; set; } - - public override string ToString() - { - return String.Format("{0} {1}", this.SupplierKeyName, this.Name); - } - } - - public class Participant - { - public string Name { get; set; } - public string Role { get; set; } - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } - - public override string ToString() - { - return String.Format("{0} {1}", this.Name, this.Role); - } - } - - public class ArtistUpdate : IExternal - { - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } - - public string SupplierKeyName { get; set; } - public string Name { get; set; } - - public DateTime? BirthDate { get; set; } - public string BirthPlace { get; set; } - - public DateTime? DeathDate { get; set; } - public string DeathPlace { get; set; } - - public string DecadesActive { get; set; } - - public string Biography { get; set; } - public string BiographyAuthor { get; set; } - - public List AssetIds { get; set; } - - public override string ToString() - { - return String.Format("{0} {1}", this.Name, this.ExternalRef); - } - } - - public class AssetUpdate : IExternal - { - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } - - public string SupplierKeyName { get; set; } - - public AssetType AssetType { get; set; } - - public string ExternalOwnerUrn { get; set; } - - public string FileName { get; set; } - public string FileExtension { get; set; } - public long FileSizeBytes { get; set; } - - public string MasterSha256Checksum { get; set; } - public string Md5Checksum { get; set; } - - public int? DurationMs { get; set; } - public int? BitRateKbps { get; set; } - - public int? Width { get; set; } - public int? Height { get; set; } - - public string TranscodedAssetPath { get; set; } - - public string BuildExternalRef() - { - switch (this.AssetType) - { - case AssetType.MasterCoverArt: - case AssetType.MasterArtistArt: - case AssetType.MasterLabelArt: - { - return String.Format("{0}/{1}", this.AssetType, this.MasterSha256Checksum).ToLower(); - } - case AssetType.TrackProduct: - case AssetType.TrackPreview: - { - var externalOwnerRef = Urn.Parse(this.ExternalOwnerUrn).IdValue; - return String.Format("{0}/{1}/{2}/{3}/{4}/{5}", this.AssetType, this.MasterSha256Checksum, externalOwnerRef, this.FileExtension.ToLower(), this.BitRateKbps ?? 0, this.DurationMs ?? 0).ToLower(); - } - default: - { - var message = String.Format("AssetType not supported: {0}-{1}-{2}", AssetType, FileExtension.ToLower(), MasterSha256Checksum); - throw new Exception(message); - } - } - } - - public AssetId CreateAssetId() - { - return new AssetId { AssetType = this.AssetType, ExternalUrn = this.ExternalUrn }; - } - - public override string ToString() - { - return this.ExternalRef; - } - } - - public class LabelUpdate : IExternal - { - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } - - public string SupplierKeyName { get; set; } - public string Name { get; set; } - - public DateTime? EstablishedDate { get; set; } - - public string Biography { get; set; } - public string BiographyAuthor { get; set; } - - public List AssetIds { get; set; } - - public List GetImageAssetIds() - { - return AssetIds.Where(x => x.AssetType.IsImage()).ToList(); - } - - public override string ToString() - { - return String.Format("{0} {1}", this.Name, this.ExternalRef); - } - } - - public class ProductUpdate - { - public bool Delete { get; set; } - - public string TerritoryCode { get; set; } - public string Copyright { get; set; } - public string ReportRef { get; set; } - - public bool AllowDownload { get; set; } - public bool AllowStreaming { get; set; } - public bool AllowSubscription { get; set; } - - public bool CollectionOnly { get; set; } - - public DateTime? DownloadStartDate { get; set; } - public DateTime? DownloadEndDate { get; set; } + public interface IExternal + { + string ExternalUrn { get; set; } + } + + public interface IExternalDeletable : IExternal + { + bool Delete { get; set; } + } + + public interface IContent : IExternal + { + Guid Id { get; set; } + string Urn { get; set; } + + DateTime CreatedDate { get; set; } + DateTime ModifiedDate { get; set; } + } + + public interface IContentDeletable : IContent + { + DateTime? DeletedDate { get; set; } + } + + public class MergeList + { + public bool Partial { get; set; } + public List Items { get; set; } + + public MergeList() + { + } + + public MergeList(IEnumerable items) + { + this.Items = new List(items); + } + + public override string ToString() + { + return String.Format("{0} {1} {2}s", this.Partial ? "Partial" : "Full", this.Items.NullableCount(), typeof(T).Name); + } + } + + public class CostPoint + { + public string Campaign { get; set; } + public DateTime StartDate { get; set; } + public string CostCode { get; set; } + } + + public enum ExplicitType + { + Unknown, + NotExplicit, + Explicit, + Cleaned + } + + public enum ReleaseType + { + Single, + Album, + Ep, + BoxedSet + } + + public class Batch + { + public Guid Id { get; set; } + public string Name { get; set; } + public string Path { get; set; } + public string SupplierKeyName { get; set; } + public string SupplierName { get; set; } + public string DeliveryKeyName { get; set; } + public long SequenceNumber { get; set; } + + public override string ToString() + { + return String.Format("{0} {1}", this.SupplierKeyName, this.Name); + } + } + + public class Participant + { + public string Name { get; set; } + public string Role { get; set; } + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } + + public override string ToString() + { + return String.Format("{0} {1}", this.Name, this.Role); + } + } + + public class ArtistUpdate : IExternal + { + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } + + public string SupplierKeyName { get; set; } + public string Name { get; set; } + + public DateTime? BirthDate { get; set; } + public string BirthPlace { get; set; } + + public DateTime? DeathDate { get; set; } + public string DeathPlace { get; set; } + + public string DecadesActive { get; set; } + + public string Biography { get; set; } + public string BiographyAuthor { get; set; } + + public List AssetIds { get; set; } + + public override string ToString() + { + return String.Format("{0} {1}", this.Name, this.ExternalRef); + } + } + + public class AssetUpdate : IExternal + { + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } + + public string SupplierKeyName { get; set; } + + public AssetType AssetType { get; set; } + + public string ExternalOwnerUrn { get; set; } + + public string FileName { get; set; } + public string FileExtension { get; set; } + public long FileSizeBytes { get; set; } + + public string MasterSha256Checksum { get; set; } + public string Md5Checksum { get; set; } + + public int? DurationMs { get; set; } + public int? BitRateKbps { get; set; } + + public int? Width { get; set; } + public int? Height { get; set; } + + public string TranscodedAssetPath { get; set; } + + public string BuildExternalRef() + { + switch (this.AssetType) + { + case AssetType.MasterCoverArt: + case AssetType.MasterArtistArt: + case AssetType.MasterLabelArt: + { + return String.Format("{0}/{1}", this.AssetType, this.MasterSha256Checksum).ToLower(); + } + case AssetType.TrackProduct: + case AssetType.TrackPreview: + { + var externalOwnerRef = Urn.Parse(this.ExternalOwnerUrn).IdValue; + return String.Format("{0}/{1}/{2}/{3}/{4}/{5}", this.AssetType, this.MasterSha256Checksum, externalOwnerRef, this.FileExtension.ToLower(), this.BitRateKbps ?? 0, this.DurationMs ?? 0).ToLower(); + } + default: + { + var message = String.Format("AssetType not supported: {0}-{1}-{2}", AssetType, FileExtension.ToLower(), MasterSha256Checksum); + throw new Exception(message); + } + } + } + + public AssetId CreateAssetId() + { + return new AssetId { AssetType = this.AssetType, ExternalUrn = this.ExternalUrn }; + } + + public override string ToString() + { + return this.ExternalRef; + } + } + + public class LabelUpdate : IExternal + { + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } + + public string SupplierKeyName { get; set; } + public string Name { get; set; } + + public DateTime? EstablishedDate { get; set; } + + public string Biography { get; set; } + public string BiographyAuthor { get; set; } + + public List AssetIds { get; set; } + + public List GetImageAssetIds() + { + return AssetIds.Where(x => x.AssetType.IsImage()).ToList(); + } + + public override string ToString() + { + return String.Format("{0} {1}", this.Name, this.ExternalRef); + } + } + + public class ProductUpdate + { + public bool Delete { get; set; } + + public string TerritoryCode { get; set; } + public string Copyright { get; set; } + public string ReportRef { get; set; } + + public bool AllowDownload { get; set; } + public bool AllowStreaming { get; set; } + public bool AllowSubscription { get; set; } + + public bool CollectionOnly { get; set; } + + public DateTime? DownloadStartDate { get; set; } + public DateTime? DownloadEndDate { get; set; } - public List CostPoints { get; set; } + public List CostPoints { get; set; } - public DateTime? StreamingStartDate { get; set; } - public DateTime? StreamingEndDate { get; set; } + public DateTime? StreamingStartDate { get; set; } + public DateTime? StreamingEndDate { get; set; } - public override string ToString() - { - return this.TerritoryCode; - } - } - - public class ReleaseChangeSet - { - public Guid BatchId { get; set; } - public string BatchName { get; set; } - public long BatchSequence { get; set; } - public string BatchPath { get; set; } - - public bool Partial { get; set; } - - public ReleaseUpdate Release { get; set; } - - public List Labels { get; set; } - public List Artists { get; set; } - public List Tracks { get; set; } - public List Assets { get; set; } - - public void UpdateBatchInfo(Batch batch) - { - this.BatchId = batch.Id; - this.BatchName = batch.Name; - this.BatchSequence = batch.SequenceNumber; - this.BatchPath = batch.Path; - } - - public override string ToString() - { - return String.Format("{0} {1} {2}", this.Release.ExternalUrn, this.BatchName, this.Partial ? "Partial" : "Full"); - } - } + public override string ToString() + { + return this.TerritoryCode; + } + } + + public class ReleaseChangeSet + { + public Guid BatchId { get; set; } + public string BatchName { get; set; } + public long BatchSequence { get; set; } + public string BatchPath { get; set; } + + public bool Partial { get; set; } + + public ReleaseUpdate Release { get; set; } + + public List Labels { get; set; } + public List Artists { get; set; } + public List Tracks { get; set; } + public List Assets { get; set; } + + public void UpdateBatchInfo(Batch batch) + { + this.BatchId = batch.Id; + this.BatchName = batch.Name; + this.BatchSequence = batch.SequenceNumber; + this.BatchPath = batch.Path; + } + + public override string ToString() + { + return String.Format("{0} {1} {2}", this.Release.ExternalUrn, this.BatchName, this.Partial ? "Partial" : "Full"); + } + } - public static class ReleaseChangeSetSerializer - { - public static string Serialize(ReleaseChangeSet changeSet) - { - return TypeSerializer.SerializeToString(changeSet); - } + public static class ReleaseChangeSetSerializer + { + public static string Serialize(ReleaseChangeSet changeSet) + { + return TypeSerializer.SerializeToString(changeSet); + } - public static ReleaseChangeSet Deserialize(string changeSetString) - { - return TypeSerializer.DeserializeFromString(changeSetString); - } - } + public static ReleaseChangeSet Deserialize(string changeSetString) + { + return TypeSerializer.DeserializeFromString(changeSetString); + } + } - public class TrackUpdate : IExternalDeletable - { - public bool Delete { get; set; } + public class TrackUpdate : IExternalDeletable + { + public bool Delete { get; set; } - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } - public string SupplierKeyName { get; set; } - public string Name { get; set; } + public string SupplierKeyName { get; set; } + public string Name { get; set; } - public string NameExVersion { get; set; } - public string NameVersion { get; set; } + public string NameExVersion { get; set; } + public string NameVersion { get; set; } - public string LabelText { get; set; } - public string ArtistText { get; set; } - public string ReleaseText { get; set; } + public string LabelText { get; set; } + public string ArtistText { get; set; } + public string ReleaseText { get; set; } - public string Isrc { get; set; } - public string GlobalReleaseId { get; set; } + public string Isrc { get; set; } + public string GlobalReleaseId { get; set; } - public int? SetNumber { get; set; } - public int? DiscNumber { get; set; } - public int? TrackNumber { get; set; } - public int? SequenceNumber { get; set; } + public int? SetNumber { get; set; } + public int? DiscNumber { get; set; } + public int? TrackNumber { get; set; } + public int? SequenceNumber { get; set; } - public int? DurationMs { get; set; } + public int? DurationMs { get; set; } - public ExplicitType ExplicitType { get; set; } + public ExplicitType ExplicitType { get; set; } - public string RightsHolder { get; set; } - public string Copyright { get; set; } + public string RightsHolder { get; set; } + public string Copyright { get; set; } - public List Publishers { get; set; } + public List Publishers { get; set; } - public List Genres { get; set; } - public List SubGenres { get; set; } + public List Genres { get; set; } + public List SubGenres { get; set; } - public string Review { get; set; } - public string ReviewAuthor { get; set; } + public string Review { get; set; } + public string ReviewAuthor { get; set; } - public string Lyrics { get; set; } + public string Lyrics { get; set; } - public List Participants { get; set; } + public List Participants { get; set; } - public string ExternalLabelUrn { get; set; } - public string ExternalReleaseUrn { get; set; } + public string ExternalLabelUrn { get; set; } + public string ExternalReleaseUrn { get; set; } - public MergeList ExternalArtistUrns { get; set; } - public MergeList Products { get; set; } + public MergeList ExternalArtistUrns { get; set; } + public MergeList Products { get; set; } - public List AssetIds { get; set; } + public List AssetIds { get; set; } - public void AddAssetIds(IEnumerable assetIds) - { - if (assetIds == null || !assetIds.Any()) - { - return; - } + public void AddAssetIds(IEnumerable assetIds) + { + if (assetIds == null || !assetIds.Any()) + { + return; + } - if (this.AssetIds == null) - { - this.AssetIds = new List(); - } + if (this.AssetIds == null) + { + this.AssetIds = new List(); + } - this.AssetIds.AddRange(assetIds); - } + this.AssetIds.AddRange(assetIds); + } - public List GetImageAssetIds() - { - return this.AssetIds.SafeWhere(x => x.AssetType.IsImage()).ToList(); - } + public List GetImageAssetIds() + { + return this.AssetIds.SafeWhere(x => x.AssetType.IsImage()).ToList(); + } - public List GetAudioAssetIds() - { - return this.AssetIds.SafeWhere(x => x.AssetType.IsAudio()).ToList(); - } + public List GetAudioAssetIds() + { + return this.AssetIds.SafeWhere(x => x.AssetType.IsAudio()).ToList(); + } - public override string ToString() - { - return String.Format("{0} {1}", this.Name, this.ExternalRef); - } - } + public override string ToString() + { + return String.Format("{0} {1}", this.Name, this.ExternalRef); + } + } - public class ReleaseUpdate : IExternalDeletable - { - public const string WorldTerritoryCode = "ZZ"; + public class ReleaseUpdate : IExternalDeletable + { + public const string WorldTerritoryCode = "ZZ"; - public bool Delete { get; set; } + public bool Delete { get; set; } - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } - public string SupplierKeyName { get; set; } - public string Name { get; set; } + public string SupplierKeyName { get; set; } + public string Name { get; set; } - public string NameExVersion { get; set; } - public string NameVersion { get; set; } + public string NameExVersion { get; set; } + public string NameVersion { get; set; } - public ReleaseType ReleaseType { get; set; } + public ReleaseType ReleaseType { get; set; } - public string LabelText { get; set; } - public string ArtistText { get; set; } + public string LabelText { get; set; } + public string ArtistText { get; set; } - public string UpcEan { get; set; } - public string GlobalReleaseId { get; set; } - public string CatalogueNumber { get; set; } + public string UpcEan { get; set; } + public string GlobalReleaseId { get; set; } + public string CatalogueNumber { get; set; } - public int? SetCount { get; set; } - public int? DiscCount { get; set; } - public int? TrackCount { get; set; } + public int? SetCount { get; set; } + public int? DiscCount { get; set; } + public int? TrackCount { get; set; } - public int? DurationMs { get; set; } - public bool ContinuousMix { get; set; } + public int? DurationMs { get; set; } + public bool ContinuousMix { get; set; } - public ExplicitType ExplicitType { get; set; } + public ExplicitType ExplicitType { get; set; } - public DateTime? ReleaseDate { get; set; } + public DateTime? ReleaseDate { get; set; } - public string RightsHolder { get; set; } - public string Copyright { get; set; } + public string RightsHolder { get; set; } + public string Copyright { get; set; } - public List Genres { get; set; } - public List SubGenres { get; set; } + public List Genres { get; set; } + public List SubGenres { get; set; } - public string Review { get; set; } - public string ReviewAuthor { get; set; } + public string Review { get; set; } + public string ReviewAuthor { get; set; } - public List Participants { get; set; } + public List Participants { get; set; } - public string ExternalLabelUrn { get; set; } + public string ExternalLabelUrn { get; set; } - public MergeList ExternalArtistUrns { get; set; } - public MergeList ExternalTrackUrns { get; set; } - public MergeList Products { get; set; } + public MergeList ExternalArtistUrns { get; set; } + public MergeList ExternalTrackUrns { get; set; } + public MergeList Products { get; set; } - public List AssetIds { get; set; } + public List AssetIds { get; set; } - public void AddAssetIds(IEnumerable assetIds) - { - if (assetIds == null || !assetIds.Any()) - { - return; - } + public void AddAssetIds(IEnumerable assetIds) + { + if (assetIds == null || !assetIds.Any()) + { + return; + } - if (this.AssetIds == null) - { - this.AssetIds = new List(); - } + if (this.AssetIds == null) + { + this.AssetIds = new List(); + } - this.AssetIds.AddRange(assetIds); - } + this.AssetIds.AddRange(assetIds); + } - public List GetImageAssetIds() - { - return this.AssetIds.SafeWhere(x => x.AssetType.IsImage()).ToList(); - } + public List GetImageAssetIds() + { + return this.AssetIds.SafeWhere(x => x.AssetType.IsImage()).ToList(); + } - public List GetAudioAssetIds() - { - return this.AssetIds.SafeWhere(x => x.AssetType.IsAudio()).ToList(); - } + public List GetAudioAssetIds() + { + return this.AssetIds.SafeWhere(x => x.AssetType.IsAudio()).ToList(); + } - public override string ToString() - { - return String.Format("{0} {1}", this.Name, this.ExternalRef); - } - } + public override string ToString() + { + return String.Format("{0} {1}", this.Name, this.ExternalRef); + } + } - public class AssetId - { - public AssetType AssetType { get; set; } - public string ExternalUrn { get; set; } + public class AssetId + { + public AssetType AssetType { get; set; } + public string ExternalUrn { get; set; } - public override string ToString() - { - return this.ExternalUrn; - } - } + public override string ToString() + { + return this.ExternalUrn; + } + } - public class Artist : IContent - { - public Guid Id { get; set; } - public string Urn { get; set; } + public class Artist : IContent + { + public Guid Id { get; set; } + public string Urn { get; set; } - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } - public string SupplierKeyName { get; set; } - public string Name { get; set; } + public string SupplierKeyName { get; set; } + public string Name { get; set; } - public DateTime? BirthDate { get; set; } - public string BirthPlace { get; set; } + public DateTime? BirthDate { get; set; } + public string BirthPlace { get; set; } - public DateTime? DeathDate { get; set; } - public string DeathPlace { get; set; } + public DateTime? DeathDate { get; set; } + public string DeathPlace { get; set; } - public string DecadesActive { get; set; } + public string DecadesActive { get; set; } - public string Biography { get; set; } - public string BiographyAuthor { get; set; } + public string Biography { get; set; } + public string BiographyAuthor { get; set; } - public List Assets { get; set; } + public List Assets { get; set; } - public DateTime CreatedDate { get; set; } - public DateTime ModifiedDate { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime ModifiedDate { get; set; } - public List GetImageAssets() - { - return this.Assets.Where(x => x.AssetType.IsImage()).ToList(); - } + public List GetImageAssets() + { + return this.Assets.Where(x => x.AssetType.IsImage()).ToList(); + } - public override string ToString() - { - return String.Format("{0} {1}", this.Name, this.Id.ToString("N")); - } - } + public override string ToString() + { + return String.Format("{0} {1}", this.Name, this.Id.ToString("N")); + } + } - public class Asset : IContent - { - public Guid Id { get; set; } - public string Urn { get; set; } + public class Asset : IContent + { + public Guid Id { get; set; } + public string Urn { get; set; } - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } - public string SupplierKeyName { get; set; } + public string SupplierKeyName { get; set; } - public AssetType AssetType { get; set; } + public AssetType AssetType { get; set; } - public string ExternalOwnerUrn { get; set; } + public string ExternalOwnerUrn { get; set; } - public string FileName { get; set; } - public string FileExtension { get; set; } - public long FileSizeBytes { get; set; } + public string FileName { get; set; } + public string FileExtension { get; set; } + public long FileSizeBytes { get; set; } - public string MasterSha256Checksum { get; set; } - public string Md5Checksum { get; set; } + public string MasterSha256Checksum { get; set; } + public string Md5Checksum { get; set; } - public int? DurationMs { get; set; } - public int? BitRateKbps { get; set; } + public int? DurationMs { get; set; } + public int? BitRateKbps { get; set; } - public int? Width { get; set; } - public int? Height { get; set; } + public int? Width { get; set; } + public int? Height { get; set; } - public string TranscodedAssetPath { get; set; } - public string RepositoryAssetPath { get; set; } + public string TranscodedAssetPath { get; set; } + public string RepositoryAssetPath { get; set; } - public DateTime CreatedDate { get; set; } - public DateTime ModifiedDate { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime ModifiedDate { get; set; } - public override string ToString() - { - return String.Format("{0} {1}", this.ExternalRef, this.Id.ToString("N")); - } - } + public override string ToString() => $"{ExternalRef} {Id:N}"; + } - public class Label : IContent - { - public Guid Id { get; set; } - public string Urn { get; set; } + public class Label : IContent + { + public Guid Id { get; set; } + public string Urn { get; set; } - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } - public string SupplierKeyName { get; set; } - public string Name { get; set; } + public string SupplierKeyName { get; set; } + public string Name { get; set; } - public DateTime? EstablishedDate { get; set; } + public DateTime? EstablishedDate { get; set; } - public string Biography { get; set; } - public string BiographyAuthor { get; set; } + public string Biography { get; set; } + public string BiographyAuthor { get; set; } - public List Assets { get; set; } + public List Assets { get; set; } - public DateTime CreatedDate { get; set; } - public DateTime ModifiedDate { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime ModifiedDate { get; set; } - public List GetImageAssets() - { - return this.Assets.Where(x => x.AssetType.IsImage()).ToList(); - } + public List GetImageAssets() + { + return this.Assets.Where(x => x.AssetType.IsImage()).ToList(); + } - public override string ToString() - { - return String.Format("{0} {1}", this.Name, this.Id.ToString("N")); - } - } + public override string ToString() + { + return String.Format("{0} {1}", this.Name, this.Id.ToString("N")); + } + } - public class Product - { - public string TerritoryCode { get; set; } - public string Copyright { get; set; } - public string ReportRef { get; set; } + public class Product + { + public string TerritoryCode { get; set; } + public string Copyright { get; set; } + public string ReportRef { get; set; } - public bool AllowDownload { get; set; } - public bool AllowStreaming { get; set; } - public bool AllowSubscription { get; set; } + public bool AllowDownload { get; set; } + public bool AllowStreaming { get; set; } + public bool AllowSubscription { get; set; } - public bool CollectionOnly { get; set; } + public bool CollectionOnly { get; set; } - public DateTime? DownloadStartDate { get; set; } - public DateTime? DownloadEndDate { get; set; } + public DateTime? DownloadStartDate { get; set; } + public DateTime? DownloadEndDate { get; set; } - public List CostPoints { get; set; } + public List CostPoints { get; set; } - public DateTime? StreamingStartDate { get; set; } - public DateTime? StreamingEndDate { get; set; } + public DateTime? StreamingStartDate { get; set; } + public DateTime? StreamingEndDate { get; set; } - public override string ToString() - { - return this.TerritoryCode; - } - } + public override string ToString() + { + return this.TerritoryCode; + } + } - public class Release : IContent - { - public const string WorldTerritoryCode = "ZZ"; + public class Release : IContent + { + public const string WorldTerritoryCode = "ZZ"; - public Guid Id { get; set; } - public string Urn { get; set; } + public Guid Id { get; set; } + public string Urn { get; set; } - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } - public string SupplierKeyName { get; set; } - public string Name { get; set; } + public string SupplierKeyName { get; set; } + public string Name { get; set; } - public string NameExVersion { get; set; } - public string NameVersion { get; set; } + public string NameExVersion { get; set; } + public string NameVersion { get; set; } - public ReleaseType ReleaseType { get; set; } + public ReleaseType ReleaseType { get; set; } - public string LabelText { get; set; } - public string ArtistText { get; set; } + public string LabelText { get; set; } + public string ArtistText { get; set; } - public string UpcEan { get; set; } - public string GlobalReleaseId { get; set; } - public string CatalogueNumber { get; set; } + public string UpcEan { get; set; } + public string GlobalReleaseId { get; set; } + public string CatalogueNumber { get; set; } - public int SetCount { get; set; } - public int DiscCount { get; set; } - public int TrackCount { get; set; } + public int SetCount { get; set; } + public int DiscCount { get; set; } + public int TrackCount { get; set; } - public int? DurationMs { get; set; } - public bool ContinuousMix { get; set; } + public int? DurationMs { get; set; } + public bool ContinuousMix { get; set; } - public ExplicitType ExplicitType { get; set; } + public ExplicitType ExplicitType { get; set; } - public DateTime? ReleaseDate { get; set; } + public DateTime? ReleaseDate { get; set; } - public string RightsHolder { get; set; } - public string Copyright { get; set; } + public string RightsHolder { get; set; } + public string Copyright { get; set; } - public List Genres { get; set; } - public List SubGenres { get; set; } + public List Genres { get; set; } + public List SubGenres { get; set; } - public string Review { get; set; } - public string ReviewAuthor { get; set; } + public string Review { get; set; } + public string ReviewAuthor { get; set; } - public List Participants { get; set; } + public List Participants { get; set; } - public Label Label { get; set; } - public List Artists { get; set; } - public List Tracks { get; set; } - public List Products { get; set; } - public List Assets { get; set; } + public Label Label { get; set; } + public List Artists { get; set; } + public List Tracks { get; set; } + public List Products { get; set; } + public List Assets { get; set; } - public DateTime CreatedDate { get; set; } - public DateTime ModifiedDate { get; set; } - public DateTime? DeletedDate { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime ModifiedDate { get; set; } + public DateTime? DeletedDate { get; set; } - public string GetPrimaryGenre() - { - return this.Genres.IsNullOrEmpty() ? null : this.Genres[0]; - } + public string GetPrimaryGenre() + { + return this.Genres.IsNullOrEmpty() ? null : this.Genres[0]; + } - public Artist GetPrimaryArtist() - { - return this.Artists.IsNullOrEmpty() ? null : this.Artists[0]; - } + public Artist GetPrimaryArtist() + { + return this.Artists.IsNullOrEmpty() ? null : this.Artists[0]; + } - public List GetImageAssets() - { - return this.Assets.Where(x => x.AssetType.IsImage()).ToList(); - } + public List GetImageAssets() + { + return this.Assets.Where(x => x.AssetType.IsImage()).ToList(); + } - public List GetAudioAssets() - { - return this.Assets.Where(x => x.AssetType.IsAudio()).ToList(); - } + public List GetAudioAssets() + { + return this.Assets.Where(x => x.AssetType.IsAudio()).ToList(); + } - public List GetActiveTracks() - { - return this.Tracks.SafeWhere(x => !x.CollectionOrphan).ToList(); - } + public List GetActiveTracks() + { + return this.Tracks.SafeWhere(x => !x.CollectionOrphan).ToList(); + } - public List GetOrphanTracks() - { - return this.Tracks.SafeWhere(x => x.CollectionOrphan).ToList(); - } + public List GetOrphanTracks() + { + return this.Tracks.SafeWhere(x => x.CollectionOrphan).ToList(); + } - public Product GetProduct(string territoryCode) - { - if (this.Products.IsNullOrEmpty()) - { - return null; - } + public Product GetProduct(string territoryCode) + { + if (this.Products.IsNullOrEmpty()) + { + return null; + } - var product = this.Products.FirstOrDefault(x => x.TerritoryCode.EqualsIgnoreCase(territoryCode)); - if (product == null) - { - // Default to the world product if exists - product = this.Products.FirstOrDefault(x => x.TerritoryCode.EqualsIgnoreCase(WorldTerritoryCode)); - } + var product = this.Products.FirstOrDefault(x => x.TerritoryCode.EqualsIgnoreCase(territoryCode)); + if (product == null) + { + // Default to the world product if exists + product = this.Products.FirstOrDefault(x => x.TerritoryCode.EqualsIgnoreCase(WorldTerritoryCode)); + } - return product; - } + return product; + } - public string GetDescription() - { - return String.Format("{0} by {1}", this.Name, this.ArtistText); - } + public string GetDescription() + { + return String.Format("{0} by {1}", this.Name, this.ArtistText); + } - public override string ToString() - { - return String.Format("{0} {1}", this.Name, this.Id.ToString("N")); - } - } + public override string ToString() + { + return String.Format("{0} {1}", this.Name, this.Id.ToString("N")); + } + } - public class Track : IContentDeletable - { - public Guid Id { get; set; } - public string Urn { get; set; } + public class Track : IContentDeletable + { + public Guid Id { get; set; } + public string Urn { get; set; } - public string ExternalRef { get; set; } - public string ExternalUrn { get; set; } - - public string SupplierKeyName { get; set; } - public string Name { get; set; } - - public string NameExVersion { get; set; } - public string NameVersion { get; set; } - - public string LabelText { get; set; } - public string ArtistText { get; set; } - public string ReleaseText { get; set; } - - public string Isrc { get; set; } - public string GlobalReleaseId { get; set; } - - public bool CollectionOrphan { get; set; } - - public int SetNumber { get; set; } - public int DiscNumber { get; set; } - public int TrackNumber { get; set; } - public int SequenceNumber { get; set; } - - public int? DurationMs { get; set; } - - public ExplicitType ExplicitType { get; set; } - - public string RightsHolder { get; set; } - public string Copyright { get; set; } - - public List Publishers { get; set; } - - public List Genres { get; set; } - public List SubGenres { get; set; } - - public string Review { get; set; } - public string ReviewAuthor { get; set; } - - public string Lyrics { get; set; } - - public List Participants { get; set; } - - public Label Label { get; set; } - public Release Release { get; set; } - public List Artists { get; set; } - public List Products { get; set; } - public List Assets { get; set; } - - public DateTime CreatedDate { get; set; } - public DateTime ModifiedDate { get; set; } - public DateTime? DeletedDate { get; set; } - - public string GetPrimaryGenre() - { - return this.Genres.IsNullOrEmpty() ? null : this.Genres[0]; - } - - public Artist GetPrimaryArtist() - { - return this.Artists.IsNullOrEmpty() ? null : this.Artists[0]; - } - - public List GetImageAssetIds() - { - return this.Assets.Where(x => x.AssetType.IsImage()).ToList(); - } - - public List GetAudioAssetIds() - { - return this.Assets.Where(x => x.AssetType.IsAudio()).ToList(); - } - - public Product GetProduct(string territoryCode) - { - if (this.Products.IsNullOrEmpty()) - { - return null; - } - - var product = this.Products.FirstOrDefault(x => x.TerritoryCode.EqualsIgnoreCase(territoryCode)); - if (product == null) - { - // Default to the world product if exists - product = this.Products.FirstOrDefault(x => x.TerritoryCode.EqualsIgnoreCase(Release.WorldTerritoryCode)); - } - - return product; - } - - public string GetDescription() - { - return String.Format("{0} {1} ({2}) by {3}", this.SequenceNumber, this.Name, this.ReleaseText, this.ArtistText); - } - - public override string ToString() - { - return String.Format("{0} {1}", this.Name, this.Id.ToString("N")); - } - } - - public enum AssetType - { - None, - MasterCoverArt, - MasterArtistArt, - MasterLabelArt, - ResizedCoverArt, - ResizedArtistArt, - ResizedLabelArt, - TrackProduct, - TrackPreview, - } - - public static class AssetTypeExtensions - { - public static bool IsAudio(this AssetType assetType) - { - return assetType == AssetType.TrackProduct || assetType == AssetType.TrackPreview; - } - - public static bool IsMasterImage(this AssetType assetType) - { - return assetType == AssetType.MasterCoverArt || assetType == AssetType.MasterArtistArt || assetType == AssetType.MasterLabelArt; - } - - public static bool IsResizedImage(this AssetType assetType) - { - return assetType == AssetType.ResizedCoverArt || assetType == AssetType.ResizedArtistArt || assetType == AssetType.ResizedLabelArt; - } - - public static bool IsImage(this AssetType assetType) - { - switch (assetType) - { - case AssetType.MasterCoverArt: - case AssetType.MasterArtistArt: - case AssetType.MasterLabelArt: - case AssetType.ResizedCoverArt: - case AssetType.ResizedArtistArt: - case AssetType.ResizedLabelArt: - return true; - default: - return false; - } - } - - public static AssetType GetMasterType(this AssetType assetType) - { - switch (assetType) - { - case AssetType.ResizedCoverArt: - return AssetType.MasterCoverArt; - case AssetType.ResizedArtistArt: - return AssetType.MasterArtistArt; - case AssetType.ResizedLabelArt: - return AssetType.MasterLabelArt; - default: - return assetType; - } - } - - public static AssetType GetResizedType(this AssetType assetType) - { - switch (assetType) - { - case AssetType.MasterCoverArt: - return AssetType.ResizedCoverArt; - case AssetType.MasterArtistArt: - return AssetType.ResizedArtistArt; - case AssetType.MasterLabelArt: - return AssetType.ResizedLabelArt; - default: - return assetType; - } - } - } - - public struct Urn - { - private const char IdValueSeperator = '/'; - private readonly string urnString; - - public string ResourceName - { - get; - private set; - } - - public string IdTypeName - { - get; - private set; - } - - public string IdValue - { - get; - private set; - } - - public string[] IdValues - { - get - { - return IdValue.Split(IdValueSeperator); - } - } - - public Urn(string resourceName, string idTypeName, string idValue) - : this() - { - if (resourceName == null) - { - throw new ArgumentNullException("resourceName"); - } - - if (idValue == null) - { - throw new ArgumentNullException("idValue"); - } - - this.ResourceName = resourceName.ToLower(); - this.IdTypeName = !String.IsNullOrEmpty(idTypeName) ? idTypeName.ToLower() : null; - this.IdValue = idValue; - - if (String.IsNullOrEmpty(this.IdTypeName)) - { - this.urnString = string.Format("urn:{0}:{1}", this.ResourceName, this.IdValue); - } - else - { - this.urnString = string.Format("urn:{0}:{1}:{2}", this.ResourceName, this.IdTypeName, this.IdValue); - } - } - - public Urn(string resourceName, string idValue) - : this(resourceName, null, idValue) - { - } - - public bool IsDefaultIdType() - { - return String.IsNullOrEmpty(IdTypeName); - } - - public bool IsResourceType(string resourceName) - { - return string.Compare(this.ResourceName, resourceName, true) == 0; - } - - public bool IsIdType(Type type) - { - return this.IsIdType(type.Name); - } - - public bool IsIdType(string idTypeName) - { - return string.Compare(this.IdTypeName, idTypeName, true) == 0; - } - - public override int GetHashCode() - { - return this.urnString.GetHashCode(); - } - - public bool Equals(Urn obj) - { - return String.CompareOrdinal(obj.urnString, this.urnString) == 0; - } - - public override bool Equals(object obj) - { - return obj.GetType() == typeof(Urn) && Equals(obj); - } - - public override string ToString() - { - return urnString; - } - - // Operators overloading - - public static implicit operator string(Urn urn) - { - return urn.urnString; - } - - public static bool operator ==(Urn urn1, Urn urn2) - { - return urn1.Equals(urn2); - } - - public static bool operator !=(Urn urn1, Urn urn2) - { - return !urn1.Equals(urn2); - } - - // Parsing - - public static bool IsValidUrn(string urnString) - { - var fields = urnString.Split(':'); - return (fields.Length == 3 || fields.Length == 4) && String.CompareOrdinal(fields[0], "urn") == 0; - } - - public static bool TryParse(string urnString, out Urn urn) - { - var fields = urnString.Split(':'); - - if ((fields.Length == 3 || fields.Length == 4) && String.CompareOrdinal(fields[0], "urn") == 0) - { - if (fields.Length == 4) - { - urn = new Urn(fields[1], fields[2], fields[3]); - } - else - { - urn = new Urn(fields[1], fields[2]); - } - - return true; - } - - urn = new Urn(); - return false; - } - - public static Urn Parse(string urnText) - { - if (String.IsNullOrEmpty(urnText)) - { - throw new ArgumentNullException("urnText"); - } - - var fields = urnText.Split(':'); - if ((fields.Length == 3 || fields.Length == 4) && String.CompareOrdinal(fields[0], "urn") == 0) - { - return fields.Length == 4 ? new Urn(fields[1], fields[2], fields[3]) : new Urn(fields[1], fields[2]); - } - - var msg = string.Format("Invalid URN text '{0}'", urnText); - throw new FormatException(msg); - } - - public static string GetUrnType(string urnString) - { - var urn = Parse(urnString); - return urn.ResourceName; - } - - public static long GetLongId(string urnString) - { - var urn = Parse(urnString); - return Convert.ToInt64(urn.IdValue); - } - - public static Guid GetGuidId(string urnString) - { - var urn = Parse(urnString); - return new Guid(urn.IdValue); - } - - public static string[] GetIdValues(string urnString) - { - var urn = Parse(urnString); - return urn.IdValues; - } - - public static string GetIdValue(string urnString) - { - var urn = Parse(urnString); - return urn.IdValue; - } - - public static string CleanIdValue(string idValue) - { - return idValue.Trim().ToLowerInvariant().Replace(' ', '_'); - } - - public static string GetFirstIdValue(string urnString) - { - var urn = Parse(urnString); - return urn.IdValue.Split('/')[0]; - } - - public static string GetSecondIdValue(string urnString) - { - var urn = Parse(urnString); - var parts = urn.IdValue.Split('/'); - return parts.Length > 1 ? parts[1] : null; - } - } + public string ExternalRef { get; set; } + public string ExternalUrn { get; set; } + + public string SupplierKeyName { get; set; } + public string Name { get; set; } + + public string NameExVersion { get; set; } + public string NameVersion { get; set; } + + public string LabelText { get; set; } + public string ArtistText { get; set; } + public string ReleaseText { get; set; } + + public string Isrc { get; set; } + public string GlobalReleaseId { get; set; } + + public bool CollectionOrphan { get; set; } + + public int SetNumber { get; set; } + public int DiscNumber { get; set; } + public int TrackNumber { get; set; } + public int SequenceNumber { get; set; } + + public int? DurationMs { get; set; } + + public ExplicitType ExplicitType { get; set; } + + public string RightsHolder { get; set; } + public string Copyright { get; set; } + + public List Publishers { get; set; } + + public List Genres { get; set; } + public List SubGenres { get; set; } + + public string Review { get; set; } + public string ReviewAuthor { get; set; } + + public string Lyrics { get; set; } + + public List Participants { get; set; } + + public Label Label { get; set; } + public Release Release { get; set; } + public List Artists { get; set; } + public List Products { get; set; } + public List Assets { get; set; } + + public DateTime CreatedDate { get; set; } + public DateTime ModifiedDate { get; set; } + public DateTime? DeletedDate { get; set; } + + public string GetPrimaryGenre() + { + return this.Genres.IsNullOrEmpty() ? null : this.Genres[0]; + } + + public Artist GetPrimaryArtist() + { + return this.Artists.IsNullOrEmpty() ? null : this.Artists[0]; + } + + public List GetImageAssetIds() + { + return this.Assets.Where(x => x.AssetType.IsImage()).ToList(); + } + + public List GetAudioAssetIds() + { + return this.Assets.Where(x => x.AssetType.IsAudio()).ToList(); + } + + public Product GetProduct(string territoryCode) + { + if (this.Products.IsNullOrEmpty()) + { + return null; + } + + var product = this.Products.FirstOrDefault(x => x.TerritoryCode.EqualsIgnoreCase(territoryCode)); + if (product == null) + { + // Default to the world product if exists + product = this.Products.FirstOrDefault(x => x.TerritoryCode.EqualsIgnoreCase(Release.WorldTerritoryCode)); + } + + return product; + } + + public string GetDescription() + { + return String.Format("{0} {1} ({2}) by {3}", this.SequenceNumber, this.Name, this.ReleaseText, this.ArtistText); + } + + public override string ToString() + { + return String.Format("{0} {1}", this.Name, this.Id.ToString("N")); + } + } + + public enum AssetType + { + None, + MasterCoverArt, + MasterArtistArt, + MasterLabelArt, + ResizedCoverArt, + ResizedArtistArt, + ResizedLabelArt, + TrackProduct, + TrackPreview, + } + + public static class AssetTypeExtensions + { + public static bool IsAudio(this AssetType assetType) + { + return assetType == AssetType.TrackProduct || assetType == AssetType.TrackPreview; + } + + public static bool IsMasterImage(this AssetType assetType) + { + return assetType == AssetType.MasterCoverArt || assetType == AssetType.MasterArtistArt || assetType == AssetType.MasterLabelArt; + } + + public static bool IsResizedImage(this AssetType assetType) + { + return assetType == AssetType.ResizedCoverArt || assetType == AssetType.ResizedArtistArt || assetType == AssetType.ResizedLabelArt; + } + + public static bool IsImage(this AssetType assetType) + { + switch (assetType) + { + case AssetType.MasterCoverArt: + case AssetType.MasterArtistArt: + case AssetType.MasterLabelArt: + case AssetType.ResizedCoverArt: + case AssetType.ResizedArtistArt: + case AssetType.ResizedLabelArt: + return true; + default: + return false; + } + } + + public static AssetType GetMasterType(this AssetType assetType) + { + switch (assetType) + { + case AssetType.ResizedCoverArt: + return AssetType.MasterCoverArt; + case AssetType.ResizedArtistArt: + return AssetType.MasterArtistArt; + case AssetType.ResizedLabelArt: + return AssetType.MasterLabelArt; + default: + return assetType; + } + } + + public static AssetType GetResizedType(this AssetType assetType) + { + switch (assetType) + { + case AssetType.MasterCoverArt: + return AssetType.ResizedCoverArt; + case AssetType.MasterArtistArt: + return AssetType.ResizedArtistArt; + case AssetType.MasterLabelArt: + return AssetType.ResizedLabelArt; + default: + return assetType; + } + } + } + + public struct Urn + { + private const char IdValueSeperator = '/'; + private readonly string urnString; + + public string ResourceName + { + get; + private set; + } + + public string IdTypeName + { + get; + private set; + } + + public string IdValue + { + get; + private set; + } + + public string[] IdValues + { + get + { + return IdValue.Split(IdValueSeperator); + } + } + + public Urn(string resourceName, string idTypeName, string idValue) + : this() + { + if (resourceName == null) + { + throw new ArgumentNullException("resourceName"); + } + + if (idValue == null) + { + throw new ArgumentNullException("idValue"); + } + + this.ResourceName = resourceName.ToLower(); + this.IdTypeName = !String.IsNullOrEmpty(idTypeName) ? idTypeName.ToLower() : null; + this.IdValue = idValue; + + if (String.IsNullOrEmpty(this.IdTypeName)) + { + this.urnString = string.Format("urn:{0}:{1}", this.ResourceName, this.IdValue); + } + else + { + this.urnString = string.Format("urn:{0}:{1}:{2}", this.ResourceName, this.IdTypeName, this.IdValue); + } + } + + public Urn(string resourceName, string idValue) + : this(resourceName, null, idValue) + { + } + + public bool IsDefaultIdType() + { + return String.IsNullOrEmpty(IdTypeName); + } + + public bool IsResourceType(string resourceName) + { + return string.Compare(this.ResourceName, resourceName, true) == 0; + } + + public bool IsIdType(Type type) + { + return this.IsIdType(type.Name); + } + + public bool IsIdType(string idTypeName) + { + return string.Compare(this.IdTypeName, idTypeName, true) == 0; + } + + public override int GetHashCode() + { + return this.urnString.GetHashCode(); + } + + public bool Equals(Urn obj) + { + return String.CompareOrdinal(obj.urnString, this.urnString) == 0; + } + + public override bool Equals(object obj) + { + return obj.GetType() == typeof(Urn) && Equals(obj); + } + + public override string ToString() + { + return urnString; + } + + // Operators overloading + + public static implicit operator string(Urn urn) + { + return urn.urnString; + } + + public static bool operator ==(Urn urn1, Urn urn2) + { + return urn1.Equals(urn2); + } + + public static bool operator !=(Urn urn1, Urn urn2) + { + return !urn1.Equals(urn2); + } + + // Parsing + + public static bool IsValidUrn(string urnString) + { + var fields = urnString.Split(':'); + return (fields.Length == 3 || fields.Length == 4) && String.CompareOrdinal(fields[0], "urn") == 0; + } + + public static bool TryParse(string urnString, out Urn urn) + { + var fields = urnString.Split(':'); + + if ((fields.Length == 3 || fields.Length == 4) && String.CompareOrdinal(fields[0], "urn") == 0) + { + if (fields.Length == 4) + { + urn = new Urn(fields[1], fields[2], fields[3]); + } + else + { + urn = new Urn(fields[1], fields[2]); + } + + return true; + } + + urn = new Urn(); + return false; + } + + public static Urn Parse(string urnText) + { + if (String.IsNullOrEmpty(urnText)) + { + throw new ArgumentNullException("urnText"); + } + + var fields = urnText.Split(':'); + if ((fields.Length == 3 || fields.Length == 4) && String.CompareOrdinal(fields[0], "urn") == 0) + { + return fields.Length == 4 ? new Urn(fields[1], fields[2], fields[3]) : new Urn(fields[1], fields[2]); + } + + var msg = string.Format("Invalid URN text '{0}'", urnText); + throw new FormatException(msg); + } + + public static string GetUrnType(string urnString) + { + var urn = Parse(urnString); + return urn.ResourceName; + } + + public static long GetLongId(string urnString) + { + var urn = Parse(urnString); + return Convert.ToInt64(urn.IdValue); + } + + public static Guid GetGuidId(string urnString) + { + var urn = Parse(urnString); + return new Guid(urn.IdValue); + } + + public static string[] GetIdValues(string urnString) + { + var urn = Parse(urnString); + return urn.IdValues; + } + + public static string GetIdValue(string urnString) + { + var urn = Parse(urnString); + return urn.IdValue; + } + + public static string CleanIdValue(string idValue) + { + return idValue.Trim().ToLowerInvariant().Replace(' ', '_'); + } + + public static string GetFirstIdValue(string urnString) + { + var urn = Parse(urnString); + return urn.IdValue.Split('/')[0]; + } + + public static string GetSecondIdValue(string urnString) + { + var urn = Parse(urnString); + var parts = urn.IdValue.Split('/'); + return parts.Length > 1 ? parts[1] : null; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/IModelFactory.cs b/tests/ServiceStack.Common.Tests/Models/IModelFactory.cs index 78ebfaa2cb5..dbfb4c019e8 100644 --- a/tests/ServiceStack.Common.Tests/Models/IModelFactory.cs +++ b/tests/ServiceStack.Common.Tests/Models/IModelFactory.cs @@ -2,15 +2,15 @@ namespace ServiceStack.Common.Tests.Models { - public interface IModelFactory - { - void AssertListsAreEqual(List actualList, IList expectedList); - void AssertIsEqual(T actual, T expected); + public interface IModelFactory + { + void AssertListsAreEqual(List actualList, IList expectedList); + void AssertIsEqual(T actual, T expected); - T ExistingValue { get; } - T NonExistingValue { get; } - List CreateList(); - List CreateList2(); - T CreateInstance(int i); - } + T ExistingValue { get; } + T NonExistingValue { get; } + List CreateList(); + List CreateList2(); + T CreateInstance(int i); + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelFactoryBase.cs b/tests/ServiceStack.Common.Tests/Models/ModelFactoryBase.cs index 09c1494c338..a442f96c996 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelFactoryBase.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelFactoryBase.cs @@ -3,60 +3,60 @@ namespace ServiceStack.Common.Tests.Models { - public abstract class ModelFactoryBase - : IModelFactory - { - #region Implementation of IModelFactory - - public void AssertListsAreEqual(List actualList, IList expectedList) - { - Assert.That(actualList, Has.Count.EqualTo(expectedList.Count)); - var i = 0; - - actualList.ForEach(x => - AssertIsEqual(x, expectedList[i++])); - } - - public abstract T CreateInstance(int i); - - public abstract void AssertIsEqual(T actual, T expected); - - public T ExistingValue - { - get - { - return CreateInstance(4); - } - } - - public T NonExistingValue - { - get - { - return CreateInstance(5); - } - } - - public List CreateList() - { - return new List - { - CreateInstance(1), - CreateInstance(2), - CreateInstance(3), - CreateInstance(4), - }; - } - public List CreateList2() - { - return new List - { - CreateInstance(5), - CreateInstance(6), - CreateInstance(7), - }; - } - - #endregion - } + public abstract class ModelFactoryBase + : IModelFactory + { + #region Implementation of IModelFactory + + public void AssertListsAreEqual(List actualList, IList expectedList) + { + Assert.That(actualList, Has.Count.EqualTo(expectedList.Count)); + var i = 0; + + actualList.ForEach(x => + AssertIsEqual(x, expectedList[i++])); + } + + public abstract T CreateInstance(int i); + + public abstract void AssertIsEqual(T actual, T expected); + + public T ExistingValue + { + get + { + return CreateInstance(4); + } + } + + public T NonExistingValue + { + get + { + return CreateInstance(5); + } + } + + public List CreateList() + { + return new List + { + CreateInstance(1), + CreateInstance(2), + CreateInstance(3), + CreateInstance(4), + }; + } + public List CreateList2() + { + return new List + { + CreateInstance(5), + CreateInstance(6), + CreateInstance(7), + }; + } + + #endregion + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithComplexTypes.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithComplexTypes.cs index d7693fc8422..e06a3c07a8f 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithComplexTypes.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithComplexTypes.cs @@ -4,74 +4,75 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithComplexTypes - { - public ModelWithComplexTypes() - { - this.StringList = new List(); - this.IntList = new List(); - this.StringMap = new Dictionary(); - this.IntMap = new Dictionary(); - } + public class ModelWithComplexTypes + { + public ModelWithComplexTypes() + { + this.StringList = new List(); + this.IntList = new List(); + this.StringMap = new Dictionary(); + this.IntMap = new Dictionary(); + } - public long Id { get; set; } + public long Id { get; set; } - public List StringList { get; set; } + public List StringList { get; set; } - public List IntList { get; set; } + public List IntList { get; set; } - public Dictionary StringMap { get; set; } + public Dictionary StringMap { get; set; } - public Dictionary IntMap { get; set; } + public Dictionary IntMap { get; set; } - public ModelWithComplexTypes Child { get; set; } + public ModelWithComplexTypes Child { get; set; } - public static ModelWithComplexTypes Create(int id) - { - var row = new ModelWithComplexTypes { - Id = id, - StringList = { "val" + id + 1, "val" + id + 2, "val" + id + 3 }, - IntList = { id + 1, id + 2, id + 3 }, - StringMap = - { - {"key" + id + 1, "val" + id + 1}, - {"key" + id + 2, "val" + id + 2}, - {"key" + id + 3, "val" + id + 3}, - }, - IntMap = - { - {id + 1, id + 2}, - {id + 3, id + 4}, - {id + 5, id + 6}, - }, - Child = new ModelWithComplexTypes { Id = id * 2 }, - }; + public static ModelWithComplexTypes Create(int id) + { + var row = new ModelWithComplexTypes + { + Id = id, + StringList = { "val" + id + 1, "val" + id + 2, "val" + id + 3 }, + IntList = { id + 1, id + 2, id + 3 }, + StringMap = + { + {"key" + id + 1, "val" + id + 1}, + {"key" + id + 2, "val" + id + 2}, + {"key" + id + 3, "val" + id + 3}, + }, + IntMap = + { + {id + 1, id + 2}, + {id + 3, id + 4}, + {id + 5, id + 6}, + }, + Child = new ModelWithComplexTypes { Id = id * 2 }, + }; - return row; - } + return row; + } - public static ModelWithComplexTypes CreateConstant(int i) - { - return Create(i); - } + public static ModelWithComplexTypes CreateConstant(int i) + { + return Create(i); + } - public static void AssertIsEqual(ModelWithComplexTypes actual, ModelWithComplexTypes expected) - { - Assert.That(actual.Id, Is.EqualTo(expected.Id)); - Assert.That(actual.StringList, Is.EquivalentTo(expected.StringList)); - Assert.That(actual.IntList, Is.EquivalentTo(expected.IntList)); - Assert.That(actual.StringMap, Is.EquivalentTo(expected.StringMap)); - Assert.That(actual.IntMap, Is.EquivalentTo(expected.IntMap)); + public static void AssertIsEqual(ModelWithComplexTypes actual, ModelWithComplexTypes expected) + { + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.StringList, Is.EquivalentTo(expected.StringList)); + Assert.That(actual.IntList, Is.EquivalentTo(expected.IntList)); + Assert.That(actual.StringMap, Is.EquivalentTo(expected.StringMap)); + Assert.That(actual.IntMap, Is.EquivalentTo(expected.IntMap)); - if (expected.Child == null) - { - Assert.That(actual.Child, Is.Null); - } - else - { - Assert.That(actual.Child, Is.Not.Null); - AssertIsEqual(actual.Child, expected.Child); - } - } - } + if (expected.Child == null) + { + Assert.That(actual.Child, Is.Null); + } + else + { + Assert.That(actual.Child, Is.Not.Null); + AssertIsEqual(actual.Child, expected.Child); + } + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithComplexTypesFactory.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithComplexTypesFactory.cs index a3f9f6b9778..0f607dd6e5d 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithComplexTypesFactory.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithComplexTypesFactory.cs @@ -1,20 +1,20 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithComplexTypesFactory - : ModelFactoryBase - { - public static ModelWithComplexTypesFactory Instance - = new ModelWithComplexTypesFactory(); + public class ModelWithComplexTypesFactory + : ModelFactoryBase + { + public static ModelWithComplexTypesFactory Instance + = new ModelWithComplexTypesFactory(); - public override void AssertIsEqual( - ModelWithComplexTypes actual, ModelWithComplexTypes expected) - { - ModelWithComplexTypes.AssertIsEqual(actual, expected); - } + public override void AssertIsEqual( + ModelWithComplexTypes actual, ModelWithComplexTypes expected) + { + ModelWithComplexTypes.AssertIsEqual(actual, expected); + } - public override ModelWithComplexTypes CreateInstance(int i) - { - return ModelWithComplexTypes.CreateConstant(i); - } - } + public override ModelWithComplexTypes CreateInstance(int i) + { + return ModelWithComplexTypes.CreateConstant(i); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithCompositeIndexFields.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithCompositeIndexFields.cs index 00fcbb1a941..b46fe000997 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithCompositeIndexFields.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithCompositeIndexFields.cs @@ -2,21 +2,21 @@ namespace ServiceStack.Common.Tests.Models { - [CompositeIndex(true, "Composite1", "Composite2")] - public class ModelWithCompositeIndexFields - { - public string Id { get; set; } + [CompositeIndex(true, "Composite1", "Composite2")] + public class ModelWithCompositeIndexFields + { + public string Id { get; set; } - [Index] - public string Name { get; set; } + [Index] + public string Name { get; set; } - public string AlbumId { get; set; } + public string AlbumId { get; set; } - [Index(true)] - public string UniqueName { get; set; } + [Index(true)] + public string UniqueName { get; set; } - public string Composite1 { get; set; } + public string Composite1 { get; set; } - public string Composite2 { get; set; } - } + public string Composite2 { get; set; } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentAndNullableTypes.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentAndNullableTypes.cs index dd8dd5ff3ab..b6b7646f96b 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentAndNullableTypes.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentAndNullableTypes.cs @@ -7,120 +7,122 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithFieldsOfDifferentAndNullableTypes - { - private static readonly ILog Log = LogManager.GetLogger(typeof(ModelWithFieldsOfDifferentAndNullableTypes)); - - [AutoIncrement] - public int Id { get; set; } - public int? NId { get; set; } - - public long LongId { get; set; } - public long? NLongId { get; set; } - - public Guid Guid { get; set; } - public Guid? NGuid { get; set; } - - public bool Bool { get; set; } - public bool? NBool { get; set; } - - public DateTime DateTime { get; set; } - public DateTime? NDateTime { get; set; } - - public float Float { get; set; } - public float? NFloat { get; set; } - - public double Double { get; set; } - public double? NDouble { get; set; } - - public decimal Decimal { get; set; } - public decimal? NDecimal { get; set; } - - public TimeSpan TimeSpan { get; set; } - public TimeSpan? NTimeSpan { get; set; } - - public static ModelWithFieldsOfDifferentAndNullableTypes Create(int id) - { - var row = new ModelWithFieldsOfDifferentAndNullableTypes { - Id = id, - Bool = id % 2 == 0, - DateTime = DateTime.Now.AddDays(id), - Float = 1.11f + id, - Double = 1.11d + id, - Guid = Guid.NewGuid(), - LongId = 999 + id, - Decimal = id + 0.5m, - TimeSpan = TimeSpan.FromSeconds(id), - }; - - return row; - } - - public static ModelWithFieldsOfDifferentAndNullableTypes CreateConstant(int id) - { - var row = new ModelWithFieldsOfDifferentAndNullableTypes { - Id = id, - Bool = id % 2 == 0, - DateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1), - Float = 1.11f + id, - Double = 1.11d + id, - Guid = new Guid(((id % 240) + 16).ToString("X") + "461D9D-47DB-4778-B3FA-458379AE9BDC"), - LongId = 999 + id, - Decimal = id + 0.5m, - TimeSpan = TimeSpan.FromSeconds(id), - }; - - return row; - } - - public static void AssertIsEqual(ModelWithFieldsOfDifferentAndNullableTypes actual, ModelWithFieldsOfDifferentAndNullableTypes expected) - { - Assert.That(actual.Id, Is.EqualTo(expected.Id)); - Assert.That(actual.Guid, Is.EqualTo(expected.Guid)); - Assert.That(actual.LongId, Is.EqualTo(expected.LongId)); - Assert.That(actual.Bool, Is.EqualTo(expected.Bool)); - Assert.That(actual.TimeSpan, Is.EqualTo(expected.TimeSpan)); - - try - { - Assert.That(actual.DateTime, Is.EqualTo(expected.DateTime)); - } - catch (Exception ex) - { - Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); - Assert.That(actual.DateTime.RoundToSecond(), Is.EqualTo(expected.DateTime.RoundToSecond())); - } - - try - { - Assert.That(actual.Float, Is.EqualTo(expected.Float)); - } - catch (Exception ex) - { - Log.Error("Trouble with float precisions, trying Assert again with rounding to 10 decimals", ex); - Assert.That(Math.Round(actual.Float, 10), Is.EqualTo(Math.Round(actual.Float, 10))); - } - - try - { - Assert.That(actual.Double, Is.EqualTo(expected.Double)); - } - catch (Exception ex) - { - Log.Error("Trouble with double precisions, trying Assert again with rounding to 10 decimals", ex); - Assert.That(Math.Round(actual.Double, 10), Is.EqualTo(Math.Round(actual.Double, 10))); - } - - Assert.That(actual.NBool, Is.EqualTo(expected.NBool)); - Assert.That(actual.NDateTime, Is.EqualTo(expected.NDateTime)); - Assert.That(actual.NDecimal, Is.EqualTo(expected.NDecimal)); - Assert.That(actual.NDouble, Is.EqualTo(expected.NDouble)); - Assert.That(actual.NFloat, Is.EqualTo(expected.NFloat)); - Assert.That(actual.NGuid, Is.EqualTo(expected.NGuid)); - Assert.That(actual.NId, Is.EqualTo(expected.NId)); - Assert.That(actual.NLongId, Is.EqualTo(expected.NLongId)); - Assert.That(actual.NTimeSpan, Is.EqualTo(expected.NTimeSpan)); - - } - } + public class ModelWithFieldsOfDifferentAndNullableTypes + { + private static readonly ILog Log = LogManager.GetLogger(typeof(ModelWithFieldsOfDifferentAndNullableTypes)); + + [AutoIncrement] + public int Id { get; set; } + public int? NId { get; set; } + + public long LongId { get; set; } + public long? NLongId { get; set; } + + public Guid Guid { get; set; } + public Guid? NGuid { get; set; } + + public bool Bool { get; set; } + public bool? NBool { get; set; } + + public DateTime DateTime { get; set; } + public DateTime? NDateTime { get; set; } + + public float Float { get; set; } + public float? NFloat { get; set; } + + public double Double { get; set; } + public double? NDouble { get; set; } + + public decimal Decimal { get; set; } + public decimal? NDecimal { get; set; } + + public TimeSpan TimeSpan { get; set; } + public TimeSpan? NTimeSpan { get; set; } + + public static ModelWithFieldsOfDifferentAndNullableTypes Create(int id) + { + var row = new ModelWithFieldsOfDifferentAndNullableTypes + { + Id = id, + Bool = id % 2 == 0, + DateTime = DateTime.Now.AddDays(id), + Float = 1.11f + id, + Double = 1.11d + id, + Guid = Guid.NewGuid(), + LongId = 999 + id, + Decimal = id + 0.5m, + TimeSpan = TimeSpan.FromSeconds(id), + }; + + return row; + } + + public static ModelWithFieldsOfDifferentAndNullableTypes CreateConstant(int id) + { + var row = new ModelWithFieldsOfDifferentAndNullableTypes + { + Id = id, + Bool = id % 2 == 0, + DateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1), + Float = 1.11f + id, + Double = 1.11d + id, + Guid = new Guid(((id % 240) + 16).ToString("X") + "461D9D-47DB-4778-B3FA-458379AE9BDC"), + LongId = 999 + id, + Decimal = id + 0.5m, + TimeSpan = TimeSpan.FromSeconds(id), + }; + + return row; + } + + public static void AssertIsEqual(ModelWithFieldsOfDifferentAndNullableTypes actual, ModelWithFieldsOfDifferentAndNullableTypes expected) + { + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.Guid, Is.EqualTo(expected.Guid)); + Assert.That(actual.LongId, Is.EqualTo(expected.LongId)); + Assert.That(actual.Bool, Is.EqualTo(expected.Bool)); + Assert.That(actual.TimeSpan, Is.EqualTo(expected.TimeSpan)); + + try + { + Assert.That(actual.DateTime, Is.EqualTo(expected.DateTime)); + } + catch (Exception ex) + { + Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); + Assert.That(actual.DateTime.RoundToSecond(), Is.EqualTo(expected.DateTime.RoundToSecond())); + } + + try + { + Assert.That(actual.Float, Is.EqualTo(expected.Float)); + } + catch (Exception ex) + { + Log.Error("Trouble with float precisions, trying Assert again with rounding to 10 decimals", ex); + Assert.That(Math.Round(actual.Float, 10), Is.EqualTo(Math.Round(actual.Float, 10))); + } + + try + { + Assert.That(actual.Double, Is.EqualTo(expected.Double)); + } + catch (Exception ex) + { + Log.Error("Trouble with double precisions, trying Assert again with rounding to 10 decimals", ex); + Assert.That(Math.Round(actual.Double, 10), Is.EqualTo(Math.Round(actual.Double, 10))); + } + + Assert.That(actual.NBool, Is.EqualTo(expected.NBool)); + Assert.That(actual.NDateTime, Is.EqualTo(expected.NDateTime)); + Assert.That(actual.NDecimal, Is.EqualTo(expected.NDecimal)); + Assert.That(actual.NDouble, Is.EqualTo(expected.NDouble)); + Assert.That(actual.NFloat, Is.EqualTo(expected.NFloat)); + Assert.That(actual.NGuid, Is.EqualTo(expected.NGuid)); + Assert.That(actual.NId, Is.EqualTo(expected.NId)); + Assert.That(actual.NLongId, Is.EqualTo(expected.NLongId)); + Assert.That(actual.NTimeSpan, Is.EqualTo(expected.NTimeSpan)); + + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentAndNullableTypesFactory.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentAndNullableTypesFactory.cs index 9ae7e113107..bed7fcde6df 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentAndNullableTypesFactory.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentAndNullableTypesFactory.cs @@ -1,20 +1,20 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithFieldsOfDifferentAndNullableTypesFactory - : ModelFactoryBase - { - public static ModelWithFieldsOfDifferentAndNullableTypesFactory Instance - = new ModelWithFieldsOfDifferentAndNullableTypesFactory(); + public class ModelWithFieldsOfDifferentAndNullableTypesFactory + : ModelFactoryBase + { + public static ModelWithFieldsOfDifferentAndNullableTypesFactory Instance + = new ModelWithFieldsOfDifferentAndNullableTypesFactory(); - public override void AssertIsEqual( - ModelWithFieldsOfDifferentAndNullableTypes actual, ModelWithFieldsOfDifferentAndNullableTypes expected) - { - ModelWithFieldsOfDifferentAndNullableTypes.AssertIsEqual(actual, expected); - } + public override void AssertIsEqual( + ModelWithFieldsOfDifferentAndNullableTypes actual, ModelWithFieldsOfDifferentAndNullableTypes expected) + { + ModelWithFieldsOfDifferentAndNullableTypes.AssertIsEqual(actual, expected); + } - public override ModelWithFieldsOfDifferentAndNullableTypes CreateInstance(int i) - { - return ModelWithFieldsOfDifferentAndNullableTypes.CreateConstant(i); - } - } + public override ModelWithFieldsOfDifferentAndNullableTypes CreateInstance(int i) + { + return ModelWithFieldsOfDifferentAndNullableTypes.CreateConstant(i); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentTypes.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentTypes.cs index a76ccaf5cc4..49eb083a203 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentTypes.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentTypes.cs @@ -7,178 +7,182 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithFieldsOfDifferentTypesAsNullables - { - private static readonly ILog Log = LogManager.GetLogger(typeof(ModelWithFieldsOfDifferentTypesAsNullables)); - - public int? Id { get; set; } - - public string Name { get; set; } - - public long? LongId { get; set; } - - public Guid? Guid { get; set; } - - public bool? Bool { get; set; } - - public DateTime? DateTime { get; set; } - - public double? Double { get; set; } - - public static ModelWithFieldsOfDifferentTypesAsNullables Create(int id) - { - var row = new ModelWithFieldsOfDifferentTypesAsNullables { - Id = id, - Bool = id % 2 == 0, - DateTime = System.DateTime.Now.AddDays(id), - Double = 1.11d + id, - Guid = System.Guid.NewGuid(), - LongId = 999 + id, - Name = "Name" + id - }; - - return row; - } - - public static ModelWithFieldsOfDifferentTypesAsNullables CreateConstant(int id) - { - var row = new ModelWithFieldsOfDifferentTypesAsNullables { - Id = id, - Bool = id % 2 == 0, - DateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1), - Double = 1.11d + id, - Guid = new Guid(((id % 240) + 16).ToString("X") + "726E3B-9983-40B4-A8CB-2F8ADA8C8760"), - LongId = 999 + id, - Name = "Name" + id - }; - - return row; - } - - public static void AssertIsEqual(ModelWithFieldsOfDifferentTypes actual, ModelWithFieldsOfDifferentTypesAsNullables expected) - { - Assert.That(actual.Id, Is.EqualTo(expected.Id.Value)); - Assert.That(actual.Name, Is.EqualTo(expected.Name)); - Assert.That(actual.Guid, Is.EqualTo(expected.Guid.Value)); - Assert.That(actual.LongId, Is.EqualTo(expected.LongId.Value)); - Assert.That(actual.Bool, Is.EqualTo(expected.Bool.Value)); - try - { - Assert.That(actual.DateTime, Is.EqualTo(expected.DateTime.Value)); - } - catch (Exception ex) - { - Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); - Assert.That(actual.DateTime.RoundToSecond(), Is.EqualTo(expected.DateTime.Value.RoundToSecond())); - } - try - { - Assert.That(actual.Double, Is.EqualTo(expected.Double.Value)); - } - catch (Exception ex) - { - Log.Error("Trouble with double precisions, trying Assert again with rounding to 10 decimals", ex); - Assert.That(Math.Round(actual.Double, 10), Is.EqualTo(Math.Round(actual.Double, 10))); - } - } - } - - - public class ModelWithFieldsOfDifferentTypes - { - private static readonly ILog Log = LogManager.GetLogger(typeof(ModelWithFieldsOfDifferentTypes)); - - [AutoIncrement] - public int Id { get; set; } - - public string Name { get; set; } - - public long LongId { get; set; } - - public Guid Guid { get; set; } - - public bool Bool { get; set; } - - public DateTime DateTime { get; set; } - - public double Double { get; set; } - - public static ModelWithFieldsOfDifferentTypes Create(int id) - { - var row = new ModelWithFieldsOfDifferentTypes { - Id = id, - Bool = id % 2 == 0, - DateTime = DateTime.Now.AddDays(id), - Double = 1.11d + id, - Guid = Guid.NewGuid(), - LongId = 999 + id, - Name = "Name" + id - }; - - return row; - } - - public static ModelWithFieldsOfDifferentTypes CreateConstant(int id) - { - var row = new ModelWithFieldsOfDifferentTypes { - Id = id, - Bool = id % 2 == 0, - DateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1), - Double = 1.11d + id, - Guid = new Guid(((id % 240) + 16).ToString("X") + "726E3B-9983-40B4-A8CB-2F8ADA8C8760"), - LongId = 999 + id, - Name = "Name" + id - }; - - return row; - } - - public override bool Equals(object obj) - { - var other = obj as ModelWithFieldsOfDifferentTypes; - if (other == null) return false; - - try - { - AssertIsEqual(this, other); - return true; - } - catch (Exception) - { - return false; - } - } - - public override int GetHashCode() - { - return (Id + Guid.ToString()).GetHashCode(); - } - - public static void AssertIsEqual(ModelWithFieldsOfDifferentTypes actual, ModelWithFieldsOfDifferentTypes expected) - { - Assert.That(actual.Id, Is.EqualTo(expected.Id)); - Assert.That(actual.Name, Is.EqualTo(expected.Name)); - Assert.That(actual.Guid, Is.EqualTo(expected.Guid)); - Assert.That(actual.LongId, Is.EqualTo(expected.LongId)); - Assert.That(actual.Bool, Is.EqualTo(expected.Bool)); - try - { - Assert.That(actual.DateTime, Is.EqualTo(expected.DateTime)); - } - catch (Exception ex) - { - Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); - Assert.That(actual.DateTime.RoundToSecond(), Is.EqualTo(expected.DateTime.RoundToSecond())); - } - try - { - Assert.That(actual.Double, Is.EqualTo(expected.Double)); - } - catch (Exception ex) - { - Log.Error("Trouble with double precisions, trying Assert again with rounding to 10 decimals", ex); - Assert.That(Math.Round(actual.Double, 10), Is.EqualTo(Math.Round(actual.Double, 10))); - } - } - } + public class ModelWithFieldsOfDifferentTypesAsNullables + { + private static readonly ILog Log = LogManager.GetLogger(typeof(ModelWithFieldsOfDifferentTypesAsNullables)); + + public int? Id { get; set; } + + public string Name { get; set; } + + public long? LongId { get; set; } + + public Guid? Guid { get; set; } + + public bool? Bool { get; set; } + + public DateTime? DateTime { get; set; } + + public double? Double { get; set; } + + public static ModelWithFieldsOfDifferentTypesAsNullables Create(int id) + { + var row = new ModelWithFieldsOfDifferentTypesAsNullables + { + Id = id, + Bool = id % 2 == 0, + DateTime = System.DateTime.Now.AddDays(id), + Double = 1.11d + id, + Guid = System.Guid.NewGuid(), + LongId = 999 + id, + Name = "Name" + id + }; + + return row; + } + + public static ModelWithFieldsOfDifferentTypesAsNullables CreateConstant(int id) + { + var row = new ModelWithFieldsOfDifferentTypesAsNullables + { + Id = id, + Bool = id % 2 == 0, + DateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1), + Double = 1.11d + id, + Guid = new Guid(((id % 240) + 16).ToString("X") + "726E3B-9983-40B4-A8CB-2F8ADA8C8760"), + LongId = 999 + id, + Name = "Name" + id + }; + + return row; + } + + public static void AssertIsEqual(ModelWithFieldsOfDifferentTypes actual, ModelWithFieldsOfDifferentTypesAsNullables expected) + { + Assert.That(actual.Id, Is.EqualTo(expected.Id.Value)); + Assert.That(actual.Name, Is.EqualTo(expected.Name)); + Assert.That(actual.Guid, Is.EqualTo(expected.Guid.Value)); + Assert.That(actual.LongId, Is.EqualTo(expected.LongId.Value)); + Assert.That(actual.Bool, Is.EqualTo(expected.Bool.Value)); + try + { + Assert.That(actual.DateTime, Is.EqualTo(expected.DateTime.Value)); + } + catch (Exception ex) + { + Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); + Assert.That(actual.DateTime.RoundToSecond(), Is.EqualTo(expected.DateTime.Value.RoundToSecond())); + } + try + { + Assert.That(actual.Double, Is.EqualTo(expected.Double.Value)); + } + catch (Exception ex) + { + Log.Error("Trouble with double precisions, trying Assert again with rounding to 10 decimals", ex); + Assert.That(Math.Round(actual.Double, 10), Is.EqualTo(Math.Round(actual.Double, 10))); + } + } + } + + + public class ModelWithFieldsOfDifferentTypes + { + private static readonly ILog Log = LogManager.GetLogger(typeof(ModelWithFieldsOfDifferentTypes)); + + [AutoIncrement] + public int Id { get; set; } + + public string Name { get; set; } + + public long LongId { get; set; } + + public Guid Guid { get; set; } + + public bool Bool { get; set; } + + public DateTime DateTime { get; set; } + + public double Double { get; set; } + + public static ModelWithFieldsOfDifferentTypes Create(int id) + { + var row = new ModelWithFieldsOfDifferentTypes + { + Id = id, + Bool = id % 2 == 0, + DateTime = DateTime.Now.AddDays(id), + Double = 1.11d + id, + Guid = Guid.NewGuid(), + LongId = 999 + id, + Name = "Name" + id + }; + + return row; + } + + public static ModelWithFieldsOfDifferentTypes CreateConstant(int id) + { + var row = new ModelWithFieldsOfDifferentTypes + { + Id = id, + Bool = id % 2 == 0, + DateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1), + Double = 1.11d + id, + Guid = new Guid(((id % 240) + 16).ToString("X") + "726E3B-9983-40B4-A8CB-2F8ADA8C8760"), + LongId = 999 + id, + Name = "Name" + id + }; + + return row; + } + + public override bool Equals(object obj) + { + var other = obj as ModelWithFieldsOfDifferentTypes; + if (other == null) return false; + + try + { + AssertIsEqual(this, other); + return true; + } + catch (Exception) + { + return false; + } + } + + public override int GetHashCode() + { + return (Id + Guid.ToString()).GetHashCode(); + } + + public static void AssertIsEqual(ModelWithFieldsOfDifferentTypes actual, ModelWithFieldsOfDifferentTypes expected) + { + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.Name, Is.EqualTo(expected.Name)); + Assert.That(actual.Guid, Is.EqualTo(expected.Guid)); + Assert.That(actual.LongId, Is.EqualTo(expected.LongId)); + Assert.That(actual.Bool, Is.EqualTo(expected.Bool)); + try + { + Assert.That(actual.DateTime, Is.EqualTo(expected.DateTime)); + } + catch (Exception ex) + { + Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); + Assert.That(actual.DateTime.RoundToSecond(), Is.EqualTo(expected.DateTime.RoundToSecond())); + } + try + { + Assert.That(actual.Double, Is.EqualTo(expected.Double)); + } + catch (Exception ex) + { + Log.Error("Trouble with double precisions, trying Assert again with rounding to 10 decimals", ex); + Assert.That(Math.Round(actual.Double, 10), Is.EqualTo(Math.Round(actual.Double, 10))); + } + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentTypesFactory.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentTypesFactory.cs index 5299d7d0a70..4fe5ea3658d 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentTypesFactory.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentTypesFactory.cs @@ -2,21 +2,21 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithFieldsOfDifferentTypesFactory - : ModelFactoryBase - { - public static ModelWithFieldsOfDifferentTypesFactory Instance - = new ModelWithFieldsOfDifferentTypesFactory(); + public class ModelWithFieldsOfDifferentTypesFactory + : ModelFactoryBase + { + public static ModelWithFieldsOfDifferentTypesFactory Instance + = new ModelWithFieldsOfDifferentTypesFactory(); - public override void AssertIsEqual( - ModelWithFieldsOfDifferentTypes actual, ModelWithFieldsOfDifferentTypes expected) - { - ModelWithFieldsOfDifferentTypes.AssertIsEqual(actual, expected); - } + public override void AssertIsEqual( + ModelWithFieldsOfDifferentTypes actual, ModelWithFieldsOfDifferentTypes expected) + { + ModelWithFieldsOfDifferentTypes.AssertIsEqual(actual, expected); + } - public override ModelWithFieldsOfDifferentTypes CreateInstance(int i) - { - return ModelWithFieldsOfDifferentTypes.CreateConstant(i); - } - } + public override ModelWithFieldsOfDifferentTypes CreateInstance(int i) + { + return ModelWithFieldsOfDifferentTypes.CreateConstant(i); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfNullableTypes.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfNullableTypes.cs index 2a298c36cfe..24a2acf4b07 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfNullableTypes.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfNullableTypes.cs @@ -6,105 +6,107 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithFieldsOfNullableTypes - : IHasIntId - { - private static readonly ILog Log = LogManager.GetLogger(typeof(ModelWithFieldsOfNullableTypes)); - - public int Id { get; set; } - public int? NId { get; set; } - - public long? NLongId { get; set; } - - public Guid? NGuid { get; set; } - - public bool? NBool { get; set; } - - public DateTime? NDateTime { get; set; } - - public float? NFloat { get; set; } - - public double? NDouble { get; set; } - - public decimal? NDecimal { get; set; } - - public TimeSpan? NTimeSpan { get; set; } - - public static ModelWithFieldsOfNullableTypes Create(int id) - { - var row = new ModelWithFieldsOfNullableTypes { - Id = id, - NId = id, - NBool = id % 2 == 0, - NDateTime = DateTime.Now.AddDays(id), - NFloat = 1.11f + id, - NDouble = 1.11d + id, - NGuid = Guid.NewGuid(), - NLongId = 999 + id, - NDecimal = id + 0.5m, - NTimeSpan = TimeSpan.FromSeconds(id), - }; - - return row; - } - - public static ModelWithFieldsOfNullableTypes CreateConstant(int id) - { - var row = new ModelWithFieldsOfNullableTypes { - Id = id, - NId = id, - NBool = id % 2 == 0, - NDateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1), - NFloat = 1.11f + id, - NDouble = 1.11d + id, - NGuid = new Guid(((id % 240) + 16).ToString("X") + "7DA519-73B6-4525-84BA-B57673B2360D"), - NLongId = 999 + id, - NDecimal = id + 0.5m, - NTimeSpan = TimeSpan.FromSeconds(id), - }; - - return row; - } - - public static void AssertIsEqual(ModelWithFieldsOfNullableTypes actual, ModelWithFieldsOfNullableTypes expected) - { - Assert.That(actual.Id, Is.EqualTo(expected.Id)); - Assert.That(actual.NId, Is.EqualTo(expected.NId)); - Assert.That(actual.NGuid, Is.EqualTo(expected.NGuid)); - Assert.That(actual.NLongId, Is.EqualTo(expected.NLongId)); - Assert.That(actual.NBool, Is.EqualTo(expected.NBool)); - Assert.That(actual.NTimeSpan, Is.EqualTo(expected.NTimeSpan)); - - try - { - Assert.That(actual.NDateTime, Is.EqualTo(expected.NDateTime)); - } - catch (Exception ex) - { - Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); - Assert.That(actual.NDateTime.Value.ToUniversalTime().RoundToSecond(), Is.EqualTo(expected.NDateTime.Value.ToUniversalTime().RoundToSecond())); - } - - try - { - Assert.That(actual.NFloat, Is.EqualTo(expected.NFloat)); - } - catch (Exception ex) - { - Log.Error("Trouble with float precisions, trying Assert again with rounding to 10 decimals", ex); - Assert.That(Math.Round(actual.NFloat.Value, 10), Is.EqualTo(Math.Round(actual.NFloat.Value, 10))); - } - - try - { - Assert.That(actual.NDouble, Is.EqualTo(expected.NDouble)); - } - catch (Exception ex) - { - Log.Error("Trouble with double precisions, trying Assert again with rounding to 10 decimals", ex); - Assert.That(Math.Round(actual.NDouble.Value, 10), Is.EqualTo(Math.Round(actual.NDouble.Value, 10))); - } - - } - } + public class ModelWithFieldsOfNullableTypes + : IHasIntId + { + private static readonly ILog Log = LogManager.GetLogger(typeof(ModelWithFieldsOfNullableTypes)); + + public int Id { get; set; } + public int? NId { get; set; } + + public long? NLongId { get; set; } + + public Guid? NGuid { get; set; } + + public bool? NBool { get; set; } + + public DateTime? NDateTime { get; set; } + + public float? NFloat { get; set; } + + public double? NDouble { get; set; } + + public decimal? NDecimal { get; set; } + + public TimeSpan? NTimeSpan { get; set; } + + public static ModelWithFieldsOfNullableTypes Create(int id) + { + var row = new ModelWithFieldsOfNullableTypes + { + Id = id, + NId = id, + NBool = id % 2 == 0, + NDateTime = DateTime.Now.AddDays(id), + NFloat = 1.11f + id, + NDouble = 1.11d + id, + NGuid = Guid.NewGuid(), + NLongId = 999 + id, + NDecimal = id + 0.5m, + NTimeSpan = TimeSpan.FromSeconds(id), + }; + + return row; + } + + public static ModelWithFieldsOfNullableTypes CreateConstant(int id) + { + var row = new ModelWithFieldsOfNullableTypes + { + Id = id, + NId = id, + NBool = id % 2 == 0, + NDateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1), + NFloat = 1.11f + id, + NDouble = 1.11d + id, + NGuid = new Guid(((id % 240) + 16).ToString("X") + "7DA519-73B6-4525-84BA-B57673B2360D"), + NLongId = 999 + id, + NDecimal = id + 0.5m, + NTimeSpan = TimeSpan.FromSeconds(id), + }; + + return row; + } + + public static void AssertIsEqual(ModelWithFieldsOfNullableTypes actual, ModelWithFieldsOfNullableTypes expected) + { + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.NId, Is.EqualTo(expected.NId)); + Assert.That(actual.NGuid, Is.EqualTo(expected.NGuid)); + Assert.That(actual.NLongId, Is.EqualTo(expected.NLongId)); + Assert.That(actual.NBool, Is.EqualTo(expected.NBool)); + Assert.That(actual.NTimeSpan, Is.EqualTo(expected.NTimeSpan)); + + try + { + Assert.That(actual.NDateTime, Is.EqualTo(expected.NDateTime)); + } + catch (Exception ex) + { + Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); + Assert.That(actual.NDateTime.Value.ToUniversalTime().RoundToSecond(), Is.EqualTo(expected.NDateTime.Value.ToUniversalTime().RoundToSecond())); + } + + try + { + Assert.That(actual.NFloat, Is.EqualTo(expected.NFloat)); + } + catch (Exception ex) + { + Log.Error("Trouble with float precisions, trying Assert again with rounding to 10 decimals", ex); + Assert.That(Math.Round(actual.NFloat.Value, 10), Is.EqualTo(Math.Round(actual.NFloat.Value, 10))); + } + + try + { + Assert.That(actual.NDouble, Is.EqualTo(expected.NDouble)); + } + catch (Exception ex) + { + Log.Error("Trouble with double precisions, trying Assert again with rounding to 10 decimals", ex); + Assert.That(Math.Round(actual.NDouble.Value, 10), Is.EqualTo(Math.Round(actual.NDouble.Value, 10))); + } + + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfNullableTypesFactory.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfNullableTypesFactory.cs index 1fde381ec79..1c04743ca2e 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfNullableTypesFactory.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfNullableTypesFactory.cs @@ -1,20 +1,20 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithFieldsOfNullableTypesFactory - : ModelFactoryBase - { - public static ModelWithFieldsOfNullableTypesFactory Instance - = new ModelWithFieldsOfNullableTypesFactory(); + public class ModelWithFieldsOfNullableTypesFactory + : ModelFactoryBase + { + public static ModelWithFieldsOfNullableTypesFactory Instance + = new ModelWithFieldsOfNullableTypesFactory(); - public override void AssertIsEqual( - ModelWithFieldsOfNullableTypes actual, ModelWithFieldsOfNullableTypes expected) - { - ModelWithFieldsOfNullableTypes.AssertIsEqual(actual, expected); - } + public override void AssertIsEqual( + ModelWithFieldsOfNullableTypes actual, ModelWithFieldsOfNullableTypes expected) + { + ModelWithFieldsOfNullableTypes.AssertIsEqual(actual, expected); + } - public override ModelWithFieldsOfNullableTypes CreateInstance(int i) - { - return ModelWithFieldsOfNullableTypes.CreateConstant(i); - } - } + public override ModelWithFieldsOfNullableTypes CreateInstance(int i) + { + return ModelWithFieldsOfNullableTypes.CreateConstant(i); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithIdAndName.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithIdAndName.cs index 76aa4707323..ec04f3a4c7f 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithIdAndName.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithIdAndName.cs @@ -4,61 +4,61 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithIdAndName - { - public ModelWithIdAndName() - { - } + public class ModelWithIdAndName + { + public ModelWithIdAndName() + { + } - public ModelWithIdAndName(int id) - { - Id = id; - Name = "Name" + id; - } + public ModelWithIdAndName(int id) + { + Id = id; + Name = "Name" + id; + } [AutoIncrement] - public int Id { get; set; } + public int Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public static ModelWithIdAndName Create(int id) - { - return new ModelWithIdAndName(id); - } + public static ModelWithIdAndName Create(int id) + { + return new ModelWithIdAndName(id); + } - public static void AssertIsEqual(ModelWithIdAndName actual, ModelWithIdAndName expected) - { - if (actual == null || expected == null) - { - Assert.That(actual == expected, Is.True); - return; - } + public static void AssertIsEqual(ModelWithIdAndName actual, ModelWithIdAndName expected) + { + if (actual == null || expected == null) + { + Assert.That(actual == expected, Is.True); + return; + } - Assert.That(actual.Id, Is.EqualTo(expected.Id)); - Assert.That(actual.Name, Is.EqualTo(expected.Name)); - } + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.Name, Is.EqualTo(expected.Name)); + } - public bool Equals(ModelWithIdAndName other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return other.Id == Id && Equals(other.Name, Name); - } + public bool Equals(ModelWithIdAndName other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return other.Id == Id && Equals(other.Name, Name); + } - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (ModelWithIdAndName)) return false; - return Equals((ModelWithIdAndName) obj); - } + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof(ModelWithIdAndName)) return false; + return Equals((ModelWithIdAndName)obj); + } - public override int GetHashCode() - { - unchecked - { - return (Id*397) ^ (Name != null ? Name.GetHashCode() : 0); - } - } - } + public override int GetHashCode() + { + unchecked + { + return (Id * 397) ^ (Name != null ? Name.GetHashCode() : 0); + } + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithIdOnly.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithIdOnly.cs index 4d2684e3b2a..2c531b6a037 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithIdOnly.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithIdOnly.cs @@ -1,18 +1,18 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithIdOnly - { - public ModelWithIdOnly() - { - } + public class ModelWithIdOnly + { + public ModelWithIdOnly() + { + } - public ModelWithIdOnly(long id) - { - Id = id; - } + public ModelWithIdOnly(long id) + { + Id = id; + } - // must be long as you cannot have a table with only an autoincrement field - public long Id { get; set; } + // must be long as you cannot have a table with only an autoincrement field + public long Id { get; set; } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithIndexFields.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithIndexFields.cs index 97c93669b82..2322908380a 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithIndexFields.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithIndexFields.cs @@ -2,16 +2,16 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithIndexFields - { - public string Id { get; set; } + public class ModelWithIndexFields + { + public string Id { get; set; } - [Index] - public string Name { get; set; } + [Index] + public string Name { get; set; } - public string AlbumId { get; set; } + public string AlbumId { get; set; } - [Index(true)] - public string UniqueName { get; set; } - } + [Index(true)] + public string UniqueName { get; set; } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithLongIdAndStringFields.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithLongIdAndStringFields.cs index 8201895bc2c..12a696ba7b1 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithLongIdAndStringFields.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithLongIdAndStringFields.cs @@ -1,13 +1,13 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithLongIdAndStringFields - { - public long Id { get; set; } + public class ModelWithLongIdAndStringFields + { + public long Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public string AlbumId { get; set; } + public string AlbumId { get; set; } - public string AlbumName { get; set; } - } + public string AlbumName { get; set; } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithMapAndList.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithMapAndList.cs index e7b178b7811..60c911e6a97 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithMapAndList.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithMapAndList.cs @@ -3,40 +3,40 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithMapAndList - { - public ModelWithMapAndList() - { - this.Map = new Dictionary(); - this.List = new List(); - } - - public ModelWithMapAndList(int id) - : this() - { - Id = id; - Name = "Name" + id; - } - - public int Id { get; set; } - - public string Name { get; set; } - - public Dictionary Map { get; set; } - - public List List { get; set; } - - public static ModelWithMapAndList Create(int id) - { - return new ModelWithMapAndList(id); - } - - public static void AssertIsEqual(ModelWithMapAndList actual, ModelWithMapAndList expected) - { - Assert.That(actual.Id, Is.EqualTo(expected.Id)); - Assert.That(actual.Name, Is.EqualTo(expected.Name)); - Assert.That(actual.Map, Is.EquivalentTo(expected.Map)); - Assert.That(actual.List, Is.EquivalentTo(expected.List)); - } - } + public class ModelWithMapAndList + { + public ModelWithMapAndList() + { + this.Map = new Dictionary(); + this.List = new List(); + } + + public ModelWithMapAndList(int id) + : this() + { + Id = id; + Name = "Name" + id; + } + + public int Id { get; set; } + + public string Name { get; set; } + + public Dictionary Map { get; set; } + + public List List { get; set; } + + public static ModelWithMapAndList Create(int id) + { + return new ModelWithMapAndList(id); + } + + public static void AssertIsEqual(ModelWithMapAndList actual, ModelWithMapAndList expected) + { + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.Name, Is.EqualTo(expected.Name)); + Assert.That(actual.Map, Is.EquivalentTo(expected.Map)); + Assert.That(actual.List, Is.EquivalentTo(expected.List)); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithNamedCompositeIndex.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithNamedCompositeIndex.cs index 7e9221ed841..28670876b8e 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithNamedCompositeIndex.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithNamedCompositeIndex.cs @@ -2,21 +2,21 @@ namespace ServiceStack.Common.Tests.Models { - [CompositeIndex(true, "Composite1", "Composite2", Name = "custom_index_name")] - public class ModelWithNamedCompositeIndex - { - public string Id { get; set; } + [CompositeIndex(true, "Composite1", "Composite2", Name = "custom_index_name")] + public class ModelWithNamedCompositeIndex + { + public string Id { get; set; } - [Index] - public string Name { get; set; } + [Index] + public string Name { get; set; } - public string AlbumId { get; set; } + public string AlbumId { get; set; } - [Index(true)] - public string UniqueName { get; set; } + [Index(true)] + public string UniqueName { get; set; } - public string Composite1 { get; set; } + public string Composite1 { get; set; } - public string Composite2 { get; set; } - } + public string Composite2 { get; set; } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ModelWithOnlyStringFields.cs b/tests/ServiceStack.Common.Tests/Models/ModelWithOnlyStringFields.cs index 64621d0f4c7..c8522540006 100644 --- a/tests/ServiceStack.Common.Tests/Models/ModelWithOnlyStringFields.cs +++ b/tests/ServiceStack.Common.Tests/Models/ModelWithOnlyStringFields.cs @@ -1,23 +1,24 @@ namespace ServiceStack.Common.Tests.Models { - public class ModelWithOnlyStringFields - { - public string Id { get; set; } + public class ModelWithOnlyStringFields + { + public string Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public string AlbumId { get; set; } + public string AlbumId { get; set; } - public string AlbumName { get; set; } + public string AlbumName { get; set; } - public static ModelWithOnlyStringFields Create(string id) - { - return new ModelWithOnlyStringFields { - Id = id, - Name = "Name", - AlbumId = "AlbumId", - AlbumName = "AlbumName", - }; - } - } + public static ModelWithOnlyStringFields Create(string id) + { + return new ModelWithOnlyStringFields + { + Id = id, + Name = "Name", + AlbumId = "AlbumId", + AlbumName = "AlbumName", + }; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/Movie.cs b/tests/ServiceStack.Common.Tests/Models/Movie.cs index 8ee1e272122..afcac8b772c 100644 --- a/tests/ServiceStack.Common.Tests/Models/Movie.cs +++ b/tests/ServiceStack.Common.Tests/Models/Movie.cs @@ -5,63 +5,63 @@ namespace ServiceStack.Common.Tests.Models { - [DataContract] - public class Movie - { - public Movie() - { - this.Genres = new List(); - } + [DataContract] + public class Movie + { + public Movie() + { + this.Genres = new List(); + } - [DataMember] - public string Id { get; set; } + [DataMember] + public string Id { get; set; } - [DataMember] - public string Title { get; set; } + [DataMember] + public string Title { get; set; } - [DataMember] - public decimal Rating { get; set; } + [DataMember] + public decimal Rating { get; set; } - [DataMember] - public string Director { get; set; } + [DataMember] + public string Director { get; set; } - [DataMember] - public DateTime ReleaseDate { get; set; } + [DataMember] + public DateTime ReleaseDate { get; set; } - [DataMember] - public string TagLine { get; set; } + [DataMember] + public string TagLine { get; set; } - [DataMember] - public List Genres { get; set; } + [DataMember] + public List Genres { get; set; } - public bool Equals(Movie other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return Equals(other.Id, Id) && Equals(other.Title, Title) && other.Rating == Rating && Equals(other.Director, Director) && other.ReleaseDate.Equals(ReleaseDate) && Equals(other.TagLine, TagLine) && Genres.EquivalentTo(other.Genres); - } + public bool Equals(Movie other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Equals(other.Id, Id) && Equals(other.Title, Title) && other.Rating == Rating && Equals(other.Director, Director) && other.ReleaseDate.Equals(ReleaseDate) && Equals(other.TagLine, TagLine) && Genres.EquivalentTo(other.Genres); + } - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (Movie)) return false; - return Equals((Movie) obj); - } + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof(Movie)) return false; + return Equals((Movie)obj); + } - public override int GetHashCode() - { - unchecked - { - int result = (Id != null ? Id.GetHashCode() : 0); - result = (result*397) ^ (Title != null ? Title.GetHashCode() : 0); - result = (result*397) ^ Rating.GetHashCode(); - result = (result*397) ^ (Director != null ? Director.GetHashCode() : 0); - result = (result*397) ^ ReleaseDate.GetHashCode(); - result = (result*397) ^ (TagLine != null ? TagLine.GetHashCode() : 0); - result = (result*397) ^ (Genres != null ? Genres.GetHashCode() : 0); - return result; - } - } - } + public override int GetHashCode() + { + unchecked + { + int result = (Id != null ? Id.GetHashCode() : 0); + result = (result * 397) ^ (Title != null ? Title.GetHashCode() : 0); + result = (result * 397) ^ Rating.GetHashCode(); + result = (result * 397) ^ (Director != null ? Director.GetHashCode() : 0); + result = (result * 397) ^ ReleaseDate.GetHashCode(); + result = (result * 397) ^ (TagLine != null ? TagLine.GetHashCode() : 0); + result = (result * 397) ^ (Genres != null ? Genres.GetHashCode() : 0); + return result; + } + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/Poco.cs b/tests/ServiceStack.Common.Tests/Models/Poco.cs index 476cbb55146..27d1a489f99 100644 --- a/tests/ServiceStack.Common.Tests/Models/Poco.cs +++ b/tests/ServiceStack.Common.Tests/Models/Poco.cs @@ -2,6 +2,8 @@ { public class Poco { - public string Name { get; set; } + public int Id { get; set; } + public string Name { get; set; } + public int? Age { get; set; } } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/SampleOrderLine.cs b/tests/ServiceStack.Common.Tests/Models/SampleOrderLine.cs index 22c93f153b8..d25fefffc93 100644 --- a/tests/ServiceStack.Common.Tests/Models/SampleOrderLine.cs +++ b/tests/ServiceStack.Common.Tests/Models/SampleOrderLine.cs @@ -6,147 +6,148 @@ namespace ServiceStack.Common.Tests.Models { - public class SampleOrderLine - : IHasStringId - { - public string Id { get; set; } + public class SampleOrderLine + : IHasStringId + { + public string Id { get; set; } - public string OrderUrn - { - get - { - return CreateUrn(this.UserId, this.OrderId, this.OrderLineId); - } - } + public string OrderUrn + { + get + { + return CreateUrn(this.UserId, this.OrderId, this.OrderLineId); + } + } - public long OrderId { get; set; } + public long OrderId { get; set; } - public long OrderLineId { get; set; } + public long OrderLineId { get; set; } - public DateTime CreatedDate { get; set; } + public DateTime CreatedDate { get; set; } - public Guid UserId { get; set; } + public Guid UserId { get; set; } - public string UserName { get; set; } + public string UserName { get; set; } - public Guid ProductId { get; set; } + public Guid ProductId { get; set; } - public string MflowUrn { get; set; } + public string MflowUrn { get; set; } - public string ProductType { get; set; } + public string ProductType { get; set; } - public string Description { get; set; } + public string Description { get; set; } - public string UpcEan { get; set; } + public string UpcEan { get; set; } - public string Isrc { get; set; } + public string Isrc { get; set; } - public Guid? RecommendationUserId { get; set; } + public Guid? RecommendationUserId { get; set; } - public string RecommendationUserName { get; set; } + public string RecommendationUserName { get; set; } - public string SupplierKeyName { get; set; } + public string SupplierKeyName { get; set; } - public string CostTierKeyName { get; set; } + public string CostTierKeyName { get; set; } - public string PriceTierKeyName { get; set; } + public string PriceTierKeyName { get; set; } - public decimal VatRate { get; set; } + public decimal VatRate { get; set; } - public int ProductPriceIncVat { get; set; } + public int ProductPriceIncVat { get; set; } - public int Quantity { get; set; } + public int Quantity { get; set; } - public decimal TransactionValueExVat { get; set; } + public decimal TransactionValueExVat { get; set; } - public decimal TransactionValueIncVat { get; set; } + public decimal TransactionValueIncVat { get; set; } - public decimal RecommendationDiscountRate { get; set; } + public decimal RecommendationDiscountRate { get; set; } - public decimal DistributionDiscountRate { get; set; } + public decimal DistributionDiscountRate { get; set; } - public decimal RecommendationDiscountAccruedExVat { get; set; } + public decimal RecommendationDiscountAccruedExVat { get; set; } - public decimal DistributionDiscountAccruedExVat { get; set; } + public decimal DistributionDiscountAccruedExVat { get; set; } - public decimal PromoMix { get; set; } + public decimal PromoMix { get; set; } - public decimal DiscountMix { get; set; } + public decimal DiscountMix { get; set; } - public decimal CashMix { get; set; } + public decimal CashMix { get; set; } - public decimal PromoMixValueExVat { get; set; } + public decimal PromoMixValueExVat { get; set; } - public decimal DiscountMixValueExVat { get; set; } + public decimal DiscountMixValueExVat { get; set; } - public decimal CashMixValueIncVat { get; set; } + public decimal CashMixValueIncVat { get; set; } - public string ContentUrn - { - get { return this.MflowUrn; } - set { this.MflowUrn = value; } - } + public string ContentUrn + { + get { return this.MflowUrn; } + set { this.MflowUrn = value; } + } - public string TrackUrn - { - get; - set; - } + public string TrackUrn + { + get; + set; + } - public string Title - { - get; - set; - } + public string Title + { + get; + set; + } - public string ArtistUrn - { - get; - set; - } + public string ArtistUrn + { + get; + set; + } - public string ArtistName - { - get; - set; - } + public string ArtistName + { + get; + set; + } - public string AlbumUrn - { - get; - set; - } + public string AlbumUrn + { + get; + set; + } - public string AlbumName - { - get; - set; - } + public string AlbumName + { + get; + set; + } - public static string CreateUrn(Guid userId, long orderId, long orderLineId) - { - return string.Format("urn:orderline:{0}/{1}/{2}", - userId.ToString("N"), orderId, orderLineId); - } + public static string CreateUrn(Guid userId, long orderId, long orderLineId) + { + return string.Format("urn:orderline:{0}/{1}/{2}", + userId.ToString("N"), orderId, orderLineId); + } - public static SampleOrderLine Create(Guid userId) - { - return Create(userId, 1, 1); - } + public static SampleOrderLine Create(Guid userId) + { + return Create(userId, 1, 1); + } - public static SampleOrderLine Create(Guid userId, int orderId, int orderLineId) - { - return new SampleOrderLine { - Id = CreateUrn(userId, orderId, orderLineId), - CreatedDate = DateTime.Now, - OrderId = orderId, - OrderLineId = orderLineId, - AlbumName = "AlbumName", - CashMixValueIncVat = 0.79m / 1.15m, - TransactionValueExVat = 0.79m, - ContentUrn = "urn:content:" + Guid.NewGuid().ToString("N"), - }; - } + public static SampleOrderLine Create(Guid userId, int orderId, int orderLineId) + { + return new SampleOrderLine + { + Id = CreateUrn(userId, orderId, orderLineId), + CreatedDate = DateTime.Now, + OrderId = orderId, + OrderLineId = orderLineId, + AlbumName = "AlbumName", + CashMixValueIncVat = 0.79m / 1.15m, + TransactionValueExVat = 0.79m, + ContentUrn = "urn:content:" + Guid.NewGuid().ToString("N"), + }; + } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/Shipper.cs b/tests/ServiceStack.Common.Tests/Models/Shipper.cs index 05a495a1b44..1af895c3ac8 100644 --- a/tests/ServiceStack.Common.Tests/Models/Shipper.cs +++ b/tests/ServiceStack.Common.Tests/Models/Shipper.cs @@ -3,34 +3,34 @@ namespace ServiceStack.Common.Tests.Models { - public class Shipper - : IHasIntId - { - public int Id { get; set; } - public string CompanyName { get; set; } - public ShipperType ShipperType { get; set; } - public DateTime DateCreated { get; set; } - public Guid UniqueRef { get; set; } + public class Shipper + : IHasIntId + { + public int Id { get; set; } + public string CompanyName { get; set; } + public ShipperType ShipperType { get; set; } + public DateTime DateCreated { get; set; } + public Guid UniqueRef { get; set; } - public override bool Equals(object obj) - { - var other = obj as Shipper; - if (other == null) return false; - return this.Id == other.Id && this.UniqueRef == other.UniqueRef; - } + public override bool Equals(object obj) + { + var other = obj as Shipper; + if (other == null) return false; + return this.Id == other.Id && this.UniqueRef == other.UniqueRef; + } - public override int GetHashCode() - { - return string.Concat(Id, UniqueRef).GetHashCode(); - } - } + public override int GetHashCode() + { + return string.Concat(Id, UniqueRef).GetHashCode(); + } + } - public enum ShipperType - { - All = Planes | Trains | Automobiles, - Unknown = 0, - Planes = 1, - Trains = 2, - Automobiles = 4 - } + public enum ShipperType + { + All = Planes | Trains | Automobiles, + Unknown = 0, + Planes = 1, + Trains = 2, + Automobiles = 4 + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/ShipperFactory.cs b/tests/ServiceStack.Common.Tests/Models/ShipperFactory.cs index 0387177c4ae..713784e8abe 100644 --- a/tests/ServiceStack.Common.Tests/Models/ShipperFactory.cs +++ b/tests/ServiceStack.Common.Tests/Models/ShipperFactory.cs @@ -3,28 +3,29 @@ namespace ServiceStack.Common.Tests.Models { - public class ShipperFactory - : ModelFactoryBase - { - public override Shipper CreateInstance(int i) - { - var hex = ((i % 240) + 16).ToString("X"); - return new Shipper { - Id = i, - CompanyName = "Shipper" + i, + public class ShipperFactory + : ModelFactoryBase + { + public override Shipper CreateInstance(int i) + { + var hex = ((i % 240) + 16).ToString("X"); + return new Shipper + { + Id = i, + CompanyName = "Shipper" + i, DateCreated = new DateTime(i + 1 % 3000, (i % 11) + 1, (i % 27) + 1, 0, 0, 0, DateTimeKind.Utc), - ShipperType = (ShipperType)(i % 3), - UniqueRef = new Guid(hex + "D148A5-E5F1-4E5A-8C60-52E5A80ACCC6"), - }; - } + ShipperType = (ShipperType)(i % 3), + UniqueRef = new Guid(hex + "D148A5-E5F1-4E5A-8C60-52E5A80ACCC6"), + }; + } - public override void AssertIsEqual(Shipper actual, Shipper expected) - { - Assert.That(actual.Id, Is.EqualTo(expected.Id)); - Assert.That(actual.CompanyName, Is.EqualTo(expected.CompanyName)); - Assert.That(actual.ShipperType, Is.EqualTo(expected.ShipperType)); - Assert.That(actual.DateCreated, Is.EqualTo(expected.DateCreated)); - Assert.That(actual.UniqueRef, Is.EqualTo(expected.UniqueRef)); - } - } + public override void AssertIsEqual(Shipper actual, Shipper expected) + { + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.CompanyName, Is.EqualTo(expected.CompanyName)); + Assert.That(actual.ShipperType, Is.EqualTo(expected.ShipperType)); + Assert.That(actual.DateCreated, Is.EqualTo(expected.DateCreated)); + Assert.That(actual.UniqueRef, Is.EqualTo(expected.UniqueRef)); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Models/TaskQueue.cs b/tests/ServiceStack.Common.Tests/Models/TaskQueue.cs index a780f77bc2e..355e15ec500 100644 --- a/tests/ServiceStack.Common.Tests/Models/TaskQueue.cs +++ b/tests/ServiceStack.Common.Tests/Models/TaskQueue.cs @@ -6,70 +6,71 @@ namespace ServiceStack.Common.Tests.Models { - public class TaskQueue - { - private static readonly ILog Log = LogManager.GetLogger(typeof(TaskQueue)); - - public const string TaskLoad = "Load"; - public const string TaskIndex = "Index"; - - public const string StatusPending = "Pending"; - public const string StatusStarted = "Started"; - public const string StatusCompleted = "Completed"; - public const string StatusFailed = "Failed"; - - public const int PriorityLow = 0; - public const int PriorityMedium = 1; - public const int PriorityHigh = 2; - - public int Id { get; set; } - - public Guid? UserId { get; set; } - - public string Task { get; set; } - - public string ContentUrn { get; set; } - - public string Status { get; set; } - - public DateTime CreatedDate { get; set; } - - public int Priority { get; set; } - - public int NoOfAttempts { get; set; } - - public string ErrorMessage { get; set; } - - public static TaskQueue Create(int id) - { - return new TaskQueue { - ContentUrn = "urn:track:" + id, - CreatedDate = DateTime.Now, - Task = TaskLoad, - Status = StatusPending, - NoOfAttempts = 0, - }; - } - - public static void AssertIsEqual(TaskQueue actual, TaskQueue expected) - { - Assert.That(actual.Id, Is.EqualTo(expected.Id)); - Assert.That(actual.UserId, Is.EqualTo(expected.UserId)); - Assert.That(actual.ContentUrn, Is.EqualTo(expected.ContentUrn)); - Assert.That(actual.Status, Is.EqualTo(expected.Status)); - try - { - Assert.That(actual.CreatedDate, Is.EqualTo(expected.CreatedDate)); - } - catch (Exception ex) - { - Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); - Assert.That(actual.CreatedDate.RoundToSecond(), Is.EqualTo(expected.CreatedDate.RoundToSecond())); - } - Assert.That(actual.Priority, Is.EqualTo(expected.Priority)); - Assert.That(actual.NoOfAttempts, Is.EqualTo(expected.NoOfAttempts)); - Assert.That(actual.ErrorMessage, Is.EqualTo(expected.ErrorMessage)); - } - - } + public class TaskQueue + { + private static readonly ILog Log = LogManager.GetLogger(typeof(TaskQueue)); + + public const string TaskLoad = "Load"; + public const string TaskIndex = "Index"; + + public const string StatusPending = "Pending"; + public const string StatusStarted = "Started"; + public const string StatusCompleted = "Completed"; + public const string StatusFailed = "Failed"; + + public const int PriorityLow = 0; + public const int PriorityMedium = 1; + public const int PriorityHigh = 2; + + public int Id { get; set; } + + public Guid? UserId { get; set; } + + public string Task { get; set; } + + public string ContentUrn { get; set; } + + public string Status { get; set; } + + public DateTime CreatedDate { get; set; } + + public int Priority { get; set; } + + public int NoOfAttempts { get; set; } + + public string ErrorMessage { get; set; } + + public static TaskQueue Create(int id) + { + return new TaskQueue + { + ContentUrn = "urn:track:" + id, + CreatedDate = DateTime.Now, + Task = TaskLoad, + Status = StatusPending, + NoOfAttempts = 0, + }; + } + + public static void AssertIsEqual(TaskQueue actual, TaskQueue expected) + { + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.UserId, Is.EqualTo(expected.UserId)); + Assert.That(actual.ContentUrn, Is.EqualTo(expected.ContentUrn)); + Assert.That(actual.Status, Is.EqualTo(expected.Status)); + try + { + Assert.That(actual.CreatedDate, Is.EqualTo(expected.CreatedDate)); + } + catch (Exception ex) + { + Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex); + Assert.That(actual.CreatedDate.RoundToSecond(), Is.EqualTo(expected.CreatedDate.RoundToSecond())); + } + Assert.That(actual.Priority, Is.EqualTo(expected.Priority)); + Assert.That(actual.NoOfAttempts, Is.EqualTo(expected.NoOfAttempts)); + Assert.That(actual.ErrorMessage, Is.EqualTo(expected.ErrorMessage)); + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/NativeTypesTests.cs b/tests/ServiceStack.Common.Tests/NativeTypesTests.cs new file mode 100644 index 00000000000..5f63207e6fa --- /dev/null +++ b/tests/ServiceStack.Common.Tests/NativeTypesTests.cs @@ -0,0 +1,432 @@ +#if !NETCORE_SUPPORT +using System; +using System.Linq; +using System.Reflection; +using NUnit.Framework; +using ServiceStack.Host; +using ServiceStack.NativeTypes.CSharp; +using ServiceStack.NativeTypes.Java; +using ServiceStack.Text; + +namespace ServiceStack.Common.Tests +{ + using System.Collections.Generic; + using NativeTypes; + using Testing; + + [TestFixture] + public class NativeTypesTests + { + ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = + new BasicAppHost(typeof(Dto).Assembly) + { + TestMode = true, + Plugins = { new NativeTypesFeature() }, + Config = new HostConfig() + }.Init(); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void GetIncludeList_Returns_IncludeList_If_NoIncludeTypes_HaveWildcard() + { + var includeTypes = new List { "Dto1", "DTO2" }; + var config = new MetadataTypesConfig + { + IncludeTypes = includeTypes + }; + + var result = MetadataExtensions.GetIncludeList(new MetadataTypes(), config); + Assert.AreEqual(includeTypes, result); + } + + [Test] + public void IncludeTypes_DoesNotReturnReferenceTypes_If_IncludeTypes_NoWildcard_Csharp() + { + var result = appHost.ExecuteService(new TypesCSharp + { + IncludeTypes = new List { "Dto" } + }); + + var stringResult = result.ToString(); + + StringAssert.DoesNotContain("class DtoResponse", stringResult); + StringAssert.DoesNotContain("EmbeddedRequest", stringResult); + StringAssert.DoesNotContain("class EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_ReturnsReferenceTypes_If_IncludeTypes_HasWildcard_Csharp() + { + var result = appHost.ExecuteService(new TypesCSharp + { + IncludeTypes = new List { "Dto.*" } + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("class DtoResponse", stringResult); + StringAssert.Contains("class EmbeddedRequest", stringResult); + StringAssert.Contains("class EmbeddedResponse", stringResult); + } + + [Test] + public void AnnotatedDtoTypes_ApiMemberNonDefaultProperties_AreSorted() + { + var result = appHost.ExecuteService(new TypesCSharp + { + IncludeTypes = new List { "DtoResponse" } + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("class DtoResponse", stringResult); + StringAssert.Contains("[ApiMember(Description=\"ShouldBeFirstInGeneratedCode\", IsRequired=true, Name=\"ShouldBeLastInGeneratedCode\")]", stringResult); + } + + [Test] + public void IncludeTypes_DoesNotReturnReferenceTypes_If_IncludeTypes_NoWildcard_Fsharp() + { + var result = appHost.ExecuteService(new TypesFSharp + { + IncludeTypes = new List { "Dto" } + }); + + var stringResult = result.ToString(); + + StringAssert.DoesNotContain("type DtoResponse", stringResult); + StringAssert.DoesNotContain("EmbeddedRequest", stringResult); + StringAssert.DoesNotContain("type EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_ReturnsReferenceTypes_If_IncludeTypes_HasWildcard_Fsharp() + { + var result = appHost.ExecuteService(new TypesFSharp + { + IncludeTypes = new List { "Dto.*" } + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("type DtoResponse", stringResult); + StringAssert.Contains("type EmbeddedRequest", stringResult); + StringAssert.Contains("type EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_DoesNotReturnReferenceTypes_If_IncludeTypes_NoWildcard_VbNet() + { + var result = appHost.ExecuteService(new TypesVbNet() + { + IncludeTypes = new List { "Dto" } + }); + + var stringResult = result.ToString(); + + StringAssert.DoesNotContain("Class DtoResponse", stringResult); + StringAssert.DoesNotContain("EmbeddedRequest", stringResult); + StringAssert.DoesNotContain("Class EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_ReturnsReferenceTypes_If_IncludeTypes_HasWildcard_VbNet() + { + var result = appHost.ExecuteService(new TypesVbNet + { + IncludeTypes = new List { "Dto.*" } + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("Class DtoResponse", stringResult); + StringAssert.Contains("Class EmbeddedRequest", stringResult); + StringAssert.Contains("Class EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_DoesNotReturnReferenceTypes_If_IncludeTypes_NoWildcard_Kotlin() + { + var result = appHost.ExecuteService(new TypesKotlin + { + IncludeTypes = new List { "Dto" } + }); + + var stringResult = result.ToString(); + + StringAssert.DoesNotContain("class DtoResponse", stringResult); + StringAssert.DoesNotContain("EmbeddedRequest", stringResult); + StringAssert.DoesNotContain("class EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_ReturnsReferenceTypes_If_IncludeTypes_HasWildcard_Kotlin() + { + var result = appHost.ExecuteService(new TypesKotlin + { + IncludeTypes = new List { "Dto.*" } + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("class DtoResponse", stringResult); + StringAssert.Contains("class EmbeddedRequest", stringResult); + StringAssert.Contains("class EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_DoesNotReturnReferenceTypes_If_IncludeTypes_NoWildcard_Java() + { + var result = appHost.ExecuteService(new TypesJava + { + IncludeTypes = new List { "Dto" } + }); + + var stringResult = result.ToString(); + + StringAssert.DoesNotContain("class DtoResponse", stringResult); + StringAssert.DoesNotContain("EmbeddedRequest", stringResult); + StringAssert.DoesNotContain("class EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_ReturnsReferenceTypes_If_IncludeTypes_HasWildcard_Java() + { + var result = appHost.ExecuteService(new TypesJava + { + IncludeTypes = new List { "Dto.*" } + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("class DtoResponse", stringResult); + StringAssert.Contains("class EmbeddedRequest", stringResult); + StringAssert.Contains("class EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_DoesNotReturnReferenceTypes_If_IncludeTypes_NoWildcard_Swift() + { + var result = appHost.ExecuteService(new TypesSwift + { + IncludeTypes = new List { "Dto" } + }); + + var stringResult = result.ToString(); + + StringAssert.DoesNotContain("class DtoResponse", stringResult); + StringAssert.DoesNotContain("EmbeddedRequest", stringResult); + StringAssert.DoesNotContain("class EmbeddedResponse", stringResult); + } + + [Test] + public void IncludeTypes_ReturnsReferenceTypes_If_IncludeTypes_HasWildcard_Swift() + { + var result = appHost.ExecuteService(new TypesSwift + { + IncludeTypes = new List { "Dto.*" } + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("class DtoResponse", stringResult); + StringAssert.Contains("class EmbeddedRequest", stringResult); + StringAssert.Contains("class EmbeddedResponse", stringResult); + } + + [Test] + public void GetIncludeList_Returns_IncludeList_when_Returning_generic_List() + { + var includeTypes = new List { "GetRequest1", "ReturnedDto" }; + var config = new MetadataTypesConfig + { + IncludeTypes = includeTypes + }; + + var result = MetadataExtensions.GetIncludeList(new MetadataTypes(), config); + result.PrintDump(); + + Assert.AreEqual(includeTypes, result); + } + + [Test] + public void Custom_ValueTypes_defaults_to_use_opaque_strings_csharp() + { + var result = appHost.ExecuteService(new TypesCSharp + { + IncludeTypes = new List { "DtoRequestWithStructProperty" }, + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("class DtoRequestWithStructProperty", stringResult); + StringAssert.Contains("public virtual string StructType { get; set; }", stringResult); + StringAssert.Contains("public virtual string NullableStructType { get; set; }", stringResult); + } + + [Test] + public void Custom_ValueTypes_can_be_exported_csharp() + { + var result = appHost.ExecuteService(new TypesCSharp + { + IncludeTypes = new List { "DtoRequestWithStructProperty" }, + ExportValueTypes = true, + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("class DtoRequestWithStructProperty", stringResult); + StringAssert.Contains("public virtual StructType StructType { get; set; }", stringResult); + StringAssert.Contains("public virtual StructType? NullableStructType { get; set; }", stringResult); + } + + [Test] + public void Custom_ValueTypes_can_be_exported_as_different_Type_in_java() + { + JavaGenerator.TypeAliases["StructType"] = "JavaStruct"; + + var result = appHost.ExecuteService(new TypesJava + { + IncludeTypes = new List { "DtoRequestWithStructProperty" }, + ExportValueTypes = true, + }); + + var stringResult = result.ToString(); + + StringAssert.Contains("class DtoRequestWithStructProperty", stringResult); + StringAssert.Contains("public JavaStruct StructType = null;", stringResult); + StringAssert.Contains("public JavaStruct NullableStructType = null;", stringResult); + + string value; + JavaGenerator.TypeAliases.TryRemove("StructType", out value); + } + + public enum ComparisonOperator + { + Equals = 0, + NotEqual = 1, + } + + [Test] + public void Can_access_enum_with_Equals_member() + { + var enumNames = new List(); + var enumValues = new List(); + + var type = typeof(ComparisonOperator); + var names = Enum.GetNames(type); + for (var i = 0; i < names.Length; i++) + { + var name = names[i]; + var enumMember = MetadataTypesGenerator.GetEnumMember(type, name); + var value = enumMember.GetRawConstantValue(); + var enumValue = Convert.ToInt64(value).ToString(); + + enumNames.Add(name); + enumValues.Add(enumValue); + } + + Assert.That(enumNames, Is.EquivalentTo(new[]{ "Equals", "NotEqual" })); + Assert.That(enumValues, Is.EquivalentTo(new[]{ "0", "1" })); + } + + [Test] + public void Can_write_ValidateRequestAttribute() + { + var gen = appHost.AssertPlugin().DefaultGenerator; + var attr = new ValidateRequestAttribute("HasRole('Accounts')") { + ErrorCode = "ExCode", + Message = "'Id' Is Required", + }; + var metaAttr = gen.ToAttribute(attr); + string argValue(string name) => metaAttr.Args.First(x => x.Name == name).Value; + Assert.That(metaAttr.Name, Is.EqualTo("ValidateRequest")); + Assert.That(metaAttr.Args.Count, Is.EqualTo(3)); + Assert.That(argValue(nameof(ValidateRequestAttribute.Validator)), Is.EqualTo("HasRole('Accounts')")); + Assert.That(argValue(nameof(ValidateRequestAttribute.ErrorCode)), Is.EqualTo("ExCode")); + Assert.That(argValue(nameof(ValidateRequestAttribute.Message)), Is.EqualTo("'Id' Is Required")); + + var csharp = new CSharpGenerator(new MetadataTypesConfig { + DefaultNamespaces = new List { + "ServiceStack" + } + }); + var src = csharp.GetCode(new MetadataTypes { + Types = new List { + new MetadataType { + Name = "TheType", + Attributes = new List { + metaAttr, + } + } + } + }, new BasicRequest()); + + src.Print(); + + Assert.That(src, Does.Contain( + "[ValidateRequest(\"HasRole('Accounts')\", ErrorCode=\"ExCode\", Message=\"'Id' Is Required\")]")); + } + } + + public class NativeTypesTestService : Service + { + public object Any(Dto request) => request; + + public object Any(DtoRequestWithStructProperty request) => request; + } + + public class Dto : IReturn + { + public EmbeddedResponse ReferencedType { get; set; } + } + + public class DtoResponse + { + [ApiMember(Name = "ShouldBeLastInGeneratedCode", Description = "ShouldBeFirstInGeneratedCode", IsRequired = true)] + public EmbeddedRequest ReferencedType { get; set; } + } + + public class EmbeddedResponse { } + public class EmbeddedRequest { } + + + [Route("/Request1/", "GET")] + public partial class GetRequest1 : IReturn>, IGet { } + + [Route("/Request3", "GET")] + public partial class GetRequest2 : IReturn, IGet {} + + public partial class ReturnedDto + { + public virtual int Id { get; set; } + } + + public class ReturnGenericListServices : Service + { + public object Any(GetRequest1 request) => request; + public object Any(GetRequest2 request) => request; + } + + public class DtoRequestWithStructProperty : IReturn + { + public StructType StructType { get; set; } + public StructType? NullableStructType { get; set; } + } + + public struct StructType + { + public int Id; + } +} +#endif diff --git a/tests/ServiceStack.Common.Tests/NetCoreTestsRunner.cs b/tests/ServiceStack.Common.Tests/NetCoreTestsRunner.cs new file mode 100644 index 00000000000..3fd2c6bac48 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/NetCoreTestsRunner.cs @@ -0,0 +1,38 @@ +#if NUNITLITE +using NUnitLite; +using NUnit.Common; +using System.Reflection; +using ServiceStack; +using ServiceStack.Text; +using System; +using System.Globalization; +using System.Threading; + +namespace NUnitLite.Tests +{ + public class NetCoreTestsRunner + { + /// + /// The main program executes the tests. Output may be routed to + /// various locations, depending on the arguments passed. + /// + /// Run with --help for a full list of arguments supported + /// + public static int Main(string[] args) + { + var licenseKey = Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE"); + if (licenseKey.IsNullOrEmpty()) + throw new ArgumentNullException("SERVICESTACK_LICENSE", "Add Environment variable for SERVICESTACK_LICENSE"); + + Licensing.RegisterLicense(licenseKey); + //"ActivatedLicenseFeatures: ".Print(LicenseUtils.ActivatedLicenseFeatures()); + + CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); + JsConfig.InitStatics(); + //JsonServiceClient client = new JsonServiceClient(); + var writer = new ExtendedTextWrapper(Console.Out); + return new AutoRun(((IReflectableType)typeof(NetCoreTestsRunner)).GetTypeInfo().Assembly).Execute(args, writer, Console.In); + } + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/AuthUserSessionTests.cs b/tests/ServiceStack.Common.Tests/OAuth/AuthUserSessionTests.cs new file mode 100644 index 00000000000..8770818e1b4 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/OAuth/AuthUserSessionTests.cs @@ -0,0 +1,472 @@ +#if !NETCORE_SUPPORT +using System; +using System.Collections.Generic; +using System.Globalization; +using Amazon.DynamoDBv2; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Aws.DynamoDb; +using ServiceStack.Configuration; +using ServiceStack.OrmLite; +using ServiceStack.Redis; +using ServiceStack.Testing; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.Common.Tests.OAuth +{ + public class InMemoryAuthUserSessionTests : AuthUserSessionTests + { + public override IUserAuthRepository CreateAuthRepo() + { + var inMemoryRepo = new InMemoryAuthRepository(); + inMemoryRepo.Clear(); + InitTest(inMemoryRepo); + return inMemoryRepo; + } + } + + public class RedisAuthUserSessionTests : AuthUserSessionTests + { + public override IUserAuthRepository CreateAuthRepo() + { + var appSettings = new AppSettings(); + var redisRepo = new RedisAuthRepository( + new BasicRedisClientManager(appSettings.GetString("Redis.Host") ?? "localhost")); + redisRepo.Clear(); + InitTest(redisRepo); + return redisRepo; + } + } + + [Ignore("Integration Test")] + public class DynamoDbAuthUserSessionTests : AuthUserSessionTests + { + public override IUserAuthRepository CreateAuthRepo() + { + var db = new PocoDynamo(TestsConfig.CreateDynamoDBClient()); + db.DeleteAllTables(); + var dynamoDbRepo = new DynamoDbAuthRepository(db); + dynamoDbRepo.Clear(); + InitTest(dynamoDbRepo); + dynamoDbRepo.InitSchema(); + return dynamoDbRepo; + } + } + + public class OrmLiteSqlServerAuthUserSessionTests : AuthUserSessionTests + { + public override IUserAuthRepository CreateAuthRepo() + { + var sqlServerFactory = new OrmLiteConnectionFactory( + TestsConfig.SqlServerConnString, + SqlServerDialect.Provider); + var sqlServerRepo = new OrmLiteAuthRepository(sqlServerFactory); + try { sqlServerRepo.Clear(); } catch {} + sqlServerRepo.InitSchema(); + InitTest(sqlServerRepo); + return sqlServerRepo; + } + } + + public class OrmLiteSqliteMemoryAuthUserSessionTests : AuthUserSessionTests + { + public override IUserAuthRepository CreateAuthRepo() + { + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); + var sqliteRepo = new OrmLiteAuthRepository(dbFactory); + sqliteRepo.InitSchema(); + InitTest(sqliteRepo); + return sqliteRepo; + } + } + + [TestFixture] + public abstract class AuthUserSessionTests : AuthUserSessionTestsBase + { + private ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + RegisterService.AllowUpdates = true; + appHost = new BasicAppHost().Init(); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + RegisterService.AllowUpdates = false; + appHost.Dispose(); + } + + public abstract IUserAuthRepository CreateAuthRepo(); + + public IUserAuthRepository InitAuthRepo() + { + var authRepo = CreateAuthRepo(); + appHost.Container.Register(authRepo); + return authRepo; + } + + [Test] + public void Does_persist_TwitterOAuth() + { + var userAuthRepository = InitAuthRepo(); + + MockAuthHttpGateway.Tokens = twitterGatewayTokens; + + var authInfo = new Dictionary { + {"user_id", "133371690876022785"}, + {"screen_name", "demisbellot"}, + }; + + var oAuthUserSession = requestContext.ReloadSession(); + + var twitterAuth = GetTwitterAuthProvider(); + twitterAuth.OnAuthenticated(service, oAuthUserSession, twitterAuthTokens, authInfo); + + oAuthUserSession = requestContext.ReloadSession(); + + Assert.That(oAuthUserSession.UserAuthId, Is.Not.Null); + + var userAuth = userAuthRepository.GetUserAuth(oAuthUserSession.UserAuthId); + Assert.That(userAuth.Id.ToString(CultureInfo.InvariantCulture), Is.EqualTo(oAuthUserSession.UserAuthId)); + Assert.That(userAuth.DisplayName, Is.EqualTo("Demis Bellot TW")); + + var authProviders = userAuthRepository.GetUserAuthDetails(oAuthUserSession.UserAuthId); + Assert.That(authProviders.Count, Is.EqualTo(1)); + var authProvider = authProviders[0]; + Assert.That(authProvider.UserAuthId, Is.EqualTo(userAuth.Id)); + Assert.That(authProvider.DisplayName, Is.EqualTo("Demis Bellot TW")); + Assert.That(authProvider.FirstName, Is.Null); + Assert.That(authProvider.LastName, Is.Null); + Assert.That(authProvider.RequestToken, Is.EqualTo(twitterAuthTokens.RequestToken)); + Assert.That(authProvider.RequestTokenSecret, Is.EqualTo(twitterAuthTokens.RequestTokenSecret)); + + Console.WriteLine(authProviders.Dump()); + } + + [Test] + public void Does_persist_FacebookOAuth() + { + var userAuthRepository = InitAuthRepo(); + + var serviceTokens = MockAuthHttpGateway.Tokens = facebookGatewayTokens; + + var oAuthUserSession = requestContext.ReloadSession(); + var facebookAuth = GetFacebookAuthProvider(); + facebookAuth.OnAuthenticated(service, oAuthUserSession, facebookAuthTokens, + JsonObject.Parse(facebookAuth.AuthHttpGateway.DownloadFacebookUserInfo("facebookCode"))); + + oAuthUserSession = requestContext.ReloadSession(); + + Assert.That(oAuthUserSession.FacebookUserId, Is.EqualTo(serviceTokens.UserId)); + + Assert.That(oAuthUserSession.UserAuthId, Is.Not.Null); + + var userAuth = userAuthRepository.GetUserAuth(oAuthUserSession.UserAuthId); + Assert.That(userAuth.Id.ToString(CultureInfo.InvariantCulture), Is.EqualTo(oAuthUserSession.UserAuthId)); + Assert.That(userAuth.DisplayName, Is.EqualTo(serviceTokens.DisplayName)); + Assert.That(userAuth.FirstName, Is.EqualTo(serviceTokens.FirstName)); + Assert.That(userAuth.LastName, Is.EqualTo(serviceTokens.LastName)); + Assert.That(userAuth.PrimaryEmail, Is.EqualTo(serviceTokens.Email)); + + var authProviders = userAuthRepository.GetUserAuthDetails(oAuthUserSession.UserAuthId); + Assert.That(authProviders.Count, Is.EqualTo(1)); + var authProvider = authProviders[0]; + Assert.That(authProvider.UserAuthId, Is.EqualTo(userAuth.Id)); + Assert.That(authProvider.DisplayName, Is.EqualTo(serviceTokens.DisplayName)); + Assert.That(authProvider.FirstName, Is.EqualTo(serviceTokens.FirstName)); + Assert.That(authProvider.LastName, Is.EqualTo(serviceTokens.LastName)); + Assert.That(authProvider.Email, Is.EqualTo(serviceTokens.Email)); + Assert.That(authProvider.RequestToken, Is.Null); + Assert.That(authProvider.RequestTokenSecret, Is.Null); + Assert.That(authProvider.AccessToken, Is.Null); + Assert.That(authProvider.AccessTokenSecret, Is.EqualTo(facebookAuthTokens.AccessTokenSecret)); + + Console.WriteLine(authProviders.Dump()); + } + + [Test] + public void Does_merge_FacebookOAuth_TwitterOAuth() + { + var userAuthRepository = InitAuthRepo(); + + var serviceTokensFb = MockAuthHttpGateway.Tokens = facebookGatewayTokens; + + var oAuthUserSession = requestContext.ReloadSession(); + var facebookAuth = GetFacebookAuthProvider(); + facebookAuth.OnAuthenticated(service, oAuthUserSession, facebookAuthTokens, + JsonObject.Parse(facebookAuth.AuthHttpGateway.DownloadFacebookUserInfo("facebookCode"))); + + oAuthUserSession = requestContext.ReloadSession(); + + var serviceTokensTw = MockAuthHttpGateway.Tokens = twitterGatewayTokens; + var authInfo = new Dictionary { + {"user_id", "17575623"}, + {"screen_name", "demisbellot"}, + }; + var twitterAuth = GetTwitterAuthProvider(); + twitterAuth.OnAuthenticated(service, oAuthUserSession, twitterAuthTokens, authInfo); + + oAuthUserSession = requestContext.ReloadSession(); + + Assert.That(oAuthUserSession.TwitterUserId, Is.EqualTo(authInfo["user_id"])); + Assert.That(oAuthUserSession.TwitterScreenName, Is.EqualTo(authInfo["screen_name"])); + + var userAuth = userAuthRepository.GetUserAuth(oAuthUserSession.UserAuthId); + Assert.That(userAuth.Id.ToString(CultureInfo.InvariantCulture), Is.EqualTo(oAuthUserSession.UserAuthId)); + Assert.That(userAuth.DisplayName, Is.EqualTo(serviceTokensFb.DisplayName)); + Assert.That(userAuth.PrimaryEmail, Is.EqualTo(serviceTokensFb.Email)); + Assert.That(userAuth.FirstName, Is.EqualTo(serviceTokensFb.FirstName)); + Assert.That(userAuth.LastName, Is.EqualTo(serviceTokensFb.LastName)); + + var authProviders = userAuthRepository.GetUserAuthDetails(oAuthUserSession.UserAuthId); + Assert.That(authProviders.Count, Is.EqualTo(2)); + + Console.WriteLine(userAuth.Dump()); + Console.WriteLine(authProviders.Dump()); + } + + [Test] + public void Can_login_with_user_created_CreateUserAuth() + { + var userAuthRepository = InitAuthRepo(); + + var registrationService = GetRegistrationService(userAuthRepository); + + var responseObj = registrationService.Post(RegisterDto); + + if (responseObj is IHttpResult httpResult) + { + Assert.Fail("HttpResult found: " + httpResult.Dump()); + } + + var response = (RegisterResponse)responseObj; + Assert.That(response.UserId, Is.Not.Null); + + var userAuth = userAuthRepository.GetUserAuth(response.UserId); + AssertEqual(userAuth, RegisterDto); + + IUserAuth userId; + userAuth = userAuthRepository.GetUserAuthByUserName(RegisterDto.UserName); + AssertEqual(userAuth, RegisterDto); + + var success = userAuthRepository.TryAuthenticate(RegisterDto.UserName, RegisterDto.Password, out userId); + Assert.That(success, Is.True); + Assert.That(userId, Is.Not.Null); + + //DynamoDb can't support both UserName and Email + if (!(userAuthRepository is DynamoDbAuthRepository)) + { + userAuth = userAuthRepository.GetUserAuthByUserName(RegisterDto.Email); + AssertEqual(userAuth, RegisterDto); + + success = userAuthRepository.TryAuthenticate(RegisterDto.Email, RegisterDto.Password, out userId); + Assert.That(success, Is.True); + Assert.That(userId, Is.Not.Null); + } + + success = userAuthRepository.TryAuthenticate(RegisterDto.UserName, "Bad Password", out userId); + Assert.That(success, Is.False); + Assert.That(userId, Is.Null); + } + + + [Test] + public void Can_login_with_user_created_CreateUserAuth_Email() + { + var userAuthRepository = InitAuthRepo(); + + //Clear Username so only Email is registered + RegisterDto.UserName = null; + + var registrationService = GetRegistrationService(userAuthRepository); + + var responseObj = registrationService.Post(RegisterDto); + + if (responseObj is IHttpResult httpResult) + { + Assert.Fail("HttpResult found: " + httpResult.Dump()); + } + + var response = (RegisterResponse)responseObj; + Assert.That(response.UserId, Is.Not.Null); + + var userAuth = userAuthRepository.GetUserAuth(response.UserId); + AssertEqual(userAuth, RegisterDto); + + IUserAuth userId; + userAuth = userAuthRepository.GetUserAuthByUserName(RegisterDto.Email); + AssertEqual(userAuth, RegisterDto); + + var success = userAuthRepository.TryAuthenticate(RegisterDto.Email, RegisterDto.Password, out userId); + Assert.That(success, Is.True); + Assert.That(userId, Is.Not.Null); + + success = userAuthRepository.TryAuthenticate(RegisterDto.Email, "Bad Password", out userId); + Assert.That(success, Is.False); + Assert.That(userId, Is.Null); + } + + [Test] + public void Logging_in_pulls_all_AuthInfo_from_repo_after_logging_in_all_AuthProviders() + { + var userAuthRepository = InitAuthRepo(); + + var oAuthUserSession = requestContext.ReloadSession(); + + //Facebook + LoginWithFacebook(oAuthUserSession); + + //Twitter + MockAuthHttpGateway.Tokens = twitterGatewayTokens; + var authInfo = new Dictionary { + {"user_id", "17575623"}, + {"screen_name", "demisbellot"}, + }; + var twitterAuth = GetTwitterAuthProvider(); + twitterAuth.OnAuthenticated(service, oAuthUserSession, twitterAuthTokens, authInfo); + Console.WriteLine("UserId: " + oAuthUserSession.UserAuthId); + + //Register + var registrationService = GetRegistrationService(userAuthRepository, oAuthUserSession, requestContext); + + var responseObj = registrationService.Post(RegisterDto); + Assert.That(responseObj as IHttpError, Is.Null, responseObj.ToString()); + + Console.WriteLine("UserId: " + oAuthUserSession.UserAuthId); + + var credentialsAuth = GetCredentialsAuthConfig(); + var loginResponse = credentialsAuth.Authenticate(service, oAuthUserSession, + new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = RegisterDto.UserName, + Password = RegisterDto.Password, + }); + + oAuthUserSession = requestContext.ReloadSession(); + + Assert.That(oAuthUserSession.TwitterUserId, Is.EqualTo(authInfo["user_id"])); + Assert.That(oAuthUserSession.TwitterScreenName, Is.EqualTo(authInfo["screen_name"])); + + var userAuth = userAuthRepository.GetUserAuth(oAuthUserSession.UserAuthId); + Assert.That(userAuth.Id.ToString(CultureInfo.InvariantCulture), Is.EqualTo(oAuthUserSession.UserAuthId)); + Assert.That(userAuth.DisplayName, Is.EqualTo(RegisterDto.DisplayName)); + Assert.That(userAuth.FirstName, Is.EqualTo(RegisterDto.FirstName)); + Assert.That(userAuth.LastName, Is.EqualTo(RegisterDto.LastName)); + Assert.That(userAuth.Email, Is.EqualTo(RegisterDto.Email)); + + Console.WriteLine(oAuthUserSession.Dump()); + Assert.That(oAuthUserSession.ProviderOAuthAccess.Count, Is.EqualTo(2)); + Assert.That(oAuthUserSession.IsAuthenticated, Is.True); + + var authProviders = userAuthRepository.GetUserAuthDetails(oAuthUserSession.UserAuthId); + Assert.That(authProviders.Count, Is.EqualTo(2)); + + Console.WriteLine(userAuth.Dump()); + Console.WriteLine(authProviders.Dump()); + } + + [Test] + public void Registering_twice_creates_two_registrations() + { + var userAuthRepository = InitAuthRepo(); + + var oAuthUserSession = requestContext.ReloadSession(); + + RegisterAndLogin(userAuthRepository, oAuthUserSession); + + requestContext.RemoveSession(); + + var userName1 = RegisterDto.UserName; + var userName2 = "UserName2"; + RegisterDto.UserName = userName2; + RegisterDto.Email = "as@if2.com"; + + var userAuth1 = userAuthRepository.GetUserAuthByUserName(userName1); + Assert.That(userAuth1, Is.Not.Null); + + Register(userAuthRepository, null, RegisterDto); + + userAuth1 = userAuthRepository.GetUserAuthByUserName(userName1); + var userAuth2 = userAuthRepository.GetUserAuthByUserName(userName2); + + Assert.That(userAuth1, Is.Not.Null); + Assert.That(userAuth2, Is.Not.Null); + } + + [Test] + public void Registering_twice_in_same_session_updates_registration() + { + var userAuthRepository = InitAuthRepo(); + + var oAuthUserSession = requestContext.ReloadSession(); + + oAuthUserSession = RegisterAndLogin(userAuthRepository, oAuthUserSession); + + var userName1 = RegisterDto.UserName; + var userName2 = "UserName2"; + RegisterDto.UserName = userName2; + + Register(userAuthRepository, oAuthUserSession, RegisterDto); + + var userAuth1 = userAuthRepository.GetUserAuthByUserName(userName1); + var userAuth2 = userAuthRepository.GetUserAuthByUserName(userName2); + + Assert.That(userAuth1, Is.Null); + Assert.That(userAuth2, Is.Not.Null); + } + + [Test] + public void Connecting_to_facebook_whilst_authenticated_connects_account() + { + var userAuthRepository = InitAuthRepo(); + + var oAuthUserSession = requestContext.ReloadSession(); + + oAuthUserSession = RegisterAndLogin(userAuthRepository, oAuthUserSession); + + LoginWithFacebook(oAuthUserSession); + + var userAuth = userAuthRepository.GetUserAuthByUserName(RegisterDto.UserName); + + Assert.That(userAuth.UserName, Is.EqualTo(RegisterDto.UserName)); + + var userAuthProviders = userAuthRepository.GetUserAuthDetails(userAuth.Id.ToString(CultureInfo.InvariantCulture)); + Assert.That(userAuthProviders.Count, Is.EqualTo(1)); + } + + [Test] + public void Can_AutoLogin_whilst_Registering() + { + var userAuthRepository = InitAuthRepo(); + var oAuthUserSession = requestContext.ReloadSession(); + RegisterDto.AutoLogin = true; + Register(userAuthRepository, oAuthUserSession, RegisterDto); + + oAuthUserSession = requestContext.ReloadSession(); + Assert.That(oAuthUserSession.IsAuthenticated, Is.True); + } + + [Test] + public void Can_DeleteUserAuth() + { + var userAuthRepository = InitAuthRepo(); + + var oAuthUserSession = requestContext.ReloadSession(); + oAuthUserSession = RegisterAndLogin(userAuthRepository, oAuthUserSession); + + var userAuth = userAuthRepository.GetUserAuthByUserName(RegisterDto.UserName); + Assert.That(userAuth, Is.Not.Null); + + userAuthRepository.DeleteUserAuth(userAuth.Id.ToString()); + userAuth = userAuthRepository.GetUserAuthByUserName(RegisterDto.UserName); + Assert.That(userAuth, Is.Null); + } + + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/AuthUserSessionTestsBase.cs b/tests/ServiceStack.Common.Tests/OAuth/AuthUserSessionTestsBase.cs new file mode 100644 index 00000000000..8cb90c35fe8 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/OAuth/AuthUserSessionTestsBase.cs @@ -0,0 +1,234 @@ +#if !NETCORE_SUPPORT +using System; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Configuration; +using ServiceStack.Host; +using ServiceStack.Testing; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.Common.Tests.OAuth +{ + public abstract class AuthUserSessionTestsBase + { + public static bool LoadUserAuthRepositorys = true; + + //Can only use either 1 OrmLiteDialectProvider at 1-time SqlServer or Sqlite. + public static bool UseSqlServer = false; + + public static AuthUserSession GetNewSession2() + { + var oAuthUserSession = new AuthUserSession(); + return oAuthUserSession; + } + + public CredentialsAuthProvider GetCredentialsAuthConfig() + { + return new CredentialsAuthProvider(new AppSettings()); + } + + public TwitterAuthProvider GetTwitterAuthProvider() + { + return new TwitterAuthProvider(new AppSettings()) + { + AuthHttpGateway = new MockAuthHttpGateway(), + }; + } + + public FacebookAuthProvider GetFacebookAuthProvider() + { + return new FacebookAuthProvider(new AppSettings()) + { + AuthHttpGateway = new MockAuthHttpGateway(), + }; + } + + public class MockService : IServiceBase + { + public IAuthRepository AuthRepo { get; set; } + public IRequest Request { get; set; } + + + public T TryResolve() + { + if (typeof(T) == typeof(IAuthRepository)) + return (T)AuthRepo; + + throw new NotImplementedException(); + } + + public IResolver GetResolver() + { + return this; + } + + public T ResolveService() + { + throw new NotImplementedException(); + } + } + + + protected BasicRequest requestContext; + protected IServiceBase service; + + protected AuthTokens facebookGatewayTokens = new AuthTokens + { + UserId = "623501766", + DisplayName = "Demis Bellot FB", + FirstName = "Demis", + LastName = "Bellot", + Email = "demis.bellot@gmail.com", + }; + protected AuthTokens twitterGatewayTokens = new AuthTokens + { + DisplayName = "Demis Bellot TW" + }; + protected AuthTokens facebookAuthTokens = new AuthTokens + { + Provider = FacebookAuthProvider.Name, + AccessTokenSecret = "AAADDDCCCoR848BAMkQIZCRIKnVWZAvcKWqo7Ibvec8ebV9vJrfZAz8qVupdu5EbjFzmMmbwUFDbcNDea9H6rOn5SVn8es7KYZD", + }; + protected AuthTokens twitterAuthTokens = new AuthTokens + { + Provider = TwitterAuthProvider.Name, + RequestToken = "JGGZZ22CCqgB1GR5e0EmGFxzyxGTw2rwEFFcC8a9o7g", + RequestTokenSecret = "qKKCCUUJ2R10bMieVQZZad7iSwWkPYJmtBYzPoM9q0", + UserId = "133371690876022785", + }; + protected Register RegisterDto; + + protected void InitTest(IUserAuthRepository userAuthRepository) + { + try + { + ((IClearable)userAuthRepository).Clear(); + } + catch { /*ignore*/ } + + var appSettings = new DictionarySettings(); + + new AuthFeature(null, new IAuthProvider[] { + new CredentialsAuthProvider(), + new BasicAuthProvider(), + new FacebookAuthProvider(appSettings), + new TwitterAuthProvider(appSettings) + }) + .Register(null); + + requestContext = new BasicRequest + { + Headers = { + {"X-ss-id", SessionExtensions.CreateRandomSessionId() } + } + }; + service = new MockService { + AuthRepo = userAuthRepository, + Request = requestContext + }; + + RegisterDto = new Register + { + UserName = "UserName", + Password = "p@55word", + Email = "as@if.com", + DisplayName = "DisplayName", + FirstName = "FirstName", + LastName = "LastName", + }; + } + + public static RegisterService GetRegistrationService( + IUserAuthRepository userAuthRepository, + AuthUserSession oAuthUserSession = null, + BasicRequest request = null) + { + if (request == null) + request = new BasicRequest(); + if (oAuthUserSession == null) + oAuthUserSession = request.ReloadSession(); + + oAuthUserSession.Id = request.Response.CreateSessionId(request); + request.Items[Keywords.Session] = oAuthUserSession; + + var mockAppHost = new BasicAppHost(); + + mockAppHost.Container.Register(userAuthRepository); + + var authService = new AuthenticateService + { + Request = request, + }; + authService.SetResolver(mockAppHost); + mockAppHost.Register(authService); + + var registrationService = new RegisterService + { + Request = request, + RegistrationValidator = + new RegistrationValidator(), + }; + registrationService.SetResolver(mockAppHost); + + return registrationService; + } + + public static void AssertEqual(IUserAuth userAuth, Register request) + { + Assert.That(userAuth, Is.Not.Null); + Assert.That(userAuth.UserName, Is.EqualTo(request.UserName)); + Assert.That(userAuth.Email, Is.EqualTo(request.Email)); + Assert.That(userAuth.DisplayName, Is.EqualTo(request.DisplayName)); + Assert.That(userAuth.FirstName, Is.EqualTo(request.FirstName)); + Assert.That(userAuth.LastName, Is.EqualTo(request.LastName)); + } + + protected AuthUserSession RegisterAndLogin(IUserAuthRepository userAuthRepository, AuthUserSession oAuthUserSession) + { + Register(userAuthRepository, oAuthUserSession); + + Login(RegisterDto.UserName, RegisterDto.Password, oAuthUserSession); + + oAuthUserSession = requestContext.ReloadSession(); + return oAuthUserSession; + } + + protected object Login(string userName, string password, AuthUserSession oAuthUserSession = null) + { + if (oAuthUserSession == null) + oAuthUserSession = requestContext.ReloadSession(); + + var credentialsAuth = GetCredentialsAuthConfig(); + return credentialsAuth.Authenticate(service, oAuthUserSession, + new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = RegisterDto.UserName, + Password = RegisterDto.Password, + }); + } + + protected object Register(IUserAuthRepository userAuthRepository, AuthUserSession oAuthUserSession, Register register = null) + { + if (register == null) + register = RegisterDto; + + var registrationService = GetRegistrationService(userAuthRepository, oAuthUserSession, requestContext); + var response = registrationService.Post(register); + Assert.That(response as IHttpError, Is.Null); + return response; + } + + protected void LoginWithFacebook(AuthUserSession oAuthUserSession) + { + MockAuthHttpGateway.Tokens = facebookGatewayTokens; + var facebookAuth = GetFacebookAuthProvider(); + facebookAuth.OnAuthenticated(service, oAuthUserSession, facebookAuthTokens, + JsonObject.Parse(facebookAuth.AuthHttpGateway.DownloadFacebookUserInfo("facebookCode"))); + Console.WriteLine("UserId: " + oAuthUserSession.UserAuthId); + } + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/CredentialsServiceTests.cs b/tests/ServiceStack.Common.Tests/OAuth/CredentialsServiceTests.cs index af1ad5ab4a0..e76758c010c 100644 --- a/tests/ServiceStack.Common.Tests/OAuth/CredentialsServiceTests.cs +++ b/tests/ServiceStack.Common.Tests/OAuth/CredentialsServiceTests.cs @@ -1,4 +1,7 @@ -using Funq; +#if !NETCORE_SUPPORT +using System.Reflection; +using System.Threading.Tasks; +using Funq; using NUnit.Framework; using ServiceStack.Auth; using ServiceStack.Host; @@ -12,6 +15,8 @@ public class CredentialsServiceTests { public class CredentialsTestAppHost : BasicAppHost { + public CredentialsTestAppHost() : base(typeof(CredentialsServiceTests).Assembly) {} + public override void Configure(Container container) { Plugins.Add(new AuthFeature(() => new AuthUserSession(), @@ -31,9 +36,9 @@ class ValidateServiceRunner : ServiceRunner public ValidateServiceRunner(IAppHost appHost, ActionContext actionContext) : base(appHost, actionContext) { } - public override object HandleException(IRequest request, T requestDto, System.Exception ex) + public override Task HandleExceptionAsync(IRequest req, T requestDto, System.Exception ex) { - return DtoUtils.CreateErrorResponse(requestDto, ex); + return DtoUtils.CreateErrorResponse(requestDto, ex).InTask(); } } @@ -73,4 +78,5 @@ public void Requires_UserName_and_Password() } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/MockAuthHttpGateway.cs b/tests/ServiceStack.Common.Tests/OAuth/MockAuthHttpGateway.cs index f06d300b2e5..41550bb9bdd 100644 --- a/tests/ServiceStack.Common.Tests/OAuth/MockAuthHttpGateway.cs +++ b/tests/ServiceStack.Common.Tests/OAuth/MockAuthHttpGateway.cs @@ -1,24 +1,26 @@ +#if !NETCORE_SUPPORT using ServiceStack.Auth; using ServiceStack.Text; namespace ServiceStack.Common.Tests.OAuth { - public class MockAuthHttpGateway : IAuthHttpGateway - { - static MockAuthHttpGateway() - { - Tokens = new AuthTokens { - UserId = "623501766", - DisplayName = "Demis Bellot", - FirstName = "Demis", - LastName = "Bellot", - Email = "demis.bellot@gmail.com", - }; - } - - public static IAuthTokens Tokens { get; set; } - - static string JsonFacebook = @"{{ + public class MockAuthHttpGateway : IAuthHttpGateway + { + static MockAuthHttpGateway() + { + Tokens = new AuthTokens + { + UserId = "623501766", + DisplayName = "Demis Bellot", + FirstName = "Demis", + LastName = "Bellot", + Email = "demis.bellot@gmail.com", + }; + } + + public static IAuthTokens Tokens { get; set; } + + static string JsonFacebook = @"{{ ""id"": ""{0}"", ""name"": ""{1}"", ""first_name"": ""{2}"", @@ -38,9 +40,9 @@ static MockAuthHttpGateway() ""verified"": true, ""updated_time"": ""2011-10-08T08:43:41+0000"" }}"; - static string JsonTwitter = @"[{{""is_translator"":false,""geo_enabled"":false,""profile_background_color"":""000000"",""protected"":false,""default_profile"":false,""profile_background_tile"":false,""created_at"":""Sun Nov 23 17:42:51 +0000 2008"",""name"":""{0}"",""profile_background_image_url_https"":""https:\/\/si0.twimg.com\/profile_background_images\/192991651\/twitter-bg.jpg"",""profile_sidebar_fill_color"":""2A372F"",""listed_count"":36,""notifications"":null,""utc_offset"":0,""friends_count"":267,""description"":""StackExchangarista, JavaScript, C#, Web & Mobile developer. Creator of the ServiceStack.NET projects. "",""following"":null,""verified"":false,""profile_sidebar_border_color"":""D9D082"",""followers_count"":796,""profile_image_url"":""http:\/\/a2.twimg.com\/profile_images\/1598852740\/avatar_normal.png"",""contributors_enabled"":false,""profile_image_url_https"":""https:\/\/si0.twimg.com\/profile_images\/1598852740\/avatar_normal.png"",""status"":{{""possibly_sensitive"":false,""place"":null,""retweet_count"":37,""in_reply_to_screen_name"":null,""created_at"":""Mon Nov 07 02:34:23 +0000 2011"",""retweeted"":false,""in_reply_to_status_id_str"":null,""in_reply_to_user_id_str"":null,""contributors"":null,""id_str"":""133371690876022785"",""retweeted_status"":{{""possibly_sensitive"":false,""place"":null,""retweet_count"":37,""in_reply_to_screen_name"":null,""created_at"":""Mon Nov 07 02:32:15 +0000 2011"",""retweeted"":false,""in_reply_to_status_id_str"":null,""in_reply_to_user_id_str"":null,""contributors"":null,""id_str"":""133371151551447041"",""in_reply_to_user_id"":null,""in_reply_to_status_id"":null,""source"":""\u003Ca href=\""http:\/\/www.arstechnica.com\"" rel=\""nofollow\""\u003EArs auto-tweeter\u003C\/a\u003E"",""geo"":null,""favorited"":false,""id"":133371151551447041,""coordinates"":null,""truncated"":false,""text"":""Google: Microsoft uses patents when products \""stop succeeding\"": http:\/\/t.co\/50QFc1uJ by @binarybits""}},""in_reply_to_user_id"":null,""in_reply_to_status_id"":null,""source"":""web"",""geo"":null,""favorited"":false,""id"":133371690876022785,""coordinates"":null,""truncated"":false,""text"":""RT @arstechnica: Google: Microsoft uses patents when products \""stop succeeding\"": http:\/\/t.co\/50QFc1uJ by @binarybits""}},""profile_use_background_image"":true,""favourites_count"":238,""location"":""New York"",""id_str"":""17575623"",""default_profile_image"":false,""show_all_inline_media"":false,""profile_text_color"":""ABB8AF"",""screen_name"":""demisbellot"",""statuses_count"":9638,""profile_background_image_url"":""http:\/\/a0.twimg.com\/profile_background_images\/192991651\/twitter-bg.jpg"",""url"":""http:\/\/www.servicestack.net\/mythz_blog\/"",""time_zone"":""London"",""profile_link_color"":""43594A"",""id"":17575623,""follow_request_sent"":null,""lang"":""en""}}]"; + static string JsonTwitter = @"[{{""is_translator"":false,""geo_enabled"":false,""profile_background_color"":""000000"",""protected"":false,""default_profile"":false,""profile_background_tile"":false,""created_at"":""Sun Nov 23 17:42:51 +0000 2008"",""name"":""{0}"",""profile_background_image_url_https"":""https:\/\/si0.twimg.com\/profile_background_images\/192991651\/twitter-bg.jpg"",""profile_sidebar_fill_color"":""2A372F"",""listed_count"":36,""notifications"":null,""utc_offset"":0,""friends_count"":267,""description"":""StackExchangarista, JavaScript, C#, Web & Mobile developer. Creator of the ServiceStack.NET projects. "",""following"":null,""verified"":false,""profile_sidebar_border_color"":""D9D082"",""followers_count"":796,""profile_image_url"":""http:\/\/a2.twimg.com\/profile_images\/1598852740\/avatar_normal.png"",""contributors_enabled"":false,""profile_image_url_https"":""https:\/\/si0.twimg.com\/profile_images\/1598852740\/avatar_normal.png"",""status"":{{""possibly_sensitive"":false,""place"":null,""retweet_count"":37,""in_reply_to_screen_name"":null,""created_at"":""Mon Nov 07 02:34:23 +0000 2011"",""retweeted"":false,""in_reply_to_status_id_str"":null,""in_reply_to_user_id_str"":null,""contributors"":null,""id_str"":""133371690876022785"",""retweeted_status"":{{""possibly_sensitive"":false,""place"":null,""retweet_count"":37,""in_reply_to_screen_name"":null,""created_at"":""Mon Nov 07 02:32:15 +0000 2011"",""retweeted"":false,""in_reply_to_status_id_str"":null,""in_reply_to_user_id_str"":null,""contributors"":null,""id_str"":""133371151551447041"",""in_reply_to_user_id"":null,""in_reply_to_status_id"":null,""source"":""\u003Ca href=\""http:\/\/www.arstechnica.com\"" rel=\""nofollow\""\u003EArs auto-tweeter\u003C\/a\u003E"",""geo"":null,""favorited"":false,""id"":133371151551447041,""coordinates"":null,""truncated"":false,""text"":""Google: Microsoft uses patents when products \""stop succeeding\"": http:\/\/t.co\/50QFc1uJ by @binarybits""}},""in_reply_to_user_id"":null,""in_reply_to_status_id"":null,""source"":""web"",""geo"":null,""favorited"":false,""id"":133371690876022785,""coordinates"":null,""truncated"":false,""text"":""RT @arstechnica: Google: Microsoft uses patents when products \""stop succeeding\"": http:\/\/t.co\/50QFc1uJ by @binarybits""}},""profile_use_background_image"":true,""favourites_count"":238,""location"":""New York"",""id_str"":""17575623"",""default_profile_image"":false,""show_all_inline_media"":false,""profile_text_color"":""ABB8AF"",""screen_name"":""demisbellot"",""statuses_count"":9638,""profile_background_image_url"":""http:\/\/a0.twimg.com\/profile_background_images\/192991651\/twitter-bg.jpg"",""url"":""http:\/\/www.servicestack.net\/mythz_blog\/"",""time_zone"":""London"",""profile_link_color"":""43594A"",""id"":17575623,""follow_request_sent"":null,""lang"":""en""}}]"; - static string JsonYammer = @"{ + static string JsonYammer = @"{ ""job_title"":""Developer"", ""summary"":""I am a developer at XYZ Corp."", ""activated_at"":""2012/12/21 12:21:12 +0000"", @@ -115,27 +117,68 @@ static MockAuthHttpGateway() ""full_name"":""{1}"" }"; - public string DownloadTwitterUserInfo(OAuthAccessToken oauthToken, string twitterUserId) - { - twitterUserId.ThrowIfNullOrEmpty("twitterUserId"); - - return JsonTwitter.Fmt(Tokens.DisplayName); - } + public string DownloadTwitterUserInfo(string consumerKey, string consumerSecret, string accessToken, string accessTokenSecret, string twitterUserId) + { + twitterUserId.ThrowIfNullOrEmpty("twitterUserId"); + return JsonTwitter.Fmt(Tokens.DisplayName); + } public string DownloadFacebookUserInfo(string facebookCode, params string[] fields) { - facebookCode.ThrowIfNullOrEmpty("facebookCode"); + facebookCode.ThrowIfNullOrEmpty("facebookCode"); + + return JsonFacebook.Fmt(Tokens.UserId, Tokens.DisplayName, + Tokens.FirstName, Tokens.LastName, Tokens.Email); + } + + public bool VerifyGoogleAccessToken(string consumerKey, string accessToken) + { + throw new System.NotImplementedException(); + } - return JsonFacebook.Fmt(Tokens.UserId, Tokens.DisplayName, - Tokens.FirstName, Tokens.LastName, Tokens.Email); - } + public string DownloadGoogleUserInfo(string accessToken) + { + throw new System.NotImplementedException(); + } + + public string DownloadMicrosoftUserInfo(string accessToken) + { + throw new System.NotImplementedException(); + } - public string DownloadYammerUserInfo(string yammerUserId) - { + public string CreateMicrosoftPhotoUrl(string accessToken, string savePhotoSize = null) + { + throw new System.NotImplementedException(); + } + + public string DownloadYammerUserInfo(string yammerUserId) + { yammerUserId.ThrowIfNullOrEmpty("yammerUserId"); return JsonYammer.Fmt(Tokens.UserId, Tokens.DisplayName, Tokens.FirstName, Tokens.LastName, Tokens.Email); - } - } -} \ No newline at end of file + } + + public string DownloadGithubUserInfo(string accessToken) + { + throw new System.NotImplementedException(); + } + + public string DownloadGithubUserEmailsInfo(string accessToken) + { + throw new System.NotImplementedException(); + } + + public bool VerifyTwitterAccessToken(string consumerKey, string consumerSecret, string accessToken, string accessTokenSecret, + out string userId, out string email) + { + throw new System.NotImplementedException(); + } + + public bool VerifyFacebookAccessToken(string appId, string accessToken) + { + throw new System.NotImplementedException(); + } + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionTests.cs b/tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionTests.cs deleted file mode 100644 index fbff6893847..00000000000 --- a/tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionTests.cs +++ /dev/null @@ -1,332 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using NUnit.Framework; -using ServiceStack.Auth; -using ServiceStack.Testing; -using ServiceStack.Text; -using ServiceStack.Web; - -namespace ServiceStack.Common.Tests.OAuth -{ - [TestFixture] - public class OAuthUserSessionTests : OAuthUserSessionTestsBase - { - private ServiceStackHost appHost; - - [TestFixtureSetUp] - public void TestFixtureSetUp() - { - appHost = new BasicAppHost().Init(); - } - - [TestFixtureTearDown] - public void TestFixtureTearDown() - { - appHost.Dispose(); - } - - [Test, TestCaseSource("UserAuthRepositorys")] - public void Does_persist_TwitterOAuth(IUserAuthRepository userAuthRepository) - { - InitTest(userAuthRepository); - - MockAuthHttpGateway.Tokens = twitterGatewayTokens; - - var authInfo = new Dictionary { - {"user_id", "133371690876022785"}, - {"screen_name", "demisbellot"}, - }; - - var oAuthUserSession = requestContext.ReloadSession(); - - var twitterAuth = GetTwitterAuthProvider(); - twitterAuth.OnAuthenticated(service, oAuthUserSession, twitterAuthTokens, authInfo); - - oAuthUserSession = requestContext.ReloadSession(); - - Assert.That(oAuthUserSession.UserAuthId, Is.Not.Null); - - var userAuth = userAuthRepository.GetUserAuth(oAuthUserSession.UserAuthId); - Assert.That(userAuth.Id.ToString(CultureInfo.InvariantCulture), Is.EqualTo(oAuthUserSession.UserAuthId)); - Assert.That(userAuth.DisplayName, Is.EqualTo("Demis Bellot TW")); - - var authProviders = userAuthRepository.GetUserAuthDetails(oAuthUserSession.UserAuthId); - Assert.That(authProviders.Count, Is.EqualTo(1)); - var authProvider = authProviders[0]; - Assert.That(authProvider.UserAuthId, Is.EqualTo(userAuth.Id)); - Assert.That(authProvider.DisplayName, Is.EqualTo("Demis Bellot TW")); - Assert.That(authProvider.FirstName, Is.Null); - Assert.That(authProvider.LastName, Is.Null); - Assert.That(authProvider.RequestToken, Is.EqualTo(twitterAuthTokens.RequestToken)); - Assert.That(authProvider.RequestTokenSecret, Is.EqualTo(twitterAuthTokens.RequestTokenSecret)); - - Console.WriteLine(authProviders.Dump()); - } - - [Test, TestCaseSource("UserAuthRepositorys")] - public void Does_persist_FacebookOAuth(IUserAuthRepository userAuthRepository) - { - InitTest(userAuthRepository); - - var serviceTokens = MockAuthHttpGateway.Tokens = facebookGatewayTokens; - - var oAuthUserSession = requestContext.ReloadSession(); - var authInfo = new Dictionary { }; - var facebookAuth = GetFacebookAuthProvider(); - facebookAuth.OnAuthenticated(service, oAuthUserSession, facebookAuthTokens, authInfo); - - oAuthUserSession = requestContext.ReloadSession(); - - Assert.That(oAuthUserSession.FacebookUserId, Is.EqualTo(serviceTokens.UserId)); - - Assert.That(oAuthUserSession.UserAuthId, Is.Not.Null); - - var userAuth = userAuthRepository.GetUserAuth(oAuthUserSession.UserAuthId); - Assert.That(userAuth.Id.ToString(CultureInfo.InvariantCulture), Is.EqualTo(oAuthUserSession.UserAuthId)); - Assert.That(userAuth.DisplayName, Is.EqualTo(serviceTokens.DisplayName)); - Assert.That(userAuth.FirstName, Is.EqualTo(serviceTokens.FirstName)); - Assert.That(userAuth.LastName, Is.EqualTo(serviceTokens.LastName)); - Assert.That(userAuth.PrimaryEmail, Is.EqualTo(serviceTokens.Email)); - - var authProviders = userAuthRepository.GetUserAuthDetails(oAuthUserSession.UserAuthId); - Assert.That(authProviders.Count, Is.EqualTo(1)); - var authProvider = authProviders[0]; - Assert.That(authProvider.UserAuthId, Is.EqualTo(userAuth.Id)); - Assert.That(authProvider.DisplayName, Is.EqualTo(serviceTokens.DisplayName)); - Assert.That(authProvider.FirstName, Is.EqualTo(serviceTokens.FirstName)); - Assert.That(authProvider.LastName, Is.EqualTo(serviceTokens.LastName)); - Assert.That(authProvider.Email, Is.EqualTo(serviceTokens.Email)); - Assert.That(authProvider.RequestToken, Is.Null); - Assert.That(authProvider.RequestTokenSecret, Is.Null); - Assert.That(authProvider.AccessToken, Is.Null); - Assert.That(authProvider.AccessTokenSecret, Is.EqualTo(facebookAuthTokens.AccessTokenSecret)); - - Console.WriteLine(authProviders.Dump()); - } - - [Test, TestCaseSource("UserAuthRepositorys")] - public void Does_merge_FacebookOAuth_TwitterOAuth(IUserAuthRepository userAuthRepository) - { - InitTest(userAuthRepository); - - var serviceTokensFb = MockAuthHttpGateway.Tokens = facebookGatewayTokens; - - var oAuthUserSession = requestContext.ReloadSession(); - var facebookAuth = GetFacebookAuthProvider(); - facebookAuth.OnAuthenticated(service, oAuthUserSession, facebookAuthTokens, new Dictionary()); - - oAuthUserSession = requestContext.ReloadSession(); - - var serviceTokensTw = MockAuthHttpGateway.Tokens = twitterGatewayTokens; - var authInfo = new Dictionary { - {"user_id", "133371690876022785"}, - {"screen_name", "demisbellot"}, - }; - var twitterAuth = GetTwitterAuthProvider(); - twitterAuth.OnAuthenticated(service, oAuthUserSession, twitterAuthTokens, authInfo); - - oAuthUserSession = requestContext.ReloadSession(); - - Assert.That(oAuthUserSession.TwitterUserId, Is.EqualTo(authInfo["user_id"])); - Assert.That(oAuthUserSession.TwitterScreenName, Is.EqualTo(authInfo["screen_name"])); - - var userAuth = userAuthRepository.GetUserAuth(oAuthUserSession.UserAuthId); - Assert.That(userAuth.Id.ToString(CultureInfo.InvariantCulture), Is.EqualTo(oAuthUserSession.UserAuthId)); - Assert.That(userAuth.DisplayName, Is.EqualTo(serviceTokensFb.DisplayName)); - Assert.That(userAuth.PrimaryEmail, Is.EqualTo(serviceTokensFb.Email)); - Assert.That(userAuth.FirstName, Is.EqualTo(serviceTokensFb.FirstName)); - Assert.That(userAuth.LastName, Is.EqualTo(serviceTokensFb.LastName)); - - var authProviders = userAuthRepository.GetUserAuthDetails(oAuthUserSession.UserAuthId); - Assert.That(authProviders.Count, Is.EqualTo(2)); - - Console.WriteLine(userAuth.Dump()); - Console.WriteLine(authProviders.Dump()); - } - - [Test, TestCaseSource("UserAuthRepositorys")] - public void Can_login_with_user_created_CreateUserAuth(IUserAuthRepository userAuthRepository) - { - InitTest(userAuthRepository); - - var registrationService = GetRegistrationService(userAuthRepository); - - var responseObj = registrationService.Post(RegisterDto); - - var httpResult = responseObj as IHttpResult; - if (httpResult != null) - { - Assert.Fail("HttpResult found: " + httpResult.Dump()); - } - - var response = (RegisterResponse)responseObj; - Assert.That(response.UserId, Is.Not.Null); - - var userAuth = userAuthRepository.GetUserAuth(response.UserId); - AssertEqual(userAuth, RegisterDto); - - userAuth = userAuthRepository.GetUserAuthByUserName(RegisterDto.UserName); - AssertEqual(userAuth, RegisterDto); - - userAuth = userAuthRepository.GetUserAuthByUserName(RegisterDto.Email); - AssertEqual(userAuth, RegisterDto); - - IUserAuth userId; - var success = userAuthRepository.TryAuthenticate(RegisterDto.UserName, RegisterDto.Password, out userId); - Assert.That(success, Is.True); - Assert.That(userId, Is.Not.Null); - - success = userAuthRepository.TryAuthenticate(RegisterDto.Email, RegisterDto.Password, out userId); - Assert.That(success, Is.True); - Assert.That(userId, Is.Not.Null); - - success = userAuthRepository.TryAuthenticate(RegisterDto.UserName, "Bad Password", out userId); - Assert.That(success, Is.False); - Assert.That(userId, Is.Null); - } - - [Test, TestCaseSource("UserAuthRepositorys")] - public void Logging_in_pulls_all_AuthInfo_from_repo_after_logging_in_all_AuthProviders(IUserAuthRepository userAuthRepository) - { - InitTest(userAuthRepository); - - var oAuthUserSession = requestContext.ReloadSession(); - - //Facebook - LoginWithFacebook(oAuthUserSession); - - //Twitter - MockAuthHttpGateway.Tokens = twitterGatewayTokens; - var authInfo = new Dictionary { - {"user_id", "133371690876022785"}, - {"screen_name", "demisbellot"}, - }; - var twitterAuth = GetTwitterAuthProvider(); - twitterAuth.OnAuthenticated(service, oAuthUserSession, twitterAuthTokens, authInfo); - Console.WriteLine("UserId: " + oAuthUserSession.UserAuthId); - - //Register - var registrationService = GetRegistrationService(userAuthRepository, oAuthUserSession, requestContext); - - var responseObj = registrationService.Post(RegisterDto); - Assert.That(responseObj as IHttpError, Is.Null, responseObj.ToString()); - - Console.WriteLine("UserId: " + oAuthUserSession.UserAuthId); - - var credentialsAuth = GetCredentialsAuthConfig(); - var loginResponse = credentialsAuth.Authenticate(service, oAuthUserSession, - new Authenticate - { - provider = CredentialsAuthProvider.Name, - UserName = RegisterDto.UserName, - Password = RegisterDto.Password, - }); - - loginResponse.PrintDump(); - oAuthUserSession = requestContext.ReloadSession(); - - Assert.That(oAuthUserSession.TwitterUserId, Is.EqualTo(authInfo["user_id"])); - Assert.That(oAuthUserSession.TwitterScreenName, Is.EqualTo(authInfo["screen_name"])); - - var userAuth = userAuthRepository.GetUserAuth(oAuthUserSession.UserAuthId); - Assert.That(userAuth.Id.ToString(CultureInfo.InvariantCulture), Is.EqualTo(oAuthUserSession.UserAuthId)); - Assert.That(userAuth.DisplayName, Is.EqualTo(RegisterDto.DisplayName)); - Assert.That(userAuth.FirstName, Is.EqualTo(RegisterDto.FirstName)); - Assert.That(userAuth.LastName, Is.EqualTo(RegisterDto.LastName)); - Assert.That(userAuth.Email, Is.EqualTo(RegisterDto.Email)); - - Console.WriteLine(oAuthUserSession.Dump()); - Assert.That(oAuthUserSession.ProviderOAuthAccess.Count, Is.EqualTo(2)); - Assert.That(oAuthUserSession.IsAuthenticated, Is.True); - - var authProviders = userAuthRepository.GetUserAuthDetails(oAuthUserSession.UserAuthId); - Assert.That(authProviders.Count, Is.EqualTo(2)); - - Console.WriteLine(userAuth.Dump()); - Console.WriteLine(authProviders.Dump()); - } - - [Test, TestCaseSource("UserAuthRepositorys")] - public void Registering_twice_creates_two_registrations(IUserAuthRepository userAuthRepository) - { - InitTest(userAuthRepository); - - var oAuthUserSession = requestContext.ReloadSession(); - - RegisterAndLogin(userAuthRepository, oAuthUserSession); - - requestContext.RemoveSession(); - - var userName1 = RegisterDto.UserName; - var userName2 = "UserName2"; - RegisterDto.UserName = userName2; - RegisterDto.Email = "as@if2.com"; - - var userAuth1 = userAuthRepository.GetUserAuthByUserName(userName1); - Assert.That(userAuth1, Is.Not.Null); - - Register(userAuthRepository, oAuthUserSession, RegisterDto); - - userAuth1 = userAuthRepository.GetUserAuthByUserName(userName1); - var userAuth2 = userAuthRepository.GetUserAuthByUserName(userName2); - - Assert.That(userAuth1, Is.Not.Null); - Assert.That(userAuth2, Is.Not.Null); - } - - [Test, TestCaseSource("UserAuthRepositorys")] - public void Registering_twice_in_same_session_updates_registration(IUserAuthRepository userAuthRepository) - { - InitTest(userAuthRepository); - - var oAuthUserSession = requestContext.ReloadSession(); - - oAuthUserSession = RegisterAndLogin(userAuthRepository, oAuthUserSession); - - var userName1 = RegisterDto.UserName; - var userName2 = "UserName2"; - RegisterDto.UserName = userName2; - - Register(userAuthRepository, oAuthUserSession, RegisterDto); - - var userAuth1 = userAuthRepository.GetUserAuthByUserName(userName1); - var userAuth2 = userAuthRepository.GetUserAuthByUserName(userName2); - - Assert.That(userAuth1, Is.Null); - Assert.That(userAuth2, Is.Not.Null); - } - - [Test, TestCaseSource("UserAuthRepositorys")] - public void Connecting_to_facebook_whilst_authenticated_connects_account(IUserAuthRepository userAuthRepository) - { - InitTest(userAuthRepository); - - var oAuthUserSession = requestContext.ReloadSession(); - - oAuthUserSession = RegisterAndLogin(userAuthRepository, oAuthUserSession); - - LoginWithFacebook(oAuthUserSession); - - var userAuth = userAuthRepository.GetUserAuthByUserName(RegisterDto.UserName); - - Assert.That(userAuth.UserName, Is.EqualTo(RegisterDto.UserName)); - - var userAuthProviders = userAuthRepository.GetUserAuthDetails(userAuth.Id.ToString(CultureInfo.InvariantCulture)); - Assert.That(userAuthProviders.Count, Is.EqualTo(1)); - } - - [Test, TestCaseSource("UserAuthRepositorys")] - public void Can_AutoLogin_whilst_Registering(IUserAuthRepository userAuthRepository) - { - InitTest(userAuthRepository); - var oAuthUserSession = requestContext.ReloadSession(); - RegisterDto.AutoLogin = true; - Register(userAuthRepository, oAuthUserSession, RegisterDto); - - oAuthUserSession = requestContext.ReloadSession(); - Assert.That(oAuthUserSession.IsAuthenticated, Is.True); - } - - } -} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionTestsBase.cs b/tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionTestsBase.cs deleted file mode 100644 index 322c97021d0..00000000000 --- a/tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionTestsBase.cs +++ /dev/null @@ -1,236 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using Moq; -using NUnit.Framework; -using ServiceStack.Auth; -using ServiceStack.Configuration; -using ServiceStack.Host; -using ServiceStack.OrmLite; -using ServiceStack.OrmLite.SqlServer; -using ServiceStack.Redis; -using ServiceStack.Testing; -using ServiceStack.Web; - -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; - - public static AuthUserSession GetNewSession2() - { - var oAuthUserSession = new AuthUserSession(); - return oAuthUserSession; - } - - public CredentialsAuthProvider GetCredentialsAuthConfig() - { - return new CredentialsAuthProvider(new AppSettings()) { - }; - } - - public TwitterAuthProvider GetTwitterAuthProvider() - { - return new TwitterAuthProvider(new AppSettings()) { - AuthHttpGateway = new MockAuthHttpGateway(), - }; - } - - public FacebookAuthProvider GetFacebookAuthProvider() - { - return new FacebookAuthProvider(new AppSettings()) { - AuthHttpGateway = new MockAuthHttpGateway(), - }; - } - - public IEnumerable UserAuthRepositorys - { - get - { - if (!LoadUserAuthRepositorys) yield break; - - var inMemoryRepo = new InMemoryAuthRepository(); - inMemoryRepo.Clear(); - yield return new TestCaseData(inMemoryRepo); - - var appSettings = new AppSettings(); - var redisRepo = new RedisAuthRepository(new BasicRedisClientManager(new string[] { appSettings.GetString("Redis.Host") ?? "localhost" })); - redisRepo.Clear(); - yield return new TestCaseData(redisRepo); - - if (UseSqlServer) - { - var connStr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\App_Data\auth.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; - var sqlServerFactory = new OrmLiteConnectionFactory(connStr, SqlServerOrmLiteDialectProvider.Instance); - var sqlServerRepo = new OrmLiteAuthRepository(sqlServerFactory); - sqlServerRepo.DropAndReCreateTables(); - yield return new TestCaseData(sqlServerRepo); - } - else - { - var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); - var sqliteRepo = new OrmLiteAuthRepository(dbFactory); - sqliteRepo.InitSchema(); - sqliteRepo.Clear(); - yield return new TestCaseData(sqliteRepo); - - var dbFilePath = "~/App_Data/auth.sqlite".MapProjectPath(); - if (File.Exists(dbFilePath)) File.Delete(dbFilePath); - var sqliteDbFactory = new OrmLiteConnectionFactory(dbFilePath); - var sqliteDbRepo = new OrmLiteAuthRepository(sqliteDbFactory); - sqliteDbRepo.InitSchema(); - yield return new TestCaseData(sqliteDbRepo); - } - } - } - - protected Mock mockService; - protected BasicRequest requestContext; - protected IServiceBase service; - - protected AuthTokens facebookGatewayTokens = new AuthTokens { - UserId = "623501766", - DisplayName = "Demis Bellot FB", - FirstName = "Demis", - LastName = "Bellot", - Email = "demis.bellot@gmail.com", - }; - protected AuthTokens twitterGatewayTokens = new AuthTokens { - DisplayName = "Demis Bellot TW" - }; - protected AuthTokens facebookAuthTokens = new AuthTokens { - Provider = FacebookAuthProvider.Name, - AccessTokenSecret = "AAADDDCCCoR848BAMkQIZCRIKnVWZAvcKWqo7Ibvec8ebV9vJrfZAz8qVupdu5EbjFzmMmbwUFDbcNDea9H6rOn5SVn8es7KYZD", - }; - protected AuthTokens twitterAuthTokens = new AuthTokens { - Provider = TwitterAuthProvider.Name, - RequestToken = "JGGZZ22CCqgB1GR5e0EmGFxzyxGTw2rwEFFcC8a9o7g", - RequestTokenSecret = "qKKCCUUJ2R10bMieVQZZad7iSwWkPYJmtBYzPoM9q0", - UserId = "133371690876022785", - }; - protected Register RegisterDto; - - protected void InitTest(IUserAuthRepository userAuthRepository) - { - ((IClearable)userAuthRepository).Clear(); - - var appsettingsMock = new Mock(); - var appSettings = appsettingsMock.Object; - - new AuthFeature(null, new IAuthProvider[] { - new CredentialsAuthProvider(), - new BasicAuthProvider(), - new FacebookAuthProvider(appSettings), - new TwitterAuthProvider(appSettings) - }) - .Register(null); - - mockService = new Mock(); - mockService.Expect(x => x.TryResolve()).Returns(userAuthRepository); - requestContext = new BasicRequest(); - mockService.Expect(x => x.Request).Returns(requestContext); - service = mockService.Object; - - RegisterDto = new Register { - UserName = "UserName", - Password = "p@55word", - Email = "as@if.com", - DisplayName = "DisplayName", - FirstName = "FirstName", - LastName = "LastName", - }; - } - - public static RegisterService GetRegistrationService( - IUserAuthRepository userAuthRepository, - AuthUserSession oAuthUserSession = null, - BasicRequest request = null) - { - if (request == null) - request = new BasicRequest(); - if (oAuthUserSession == null) - oAuthUserSession = request.ReloadSession(); - - oAuthUserSession.Id = request.Response.CreateSessionId(request); - request.Items[ServiceExtensions.RequestItemsSessionKey] = oAuthUserSession; - - var mockAppHost = new BasicAppHost(); - - mockAppHost.Container.Register(userAuthRepository); - - var authService = new AuthenticateService { - Request = request, - }; - authService.SetResolver(mockAppHost); - mockAppHost.Register(authService); - - var registrationService = new RegisterService { - AuthRepo = userAuthRepository, - Request = request, - RegistrationValidator = - new RegistrationValidator { UserAuthRepo = RegistrationServiceTests.GetStubRepo() }, - }; - registrationService.SetResolver(mockAppHost); - - return registrationService; - } - - public static void AssertEqual(IUserAuth userAuth, Register request) - { - Assert.That(userAuth, Is.Not.Null); - Assert.That(userAuth.UserName, Is.EqualTo(request.UserName)); - Assert.That(userAuth.Email, Is.EqualTo(request.Email)); - Assert.That(userAuth.DisplayName, Is.EqualTo(request.DisplayName)); - Assert.That(userAuth.FirstName, Is.EqualTo(request.FirstName)); - Assert.That(userAuth.LastName, Is.EqualTo(request.LastName)); - } - - protected AuthUserSession RegisterAndLogin(IUserAuthRepository userAuthRepository, AuthUserSession oAuthUserSession) - { - Register(userAuthRepository, oAuthUserSession); - - Login(RegisterDto.UserName, RegisterDto.Password, oAuthUserSession); - - oAuthUserSession = requestContext.ReloadSession(); - return oAuthUserSession; - } - - protected object Login(string userName, string password, AuthUserSession oAuthUserSession = null) - { - if (oAuthUserSession == null) - oAuthUserSession = requestContext.ReloadSession(); - - var credentialsAuth = GetCredentialsAuthConfig(); - return credentialsAuth.Authenticate(service, oAuthUserSession, - new Authenticate { - provider = CredentialsAuthProvider.Name, - UserName = RegisterDto.UserName, - Password = RegisterDto.Password, - }); - } - - protected object Register(IUserAuthRepository userAuthRepository, AuthUserSession oAuthUserSession, Register register = null) - { - if (register == null) - register = RegisterDto; - - var registrationService = GetRegistrationService(userAuthRepository, oAuthUserSession, requestContext); - var response = registrationService.Post(register); - Assert.That(response as IHttpError, Is.Null); - return response; - } - - protected void LoginWithFacebook(AuthUserSession oAuthUserSession) - { - MockAuthHttpGateway.Tokens = facebookGatewayTokens; - var facebookAuth = GetFacebookAuthProvider(); - facebookAuth.OnAuthenticated(service, oAuthUserSession, facebookAuthTokens, new Dictionary()); - Console.WriteLine("UserId: " + oAuthUserSession.UserAuthId); - } - } -} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionWithoutTestSourceTests.cs b/tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionWithoutTestSourceTests.cs deleted file mode 100644 index fa615b22fb9..00000000000 --- a/tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionWithoutTestSourceTests.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; -using ServiceStack.Auth; -using ServiceStack.Configuration; -using ServiceStack.OrmLite; -using ServiceStack.OrmLite.SqlServer; -using ServiceStack.Redis; -using ServiceStack.Testing; - -namespace ServiceStack.Common.Tests.OAuth -{ - [TestFixture, Explicit("Manual OAuth Test with iteration over data stores")] - public class OAuthUserSessionWithoutTestSourceTests - { - private OAuthUserSessionTests tests; - private readonly List userAuthRepositorys = new List(); - - readonly OrmLiteConnectionFactory dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); - - private ServiceStackHost appHost; - - [SetUp] - public void SetUp() - { - try - { - tests = new OAuthUserSessionTests(); - - appHost = new BasicAppHost().Init(); - - var inMemoryRepo = new InMemoryAuthRepository(); - inMemoryRepo.Clear(); - userAuthRepositorys.Add(inMemoryRepo); - - var appSettings = new AppSettings(); - var redisRepo = new RedisAuthRepository(new BasicRedisClientManager(new[] { appSettings.GetString("Redis.Host") ?? "localhost" })); - redisRepo.Clear(); - userAuthRepositorys.Add(redisRepo); - - if (OAuthUserSessionTestsBase.UseSqlServer) - { - var connStr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\App_Data\auth.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; - var sqlServerFactory = new OrmLiteConnectionFactory(connStr, SqlServerOrmLiteDialectProvider.Instance); - var sqlServerRepo = new OrmLiteAuthRepository(sqlServerFactory); - sqlServerRepo.DropAndReCreateTables(); - } - else - { - var sqliteInMemoryRepo = new OrmLiteAuthRepository(dbFactory); - - sqliteInMemoryRepo.InitSchema(); - sqliteInMemoryRepo.Clear(); - userAuthRepositorys.Add(sqliteInMemoryRepo); - - var sqliteDbFactory = new OrmLiteConnectionFactory( - "~/App_Data/auth.sqlite".MapProjectPath()); - var sqliteDbRepo = new OrmLiteAuthRepository(sqliteDbFactory); - sqliteDbRepo.InitSchema(); - userAuthRepositorys.Add(sqliteDbRepo); - } - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - throw; - } - } - - [TearDown] - public void TestFixtureTearDown() - { - appHost.Dispose(); - } - - [Test] - public void Does_persist_TwitterOAuth() - { - userAuthRepositorys.ForEach(x => tests.Does_persist_TwitterOAuth(x)); - } - - [Test] - public void Does_persist_FacebookOAuth() - { - userAuthRepositorys.ForEach(x => tests.Does_persist_FacebookOAuth(x)); - } - - [Test] - public void Does_merge_FacebookOAuth_TwitterOAuth() - { - userAuthRepositorys.ForEach(x => tests.Does_merge_FacebookOAuth_TwitterOAuth(x)); - } - - [Test] - public void Can_login_with_user_created_CreateUserAuth() - { - userAuthRepositorys.ForEach(x => tests.Can_login_with_user_created_CreateUserAuth(x)); - } - - - } -} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthRepositoryTests.cs b/tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthRepositoryTests.cs index b0d30a72d50..babd56b3628 100644 --- a/tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthRepositoryTests.cs +++ b/tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthRepositoryTests.cs @@ -1,7 +1,7 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt - +#if !NETCORE_SUPPORT using System.Net; using NUnit.Framework; using ServiceStack.Auth; @@ -15,16 +15,19 @@ public class OrmLiteUserAuthRepositoryTests { private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { - appHost = new BasicAppHost + appHost = new BasicAppHost(typeof(OrmLiteUserAuthRepositoryTests).Assembly) { ConfigureAppHost = host => { host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new CredentialsAuthProvider(), - })); + }) + { + IncludeRegistrationService = true, + }); }, ConfigureContainer = container => { @@ -39,7 +42,7 @@ public void TestFixtureSetUp() }.Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -92,10 +95,10 @@ public void Does_lockout_user_after_reaching_max_invalid_logins_limit() { RegisterUser(email: "as@if.com"); - var authRepo = (OrmLiteAuthRepository)appHost.Resolve(); - authRepo.MaxLoginAttempts = 3; + var feature = appHost.GetPlugin(); + feature.MaxLoginAttempts = 3; - authRepo.MaxLoginAttempts.Value.Times(i => + feature.MaxLoginAttempts.Value.Times(i => { appHost.ExecuteService(new Authenticate { UserName = "as@if.com", @@ -127,4 +130,5 @@ public void Does_lockout_user_after_reaching_max_invalid_logins_limit() Assert.That(httpError.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized)); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthTests.cs b/tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthTests.cs index 7a968b22565..52f0fb25d19 100644 --- a/tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthTests.cs +++ b/tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthTests.cs @@ -1,4 +1,5 @@ -using System.Data; +#if !NETCORE_SUPPORT +using System.Data; using System.IO; using NUnit.Framework; using ServiceStack.Auth; @@ -24,7 +25,7 @@ private static IDbConnection OpenDbConnection() private static UserAuth GetUserAuth() { 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(); + var userAuth = jsv.ConvertTo(); return userAuth; } @@ -41,11 +42,10 @@ public void Can_insert_table_with_UserAuth() var rows = db.Select(q => q.UserName == "UserName"); - rows[0].PrintDump(); - Assert.That(rows[0].UserName, Is.EqualTo(userAuth.UserName)); } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/RegistrationServiceTests.cs b/tests/ServiceStack.Common.Tests/OAuth/RegistrationServiceTests.cs index 48193f5f69d..39dc44a7e07 100644 --- a/tests/ServiceStack.Common.Tests/OAuth/RegistrationServiceTests.cs +++ b/tests/ServiceStack.Common.Tests/OAuth/RegistrationServiceTests.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; -using Moq; +#if !NETCORE_SUPPORT +using System.Collections.Generic; using NUnit.Framework; using ServiceStack.Auth; using ServiceStack.FluentValidation; @@ -15,7 +15,7 @@ public class RegistrationServiceTests private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost @@ -30,7 +30,7 @@ public void TestFixtureSetUp() }.Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -38,13 +38,8 @@ public void TestFixtureTearDown() public static IUserAuthRepository GetStubRepo() { - var mock = new Mock(); - mock.Expect(x => x.GetUserAuthByUserName(It.IsAny())) - .Returns((UserAuth)null); - mock.Expect(x => x.CreateUserAuth(It.IsAny(), It.IsAny())) - .Returns(new UserAuth { Id = 1 }); - - return mock.Object; + var authRepo = new InMemoryAuthRepository(); + return authRepo; } public static RegisterService GetRegistrationService( @@ -58,14 +53,17 @@ public static RegisterService GetRegistrationService( requestContext.ResponseContentType = contentType; } var userAuthRepository = authRepo ?? GetStubRepo(); + HostContext.Container.Register(userAuthRepository); + var service = new RegisterService { - RegistrationValidator = validator ?? new RegistrationValidator { UserAuthRepo = userAuthRepository }, - AuthRepo = userAuthRepository, + RegistrationValidator = validator ?? new RegistrationValidator(), Request = requestContext, }; HostContext.Container.Register(userAuthRepository); + + (HostContext.TryResolve() as InMemoryAuthRepository)?.Clear(); return service; } @@ -142,17 +140,18 @@ public static Register GetValidRegistration(bool autoLogin = false) [Test] public void Requires_unique_UserName_and_Email() { - var mockExistingUser = new UserAuth(); + (HostContext.TryResolve() as InMemoryAuthRepository)?.Clear(); - var mock = new Mock(); - mock.Expect(x => x.GetUserAuthByUserName(It.IsAny())) - .Returns(() => mockExistingUser); - var mockUserAuth = mock.Object; + var authRepo = new InMemoryAuthRepository(); + authRepo.CreateUserAuth(new UserAuth { + Email = "my@email.com", + UserName = "UserName", + }, "password"); + appHost.Register(authRepo); var service = new RegisterService { - RegistrationValidator = new RegistrationValidator { UserAuthRepo = mockUserAuth }, - AuthRepo = mockUserAuth, + RegistrationValidator = new RegistrationValidator(), }; var request = new Register @@ -181,8 +180,8 @@ public void Registration_with_Html_ContentType_And_Continue_returns_302_with_Loc var service = GetRegistrationService(null, null, MimeTypes.Html); var request = GetValidRegistration(); - request.Continue = "http://localhost/home"; + service.Request.QueryString[Keywords.Continue] = "http://localhost/home"; var response = service.Post(request) as HttpResult; Assert.That(response, Is.Not.Null); @@ -196,7 +195,7 @@ public void Registration_with_EmptyString_Continue_returns_RegistrationResponse( var service = GetRegistrationService(null, null, MimeTypes.Html); var request = GetValidRegistration(); - request.Continue = string.Empty; + service.Request.QueryString[Keywords.Continue] = string.Empty; var response = service.Post(request); @@ -210,7 +209,7 @@ public void Registration_with_Json_ContentType_And_Continue_returns_Registration var service = GetRegistrationService(null, null, MimeTypes.Json); var request = GetValidRegistration(); - request.Continue = "http://localhost/home"; + service.Request.QueryString[Keywords.Continue] = "http://localhost/home"; var response = service.Post(request); @@ -219,4 +218,5 @@ public void Registration_with_Json_ContentType_And_Continue_returns_Registration Assert.That(((RegisterResponse)response).ReferrerUrl, Is.EqualTo("http://localhost/home")); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/OAuth/RequiredRolesTests.cs b/tests/ServiceStack.Common.Tests/OAuth/RequiredRolesTests.cs index fdec059cb84..9f53466ea97 100644 --- a/tests/ServiceStack.Common.Tests/OAuth/RequiredRolesTests.cs +++ b/tests/ServiceStack.Common.Tests/OAuth/RequiredRolesTests.cs @@ -1,9 +1,9 @@ -using System.Linq; +#if !NETCORE_SUPPORT +using System.Linq; using NUnit.Framework; using ServiceStack.Auth; using ServiceStack.Configuration; using ServiceStack.Testing; -using ServiceStack.Web; namespace ServiceStack.Common.Tests.OAuth { @@ -12,14 +12,23 @@ public class RequiredRolesTests { private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { - appHost = new BasicAppHost().Init(); - AuthenticateService.Init(() => new AuthUserSession(), new CredentialsAuthProvider()); + appHost = new BasicAppHost + { + ConfigureAppHost = host => + { + host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new[] { new CredentialsAuthProvider() }) + { + IncludeRegistrationService = true, + }); + }, + + }.Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -84,7 +93,7 @@ public void Does_validate_RequiredRoles_with_UserAuthRepo_When_Role_not_in_Sessi HostContext.Container.Register(userAuth); var httpRes = request.Response; - requiredRole.Execute(request, request.Response, request.OperationName); + requiredRole.ExecuteAsync(request, request.Response, request.OperationName).Wait(); Assert.That(!httpRes.IsClosed); } @@ -102,4 +111,5 @@ public void Does_validate_AssertRequiredRoles_with_UserAuthRepo_When_Role_not_in Assert.That(!request.Response.IsClosed); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Perf/AdhocFastPerfTests.cs b/tests/ServiceStack.Common.Tests/Perf/AdhocFastPerfTests.cs index 104dee7a255..6365e17f890 100644 --- a/tests/ServiceStack.Common.Tests/Perf/AdhocFastPerfTests.cs +++ b/tests/ServiceStack.Common.Tests/Perf/AdhocFastPerfTests.cs @@ -6,97 +6,97 @@ namespace ServiceStack.Common.Tests.Perf { - [Ignore] - [TestFixture] - public class AdhocFastPerfTests - : PerfTestBase - { - public AdhocFastPerfTests() - { - //this.MultipleIterations = new List { 1000, 10000, 100000, 1000000 }; - this.MultipleIterations = new List { 10000 }; - } - - public static byte[] ToByteArray(string hexString) - { - var numberChars = hexString.Length; - var bytes = new byte[numberChars / 2]; - for (var i = 0; i < numberChars; i += 2) - { - bytes[i / 2] = Convert.ToByte(hexString.Substring(i, 2), 16); - } - return bytes; - } - - [Test] - public void Compare_small_ConvertBytes() - { - var byteArrayValue = new byte[] { 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, }; - - CompareMultipleRuns( - - "Convert.FromBase64String", () => Convert.FromBase64String(Convert.ToBase64String(byteArrayValue)), - "Encoding.Default", () => Encoding.Default.GetBytes(Encoding.Default.GetString(byteArrayValue)) - ); - } - - [Test] - public void Compare_medium_ConvertBytes() - { - var byteArrayValue = ToByteArray("151C2F00020000000D000E0014002100FFFFFFFF4269746D617020496D616765005061696E742E506963747572650001050000020000000700000050427275736800000000000000000080540000424D80540000000000007600000028000000C0000000E0000000010004000000000000540000CE0E0000D80E0000000000000000000000000000000080000080000000808000800000008000800080800000C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFB009A00A9009A9AA9A900009AA9ABE9EB0B0BB09A0AB0A9A9B0FA0FA0CBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFE9A09A9EBEBFBB0BB0AB09AC9090AB0BCB0BA9E9AA9A90B000009AAB09009BEB0BAD0EB9E9F9B0C0B0FADB0F0BEB0FCBC0BCBFB0F0BBE0B09BA0BBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFA9DABEBFFFADFFADBF0BEBBAFAF0FBBAB9ADABADBE0AB0BCBFBC090E0A9AFA9BC90BB9AFABEE0BB0FA9ABEBE9B0FBA9AB9A9A0FB09E0BDAFA0DBE9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFB0FABFFFAFAFEABCBAA9F09AF0B9BBCBE9EBE9ADA9A990FAB0000BFA9090B09E0BAF00A9ADAB9BCBE9F0BCF0BE9FA9EB9CA90FBEAF0BFBA9ADBA9ABFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FE99A9FAFFFFEBDA9ADBCBFA9BA9EAFACB0B9AF9A9AFAEB0900BB9A0000A9AF0BBCB0B9E9BADAFAB0BABEBBBC9EAA9EBEABBE90B9B0B0BCBE9A9FADAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFBAFBA9BEBE09ABFEBABAB0F0F0F9DBFBBAFAB0FAF0B090BCBC00090B0B0A0BBE9B0BCA9AF9A9BC9E9FAD00ABAB9FA9CB9C90B0FABFF09ADBFEB00B9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCBE9ABDEFBDBBFFCAB0F0D0FB0BBA0ABF0FDA9F0A90009A09A0B00000000D0BDA9AFADA9BDBEBFABABBADABFBDA9E0BEB9EBABE9A9EB0FE9AB09FAFBAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9B9E9FABADAFEB0BBDE9BABBA9FEDBBF0BFABC0A900BFE0BC0900B090B0B0BFAFE9A9A900A0B0E9CF0C0B0F0CADABF0F0ABBCB0B0BCBEB0A9AFA9A9E9BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFABA9F9FAF0FCBCAB0BE90EDABBABCBFA090B090FBFEF009A0B00A000F0B00B0BE9EBAF9FBFBBBBABB09FABB0F9AFA9FBCFBCB0E9B9A9FAC9F0BC9F0BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCBF0DA0A0FBEBABBDEF9AFBBADA9CB0A0BCA00BAF0BFFE9BA9009090B09ACBBAFF0BADB0A0BADACBDE9CA0BC0BAAF0FBAEB00B0B9A0F9EB9ABAFABABBEBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0BA9BFBACB9EDAB0BAF9AE9A9FA90900090B0F0BFBFE000CB0A00009A9B0ADB0BE900A99ADABFBABEA99A0BF0F9AF0FF0BFADA0E9BABBEBC90BC9E0BCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9E9AF00FBFEBA9EBBC9A09BCA000A09A9ABCB9BFFEE9AF0B009090BAFBEB9BAF0BAFF9ACB0BFACBDBBE0DBFAF9EB0B0BE909A99B00BF0B0AABCBABDBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0BA9AFBCBCBBEBBCABAD000090909009AC90B0AA9FF090B0B00A0BC90F090F9EBCB0AF9ABF0B9BAA9CB0A00FAABCBEBDAFAF0E09BE90FBF9CBB0BCA0DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBF0FBDA0BABE90CB9B0FA9AB000A00B0A9A9A9F9EBFE0BC00090900BA9BEB0BABCB0FB0BCB0FBEBDBFA9E9BFADBCBA9A0BE90BBB0E9AFA90FA00BE9A9BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0A0B0EBFBCB9EBBAF0F0BC90B0090000909A9E0BBFEE900B0DA000900FA0B0B0BBE9B0BEB0B0AB0A0F0BBC0A99ABAD0BFF9EB0C009A909EBA9E9F0BCADBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9BDBFBB00BE0BAC9AFA9ABFE09A00909A0BCBA9AEBE90AB00A90A9ABFBE9F00FC9AEBC909ADB9EBFB0BC0B09AE9CB0F0A0A90B9EB090FAB0FA9A0FA90ABFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0A000CBE9BE99BFA90F090AB00000009090F0BFBFE0B0DA900090BCBA90AB0BEB90BAFADBA0FB0EBEBABEBC9AA9A9ABF90FA009A9EB09E9AFADA9CA9CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCB9FB9A9AE9BEFAF9A9ABEB9EBCB00000A0B0BE9AFF0FA090B00A90B0FADB009BAE9ADBAB0FFB0FBF09BF00B0D0F0EB00AB09EB0DA90A9AF0B0B0CB00B9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0A00EBCB9BEB0BA0F0B09AE90B00B00090A909FFF09009A00090A0F9A9BAB0B0BFADA0D0F0B0BA9A9E00AF0A0BA9BC9E909AB09A09A9CA9ADACA90B0BCFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9B9BB0BE9E9E909F0BCBEB90B9CB00900BB0FAABEE0B9E090B0BDBBAF0E90C9AE90B0BAB09AFDABE9ADB9A909A9E00A90E90D0A09E0B09A9A090A00009BFE000909FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0CACBE0BA9A9AB00B0B0BC0BCAB0B0000009AFBE9A9E090A0009ABEFABBAB009BADAF09ABE9ABBDAFBAFA9E9AD090B0A90A0A9CB0900B0DADB0B000900BC90000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBB9ADBE9FA9E9EB00F0F9A9E900BCB0B900F90FBEDA9A09090A9A90BC0DB0B09AFB00BCBCB0BCBEB0BDA9E0BC0A0BC090A9090B09A9B00B0A00009000900000000009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00A9AA9A0BF0B0BFBA90ACB0B0F0B0B00A90ABAFE90ADA0A0090DAFB0BA0BC0AFAC0BCB0BADAB0B0FEBA90B00B0900BCA9CB0A00A0000B09090900000000009000009BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9BF0F9FADA0BBFF0E90A99ABCB090B0E9000B9FE90E9009009AFAA9A9A9F0A909BBB0B0BC9A9EBDB0B9E0BCA9000BA009A0090B0909A900A0000000000000000090009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9A9AB0BBF0F0B0B9EBDAE90B0E0BC9AF0B00E9F0A9A9A090A9A9FAFCBB0B0B00FAF0E9AB0B0BAB0F0BBF0B0A9A909A9090A0000000009090000000000090009000000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBCBE9AF0F09AFAF0A9EA90A90B090B09A90B0BAF090009A0909BE9BA9AFBBC0A90F0B0A9CB0F0DAFABE0000900000000A0A9090A9A900A0000000000000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF09A9ADBF0BBE9B0BBE90BBCA909A009A9AC9A0BEBA0F0009A0BEBBE09F0009A90BABE090B0B0BABBCB090B000090009090900A090000900009000000090000000009009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9A9F0A00ABE9B0FA09ABC0B9E0A9F9ADA9A9E9D00C90A9000F0BDA0DA0FBBE9E09F9FA0B0E0BCBCBAD0A009000000000000009000000090000000000000000000900000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDA9A0B9DA9CB9EB0BDAD0BBC0B09000A90BF0BAA9A9A9009A90BAAFFABBA0A9A9A0A0BDAC9B09A9BE9A909000000000000009000900900000090000000000000000000900FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9ADA0A09AB0A0BE0B0A9E0B00B0B0B0A900F09E09000B000B0BFF0B0F9F9BE9A9E9BEA9BA0DA9E09E9000000000000000000000000000000000000000000000900000009BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE09A9BC9A9CBE9E9F0F0B09A9AD00B09C0B0B0BC9AA9A009A9ADABFADAABABCBCB09EB9C009A9A09B0A00000000009000000000000900000000000000000090000000909C9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF09A9C00A90A09A9A0A0BCBA0D0A0BC9A9A900BE9AC90090BCBFAFABCBADA9BA9A0A9BCAB0F0B090A0090000090900000009000000000090000000009000900000000000BE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFE90A9A90A90B090909A9A0DBA0990B00B9E09F0A9A09A000B0BFDEBE9FBEBEFAD9000B0090A0F0BCB000009000000009000000000000000000000900000000000009000BF0BFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBFFA09000090090000000909A009A0A00B00A90A0F009A09A9ADA0BADBB0A9F09B9A0F0BADB0A990BCB0000900000000000000000000000000009000000000000000000009FE0BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA909090009000000000000000009A00909A09BC0BFF09AC090090BFF0FAE0BF9ABBEE0B0A9F00A900A090090900000090000000000000000000000000000000000009000900BF09FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF909090000000000000000000000900090BF009E00B0BA0A90B0A9AFA9ABA9BFABAD00BFF0900BA9DA0F0B0B00000090900000000000000000000000000000000900000000009A9ED0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000090000000000000900000009000000B0B0B0BECBDA0090CB9EBFF0F009CBBAB0BEBE909E0A9009000B00090000000900000000000000000000000000000000000090000900BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00909000000000900000000000000000009009009A09BF0A090A0B0ABBEBEFAFEBBCB9ADAF00A9AF090A9A9E9009000900000000000000000000000000000000000000900000090009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF09000000900000000000000000000000000000A9A009FEA9BCA9090BB0FFFFABF0BCBEAB0BFEB09E9A0A90009000009000000000000000000000000000000000000000000090090090FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000090000000009000909AF0DA090E0F0FFFEBEDFA9EBA99AF0BF09ABE09009A9A09090000000000000000000000000000000090000000000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00009009000000900000000900000000000000009A00BF0BA09A99BBFAABFFBB0BE9BCBA90F0FE090BCA9A0009A000000000000000000000000000090000000000900900000000090D0BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9000000000090000000000000000000000000000090A0BC9AD00A000BFBCBCBEF0BAFBCBAB0BABCBAF09009A9A0900900000000000000090000000000000000000000000000000900A9FEFFFFFFFFFFFFFFCBF9FF9FFFFFFFFD99F9FFFFFFFF000900090000000000000900000000000000000000009BEBE90A909E9F0BBFFA9EBC9B0B0BCF09EF0BC9A09A00090000000000000000000000090000000000000000000000090090A99EBFFFFFFFEF9A9BF9FF9F9F0F0BDBFFFB0FB9F09FFFFE00000900000000000000000000000000000000000090BAE900A90BABBAFAFEA9EB0BAAF0FEB00AFBE9A0900909A00000000000000000000000000000000000000000000000000009C0A9FFFFFFFB9DBDFDBFDBFBF9FBDBE999DDB9CB99A990FF090000900000000000000000000000000000000900009FBAF09A09E9E9E90BCB0E9EBDAB0DAF9CAFFE9E0B0A0090909000000000000000000000000000000000000000009000000B0900BFFFE90DB0FBFFDBFDF9FBD9F9BFFABDBFBDBDB0F90900000009090009000900090000000009000000000000A9E90A09F0BFAFAFEBBCB9E9EBF0BAF0AB9BAFA9A0909A00000000000000000000000000000000000000000000000000000000BCBFC9909B0FBDBFFF9FBE9DAF9FDB9DBBDBDBCBF99ADA00000000000000000000000000000000000000000009BEFA09A00BF0BE9A9E0B0A9A9E0B009EF0E0FE9AC90A000900000900000000000000009000000000000000000000000000900B09009ACBF0F9DBDAF9FBDFFBF9ADB9FFBCBDBDBF09F0909090000000000000000000000000000000000000009A9A909AD0B00ADCB0F0900909A9A9E0A90BFFA9EB0A090900090000000090009000000000000000000000000000000009000909009A09909F9FBFFF9F9FF99F9FDF9FB9DBDA9B99DB0B9000000000000000000000000000009000000000000000AF0E90ABCBFBEB0E9A0B00A000900C90000BEF0F9ADA000900000000000000000000000000000090000000000000000000000000090A9F09B9F9BFBFF9BFF9FBBDBDFFB9F9F9FABD9CB0909090000000000000000000000000000000000000909A90A90DA009BCBB0F00F090900B0000B0009AF0AF009A9000000000000000000009000000000000000000900000000000090009009009BFBCBFDBDF9FCB9FBDF9FB9ADF9F9B0D9A9B90000000909009000009009009000000000000009000009E0B0F0A9FAEAB0CB0B000000000900D0009009AF00B000009090000900090090000000000000000000000000090000000000900090BDBC99FBDBFBF9FB9EF9FBFF0F9F0F9ADF9BBD9E9A90900000000000000000000000000000000000000A9A0BCB0ADA009F0EB0009A900B009AC000000000009A0F0090000000000000000000000000009000000000000000000009000000900090B9AFBDBFFDBF9FDBDFF9F9FFDBF9BDB9BD0B09000000900000000000000000000000000009000000900090009009ADA0B90BCB000090900009C0D00000000090B0009000090000000000000000090000000000000000000000000000000090B9CB9DBFF99F9FB9F9B9FFFB9BF9BE9F0BCBD0B9B9090900900000000000000000000000000000000000B0A9A9A9A09A9E0AD0B09009ACA00000090090000009000090000000009000000000000900000000000000000000000000000000090909B9EBDB9FBFFBCFBFFFBDBDFF9EF9F9FDBB9BD0D0B000000009000090000000000000000000000009090090000009A090900A000A9A90909000000C00090000000000000000000090000090000000000009000000900000000000000900900A9DA9F9F9FF0F9BDB9F9BDBEBF9BD9B9E9B9C99A9A09090900000000000000000000000000000090000A00B00B09A9A09A0A9A9090900090000090090900000000009000009000000000900009000000000000000000000900000000000000099A99F9B0F9BF9FDB9F9FFF9F9FFFFBEDBCF9B0F9C9B09A00090000900000009000900000090000000000900090A00090009000000009090B090000000E000000000000000000900900900000000000000900000000000000000000900000000009E9ADBBDF9B9B9F0BF9B9FBF9B99F9F9B9EDBCB909C090900000000000090000000000900000000009009A0009090009000900909A00A0000000900009000000000000900000000090000900009000000000000000000000000000000000909AD9BDB9DB0F9E9F9F9BDF9BDBFDEF9F0FDB9B9B9CB0B9090090900000000000000000000000000000000A000A0000000000000000009090900900C0D09C09000000000000900000000009000900000000000900000000000000000000000000099BDB9EB9F9F9B0B9F9FB0F9F0BB9ADB9B09E9E9A9090A00900000009000000000000900000000000009009090000000000000900090000009A090A00C0000009000090000000009000000000000009009000000000000000000000000090099A9A9E99DB9B9BDBDB9E99F9A9BDBDF9AFDF9B99C9B0090900000900000000000000000000000000090009000000900000000000090000909A000C0D0D0F0909000900000000090000090000000009000000009000000000900000000090000009DB99FB90DADA9B9F9FB9B9F9BDBA9F99A9EDB0B0D9A900900900000000009000000000000000000000000900900000000090000009090009090900CAC0C0000000000000000000000000000000000000000000000000000000000000000009A9A9F990F9B99BD0B9090D0F9FCBD9F0BE9F990F9B0A9CA90000000000000000090000000009000000000000000000000000000090000009000E0C0C9C909000900009000900000000000009000000000000000000000000000900000000000909D9ADAF9AD0BD0BD0BDB9F9A9B90B0DF990BAF090D9009009000000009000000000909000000000000009000000000000000000000090B00F0D009A000C090000000009000009000000000009009000000900000000090000000000000000909A9BDB99099F0B90BD9B0B0BD0F9F9B9ADABD99BDA9A9009000090000000000000000000000000000000000000900900000000090090000900DE900D0D000000090090000000000009000000000000000000000090000000000000009000000BC9BC9B0BDA9090F90B0C9D90B90B09CB99D0B09CB90D0B00909000000000000000000000000000000000000090000000000000000000009ADAD00C000009C00000000000090000090000900000000000000000000000000000000000000000909B0B9C99090B9F9AB9F9B0BBD0B9F9B90B0F0F0B0F0B0909000000000000000000000000000900000000000000000000000000000000900C0DAD090C90C00000000000000009090000000000900000090000900000000000000000000000090B90D9A9ACB0BD0909C90B0BD90BD00A9CBDA999099909000000000090000000000000000900000000000000000000000000000000000000009ECF0E00C09000090090000900000000900900000000900000000000000000000000000000090090F9BC90999D9A9ADA9A90D09A9A9FBD0B909F0AD00BCB09090909000000009000090000000000000000000000000000000000000000000090009C90D0900009000000090000000000000000900090000000000000000900000000000000000009090B0B0B00B90999909A9B09C9090BD0F9A9990B00909A00000000000000000000000000000000000000000000000000000000000000000009E9C00CAC09C00000000000000090000900900000000090009000900000000000900000900000B0B090099C9BD0F0B0F9F990DB9BDA909B90D0F09090A9C9090000000000000000000000000000000000000000000000000000000090000000900C09E9090000090900000900900000000900900900900000000000000000000000000000000990D009BDA9A90B9BDB90B0F9B9ADADB9E9EB9B09ADA990B0000900900000000000000000000000000000000000009000000000000000000000000FC000C0C0090C0A009000000000900000000000000000000000000090000000000900000090090B9090999B9C999CBD99BC9F9BDBDE909DADA99090090090000000090000000000000000000009000000000900000900009000000090090000909C9090090009C0D000000000900000009009090909009000900000000000000000000000090B009BE90F0DB9BE9B9ADF9B9BDBBDBFFF0B9BDAC9A9A090090090000000000000000000000000000000000000000000000000900000000009000C00AC0C000C9009000000000000000000009000000000000000000000000000000000000009A099B099B9B90F99B9F9B9BDBDBDFFF9F0FDADA99A9C900B0000000000000000000000000000000000000900000000000000000009000000000909C9C9A90C9000C0E90090000900009000000009000009000000000000000000000000000090990B0D0BC9F9F99BDF9BDFDB9BFFFBDFFFB099F9AD90B09009009000000000000000000000900900000000000000000000900090000090909000CCAC00C00000CB0D0C00000000009000900000000900000000000000000009000000090009A90E909B999B09BDBDB9F9BBFFDF9FDFBF9FDFCB0F90A9000900000009000000000000000000000000000000000000000900000009090000000090B0C9E90D0D0B0C0CBC900090000000000090090000900900900009009000000000000000009099BD09FBDF9BDB9BDB9FD99BFFFFFFDFFFBFBDB0F99E9A909090000000000000000000000000000000000000000000000000000000909009A000C9F0C0CAC00C09C9C0E090000090009000000000900000000000000000000000000000000909F09A9B09B9F9F9F9B9DBBFFFDBFDBFFFFBDFDEDB9E9909C00000900000090000000000000000000000000000000000000009000000000000090C9CC0C90909C9CE9E0C9C00009000900009009A0000000000000000000000000000000000900B09BDBD9F0F9FB9BDBDBFD9BDBDFFFFF9FDFFBDB0F9BCB0B0090000000000000000000000000000000000000000000000000000009000090900CBCA0F0CAC0CAC90C9CBC9E9000000009000000090090900090000000000000009009000000B9DB09B09B99B9D9F9BDB99BFDBFBFFFFFFFBF9FE9F0F0BC9090009000000000000000000000000000000000000000000000000090000090000909C0DC0F090D090E9CAC0C0C0C900900000009000000000000000000000090000000000000090B09F0DBF0BD0BB99F9BDBD9BBDBDBF0DB99FFFDBFF9BD9B0BC9000000900000000000000000000900000000000009000000000000000000900000FC0FC0C0C0E0C9C0D0F09C9A0000000090000900090000000009000000000000000000009A999B9B9099DB9D9E90BDA9B9D99F9E9FBDFFF9FBFDBFCBADBC9A09000000000000000000000000000000000000000000000000000009000000000C0DEC0DAD009C9CA9E0C0CA0C09000900009000000009000000000000090000000000000909ADAD9E9F9FB0B9B99B909909A9B0999BDBBBDBFF9E9E9BD909B090000000000000000000000000000000090000000000000000900000090000909C9E90FC0E9EC0E9C09C9009C9CAD000A00009000090009000000009000090000000000000BD9B90B9B9B09DBE9DBCBB90F990D9F0F9FDFDBF9FFBF9F9EB9FC9E0000000000000090000000000000000000000000000000900000000000000000BCCDC0F0D0DAD0E9CA0C9C0009CAD0909000090900000000000000000000000000090000D0B09F9DA99BDB999B0999CBB9EBB0B9B9E9BFF9FBDF9FDAD9E9AB099900000000000000000000000000090000000000000000000000000000900000C9ACBCCADEADE0D0AD0AC00D0C0D0A000090000A000000000000000000000000000000090B9F9A9B9F0DB9ADBC9BCB99D099D9F9F9BF9F9FFDFB9EBDBBDBD9FCA0000900000000000000090000000000000000000000000000009000000009090EDCCCBDE0D0C9CAD0CD0BC00E9E0D009A00000909000000000000000000000090000090B9DB9DBDA99B9F9B99BF9B9F0BDA9B09FFFDFFFFFFBDFF9FBCBDBF0B90D0000000000000000000090090000000000000000000000000009000000000CD0BB0CE0FCADAD00F000C0C90C9E0F000900900000000900000000000000000000000BD9EB90B09B9F9F09F9F999D099999999F99FFFFFF9FFFBDB9F9FBC9F9E900000000090000000000000009000000000000000000000000000000000000DACCC9E9C0FC0CAD00DAD09ACBC0D00BC00B00090009000000000000900000000000000B99B9F9BD9F9B9F9BB9F9A9B9BD9BDF99F99FFFFFFFDFF0F09BCBF9CBDA900000000000000000000000000009000000009000000000000000000000090DAD9E9CAD0BCF0DAD0C0C0C90CB0E9C9A000900009000000000000000000000000009BDAD9E9BF0B0BDB9BDD99999D9D9F999DB9DBDFFFFFDFF9F9BFFBDBFBF0F0F090000000000000000000000000000000000000000000000000000000090C0DCC0E0D0EC90CAC0E0DAC90E90C9C0E90900A0900000000000000000000900000099E9B9B99F99BDB9BDB9B99F9990909999099FDFDFFFFFB9FB9F9BDBF0F9F990000000000000000000000090000000090000000000000000000090009000CBC0AD0F0D09ECBCBC9C0DA0D0EDA0BC900A009000009000000000000000000000090B9F9FDBF9BF99DBDA99CB09999B9B09BF99999FFFDFFDFD90B9FFBDF9DBDBE90000000000000000000000000000000000000000000000000000000000009CF09EC0E0C090C9CA0F0CD0E90CDC00E9009000B090000000000090000000000000BDA9F9BDBD9BE999BDF9999900B9F9BFFFF099099DFDFBFBDBDB9FFBFFBDADF0F0900000000000000000000000000000000000000000000000000000000900CDC9E9C90F0E9E0DC0CB0C9CE9A9AD00F00A9000000000000000000000000000909F9F9AF9BFBD9BE9B9909090B9BFBFFFBFFFFFF9D9B9FD90B90BFFDFDBFFFFBF0000000000000000000000000900000000000000000000000000000000000F0C9E9E0AC0C9C0F0909CC9E090C0D00F0090009000000000000000000000000009F99BDF99F9DBAD99CB090B9F9FFFFFBFFFFFFFFF00999BFBD9F9FFFFFFDBDFC9C90000000000000000000090000000000000000000000000009000000900D0CBECCD0D09E0F0C0CAC0BC0F0E9E0BC0900090009090000000000000000000009A9AF9B9BF9BBD9B9B909009BFF9FFFF9FFFFBFFFFF0000999A99BDBFBF9FFFFFFB0A000000009000000090000000000000000000000000000000000900000EDFC9E9AC0DA9C0F0F009C0BC0D009C0BCE9000090000000000000000000000000BDBDBDBF9BFDFBD0F090009BDBF9BFBC0BDBD09B90B909000990BDBDFDFFFFF9FDF99000000000000000000000000000900090009000090090000090000090000FE9EC9E0CCBDCD00DA9CC9E0F0E0FC090090000900009000000000000000000DB99BDB99F9B9DB9090000B090090909990909909D0000009A09F9BFFFBFFDBFFE9E0000000000000000000000000000000000000009000000000000009000DED09CC9E0D0BCCA0AD0CCE9A0D0C9D009E0000090000000000000000000000099A9FBDB9DA9B9FB009000909909B90999B0F9BDEF90999F9A9C9999BF9BDFDBFFF9F090000000000000000000000000000000000000000000000000009A000DAD0FECBC9CADE0BCDCADA90CDCADACACFC90009000090000000000000000000009F909F9FBDBDF9DB90B9F090909099090999099999F9FFFFDB09F0BDBFDFBBF9FDFBDA900009000000009000000090000000000000000000000000900009000C0F00BCACBC0DCCB0D00CE9A0F0CD0D00E0900009000000000000000000000000B9FB99A99B9B9B99E90B9F9BCB9DA9DB9FDBDF9FFFFFFF9FFDB09BDBDBB9FDDBFBEDBD00000000000000000009000009009000000000000000900000900009A9DCFDC9C9C0F0E9CCA0D09CC90CB0F0FC900000000900000000000000000000090F9DBD9BD9F0F9BC9BD9B9DB99F999B9F9BDBFFBFDFFFFFF9A9DB099BDDB9FBFDFFDBCB0000000000000000000000000000090000000000000000900000090CCAD0CA0F0CBC0D0E90DA0CA9ACF0CC0C000090900000009000000000009BF0099BB9B9BFDBB9B9B99B90BC9B99F9DBF9F9BDBF9DF9FFFF9F0F99B9DBBDABFDBDFBFFFE90090000000000000000000000009000000000090000000000900000C9AD0F0DC0F0C9CAD0CA09C90CD00DA9EDE90000000900000000000000000BF000BD0F0F09B9C9F9DA90BD99A9F9B9B99B9DB999BBFFFFDFF9F9F0D0B9DB9D9FBFD9FDBDF900000000000000000000900000000000090000009000900000009CBCDED000F00F0E9CAD0D0E0E9A0F0CC090C00090090000000000000000000909090B99B9BD9BB99A9D9F9B09D09BC99F9DA90F9D09B9FDBDF99A99B99F9DBF9DFBFFFFFBEDA900000009000009000000000000000000000000009000000000C0C0E9EFC90C90C9C0D00A0909C0D0DA9ECE90000000000000000000000000000000BDBD9F9B0D9F9DB9B909BF9BD09B0B9B99F90B9FDFBDFA9F9F9F0DB9B9F9FFBDFFFFDFDB00090000000000000000000900900900000090000000000090090D0D9C9C0AC9ACB0E90CBC9CACADACE9CC900009000000090000000000000000909B99CB9AD9F9F09B9AD09BD9090B999D99CB09B9FFFFDBFDF0BD09BB9F9FBDFFDFFFFDFFED0900000000000000000000000000000000000000000009000000C0F0CADECD0C900D00F00CA909C0D09CB0C909000900000000000000000000000009CBB9F9DB9B99F9D99B909B9B99E99A9B9090D9BD9FFDBDBDB9B99DB9F9DBDFFFFFFFFDBBC00900000000000000009000000900000900000090000009009E9C0FCDA9AC9E0FC0F0CF09CEDA9E0DE0CDA00000000000000009000009000009090F9DFF9B99F9F99B9BD9F909D9F99A99009B090B0B90FBDF9BD90F9BDBDBFFFFFFFFFFFFDE9900000000000000000000000000009000009000000900000000C9C0BCFCD0E9C09E0DA0DE0900C9CA9CB09000090000090000000000000000000090BB99BDBF9F99F9BDA99090B0990900990990BC90099DB9BDB0999F9F9F9FDFFFFFFFFDFBCA0909000000000009000000090090000000000000000090090D0E9CC9CBCAD0E9E0DACDE0DACAD0E9C0C000900000000000000000000000000909A9BD9BDBD9BDFBDBDB9DA9B909B09C90B099CB99F0909B9BC909B9F9B9FBFFFFFFFFFFFFED0900000000009000000000000000000900000009000009009AC0C90C9EBC0DAC9C0F0C9E0F0C9DAD0CADA90000000900000000900000000000000090DBF9F9FBDB9DBDBDB9D09AD909B00D9B0B99F999BDFFD9B9B99F99FFFDFFFFFFFFFFFFDFF00090000000000000000000000900000000000000090000C0DCBCDACDCF9C9ACBC0F0E9C0F0AC0AD0D0C0090009000000000000000000000000009B99B9FBDFBDBF9BDBDBBD990B0999B09D99B99BDFFFFFF0D09DB9F99FFFFFFFFFFFFFFFFCDA90000000000000000000000000009000000000090000909C09C0CDA9E0CA0CD09E0D0CBC0DC9ED0E0F090000900000000000000009000000090909FFF9BDBDBDBDBDB9F9D9A999099BD9B9BDDF9FFFFFFFC9B9F9BDBFFFDFFFFFFFFFFFFFFFB00000900000000000000000000000000000900000009000A9EC9EBCDE9F09C9A0E0DACBC0DA9AC0F0DC00009000000000000000000000000900009BF9BDF9FBDBDBDBDF9F9B9DB099AD9BDBF9FBFFFFFFFFDB9DB9F9BDBDFFFFFFFFFFFFFFD90D0090000900000000009000000000009000000000000000DCDAF0D0F0FCC0AC0D0BC90C9E0CCDAD0E9AD090A00009009000000000000000000009A99F9F9FBDB9BDBDB9FBF9F90B0999BDBD9BBDFFFFFFFF0D9B9FFFFFFFBFFFFFFFFFFFFFFFF00000000000000000000000000009000000000000000009ADADC9EF0FCB0D09E0D0ED0F090B00DADCE0C0A09009000000000000000000000000909F9BFBF9DBDF9F9BDF9D9F9BD990F90BDBD9FBFFFFFFFF9BDF9BDBDF9FDFFFFFFFFFFFFFFCBF000000000000009000000000090000000000009000000000DAFE9EF0FE000C0DAD00E0CAC0DA0D0BCDE909000000000000900000000000000000B0BD9F9FBDB9B9F9F9FBF9BDB9E999BDB9BD99FFFFFFFD9BBBFDFFFBFFFFFFFFFFFFFFFFFBD0900000000000000000000000000009000000000000000009ED0FF0FFAD0C9ADAC0DE9C9C9A0C9CACDA9C000090000000000000000000900900099F9FFF9F9F9F9F9BDBF9DBDBDB99A9D99F9B9FFFFFFFFFFDFDFFBFDFDBDBDFFFFFFFFFFFDF9E00090000000000000000000000000000900000000900900CB0FE0FF0FF90C00D0F00C0A00D0BCADF0CF09090000090000000000000000000009A99F99FBDBDBDBFDB9F9FBDB9BDBD9B0FB9DBDBDFFFFFFFFFFFBFDFBFFFFFFFFFFFFFFFFFFDE9000000000009000000000000000000000000000000000909CFF9FDAFDAC90E9E00DA0D0C9AC09C00F0CE00000090000090000900000000000009A9FFBDF9F9FDFDF9F9F9BDBF9B9BF999DBD9BDBFFFFFFFFFFFDFFFDF9F99FBDFFFFFFFFFFFF0900000000000000090000000909000000000000000090CAC9CAFAFDAFF00C9C9EDAC90CB0C9ACBCFCE90900090000090000000000000000000009F9FDFBF9B9BD9FB9F9F9BD9F9F90BDB99B9DBDFFFFFFFFFDFFFFFF9F9FFBDFFFFFFFFFFFDE90000000000000000000000000000000000000000000009C9EBDCF0BFCB0E9E0E9C0D0E90C9AC9CBC090000900000000000000000900000000099BDBDBBDDBDBDBFD9B9B99F9F9B99F9A99F9F9BFFFFFFFFFFFFFB9F9F9F9BDBFBFDFFFFFFFE9000000009090000000000900000000000000000009090DE9ECD0EBCFCBFD00D0D0ADAD00DA0D0E9CADE90000000000000000000000000090090009BDBFDBBDBDBDB9FDDBDB99BF9DF9F9DB999F9BFFFFFFFFFFDEDF0F9FBFFFDFDFFFFFFFF9F000000090000000000000000900000900000000000000000C90BC9CDABCF0CF0ACD0C0ECD0DAC9CE9C0000900000090000009000000000000000090BBDBFDBF9F9BDA9BBDA9F099A9B09B99F9F9FDFFFFFFFFFCB9B9F9F9DFFFFBFFFFFBFFFE9090090000000000000009000000900000000000090000090FCDCBCBCDCBC090DC9ADAD09AC0C9E0DCBDE900009000000000000000000000000000009FFBDBDBBDBDB9D0909D09E9D99F9D9F9BDB9BFFFFFFF99BDBC9090B90B9BDFFDFFFFFFD000000000000000000000000000000000000090000009000C0000C0C9E9EFCAC0A0CC0CBCC9E9E0D0AC00000000000000000000000000000000000909B9F9B9BDB9BD9A9A990B0990B0B9AB9BDBDFFFFFFDD0BC990A90B090B9FEFF9FBFDFA9000000000000000000000000000000000000000000000000090DAD0DAD0FC99C9C9CB0F0C0BC0C0DACD0FC9090000000090000000000000000900000909FCBF9F90F9A99D99A9090A90909D0D9BDBF9FFFFEB909A09909C99F9F9F9FFFDBFBDB00090000000000090000000000900000000000000900000900C0C00CDAC9EF0CAC00C90DAC0BCBC0DACD00E000900090000090000000900000000000090BBDBCBFB9D9B0B09099A9909090B9B9DBDBFFFFFD0E909000909A09B0FDFBDEBCBDBC09000000900000000000000090000000000000000000000000900DA0CDAD0FF0D09E9CA0D0D0D0DE0D9ADF090000900000000000000000000000000090099B9B99DB9A9D090B009000A909099FBFBDFFFFDA9909090B9A999CDFBF0F9999B9A0900000000000000000009000000000000000000000009000000C90CD00DE9EC0CAC9C0CDACACACA0D0ECC000009000000000000000000000000000000090B9F0B0B0BD909BC90BD09990B090F99BDFFFFDF090B009090000AFB0D099A09ADBC900000000000000000000000000900000000009000000000000000C90EDE9ED0F0D00ADA0C9C9C9CDAC9E9ED09A0000090000000000000000000000000000909D090900B0F00090BFA00909A99BFDBFFFFE99F00090F0009090DF000099F9B0B0000090000000090000000000000009090000000900000000909C90CC9C0DEBD0CAC9C0D09AC0FCBCDAC9E9CA0D09000000090009000000000090000090090B0B90909090B0900009DF00909099BBDBFFF9E099090BC9000000A9009B090F0D0900000000000000000900000900000000009000000009090C0000C9A0CBCBCDCAD09C09A0E09E00C0ADF0CCB0DA000900909000000000000000000000000000990B0B000BC0000F0BE009A909A9F9FFFFFF99A09009A00909090009E909B90B000000000000000000000000000000000000009000090000C90F0D0C0D0CDCBE09C0E0BC0D0D0C9EDADC0EDBCDE090B0C9A000000000000000000000000000909AD090900900909A090990090B9DBBDBFFF9E009009000000000009E909E9CB009000000000009000000000000009090A90900000900000DA0C0C000D0CBCBED0CBC9C0BC0CA9E090DCAFDAC0E9E000AB0C0000000000000000000000000000909A90099C000000900000900099B9FFBF9FF90909009009000009FE90A99A90900090000000000000000000900000009000000000000090009009E9C0E9CBC9FE9CAC9C0DA9C09CECA9C0EDBE9C9F0DDEB090000000000000000000000000000909ADB0B09090000099B009090F9B9F9FFBDF9CA090090009C9FBD00990BCB009000000090000000000009000900000009009009000000090C9C00C9C0C9CF0F90D0DA9CADC0FCA90DCBC9E0DE9ECBFAFC000090000000000000000000000000090909009BDAD9CB9A0009A09B99FFBFF9F0B9B0900909B0B9A0009BCBF0909000000000000000000000000000009000000000900090000C00009C000DACBCFCCACAC0CE9CAFC09CFCAC9ECDE9ECBDAFC090A000000090000000000000900000909A90B09009A0B000909009B09FB99F9FF9F00900900000900909A09009000000000000000000000009000000000009000900000900909090D0C090D0C9CBCB0D0DAD09CAD0ADE009CBED0F0EDBEFFF900D9C90000000000000000000000000090990D9E0909900900909909DB99FBFF9F90DB0090909090090B09090900000000090000000090000000000090000000900090000000C00C000900E0DACF0FE0E9C0ADAD0FCFADEDE9C9ADAF9EDFBEFEF0A9A009000000000000000000000000000A9A990B000990900000B090F99F9B9E9B0900000009090090000000000000000000009000000900000000000090000000009009090D09C0C0AD0D0D0DE9FC9CADCC00E0F0DADACADEFFDEFBFAFFBDADFED0000000000000000000000009009099090A9090900000900009FB9BF9FFF9F9DAD000000000090909000000090000000000000000000000090000090009090900000000E0C00909C000C0F0DE99CAD00BCF0D0FEF0E9DEBEBEBFEFFFFFEDFADA09A09000000000000000000000000000909090000090000999B999F9FBF9DA9B99A90900000000000000000000009000090000000000009000090000900000000000009C909C00C09CF0F0DE9EE9C0FCC90DAD0D0ED0E9FDFFFFBFFFEFFADFAD009000000090000000000000000909B0009000900009090BE9DADB9F9F9FB9F0F09000090090000000000000000000000000090009009000000000B00900090090009C000C00D090C00D0CF0FFCBED0BCE0C0ADADBEDE0CBEFFEFFEFFBFFEBDA0009009000000000000000000000909B9A09000090CA9C9D9B9B9F9FBDF9F9DB9F9BD9F090090000000000000000009000000000000000000900D00D00A90000009009CD09C00C0C9C0C9E0F0FADCBEC90DADC0CAC9ADCBCBFBFFFFFFEFFBFE0D000A900000000000000000000000909C99A9DBDA999B9FB9FDF9BDBDBFF9BBDB9E90B00090000000000900900000000000000000000000000C9A9FA9ED009090000C0A00C09C00B00BCE9CDADDFAFC9EDE0C9E9C9EDCBCFDFEFFFFBFFFFEFE9000900000000000000009000009090B9B9B9DB9BF9FBDFB9DB9B9FBFFFF9FFDBDF9B9009000900900000000000000000009000000000009000FADFCBDE90F000090090D0D00C090C0DC09CFADFEADBFE9E9CBC0E9E9EADC9AFFFEFFEFFFFFF9E90009A090000000000000000000009099ADB09F99BF9FBDFFBFDF9F9F9FFF9BF0B9FC9009000000090000000000000000000009000000000900DEBFEFBEF0DCB0000C0000D090C09C00FCB0DFA9DECBFEBEDCBC90C0DCACFC9FFFFFFFFEBFEFEFE9009000000000000000000009090B0D9BDBDBF9DBF9FB9BD9FBFBF9FB9FF9F9F09B00000000000000000000000000000009000000090000090DFBFFE9EDACC9CA909C000C090C00D00DCF0DFCADBF0FFFABC0EDADA9CBCBEBFFFFFFFFFFFBFC9000009009000000000000000000909B90B9B99FBD9FBDFFBFBDBDBDBCB9DA9BDB0009000000000000000000009009000000000000000000000FAFFFBFDAD0F0C9C0C09C900C09CDACD0E9EBC9C9ECFFF0FCDE90CC9EFC9EDFEFFEFFEFFFFFCB000909A00000090000000900000909B09F9FF9FB9FBDBDB99F9FDFFBDBD9A9D090909000000000000000000000000009000000000900009000DBDFAFCFADAD0C9C0C90C000D09C000DAC9CBCFCBCF9E9EF0FA9EDEBCC0BCDADBFFFFFFFFFEFBC0900000000000000090000000090909DA9B99B9DBDFBDBDBF9F9B9BDBDBC9B09A90000009009000000900009000000000000000900009000090FAFFBF0FC0C9CAC90C090D000CA0DC0DADEDF0EDACBCF9EFDECBC9CBDCCADCADFBFFFFFEFFFEF00009009000000000000000000009A999F0F9FBBDB9FB9BDB9F9F9CB9A9B00909090000000000000900000000000000000000900000000C0000DFFFFFF0FDE0DC0CB0C000D0D0D00F0CD0F0FFFADFCF0F9FAFBCFACCADADADCFAFFFEFBFFFFFF0F09009000900000000000000000009A99B9B0DDBDBDBDBF9DB9EB99F9D0090B000000000000000000000000000000900900000009000900909EBFFEBCF0C0D009C0C90D000C00C9C9CAD0F0FFFFAFBFEF0FFCF0CDADAD0C0DADFEFFFFFBEFBEF0000000000000900000000000090909DA9DBDBBB9B9F9F99BBD99DB09B0909009090090000000000009000000090000000000000009000000CBFFFBDF0DAD0E9C009C00C0D00D0C0CADCF0FFFBFFFEFBFFEBE9EF0D0DE0F9EDADBFFFEFFFFFFDF0909009000000000000000090009A9BDB9F9F9DBDBDB9DBC99A9B0F09A000900000000000000900000000090000000000090090000009000BDFFFFEBEDC0D0C09C00D09E09E0DAD0DADADF0FEFFFFFEFBDF9E9EBCE0DCCC00DECBFFFFFFFFFAFC0A090000000000000000000000090090B9B9BBDB9BDBB9B9BD0990909090090000000000090000000000000000090000000000000000090CBFFFFFCBCBC0D0C09C00E09C0D00D0E0D0F0FFFFFEBFFDFEEBEFFDEDBDADA9FCAD9FCBFFEFFEFFF090000000000000000900000000909B9BDBDBC9B9F9BD0F9F9A9F09A900090009000900000000090000000000000000090000009009000009EFFFFFBCBCCBC0BCC09C9C00D0CD0C9DE9CF0FFFBFFDAFADBDFBFAFACECADCC0D0ECBEFFBFFFFADAC090009000000000000000009009B0D099B99BDB9BE9B9B0D9900900909090000000000000000000000000009000000000000000B009CC9FFFFEFBCFCC90C9C0A9C000CD00F00FCE0DE9FC9EFCBEDADAFAFEFFFFBDBDADADE9C9CD0FFFFFFFEF9C00900000000000000000000090099BCBDBBDBDAD99BC99A009B09000000000000000000000000000090000000900000090009000000BCFBFFBFEF9E9ED0C0D0C09CD0A9C0CD0D0DE9EFBE9EBC9EDEDFFFBFFFFFEFEDADADE9E0FC9EFBEFFFAFBC00000000000000000000000090A09B09C9B9B9BBD9BC999A090090900090000000000000000000000000000000900000000000900009EFFFFFBFE9C00D0C0C9C00AD0C9C9ACADA9E9CFCFC9EF0FBFAFFFEBFEFFBFFFFFE9EDBCBCBDFFFFBFFCA9000009000000000000000090999009B9BC9BD0D0B90B00900090000900009000090090009000900000090000000900000909000900CBFFFFFFCBEDED0E90D0AD0D0C9CACD0DCDE9EFB0F0FE9FBEFFFAFFFFFBFFFAFFAFFFBEDF0FEFBFEFEDA90090000000000000000090000000A990D09BD9B9B9A900B09090090000000009000000000000000000000000000000000900000000DBFFFFFFEBF0D00D0CC00D0C0C9E0C9C9E9E9EDBCF0F9FFEFFFBFFFFFFFFEFFFFFFFBEFFBEFDBEFFFFBFFC0000000000009000000000009090900B9B099A909C9090900000000090090000000000000000000900900009009000900000000900ADBFFFFFFFCF0CF0D09AD0D0F0C9C9CADCF0DEAFFFFEFAF9FAFEFFFFFFFFFFFFFFFFFFFFFFBEFFBFFFEFBF090000090000000000000000000909009CB0D9BDA99A090090090090000000000000000900000000000090000000000000000900090EFFFFFFFBF0F0C0CC0C0C0C0D0C9E9C0E9EBDF0FFAFBFFEFFFBFFEFBEFFFFBFEFFEFFFEFFFFBFFEFFFBCF00090000000000000000000009000090B099A9C9900900090090000000000009000900000009000000000090090090009000900090DBFFFFFFFFFE9E9CB0D0DAD0D0E9C0C9E9C9CE9FFFDFFCFBFFFFFFFFFFFFFEFFFBFFFFBFFEFFFEFFFBFCFB0900000000000000000000000000090090B090B09A9009000000000090000000000000000000090009000000000000900090000B0EFFFFFFFFFFE9CD0D0C0C0D0E0C9C0CDADCFEFBFFAAF0FBEFFAFFFFFFFFFBFFFFFFFFFFFFFFFFFFFBFEFBFC0A0900000900000000000009000900900909A90B00900090090009000090000000000900000000000000900009000A0090090AD0FDBFFFFFFFFFFFE0C0C9CBC00D0D0D0F0CDA0DADADFFBFEFFBFFFFEBFFFBFFFFFFFFFFFFFFBFFBFFFFFFFEBF09000009000090000000000000000000900090909000900000000000000090009000000090000000000000000009090000000DADAFFFFFFFFFFFFF9F0F0C0C9C90C0CAD0DACDE9CFFAFFEFFBFEFFFFFFFEFFEFFFFBFEFBFFEFFFFEFFFFFFFFFC90090900000000090009000000000900009000090909000900090000000000000000000000090090000000900000000009009AFFFFFFFFFFFFFFFFECD0C9C90CAC9E9C0C0D0F0FBCBDFFFBFFFFFFFBFFFFFFFBFEFFFFFEFBFFEFFFFFEFBFAFCBC0B0000000000000000000000000000000009090000000000000009000000000000000000000000090900000909AC9090009EFFFBFFFFFFFFFFFFE9F00DAC0C9C9C0C0D0F0F0DECBFFAFFFEFFFBFEFFFFFBFFFFBFFFFFFFFFFFBFFFBFFFFFFBE9000B00000900000000000900000000909000000090009000090000000000000000900009000000000000900000900009000BFFFFFFFFFFFFFFFFFC0FC0D0D0C0C9C9CAD0CCFADBFCBFFFFFFFFFFFFFEBFFFFFFFFFFFBFFFFBFFFFFFFFFFFEFF0900090000000000000000000000000000000009000000000000000000000009000000000000009000000000900009000090BDAFFFFFFFFFFFFFFBFC0D0C0CB0CBC0E9C0DA9CDACBFCFFFBFFBEFFBFFFFFEFBEFFFFAFFFFFEFFFFFEFFFAFFBDAC009000900000090000000000009000000000000009000009000000900000900000000900009000000000009009000009000CBFFFFFFFFFFFFFFFEDAD0F0D0C0D0C9C0D0EDCB0FDADBFFFFFFFFFFFFFFFFFFFFFBFFFFFEFBFFFEBFFFFFFFEFFE90900090000000000000000000000000000000000000000000000000000000000000000000000000090009000AC0090B000DBFFFFFFFFFFFFFFFADAD0C0C0C0D0C9C0DAC9CADEDAFFFAFFFAFFFBFEFBFFBFFFFFEFFFFFFFFFFFFFFFFAFFFFFAD00009A00000000000000000000000000000090000000009000000000000000000009000000000009000000090909A000000BCBFFFFFFFFFFFFFFF0DC0D0DAD0CB0CBC0D0E9DCB0FDADFFFFFFFFFFFFFFEFFFFFFFFFFFBFFFFFFFFFBFFFFFFFFEFC00090B09090000000900000000000000000009000000000000900000900000900000009000090000900000000009090900BFFFFFFFFFFFFFFEFF0DAC9C0C9CC9C0D0C9CCADEDAFFAFFFFFFBEFFBFFFFFFEBFFFFBEFFFFFFEBFFFFFFFFEFFFF0B0900000000009000000000900000000000000000900000000000000000090000000009009000000000909000909000000DFFFFFFFFFFFFFFFFBCF0C9E0D0E09C0D0F0E9AD0F0FCBDFFFFFFFFFFFFFFBFFFFFBFFFFFFEFBFFFFFEFFBFFBFFF0FC000909000000000000000000000000000000000000000000000000000000000000000000000000900000009000000B09FBFFFFFFFFFFFFFFFFDE9ED0C9C0C9C0F0C0C9CDCF0FCBFFAFBEFFFFFFFEFFFFFFFFFFFFFBFFFFFFFFFFFFEFFFFEFFBDE9000009000000000000000000000000900000000009000000000090000000009009000000900000000000000009000AFFFFFFFFFFFFFFFFFEF0CD0C9C0D0C0D0C9C9CE0F0FCBF0FFFFFFBFFFBFFFFFEFFFFEFFFFFFFFFFFFFFBFFFFFFFBFEFBCA9090000900000000000000000000900000900000000000000090000900009000000009000000009000B0090900009FFFFFFFFFFFFFFFFFFFBF0ADAC9E0DAC0DAC9E90F0F0FCFF0FFFFFFEFFEFFBFFFBFFFFFBEFFFFFFEBFEFFFFFBFFFFFFBCF9C0A09000000009009000000009000000000009000000090090000000000900000900000000000000900000000099FFFFFFFFFFFFFFFFFFFFFCFD0C9C0D0C9C0D0C0CDC9CF9ADAFFFFFFFFFFFFFFFFFFFBFFFFFBEFBFFFFFFFFFFFFEFFFFBEFBCA909000000900000009000000000000000000000000000000000000000000000000900000009009000909009090FFFFFFFFFFFFFFFFFFFFFEBC0C9CAD0C9C0F0C9CBCADEBCFFFFBFFFBFFBFFBFFFBFFFEFFFFFFFFEFFFFFBFFEFFFFFBEFFFFCF90C009090000000000000000000000000000000000000000009000000900009009000009090090000000000000BFFFFFFFFFFFFFFFFFFFFFBCBCBC9C0D0E9C0D0E9C9DE9CFBCBCFFBEFFFFFFFEFFEFFFFFFBFFFFFFFBFFFFFFBFFFFFFFFFFBFAFB0900000009009000000900000000000900000000090000000000000000000000000900000000009000090909FFFFFFFFFFFFFFFFFFFFFFDFC9C0C9C0D0C9C0D0CAC0DE9CFBFBFFFFFFFEFFFFBFFFBFFBFEFFBFFFFFFFEFFFFFFBFFFFFAFFFFDE9E0909000000000000000000009000000000090900009000000000000090000009000000900900009090000FFFFFFFFFFFFFFFFFFFFFFFFADE9CBC0D00D0E9C9C9CFA9EF0FCFFFFFFBFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFEFFEBFFFEFBEBE09000090000000900000090000000000009000000000000009009000000000000000900000009A9000000FBFFFFFFFFFFFFFFFFFFFFFEBCD0C9C0DACDAC9C0E9ED0DCF0FBFFAFFFFFFFFBFFFFBFEFFFFFFFFFFFFEFFFBFFAFFFFFFFFFFFFFFDBDA09000009000000009000000009000000000000000000000000000000000900009000909090000000090FFFFFFFFFFFFFFFFFFFFFFFDFCADAC9C0D00D0C9C9CCBCEB0FEDADFFFFFFFBFFFFEFFFFFFBFFBFFFFEFFFBFFFFFFFFFFFFFFFFBEFEFADBC09000009000900000000000000090000000000000000000000000000000090000000000C90C9C90CBFFFFFFFFFFFFFFFFFFFFFFFBE9D0D0CBC0D0C9CAD0D0C9CDE9FBFBFFFBEFFFFEFFFFFFFBFEFFFFFFFFBFFFFEFFFFFBFFBFEFBFFFBFBDBCA9000000000000900000000000000000000900090000900000009000900000000090000B000B0A00BFFFFFFFFFFFFFFFFFFFFFFFFEFCED0E9C0DAD0E9C0F0ADE9ADE9EDEFFFFFFEFFFFBFFFFFFFFFEFFFBFFFFBFFFBFFFFFEFFFFFEFFFFFFEFE9009000000000000090090000000000900000000000000900000000000000000900009000BC0009FFFFFFFFFFFFFFFFFFFFFFFFFFF9E90C9C0D0C0C9C0D0CDC9EDE9EFBFBFFFFBFFFFFFFFEBFFFFFBFFFEFFFFEFFFFFEFFFFFFFBFFFEBFEFBF9EF0090000900000000000909090900000000000000000000000000000000900000090090009090AFFFFFFFFFFFFFFFFFFFFFFFFFFFE9CF0C9E0C9C9C0DAC9CBC9E9FF0FCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFBFFFBFCFF9EDA0090000000900000000000000000000000000090000000000000009000090000000090000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9CD0C9C0E9CBC0D0E9CFCBC0FFBFFFFFFFFFBFFFFBFFFFAFFFFFFFFFBFFFFFFFFFFFBFFEFFFFFFFFFFBEFFAD090000009000000090000000900090000090000000009009000090000000000909000090FBFFFFFFFFFFFFFFFFFFFFFFFFFFFFBCF0E9C0D0D0C0D0C9CCBCBCFF0FCBFFFBEFFFFFFEFFFFFFFFFBFEBFFFEFFFFEFBFFFEFFBFFFFFFFEFFAFFDBCF0C000000000000900000090000000090000000000000000000000000090009000009090CBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCF0C9CAD0E0D0D0ADACBC9CBF0FBFFFFFFFFBEFFFFFFFEFFFFFFFFFFBFFFFBFFFFFFFFFFFFFFEFBFFBFFFBEFBFA909090000090000009000000000000000000000090000000090000000000000090000BBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FD00D0C9C0DACD0C9C0FED0FDE9EBFFFFFFFFFBFFFBFFBFFFFFFFFFFFFFFFFFFFFBFFFFFFBFFFFFFFFFFFBCFCBCA000000000000900900900090000000000000000000000000000900090090000090CBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFC0CF0C9C0D0C90C9CADD09EF0FBFFFFFFFFFFFFFFFFFFFFFFAFFFFFFFBFFFFFFFEFFFFEFFFFFFFFFFEBFFEFFBFCB09090000000000000A000900009000009000000000009000009000000000090900BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF9F0C9E0D00F0CDAC9D0EDE9CFADE9FFFFFBFFBFFFFFFFFFFFFFFFFFFEFFFEFFFFFFFFFFFFFFFFEFFFFFEFFBFFCBC9C0009000090009090900000000009000000000090000000000000900909000ACBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD9E0C9C0DACD0CF00DACE9CBCBE9FBFFFFFFFFFFFEFFFFFFEFFFFFEFBFFFFFFFBFFFFFFFFFBEFFBFFBFFFFBFFEBFFFFBE9009000000000000B00900000000000000900000000009000900000000909BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAED0DAC90C90C90CD0C9DE9CF0DFCFBFFFFEFFFEFFFFFFBFFBFFFFFFFFFFFFBFEFFBFEFBFFFFFFFFFFFFFFFFFFFEBCBCBCBC0000000090090000009000000000900000000900900900E0009000000CBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDBCD0D0ED0CBCC90E9CA0DE9EFAFBDEFFFBFFFBFFBFFBEFFFFFFFFBFFFBFFFFFFFFFFFFFFFFFBFFFFFEFBFFEBFFBFFFFFBE9AD0900900A9009090000090000000000000000000000090900009000DBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBEDADE0D00D0C90E9C0DCDE9E9CDBCFBFFFFFFFFFFFFFFFFFFFFEFFFFFFFFBFFFFFFFFFFFFFFFFFEFFFFFEFFFFFFFFFBFBFFFF0B009A0990C9AC00090000090000090090090009090000009000C9FBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEDAD0C9C0DE0D0C9C0DA9E9CBDEBEFBFFFEFFBFFFFFFFFFFFFFFBFFFEBFFEFFFFBFFFFFFFEBFFFFFFFBFFFFFFFFFFAFFFFFBFBFEBC09FACB9E9BC9000900009090000000000900000909000090B0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBCBC9CBC09C0F0C0F0CD0DE9E9F9EDAFFFFFFFEBFFEBFFFBFFFFFFFFFFFFFFFEFFFEFFFFFFFFFFFBFFFFFFBFFFFFFBFFBFFFFFBFB9A9DACB9EBFA9E0C0900000000000900000900000090090CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9E0C9CC9C0D0D0DACF0DE9ECFBFFFFFBFFFFFFFFFFFFFEFFFFFBFFFFBFFFFFFFBFFFBFFFEBFFFFFEFFFEFFEBFFFFBFFFFBFFFFEDABDBFEFDADE9FBCA9A909009090009000009000000F0FBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FC9C9E09C09CBC0D0D0DADE9BCF0FBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFEFBFFFBFFFFFBFBFDE9FBFBFFBFFCBDAC00A09000000000090009090F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF9E0D0C9EC9C0C0F0CBCBCF0FCFBFFFFFFEBFFFFFBFFBFFFBFFAFFFBFFFEFFFFFFFFFEFFFFFFFEFFBFFFFFFFFFFBFFFBFFFFFBFFFFAFBEFFFEDAFEBFFEDBF09C0009A90900000000ACBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBC0D9E0D009CAD0D0C9CE9E9EDBBCFBFFFFFFFFFAFFFFEFFFFFFFFFFEFBFFFFFFFFFFBFFFFFFFFBFFFFFFFFFFFFFFFBFFFFBFFFFFBFFFFBFBFBFDBDFAFBE9EF0BDAD00C0AD09000D09FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCE0D0CDCC9C0DAD0F0DCDE9ECFBDEFFFBFFFBFFFFFFFFBFFFFFFFFFFFFFBFEBFFEFFFFFAFFFFFFFEFFFEFFFFFEFBFFBFFFFFFFBFFBFBFFFEFFAFFBFFFFFF0FCADAF0BFCAACC99AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0BD0C9A009C09C0D0CDADA9E9F0FBFBFFFFFFFFFFFBFFFFFFFFFFBFFFFFFFFFFFFFFFFFFFFBFFFFFFFBFFFBFFFFFFFBFFBFFFBFFFFFFEFBFBFBFFAFFFBEF0FFADBFCBFCBFDFBFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FCCCBCDCFC0BCC9CADADADCFDAFDEFFFFFFFEFFBFFEFFFFEFBFFFFFFFFBFFFFFFBFFFBFFFFFFEFFBFFFFFFFEFFBFBFFFFFFBFFFFBFBFBFFEFFEBFFFBFFBFFBCFBCEBDEBCFAFEBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9A9C00000DC9AC0D0C9CFADADEBDBFFFBFFFFFFFFFFFFBFFFFFEFFFFEFFFBFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFBFBFFFFFFFFFFFFFFBFBFFFFBFFFFFFADBCFBDEBDFBFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9FCD0DEDCD00CC9CBCBCF0DCBCBDEBFFFFFFFBFFFFBFFFFFFFFFBFFFBFFFFEFFFEFFFFFFFBEFFFFFEFFFEFFFFFFEFFFFFFBFFBFBFFFFBFBFFFFBFFFFFFFFEFFEBEDEBCAFCBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0E9E0909AC909C90CD0CF0BCBDEBDEBFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFBFFFFFFBFFFFBFFFBFFFFFBFFBFFFFFFFFFBFBFFFFFFFFFFFFFFFFFBE9E9EBCBFDBEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F9C0DCCCC9ECCACC9ACF9EDEDE9EBFFFFFBFFFBFFFFFFBFFBFFFFFFFFFFFBFFBFFBFFFFFFFFFFFFFFFFFFFFFFFFFBFFBFFFFFFFFFFFFFFFFFFFFFFFFFFAFE9EDBCF9EDAFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCE9C00B09C909C9BCD90CF09E9FDFBFFFFEFFFFEFBFEFFEFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFFEFBFFFBFBFBFBFFFFFFFFFFFFFFFFFFDBDE9ECBCE9EDADEFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBD0FCDCC0CCD0CC00ECF0CFCBCBE9FFFFFFFFFFFFFFFFFFFFFEFFBFFBFEFFFEFFFEFFFEFFEBFFEBFFEFBFEBFFFFBFFFBFFFFFFFFFBFFFFFFFFFFFFFEFBEF0FCBDE9FCBCFBFFEFBEFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBECF00090B09A090DD09CF9CBCFE9FEBFFFBFFBFFFFFFBFFBFFBFFFFFFFFBFFBFFBFFBFFBFFFFFFFFBFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFFFFFFBFBCF9EDADA0F0ADA9E9ADBEDBEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFED90DCFCCCCCCDECCACDE9CADCB9EDBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFBFFFFBFBFBFBFFFFFFFFFFFFBFEFFBECB0DCEDCEDCEDCEFCE9EDBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0EC0009090900909CBC0CED0FCFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFBFFFFFFFFFFFFFFFFFFBFFBFBEDBFCFAD9E9DAD9E9DADBC9ECBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9DEDCCDCCCDCCD0DCBDBDADADADEBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBE9E9CAC9E0DAC9E0DAC9E9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0CA900B00B00B00E00C0C0DADADBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDEFDEFDEFDEFDFFFFFFFFFFFFFFF000000000000000000000105000000000000A9AD05FE"); - var encodedString = Encoding.Default.GetString(byteArrayValue); - var base64String = Convert.ToBase64String(byteArrayValue); - - Console.WriteLine("Original length: {0}, Encoding length: {1}, Base65 length: {2}", - byteArrayValue.Length, encodedString.Length, base64String.Length); - - CompareMultipleRuns( - "Convert.FromBase64String", () => Convert.FromBase64String(Convert.ToBase64String(byteArrayValue)), - "Encoding.Default", () => Encoding.Default.GetBytes(Encoding.Default.GetString(byteArrayValue)) - ); - } - - [Test] - public void Compare_Type_test_with_Parse_Func() - { - var testClassWithType = new TestClassWithType { Type = typeof(string) }; - var testClassWithFunc = new TestClassWithFunc { GetValueFn = value => value }; - - CompareMultipleRuns( - "TestClassWithType", () => testClassWithType.GetValue("test"), - "TestClassWithFunc", () => testClassWithFunc.GetValue("test") - ); - } - - - } - - public class TestClassWithType - { - public Type Type { get; set; } - - public object GetValue(string value) - { - if (Type == typeof(string)) - { - return value; - } - - return null; - } - } - - public class TestClassWithFunc - { - public ParseStringDelegate GetValueFn; - - public object GetValue(string value) - { - if (GetValueFn != null) - { - return GetValueFn(value); - } - return null; - } - } + [Ignore("Benchmarks")] + [TestFixture] + public class AdhocFastPerfTests + : PerfTestBase + { + public AdhocFastPerfTests() + { + //this.MultipleIterations = new List { 1000, 10000, 100000, 1000000 }; + this.MultipleIterations = new List { 10000 }; + } + + public static byte[] ToByteArray(string hexString) + { + var numberChars = hexString.Length; + var bytes = new byte[numberChars / 2]; + for (var i = 0; i < numberChars; i += 2) + { + bytes[i / 2] = Convert.ToByte(hexString.Substring(i, 2), 16); + } + return bytes; + } + + [Test] + public void Compare_small_ConvertBytes() + { + var byteArrayValue = new byte[] { 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, }; + + CompareMultipleRuns( + + "Convert.FromBase64String", () => Convert.FromBase64String(Convert.ToBase64String(byteArrayValue)), + "Encoding.Default", () => Encoding.GetEncoding(0).GetBytes(Encoding.GetEncoding(0).GetString(byteArrayValue)) + ); + } + + [Test] + public void Compare_medium_ConvertBytes() + { + var byteArrayValue = ToByteArray("151C2F00020000000D000E0014002100FFFFFFFF4269746D617020496D616765005061696E742E506963747572650001050000020000000700000050427275736800000000000000000080540000424D80540000000000007600000028000000C0000000E0000000010004000000000000540000CE0E0000D80E0000000000000000000000000000000080000080000000808000800000008000800080800000C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFB009A00A9009A9AA9A900009AA9ABE9EB0B0BB09A0AB0A9A9B0FA0FA0CBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFE9A09A9EBEBFBB0BB0AB09AC9090AB0BCB0BA9E9AA9A90B000009AAB09009BEB0BAD0EB9E9F9B0C0B0FADB0F0BEB0FCBC0BCBFB0F0BBE0B09BA0BBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFA9DABEBFFFADFFADBF0BEBBAFAF0FBBAB9ADABADBE0AB0BCBFBC090E0A9AFA9BC90BB9AFABEE0BB0FA9ABEBE9B0FBA9AB9A9A0FB09E0BDAFA0DBE9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFB0FABFFFAFAFEABCBAA9F09AF0B9BBCBE9EBE9ADA9A990FAB0000BFA9090B09E0BAF00A9ADAB9BCBE9F0BCF0BE9FA9EB9CA90FBEAF0BFBA9ADBA9ABFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FE99A9FAFFFFEBDA9ADBCBFA9BA9EAFACB0B9AF9A9AFAEB0900BB9A0000A9AF0BBCB0B9E9BADAFAB0BABEBBBC9EAA9EBEABBE90B9B0B0BCBE9A9FADAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFBAFBA9BEBE09ABFEBABAB0F0F0F9DBFBBAFAB0FAF0B090BCBC00090B0B0A0BBE9B0BCA9AF9A9BC9E9FAD00ABAB9FA9CB9C90B0FABFF09ADBFEB00B9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCBE9ABDEFBDBBFFCAB0F0D0FB0BBA0ABF0FDA9F0A90009A09A0B00000000D0BDA9AFADA9BDBEBFABABBADABFBDA9E0BEB9EBABE9A9EB0FE9AB09FAFBAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9B9E9FABADAFEB0BBDE9BABBA9FEDBBF0BFABC0A900BFE0BC0900B090B0B0BFAFE9A9A900A0B0E9CF0C0B0F0CADABF0F0ABBCB0B0BCBEB0A9AFA9A9E9BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFABA9F9FAF0FCBCAB0BE90EDABBABCBFA090B090FBFEF009A0B00A000F0B00B0BE9EBAF9FBFBBBBABB09FABB0F9AFA9FBCFBCB0E9B9A9FAC9F0BC9F0BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCBF0DA0A0FBEBABBDEF9AFBBADA9CB0A0BCA00BAF0BFFE9BA9009090B09ACBBAFF0BADB0A0BADACBDE9CA0BC0BAAF0FBAEB00B0B9A0F9EB9ABAFABABBEBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0BA9BFBACB9EDAB0BAF9AE9A9FA90900090B0F0BFBFE000CB0A00009A9B0ADB0BE900A99ADABFBABEA99A0BF0F9AF0FF0BFADA0E9BABBEBC90BC9E0BCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9E9AF00FBFEBA9EBBC9A09BCA000A09A9ABCB9BFFEE9AF0B009090BAFBEB9BAF0BAFF9ACB0BFACBDBBE0DBFAF9EB0B0BE909A99B00BF0B0AABCBABDBBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0BA9AFBCBCBBEBBCABAD000090909009AC90B0AA9FF090B0B00A0BC90F090F9EBCB0AF9ABF0B9BAA9CB0A00FAABCBEBDAFAF0E09BE90FBF9CBB0BCA0DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBF0FBDA0BABE90CB9B0FA9AB000A00B0A9A9A9F9EBFE0BC00090900BA9BEB0BABCB0FB0BCB0FBEBDBFA9E9BFADBCBA9A0BE90BBB0E9AFA90FA00BE9A9BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0A0B0EBFBCB9EBBAF0F0BC90B0090000909A9E0BBFEE900B0DA000900FA0B0B0BBE9B0BEB0B0AB0A0F0BBC0A99ABAD0BFF9EB0C009A909EBA9E9F0BCADBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9BDBFBB00BE0BAC9AFA9ABFE09A00909A0BCBA9AEBE90AB00A90A9ABFBE9F00FC9AEBC909ADB9EBFB0BC0B09AE9CB0F0A0A90B9EB090FAB0FA9A0FA90ABFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0A000CBE9BE99BFA90F090AB00000009090F0BFBFE0B0DA900090BCBA90AB0BEB90BAFADBA0FB0EBEBABEBC9AA9A9ABF90FA009A9EB09E9AFADA9CA9CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCB9FB9A9AE9BEFAF9A9ABEB9EBCB00000A0B0BE9AFF0FA090B00A90B0FADB009BAE9ADBAB0FFB0FBF09BF00B0D0F0EB00AB09EB0DA90A9AF0B0B0CB00B9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0A00EBCB9BEB0BA0F0B09AE90B00B00090A909FFF09009A00090A0F9A9BAB0B0BFADA0D0F0B0BA9A9E00AF0A0BA9BC9E909AB09A09A9CA9ADACA90B0BCFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9B9BB0BE9E9E909F0BCBEB90B9CB00900BB0FAABEE0B9E090B0BDBBAF0E90C9AE90B0BAB09AFDABE9ADB9A909A9E00A90E90D0A09E0B09A9A090A00009BFE000909FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0CACBE0BA9A9AB00B0B0BC0BCAB0B0000009AFBE9A9E090A0009ABEFABBAB009BADAF09ABE9ABBDAFBAFA9E9AD090B0A90A0A9CB0900B0DADB0B000900BC90000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBB9ADBE9FA9E9EB00F0F9A9E900BCB0B900F90FBEDA9A09090A9A90BC0DB0B09AFB00BCBCB0BCBEB0BDA9E0BC0A0BC090A9090B09A9B00B0A00009000900000000009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00A9AA9A0BF0B0BFBA90ACB0B0F0B0B00A90ABAFE90ADA0A0090DAFB0BA0BC0AFAC0BCB0BADAB0B0FEBA90B00B0900BCA9CB0A00A0000B09090900000000009000009BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9BF0F9FADA0BBFF0E90A99ABCB090B0E9000B9FE90E9009009AFAA9A9A9F0A909BBB0B0BC9A9EBDB0B9E0BCA9000BA009A0090B0909A900A0000000000000000090009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9A9AB0BBF0F0B0B9EBDAE90B0E0BC9AF0B00E9F0A9A9A090A9A9FAFCBB0B0B00FAF0E9AB0B0BAB0F0BBF0B0A9A909A9090A0000000009090000000000090009000000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBCBE9AF0F09AFAF0A9EA90A90B090B09A90B0BAF090009A0909BE9BA9AFBBC0A90F0B0A9CB0F0DAFABE0000900000000A0A9090A9A900A0000000000000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF09A9ADBF0BBE9B0BBE90BBCA909A009A9AC9A0BEBA0F0009A0BEBBE09F0009A90BABE090B0B0BABBCB090B000090009090900A090000900009000000090000000009009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9A9F0A00ABE9B0FA09ABC0B9E0A9F9ADA9A9E9D00C90A9000F0BDA0DA0FBBE9E09F9FA0B0E0BCBCBAD0A009000000000000009000000090000000000000000000900000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDA9A0B9DA9CB9EB0BDAD0BBC0B09000A90BF0BAA9A9A9009A90BAAFFABBA0A9A9A0A0BDAC9B09A9BE9A909000000000000009000900900000090000000000000000000900FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9ADA0A09AB0A0BE0B0A9E0B00B0B0B0A900F09E09000B000B0BFF0B0F9F9BE9A9E9BEA9BA0DA9E09E9000000000000000000000000000000000000000000000900000009BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE09A9BC9A9CBE9E9F0F0B09A9AD00B09C0B0B0BC9AA9A009A9ADABFADAABABCBCB09EB9C009A9A09B0A00000000009000000000000900000000000000000090000000909C9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF09A9C00A90A09A9A0A0BCBA0D0A0BC9A9A900BE9AC90090BCBFAFABCBADA9BA9A0A9BCAB0F0B090A0090000090900000009000000000090000000009000900000000000BE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFE90A9A90A90B090909A9A0DBA0990B00B9E09F0A9A09A000B0BFDEBE9FBEBEFAD9000B0090A0F0BCB000009000000009000000000000000000000900000000000009000BF0BFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBFFA09000090090000000909A009A0A00B00A90A0F009A09A9ADA0BADBB0A9F09B9A0F0BADB0A990BCB0000900000000000000000000000000009000000000000000000009FE0BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA909090009000000000000000009A00909A09BC0BFF09AC090090BFF0FAE0BF9ABBEE0B0A9F00A900A090090900000090000000000000000000000000000000000009000900BF09FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF909090000000000000000000000900090BF009E00B0BA0A90B0A9AFA9ABA9BFABAD00BFF0900BA9DA0F0B0B00000090900000000000000000000000000000000900000000009A9ED0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000090000000000000900000009000000B0B0B0BECBDA0090CB9EBFF0F009CBBAB0BEBE909E0A9009000B00090000000900000000000000000000000000000000000090000900BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00909000000000900000000000000000009009009A09BF0A090A0B0ABBEBEFAFEBBCB9ADAF00A9AF090A9A9E9009000900000000000000000000000000000000000000900000090009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF09000000900000000000000000000000000000A9A009FEA9BCA9090BB0FFFFABF0BCBEAB0BFEB09E9A0A90009000009000000000000000000000000000000000000000000090090090FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000090000000009000909AF0DA090E0F0FFFEBEDFA9EBA99AF0BF09ABE09009A9A09090000000000000000000000000000000090000000000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00009009000000900000000900000000000000009A00BF0BA09A99BBFAABFFBB0BE9BCBA90F0FE090BCA9A0009A000000000000000000000000000090000000000900900000000090D0BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9000000000090000000000000000000000000000090A0BC9AD00A000BFBCBCBEF0BAFBCBAB0BABCBAF09009A9A0900900000000000000090000000000000000000000000000000900A9FEFFFFFFFFFFFFFFCBF9FF9FFFFFFFFD99F9FFFFFFFF000900090000000000000900000000000000000000009BEBE90A909E9F0BBFFA9EBC9B0B0BCF09EF0BC9A09A00090000000000000000000000090000000000000000000000090090A99EBFFFFFFFEF9A9BF9FF9F9F0F0BDBFFFB0FB9F09FFFFE00000900000000000000000000000000000000000090BAE900A90BABBAFAFEA9EB0BAAF0FEB00AFBE9A0900909A00000000000000000000000000000000000000000000000000009C0A9FFFFFFFB9DBDFDBFDBFBF9FBDBE999DDB9CB99A990FF090000900000000000000000000000000000000900009FBAF09A09E9E9E90BCB0E9EBDAB0DAF9CAFFE9E0B0A0090909000000000000000000000000000000000000000009000000B0900BFFFE90DB0FBFFDBFDF9FBD9F9BFFABDBFBDBDB0F90900000009090009000900090000000009000000000000A9E90A09F0BFAFAFEBBCB9E9EBF0BAF0AB9BAFA9A0909A00000000000000000000000000000000000000000000000000000000BCBFC9909B0FBDBFFF9FBE9DAF9FDB9DBBDBDBCBF99ADA00000000000000000000000000000000000000000009BEFA09A00BF0BE9A9E0B0A9A9E0B009EF0E0FE9AC90A000900000900000000000000009000000000000000000000000000900B09009ACBF0F9DBDAF9FBDFFBF9ADB9FFBCBDBDBF09F0909090000000000000000000000000000000000000009A9A909AD0B00ADCB0F0900909A9A9E0A90BFFA9EB0A090900090000000090009000000000000000000000000000000009000909009A09909F9FBFFF9F9FF99F9FDF9FB9DBDA9B99DB0B9000000000000000000000000000009000000000000000AF0E90ABCBFBEB0E9A0B00A000900C90000BEF0F9ADA000900000000000000000000000000000090000000000000000000000000090A9F09B9F9BFBFF9BFF9FBBDBDFFB9F9F9FABD9CB0909090000000000000000000000000000000000000909A90A90DA009BCBB0F00F090900B0000B0009AF0AF009A9000000000000000000009000000000000000000900000000000090009009009BFBCBFDBDF9FCB9FBDF9FB9ADF9F9B0D9A9B90000000909009000009009009000000000000009000009E0B0F0A9FAEAB0CB0B000000000900D0009009AF00B000009090000900090090000000000000000000000000090000000000900090BDBC99FBDBFBF9FB9EF9FBFF0F9F0F9ADF9BBD9E9A90900000000000000000000000000000000000000A9A0BCB0ADA009F0EB0009A900B009AC000000000009A0F0090000000000000000000000000009000000000000000000009000000900090B9AFBDBFFDBF9FDBDFF9F9FFDBF9BDB9BD0B09000000900000000000000000000000000009000000900090009009ADA0B90BCB000090900009C0D00000000090B0009000090000000000000000090000000000000000000000000000000090B9CB9DBFF99F9FB9F9B9FFFB9BF9BE9F0BCBD0B9B9090900900000000000000000000000000000000000B0A9A9A9A09A9E0AD0B09009ACA00000090090000009000090000000009000000000000900000000000000000000000000000000090909B9EBDB9FBFFBCFBFFFBDBDFF9EF9F9FDBB9BD0D0B000000009000090000000000000000000000009090090000009A090900A000A9A90909000000C00090000000000000000000090000090000000000009000000900000000000000900900A9DA9F9F9FF0F9BDB9F9BDBEBF9BD9B9E9B9C99A9A09090900000000000000000000000000000090000A00B00B09A9A09A0A9A9090900090000090090900000000009000009000000000900009000000000000000000000900000000000000099A99F9B0F9BF9FDB9F9FFF9F9FFFFBEDBCF9B0F9C9B09A00090000900000009000900000090000000000900090A00090009000000009090B090000000E000000000000000000900900900000000000000900000000000000000000900000000009E9ADBBDF9B9B9F0BF9B9FBF9B99F9F9B9EDBCB909C090900000000000090000000000900000000009009A0009090009000900909A00A0000000900009000000000000900000000090000900009000000000000000000000000000000000909AD9BDB9DB0F9E9F9F9BDF9BDBFDEF9F0FDB9B9B9CB0B9090090900000000000000000000000000000000A000A0000000000000000009090900900C0D09C09000000000000900000000009000900000000000900000000000000000000000000099BDB9EB9F9F9B0B9F9FB0F9F0BB9ADB9B09E9E9A9090A00900000009000000000000900000000000009009090000000000000900090000009A090A00C0000009000090000000009000000000000009009000000000000000000000000090099A9A9E99DB9B9BDBDB9E99F9A9BDBDF9AFDF9B99C9B0090900000900000000000000000000000000090009000000900000000000090000909A000C0D0D0F0909000900000000090000090000000009000000009000000000900000000090000009DB99FB90DADA9B9F9FB9B9F9BDBA9F99A9EDB0B0D9A900900900000000009000000000000000000000000900900000000090000009090009090900CAC0C0000000000000000000000000000000000000000000000000000000000000000009A9A9F990F9B99BD0B9090D0F9FCBD9F0BE9F990F9B0A9CA90000000000000000090000000009000000000000000000000000000090000009000E0C0C9C909000900009000900000000000009000000000000000000000000000900000000000909D9ADAF9AD0BD0BD0BDB9F9A9B90B0DF990BAF090D9009009000000009000000000909000000000000009000000000000000000000090B00F0D009A000C090000000009000009000000000009009000000900000000090000000000000000909A9BDB99099F0B90BD9B0B0BD0F9F9B9ADABD99BDA9A9009000090000000000000000000000000000000000000900900000000090090000900DE900D0D000000090090000000000009000000000000000000000090000000000000009000000BC9BC9B0BDA9090F90B0C9D90B90B09CB99D0B09CB90D0B00909000000000000000000000000000000000000090000000000000000000009ADAD00C000009C00000000000090000090000900000000000000000000000000000000000000000909B0B9C99090B9F9AB9F9B0BBD0B9F9B90B0F0F0B0F0B0909000000000000000000000000000900000000000000000000000000000000900C0DAD090C90C00000000000000009090000000000900000090000900000000000000000000000090B90D9A9ACB0BD0909C90B0BD90BD00A9CBDA999099909000000000090000000000000000900000000000000000000000000000000000000009ECF0E00C09000090090000900000000900900000000900000000000000000000000000000090090F9BC90999D9A9ADA9A90D09A9A9FBD0B909F0AD00BCB09090909000000009000090000000000000000000000000000000000000000000090009C90D0900009000000090000000000000000900090000000000000000900000000000000000009090B0B0B00B90999909A9B09C9090BD0F9A9990B00909A00000000000000000000000000000000000000000000000000000000000000000009E9C00CAC09C00000000000000090000900900000000090009000900000000000900000900000B0B090099C9BD0F0B0F9F990DB9BDA909B90D0F09090A9C9090000000000000000000000000000000000000000000000000000000090000000900C09E9090000090900000900900000000900900900900000000000000000000000000000000990D009BDA9A90B9BDB90B0F9B9ADADB9E9EB9B09ADA990B0000900900000000000000000000000000000000000009000000000000000000000000FC000C0C0090C0A009000000000900000000000000000000000000090000000000900000090090B9090999B9C999CBD99BC9F9BDBDE909DADA99090090090000000090000000000000000000009000000000900000900009000000090090000909C9090090009C0D000000000900000009009090909009000900000000000000000000000090B009BE90F0DB9BE9B9ADF9B9BDBBDBFFF0B9BDAC9A9A090090090000000000000000000000000000000000000000000000000900000000009000C00AC0C000C9009000000000000000000009000000000000000000000000000000000000009A099B099B9B90F99B9F9B9BDBDBDFFF9F0FDADA99A9C900B0000000000000000000000000000000000000900000000000000000009000000000909C9C9A90C9000C0E90090000900009000000009000009000000000000000000000000000090990B0D0BC9F9F99BDF9BDFDB9BFFFBDFFFB099F9AD90B09009009000000000000000000000900900000000000000000000900090000090909000CCAC00C00000CB0D0C00000000009000900000000900000000000000000009000000090009A90E909B999B09BDBDB9F9BBFFDF9FDFBF9FDFCB0F90A9000900000009000000000000000000000000000000000000000900000009090000000090B0C9E90D0D0B0C0CBC900090000000000090090000900900900009009000000000000000009099BD09FBDF9BDB9BDB9FD99BFFFFFFDFFFBFBDB0F99E9A909090000000000000000000000000000000000000000000000000000000909009A000C9F0C0CAC00C09C9C0E090000090009000000000900000000000000000000000000000000909F09A9B09B9F9F9F9B9DBBFFFDBFDBFFFFBDFDEDB9E9909C00000900000090000000000000000000000000000000000000009000000000000090C9CC0C90909C9CE9E0C9C00009000900009009A0000000000000000000000000000000000900B09BDBD9F0F9FB9BDBDBFD9BDBDFFFFF9FDFFBDB0F9BCB0B0090000000000000000000000000000000000000000000000000000009000090900CBCA0F0CAC0CAC90C9CBC9E9000000009000000090090900090000000000000009009000000B9DB09B09B99B9D9F9BDB99BFDBFBFFFFFFFBF9FE9F0F0BC9090009000000000000000000000000000000000000000000000000090000090000909C0DC0F090D090E9CAC0C0C0C900900000009000000000000000000000090000000000000090B09F0DBF0BD0BB99F9BDBD9BBDBDBF0DB99FFFDBFF9BD9B0BC9000000900000000000000000000900000000000009000000000000000000900000FC0FC0C0C0E0C9C0D0F09C9A0000000090000900090000000009000000000000000000009A999B9B9099DB9D9E90BDA9B9D99F9E9FBDFFF9FBFDBFCBADBC9A09000000000000000000000000000000000000000000000000000009000000000C0DEC0DAD009C9CA9E0C0CA0C09000900009000000009000000000000090000000000000909ADAD9E9F9FB0B9B99B909909A9B0999BDBBBDBFF9E9E9BD909B090000000000000000000000000000000090000000000000000900000090000909C9E90FC0E9EC0E9C09C9009C9CAD000A00009000090009000000009000090000000000000BD9B90B9B9B09DBE9DBCBB90F990D9F0F9FDFDBF9FFBF9F9EB9FC9E0000000000000090000000000000000000000000000000900000000000000000BCCDC0F0D0DAD0E9CA0C9C0009CAD0909000090900000000000000000000000000090000D0B09F9DA99BDB999B0999CBB9EBB0B9B9E9BFF9FBDF9FDAD9E9AB099900000000000000000000000000090000000000000000000000000000900000C9ACBCCADEADE0D0AD0AC00D0C0D0A000090000A000000000000000000000000000000090B9F9A9B9F0DB9ADBC9BCB99D099D9F9F9BF9F9FFDFB9EBDBBDBD9FCA0000900000000000000090000000000000000000000000000009000000009090EDCCCBDE0D0C9CAD0CD0BC00E9E0D009A00000909000000000000000000000090000090B9DB9DBDA99B9F9B99BF9B9F0BDA9B09FFFDFFFFFFBDFF9FBCBDBF0B90D0000000000000000000090090000000000000000000000000009000000000CD0BB0CE0FCADAD00F000C0C90C9E0F000900900000000900000000000000000000000BD9EB90B09B9F9F09F9F999D099999999F99FFFFFF9FFFBDB9F9FBC9F9E900000000090000000000000009000000000000000000000000000000000000DACCC9E9C0FC0CAD00DAD09ACBC0D00BC00B00090009000000000000900000000000000B99B9F9BD9F9B9F9BB9F9A9B9BD9BDF99F99FFFFFFFDFF0F09BCBF9CBDA900000000000000000000000000009000000009000000000000000000000090DAD9E9CAD0BCF0DAD0C0C0C90CB0E9C9A000900009000000000000000000000000009BDAD9E9BF0B0BDB9BDD99999D9D9F999DB9DBDFFFFFDFF9F9BFFBDBFBF0F0F090000000000000000000000000000000000000000000000000000000090C0DCC0E0D0EC90CAC0E0DAC90E90C9C0E90900A0900000000000000000000900000099E9B9B99F99BDB9BDB9B99F9990909999099FDFDFFFFFB9FB9F9BDBF0F9F990000000000000000000000090000000090000000000000000000090009000CBC0AD0F0D09ECBCBC9C0DA0D0EDA0BC900A009000009000000000000000000000090B9F9FDBF9BF99DBDA99CB09999B9B09BF99999FFFDFFDFD90B9FFBDF9DBDBE90000000000000000000000000000000000000000000000000000000000009CF09EC0E0C090C9CA0F0CD0E90CDC00E9009000B090000000000090000000000000BDA9F9BDBD9BE999BDF9999900B9F9BFFFF099099DFDFBFBDBDB9FFBFFBDADF0F0900000000000000000000000000000000000000000000000000000000900CDC9E9C90F0E9E0DC0CB0C9CE9A9AD00F00A9000000000000000000000000000909F9F9AF9BFBD9BE9B9909090B9BFBFFFBFFFFFF9D9B9FD90B90BFFDFDBFFFFBF0000000000000000000000000900000000000000000000000000000000000F0C9E9E0AC0C9C0F0909CC9E090C0D00F0090009000000000000000000000000009F99BDF99F9DBAD99CB090B9F9FFFFFBFFFFFFFFF00999BFBD9F9FFFFFFDBDFC9C90000000000000000000090000000000000000000000000009000000900D0CBECCD0D09E0F0C0CAC0BC0F0E9E0BC0900090009090000000000000000000009A9AF9B9BF9BBD9B9B909009BFF9FFFF9FFFFBFFFFF0000999A99BDBFBF9FFFFFFB0A000000009000000090000000000000000000000000000000000900000EDFC9E9AC0DA9C0F0F009C0BC0D009C0BCE9000090000000000000000000000000BDBDBDBF9BFDFBD0F090009BDBF9BFBC0BDBD09B90B909000990BDBDFDFFFFF9FDF99000000000000000000000000000900090009000090090000090000090000FE9EC9E0CCBDCD00DA9CC9E0F0E0FC090090000900009000000000000000000DB99BDB99F9B9DB9090000B090090909990909909D0000009A09F9BFFFBFFDBFFE9E0000000000000000000000000000000000000009000000000000009000DED09CC9E0D0BCCA0AD0CCE9A0D0C9D009E0000090000000000000000000000099A9FBDB9DA9B9FB009000909909B90999B0F9BDEF90999F9A9C9999BF9BDFDBFFF9F090000000000000000000000000000000000000000000000000009A000DAD0FECBC9CADE0BCDCADA90CDCADACACFC90009000090000000000000000000009F909F9FBDBDF9DB90B9F090909099090999099999F9FFFFDB09F0BDBFDFBBF9FDFBDA900009000000009000000090000000000000000000000000900009000C0F00BCACBC0DCCB0D00CE9A0F0CD0D00E0900009000000000000000000000000B9FB99A99B9B9B99E90B9F9BCB9DA9DB9FDBDF9FFFFFFF9FFDB09BDBDBB9FDDBFBEDBD00000000000000000009000009009000000000000000900000900009A9DCFDC9C9C0F0E9CCA0D09CC90CB0F0FC900000000900000000000000000000090F9DBD9BD9F0F9BC9BD9B9DB99F999B9F9BDBFFBFDFFFFFF9A9DB099BDDB9FBFDFFDBCB0000000000000000000000000000090000000000000000900000090CCAD0CA0F0CBC0D0E90DA0CA9ACF0CC0C000090900000009000000000009BF0099BB9B9BFDBB9B9B99B90BC9B99F9DBF9F9BDBF9DF9FFFF9F0F99B9DBBDABFDBDFBFFFE90090000000000000000000000009000000000090000000000900000C9AD0F0DC0F0C9CAD0CA09C90CD00DA9EDE90000000900000000000000000BF000BD0F0F09B9C9F9DA90BD99A9F9B9B99B9DB999BBFFFFDFF9F9F0D0B9DB9D9FBFD9FDBDF900000000000000000000900000000000090000009000900000009CBCDED000F00F0E9CAD0D0E0E9A0F0CC090C00090090000000000000000000909090B99B9BD9BB99A9D9F9B09D09BC99F9DA90F9D09B9FDBDF99A99B99F9DBF9DFBFFFFFBEDA900000009000009000000000000000000000000009000000000C0C0E9EFC90C90C9C0D00A0909C0D0DA9ECE90000000000000000000000000000000BDBD9F9B0D9F9DB9B909BF9BD09B0B9B99F90B9FDFBDFA9F9F9F0DB9B9F9FFBDFFFFDFDB00090000000000000000000900900900000090000000000090090D0D9C9C0AC9ACB0E90CBC9CACADACE9CC900009000000090000000000000000909B99CB9AD9F9F09B9AD09BD9090B999D99CB09B9FFFFDBFDF0BD09BB9F9FBDFFDFFFFDFFED0900000000000000000000000000000000000000000009000000C0F0CADECD0C900D00F00CA909C0D09CB0C909000900000000000000000000000009CBB9F9DB9B99F9D99B909B9B99E99A9B9090D9BD9FFDBDBDB9B99DB9F9DBDFFFFFFFFDBBC00900000000000000009000000900000900000090000009009E9C0FCDA9AC9E0FC0F0CF09CEDA9E0DE0CDA00000000000000009000009000009090F9DFF9B99F9F99B9BD9F909D9F99A99009B090B0B90FBDF9BD90F9BDBDBFFFFFFFFFFFFDE9900000000000000000000000000009000009000000900000000C9C0BCFCD0E9C09E0DA0DE0900C9CA9CB09000090000090000000000000000000090BB99BDBF9F99F9BDA99090B0990900990990BC90099DB9BDB0999F9F9F9FDFFFFFFFFDFBCA0909000000000009000000090090000000000000000090090D0E9CC9CBCAD0E9E0DACDE0DACAD0E9C0C000900000000000000000000000000909A9BD9BDBD9BDFBDBDB9DA9B909B09C90B099CB99F0909B9BC909B9F9B9FBFFFFFFFFFFFFED0900000000009000000000000000000900000009000009009AC0C90C9EBC0DAC9C0F0C9E0F0C9DAD0CADA90000000900000000900000000000000090DBF9F9FBDB9DBDBDB9D09AD909B00D9B0B99F999BDFFD9B9B99F99FFFDFFFFFFFFFFFFDFF00090000000000000000000000900000000000000090000C0DCBCDACDCF9C9ACBC0F0E9C0F0AC0AD0D0C0090009000000000000000000000000009B99B9FBDFBDBF9BDBDBBD990B0999B09D99B99BDFFFFFF0D09DB9F99FFFFFFFFFFFFFFFFCDA90000000000000000000000000009000000000090000909C09C0CDA9E0CA0CD09E0D0CBC0DC9ED0E0F090000900000000000000009000000090909FFF9BDBDBDBDBDB9F9D9A999099BD9B9BDDF9FFFFFFFC9B9F9BDBFFFDFFFFFFFFFFFFFFFB00000900000000000000000000000000000900000009000A9EC9EBCDE9F09C9A0E0DACBC0DA9AC0F0DC00009000000000000000000000000900009BF9BDF9FBDBDBDBDF9F9B9DB099AD9BDBF9FBFFFFFFFFDB9DB9F9BDBDFFFFFFFFFFFFFFD90D0090000900000000009000000000009000000000000000DCDAF0D0F0FCC0AC0D0BC90C9E0CCDAD0E9AD090A00009009000000000000000000009A99F9F9FBDB9BDBDB9FBF9F90B0999BDBD9BBDFFFFFFFF0D9B9FFFFFFFBFFFFFFFFFFFFFFFF00000000000000000000000000009000000000000000009ADADC9EF0FCB0D09E0D0ED0F090B00DADCE0C0A09009000000000000000000000000909F9BFBF9DBDF9F9BDF9D9F9BD990F90BDBD9FBFFFFFFFF9BDF9BDBDF9FDFFFFFFFFFFFFFFCBF000000000000009000000000090000000000009000000000DAFE9EF0FE000C0DAD00E0CAC0DA0D0BCDE909000000000000900000000000000000B0BD9F9FBDB9B9F9F9FBF9BDB9E999BDB9BD99FFFFFFFD9BBBFDFFFBFFFFFFFFFFFFFFFFFBD0900000000000000000000000000009000000000000000009ED0FF0FFAD0C9ADAC0DE9C9C9A0C9CACDA9C000090000000000000000000900900099F9FFF9F9F9F9F9BDBF9DBDBDB99A9D99F9B9FFFFFFFFFFDFDFFBFDFDBDBDFFFFFFFFFFFDF9E00090000000000000000000000000000900000000900900CB0FE0FF0FF90C00D0F00C0A00D0BCADF0CF09090000090000000000000000000009A99F99FBDBDBDBFDB9F9FBDB9BDBD9B0FB9DBDBDFFFFFFFFFFFBFDFBFFFFFFFFFFFFFFFFFFDE9000000000009000000000000000000000000000000000909CFF9FDAFDAC90E9E00DA0D0C9AC09C00F0CE00000090000090000900000000000009A9FFBDF9F9FDFDF9F9F9BDBF9B9BF999DBD9BDBFFFFFFFFFFFDFFFDF9F99FBDFFFFFFFFFFFF0900000000000000090000000909000000000000000090CAC9CAFAFDAFF00C9C9EDAC90CB0C9ACBCFCE90900090000090000000000000000000009F9FDFBF9B9BD9FB9F9F9BD9F9F90BDB99B9DBDFFFFFFFFFDFFFFFF9F9FFBDFFFFFFFFFFFDE90000000000000000000000000000000000000000000009C9EBDCF0BFCB0E9E0E9C0D0E90C9AC9CBC090000900000000000000000900000000099BDBDBBDDBDBDBFD9B9B99F9F9B99F9A99F9F9BFFFFFFFFFFFFFB9F9F9F9BDBFBFDFFFFFFFE9000000009090000000000900000000000000000009090DE9ECD0EBCFCBFD00D0D0ADAD00DA0D0E9CADE90000000000000000000000000090090009BDBFDBBDBDBDB9FDDBDB99BF9DF9F9DB999F9BFFFFFFFFFFDEDF0F9FBFFFDFDFFFFFFFF9F000000090000000000000000900000900000000000000000C90BC9CDABCF0CF0ACD0C0ECD0DAC9CE9C0000900000090000009000000000000000090BBDBFDBF9F9BDA9BBDA9F099A9B09B99F9F9FDFFFFFFFFFCB9B9F9F9DFFFFBFFFFFBFFFE9090090000000000000009000000900000000000090000090FCDCBCBCDCBC090DC9ADAD09AC0C9E0DCBDE900009000000000000000000000000000009FFBDBDBBDBDB9D0909D09E9D99F9D9F9BDB9BFFFFFFF99BDBC9090B90B9BDFFDFFFFFFD000000000000000000000000000000000000090000009000C0000C0C9E9EFCAC0A0CC0CBCC9E9E0D0AC00000000000000000000000000000000000909B9F9B9BDB9BD9A9A990B0990B0B9AB9BDBDFFFFFFDD0BC990A90B090B9FEFF9FBFDFA9000000000000000000000000000000000000000000000000090DAD0DAD0FC99C9C9CB0F0C0BC0C0DACD0FC9090000000090000000000000000900000909FCBF9F90F9A99D99A9090A90909D0D9BDBF9FFFFEB909A09909C99F9F9F9FFFDBFBDB00090000000000090000000000900000000000000900000900C0C00CDAC9EF0CAC00C90DAC0BCBC0DACD00E000900090000090000000900000000000090BBDBCBFB9D9B0B09099A9909090B9B9DBDBFFFFFD0E909000909A09B0FDFBDEBCBDBC09000000900000000000000090000000000000000000000000900DA0CDAD0FF0D09E9CA0D0D0D0DE0D9ADF090000900000000000000000000000000090099B9B99DB9A9D090B009000A909099FBFBDFFFFDA9909090B9A999CDFBF0F9999B9A0900000000000000000009000000000000000000000009000000C90CD00DE9EC0CAC9C0CDACACACA0D0ECC000009000000000000000000000000000000090B9F0B0B0BD909BC90BD09990B090F99BDFFFFDF090B009090000AFB0D099A09ADBC900000000000000000000000000900000000009000000000000000C90EDE9ED0F0D00ADA0C9C9C9CDAC9E9ED09A0000090000000000000000000000000000909D090900B0F00090BFA00909A99BFDBFFFFE99F00090F0009090DF000099F9B0B0000090000000090000000000000009090000000900000000909C90CC9C0DEBD0CAC9C0D09AC0FCBCDAC9E9CA0D09000000090009000000000090000090090B0B90909090B0900009DF00909099BBDBFFF9E099090BC9000000A9009B090F0D0900000000000000000900000900000000009000000009090C0000C9A0CBCBCDCAD09C09A0E09E00C0ADF0CCB0DA000900909000000000000000000000000000990B0B000BC0000F0BE009A909A9F9FFFFFF99A09009A00909090009E909B90B000000000000000000000000000000000000009000090000C90F0D0C0D0CDCBE09C0E0BC0D0D0C9EDADC0EDBCDE090B0C9A000000000000000000000000000909AD090900900909A090990090B9DBBDBFFF9E009009000000000009E909E9CB009000000000009000000000000009090A90900000900000DA0C0C000D0CBCBED0CBC9C0BC0CA9E090DCAFDAC0E9E000AB0C0000000000000000000000000000909A90099C000000900000900099B9FFBF9FF90909009009000009FE90A99A90900090000000000000000000900000009000000000000090009009E9C0E9CBC9FE9CAC9C0DA9C09CECA9C0EDBE9C9F0DDEB090000000000000000000000000000909ADB0B09090000099B009090F9B9F9FFBDF9CA090090009C9FBD00990BCB009000000090000000000009000900000009009009000000090C9C00C9C0C9CF0F90D0DA9CADC0FCA90DCBC9E0DE9ECBFAFC000090000000000000000000000000090909009BDAD9CB9A0009A09B99FFBFF9F0B9B0900909B0B9A0009BCBF0909000000000000000000000000000009000000000900090000C00009C000DACBCFCCACAC0CE9CAFC09CFCAC9ECDE9ECBDAFC090A000000090000000000000900000909A90B09009A0B000909009B09FB99F9FF9F00900900000900909A09009000000000000000000000009000000000009000900000900909090D0C090D0C9CBCB0D0DAD09CAD0ADE009CBED0F0EDBEFFF900D9C90000000000000000000000000090990D9E0909900900909909DB99FBFF9F90DB0090909090090B09090900000000090000000090000000000090000000900090000000C00C000900E0DACF0FE0E9C0ADAD0FCFADEDE9C9ADAF9EDFBEFEF0A9A009000000000000000000000000000A9A990B000990900000B090F99F9B9E9B0900000009090090000000000000000000009000000900000000000090000000009009090D09C0C0AD0D0D0DE9FC9CADCC00E0F0DADACADEFFDEFBFAFFBDADFED0000000000000000000000009009099090A9090900000900009FB9BF9FFF9F9DAD000000000090909000000090000000000000000000000090000090009090900000000E0C00909C000C0F0DE99CAD00BCF0D0FEF0E9DEBEBEBFEFFFFFEDFADA09A09000000000000000000000000000909090000090000999B999F9FBF9DA9B99A90900000000000000000000009000090000000000009000090000900000000000009C909C00C09CF0F0DE9EE9C0FCC90DAD0D0ED0E9FDFFFFBFFFEFFADFAD009000000090000000000000000909B0009000900009090BE9DADB9F9F9FB9F0F09000090090000000000000000000000000090009009000000000B00900090090009C000C00D090C00D0CF0FFCBED0BCE0C0ADADBEDE0CBEFFEFFEFFBFFEBDA0009009000000000000000000000909B9A09000090CA9C9D9B9B9F9FBDF9F9DB9F9BD9F090090000000000000000009000000000000000000900D00D00A90000009009CD09C00C0C9C0C9E0F0FADCBEC90DADC0CAC9ADCBCBFBFFFFFFEFFBFE0D000A900000000000000000000000909C99A9DBDA999B9FB9FDF9BDBDBFF9BBDB9E90B00090000000000900900000000000000000000000000C9A9FA9ED009090000C0A00C09C00B00BCE9CDADDFAFC9EDE0C9E9C9EDCBCFDFEFFFFBFFFFEFE9000900000000000000009000009090B9B9B9DB9BF9FBDFB9DB9B9FBFFFF9FFDBDF9B9009000900900000000000000000009000000000009000FADFCBDE90F000090090D0D00C090C0DC09CFADFEADBFE9E9CBC0E9E9EADC9AFFFEFFEFFFFFF9E90009A090000000000000000000009099ADB09F99BF9FBDFFBFDF9F9F9FFF9BF0B9FC9009000000090000000000000000000009000000000900DEBFEFBEF0DCB0000C0000D090C09C00FCB0DFA9DECBFEBEDCBC90C0DCACFC9FFFFFFFFEBFEFEFE9009000000000000000000009090B0D9BDBDBF9DBF9FB9BD9FBFBF9FB9FF9F9F09B00000000000000000000000000000009000000090000090DFBFFE9EDACC9CA909C000C090C00D00DCF0DFCADBF0FFFABC0EDADA9CBCBEBFFFFFFFFFFFBFC9000009009000000000000000000909B90B9B99FBD9FBDFFBFBDBDBDBCB9DA9BDB0009000000000000000000009009000000000000000000000FAFFFBFDAD0F0C9C0C09C900C09CDACD0E9EBC9C9ECFFF0FCDE90CC9EFC9EDFEFFEFFEFFFFFCB000909A00000090000000900000909B09F9FF9FB9FBDBDB99F9FDFFBDBD9A9D090909000000000000000000000000009000000000900009000DBDFAFCFADAD0C9C0C90C000D09C000DAC9CBCFCBCF9E9EF0FA9EDEBCC0BCDADBFFFFFFFFFEFBC0900000000000000090000000090909DA9B99B9DBDFBDBDBF9F9B9BDBDBC9B09A90000009009000000900009000000000000000900009000090FAFFBF0FC0C9CAC90C090D000CA0DC0DADEDF0EDACBCF9EFDECBC9CBDCCADCADFBFFFFFEFFFEF00009009000000000000000000009A999F0F9FBBDB9FB9BDB9F9F9CB9A9B00909090000000000000900000000000000000000900000000C0000DFFFFFF0FDE0DC0CB0C000D0D0D00F0CD0F0FFFADFCF0F9FAFBCFACCADADADCFAFFFEFBFFFFFF0F09009000900000000000000000009A99B9B0DDBDBDBDBF9DB9EB99F9D0090B000000000000000000000000000000900900000009000900909EBFFEBCF0C0D009C0C90D000C00C9C9CAD0F0FFFFAFBFEF0FFCF0CDADAD0C0DADFEFFFFFBEFBEF0000000000000900000000000090909DA9DBDBBB9B9F9F99BBD99DB09B0909009090090000000000009000000090000000000000009000000CBFFFBDF0DAD0E9C009C00C0D00D0C0CADCF0FFFBFFFEFBFFEBE9EF0D0DE0F9EDADBFFFEFFFFFFDF0909009000000000000000090009A9BDB9F9F9DBDBDB9DBC99A9B0F09A000900000000000000900000000090000000000090090000009000BDFFFFEBEDC0D0C09C00D09E09E0DAD0DADADF0FEFFFFFEFBDF9E9EBCE0DCCC00DECBFFFFFFFFFAFC0A090000000000000000000000090090B9B9BBDB9BDBB9B9BD0990909090090000000000090000000000000000090000000000000000090CBFFFFFCBCBC0D0C09C00E09C0D00D0E0D0F0FFFFFEBFFDFEEBEFFDEDBDADA9FCAD9FCBFFEFFEFFF090000000000000000900000000909B9BDBDBC9B9F9BD0F9F9A9F09A900090009000900000000090000000000000000090000009009000009EFFFFFBCBCCBC0BCC09C9C00D0CD0C9DE9CF0FFFBFFDAFADBDFBFAFACECADCC0D0ECBEFFBFFFFADAC090009000000000000000009009B0D099B99BDB9BE9B9B0D9900900909090000000000000000000000000009000000000000000B009CC9FFFFEFBCFCC90C9C0A9C000CD00F00FCE0DE9FC9EFCBEDADAFAFEFFFFBDBDADADE9C9CD0FFFFFFFEF9C00900000000000000000000090099BCBDBBDBDAD99BC99A009B09000000000000000000000000000090000000900000090009000000BCFBFFBFEF9E9ED0C0D0C09CD0A9C0CD0D0DE9EFBE9EBC9EDEDFFFBFFFFFEFEDADADE9E0FC9EFBEFFFAFBC00000000000000000000000090A09B09C9B9B9BBD9BC999A090090900090000000000000000000000000000000900000000000900009EFFFFFBFE9C00D0C0C9C00AD0C9C9ACADA9E9CFCFC9EF0FBFAFFFEBFEFFBFFFFFE9EDBCBCBDFFFFBFFCA9000009000000000000000090999009B9BC9BD0D0B90B00900090000900009000090090009000900000090000000900000909000900CBFFFFFFCBEDED0E90D0AD0D0C9CACD0DCDE9EFB0F0FE9FBEFFFAFFFFFBFFFAFFAFFFBEDF0FEFBFEFEDA90090000000000000000090000000A990D09BD9B9B9A900B09090090000000009000000000000000000000000000000000900000000DBFFFFFFEBF0D00D0CC00D0C0C9E0C9C9E9E9EDBCF0F9FFEFFFBFFFFFFFFEFFFFFFFBEFFBEFDBEFFFFBFFC0000000000009000000000009090900B9B099A909C9090900000000090090000000000000000000900900009009000900000000900ADBFFFFFFFCF0CF0D09AD0D0F0C9C9CADCF0DEAFFFFEFAF9FAFEFFFFFFFFFFFFFFFFFFFFFFBEFFBFFFEFBF090000090000000000000000000909009CB0D9BDA99A090090090090000000000000000900000000000090000000000000000900090EFFFFFFFBF0F0C0CC0C0C0C0D0C9E9C0E9EBDF0FFAFBFFEFFFBFFEFBEFFFFBFEFFEFFFEFFFFBFFEFFFBCF00090000000000000000000009000090B099A9C9900900090090000000000009000900000009000000000090090090009000900090DBFFFFFFFFFE9E9CB0D0DAD0D0E9C0C9E9C9CE9FFFDFFCFBFFFFFFFFFFFFFEFFFBFFFFBFFEFFFEFFFBFCFB0900000000000000000000000000090090B090B09A9009000000000090000000000000000000090009000000000000900090000B0EFFFFFFFFFFE9CD0D0C0C0D0E0C9C0CDADCFEFBFFAAF0FBEFFAFFFFFFFFFBFFFFFFFFFFFFFFFFFFFBFEFBFC0A0900000900000000000009000900900909A90B00900090090009000090000000000900000000000000900009000A0090090AD0FDBFFFFFFFFFFFE0C0C9CBC00D0D0D0F0CDA0DADADFFBFEFFBFFFFEBFFFBFFFFFFFFFFFFFFBFFBFFFFFFFEBF09000009000090000000000000000000900090909000900000000000000090009000000090000000000000000009090000000DADAFFFFFFFFFFFFF9F0F0C0C9C90C0CAD0DACDE9CFFAFFEFFBFEFFFFFFFEFFEFFFFBFEFBFFEFFFFEFFFFFFFFFC90090900000000090009000000000900009000090909000900090000000000000000000000090090000000900000000009009AFFFFFFFFFFFFFFFFECD0C9C90CAC9E9C0C0D0F0FBCBDFFFBFFFFFFFBFFFFFFFBFEFFFFFEFBFFEFFFFFEFBFAFCBC0B0000000000000000000000000000000009090000000000000009000000000000000000000000090900000909AC9090009EFFFBFFFFFFFFFFFFE9F00DAC0C9C9C0C0D0F0F0DECBFFAFFFEFFFBFEFFFFFBFFFFBFFFFFFFFFFFBFFFBFFFFFFBE9000B00000900000000000900000000909000000090009000090000000000000000900009000000000000900000900009000BFFFFFFFFFFFFFFFFFC0FC0D0D0C0C9C9CAD0CCFADBFCBFFFFFFFFFFFFFEBFFFFFFFFFFFBFFFFBFFFFFFFFFFFEFF0900090000000000000000000000000000000009000000000000000000000009000000000000009000000000900009000090BDAFFFFFFFFFFFFFFBFC0D0C0CB0CBC0E9C0DA9CDACBFCFFFBFFBEFFBFFFFFEFBEFFFFAFFFFFEFFFFFEFFFAFFBDAC009000900000090000000000009000000000000009000009000000900000900000000900009000000000009009000009000CBFFFFFFFFFFFFFFFEDAD0F0D0C0D0C9C0D0EDCB0FDADBFFFFFFFFFFFFFFFFFFFFFBFFFFFEFBFFFEBFFFFFFFEFFE90900090000000000000000000000000000000000000000000000000000000000000000000000000090009000AC0090B000DBFFFFFFFFFFFFFFFADAD0C0C0C0D0C9C0DAC9CADEDAFFFAFFFAFFFBFEFBFFBFFFFFEFFFFFFFFFFFFFFFFAFFFFFAD00009A00000000000000000000000000000090000000009000000000000000000009000000000009000000090909A000000BCBFFFFFFFFFFFFFFF0DC0D0DAD0CB0CBC0D0E9DCB0FDADFFFFFFFFFFFFFFEFFFFFFFFFFFBFFFFFFFFFBFFFFFFFFEFC00090B09090000000900000000000000000009000000000000900000900000900000009000090000900000000009090900BFFFFFFFFFFFFFFEFF0DAC9C0C9CC9C0D0C9CCADEDAFFAFFFFFFBEFFBFFFFFFEBFFFFBEFFFFFFEBFFFFFFFFEFFFF0B0900000000009000000000900000000000000000900000000000000000090000000009009000000000909000909000000DFFFFFFFFFFFFFFFFBCF0C9E0D0E09C0D0F0E9AD0F0FCBDFFFFFFFFFFFFFFBFFFFFBFFFFFFEFBFFFFFEFFBFFBFFF0FC000909000000000000000000000000000000000000000000000000000000000000000000000000900000009000000B09FBFFFFFFFFFFFFFFFFDE9ED0C9C0C9C0F0C0C9CDCF0FCBFFAFBEFFFFFFFEFFFFFFFFFFFFFBFFFFFFFFFFFFEFFFFEFFBDE9000009000000000000000000000000900000000009000000000090000000009009000000900000000000000009000AFFFFFFFFFFFFFFFFFEF0CD0C9C0D0C0D0C9C9CE0F0FCBF0FFFFFFBFFFBFFFFFEFFFFEFFFFFFFFFFFFFFBFFFFFFFBFEFBCA9090000900000000000000000000900000900000000000000090000900009000000009000000009000B0090900009FFFFFFFFFFFFFFFFFFFBF0ADAC9E0DAC0DAC9E90F0F0FCFF0FFFFFFEFFEFFBFFFBFFFFFBEFFFFFFEBFEFFFFFBFFFFFFBCF9C0A09000000009009000000009000000000009000000090090000000000900000900000000000000900000000099FFFFFFFFFFFFFFFFFFFFFCFD0C9C0D0C9C0D0C0CDC9CF9ADAFFFFFFFFFFFFFFFFFFFBFFFFFBEFBFFFFFFFFFFFFEFFFFBEFBCA909000000900000009000000000000000000000000000000000000000000000000900000009009000909009090FFFFFFFFFFFFFFFFFFFFFEBC0C9CAD0C9C0F0C9CBCADEBCFFFFBFFFBFFBFFBFFFBFFFEFFFFFFFFEFFFFFBFFEFFFFFBEFFFFCF90C009090000000000000000000000000000000000000000009000000900009009000009090090000000000000BFFFFFFFFFFFFFFFFFFFFFBCBCBC9C0D0E9C0D0E9C9DE9CFBCBCFFBEFFFFFFFEFFEFFFFFFBFFFFFFFBFFFFFFBFFFFFFFFFFBFAFB0900000009009000000900000000000900000000090000000000000000000000000900000000009000090909FFFFFFFFFFFFFFFFFFFFFFDFC9C0C9C0D0C9C0D0CAC0DE9CFBFBFFFFFFFEFFFFBFFFBFFBFEFFBFFFFFFFEFFFFFFBFFFFFAFFFFDE9E0909000000000000000000009000000000090900009000000000000090000009000000900900009090000FFFFFFFFFFFFFFFFFFFFFFFFADE9CBC0D00D0E9C9C9CFA9EF0FCFFFFFFBFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFEFFEBFFFEFBEBE09000090000000900000090000000000009000000000000009009000000000000000900000009A9000000FBFFFFFFFFFFFFFFFFFFFFFEBCD0C9C0DACDAC9C0E9ED0DCF0FBFFAFFFFFFFFBFFFFBFEFFFFFFFFFFFFEFFFBFFAFFFFFFFFFFFFFFDBDA09000009000000009000000009000000000000000000000000000000000900009000909090000000090FFFFFFFFFFFFFFFFFFFFFFFDFCADAC9C0D00D0C9C9CCBCEB0FEDADFFFFFFFBFFFFEFFFFFFBFFBFFFFEFFFBFFFFFFFFFFFFFFFFBEFEFADBC09000009000900000000000000090000000000000000000000000000000090000000000C90C9C90CBFFFFFFFFFFFFFFFFFFFFFFFBE9D0D0CBC0D0C9CAD0D0C9CDE9FBFBFFFBEFFFFEFFFFFFFBFEFFFFFFFFBFFFFEFFFFFBFFBFEFBFFFBFBDBCA9000000000000900000000000000000000900090000900000009000900000000090000B000B0A00BFFFFFFFFFFFFFFFFFFFFFFFFEFCED0E9C0DAD0E9C0F0ADE9ADE9EDEFFFFFFEFFFFBFFFFFFFFFEFFFBFFFFBFFFBFFFFFEFFFFFEFFFFFFEFE9009000000000000090090000000000900000000000000900000000000000000900009000BC0009FFFFFFFFFFFFFFFFFFFFFFFFFFF9E90C9C0D0C0C9C0D0CDC9EDE9EFBFBFFFFBFFFFFFFFEBFFFFFBFFFEFFFFEFFFFFEFFFFFFFBFFFEBFEFBF9EF0090000900000000000909090900000000000000000000000000000000900000090090009090AFFFFFFFFFFFFFFFFFFFFFFFFFFFE9CF0C9E0C9C9C0DAC9CBC9E9FF0FCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFBFFFBFCFF9EDA0090000000900000000000000000000000000090000000000000009000090000000090000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9CD0C9C0E9CBC0D0E9CFCBC0FFBFFFFFFFFFBFFFFBFFFFAFFFFFFFFFBFFFFFFFFFFFBFFEFFFFFFFFFFBEFFAD090000009000000090000000900090000090000000009009000090000000000909000090FBFFFFFFFFFFFFFFFFFFFFFFFFFFFFBCF0E9C0D0D0C0D0C9CCBCBCFF0FCBFFFBEFFFFFFEFFFFFFFFFBFEBFFFEFFFFEFBFFFEFFBFFFFFFFEFFAFFDBCF0C000000000000900000090000000090000000000000000000000000090009000009090CBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCF0C9CAD0E0D0D0ADACBC9CBF0FBFFFFFFFFBEFFFFFFFEFFFFFFFFFFBFFFFBFFFFFFFFFFFFFFEFBFFBFFFBEFBFA909090000090000009000000000000000000000090000000090000000000000090000BBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FD00D0C9C0DACD0C9C0FED0FDE9EBFFFFFFFFFBFFFBFFBFFFFFFFFFFFFFFFFFFFFBFFFFFFBFFFFFFFFFFFBCFCBCA000000000000900900900090000000000000000000000000000900090090000090CBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFC0CF0C9C0D0C90C9CADD09EF0FBFFFFFFFFFFFFFFFFFFFFFFAFFFFFFFBFFFFFFFEFFFFEFFFFFFFFFFEBFFEFFBFCB09090000000000000A000900009000009000000000009000009000000000090900BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF9F0C9E0D00F0CDAC9D0EDE9CFADE9FFFFFBFFBFFFFFFFFFFFFFFFFFFEFFFEFFFFFFFFFFFFFFFFEFFFFFEFFBFFCBC9C0009000090009090900000000009000000000090000000000000900909000ACBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD9E0C9C0DACD0CF00DACE9CBCBE9FBFFFFFFFFFFFEFFFFFFEFFFFFEFBFFFFFFFBFFFFFFFFFBEFFBFFBFFFFBFFEBFFFFBE9009000000000000B00900000000000000900000000009000900000000909BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAED0DAC90C90C90CD0C9DE9CF0DFCFBFFFFEFFFEFFFFFFBFFBFFFFFFFFFFFFBFEFFBFEFBFFFFFFFFFFFFFFFFFFFEBCBCBCBC0000000090090000009000000000900000000900900900E0009000000CBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDBCD0D0ED0CBCC90E9CA0DE9EFAFBDEFFFBFFFBFFBFFBEFFFFFFFFBFFFBFFFFFFFFFFFFFFFFFBFFFFFEFBFFEBFFBFFFFFBE9AD0900900A9009090000090000000000000000000000090900009000DBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBEDADE0D00D0C90E9C0DCDE9E9CDBCFBFFFFFFFFFFFFFFFFFFFFEFFFFFFFFBFFFFFFFFFFFFFFFFFEFFFFFEFFFFFFFFFBFBFFFF0B009A0990C9AC00090000090000090090090009090000009000C9FBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEDAD0C9C0DE0D0C9C0DA9E9CBDEBEFBFFFEFFBFFFFFFFFFFFFFFBFFFEBFFEFFFFBFFFFFFFEBFFFFFFFBFFFFFFFFFFAFFFFFBFBFEBC09FACB9E9BC9000900009090000000000900000909000090B0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBCBC9CBC09C0F0C0F0CD0DE9E9F9EDAFFFFFFFEBFFEBFFFBFFFFFFFFFFFFFFFEFFFEFFFFFFFFFFFBFFFFFFBFFFFFFBFFBFFFFFBFB9A9DACB9EBFA9E0C0900000000000900000900000090090CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9E0C9CC9C0D0D0DACF0DE9ECFBFFFFFBFFFFFFFFFFFFFEFFFFFBFFFFBFFFFFFFBFFFBFFFEBFFFFFEFFFEFFEBFFFFBFFFFBFFFFEDABDBFEFDADE9FBCA9A909009090009000009000000F0FBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FC9C9E09C09CBC0D0D0DADE9BCF0FBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFEFBFFFBFFFFFBFBFDE9FBFBFFBFFCBDAC00A09000000000090009090F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF9E0D0C9EC9C0C0F0CBCBCF0FCFBFFFFFFEBFFFFFBFFBFFFBFFAFFFBFFFEFFFFFFFFFEFFFFFFFEFFBFFFFFFFFFFBFFFBFFFFFBFFFFAFBEFFFEDAFEBFFEDBF09C0009A90900000000ACBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBC0D9E0D009CAD0D0C9CE9E9EDBBCFBFFFFFFFFFAFFFFEFFFFFFFFFFEFBFFFFFFFFFFBFFFFFFFFBFFFFFFFFFFFFFFFBFFFFBFFFFFBFFFFBFBFBFDBDFAFBE9EF0BDAD00C0AD09000D09FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCE0D0CDCC9C0DAD0F0DCDE9ECFBDEFFFBFFFBFFFFFFFFBFFFFFFFFFFFFFBFEBFFEFFFFFAFFFFFFFEFFFEFFFFFEFBFFBFFFFFFFBFFBFBFFFEFFAFFBFFFFFF0FCADAF0BFCAACC99AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0BD0C9A009C09C0D0CDADA9E9F0FBFBFFFFFFFFFFFBFFFFFFFFFFBFFFFFFFFFFFFFFFFFFFFBFFFFFFFBFFFBFFFFFFFBFFBFFFBFFFFFFEFBFBFBFFAFFFBEF0FFADBFCBFCBFDFBFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FCCCBCDCFC0BCC9CADADADCFDAFDEFFFFFFFEFFBFFEFFFFEFBFFFFFFFFBFFFFFFBFFFBFFFFFFEFFBFFFFFFFEFFBFBFFFFFFBFFFFBFBFBFFEFFEBFFFBFFBFFBCFBCEBDEBCFAFEBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9A9C00000DC9AC0D0C9CFADADEBDBFFFBFFFFFFFFFFFFBFFFFFEFFFFEFFFBFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFBFBFFFFFFFFFFFFFFBFBFFFFBFFFFFFADBCFBDEBDFBFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9FCD0DEDCD00CC9CBCBCF0DCBCBDEBFFFFFFFBFFFFBFFFFFFFFFBFFFBFFFFEFFFEFFFFFFFBEFFFFFEFFFEFFFFFFEFFFFFFBFFBFBFFFFBFBFFFFBFFFFFFFFEFFEBEDEBCAFCBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0E9E0909AC909C90CD0CF0BCBDEBDEBFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFBFFFFFFBFFFFBFFFBFFFFFBFFBFFFFFFFFFBFBFFFFFFFFFFFFFFFFFBE9E9EBCBFDBEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F9C0DCCCC9ECCACC9ACF9EDEDE9EBFFFFFBFFFBFFFFFFBFFBFFFFFFFFFFFBFFBFFBFFFFFFFFFFFFFFFFFFFFFFFFFBFFBFFFFFFFFFFFFFFFFFFFFFFFFFFAFE9EDBCF9EDAFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCE9C00B09C909C9BCD90CF09E9FDFBFFFFEFFFFEFBFEFFEFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFFEFBFFFBFBFBFBFFFFFFFFFFFFFFFFFFDBDE9ECBCE9EDADEFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBD0FCDCC0CCD0CC00ECF0CFCBCBE9FFFFFFFFFFFFFFFFFFFFFEFFBFFBFEFFFEFFFEFFFEFFEBFFEBFFEFBFEBFFFFBFFFBFFFFFFFFFBFFFFFFFFFFFFFEFBEF0FCBDE9FCBCFBFFEFBEFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBECF00090B09A090DD09CF9CBCFE9FEBFFFBFFBFFFFFFBFFBFFBFFFFFFFFBFFBFFBFFBFFBFFFFFFFFBFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFFFFFFBFBCF9EDADA0F0ADA9E9ADBEDBEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFED90DCFCCCCCCDECCACDE9CADCB9EDBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFBFFFFBFBFBFBFFFFFFFFFFFFBFEFFBECB0DCEDCEDCEDCEFCE9EDBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0EC0009090900909CBC0CED0FCFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFBFFFFFFFFFFFFFFFFFFBFFBFBEDBFCFAD9E9DAD9E9DADBC9ECBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9DEDCCDCCCDCCD0DCBDBDADADADEBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBE9E9CAC9E0DAC9E0DAC9E9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0CA900B00B00B00E00C0C0DADADBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDEFDEFDEFDEFDFFFFFFFFFFFFFFF000000000000000000000105000000000000A9AD05FE"); + var encodedString = Encoding.GetEncoding(0).GetString(byteArrayValue); + var base64String = Convert.ToBase64String(byteArrayValue); + + Console.WriteLine("Original length: {0}, Encoding length: {1}, Base65 length: {2}", + byteArrayValue.Length, encodedString.Length, base64String.Length); + + CompareMultipleRuns( + "Convert.FromBase64String", () => Convert.FromBase64String(Convert.ToBase64String(byteArrayValue)), + "Encoding.Default", () => Encoding.GetEncoding(0).GetBytes(Encoding.GetEncoding(0).GetString(byteArrayValue)) + ); + } + + [Test] + public void Compare_Type_test_with_Parse_Func() + { + var testClassWithType = new TestClassWithType { Type = typeof(string) }; + var testClassWithFunc = new TestClassWithFunc { GetValueFn = value => value }; + + CompareMultipleRuns( + "TestClassWithType", () => testClassWithType.GetValue("test"), + "TestClassWithFunc", () => testClassWithFunc.GetValue("test") + ); + } + + + } + + public class TestClassWithType + { + public Type Type { get; set; } + + public object GetValue(string value) + { + if (Type == typeof(string)) + { + return value; + } + + return null; + } + } + + public class TestClassWithFunc + { + public ParseStringDelegate GetValueFn; + + public object GetValue(string value) + { + if (GetValueFn != null) + { + return GetValueFn(value); + } + return null; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Perf/DateTimePerf.cs b/tests/ServiceStack.Common.Tests/Perf/DateTimePerf.cs index 671c46d3e09..5761545e26f 100644 --- a/tests/ServiceStack.Common.Tests/Perf/DateTimePerf.cs +++ b/tests/ServiceStack.Common.Tests/Perf/DateTimePerf.cs @@ -7,123 +7,124 @@ namespace ServiceStack.Common.Tests.Perf { - [TestFixture] - public class DateTimePerf - : PerfTestBase - { - public DateTimePerf() - { - this.MultipleIterations = new List { 10000 }; - } - - - [Test] - public void PrintFormats() - { - var now = DateTime.Now; - var nowWithoutTime = new DateTime(now.Date.Ticks); - - Log(now.ToShortDateString()); - Log(now.ToShortTimeString()); - Log(now.ToLongTimeString()); - Log(now.ToLongTimeString()); - Log(now.ToString()); - Log(DateTimeSerializer.ToDateTimeString(now)); - Log(DateTimeSerializer.ToShortestXsdDateTimeString(now)); - - Log("\n"); - Log(nowWithoutTime.ToShortDateString()); - Log(nowWithoutTime.ToShortTimeString()); - Log(nowWithoutTime.ToLongTimeString()); - Log(nowWithoutTime.ToLongTimeString()); - Log(nowWithoutTime.ToString()); - Log(DateTimeSerializer.ToDateTimeString(nowWithoutTime)); - Log(DateTimeSerializer.ToShortestXsdDateTimeString(nowWithoutTime)); - } - - [Test] - public void Compare_DateTime_Serializtion() - { - var now = DateTime.Now; - var nowWithoutTime = new DateTime(now.Date.Ticks); - - CompareMultipleRuns( - "now.ToString()", () => now.ToString(), - "XmlConvert.ToString(now, XmlDateTimeSerializationMode.Utc)", () => XmlConvert.ToString(now, XmlDateTimeSerializationMode.Utc) - ); - - CompareMultipleRuns( - "now.ToString()", () => now.ToString(), - "XmlConvert.ToString(now, DateTimeFormat)", () => XmlConvert.ToString(now, DateTimeSerializer.XsdDateTimeFormat) - ); - - CompareMultipleRuns( - "ToDateTimeString(now)", () => DateTimeSerializer.ToDateTimeString(now), - "ToDateOrDateTimeString(now)", () => DateTimeSerializer.ToShortestXsdDateTimeString(now) - ); - - CompareMultipleRuns( - "ToDateTimeString(nowWithoutTime)", () => DateTimeSerializer.ToDateTimeString(nowWithoutTime), - "ToDateOrDateTimeString(nowWithoutTime)", () => DateTimeSerializer.ToShortestXsdDateTimeString(nowWithoutTime) - ); - } - - [Test] - public void Compare_DateTime_DeSerializtion() - { - var nowStr = DateTime.Now.ToString(); - var nowXmlStr = XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Utc); - var nowXmlExact = XmlConvert.ToString(DateTime.UtcNow, DateTimeSerializer.XsdDateTimeFormat); - - CompareMultipleRuns( - "DateTime.Parse(now.ToString())", () => DateTime.Parse(nowStr), - "XmlConvert.ToString", () => XmlConvert.ToDateTime(nowXmlStr, XmlDateTimeSerializationMode.Utc) - ); - - CompareMultipleRuns( - "DateTime.ParseExact(utcNow, DateTimeFormat, null)", () => DateTime.ParseExact(nowXmlExact, DateTimeSerializer.XsdDateTimeFormat, null), - "XmlConvert.ToString", () => XmlConvert.ToDateTime(nowXmlExact, DateTimeSerializer.XsdDateTimeFormat) - ); - } - - [Test] - public void Compare_Serialization() - { - var now = DateTime.Now; - CompareMultipleRuns( - "FromDateTimeString(ToDateTimeString(now))", () => DateTimeSerializer.ParseDateTime(DateTimeSerializer.ToDateTimeString(now)), - "FromDateOrDateTimeString(ToDateOrDateTimeString(now))", () => DateTimeSerializer.ParseShortestXsdDateTime(DateTimeSerializer.ToShortestXsdDateTimeString(now)) - ); - - Assert.That(now, Is.EqualTo(DateTimeSerializer.ParseDateTime(DateTimeSerializer.ToDateTimeString(now)))); - Assert.That(now, Is.EqualTo(DateTimeSerializer.ParseShortestXsdDateTime(DateTimeSerializer.ToShortestXsdDateTimeString(now)))); - - var nowWithoutTime = new DateTime(now.Date.Ticks); - CompareMultipleRuns( - "FromDateTimeString(ToDateTimeString(nowWithoutTime))", () => DateTimeSerializer.ParseDateTime(DateTimeSerializer.ToDateTimeString(nowWithoutTime)), - "FromDateOrDateTimeString(ToDateOrDateTimeString(nowWithoutTime))", () => DateTimeSerializer.ParseShortestXsdDateTime(DateTimeSerializer.ToShortestXsdDateTimeString(nowWithoutTime)) - ); - - Assert.That(nowWithoutTime, Is.EqualTo(DateTimeSerializer.ParseDateTime(DateTimeSerializer.ToDateTimeString(nowWithoutTime)))); - Assert.That(nowWithoutTime, Is.EqualTo(DateTimeSerializer.ParseShortestXsdDateTime(DateTimeSerializer.ToShortestXsdDateTimeString(nowWithoutTime)))); - - Log("OK"); - } - - [Test] - public void Compare_Parsing() - { - const string dateTimeStr = "2010-11-22T11:11:11.001Z"; - - CompareMultipleRuns( - "XmlConvert.ToDateTime()", () => XmlConvert.ToDateTime(dateTimeStr, XmlDateTimeSerializationMode.Utc), - "DateTime.ParseExact()", () => DateTime.ParseExact(dateTimeStr, - DateTimeSerializer.XsdDateTimeFormat3F, null, - DateTimeStyles.AdjustToUniversal) - ); - } - - } + [TestFixture] + public class DateTimePerf + : PerfTestBase + { + public DateTimePerf() + { + this.MultipleIterations = new List { 10000 }; + } + + + [Test] + public void PrintFormats() + { + var now = DateTime.Now; + var nowWithoutTime = new DateTime(now.Date.Ticks); + + Log(now.ToString("d")); + Log(now.ToString("t")); + Log(now.ToString("D")); + Log(now.ToString("T")); + Log(now.ToString()); + Log(DateTimeSerializer.ToDateTimeString(now)); + Log(DateTimeSerializer.ToShortestXsdDateTimeString(now)); + + Log("\n"); + Log(nowWithoutTime.ToString("d")); + Log(nowWithoutTime.ToString("t")); + Log(nowWithoutTime.ToString("D")); + Log(nowWithoutTime.ToString("T")); + Log(nowWithoutTime.ToString()); + Log(DateTimeSerializer.ToDateTimeString(nowWithoutTime)); + Log(DateTimeSerializer.ToShortestXsdDateTimeString(nowWithoutTime)); + } + + [Test] + public void Compare_DateTime_Serializtion() + { + var now = DateTime.Now; + var nowWithoutTime = new DateTime(now.Date.Ticks); + + CompareMultipleRuns( + "now.ToString()", () => now.ToString(), + "XmlConvert.ToString(now, XmlDateTimeSerializationMode.Utc)", () => XmlConvert.ToString(now, XmlDateTimeSerializationMode.Utc) + ); + + CompareMultipleRuns( + "now.ToString()", () => now.ToString(), + "XmlConvert.ToString(now, DateTimeFormat)", () => XmlConvert.ToString(now, DateTimeSerializer.XsdDateTimeFormat) + ); + + CompareMultipleRuns( + "ToDateTimeString(now)", () => DateTimeSerializer.ToDateTimeString(now), + "ToDateOrDateTimeString(now)", () => DateTimeSerializer.ToShortestXsdDateTimeString(now) + ); + + CompareMultipleRuns( + "ToDateTimeString(nowWithoutTime)", () => DateTimeSerializer.ToDateTimeString(nowWithoutTime), + "ToDateOrDateTimeString(nowWithoutTime)", () => DateTimeSerializer.ToShortestXsdDateTimeString(nowWithoutTime) + ); + } + + [Test] + public void Compare_DateTime_DeSerializtion() + { + var nowStr = DateTime.Now.ToString(); + var nowXmlStr = XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Utc); + var nowXmlExact = XmlConvert.ToString(DateTime.UtcNow, DateTimeSerializer.XsdDateTimeFormat); + + CompareMultipleRuns( + "DateTime.Parse(now.ToString())", () => DateTime.Parse(nowStr), + "XmlConvert.ToString", () => XmlConvert.ToDateTime(nowXmlStr, XmlDateTimeSerializationMode.Utc) + ); +#if !NETCORE + CompareMultipleRuns( + "DateTime.ParseExact(utcNow, DateTimeFormat, null)", () => DateTime.ParseExact(nowXmlExact, DateTimeSerializer.XsdDateTimeFormat, null), + "XmlConvert.ToString", () => XmlConvert.ToDateTime(nowXmlExact, DateTimeSerializer.XsdDateTimeFormat) + ); +#endif + } + + [Test] + public void Compare_Serialization() + { + var now = DateTime.Now; + CompareMultipleRuns( + "FromDateTimeString(ToDateTimeString(now))", () => DateTimeSerializer.ParseDateTime(DateTimeSerializer.ToDateTimeString(now)), + "FromDateOrDateTimeString(ToDateOrDateTimeString(now))", () => DateTimeSerializer.ParseShortestXsdDateTime(DateTimeSerializer.ToShortestXsdDateTimeString(now)) + ); + + Assert.That(now, Is.EqualTo(DateTimeSerializer.ParseDateTime(DateTimeSerializer.ToDateTimeString(now)))); + Assert.That(now, Is.EqualTo(DateTimeSerializer.ParseShortestXsdDateTime(DateTimeSerializer.ToShortestXsdDateTimeString(now)))); + + var nowWithoutTime = new DateTime(now.Date.Ticks); + CompareMultipleRuns( + "FromDateTimeString(ToDateTimeString(nowWithoutTime))", () => DateTimeSerializer.ParseDateTime(DateTimeSerializer.ToDateTimeString(nowWithoutTime)), + "FromDateOrDateTimeString(ToDateOrDateTimeString(nowWithoutTime))", () => DateTimeSerializer.ParseShortestXsdDateTime(DateTimeSerializer.ToShortestXsdDateTimeString(nowWithoutTime)) + ); + + Assert.That(nowWithoutTime, Is.EqualTo(DateTimeSerializer.ParseDateTime(DateTimeSerializer.ToDateTimeString(nowWithoutTime)))); + Assert.That(nowWithoutTime, Is.EqualTo(DateTimeSerializer.ParseShortestXsdDateTime(DateTimeSerializer.ToShortestXsdDateTimeString(nowWithoutTime)))); + + Log("OK"); + } + + [Test] + public void Compare_Parsing() + { + const string dateTimeStr = "2010-11-22T11:11:11.001Z"; + + CompareMultipleRuns( + "XmlConvert.ToDateTime()", () => XmlConvert.ToDateTime(dateTimeStr, XmlDateTimeSerializationMode.Utc), + "DateTime.ParseExact()", () => DateTime.ParseExact(dateTimeStr, + DateTimeSerializer.XsdDateTimeFormat3F, null, + DateTimeStyles.AdjustToUniversal) + ); + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Perf/IdUtilsPerf.cs b/tests/ServiceStack.Common.Tests/Perf/IdUtilsPerf.cs index a20160b1d2e..52b41b3dbdc 100644 --- a/tests/ServiceStack.Common.Tests/Perf/IdUtilsPerf.cs +++ b/tests/ServiceStack.Common.Tests/Perf/IdUtilsPerf.cs @@ -5,94 +5,94 @@ namespace ServiceStack.Common.Tests.Perf { - [Ignore("Benchmarks for measuring Id access")] - [TestFixture] - public class IdUtilsPerf - : PerfTestBase - { - public IdUtilsPerf() - { - this.MultipleIterations = new List { 100000 }; - } + [Ignore("Benchmarks for measuring Id access")] + [TestFixture] + public class IdUtilsPerf + : PerfTestBase + { + public IdUtilsPerf() + { + this.MultipleIterations = new List { 100000 }; + } - public static object OldGetId(T entity) - { - const string idField = "Id"; + public static object OldGetId(T entity) + { + const string idField = "Id"; - var guidEntity = entity as IHasGuidId; - if (guidEntity != null) - { - return guidEntity.Id; - } + var guidEntity = entity as IHasGuidId; + if (guidEntity != null) + { + return guidEntity.Id; + } - var intEntity = entity as IHasIntId; - if (intEntity != null) - { - return intEntity.Id; - } + var intEntity = entity as IHasIntId; + if (intEntity != null) + { + return intEntity.Id; + } - var longEntity = entity as IHasLongId; - if (longEntity != null) - { - return longEntity.Id; - } + var longEntity = entity as IHasLongId; + if (longEntity != null) + { + return longEntity.Id; + } - var stringEntity = entity as IHasStringId; - if (stringEntity != null) - { - return stringEntity.Id; - } + var stringEntity = entity as IHasStringId; + if (stringEntity != null) + { + return stringEntity.Id; + } - var propertyInfo = typeof(T).GetProperty(idField); - if (propertyInfo != null) - { - return propertyInfo.GetGetMethod().Invoke(entity, new object[0]); - } + var propertyInfo = typeof(T).GetProperty(idField); + if (propertyInfo != null) + { + return propertyInfo.GetGetMethod().Invoke(entity, new object[0]); + } - if (typeof(T).IsValueType || typeof(T) == typeof(string)) - { - return entity.GetHashCode(); - } + if (typeof(T).IsValueType || typeof(T) == typeof(string)) + { + return entity.GetHashCode(); + } - throw new NotSupportedException("Cannot retrieve value of Id field, use IHasId<>"); - } + throw new NotSupportedException("Cannot retrieve value of Id field, use IHasId<>"); + } - private void CompareForInstance(T obj) - { - CompareMultipleRuns( - "OldGetId", () => OldGetId(obj), - "obj.GetId()", () => obj.GetId() - ); - } + private void CompareForInstance(T obj) + { + CompareMultipleRuns( + "OldGetId", () => OldGetId(obj), + "obj.GetId()", () => obj.GetId() + ); + } - [Test] - public void Compare_HasIntId() - { - CompareForInstance(new IdUtilsTests.HasIntId()); - } + [Test] + public void Compare_HasIntId() + { + CompareForInstance(new IdUtilsTests.HasIntId()); + } - [Test] - public void Compare_HasGenericIdInt() - { - CompareForInstance(new IdUtilsTests.HasGenericIdInt()); - } + [Test] + public void Compare_HasGenericIdInt() + { + CompareForInstance(new IdUtilsTests.HasGenericIdInt()); + } - [Test] - public void Compare_HasGenericIdString() - { - CompareForInstance(new IdUtilsTests.HasGenericIdString()); - } + [Test] + public void Compare_HasGenericIdString() + { + CompareForInstance(new IdUtilsTests.HasGenericIdString()); + } - [Test] - public void Compare_HasIdStringProperty() - { - CompareForInstance(new IdUtilsTests.HasIdStringProperty()); - } + [Test] + public void Compare_HasIdStringProperty() + { + CompareForInstance(new IdUtilsTests.HasIdStringProperty()); + } - [Test] - public void Compare_HasIdProperty() - { - CompareForInstance(new IdUtilsTests.HasIdProperty()); - } - } + [Test] + public void Compare_HasIdProperty() + { + CompareForInstance(new IdUtilsTests.HasIdProperty()); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Perf/PropertyAccessorPerf.cs b/tests/ServiceStack.Common.Tests/Perf/PropertyAccessorPerf.cs deleted file mode 100644 index fb1d7b198b9..00000000000 --- a/tests/ServiceStack.Common.Tests/Perf/PropertyAccessorPerf.cs +++ /dev/null @@ -1,172 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Reflection; -using NUnit.Framework; -using ServiceStack.Common.Tests.Models; -using ServiceStack.Reflection; -using ServiceStack.Text; - -namespace ServiceStack.Common.Tests.Perf -{ - [Ignore("Benchmark for comparing property access")] - [TestFixture] - public class PropertyAccessorPerf - : PerfTestBase - { - public PropertyAccessorPerf() - { - this.MultipleIterations = new List { 1000000 }; - } - - public static class TestAcessor - { - public static Func TypedGetPropertyFn(PropertyInfo pi) - { - var mi = pi.GetGetMethod(); - return (Func)Delegate.CreateDelegate(typeof(Func), mi); - } - - /// - /// Required to cast the return ValueType to an object for caching - /// - public static Func ValueUnTypedGetPropertyFn(PropertyInfo pi) - { - var typedPropertyFn = TypedGetPropertyFn(pi); - return x => typedPropertyFn(x); - } - - public static Func ValueUnTypedGetPropertyTypeFn_Reflection(PropertyInfo pi) - { - var mi = typeof(StaticAccessors).GetMethod("TypedGetPropertyFn"); - var genericMi = mi.MakeGenericMethod(pi.PropertyType); - var typedGetPropertyFn = (Delegate)genericMi.Invoke(null, new[] { pi }); - return x => typedGetPropertyFn.Method.Invoke(x, new object[] { }); - } - - public static Func ValueUnTypedGetPropertyTypeFn_Expr(PropertyInfo pi) - { - var mi = typeof(StaticAccessors).GetMethod("TypedGetPropertyFn"); - var genericMi = mi.MakeGenericMethod(pi.PropertyType); - var typedGetPropertyFn = (Delegate)genericMi.Invoke(null, new[] { pi }); - - var typedMi = typedGetPropertyFn.Method; - var obj = Expression.Parameter(typeof(object), "oFunc"); - var expr = Expression.Lambda>( - Expression.Convert( - Expression.Call( - Expression.Convert(obj, typedMi.DeclaringType), - typedMi - ), - typeof(object) - ), - obj - ); - return expr.Compile(); - } - - - /// - /// Func to set the Strongly-typed field - /// - public static Action TypedSetPropertyFn(PropertyInfo pi) - { - var mi = pi.GetSetMethod(); - return (Action)Delegate.CreateDelegate(typeof(Action), mi); - } - - /// - /// Required to cast the ValueType to an object for caching - /// - public static Action ValueUnTypedSetPropertyFn(PropertyInfo pi) - { - var typedPropertyFn = TypedSetPropertyFn(pi); - return (x, y) => typedPropertyFn(x, (TId)y); - } - - public static Action ValueUnTypedSetPropertyTypeFn_Reflection(PropertyInfo pi) - { - var mi = typeof (StaticAccessors).GetMethod("TypedSetPropertyFn"); - var genericMi = mi.MakeGenericMethod(pi.PropertyType); - var typedSetPropertyFn = (Delegate) genericMi.Invoke(null, new[] {pi}); - - return (x, y) => typedSetPropertyFn.Method.Invoke(x, new[] { y }); - } - - public static Action ValueUnTypedSetPropertyTypeFn_Expr(PropertyInfo pi) - { - var mi = typeof(StaticAccessors).GetMethod("TypedSetPropertyFn"); - var genericMi = mi.MakeGenericMethod(pi.PropertyType); - var typedSetPropertyFn = (Delegate)genericMi.Invoke(null, new[] { pi }); - - var typedMi = typedSetPropertyFn.Method; - var paramFunc = Expression.Parameter(typeof(object), "oFunc"); - var paramValue = Expression.Parameter(typeof(object), "oValue"); - var expr = Expression.Lambda>( - Expression.Call( - Expression.Convert(paramFunc, typedMi.DeclaringType), - typedMi, - Expression.Convert(paramValue, pi.PropertyType) - ), - paramFunc, - paramValue - ); - return expr.Compile(); - } - } - - private void CompareGet(Func reflection, Func expr) - { - var obj = typeof(T).CreateInstance(); - CompareMultipleRuns( - "GET Reflection", () => reflection(obj), - "GET Expression", () => expr(obj) - ); - } - - private void CompareSet( - Action reflection, Action expr, TArg arg) - { - var obj = typeof(T).CreateInstance(); - CompareMultipleRuns( - "SET Reflection", () => reflection(obj, arg), - "SET Expression", () => expr(obj, arg) - ); - } - - [Test] - public void Compare_get_int() - { - var fieldPi = typeof(ModelWithIdAndName).GetProperty("Id"); - CompareGet - ( - TestAcessor.ValueUnTypedGetPropertyTypeFn_Reflection(fieldPi), - TestAcessor.ValueUnTypedGetPropertyTypeFn_Expr(fieldPi) - ); - CompareSet - ( - TestAcessor.ValueUnTypedSetPropertyTypeFn_Reflection(fieldPi), - TestAcessor.ValueUnTypedSetPropertyTypeFn_Expr(fieldPi), - 1 - ); - } - - [Test] - public void Compare_get_string() - { - var fieldPi = typeof(ModelWithIdAndName).GetProperty("Name"); - CompareGet - ( - TestAcessor.ValueUnTypedGetPropertyTypeFn_Reflection(fieldPi), - TestAcessor.ValueUnTypedGetPropertyTypeFn_Expr(fieldPi) - ); - - CompareSet - ( - TestAcessor.ValueUnTypedSetPropertyTypeFn_Reflection(fieldPi), - TestAcessor.ValueUnTypedSetPropertyTypeFn_Expr(fieldPi), - "A" - ); - } - } -} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Perf/ReflectionTests.cs b/tests/ServiceStack.Common.Tests/Perf/ReflectionTests.cs index d11fe6864e4..92ccd75e15a 100644 --- a/tests/ServiceStack.Common.Tests/Perf/ReflectionTests.cs +++ b/tests/ServiceStack.Common.Tests/Perf/ReflectionTests.cs @@ -7,67 +7,71 @@ namespace ServiceStack.Common.Tests.Perf { - [Ignore("Benchmark for comparing expressions / delegates around generic methods.")] - [TestFixture] - public class ReflectionTests - : PerfTestBase - { - public ReflectionTests() - : base() - { - this.MultipleIterations = new List { 100000000 }; - } + [Ignore("Benchmark for comparing expressions / delegates around generic methods.")] + [TestFixture] + public class ReflectionTests + : PerfTestBase + { + public ReflectionTests() + : base() + { + this.MultipleIterations = new List { 100000000 }; + } - public static Func GetPropertyValueMethodViaExpressions( - Type type, PropertyInfo propertyInfo) - { - var getMethodInfo = propertyInfo.GetGetMethod(); - var oInstanceParam = Expression.Parameter(typeof(object), "oInstanceParam"); - var instanceParam = Expression.Convert(oInstanceParam, type); + public static Func GetPropertyValueMethodViaExpressions( + Type type, PropertyInfo propertyInfo) + { + var getMethodInfo = propertyInfo.GetGetMethod(); + var oInstanceParam = Expression.Parameter(typeof(object), "oInstanceParam"); + var instanceParam = Expression.Convert(oInstanceParam, type); - var exprCallPropertyGetFn = Expression.Call(instanceParam, getMethodInfo); - var oExprCallPropertyGetFn = Expression.Convert(exprCallPropertyGetFn, typeof(object)); + var exprCallPropertyGetFn = Expression.Call(instanceParam, getMethodInfo); + var oExprCallPropertyGetFn = Expression.Convert(exprCallPropertyGetFn, typeof(object)); - var propertyGetFn = Expression.Lambda> - ( - oExprCallPropertyGetFn, - oInstanceParam - ).Compile(); + var propertyGetFn = Expression.Lambda> + ( + oExprCallPropertyGetFn, + oInstanceParam + ).Compile(); - return propertyGetFn; - } + return propertyGetFn; + } - public static Func GetPropertyValueMethodViaDelegate( - Type type, PropertyInfo propertyInfo) - { - var mi = typeof(ReflectionTests).GetMethod("CreateFunc"); + public static Func GetPropertyValueMethodViaDelegate( + Type type, PropertyInfo propertyInfo) + { + var mi = typeof(ReflectionTests).GetMethod("CreateFunc"); - var genericMi = mi.MakeGenericMethod(type, propertyInfo.PropertyType); - var del = genericMi.Invoke(null, new[] { propertyInfo.GetGetMethod() }); + var genericMi = mi.MakeGenericMethod(type, propertyInfo.PropertyType); + var del = genericMi.Invoke(null, new[] { propertyInfo.GetGetMethod() }); - return (Func) del; - } + return (Func)del; + } - public static Func CreateFunc(MethodInfo mi) - { - var del = (Func)Delegate.CreateDelegate(typeof(Func), mi); - return x => del((T1) x); - } + public static Func CreateFunc(MethodInfo mi) + { +#if !NETCORE + var del = (Func)Delegate.CreateDelegate(typeof(Func), mi); +#else + var del = (Func)mi.CreateDelegate(typeof(Func)); +#endif + return x => del((T1)x); + } - [Test] - public void Compare() - { - var model = ModelWithIdAndName.Create(1); - var pi = model.GetType().GetProperty("Name"); - var simpleExpr = GetPropertyValueMethodViaExpressions(typeof(ModelWithIdAndName), pi); - var simpleDelegate = GetPropertyValueMethodViaDelegate(typeof(ModelWithIdAndName), pi); + [Test] + public void Compare() + { + var model = ModelWithIdAndName.Create(1); + var pi = model.GetType().GetProperty("Name"); + var simpleExpr = GetPropertyValueMethodViaExpressions(typeof(ModelWithIdAndName), pi); + var simpleDelegate = GetPropertyValueMethodViaDelegate(typeof(ModelWithIdAndName), pi); - CompareMultipleRuns( - "Expressions", () => simpleExpr(model), - "Delegate", () => simpleDelegate(model) - ); + CompareMultipleRuns( + "Expressions", () => simpleExpr(model), + "Delegate", () => simpleDelegate(model) + ); - } + } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Perf/StringParsePerf.cs b/tests/ServiceStack.Common.Tests/Perf/StringParsePerf.cs index 6c5a3f6037f..a423e8ecf3c 100644 --- a/tests/ServiceStack.Common.Tests/Perf/StringParsePerf.cs +++ b/tests/ServiceStack.Common.Tests/Perf/StringParsePerf.cs @@ -6,221 +6,221 @@ namespace ServiceStack.Common.Tests.Perf { - [Ignore("Benchmarks for deserializing basic .NET types")] - [TestFixture] - public class StringParsePerf - : PerfTestBase - { - public StringParsePerf() - { - this.MultipleIterations = new List { 10000 }; - } - - public List CreateList(Func createStringFn, int noOfTimes) - { - var list = new List(); - for (var i=0; i < noOfTimes; i++) - { - list.Add(createStringFn(i)); - } - return list; - } - - [Test] - public void Compare_ints() - { - CompareMultipleRuns( - "int.Parse", () => int.Parse("1"), - "SCU.Parse", () => TypeSerializer.DeserializeFromString("1") - ); - } - - [Test] - public void Compare_longs() - { - CompareMultipleRuns( - "long.Parse", () => long.Parse("1"), - "SCU.Parse", () => TypeSerializer.DeserializeFromString("1") - ); - } - - [Test] - public void Compare_Guids() - { - CompareMultipleRuns( - "new Guid", () => new Guid("AC800C9C-B8BE-4829-868A-B43CFF7B2AFD"), - "SCU.Parse", () => TypeSerializer.DeserializeFromString("AC800C9C-B8BE-4829-868A-B43CFF7B2AFD") - ); - } - - [Test] - public void Compare_DateTime() - { - const string dateTimeStr = "2009-12-20T19:24:37.4379982Z"; - CompareMultipleRuns( - "DateTime.Parse", () => DateTime.Parse(dateTimeStr), - "SCU.Parse", () => TypeSerializer.DeserializeFromString(dateTimeStr) - ); - } - - private static string[] SplitList(string listStr) - { - return listStr.Substring(1, listStr.Length - 2).Split(','); - } - - [Test] - public void Compare_IntList() - { - const string intValues = "[0,1,2,3,4,5,6,7,8,9]"; - CompareMultipleRuns( - "intValues.Split(',').ConvertAll", () => SplitList(intValues).Map(int.Parse), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(intValues) - ); - } - - [Test] - public void Compare_LongList() - { - const string longValues = "[0,1,2,3,4,5,6,7,8,9]"; - CompareMultipleRuns( + [Ignore("Benchmarks for deserializing basic .NET types")] + [TestFixture] + public class StringParsePerf + : PerfTestBase + { + public StringParsePerf() + { + this.MultipleIterations = new List { 10000 }; + } + + public List CreateList(Func createStringFn, int noOfTimes) + { + var list = new List(); + for (var i = 0; i < noOfTimes; i++) + { + list.Add(createStringFn(i)); + } + return list; + } + + [Test] + public void Compare_ints() + { + CompareMultipleRuns( + "int.Parse", () => int.Parse("1"), + "SCU.Parse", () => TypeSerializer.DeserializeFromString("1") + ); + } + + [Test] + public void Compare_longs() + { + CompareMultipleRuns( + "long.Parse", () => long.Parse("1"), + "SCU.Parse", () => TypeSerializer.DeserializeFromString("1") + ); + } + + [Test] + public void Compare_Guids() + { + CompareMultipleRuns( + "new Guid", () => new Guid("AC800C9C-B8BE-4829-868A-B43CFF7B2AFD"), + "SCU.Parse", () => TypeSerializer.DeserializeFromString("AC800C9C-B8BE-4829-868A-B43CFF7B2AFD") + ); + } + + [Test] + public void Compare_DateTime() + { + const string dateTimeStr = "2009-12-20T19:24:37.4379982Z"; + CompareMultipleRuns( + "DateTime.Parse", () => DateTime.Parse(dateTimeStr), + "SCU.Parse", () => TypeSerializer.DeserializeFromString(dateTimeStr) + ); + } + + private static string[] SplitList(string listStr) + { + return listStr.Substring(1, listStr.Length - 2).Split(','); + } + + [Test] + public void Compare_IntList() + { + const string intValues = "[0,1,2,3,4,5,6,7,8,9]"; + CompareMultipleRuns( + "intValues.Split(',').ConvertAll", () => SplitList(intValues).Map(int.Parse), + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(intValues) + ); + } + + [Test] + public void Compare_LongList() + { + const string longValues = "[0,1,2,3,4,5,6,7,8,9]"; + CompareMultipleRuns( "intValues.Split(',').ConvertAll", () => SplitList(longValues).Map(long.Parse), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(longValues) - ); - } - - [Test] - public void Compare_StringArray() - { - const string stringValues = "[a,b,c,d,e,f,g,h,i,j]"; - CompareMultipleRuns( - "TextExtensions.FromCsvFields", () => TextExtensions.FromCsvFields(stringValues.Split(',')), - "SCU.Parse", () => TypeSerializer.DeserializeFromString(stringValues) - ); - } - - [Test] - public void Compare_DoubleArray() - { - const string stringValues = "[1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,0.1]"; - CompareMultipleRuns( + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(longValues) + ); + } + + [Test] + public void Compare_StringArray() + { + const string stringValues = "[a,b,c,d,e,f,g,h,i,j]"; + CompareMultipleRuns( + "TextExtensions.FromCsvFields", () => TextExtensions.FromCsvFields(stringValues.Split(',')), + "SCU.Parse", () => TypeSerializer.DeserializeFromString(stringValues) + ); + } + + [Test] + public void Compare_DoubleArray() + { + const string stringValues = "[1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,0.1]"; + CompareMultipleRuns( ".Split(',').ConvertAll(x => double.Parse(x))", () => SplitList(stringValues).Map(double.Parse), - "SCU.Parse", () => TypeSerializer.DeserializeFromString(stringValues) - ); - } - - [Test] - public void Compare_GuidArray() - { - const string stringValues = "[8F403A5E-CDFC-4C6F-B0EB-C055C1C8BA60,5673BAC7-BAC5-4B3F-9B69-4180E6227508,B0CA730F-14C9-4D00-AC7F-07E7DE8D566E,4E26AF94-6B13-4F89-B192-36C6ABE73DAE,08491B16-2270-4DF9-8AEE-A8861A791C50]"; - CompareMultipleRuns( + "SCU.Parse", () => TypeSerializer.DeserializeFromString(stringValues) + ); + } + + [Test] + public void Compare_GuidArray() + { + const string stringValues = "[8F403A5E-CDFC-4C6F-B0EB-C055C1C8BA60,5673BAC7-BAC5-4B3F-9B69-4180E6227508,B0CA730F-14C9-4D00-AC7F-07E7DE8D566E,4E26AF94-6B13-4F89-B192-36C6ABE73DAE,08491B16-2270-4DF9-8AEE-A8861A791C50]"; + CompareMultipleRuns( ".Split(',').ConvertAll(x => new Guid(x))", () => SplitList(stringValues).Map(x => new Guid(x)), - "SCU.Parse", () => TypeSerializer.DeserializeFromString(stringValues) - ); - } - - [Test] - public void Compare_StringList() - { - const string stringValues = "[a,b,c,d,e,f,g,h,i,j]"; - CompareMultipleRuns( - "stringValues.Split(',').FromCsvFields()", () => SplitList(stringValues).FromCsvFields(), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) - ); - } - - [Test] - public void Compare_DoubleList() - { - const string stringValues = "[1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,0.1]"; - CompareMultipleRuns( + "SCU.Parse", () => TypeSerializer.DeserializeFromString(stringValues) + ); + } + + [Test] + public void Compare_StringList() + { + const string stringValues = "[a,b,c,d,e,f,g,h,i,j]"; + CompareMultipleRuns( + "stringValues.Split(',').FromCsvFields()", () => SplitList(stringValues).FromCsvFields(), + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) + ); + } + + [Test] + public void Compare_DoubleList() + { + const string stringValues = "[1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,0.1]"; + CompareMultipleRuns( ".Split(',').ConvertAll(x => double.Parse(x))", () => SplitList(stringValues).Map(double.Parse), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) - ); - } - - [Test] - public void Compare_GuidList() - { - const string stringValues = "[8F403A5E-CDFC-4C6F-B0EB-C055C1C8BA60,5673BAC7-BAC5-4B3F-9B69-4180E6227508,B0CA730F-14C9-4D00-AC7F-07E7DE8D566E,4E26AF94-6B13-4F89-B192-36C6ABE73DAE,08491B16-2270-4DF9-8AEE-A8861A791C50]"; - CompareMultipleRuns( + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) + ); + } + + [Test] + public void Compare_GuidList() + { + const string stringValues = "[8F403A5E-CDFC-4C6F-B0EB-C055C1C8BA60,5673BAC7-BAC5-4B3F-9B69-4180E6227508,B0CA730F-14C9-4D00-AC7F-07E7DE8D566E,4E26AF94-6B13-4F89-B192-36C6ABE73DAE,08491B16-2270-4DF9-8AEE-A8861A791C50]"; + CompareMultipleRuns( ".Split(',').ConvertAll(x => new Guid(x))", () => SplitList(stringValues).Map(x => new Guid(x)), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) - ); - } - - [Test] - public void Compare_StringHashSet() - { - const string stringValues = "[a,b,c,d,e,f,g,h,i,j]"; - CompareMultipleRuns( - "new HashSet(.Split(',').FromCsvFields())", () => new HashSet(SplitList(stringValues).FromCsvFields()), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) - ); - } - - [Test] - public void Compare_IntHashSet() - { - const string stringValues = "[0,1,2,3,4,5,6,7,8,9]"; - CompareMultipleRuns( + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) + ); + } + + [Test] + public void Compare_StringHashSet() + { + const string stringValues = "[a,b,c,d,e,f,g,h,i,j]"; + CompareMultipleRuns( + "new HashSet(.Split(',').FromCsvFields())", () => new HashSet(SplitList(stringValues).FromCsvFields()), + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) + ); + } + + [Test] + public void Compare_IntHashSet() + { + const string stringValues = "[0,1,2,3,4,5,6,7,8,9]"; + CompareMultipleRuns( "new HashSet(.Split(',').ConvertAll(x => int.Parse(x))", () => new HashSet(SplitList(stringValues).Map(int.Parse)), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) - ); - } - - [Test] - public void Compare_DoubleHashSet() - { - const string stringValues = "[1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,0.1]"; - CompareMultipleRuns( + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) + ); + } + + [Test] + public void Compare_DoubleHashSet() + { + const string stringValues = "[1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,0.1]"; + CompareMultipleRuns( "new HashSet(.ConvertAll(x => double.Parse(x)))", () => new HashSet(SplitList(stringValues).Map(double.Parse)), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) - ); - } - - [Test] - public void Compare_StringStringMap() - { - const string mapValues = "{A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,I:9,J:0}"; - var map = new Dictionary(); - CompareMultipleRuns( + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(stringValues) + ); + } + + [Test] + public void Compare_StringStringMap() + { + const string mapValues = "{A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,I:9,J:0}"; + var map = new Dictionary(); + CompareMultipleRuns( "mapValues.Split(',').ConvertAll", () => SplitList(mapValues).Map(x => x.Split(':')).ForEach(y => map[y[0].FromCsvField()] = y[1].FromCsvField()), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(mapValues) - ); - } - - [Test] - public void Compare_StringIntMap() - { - const string mapValues = "{A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,I:9,J:0}"; - var map = new Dictionary(); - CompareMultipleRuns( + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(mapValues) + ); + } + + [Test] + public void Compare_StringIntMap() + { + const string mapValues = "{A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,I:9,J:0}"; + var map = new Dictionary(); + CompareMultipleRuns( "mapValues.Split(',').ConvertAll", () => SplitList(mapValues).Map(x => x.Split(':')).ForEach(y => map[y[0].FromCsvField()] = int.Parse(y[1])), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(mapValues) - ); - } - - [Test] - public void Compare_StringInt_SortedDictionary() - { - const string mapValues = "{A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,I:9,J:0}"; - var map = new SortedDictionary(); - CompareMultipleRuns( + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(mapValues) + ); + } + + [Test] + public void Compare_StringInt_SortedDictionary() + { + const string mapValues = "{A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,I:9,J:0}"; + var map = new SortedDictionary(); + CompareMultipleRuns( "mapValues.Split(',').ConvertAll", () => SplitList(mapValues).Map(x => x.Split(':')).ForEach(y => map[y[0].FromCsvField()] = int.Parse(y[1])), - "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(mapValues) - ); - } - - [Test] - public void Compare_ByteArray() - { - var byteArrayValue = new byte[] { 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, }; - var byteArrayString = Convert.ToBase64String(byteArrayValue); - - CompareMultipleRuns( - "Encoding.Default.GetBytes", () => System.Text.Encoding.Default.GetBytes(byteArrayString), - "SCU.Parse", () => TypeSerializer.DeserializeFromString(byteArrayString) - ); - } - } + "SCU.Parse>", () => TypeSerializer.DeserializeFromString>(mapValues) + ); + } + + [Test] + public void Compare_ByteArray() + { + var byteArrayValue = new byte[] { 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, }; + var byteArrayString = Convert.ToBase64String(byteArrayValue); + + CompareMultipleRuns( + "Encoding.Default.GetBytes", () => System.Text.Encoding.GetEncoding(0).GetBytes(byteArrayString), + "SCU.Parse", () => TypeSerializer.DeserializeFromString(byteArrayString) + ); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Perf/ToStringPerf.cs b/tests/ServiceStack.Common.Tests/Perf/ToStringPerf.cs index 7be58717771..d068569a190 100644 --- a/tests/ServiceStack.Common.Tests/Perf/ToStringPerf.cs +++ b/tests/ServiceStack.Common.Tests/Perf/ToStringPerf.cs @@ -7,300 +7,312 @@ namespace ServiceStack.Common.Tests.Perf { - [Ignore("Bencharks for serializing basic .NET types")] - [TestFixture] - public class ToStringPerf - : PerfTestBase - { - public ToStringPerf() - { - this.MultipleIterations = new List { 10000 }; - } + [Ignore("Bencharks for serializing basic .NET types")] + [TestFixture] + public class ToStringPerf + : PerfTestBase + { + public ToStringPerf() + { + this.MultipleIterations = new List { 10000 }; + } - [Test] - public void Compare_string() - { - CompareMultipleRuns( - "'test'.ToCsvField()", () => "test".ToCsvField(), - "SCU.ToString('test')", () => TypeSerializer.SerializeToString("test") - ); - } + [Test] + public void Compare_string() + { + CompareMultipleRuns( + "'test'.ToCsvField()", () => "test".ToCsvField(), + "SCU.ToString('test')", () => TypeSerializer.SerializeToString("test") + ); + } - [Test] - public void Compare_escaped_string() - { - CompareMultipleRuns( - "'t,e:st'.ToCsvField()", () => "t,e:st".ToCsvField(), - "SCU.ToString('t,e:st')", () => TypeSerializer.SerializeToString("t,e:st") - ); - } + [Test] + public void Compare_escaped_string() + { + CompareMultipleRuns( + "'t,e:st'.ToCsvField()", () => "t,e:st".ToCsvField(), + "SCU.ToString('t,e:st')", () => TypeSerializer.SerializeToString("t,e:st") + ); + } - [Test] - public void Compare_ints() - { - CompareMultipleRuns( - "1.ToString()", () => 1.ToString(), - "SCU.ToString(1)", () => TypeSerializer.SerializeToString(1) - ); - } + [Test] + public void Compare_ints() + { + CompareMultipleRuns( + "1.ToString()", () => 1.ToString(), + "SCU.ToString(1)", () => TypeSerializer.SerializeToString(1) + ); + } - [Test] - public void Compare_longs() - { - CompareMultipleRuns( - "1L.ToString()", () => 1L.ToString(), - "SCU.ToString(1L)", () => TypeSerializer.SerializeToString(1L) - ); - } + [Test] + public void Compare_longs() + { + CompareMultipleRuns( + "1L.ToString()", () => 1L.ToString(), + "SCU.ToString(1L)", () => TypeSerializer.SerializeToString(1L) + ); + } - [Test] - public void Compare_Guids() - { - var guid = new Guid("AC800C9C-B8BE-4829-868A-B43CFF7B2AFD"); - CompareMultipleRuns( - "guid.ToString()", () => guid.ToString(), - "SCU.ToString(guid)", () => TypeSerializer.SerializeToString(guid) - ); - } + [Test] + public void Compare_Guids() + { + var guid = new Guid("AC800C9C-B8BE-4829-868A-B43CFF7B2AFD"); + CompareMultipleRuns( + "guid.ToString()", () => guid.ToString(), + "SCU.ToString(guid)", () => TypeSerializer.SerializeToString(guid) + ); + } - [Test] - public void Compare_DateTime() - { - var now = DateTime.Now; - CompareMultipleRuns( - "now.ToString()", () => now.ToString(), - "SCU.ToString(now)", () => TypeSerializer.SerializeToString(now) - ); - } + [Test] + public void Compare_DateTime() + { + var now = DateTime.Now; + CompareMultipleRuns( + "now.ToString()", () => now.ToString(), + "SCU.ToString(now)", () => TypeSerializer.SerializeToString(now) + ); + } - [Test] - public void Compare_IntList() - { - var intList = new List { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - CompareMultipleRuns( - "intList.ForEach(x => sb.Append(x.ToString()))", () => { - var sb = new StringBuilder(); - intList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); - sb.ToString(); - }, - "SCU.ToString(intList)", () => TypeSerializer.SerializeToString(intList) - ); - } + [Test] + public void Compare_IntList() + { + var intList = new List { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + CompareMultipleRuns( + "intList.ForEach(x => sb.Append(x.ToString()))", () => + { + var sb = new StringBuilder(); + intList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); + sb.ToString(); + }, + "SCU.ToString(intList)", () => TypeSerializer.SerializeToString(intList) + ); + } - [Test] - public void Compare_LongList() - { - var longList = new List { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - CompareMultipleRuns( - "longList.ForEach(x => sb.Append(x.ToString()))", () => { - var sb = new StringBuilder(); - longList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); - sb.ToString(); - }, - "SCU.ToString(longList)", () => TypeSerializer.SerializeToString(longList) - ); - } + [Test] + public void Compare_LongList() + { + var longList = new List { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + CompareMultipleRuns( + "longList.ForEach(x => sb.Append(x.ToString()))", () => + { + var sb = new StringBuilder(); + longList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); + sb.ToString(); + }, + "SCU.ToString(longList)", () => TypeSerializer.SerializeToString(longList) + ); + } - [Test] - public void Compare_StringArray() - { - var stringArray = new[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }; - CompareMultipleRuns( - "sb.Append(s.ToCsvField());", () => { - var sb = new StringBuilder(); - foreach (var s in stringArray) - { - if (sb.Length > 0) sb.Append(","); - sb.Append(s.ToCsvField()); - } - sb.ToString(); - }, - "SCU.ToString(stringArray)", () => TypeSerializer.SerializeToString(stringArray) - ); - } + [Test] + public void Compare_StringArray() + { + var stringArray = new[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }; + CompareMultipleRuns( + "sb.Append(s.ToCsvField());", () => + { + var sb = new StringBuilder(); + foreach (var s in stringArray) + { + if (sb.Length > 0) sb.Append(","); + sb.Append(s.ToCsvField()); + } + sb.ToString(); + }, + "SCU.ToString(stringArray)", () => TypeSerializer.SerializeToString(stringArray) + ); + } - [Test] - public void Compare_StringList() - { - var stringList = new List { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }; - CompareMultipleRuns( - "sb.Append(s.ToCsvField());", () => { - var sb = new StringBuilder(); - stringList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); - sb.ToString(); - }, - "SCU.ToString(stringList)", () => TypeSerializer.SerializeToString(stringList) - ); - } + [Test] + public void Compare_StringList() + { + var stringList = new List { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }; + CompareMultipleRuns( + "sb.Append(s.ToCsvField());", () => + { + var sb = new StringBuilder(); + stringList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); + sb.ToString(); + }, + "SCU.ToString(stringList)", () => TypeSerializer.SerializeToString(stringList) + ); + } - [Test] - public void Compare_DoubleList() - { - var doubleList = new List { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 0.1 }; - CompareMultipleRuns( - "doubleList.ForEach(x => sb.Append(x.ToString()))", () => { - var sb = new StringBuilder(); - doubleList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); - sb.ToString(); - }, - "SCU.ToString(doubleList)", () => TypeSerializer.SerializeToString(doubleList) - ); - } + [Test] + public void Compare_DoubleList() + { + var doubleList = new List { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 0.1 }; + CompareMultipleRuns( + "doubleList.ForEach(x => sb.Append(x.ToString()))", () => + { + var sb = new StringBuilder(); + doubleList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); + sb.ToString(); + }, + "SCU.ToString(doubleList)", () => TypeSerializer.SerializeToString(doubleList) + ); + } - [Test] - public void Compare_GuidList() - { - var guidList = new List - { - new Guid("8F403A5E-CDFC-4C6F-B0EB-C055C1C8BA60"), - new Guid("5673BAC7-BAC5-4B3F-9B69-4180E6227508"), - new Guid("B0CA730F-14C9-4D00-AC7F-07E7DE8D566E"), - new Guid("4E26AF94-6B13-4F89-B192-36C6ABE73DAE"), - new Guid("08491B16-2270-4DF9-8AEE-A8861A791C50"), - }; - CompareMultipleRuns( - "guidList.ForEach(x => sb.Append(x.ToString()))", () => { - var sb = new StringBuilder(); - guidList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); - sb.ToString(); - }, - "SCU.ToString(guidList)", () => TypeSerializer.SerializeToString(guidList) - ); - } + [Test] + public void Compare_GuidList() + { + var guidList = new List + { + new Guid("8F403A5E-CDFC-4C6F-B0EB-C055C1C8BA60"), + new Guid("5673BAC7-BAC5-4B3F-9B69-4180E6227508"), + new Guid("B0CA730F-14C9-4D00-AC7F-07E7DE8D566E"), + new Guid("4E26AF94-6B13-4F89-B192-36C6ABE73DAE"), + new Guid("08491B16-2270-4DF9-8AEE-A8861A791C50"), + }; + CompareMultipleRuns( + "guidList.ForEach(x => sb.Append(x.ToString()))", () => + { + var sb = new StringBuilder(); + guidList.ForEach(x => { if (sb.Length > 0) sb.Append(","); sb.Append(x.ToString()); }); + sb.ToString(); + }, + "SCU.ToString(guidList)", () => TypeSerializer.SerializeToString(guidList) + ); + } - [Test] - public void Compare_StringHashSet() - { - var stringHashSet = new HashSet { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }; - CompareMultipleRuns( - "sb.Append(s.ToCsvField());", () => { - var sb = new StringBuilder(); - foreach (var s in stringHashSet) - { - if (sb.Length > 0) sb.Append(","); - sb.Append(s.ToCsvField()); - } - sb.ToString(); - }, - "SCU.ToString(stringHashSet)", () => TypeSerializer.SerializeToString(stringHashSet) - ); - } + [Test] + public void Compare_StringHashSet() + { + var stringHashSet = new HashSet { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }; + CompareMultipleRuns( + "sb.Append(s.ToCsvField());", () => + { + var sb = new StringBuilder(); + foreach (var s in stringHashSet) + { + if (sb.Length > 0) sb.Append(","); + sb.Append(s.ToCsvField()); + } + sb.ToString(); + }, + "SCU.ToString(stringHashSet)", () => TypeSerializer.SerializeToString(stringHashSet) + ); + } - [Test] - public void Compare_IntHashSet() - { - var intHashSet = new HashSet { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - CompareMultipleRuns( - "intList.ForEach(x => sb.Append(x.ToString()))", () => { - var sb = new StringBuilder(); - foreach (var s in intHashSet) - { - if (sb.Length > 0) sb.Append(","); - sb.Append(s.ToString()); - } - sb.ToString(); - }, - "SCU.ToString(intHashSet)", () => TypeSerializer.SerializeToString(intHashSet) - ); - } + [Test] + public void Compare_IntHashSet() + { + var intHashSet = new HashSet { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + CompareMultipleRuns( + "intList.ForEach(x => sb.Append(x.ToString()))", () => + { + var sb = new StringBuilder(); + foreach (var s in intHashSet) + { + if (sb.Length > 0) sb.Append(","); + sb.Append(s.ToString()); + } + sb.ToString(); + }, + "SCU.ToString(intHashSet)", () => TypeSerializer.SerializeToString(intHashSet) + ); + } - [Test] - public void Compare_DoubleHashSet() - { - var doubleHashSet = new HashSet { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 0.1 }; - CompareMultipleRuns( - "doubleList.ForEach(x => sb.Append(x.ToString()))", () => { - var sb = new StringBuilder(); - foreach (var s in doubleHashSet) - { - if (sb.Length > 0) sb.Append(","); - sb.Append(s.ToString()); - } - sb.ToString(); - }, - "SCU.ToString(doubleHashSet)", () => TypeSerializer.SerializeToString(doubleHashSet) - ); - } + [Test] + public void Compare_DoubleHashSet() + { + var doubleHashSet = new HashSet { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 0.1 }; + CompareMultipleRuns( + "doubleList.ForEach(x => sb.Append(x.ToString()))", () => + { + var sb = new StringBuilder(); + foreach (var s in doubleHashSet) + { + if (sb.Length > 0) sb.Append(","); + sb.Append(s.ToString()); + } + sb.ToString(); + }, + "SCU.ToString(doubleHashSet)", () => TypeSerializer.SerializeToString(doubleHashSet) + ); + } - [Test] - public void Compare_StringStringMap() - { - var map = new Dictionary { - {"A", "1"},{"B", "2"},{"C", "3"},{"D", "4"},{"E", "5"}, - {"F", "6"},{"G", "7"},{"H", "8"},{"I", "9"},{"j", "10"}, - }; - CompareMultipleRuns( - "sb.Append(kv.Key.ToCsvField()).Append(ParseStringMethods.KeyValueSeperator).", () => { - var sb = new StringBuilder(); - foreach (var kv in map) - { - if (sb.Length > 0) sb.Append(","); - sb.Append(kv.Key.ToCsvField()) - .Append(JsWriter.MapKeySeperator) - .Append(kv.Value.ToCsvField()); - } - sb.ToString(); - }, - "SCU.ToString(map)", () => TypeSerializer.SerializeToString(map) - ); - } + [Test] + public void Compare_StringStringMap() + { + var map = new Dictionary { + {"A", "1"},{"B", "2"},{"C", "3"},{"D", "4"},{"E", "5"}, + {"F", "6"},{"G", "7"},{"H", "8"},{"I", "9"},{"j", "10"}, + }; + CompareMultipleRuns( + "sb.Append(kv.Key.ToCsvField()).Append(ParseStringMethods.KeyValueSeperator).", () => + { + var sb = new StringBuilder(); + foreach (var kv in map) + { + if (sb.Length > 0) sb.Append(","); + sb.Append(kv.Key.ToCsvField()) + .Append(JsWriter.MapKeySeperator) + .Append(kv.Value.ToCsvField()); + } + sb.ToString(); + }, + "SCU.ToString(map)", () => TypeSerializer.SerializeToString(map) + ); + } - [Test] - public void Compare_StringIntMap() - { - var map = new Dictionary { - {"A", 1},{"B", 2},{"C", 3},{"D", 4},{"E", 5}, - {"F", 6},{"G", 7},{"H", 8},{"I", 9},{"j", 10}, - }; - CompareMultipleRuns( - ".Append(ParseStringMethods.KeyValueSeperator).Append(kv.Value.ToString())", () => { - var sb = new StringBuilder(); - foreach (var kv in map) - { - if (sb.Length > 0) sb.Append(","); - sb.Append(kv.Key.ToCsvField()) - .Append(JsWriter.MapKeySeperator) - .Append(kv.Value.ToString()); - } - sb.ToString(); - }, - "SCU.ToString(map)", () => TypeSerializer.SerializeToString(map) - ); - } + [Test] + public void Compare_StringIntMap() + { + var map = new Dictionary { + {"A", 1},{"B", 2},{"C", 3},{"D", 4},{"E", 5}, + {"F", 6},{"G", 7},{"H", 8},{"I", 9},{"j", 10}, + }; + CompareMultipleRuns( + ".Append(ParseStringMethods.KeyValueSeperator).Append(kv.Value.ToString())", () => + { + var sb = new StringBuilder(); + foreach (var kv in map) + { + if (sb.Length > 0) sb.Append(","); + sb.Append(kv.Key.ToCsvField()) + .Append(JsWriter.MapKeySeperator) + .Append(kv.Value.ToString()); + } + sb.ToString(); + }, + "SCU.ToString(map)", () => TypeSerializer.SerializeToString(map) + ); + } - [Test] - public void Compare_StringInt_SortedDictionary() - { - var map = new SortedDictionary{ - {"A", 1},{"B", 2},{"C", 3},{"D", 4},{"E", 5}, - {"F", 6},{"G", 7},{"H", 8},{"I", 9},{"j", 10}, - }; - CompareMultipleRuns( - ".Append(ParseStringMethods.KeyValueSeperator).Append(kv.Value.ToString())", () => { - var sb = new StringBuilder(); - foreach (var kv in map) - { - if (sb.Length > 0) sb.Append(","); - sb.Append(kv.Key.ToCsvField()) - .Append(JsWriter.MapKeySeperator) - .Append(kv.Value.ToString()); - } - sb.ToString(); - }, - "SCU.ToString(map)", () => TypeSerializer.SerializeToString(map) - ); - } + [Test] + public void Compare_StringInt_SortedDictionary() + { + var map = new SortedDictionary{ + {"A", 1},{"B", 2},{"C", 3},{"D", 4},{"E", 5}, + {"F", 6},{"G", 7},{"H", 8},{"I", 9},{"j", 10}, + }; + CompareMultipleRuns( + ".Append(ParseStringMethods.KeyValueSeperator).Append(kv.Value.ToString())", () => + { + var sb = new StringBuilder(); + foreach (var kv in map) + { + if (sb.Length > 0) sb.Append(","); + sb.Append(kv.Key.ToCsvField()) + .Append(JsWriter.MapKeySeperator) + .Append(kv.Value.ToString()); + } + sb.ToString(); + }, + "SCU.ToString(map)", () => TypeSerializer.SerializeToString(map) + ); + } - [Test] - public void Compare_ByteArray() - { - var byteArrayValue = new byte[] { 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, }; + [Test] + public void Compare_ByteArray() + { + var byteArrayValue = new byte[] { 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, 0, 65, 97, 255, }; - CompareMultipleRuns( - "Encoding.Default.GetString(byteArrayValue)", () => Encoding.Default.GetString(byteArrayValue), - "SCU.ToString(byteArrayValue)", () => TypeSerializer.SerializeToString(byteArrayValue) - ); - } + CompareMultipleRuns( + "Encoding.Default.GetString(byteArrayValue)", () => Encoding.GetEncoding(0).GetString(byteArrayValue), + "SCU.ToString(byteArrayValue)", () => TypeSerializer.SerializeToString(byteArrayValue) + ); + } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/PerfTestBase.cs b/tests/ServiceStack.Common.Tests/PerfTestBase.cs index d519ac0dbe8..b8722b53380 100644 --- a/tests/ServiceStack.Common.Tests/PerfTestBase.cs +++ b/tests/ServiceStack.Common.Tests/PerfTestBase.cs @@ -5,106 +5,106 @@ namespace ServiceStack.Common.Tests { - public class PerfTestBase - { - protected int DefaultIterations { get; set; } - protected List MultipleIterations { get; set; } - - public PerfTestBase() - { - this.DefaultIterations = 10000; - this.MultipleIterations = new List { 1000, 10000, 100000, 1000000 }; - } - - protected StringBuilder SbLog = new StringBuilder(); - - public void Log(string message, params object[] args) - { - Console.WriteLine(message, args); - - SbLog.AppendFormat(message, args); - SbLog.AppendLine(); - } - - protected void CompareMultipleRuns(string run1Name, Action run1Action, string run2Name, Action run2Action) - { - WarmUp(run1Action, run2Action); - foreach (var iteration in this.MultipleIterations) - { - Log("\n{0} times:", iteration); - CompareRuns(iteration, run1Name, run1Action, run2Name, run2Action); - } - } - - protected void CompareRuns(string run1Name, Action run1Action, string run2Name, Action run2Action) - { - CompareRuns(DefaultIterations, run1Name, run1Action, run2Name, run2Action); - } - - protected void CompareRuns(int iterations, string run1Name, Action run1Action, string run2Name, Action run2Action) - { - var run1 = RunAction(run1Action, iterations, run1Name); - var run2 = RunAction(run2Action, iterations, run2Name); - - var runDiff = run1.Ticks - run2.Ticks; - var run1IsSlower = runDiff > 0; - var slowerRun = run1IsSlower ? run1Name : run2Name; - var fasterRun = run1IsSlower ? run2Name : run1Name; - var runDiffTime = run1IsSlower ? runDiff : runDiff * -1; - var runDiffAvg = run1IsSlower ? run1.Ticks / (double)run2.Ticks : run2.Ticks / (double)run1.Ticks; - - Log("{0} was {1}ms or {2} times slower than {3}", - slowerRun, runDiffTime, Math.Round(runDiffAvg, 2), fasterRun); - } - - protected void WarmUp(params Action[] actions) - { - foreach (var action in actions) - { - action(); - GC.Collect(); - } - } - - protected void RunMultipleTimes(Action action, string actionName) - { - WarmUp(action); - foreach (var iteration in this.MultipleIterations) - { - Log("\n{0} times:", iteration); - RunAction(action, iteration, actionName ?? "Action"); - } - } - - protected TimeSpan RunAction(Action action, int iterations) - { - return RunAction(action, iterations, null); - } - - protected TimeSpan RunAction(Action action, int iterations, string actionName) - { - actionName = actionName ?? action.GetType().Name; - var ticksTaken = Measure(action, iterations); - var timeSpan = TimeSpan.FromSeconds(ticksTaken * 1d / Stopwatch.Frequency); - - Log("{0} took {1}ms ({2} ticks), avg: {3} ticks", actionName, timeSpan.TotalMilliseconds, timeSpan.Ticks, (timeSpan.Ticks / iterations)); - - return timeSpan; - } - - protected long Measure(Action action, decimal iterations) - { - GC.Collect(); - var begin = Stopwatch.GetTimestamp(); - - for (var i = 0; i < iterations; i++) - { - action(); - } - - var end = Stopwatch.GetTimestamp(); - - return (end - begin); - } - } + public class PerfTestBase + { + protected int DefaultIterations { get; set; } + protected List MultipleIterations { get; set; } + + public PerfTestBase() + { + this.DefaultIterations = 10000; + this.MultipleIterations = new List { 1000, 10000, 100000, 1000000 }; + } + + protected StringBuilder SbLog = new StringBuilder(); + + public void Log(string message, params object[] args) + { + Console.WriteLine(message, args); + + SbLog.AppendFormat(message, args); + SbLog.AppendLine(); + } + + protected void CompareMultipleRuns(string run1Name, Action run1Action, string run2Name, Action run2Action) + { + WarmUp(run1Action, run2Action); + foreach (var iteration in this.MultipleIterations) + { + Log("\n{0} times:", iteration); + CompareRuns(iteration, run1Name, run1Action, run2Name, run2Action); + } + } + + protected void CompareRuns(string run1Name, Action run1Action, string run2Name, Action run2Action) + { + CompareRuns(DefaultIterations, run1Name, run1Action, run2Name, run2Action); + } + + protected void CompareRuns(int iterations, string run1Name, Action run1Action, string run2Name, Action run2Action) + { + var run1 = RunAction(run1Action, iterations, run1Name); + var run2 = RunAction(run2Action, iterations, run2Name); + + var runDiff = run1.Ticks - run2.Ticks; + var run1IsSlower = runDiff > 0; + var slowerRun = run1IsSlower ? run1Name : run2Name; + var fasterRun = run1IsSlower ? run2Name : run1Name; + var runDiffTime = run1IsSlower ? runDiff : runDiff * -1; + var runDiffAvg = run1IsSlower ? run1.Ticks / (double)run2.Ticks : run2.Ticks / (double)run1.Ticks; + + Log("{0} was {1}ms or {2} times slower than {3}", + slowerRun, runDiffTime, Math.Round(runDiffAvg, 2), fasterRun); + } + + protected void WarmUp(params Action[] actions) + { + foreach (var action in actions) + { + action(); + GC.Collect(); + } + } + + protected void RunMultipleTimes(Action action, string actionName) + { + WarmUp(action); + foreach (var iteration in this.MultipleIterations) + { + Log("\n{0} times:", iteration); + RunAction(action, iteration, actionName ?? "Action"); + } + } + + protected TimeSpan RunAction(Action action, int iterations) + { + return RunAction(action, iterations, null); + } + + protected TimeSpan RunAction(Action action, int iterations, string actionName) + { + actionName = actionName ?? action.GetType().Name; + var ticksTaken = Measure(action, iterations); + var timeSpan = TimeSpan.FromSeconds(ticksTaken * 1d / Stopwatch.Frequency); + + Log("{0} took {1}ms ({2} ticks), avg: {3} ticks", actionName, timeSpan.TotalMilliseconds, timeSpan.Ticks, (timeSpan.Ticks / iterations)); + + return timeSpan; + } + + protected long Measure(Action action, decimal iterations) + { + GC.Collect(); + var begin = Stopwatch.GetTimestamp(); + + for (var i = 0; i < iterations; i++) + { + action(); + } + + var end = Stopwatch.GetTimestamp(); + + return (end - begin); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/PerfUtilsTests.cs b/tests/ServiceStack.Common.Tests/PerfUtilsTests.cs index e1c9d3a3356..7d666369837 100644 --- a/tests/ServiceStack.Common.Tests/PerfUtilsTests.cs +++ b/tests/ServiceStack.Common.Tests/PerfUtilsTests.cs @@ -5,7 +5,7 @@ namespace ServiceStack.Common.Tests { - [TestFixture,Explicit] + [TestFixture, Ignore("Benchmark")] public class PerfUtilsTests { Random rand = new Random(); diff --git a/tests/ServiceStack.Common.Tests/Properties/AssemblyInfo.cs b/tests/ServiceStack.Common.Tests/Properties/AssemblyInfo.cs index d4b2461df39..fdcbbb507ff 100644 --- a/tests/ServiceStack.Common.Tests/Properties/AssemblyInfo.cs +++ b/tests/ServiceStack.Common.Tests/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] +[assembly: AssemblyFileVersion("5.0.0.0")] diff --git a/tests/ServiceStack.Common.Tests/Properties/Settings.Designer.cs b/tests/ServiceStack.Common.Tests/Properties/Settings.Designer.cs index 20bafdad647..48751c32540 100644 --- a/tests/ServiceStack.Common.Tests/Properties/Settings.Designer.cs +++ b/tests/ServiceStack.Common.Tests/Properties/Settings.Designer.cs @@ -1,20 +1,21 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18408 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ +#if !NETCORE_SUPPORT namespace ServiceStack.Common.Tests.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { @@ -35,3 +36,4 @@ public string authConnectionString { } } } +#endif diff --git a/tests/ServiceStack.Common.Tests/QueryStringSerializerTests.cs b/tests/ServiceStack.Common.Tests/QueryStringSerializerTests.cs index 6c4091d15db..5930beb7959 100644 --- a/tests/ServiceStack.Common.Tests/QueryStringSerializerTests.cs +++ b/tests/ServiceStack.Common.Tests/QueryStringSerializerTests.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#if !NETCORE_SUPPORT +using System.Collections.Generic; using System.Collections.Specialized; using System.IO; using System.Linq; @@ -26,7 +27,7 @@ public void Can_deserialize_TestRequest_QueryStringSerializer_output() NameValueCollection queryString = HttpUtility.ParseQueryString(requestString); var httpReq = new MockHttpRequest("service", "GET", "application/json", "service", queryString, new MemoryStream(), new NameValueCollection()); - var request2 = (TestRequest)restHandler.CreateRequest(httpReq, "service"); + var request2 = (TestRequest)restHandler.CreateRequestAsync(httpReq, "service").Result; Assert.That(request2.ListOfA.Count, Is.EqualTo(1)); Assert.That(request2.ListOfA.First().ListOfB.Count, Is.EqualTo(2)); @@ -64,4 +65,5 @@ public class B public string Property { get; set; } } } -} \ No newline at end of file +} +#endif diff --git a/tests/ServiceStack.Common.Tests/RedisTypeTests.cs b/tests/ServiceStack.Common.Tests/RedisTypeTests.cs new file mode 100644 index 00000000000..febe5c0b54f --- /dev/null +++ b/tests/ServiceStack.Common.Tests/RedisTypeTests.cs @@ -0,0 +1,10 @@ +using NUnit.Framework; +using ServiceStack.Redis; + +namespace ServiceStack.Common.Tests +{ + [TestFixture] + public class RedisTypeTests + { + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Reflection/InvokerMethodTests.cs b/tests/ServiceStack.Common.Tests/Reflection/InvokerMethodTests.cs new file mode 100644 index 00000000000..79f178c9d5a --- /dev/null +++ b/tests/ServiceStack.Common.Tests/Reflection/InvokerMethodTests.cs @@ -0,0 +1,41 @@ +using NUnit.Framework; + +namespace ServiceStack.Common.Tests.Reflection +{ + class TransformDouble + { + public double Target { get; } + public TransformDouble(double target) => Target = target; + + public double Add(double value) => Target + value; + } + + public class InvokerMethodTests + { + [Test] + public void Can_use_MethodInvoker_to_call_Add_with_runtime_type() + { + var method = typeof(TransformDouble).GetMethod("Add"); + var invoker = method.GetInvoker(); + + var instance = new TransformDouble(1.0); + Assert.That(invoker(instance, 2.0), Is.EqualTo(3.0)); + + Assert.That(invoker(instance, 2), Is.EqualTo(3.0)); + Assert.That(invoker(instance, "2"), Is.EqualTo(3.0)); + } + + [Test] + public void Can_use_ObjectActivator_to_call_Add_with_runtime_type() + { + var ctor = typeof(TransformDouble).GetConstructors()[0]; + var activator = ctor.GetActivator(); + + Assert.That(((TransformDouble)activator(1.0)).Target, Is.EqualTo(1.0)); + + Assert.That(((TransformDouble)activator(1)).Target, Is.EqualTo(1.0)); + Assert.That(((TransformDouble)activator("1")).Target, Is.EqualTo(1.0)); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Reflection/PropertyAccessorTests.cs b/tests/ServiceStack.Common.Tests/Reflection/PropertyAccessorTests.cs index b4f8ff261b8..2b3ab090481 100644 --- a/tests/ServiceStack.Common.Tests/Reflection/PropertyAccessorTests.cs +++ b/tests/ServiceStack.Common.Tests/Reflection/PropertyAccessorTests.cs @@ -1,148 +1,149 @@ using NUnit.Framework; using ServiceStack.Common.Tests.Models; -using ServiceStack.Reflection; namespace ServiceStack.Common.Tests.Reflection { - [TestFixture] - public class PropertyAccessorTests - { - [Test] - public void Can_access_ModelWithIdAndName() - { - var idAccessor = new PropertyAccessor("Id"); - var nameAccessor = new PropertyAccessor("Name"); - - var obj = new ModelWithIdAndName { Id = 1, Name = "A" }; - - Assert.That(idAccessor.GetPropertyFn()(obj), Is.EqualTo(1)); - Assert.That(nameAccessor.GetPropertyFn()(obj), Is.EqualTo("A")); - - idAccessor.SetPropertyFn()(obj, 2); - nameAccessor.SetPropertyFn()(obj, "B"); - - Assert.That(obj.Id, Is.EqualTo(2)); - Assert.That(obj.Name, Is.EqualTo("B")); - } - - [Test] - public void Can_access_ModelWithFieldsOfDifferentTypes() - { - var idAccessor = new PropertyAccessor("Id"); - var nameAccessor = new PropertyAccessor("Name"); - var longIdAccessor = new PropertyAccessor("LongId"); - var guidAccessor = new PropertyAccessor("Guid"); - var boolAccessor = new PropertyAccessor("Bool"); - var dateTimeAccessor = new PropertyAccessor("DateTime"); - - var original = ModelWithFieldsOfDifferentTypesFactory.Instance.CreateInstance(1); - - Assert.That(idAccessor.GetPropertyFn()(original), Is.EqualTo(original.Id)); - Assert.That(nameAccessor.GetPropertyFn()(original), Is.EqualTo(original.Name)); - Assert.That(longIdAccessor.GetPropertyFn()(original), Is.EqualTo(original.LongId)); - Assert.That(guidAccessor.GetPropertyFn()(original), Is.EqualTo(original.Guid)); - Assert.That(boolAccessor.GetPropertyFn()(original), Is.EqualTo(original.Bool)); - Assert.That(dateTimeAccessor.GetPropertyFn()(original), Is.EqualTo(original.DateTime)); - - var to = ModelWithFieldsOfDifferentTypesFactory.Instance.CreateInstance(2); - - idAccessor.SetPropertyFn()(original, to.Id); - nameAccessor.SetPropertyFn()(original, to.Name); - longIdAccessor.SetPropertyFn()(original, to.LongId); - guidAccessor.SetPropertyFn()(original, to.Guid); - boolAccessor.SetPropertyFn()(original, to.Bool); - dateTimeAccessor.SetPropertyFn()(original, to.DateTime); - - ModelWithFieldsOfDifferentTypesFactory.Instance.AssertIsEqual(original, to); - } - - [Test] - public void Can_access_ModelWithComplexTypes() - { - var idAccessor = new PropertyAccessor("Id"); - var stringListAccessor = new PropertyAccessor("StringList"); - var intListAccessor = new PropertyAccessor("IntList"); - var stringMapAccessor = new PropertyAccessor("StringMap"); - var intMapAccessor = new PropertyAccessor("IntMap"); - var childAccessor = new PropertyAccessor("Child"); - - var original = ModelWithComplexTypesFactory.Instance.CreateInstance(1); - - Assert.That(idAccessor.GetPropertyFn()(original), Is.EqualTo(original.Id)); - Assert.That(stringListAccessor.GetPropertyFn()(original), Is.EqualTo(original.StringList)); - Assert.That(intListAccessor.GetPropertyFn()(original), Is.EqualTo(original.IntList)); - Assert.That(stringMapAccessor.GetPropertyFn()(original), Is.EqualTo(original.StringMap)); - Assert.That(intMapAccessor.GetPropertyFn()(original), Is.EqualTo(original.IntMap)); - Assert.That(childAccessor.GetPropertyFn()(original), Is.EqualTo(original.Child)); - - var to = ModelWithComplexTypesFactory.Instance.CreateInstance(2); - - idAccessor.SetPropertyFn()(original, to.Id); - stringListAccessor.SetPropertyFn()(original, to.StringList); - intListAccessor.SetPropertyFn()(original, to.IntList); - stringMapAccessor.SetPropertyFn()(original, to.StringMap); - intMapAccessor.SetPropertyFn()(original, to.IntMap); - childAccessor.SetPropertyFn()(original, to.Child); - - ModelWithComplexTypesFactory.Instance.AssertIsEqual(original, to); - } - - [Test] - public void Can_access_ModelWithFieldsOfDifferentAndNullableTypes() - { - var idAccessor = new PropertyAccessor("Id"); - var idNAccessor = new PropertyAccessor("NId"); - var longIdAccessor = new PropertyAccessor("NLongId"); - var guidAccessor = new PropertyAccessor("NGuid"); - var boolAccessor = new PropertyAccessor("NBool"); - var dateTimeAccessor = new PropertyAccessor("NDateTime"); - var floatAccessor = new PropertyAccessor("NFloat"); - var doubleAccessor = new PropertyAccessor("NDouble"); - var decimalAccessor = new PropertyAccessor("NDecimal"); - var timespanAccessor = new PropertyAccessor("NTimeSpan"); - - var original = ModelWithFieldsOfNullableTypesFactory.Instance.CreateInstance(1); - - Assert.That(idAccessor.GetPropertyFn()(original), Is.EqualTo(original.Id)); - Assert.That(idNAccessor.GetPropertyFn()(original), Is.EqualTo(original.NId)); - Assert.That(longIdAccessor.GetPropertyFn()(original), Is.EqualTo(original.NLongId)); - Assert.That(guidAccessor.GetPropertyFn()(original), Is.EqualTo(original.NGuid)); - Assert.That(boolAccessor.GetPropertyFn()(original), Is.EqualTo(original.NBool)); - Assert.That(dateTimeAccessor.GetPropertyFn()(original), Is.EqualTo(original.NDateTime)); - Assert.That(floatAccessor.GetPropertyFn()(original), Is.EqualTo(original.NFloat)); - Assert.That(doubleAccessor.GetPropertyFn()(original), Is.EqualTo(original.NDouble)); - Assert.That(decimalAccessor.GetPropertyFn()(original), Is.EqualTo(original.NDecimal)); - Assert.That(timespanAccessor.GetPropertyFn()(original), Is.EqualTo(original.NTimeSpan)); - - var to = ModelWithFieldsOfNullableTypesFactory.Instance.CreateInstance(2); - - idAccessor.SetPropertyFn()(original, to.Id); - idNAccessor.SetPropertyFn()(original, to.NId); - longIdAccessor.SetPropertyFn()(original, to.NLongId); - guidAccessor.SetPropertyFn()(original, to.NGuid); - boolAccessor.SetPropertyFn()(original, to.NBool); - dateTimeAccessor.SetPropertyFn()(original, to.NDateTime); - floatAccessor.SetPropertyFn()(original, to.NFloat); - doubleAccessor.SetPropertyFn()(original, to.NDouble); - decimalAccessor.SetPropertyFn()(original, to.NDecimal); - timespanAccessor.SetPropertyFn()(original, to.NTimeSpan); - - ModelWithFieldsOfNullableTypesFactory.Instance.AssertIsEqual(original, to); - - //Can handle nulls - original = new ModelWithFieldsOfNullableTypes(); - - Assert.That(idAccessor.GetPropertyFn()(original), Is.EqualTo(original.Id)); - Assert.That(idNAccessor.GetPropertyFn()(original), Is.EqualTo(original.NId)); - Assert.That(longIdAccessor.GetPropertyFn()(original), Is.EqualTo(original.NLongId)); - Assert.That(guidAccessor.GetPropertyFn()(original), Is.EqualTo(original.NGuid)); - Assert.That(boolAccessor.GetPropertyFn()(original), Is.EqualTo(original.NBool)); - Assert.That(dateTimeAccessor.GetPropertyFn()(original), Is.EqualTo(original.NDateTime)); - Assert.That(floatAccessor.GetPropertyFn()(original), Is.EqualTo(original.NFloat)); - Assert.That(doubleAccessor.GetPropertyFn()(original), Is.EqualTo(original.NDouble)); - Assert.That(decimalAccessor.GetPropertyFn()(original), Is.EqualTo(original.NDecimal)); - Assert.That(timespanAccessor.GetPropertyFn()(original), Is.EqualTo(original.NTimeSpan)); - } - - } + [TestFixture] + public class PropertyAccessorTests + { + [Test] + public void Can_access_ModelWithIdAndName() + { + var accessor = TypeProperties.Instance; + + var obj = new ModelWithIdAndName { Id = 1, Name = "A" }; + + Assert.That(accessor.GetPublicGetter("Id")(obj), Is.EqualTo(1)); + Assert.That(accessor.GetPublicGetter("Name")(obj), Is.EqualTo("A")); + + accessor.GetPublicSetter("Id")(obj, 2); + accessor.GetPublicSetter("Name")(obj, "B"); + + Assert.That(obj.Id, Is.EqualTo(2)); + Assert.That(obj.Name, Is.EqualTo("B")); + } + + [Test] + public void Can_access_ModelWithFieldsOfDifferentTypes() + { + var idAccessor = TypeProperties.GetAccessor("Id"); + var nameAccessor = TypeProperties.GetAccessor("Name"); + var longIdAccessor = TypeProperties.GetAccessor("LongId"); + var guidAccessor = TypeProperties.GetAccessor("Guid"); + var boolAccessor = TypeProperties.GetAccessor("Bool"); + var doubleAccessor = TypeProperties.GetAccessor("Double"); + var dateTimeAccessor = TypeProperties.GetAccessor("DateTime"); + + var original = ModelWithFieldsOfDifferentTypesFactory.Instance.CreateInstance(1); + + Assert.That(idAccessor.PublicGetter(original), Is.EqualTo(original.Id)); + Assert.That(nameAccessor.PublicGetter(original), Is.EqualTo(original.Name)); + Assert.That(longIdAccessor.PublicGetter(original), Is.EqualTo(original.LongId)); + Assert.That(guidAccessor.PublicGetter(original), Is.EqualTo(original.Guid)); + Assert.That(boolAccessor.PublicGetter(original), Is.EqualTo(original.Bool)); + Assert.That(doubleAccessor.PublicGetter(original), Is.EqualTo(original.Double).Within(0.1)); + Assert.That(dateTimeAccessor.PublicGetter(original), Is.EqualTo(original.DateTime)); + + var to = ModelWithFieldsOfDifferentTypesFactory.Instance.CreateInstance(2); + + idAccessor.PublicSetter(original, to.Id); + nameAccessor.PublicSetter(original, to.Name); + longIdAccessor.PublicSetter(original, to.LongId); + guidAccessor.PublicSetter(original, to.Guid); + boolAccessor.PublicSetter(original, to.Bool); + doubleAccessor.PublicSetter(original, to.Double); + dateTimeAccessor.PublicSetter(original, to.DateTime); + + ModelWithFieldsOfDifferentTypesFactory.Instance.AssertIsEqual(original, to); + } + + [Test] + public void Can_access_ModelWithComplexTypes() + { + var idAccessor = TypeProperties.GetAccessor("Id"); + var stringListAccessor = TypeProperties.GetAccessor("StringList"); + var intListAccessor = TypeProperties.GetAccessor("IntList"); + var stringMapAccessor = TypeProperties.GetAccessor("StringMap"); + var intMapAccessor = TypeProperties.GetAccessor("IntMap"); + var childAccessor = TypeProperties.GetAccessor("Child"); + + var original = ModelWithComplexTypesFactory.Instance.CreateInstance(1); + + Assert.That(idAccessor.PublicGetter(original), Is.EqualTo(original.Id)); + Assert.That(stringListAccessor.PublicGetter(original), Is.EqualTo(original.StringList)); + Assert.That(intListAccessor.PublicGetter(original), Is.EqualTo(original.IntList)); + Assert.That(stringMapAccessor.PublicGetter(original), Is.EqualTo(original.StringMap)); + Assert.That(intMapAccessor.PublicGetter(original), Is.EqualTo(original.IntMap)); + Assert.That(childAccessor.PublicGetter(original), Is.EqualTo(original.Child)); + + var to = ModelWithComplexTypesFactory.Instance.CreateInstance(2); + + idAccessor.PublicSetter(original, to.Id); + stringListAccessor.PublicSetter(original, to.StringList); + intListAccessor.PublicSetter(original, to.IntList); + stringMapAccessor.PublicSetter(original, to.StringMap); + intMapAccessor.PublicSetter(original, to.IntMap); + childAccessor.PublicSetter(original, to.Child); + + ModelWithComplexTypesFactory.Instance.AssertIsEqual(original, to); + } + + [Test] + public void Can_access_ModelWithFieldsOfDifferentAndNullableTypes() + { + var idAccessor = TypeProperties.GetAccessor("Id"); + var idNAccessor = TypeProperties.GetAccessor("NId"); + var longIdAccessor = TypeProperties.GetAccessor("NLongId"); + var guidAccessor = TypeProperties.GetAccessor("NGuid"); + var boolAccessor = TypeProperties.GetAccessor("NBool"); + var dateTimeAccessor = TypeProperties.GetAccessor("NDateTime"); + var floatAccessor = TypeProperties.GetAccessor("NFloat"); + var doubleAccessor = TypeProperties.GetAccessor("NDouble"); + var decimalAccessor = TypeProperties.GetAccessor("NDecimal"); + var timespanAccessor = TypeProperties.GetAccessor("NTimeSpan"); + + var original = ModelWithFieldsOfNullableTypesFactory.Instance.CreateInstance(1); + + Assert.That(idAccessor.PublicGetter(original), Is.EqualTo(original.Id)); + Assert.That(idNAccessor.PublicGetter(original), Is.EqualTo(original.NId)); + Assert.That(longIdAccessor.PublicGetter(original), Is.EqualTo(original.NLongId)); + Assert.That(guidAccessor.PublicGetter(original), Is.EqualTo(original.NGuid)); + Assert.That(boolAccessor.PublicGetter(original), Is.EqualTo(original.NBool)); + Assert.That(dateTimeAccessor.PublicGetter(original), Is.EqualTo(original.NDateTime)); + Assert.That(floatAccessor.PublicGetter(original), Is.EqualTo(original.NFloat)); + Assert.That(doubleAccessor.PublicGetter(original), Is.EqualTo(original.NDouble)); + Assert.That(decimalAccessor.PublicGetter(original), Is.EqualTo(original.NDecimal)); + Assert.That(timespanAccessor.PublicGetter(original), Is.EqualTo(original.NTimeSpan)); + + var to = ModelWithFieldsOfNullableTypesFactory.Instance.CreateInstance(2); + + idAccessor.PublicSetter(original, to.Id); + idNAccessor.PublicSetter(original, to.NId); + longIdAccessor.PublicSetter(original, to.NLongId); + guidAccessor.PublicSetter(original, to.NGuid); + boolAccessor.PublicSetter(original, to.NBool); + dateTimeAccessor.PublicSetter(original, to.NDateTime); + floatAccessor.PublicSetter(original, to.NFloat); + doubleAccessor.PublicSetter(original, to.NDouble); + decimalAccessor.PublicSetter(original, to.NDecimal); + timespanAccessor.PublicSetter(original, to.NTimeSpan); + + ModelWithFieldsOfNullableTypesFactory.Instance.AssertIsEqual(original, to); + + //Can handle nulls + original = new ModelWithFieldsOfNullableTypes(); + + Assert.That(idAccessor.PublicGetter(original), Is.EqualTo(original.Id)); + Assert.That(idNAccessor.PublicGetter(original), Is.EqualTo(original.NId)); + Assert.That(longIdAccessor.PublicGetter(original), Is.EqualTo(original.NLongId)); + Assert.That(guidAccessor.PublicGetter(original), Is.EqualTo(original.NGuid)); + Assert.That(boolAccessor.PublicGetter(original), Is.EqualTo(original.NBool)); + Assert.That(dateTimeAccessor.PublicGetter(original), Is.EqualTo(original.NDateTime)); + Assert.That(floatAccessor.PublicGetter(original), Is.EqualTo(original.NFloat)); + Assert.That(doubleAccessor.PublicGetter(original), Is.EqualTo(original.NDouble)); + Assert.That(decimalAccessor.PublicGetter(original), Is.EqualTo(original.NDecimal)); + Assert.That(timespanAccessor.PublicGetter(original), Is.EqualTo(original.NTimeSpan)); + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/ReflectionExtensionsTests.cs b/tests/ServiceStack.Common.Tests/ReflectionExtensionsTests.cs index 8258ec24fe3..1e6b73fb559 100644 --- a/tests/ServiceStack.Common.Tests/ReflectionExtensionsTests.cs +++ b/tests/ServiceStack.Common.Tests/ReflectionExtensionsTests.cs @@ -1,67 +1,70 @@ +using System; using System.Collections.Generic; using NUnit.Framework; using ServiceStack.Text; namespace ServiceStack.Common.Tests { - public enum UserFileType - { - DefaultProfile, - OriginalProfile, - Profile75X75, - Profile66X66, - Profile63X63, - } - - public class TestClassA - { - public IList ToStringList { get; set; } - public ArrayOfString FromStringList { get; set; } - public IList FromUserFileTypes { get; set; } - } - - public class TestClassB - { - public ArrayOfString ToStringList { get; set; } - public IList FromStringList { get; set; } - public ArrayOfString FromUserFileTypes { get; set; } - } + public enum UserFileType + { + DefaultProfile, + OriginalProfile, + Profile75X75, + Profile66X66, + Profile63X63, + } + + public class TestClassA + { + public IList ToStringList { get; set; } + public ArrayOfString FromStringList { get; set; } + public IList FromUserFileTypes { get; set; } + } + + public class TestClassB + { + public ArrayOfString ToStringList { get; set; } + public IList FromStringList { get; set; } + public ArrayOfString FromUserFileTypes { get; set; } + } public class TestClassC { public IList FromStringList { get; protected set; } } - [TestFixture] - public class ReflectionExtensionsTests - { - [Test] - public void Can_translate_generic_lists() - { - var values = new[] { "A", "B", "C" }; - var testA = new TestClassA { - FromStringList = new ArrayOfString(values), - ToStringList = new List(values), - FromUserFileTypes = new List - { - UserFileType.DefaultProfile, UserFileType.OriginalProfile - }, - }; - - var fromTestA = testA.ConvertTo(); - - AssertAreEqual(testA, fromTestA); - - var userFileTypeValues = testA.FromUserFileTypes.Map(x => x.ToString()); - var testB = new TestClassB { - FromStringList = new List(values), - ToStringList = new ArrayOfString(values), - FromUserFileTypes = new ArrayOfString(userFileTypeValues), - }; - - var fromTestB = testB.ConvertTo(); - AssertAreEqual(fromTestB, testB); - } + [TestFixture] + public class ReflectionExtensionsTests + { + [Test] + public void Can_translate_generic_lists() + { + var values = new[] { "A", "B", "C" }; + var testA = new TestClassA + { + ToStringList = new List(values), + FromStringList = new ArrayOfString(values), + FromUserFileTypes = new List + { + UserFileType.DefaultProfile, UserFileType.OriginalProfile + }, + }; + + var fromTestA = testA.ConvertTo(); + + AssertAreEqual(testA, fromTestA); + + var userFileTypeValues = testA.FromUserFileTypes.Map(x => x.ToString()); + var testB = new TestClassB + { + ToStringList = new ArrayOfString(values), + FromStringList = new List(values), + FromUserFileTypes = new ArrayOfString(userFileTypeValues), + }; + + var fromTestB = testB.ConvertTo(); + AssertAreEqual(fromTestB, testB); + } [Test] public void Can_translate_generic_list_does_ignore_protected_setters() @@ -77,24 +80,77 @@ public void Can_translate_generic_list_does_ignore_protected_setters() Assert.IsNull(fromTestA.FromStringList); } - private static void AssertAreEqual(TestClassA testA, TestClassB testB) - { - Assert.That(testA, Is.Not.Null); - Assert.That(testB, Is.Not.Null); - - Assert.That(testA.FromStringList, Is.Not.Null); - Assert.That(testB.FromStringList, Is.Not.Null); - Assert.That(testA.FromStringList, - Is.EquivalentTo(new List(testB.FromStringList))); - - Assert.That(testA.ToStringList, Is.Not.Null); - Assert.That(testB.ToStringList, Is.Not.Null); - Assert.That(testA.ToStringList, Is.EquivalentTo(testB.ToStringList)); - - Assert.That(testA.FromUserFileTypes, Is.Not.Null); - Assert.That(testB.FromUserFileTypes, Is.Not.Null); - Assert.That(testA.FromUserFileTypes, - Is.EquivalentTo(testB.FromUserFileTypes.ConvertAll(x => x.ToEnum()))); - } - } + private static void AssertAreEqual(TestClassA testA, TestClassB testB) + { + Assert.That(testA, Is.Not.Null); + Assert.That(testB, Is.Not.Null); + + Assert.That(testA.FromStringList, Is.Not.Null); + Assert.That(testB.FromStringList, Is.Not.Null); + Assert.That(testA.FromStringList, + Is.EquivalentTo(new List(testB.FromStringList))); + + Assert.That(testA.ToStringList, Is.Not.Null); + Assert.That(testB.ToStringList, Is.Not.Null); + Assert.That(testA.ToStringList, Is.EquivalentTo(testB.ToStringList)); + + Assert.That(testA.FromUserFileTypes, Is.Not.Null); + Assert.That(testB.FromUserFileTypes, Is.Not.Null); + Assert.That(testA.FromUserFileTypes, + Is.EquivalentTo(testB.FromUserFileTypes.ConvertAll(x => x.ToEnum()))); + } + + [Test] + public void Does_get_generic_args() + { + var returnType = typeof(IReturn<>); + var argsCount = returnType.GetGenericArguments().Length; + Assert.That(argsCount, Is.EqualTo(1)); + + argsCount = typeof(ServiceStack.Messaging.Message<>).GetGenericArguments().Length; + Assert.That(argsCount, Is.EqualTo(1)); + } + +#if !NETCORE + [Test] + public void Can_cache_a_geneneric_tuple_activator() + { + var genericArgs = new[] + { + typeof(TestClassA), + typeof(TestClassB), + typeof(TestClassC), + }; + Type genericType = typeof(Tuple<,,>).GetCachedGenericType(genericArgs); + + var ci = genericType.GetConstructor(genericArgs); + + var activator = ci.GetActivator(); + + var tuple = (Tuple) + activator(new TestClassA(), new TestClassB(), new TestClassC()); + + tuple = (Tuple) + activator(new TestClassA(), new TestClassB(), new TestClassC()); + + Assert.That(tuple.Item1, Is.Not.Null); + Assert.That(tuple.Item2, Is.Not.Null); + Assert.That(tuple.Item3, Is.Not.Null); + } + + [Test] + public void Can_cache_generic_list_activator() + { + Type genericType = typeof(List<>).GetCachedGenericType(typeof(TestClassA)); + + var ci = genericType.GetConstructor(Type.EmptyTypes); + + var activator = ci.GetActivator(); + + var list = (List)activator(); + + Assert.That(list, Is.Not.Null); + } +#endif + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/ReflectionUtilTests.cs b/tests/ServiceStack.Common.Tests/ReflectionUtilTests.cs index 3ce094bf507..b2cd82cd62b 100644 --- a/tests/ServiceStack.Common.Tests/ReflectionUtilTests.cs +++ b/tests/ServiceStack.Common.Tests/ReflectionUtilTests.cs @@ -4,38 +4,40 @@ using ServiceStack.Common.Tests.Models; using ServiceStack.DataAnnotations; using System.Collections.Generic; +using System.Threading.Tasks; +using ServiceStack.Reflection; using ServiceStack.Text; namespace ServiceStack.Common.Tests { - [TestFixture] + [TestFixture] public class ReflectionUtilTests - { - public enum TestClassType - { - One = 1, - Two = 2, - Three = 3 - } + { + public enum TestClassType + { + One = 1, + Two = 2, + Three = 3 + } - public class TestClass2 - { - public TestClassType Type { get; set; } - } + public class TestClass2 + { + public TestClassType Type { get; set; } + } - public class TestClass - { - [Required] - public string Member1 { get; set; } + public class TestClass + { + [Required] + public string Member1 { get; set; } - public string Member2 { get; set; } + public string Member2 { get; set; } - [Required] - public string Member3 { get; set; } + [Required] + public string Member3 { get; set; } - [StringLength(1)] - public string Member4 { get; set; } - } + [StringLength(1)] + public string Member4 { get; set; } + } public class DtoWithStringArray { @@ -82,9 +84,9 @@ public class Vortex public void Can_PopulateRecursiveDto() { var obj = (RecursiveDto)AutoMappingUtils.PopulateWith(new RecursiveDto()); - Assert.IsNotNullOrEmpty(obj.Name); + Assert.That(obj.Name, Is.Not.Null); Assert.IsNotNull(obj.Child); - Assert.IsNotNullOrEmpty(obj.Child.Name); + Assert.That(obj.Child.Name, Is.Not.Null); } [Test] @@ -94,20 +96,20 @@ public void Can_PopulateArrayOfRecursiveDto() Assert.IsNotNull(obj.Paths); Assert.Greater(obj.Paths.Length, 0); Assert.IsNotNull(obj.Paths[0]); - Assert.IsNotNullOrEmpty(obj.Paths[0].Name); + Assert.That(obj.Paths[0].Name, Is.Not.Null); Assert.IsNotNull(obj.Paths[0].Child); - Assert.IsNotNullOrEmpty(obj.Paths[0].Child.Name); + Assert.That(obj.Paths[0].Child.Name, Is.Not.Null); } [Test] public void Can_PopulateRecursiveArrayDto() { var obj = (RecursiveArrayDto)AutoMappingUtils.PopulateWith(new RecursiveArrayDto()); - Assert.IsNotNullOrEmpty(obj.Name); + Assert.That(obj.Name, Is.Not.Null); Assert.IsNotNull(obj.Nodes[0]); - Assert.IsNotNullOrEmpty(obj.Nodes[0].Name); + Assert.That(obj.Nodes[0].Name, Is.Not.Null); Assert.IsNotNull(obj.Nodes[0].Nodes); - Assert.IsNotNullOrEmpty(obj.Nodes[0].Nodes[0].Name); + Assert.That(obj.Nodes[0].Nodes[0].Name, Is.Not.Null); } [Test] @@ -139,101 +141,101 @@ public void Can_PopulateObjectWithNonZeroEnumArray() Assert.That(Enum.IsDefined(typeof(TestClassType), obj.Data[0]), "Values in created array should be valid for the enum"); } - [Test] - public void PopulateObject_UsesDefinedEnum() - { - var requestObj = (TestClass2)AutoMappingUtils.PopulateWith(Activator.CreateInstance(typeof(TestClass2))); - Assert.True(Enum.IsDefined(typeof(TestClassType), requestObj.Type)); - } - - [Test] - public void PopulateObject_UsesDefinedEnum_OnNestedTypes() - { - var requestObj = (Dictionary)AutoMappingUtils.CreateDefaultValue(typeof(Dictionary), new Dictionary()); - Assert.True(Enum.IsDefined(typeof(TestClassType), requestObj.First().Value.Type)); - } - - [Test] - public void GetTest() - { - var propertyAttributes = AutoMappingUtils.GetPropertyAttributes(typeof(TestClass)); - var propertyNames = propertyAttributes.ToList().ConvertAll(x => x.Key.Name); - Assert.That(propertyNames, Is.EquivalentTo(new[] { "Member1", "Member3" })); - } - - [Test] - public void Populate_Same_Objects() - { - var toObj = ModelWithFieldsOfDifferentTypes.Create(1); - var fromObj = ModelWithFieldsOfDifferentTypes.Create(2); - - var obj3 = AutoMappingUtils.PopulateWith(toObj, fromObj); - - Assert.IsTrue(obj3 == toObj); - Assert.That(obj3.Bool, Is.EqualTo(fromObj.Bool)); - Assert.That(obj3.DateTime, Is.EqualTo(fromObj.DateTime)); - Assert.That(obj3.Double, Is.EqualTo(fromObj.Double)); - Assert.That(obj3.Guid, Is.EqualTo(fromObj.Guid)); - Assert.That(obj3.Id, Is.EqualTo(fromObj.Id)); - Assert.That(obj3.LongId, Is.EqualTo(fromObj.LongId)); - Assert.That(obj3.Name, Is.EqualTo(fromObj.Name)); - } - - [Test] - public void Populate_Different_Objects_with_different_property_types() - { - var toObj = ModelWithFieldsOfDifferentTypes.Create(1); - var fromObj = ModelWithOnlyStringFields.Create("2"); - - var obj3 = AutoMappingUtils.PopulateWith(toObj, fromObj); - - Assert.IsTrue(obj3 == toObj); - Assert.That(obj3.Id, Is.EqualTo(2)); - Assert.That(obj3.Name, Is.EqualTo(fromObj.Name)); - } - - [Test] - public void Populate_From_Properties_With_Attribute() - { - var originalToObj = ModelWithOnlyStringFields.Create("id-1"); - var toObj = ModelWithOnlyStringFields.Create("id-1"); - var fromObj = ModelWithOnlyStringFields.Create("id-2"); - - AutoMappingUtils.PopulateFromPropertiesWithAttribute(toObj, fromObj, - typeof(IndexAttribute)); - - Assert.That(toObj.Id, Is.EqualTo(originalToObj.Id)); - Assert.That(toObj.AlbumId, Is.EqualTo(originalToObj.AlbumId)); - - //Properties with IndexAttribute - Assert.That(toObj.Name, Is.EqualTo(fromObj.Name)); - Assert.That(toObj.AlbumName, Is.EqualTo(fromObj.AlbumName)); - } - - [Test] - public void Populate_From_Properties_With_Non_Default_Values() - { - var toObj = ModelWithFieldsOfDifferentTypes.Create(1); - var fromObj = ModelWithFieldsOfDifferentTypes.Create(2); - - var originalToObj = ModelWithFieldsOfDifferentTypes.Create(1); - var originalGuid = toObj.Guid; - - fromObj.Name = null; - fromObj.Double = default(double); - fromObj.Guid = default(Guid); - - toObj.PopulateWithNonDefaultValues(fromObj); - - Assert.That(toObj.Name, Is.EqualTo(originalToObj.Name)); - Assert.That(toObj.Double, Is.EqualTo(originalToObj.Double)); - Assert.That(toObj.Guid, Is.EqualTo(originalGuid)); - - Assert.That(toObj.Id, Is.EqualTo(fromObj.Id)); - Assert.That(toObj.LongId, Is.EqualTo(fromObj.LongId)); - Assert.That(toObj.Bool, Is.EqualTo(fromObj.Bool)); - Assert.That(toObj.DateTime, Is.EqualTo(fromObj.DateTime)); - } + [Test] + public void PopulateObject_UsesDefinedEnum() + { + var requestObj = (TestClass2)AutoMappingUtils.PopulateWith(Activator.CreateInstance(typeof(TestClass2))); + Assert.True(Enum.IsDefined(typeof(TestClassType), requestObj.Type)); + } + + [Test] + public void PopulateObject_UsesDefinedEnum_OnNestedTypes() + { + var requestObj = (Dictionary)AutoMappingUtils.CreateDefaultValue(typeof(Dictionary), new Dictionary()); + Assert.True(Enum.IsDefined(typeof(TestClassType), requestObj.First().Value.Type)); + } + + [Test] + public void GetTest() + { + var propertyAttributes = AutoMappingUtils.GetPropertyAttributes(typeof(TestClass)); + var propertyNames = propertyAttributes.ToList().ConvertAll(x => x.Key.Name); + Assert.That(propertyNames, Is.EquivalentTo(new[] { "Member1", "Member3" })); + } + + [Test] + public void Populate_Same_Objects() + { + var toObj = ModelWithFieldsOfDifferentTypes.Create(1); + var fromObj = ModelWithFieldsOfDifferentTypes.Create(2); + + var obj3 = AutoMappingUtils.PopulateWith(toObj, fromObj); + + Assert.IsTrue(obj3 == toObj); + Assert.That(obj3.Bool, Is.EqualTo(fromObj.Bool)); + Assert.That(obj3.DateTime, Is.EqualTo(fromObj.DateTime)); + Assert.That(obj3.Double, Is.EqualTo(fromObj.Double)); + Assert.That(obj3.Guid, Is.EqualTo(fromObj.Guid)); + Assert.That(obj3.Id, Is.EqualTo(fromObj.Id)); + Assert.That(obj3.LongId, Is.EqualTo(fromObj.LongId)); + Assert.That(obj3.Name, Is.EqualTo(fromObj.Name)); + } + + [Test] + public void Populate_Different_Objects_with_different_property_types() + { + var toObj = ModelWithFieldsOfDifferentTypes.Create(1); + var fromObj = ModelWithOnlyStringFields.Create("2"); + + var obj3 = AutoMappingUtils.PopulateWith(toObj, fromObj); + + Assert.IsTrue(obj3 == toObj); + Assert.That(obj3.Id, Is.EqualTo(2)); + Assert.That(obj3.Name, Is.EqualTo(fromObj.Name)); + } + + [Test] + public void Populate_From_Properties_With_Attribute() + { + var originalToObj = ModelWithOnlyStringFields.Create("id-1"); + var toObj = ModelWithOnlyStringFields.Create("id-1"); + var fromObj = ModelWithOnlyStringFields.Create("id-2"); + + AutoMappingUtils.PopulateFromPropertiesWithAttribute(toObj, fromObj, + typeof(IndexAttribute)); + + Assert.That(toObj.Id, Is.EqualTo(originalToObj.Id)); + Assert.That(toObj.AlbumId, Is.EqualTo(originalToObj.AlbumId)); + + //Properties with IndexAttribute + Assert.That(toObj.Name, Is.EqualTo(fromObj.Name)); + Assert.That(toObj.AlbumName, Is.EqualTo(fromObj.AlbumName)); + } + + [Test] + public void Populate_From_Properties_With_Non_Default_Values() + { + var toObj = ModelWithFieldsOfDifferentTypes.Create(1); + var fromObj = ModelWithFieldsOfDifferentTypes.Create(2); + + var originalToObj = ModelWithFieldsOfDifferentTypes.Create(1); + var originalGuid = toObj.Guid; + + fromObj.Name = null; + fromObj.Double = default(double); + fromObj.Guid = default(Guid); + + toObj.PopulateWithNonDefaultValues(fromObj); + + Assert.That(toObj.Name, Is.EqualTo(originalToObj.Name)); + Assert.That(toObj.Double, Is.EqualTo(originalToObj.Double)); + Assert.That(toObj.Guid, Is.EqualTo(originalGuid)); + + Assert.That(toObj.Id, Is.EqualTo(fromObj.Id)); + Assert.That(toObj.LongId, Is.EqualTo(fromObj.LongId)); + Assert.That(toObj.Bool, Is.EqualTo(fromObj.Bool)); + Assert.That(toObj.DateTime, Is.EqualTo(fromObj.DateTime)); + } [Test] public void Populate_From_Nullable_Properties_With_Non_Default_Values() @@ -260,28 +262,44 @@ public void Populate_From_Nullable_Properties_With_Non_Default_Values() Assert.That(toObj.DateTime, Is.EqualTo(fromObj.DateTime)); } - [Test] - public void Translate_Between_Models_of_differrent_types_and_nullables() - { - var fromObj = ModelWithFieldsOfDifferentTypes.CreateConstant(1); + [Test] + public void Translate_Between_Models_of_different_types_and_nullables() + { + var fromObj = ModelWithFieldsOfDifferentTypes.CreateConstant(1); + + var toObj = fromObj.ConvertTo(); - var toObj = fromObj.ConvertTo(); + Console.WriteLine(toObj.Dump()); - Console.WriteLine(toObj.Dump()); + ModelWithFieldsOfDifferentTypesAsNullables.AssertIsEqual(fromObj, toObj); + } - ModelWithFieldsOfDifferentTypesAsNullables.AssertIsEqual(fromObj, toObj); - } + [Test] + public void Translate_Between_Models_of_nullables_and_different_types() + { + var fromObj = ModelWithFieldsOfDifferentTypesAsNullables.CreateConstant(1); - [Test] - public void Translate_Between_Models_of_nullables_and_differrent_types() - { - var fromObj = ModelWithFieldsOfDifferentTypesAsNullables.CreateConstant(1); + var toObj = fromObj.ConvertTo(); - var toObj = fromObj.ConvertTo(); + Console.WriteLine(toObj.Dump()); - Console.WriteLine(toObj.Dump()); + ModelWithFieldsOfDifferentTypesAsNullables.AssertIsEqual(toObj, fromObj); + } - ModelWithFieldsOfDifferentTypesAsNullables.AssertIsEqual(toObj, fromObj); - } - } + [Test] + public void Can_get_result_of_Task() + { + var tcs = new TaskCompletionSource(); + var task = tcs.Task; + tcs.SetResult("foo"); + + var fn = TypeProperties.Get(task.GetType()).GetPublicGetter("Result"); + var value = fn(task); + Assert.That(value, Is.EqualTo("foo")); + + fn = TypeProperties.Get(task.GetType()).GetPublicGetter("Result"); + value = fn(task); + Assert.That(value, Is.EqualTo("foo")); + } + } } diff --git a/tests/ServiceStack.Common.Tests/RsaUtilTests.cs b/tests/ServiceStack.Common.Tests/RsaUtilTests.cs new file mode 100644 index 00000000000..2b17bbd78a3 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/RsaUtilTests.cs @@ -0,0 +1,146 @@ +using System; +using System.Security.Cryptography; +using System.Xml; +using System.Xml.Linq; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.Common.Tests +{ + [TestFixture] + public class RsaUtilTests + { + const string PrivateKeyXml = @" +sO2GRzjw6Kx9d2+RzsaH+vWINhuB6+zIQ2KKH39ZvV19AMvxmhRyqyYoTYjm7v7P0vNlpqeYYPqDx2sba+rD9GwarBGhG1ZJ2gmB24rGxLJ7G0tATKLWULs558tOjcoS5bVTxoS1XmxVjUw47RiafMSpe0B61cceSadV9LEHkrs= +AQAB +

      3JLEo1LdH+CVYQHvSNHcob8lkmEWT+pBWqsz90Hk9Fy75fVxTVgDYryvm/SAZoq4HiSDFK8vha6GtaJMXfdjIw==

      +zVgzfOKGoXCttLgR7+aQJc47bQe05nE8QcDfmu1RJFMJGzPJokTd6kGjAqZZZIARb25h+q/RvirsaCaQ9j03iQ== +XRmd4goBx4i1xGJaq3PZGnRh2W0dS9Hmj+yfXIf1qabSsHduwWSa2TwnKz6CS8XVfPOQWFSxTE2kElpUvXzD3Q== +Bx5nqoyv3ijp3LoE5Sw5ExZzOPRrcRG75QuqtNRFW90FE8xX0ShSCSz9WboqnzFRaWuKOgaeXtleGL49iEvXAQ== +SgkSPIM/CXU//ndT+5XT+IaVeXQa8HMrIPhbvsKsq3v6D7p4yPwOEvMRsRZfFpzGrIO3iRsCBpob2nyHbr4qJw== +BS4/U1CQhU+fsOKcc2CO1MNhxKvThxP83TRCdR+mggv9wAs4vNlCbk6EuZh7op3lefjUjie0J4rOVwWE3QkXycDz4qH8FHkROmJTBMqITvy7D0xvOAP0KMBrKH6vs0Knc2qzIDkyaV+Ej1xMF6aawZWoXKd9eCCL4HhQoFGAf/E= +
      "; + + const string PublicKeyXml = @" +sO2GRzjw6Kx9d2+RzsaH+vWINhuB6+zIQ2KKH39ZvV19AMvxmhRyqyYoTYjm7v7P0vNlpqeYYPqDx2sba+rD9GwarBGhG1ZJ2gmB24rGxLJ7G0tATKLWULs558tOjcoS5bVTxoS1XmxVjUw47RiafMSpe0B61cceSadV9LEHkrs= +AQAB +"; + + const string PublicKeyXmlWithSpaces = @" + +sO2GRzjw6Kx9d2+RzsaH+vWINhuB6+zIQ2KKH39ZvV19AMvxmhRyqyYoTYjm7v7P0vNlpqeYYPqDx2sba+rD9GwarBGhG1ZJ2gmB24rGxLJ7G0tATKLWULs558tOjcoS5bVTxoS1XmxVjUw47RiafMSpe0B61cceSadV9LEHkrs= + AQAB +"; + + [Test] + public void Export_PrivateKey_to_xml() + { + var privateKey = RsaUtils.CreatePrivateKeyParams(); + "PRIVATE KEY".Print(); + privateKey.ToPrivateKeyXml().Print(); + + "PUBLIC KEY".Print(); + privateKey.ToPublicKeyXml().Print(); + } + + [Test] +#if NETCORE_SUPPORT + [Ignore("Operation not supported on .NET Core")] +#endif + public void Can_parse_private_key_xml() + { + var pk1 = PlatformRsaUtils.ExtractFromXml(PrivateKeyXml); + using (var rsa = RSA.Create()) + { + rsa.FromXml(PrivateKeyXml); + + var pk2 = rsa.ExportParameters(includePrivateParameters: true); + + Assert.That(pk1.Modulus, Is.EqualTo(pk2.Modulus)); + Assert.That(pk1.Exponent, Is.EqualTo(pk2.Exponent)); + Assert.That(pk1.P, Is.EqualTo(pk2.P)); + Assert.That(pk1.Q, Is.EqualTo(pk2.Q)); + Assert.That(pk1.DP, Is.EqualTo(pk2.DP)); + Assert.That(pk1.DQ, Is.EqualTo(pk2.DQ)); + Assert.That(pk1.InverseQ, Is.EqualTo(pk2.InverseQ)); + Assert.That(pk1.D, Is.EqualTo(pk2.D)); + } + } + + [Test] +#if NETCORE_SUPPORT + [Ignore("Operation not supported on .NET Core")] +#endif + public void Can_parse_public_key_xml() + { + var pk1 = PlatformRsaUtils.ExtractFromXml(PublicKeyXml); + using (var rsa = RSA.Create()) + { + rsa.FromXml(PublicKeyXml); + + var pk2 = rsa.ExportParameters(includePrivateParameters: false); + + Assert.That(pk1.Modulus, Is.EqualTo(pk2.Modulus)); + Assert.That(pk1.Exponent, Is.EqualTo(pk2.Exponent)); + Assert.That(pk1.P, Is.EqualTo(pk2.P)); + Assert.That(pk1.Q, Is.EqualTo(pk2.Q)); + Assert.That(pk1.DP, Is.EqualTo(pk2.DP)); + Assert.That(pk1.DQ, Is.EqualTo(pk2.DQ)); + Assert.That(pk1.InverseQ, Is.EqualTo(pk2.InverseQ)); + Assert.That(pk1.D, Is.EqualTo(pk2.D)); + } + } + + [Test] + public void Can_parse_public_key_xml_with_different_whitespace() + { + var pk1 = PlatformRsaUtils.ExtractFromXml(PublicKeyXml); + var pk2 = PlatformRsaUtils.ExtractFromXml(PublicKeyXmlWithSpaces); + Assert.That(pk1.Modulus, Is.EqualTo(pk2.Modulus)); + Assert.That(pk1.Exponent, Is.EqualTo(pk2.Exponent)); + } + + private static RSAParameters ExtractRsaParameters(string xml) + { + var doc = XDocument.Parse(xml); + var csp = new RSAParameters(); + var node = ((XElement) doc.FirstNode).FirstNode; + do + { + var el = node as XElement; + if (el != null) + { + switch (el.Name.LocalName) + { + case "Modulus": + csp.Modulus = Convert.FromBase64String(el.Value); + break; + case "Exponent": + csp.Exponent = Convert.FromBase64String(el.Value); + break; + case "P": + csp.P = Convert.FromBase64String(el.Value); + break; + case "Q": + csp.Q = Convert.FromBase64String(el.Value); + break; + case "DP": + csp.DP = Convert.FromBase64String(el.Value); + break; + case "DQ": + csp.DQ = Convert.FromBase64String(el.Value); + break; + case "InverseQ": + csp.InverseQ = Convert.FromBase64String(el.Value); + break; + case "D": + csp.D = Convert.FromBase64String(el.Value); + break; + } + } + } while ((node = node.NextNode) != null); + + return csp; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/ServiceClient.Web/HtmlServiceClient.cs b/tests/ServiceStack.Common.Tests/ServiceClient.Web/HtmlServiceClient.cs index e2e5a80cb6a..2aacd365ad0 100644 --- a/tests/ServiceStack.Common.Tests/ServiceClient.Web/HtmlServiceClient.cs +++ b/tests/ServiceStack.Common.Tests/ServiceClient.Web/HtmlServiceClient.cs @@ -34,7 +34,7 @@ public override string ContentType get { return MimeTypes.FormUrlEncoded; } } - public override void SerializeToStream(IRequest requestContext, object request, Stream stream) + public override void SerializeToStream(IRequest req, object request, Stream stream) { var queryString = QueryStringSerializer.SerializeToString(request); stream.Write(queryString); diff --git a/tests/ServiceStack.Common.Tests/ServiceClient.Web/ServiceClientBaseTester.cs b/tests/ServiceStack.Common.Tests/ServiceClient.Web/ServiceClientBaseTester.cs index eb08228b024..ad80b271a8a 100644 --- a/tests/ServiceStack.Common.Tests/ServiceClient.Web/ServiceClientBaseTester.cs +++ b/tests/ServiceStack.Common.Tests/ServiceClient.Web/ServiceClientBaseTester.cs @@ -10,7 +10,7 @@ public class ServiceClientBaseTester : ServiceClientBase { public override string ContentType { get { return String.Format("application/{0}", Format); } } - public override void SerializeToStream(IRequest requestContext, object request, System.IO.Stream stream) + public override void SerializeToStream(IRequest req, object request, System.IO.Stream stream) { throw new NotImplementedException(); } diff --git a/tests/ServiceStack.Common.Tests/ServiceClient.Web/ServiceClientBaseTests.cs b/tests/ServiceStack.Common.Tests/ServiceClient.Web/ServiceClientBaseTests.cs index 1f43484db8d..5a3ca4817e1 100644 --- a/tests/ServiceStack.Common.Tests/ServiceClient.Web/ServiceClientBaseTests.cs +++ b/tests/ServiceStack.Common.Tests/ServiceClient.Web/ServiceClientBaseTests.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using NUnit.Framework; +using ServiceStack.Common.Tests.FluentValidation; namespace ServiceStack.Common.Tests.ServiceClient.Web { diff --git a/tests/ServiceStack.Common.Tests/ServiceClient.Web/UrlExtensionsTests.cs b/tests/ServiceStack.Common.Tests/ServiceClient.Web/UrlExtensionsTests.cs index 6912c86d21e..283f47bf15e 100644 --- a/tests/ServiceStack.Common.Tests/ServiceClient.Web/UrlExtensionsTests.cs +++ b/tests/ServiceStack.Common.Tests/ServiceClient.Web/UrlExtensionsTests.cs @@ -1,6 +1,8 @@ using System; +using System.Collections.Generic; using NUnit.Framework; -using ServiceStack.Host; +using ServiceStack.Common.Tests.Models; +using ServiceStack.NativeTypes; using ServiceStack.Testing; using ServiceStack.Text; @@ -37,7 +39,7 @@ public void Can_get_operation_name() [Test] public void Can_use_nested_classes_as_Request_DTOs() { - using (var appHost = new BasicAppHost(typeof(NestedService).Assembly){}.Init()) + using (var appHost = new BasicAppHost(typeof(NestedService).Assembly).Init()) { var root = (Root)appHost.ExecuteService(new Root { Id = 1 }); Assert.That(root.Id, Is.EqualTo(1)); @@ -46,6 +48,116 @@ public void Can_use_nested_classes_as_Request_DTOs() Assert.That(nested.Id, Is.EqualTo(2)); } } + + [Test] + public void Can_expand_generic_List() + { + var genericName = typeof(List).ExpandTypeName(); + + genericName.Print(); + + Assert.That(genericName, Is.EqualTo("List")); + } + + [Test] + public void Can_expand_generic_List_and_Dictionary() + { + //System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Namespace.Poco, Assembly.Name, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] + + var genericName = typeof(Dictionary>).ExpandTypeName(); + + genericName.Print(); + + Assert.That(genericName, Is.EqualTo("Dictionary>")); + } + + [Test] + public void Can_parse_Single_Type() + { + var fullGenericTypeName = "Poco"; + + var textNode = fullGenericTypeName.ParseTypeIntoNodes(); + + Assert.That(textNode.Text, Is.EqualTo("Poco")); + Assert.That(textNode.Children.Count, Is.EqualTo(0)); + } + + [Test] + public void Can_parse_generic_List_of_Poco() + { + var fullGenericTypeName = "List"; + + var textNode = fullGenericTypeName.ParseTypeIntoNodes(); + + textNode.PrintDump(); + + Assert.That(textNode.Text, Is.EqualTo("List")); + Assert.That(textNode.Children.Count, Is.EqualTo(1)); + Assert.That(textNode.Children[0].Text, Is.EqualTo("Poco")); + } + + [Test] + public void Can_parse_generic_List_Dictionary_of_String_and_Poco() + { + var fullGenericTypeName = "List>"; + + var textNode = fullGenericTypeName.ParseTypeIntoNodes(); + + Assert.That(textNode.Text, Is.EqualTo("List")); + Assert.That(textNode.Children.Count, Is.EqualTo(1)); + + Assert.That(textNode.Children[0].Text, Is.EqualTo("Dictionary")); + Assert.That(textNode.Children[0].Children.Count, Is.EqualTo(2)); + Assert.That(textNode.Children[0].Children[0].Text, Is.EqualTo("String")); + Assert.That(textNode.Children[0].Children[1].Text, Is.EqualTo("Poco")); + } + + [Test] + public void Can_parse_generic_List_Dictionary_of_Dictionary_of_String_and_Poco() + { + var fullGenericTypeName = "List>>"; + + var textNode = fullGenericTypeName.ParseTypeIntoNodes(); + + Assert.That(textNode.Text, Is.EqualTo("List")); + Assert.That(textNode.Children.Count, Is.EqualTo(1)); + + Assert.That(textNode.Children[0].Text, Is.EqualTo("Dictionary")); + Assert.That(textNode.Children[0].Children.Count, Is.EqualTo(2)); + Assert.That(textNode.Children[0].Children[0].Text, Is.EqualTo("String")); + + Assert.That(textNode.Children[0].Children[1].Text, Is.EqualTo("Dictionary")); + Assert.That(textNode.Children[0].Children[1].Children.Count, Is.EqualTo(2)); + Assert.That(textNode.Children[0].Children[1].Children[0].Text, Is.EqualTo("String")); + Assert.That(textNode.Children[0].Children[1].Children[1].Text, Is.EqualTo("Poco")); + } + + [Test] + public void Can_SplitGenericArgs() + { + var args = StringUtils.SplitGenericArgs("String,Int64,Boolean"); + Assert.That(args, Is.EquivalentTo(new[] {"String", "Int64", "Boolean"})); + + args = StringUtils.SplitGenericArgs("List>>"); + Assert.That(args, Is.EquivalentTo(new[] { "List>>" })); + + args = StringUtils.SplitGenericArgs("String,List>>,Int64"); + Assert.That(args, Is.EquivalentTo(new[] { "String", "List>>", "Int64" })); + } + + [Test] + public void Can_strip_nullables() + { + Assert.That(MetadataExtensions.StripGenericType("Nullable", "Nullable"), + Is.EqualTo("Byte")); + Assert.That(MetadataExtensions.StripGenericType("Nullable[]", "Nullable"), + Is.EqualTo("Byte[]")); + Assert.That(MetadataExtensions.StripGenericType("List>[]", "Nullable"), + Is.EqualTo("List[]")); + Assert.That(MetadataExtensions.StripGenericType("List>>[]", "Nullable"), + Is.EqualTo("List>[]")); + } + } public class Root diff --git a/tests/ServiceStack.Common.Tests/ServiceStack.Common.Tests.csproj b/tests/ServiceStack.Common.Tests/ServiceStack.Common.Tests.csproj index 155a811bb7a..68cd3bda80e 100644 --- a/tests/ServiceStack.Common.Tests/ServiceStack.Common.Tests.csproj +++ b/tests/ServiceStack.Common.Tests/ServiceStack.Common.Tests.csproj @@ -1,321 +1,65 @@ - - + - Debug - AnyCPU - 9.0.30729 - 2.0 - {3FA9197A-462D-44CC-9AB3-61AF414D0B45} - Library - Properties - ServiceStack.Common.Tests + net461;netcoreapp3.1 + portable ServiceStack.Common.Tests - v4.5 - 512 - - - 3.5 - - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - ..\..\src\ - true - - - True - full - False - bin\Debug\ - TRACE;DEBUG;MONO - prompt - 4 - AllRules.ruleset - False - x86 - false - - - pdbonly - True - bin\Release\ - TRACE - prompt - 4 - x86 - AllRules.ruleset - false - - - True - bin\monotouch\ - TRACE;DEBUG;STATIC_ONLY NO_EXPRESSIONS - full - AnyCPU - prompt - 4 - False - AllRules.ruleset - false - - - True - bin\MonoTouch\ - TRACE;DEBUG;STATIC_ONLY NO_EXPRESSIONS - full - AnyCPU - prompt - 4 - False - AllRules.ruleset - false - - - bin\Signed\ - TRACE - true - pdbonly - x86 - prompt - AllRules.ruleset - false + ServiceStack.Common.Tests + false + false + false + false + false + false + false + false - - ..\..\lib\tests\Moq.dll - - - False - ..\..\src\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - ..\..\src\packages\RabbitMQ.Client.3.2.4\lib\net30\RabbitMQ.Client.dll - - - ..\..\lib\ServiceStack.Interfaces.dll - - - ..\..\lib\ServiceStack.Redis.dll - - - - 3.5 - - - - 3.5 - - - - 3.0 - - - - - 3.5 - - - 3.5 - - - - - ..\..\lib\ServiceStack.Text.dll - - - ..\..\lib\tests\Mono.Data.Sqlite.dll - - - ..\..\lib\ServiceStack.OrmLite.dll - - - ..\..\lib\ServiceStack.OrmLite.Sqlite.dll - - - ..\..\lib\ServiceStack.OrmLite.SqlServer.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Settings.settings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + PreserveNewest + - - {c43f583f-abde-4dd4-bbe3-66322817a6ad} - ServiceStack.Client - - - {982416DB-C143-4028-A0C3-CF41892D18D3} - ServiceStack.Common - - - {6b751a07-75d4-4a9d-b3a0-eea27808e64c} - ServiceStack.MsgPack - - - {ef36a253-c53f-4bf3-b0ec-4d29211fa67d} - ServiceStack.ProtoBuf - - - {E940929C-9E76-41CD-BD09-08029FE9B440} - ServiceStack.RabbitMq - - - {5a315f92-80d2-4c60-a5a4-22e027ac7e7e} - ServiceStack.Server - - - {680A1709-25EB-4D52-A87F-EE03FFD94BAA} - ServiceStack - + + + + + + + + + + + + + + + + - - + + $(DefineConstants);NET45 + + + + + + + + + - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - SQL Server 2008 Express - true - - - False - Windows Installer 3.1 - true - - - False - Windows Installer 4.5 - true - + + $(DefineConstants);NETCORE_SUPPORT;NETCORE + + + + + + - - - + SettingsSingleFileGenerator - Settings.Designer.cs - - - sqlite3.dll - PreserveNewest - - - - - \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/SessionExtensionTests.cs b/tests/ServiceStack.Common.Tests/SessionExtensionTests.cs index fa8ae9ed94a..ea982a067cf 100644 --- a/tests/ServiceStack.Common.Tests/SessionExtensionTests.cs +++ b/tests/ServiceStack.Common.Tests/SessionExtensionTests.cs @@ -1,5 +1,7 @@ -using System; +#if !NETCORE_SUPPORT +using System; using NUnit.Framework; +using ServiceStack.Text; namespace ServiceStack.Common.Tests { @@ -12,11 +14,50 @@ public void Does_CreateRandomSessionId_without_url_unfriendly_chars() 1000.Times(i => { var sessionId = SessionExtensions.CreateRandomSessionId(); - Assert.That(sessionId, Is.Not.StringContaining("+")); - Assert.That(sessionId, Is.Not.StringContaining("/")); + Assert.That(sessionId, Does.Not.Contain("+")); + Assert.That(sessionId, Does.Not.Contain("/")); }); } + [Test] + public void ToBase64UrlSafe_does_not_contain_unfriendly_chars() + { + var bytes = new byte[24]; + string lastSessionId = null; + + 1000.Times(i => + { + SessionExtensions.PopulateWithSecureRandomBytes(bytes); + + var sessionId = bytes.ToBase64UrlSafe(); + + Assert.That(sessionId, Does.Not.Contain("+")); + Assert.That(sessionId, Does.Not.Contain("/")); + + if (lastSessionId != null) + Assert.That(sessionId, Is.Not.EqualTo(lastSessionId)); + lastSessionId = sessionId; + }); + } + + [Test] + public void Does_CreateRandomBase62Id_16_byte_id_in_less_than_3_attempts_avg() + { + Assert.That(SessionExtensions.CreateRandomBase62Id(16).Length, Is.EqualTo(24)); + + int attempts = 0; + 1000.Times(i => + { + do + { + attempts++; + } while (SessionExtensions.CreateRandomBase64Id(16).IndexOfAny(new[] {'+', '/'}) >= 0); + }); + + attempts.Print(); + Assert.That(attempts, Is.LessThan(1000 * 3)); + } + [Test] public void CreateRandomBase64Id_contains_url_unfriendly_chars() { @@ -29,4 +70,5 @@ public void CreateRandomBase64Id_contains_url_unfriendly_chars() })); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/StreamExtensionsTests.cs b/tests/ServiceStack.Common.Tests/StreamExtensionsTests.cs index f21aed25309..fb7f81af213 100644 --- a/tests/ServiceStack.Common.Tests/StreamExtensionsTests.cs +++ b/tests/ServiceStack.Common.Tests/StreamExtensionsTests.cs @@ -2,75 +2,75 @@ using NUnit.Framework; using ServiceStack.Common; using ServiceStack.Serialization; -using DataContractSerializer=ServiceStack.Serialization.DataContractSerializer; +using DataContractSerializer = ServiceStack.Serialization.DataContractSerializer; namespace ServiceStack.Common.Tests { - [TestFixture] - public class StreamExtensionsTests - { - [DataContract] - public class SimpleDto - { - [DataMember] - public int Id { get; set; } + [TestFixture] + public class StreamExtensionsTests + { + [DataContract] + public class SimpleDto + { + [DataMember] + public int Id { get; set; } - [DataMember] - public string Name { get; set; } + [DataMember] + public string Name { get; set; } - public SimpleDto(int id, string name) - { - Id = id; - Name = name; - } - } + public SimpleDto(int id, string name) + { + Id = id; + Name = name; + } + } - [Test] - public void Can_compress_and_decompress_SimpleDto() - { - var simpleDto = new SimpleDto(1, "name"); + [Test] + public void Can_compress_and_decompress_SimpleDto() + { + var simpleDto = new SimpleDto(1, "name"); - var simpleDtoXml = DataContractSerializer.Instance.SerializeToString(simpleDto); + var simpleDtoXml = DataContractSerializer.Instance.SerializeToString(simpleDto); - var simpleDtoZip = simpleDtoXml.Deflate(); + var simpleDtoZip = simpleDtoXml.Deflate(); - Assert.That(simpleDtoZip.Length, Is.GreaterThan(0)); + Assert.That(simpleDtoZip.Length, Is.GreaterThan(0)); - var deserializedSimpleDtoXml = simpleDtoZip.Inflate(); + var deserializedSimpleDtoXml = simpleDtoZip.Inflate(); - Assert.That(deserializedSimpleDtoXml, Is.Not.Empty); + Assert.That(deserializedSimpleDtoXml, Is.Not.Empty); - var deserializedSimpleDto = DataContractSerializer.Instance.DeserializeFromString( - deserializedSimpleDtoXml); + var deserializedSimpleDto = DataContractSerializer.Instance.DeserializeFromString( + deserializedSimpleDtoXml); - Assert.That(deserializedSimpleDto, Is.Not.Null); + Assert.That(deserializedSimpleDto, Is.Not.Null); - Assert.That(deserializedSimpleDto.Id, Is.EqualTo(simpleDto.Id)); - Assert.That(deserializedSimpleDto.Name, Is.EqualTo(simpleDto.Name)); - } + Assert.That(deserializedSimpleDto.Id, Is.EqualTo(simpleDto.Id)); + Assert.That(deserializedSimpleDto.Name, Is.EqualTo(simpleDto.Name)); + } - [Test] - public void Can_compress_and_decompress_SimpleDto_with_Gzip() - { - var simpleDto = new SimpleDto(1, "name"); + [Test] + public void Can_compress_and_decompress_SimpleDto_with_Gzip() + { + var simpleDto = new SimpleDto(1, "name"); - var simpleDtoXml = DataContractSerializer.Instance.SerializeToString(simpleDto); + var simpleDtoXml = DataContractSerializer.Instance.SerializeToString(simpleDto); - var simpleDtoZip = simpleDtoXml.GZip(); + var simpleDtoZip = simpleDtoXml.GZip(); - Assert.That(simpleDtoZip.Length, Is.GreaterThan(0)); + Assert.That(simpleDtoZip.Length, Is.GreaterThan(0)); - var deserializedSimpleDtoXml = simpleDtoZip.GUnzip(); + var deserializedSimpleDtoXml = simpleDtoZip.GUnzip(); - Assert.That(deserializedSimpleDtoXml, Is.Not.Empty); + Assert.That(deserializedSimpleDtoXml, Is.Not.Empty); - var deserializedSimpleDto = DataContractSerializer.Instance.DeserializeFromString( - deserializedSimpleDtoXml); + var deserializedSimpleDto = DataContractSerializer.Instance.DeserializeFromString( + deserializedSimpleDtoXml); - Assert.That(deserializedSimpleDto, Is.Not.Null); + Assert.That(deserializedSimpleDto, Is.Not.Null); - Assert.That(deserializedSimpleDto.Id, Is.EqualTo(simpleDto.Id)); - Assert.That(deserializedSimpleDto.Name, Is.EqualTo(simpleDto.Name)); - } - } + Assert.That(deserializedSimpleDto.Id, Is.EqualTo(simpleDto.Id)); + Assert.That(deserializedSimpleDto.Name, Is.EqualTo(simpleDto.Name)); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/StringExtensionTests.cs b/tests/ServiceStack.Common.Tests/StringExtensionTests.cs index c8592b33a6c..fe9f16ff5f1 100644 --- a/tests/ServiceStack.Common.Tests/StringExtensionTests.cs +++ b/tests/ServiceStack.Common.Tests/StringExtensionTests.cs @@ -4,104 +4,86 @@ using System.Web; using NUnit.Framework; using ServiceStack.Text; +#if NETCORE +using HttpUtility = System.Net.WebUtility; +#endif namespace ServiceStack.Common.Tests { - [TestFixture] - public class StringExtensionTests - { - [Test] - public void To_works_with_ValueTypes() - { - Assert.That(1.ToString().To(), Is.EqualTo(1)); - } - - [Test] - public void To_on_null_or_empty_string_returns_default_value_supplied() - { - const string nullString = null; - Assert.That("".To(1), Is.EqualTo(1)); - Assert.That("".To(default(int)), Is.EqualTo(default(int))); - Assert.That(nullString.To(1), Is.EqualTo(1)); - } - - [Test] - public void To_ValueType_on_null_or_empty_string_returns_default_value() - { - Assert.That("".To(), Is.EqualTo(default(int))); - } - - [Test] - public void To_UrlEncode() - { - const string url = "http://www.servicestack.net/a?b=c&d=f"; - var urlEncoded = url.UrlEncode(); - - Assert.That(urlEncoded, Is.EqualTo(HttpUtility.UrlEncode(url))); - } - - [Test] - public void To_UrlDecode() - { - const string url = "http://www.servicestack.net/a?b=c&d=f"; - var urlEncoded = url.UrlEncode(); - var decodedUrl = urlEncoded.UrlDecode(); - - Assert.That(decodedUrl, Is.EqualTo(url)); - } - - [Test] - public void UrlFormat_encodes_components() - { - const string url = "http://www.servicestack.net/a?b={0}&d={1}"; - const string arg1 = "as@if.com"; - const string arg2 = "&="; - - var urlFormat = url.UrlFormat(arg1, arg2); - var expectedUrlFormat = string.Format(url, arg1.UrlEncode(), arg2.UrlEncode()); - - Assert.That(urlFormat, Is.EqualTo(expectedUrlFormat)); - } - - [Test] - public void ErrorCode_to_English_format() - { - const string code = "EmailAddressIsInvalid"; - Assert.That(code.ToEnglish(), Is.EqualTo("Email address is invalid")); - } - - [Test] - public void Print_special_chars() - { - var specialChars = new List { '"', ':', ',', '%' }; - specialChars.ForEach(x => Console.WriteLine(x + " = " + ((int)x).ToString("x"))); - } - - [Test] - public void HexEscape_escapes_special_chars() - { - var specialChars = new List { '"', ':', ',', '%' }; - const string unescapedString = "\"1st 2:nd 3r,d 4th%"; - const string expectedString = "%221st 2%3and 3r%2cd 4th%25"; - Assert.That(unescapedString.HexEscape(specialChars.ToArray()), Is.EqualTo(expectedString)); - } - - [Test] - public void HexUnescape_unescapes_special_chars() - { - var specialChars = new List { '"', ':', ',', '%' }; - const string escapedString = "%221st 2%3and 3r%2cd 4th%25"; - const string expectedString = "\"1st 2:nd 3r,d 4th%"; - Assert.That(escapedString.HexUnescape(specialChars.ToArray()), Is.EqualTo(expectedString)); - } - - [Test] - public void SafeVarName_strips_illegal_chars() - { - Assert.That("with space".SafeVarName(), Is.EqualTo("with_space")); - Assert.That("with @+:\\illegals".SafeVarName(), Is.EqualTo("with_____illegals")); - Assert.That("UPPER_lower_0123456789".SafeVarName(), Is.EqualTo("UPPER_lower_0123456789")); - } + [TestFixture] + public class StringExtensionTests + { + [Test] + public void To_UrlEncode() + { + const string url = "http://www.servicestack.net/a?b=c&d=f"; + var urlEncoded = url.UrlEncode(); + + Assert.That(urlEncoded.ToUpper(), Is.EqualTo(HttpUtility.UrlEncode(url).ToUpper())); + } + + [Test] + public void To_UrlDecode() + { + const string url = "http://www.servicestack.net/a?b=c&d=f"; + var urlEncoded = url.UrlEncode(); + var decodedUrl = urlEncoded.UrlDecode(); + + Assert.That(decodedUrl, Is.EqualTo(url)); + } + + [Test] + public void UrlFormat_encodes_components() + { + const string url = "http://www.servicestack.net/a?b={0}&d={1}"; + const string arg1 = "as@if.com"; + const string arg2 = "&="; + + var urlFormat = url.UrlFormat(arg1, arg2); + var expectedUrlFormat = string.Format(url, arg1.UrlEncode(), arg2.UrlEncode()); + + Assert.That(urlFormat, Is.EqualTo(expectedUrlFormat)); + } + + [Test] + public void ErrorCode_to_English_format() + { + const string code = "EmailAddressIsInvalid"; + Assert.That(code.ToEnglish(), Is.EqualTo("Email address is invalid")); + } + + [Test] + public void Print_special_chars() + { + var specialChars = new List { '"', ':', ',', '%' }; + specialChars.ForEach(x => Console.WriteLine(x + " = " + ((int)x).ToString("x"))); + } + + [Test] + public void HexEscape_escapes_special_chars() + { + var specialChars = new List { '"', ':', ',', '%' }; + const string unescapedString = "\"1st 2:nd 3r,d 4th%"; + const string expectedString = "%221st 2%3and 3r%2cd 4th%25"; + Assert.That(unescapedString.HexEscape(specialChars.ToArray()), Is.EqualTo(expectedString)); + } + + [Test] + public void HexUnescape_unescapes_special_chars() + { + var specialChars = new List { '"', ':', ',', '%' }; + const string escapedString = "%221st 2%3and 3r%2cd 4th%25"; + const string expectedString = "\"1st 2:nd 3r,d 4th%"; + Assert.That(escapedString.HexUnescape(specialChars.ToArray()), Is.EqualTo(expectedString)); + } + + [Test] + public void SafeVarName_strips_illegal_chars() + { + Assert.That("with space".SafeVarName(), Is.EqualTo("with_space")); + Assert.That("with @+:\\illegals".SafeVarName(), Is.EqualTo("with_____illegals")); + Assert.That("UPPER_lower_0123456789".SafeVarName(), Is.EqualTo("UPPER_lower_0123456789")); + } [Test] public void Glob_finds_right_strings() @@ -110,13 +92,13 @@ public void Glob_finds_right_strings() var expected = input.Where(s => s.EndsWith("oo")).ToList(); var actual = input.Where(s => s.Glob("*oo")).ToList(); - + Assert.That(actual, Is.EquivalentTo(expected)); } - [Test] - public void Does_combine_paths() - { + [Test] + public void Does_combine_paths() + { Assert.That("/".CombineWith("/some/other/path"), Is.EqualTo("/some/other/path")); Assert.That("a".CombineWith("/some/other/path"), Is.EqualTo("a/some/other/path")); Assert.That("a/".CombineWith("/some/other/path"), Is.EqualTo("a/some/other/path")); @@ -127,7 +109,7 @@ public void Does_combine_paths() Assert.That("/a".CombineWith("/some/other/path/"), Is.EqualTo("/a/some/other/path/")); Assert.That("/a".CombineWith("/some/", "other", "/path/"), Is.EqualTo("/a/some/other/path/")); Assert.That("/a".CombineWith("some", "other", "path/"), Is.EqualTo("/a/some/other/path/")); - + Assert.That("".CombineWith("some", "other", "path/"), Is.EqualTo("some/other/path/")); } @@ -160,5 +142,149 @@ public void ToHttps_is_not_case_sensitive() { Assert.That("HTTP://HOST.EXAMPLE.COM".ToHttps(), Is.EqualTo("https://HOST.EXAMPLE.COM")); } - } + + [Test] + public void Can_parse_commands() + { + Assert.That("COUNT".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:]" })); + Assert.That("COUNT()".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:]" })); + Assert.That("COUNT(*)".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:*]" })); + Assert.That("COUNT(DISTINCT Name)".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:DISTINCT Name]" })); + Assert.That("COUNT('Name')".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:'Name']" })); + Assert.That("COUNT(\"Name\")".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:\"Name\"]" })); + Assert.That("COUNT('N,a(m\"e')".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:'N,a(m\"e']" })); + Assert.That("COUNT(*,'foo',1)".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:*|'foo'|1]" })); + Assert.That("COUNT( * , 'foo' , 1 )".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:*|'foo'|1]" })); + Assert.That("Count(*), Min(Age), Max(Age), Sum(Id)".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo( + new[] { "[Count:*]", "[Min:Age]", "[Max:Age]", "[Sum:Id]" })); + Assert.That("Count(*,\",\"), Min(Age,')'), Max(Age,1), Sum(Id,Foo,2.0)".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo( + new[] { "[Count:*|\",\"]", "[Min:Age|')']", "[Max:Age|1]", "[Sum:Id|Foo|2.0]" })); + + Assert.That("Field1,Field2".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[Field1:]", "[Field2:]" })); + } + + [Test] + public void Can_parse_commands_with_Aliases() + { + Assert.That("COUNT(*) Count".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:*] Count" })); + Assert.That("COUNT(DISTINCT LivingStatus) as UniqueStatus".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[COUNT:DISTINCT LivingStatus] as UniqueStatus" })); + Assert.That("MIN(Age) MinAge".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { "[MIN:Age] MinAge" })); + Assert.That("Count(*) count, Min(Age) min, Max(Age) max, Sum(Id) sum".ParseCommands().Map(x => x.ToDebugString()), Is.EquivalentTo(new[] { + "[Count:*] count", "[Min:Age] min", "[Max:Age] max", "[Sum:Id] sum" + })); + } + + [Test] + public void Does_clean_input() + { + Assert.That("a.b+c@&.com=|".SafeInput(), Is.EqualTo("a.b+c@d.com")); + Assert.That("/a/b.c".SafeInput(), Is.EqualTo("/a/b.c")); + Assert.That("1,000.00".SafeInput(), Is.EqualTo("1,000.00")); + Assert.That("a b c".SafeInput(), Is.EqualTo("a b c")); + } + + [Test] + public void Does_parse_complex_arguments() + { + Assert.That("add(1,add(2,3))".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[add:1|add(2,3)]" })); + Assert.That(" add ( 1, add(2,3) ) ".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[add:1|add(2,3)]" })); + Assert.That("cat('1',cat(\"2\",'3'))".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[cat:'1'|cat(\"2\",'3')]" })); + + Assert.That(" add ( 1, add(add(2,3),4) ) ".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[add:1|add(add(2,3),4)]" })); + } + + [Test] + public void Does_preserve_js_literal_string() + { + Assert.That("li({ id:'id-{name}', className:'cls'})".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[li:{ id:'id-{name}', className:'cls'}]" })); + } + + [Test] + public void Does_preserve_ternary_expression() + { + Assert.That("filter( true ? 'Y' : 'N' )".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[filter:true ? 'Y' : 'N']" })); + } + + [Test] + public void Does_parse_binding_expressions() + { + Assert.That("var".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[var:]" })); + Assert.That("var2".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[var2:]" })); + Assert.That("var.prop".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[var.prop:]" })); + Assert.That("var.prop.p2.p3".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[var.prop.p2.p3:]" })); + Assert.That("var.prop[key]".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[var.prop[key]:]" })); + Assert.That("var.prop['key']".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[var.prop['key']:]" })); + Assert.That("var.prop[\"key\"]".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[var.prop[\"key\"]:]" })); + + Assert.That("fn(var)".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var]" })); + Assert.That("fn(var.prop)".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop]" })); + Assert.That("fn(var.prop.p2.p3)".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop.p2.p3]" })); + Assert.That("fn(var.prop[key])".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop[key]]" })); + Assert.That("fn(var.prop['key'])".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop['key']]" })); + Assert.That("fn(var.prop[\"key\"])".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop[\"key\"]]" })); + + Assert.That("fn(var,var)".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var|var]" })); + Assert.That("fn(var.prop,var.prop)".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop|var.prop]" })); + Assert.That("fn(var.prop.p2.p3,var.prop.p2.p3)".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop.p2.p3|var.prop.p2.p3]" })); + Assert.That("fn(var.prop[key],var.prop[key])".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop[key]|var.prop[key]]" })); + Assert.That("fn(var.prop['key'],var.prop['key'])".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop['key']|var.prop['key']]" })); + Assert.That("fn(var.prop[\"key\"],var.prop[\"key\"])".ParseCommands().Map(x => x.ToDebugString()), Is.EqualTo(new[]{ "[fn:var.prop[\"key\"]|var.prop[\"key\"]]" })); + } + + [Test] + public void Can_parse_SELECT_Expression_with_concatenation() + { + var sql = "\"UserName\", \"Email\", \"FirstName\" AS \"GivenName\", \"LastName\" AS \"Surname\", \"FirstName\" || @1 || \"LastName\" AS FullName"; + + var commands = sql.ParseCommands(); + + var names = commands.Map(x => x.Original.ToString()); + Assert.That(names, Is.EquivalentTo(new[] { + "\"UserName\"", + "\"Email\"", + "\"FirstName\" AS \"GivenName\"", + "\"LastName\" AS \"Surname\"", + "\"FirstName\" || @1 || \"LastName\" AS FullName", + })); + + var aliasesOrNames = names.Map(x => x.LastRightPart("AS").Trim().StripQuotes() ); + aliasesOrNames.PrintDump(); + + Assert.That(aliasesOrNames, Is.EquivalentTo(new[] { + "UserName", + "Email", + "GivenName", + "Surname", + "FullName", + })); + } + + [Test] + public void Can_parse_SELECT_Expression_with_nested_functions() + { + var sql = "CONCAT(CONCAT(\"FirstName\", @1), \"LastName\") AS FullName, \"FirstName\" AS \"GivenName\", \"LastName\" AS \"Surname\", \"Email\", \"UserName\""; + + var commands = sql.ParseCommands(); + + var names = commands.Map(x => x.Original.ToString()); + Assert.That(names, Is.EquivalentTo(new[] { + "CONCAT(CONCAT(\"FirstName\", @1), \"LastName\") AS FullName", + "\"FirstName\" AS \"GivenName\"", + "\"LastName\" AS \"Surname\"", + "\"Email\"", + "\"UserName\"", + })); + + var aliasesOrNames = names.Map(x => x.LastRightPart("AS").Trim().StripQuotes() ); + aliasesOrNames.PrintDump(); + + Assert.That(aliasesOrNames, Is.EquivalentTo(new[] { + "FullName", + "GivenName", + "Surname", + "Email", + "UserName", + })); + } + } } diff --git a/tests/ServiceStack.Common.Tests/StringUtilsTests.cs b/tests/ServiceStack.Common.Tests/StringUtilsTests.cs index cb3e8a41758..2366448a71f 100644 --- a/tests/ServiceStack.Common.Tests/StringUtilsTests.cs +++ b/tests/ServiceStack.Common.Tests/StringUtilsTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt @@ -12,6 +12,17 @@ namespace ServiceStack.Common.Tests [TestFixture] public class StringUtilsTests { + [Test] + public void Does_replace_outside_of_quotes() + { + Assert.That("{it}".ReplaceOutsideOfQuotes("{", "{{", "}", "}}"), Is.EqualTo("{{it}}")); + Assert.That("{it} '{it}'".ReplaceOutsideOfQuotes("{", "{{", "}", "}}"), Is.EqualTo("{{it}} '{it}'")); + Assert.That("{it} `'{it}' {it}`".ReplaceOutsideOfQuotes("{", "{{", "}", "}}"), Is.EqualTo("{{it}} `'{it}' {it}`")); + Assert.That("{it} `'{it}' {it}` {it}".ReplaceOutsideOfQuotes("{", "{{", "}", "}}"), Is.EqualTo("{{it}} `'{it}' {it}` {{it}}")); + + Assert.That("{ '{0:00}' | fmt(it) }\n".ReplaceOutsideOfQuotes("{", "{{", "}", "}}"), Is.EqualTo("{{ '{0:00}' | fmt(it) }}\n")); + } + [Test] public void HtmlStrip_unescapes_all_html_character_codes_correctly() { @@ -19,11 +30,11 @@ public void HtmlStrip_unescapes_all_html_character_codes_correctly() { var expected = ((char)value).ToString(CultureInfo.InvariantCulture); - var decimalNotation = String.Format("&#{0};", value); + var decimalNotation = $"&#{value};"; var decimalActual = decimalNotation.StripHtml().ConvertHtmlCodes(); Assert.AreEqual(expected, decimalActual); - var hexNotation = String.Format("&#x{0:X};", value); + var hexNotation = $"&#x{value:X};"; var hexActual = hexNotation.StripHtml().ConvertHtmlCodes(); Assert.AreEqual(expected, hexActual); } @@ -46,5 +57,16 @@ public void HtmlStrip_fixes_actual_production_example() var actual = encoded.StripHtml().ConvertHtmlCodes(); Assert.AreEqual(expected, actual); } + + [Test] + public void Does_convert_snake_case_to_PascalCase() + { + Assert.That(StringUtils.SnakeCaseToPascalCase(""), Is.EqualTo("")); + Assert.That(StringUtils.SnakeCaseToPascalCase("a"), Is.EqualTo("A")); + Assert.That(StringUtils.SnakeCaseToPascalCase("a_b"), Is.EqualTo("AB")); + Assert.That(StringUtils.SnakeCaseToPascalCase("a1_b2"), Is.EqualTo("A1B2")); + Assert.That(StringUtils.SnakeCaseToPascalCase("aa_bb"), Is.EqualTo("AaBb")); + Assert.That(StringUtils.SnakeCaseToPascalCase("aaBb"), Is.EqualTo("AaBb")); + } } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/TestBase.cs b/tests/ServiceStack.Common.Tests/TestBase.cs index ab3811c613a..47f08e19fee 100644 --- a/tests/ServiceStack.Common.Tests/TestBase.cs +++ b/tests/ServiceStack.Common.Tests/TestBase.cs @@ -4,6 +4,7 @@ using System.Net; using System.Reflection; using System.Text; +using System.Threading; using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.Host; @@ -32,10 +33,17 @@ protected TestBase(string serviceClientBaseUri, params Assembly[] serviceAssembl ServiceClientBaseUri = serviceClientBaseUri; ServiceAssemblies = serviceAssemblies; - this.AppHost = new BasicAppHost(serviceAssemblies).Init(); + this.AppHost = new BasicAppHost(serviceAssemblies) + { + ConfigureAppHost = host => + { + host.CatchAllHandlers.Add(new PredefinedRoutesFeature().ProcessRequest); + host.CatchAllHandlers.Add(new MetadataFeature().ProcessRequest); + } + }.Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { this.AppHost.Dispose(); @@ -43,15 +51,9 @@ public void TestFixtureTearDown() protected abstract void Configure(Funq.Container container); - protected Funq.Container Container - { - get { return HostContext.Container; } - } + protected Funq.Container Container => HostContext.Container; - protected IServiceRoutes Routes - { - get { return HostContext.AppHost.Routes; } - } + protected IServiceRoutes Routes => HostContext.AppHost.Routes; //All integration tests call the Webservices hosted at the following location: protected string ServiceClientBaseUri { get; set; } @@ -111,62 +113,36 @@ public void SendOneWay(string relativeOrAbsoluteUri, object requestDto) ServiceManager.Execute(requestDto); } - public TResponse Send(object request) + public void SendAllOneWay(IEnumerable requests) { - var message = MessageFactory.Create(request); - var response = ServiceManager.ExecuteMessage(message); - var httpResult = response as IHttpResult; - if (httpResult != null) - { - if (httpResult.StatusCode >= HttpStatusCode.BadRequest) - { - var webEx = new WebServiceException(httpResult.StatusDescription) { - ResponseDto = httpResult.Response, - StatusCode = httpResult.Status, - }; - throw webEx; - } - return (TResponse) httpResult.Response; - } - - var responseStatus = response.GetResponseStatus(); - var isError = responseStatus != null && responseStatus.ErrorCode != null; - if (isError) - { - var webEx = new WebServiceException(responseStatus.Message) - { - ResponseDto = response, - StatusCode = responseStatus.Errors != null && responseStatus.Errors.Count > 0 - ? 400 - : 500, - }; - throw webEx; - } - - return (TResponse)response; + throw new NotImplementedException(); } - public TResponse Send(IReturn request) + public TResponse Get(IReturn requestDto) { throw new NotImplementedException(); } - public void Send(IReturnVoid request) + public TResponse Get(object requestDto) { throw new NotImplementedException(); } - public HttpWebResponse Get(object request) + public void AddHeader(string name, string value) { throw new NotImplementedException(); } - public TResponse Get(IReturn requestDto) + public void ClearCookies() { - throw new NotImplementedException(); } - public TResponse Get(object requestDto) + public Dictionary GetCookieValues() + { + return new Dictionary(); + } + + public void SetCookie(string name, string value, TimeSpan? expiresIn = null) { throw new NotImplementedException(); } @@ -186,11 +162,6 @@ public IEnumerable GetLazy(IReturn(IReturn request) { throw new NotImplementedException(); @@ -211,11 +182,6 @@ public TResponse Delete(string relativeOrAbsoluteUrl) return parent.ExecutePath(HttpMethods.Delete, new UrlParts(relativeOrAbsoluteUrl), null); } - public HttpWebResponse Post(object requestDto) - { - throw new NotImplementedException(); - } - public TResponse Post(IReturn requestDto) { throw new NotImplementedException(); @@ -241,11 +207,6 @@ public TResponse Post(object request, string relativeOrAbsoluteUrl) return parent.ExecutePath(HttpMethods.Post, new UrlParts(relativeOrAbsoluteUrl), request); } - public HttpWebResponse Put(object requestDto) - { - throw new NotImplementedException(); - } - public TResponse Put(IReturn requestDto) { throw new NotImplementedException(); @@ -271,22 +232,22 @@ public TResponse Put(object requestDto, string relativeOrAbsoluteUrl) return parent.ExecutePath(HttpMethods.Put, new UrlParts(relativeOrAbsoluteUrl), requestDto); } - public HttpWebResponse Patch(object requestDto) + public TResponse Patch(IReturn requestDto) { throw new NotImplementedException(); } - public TResponse Patch(IReturn requestDto) + public TResponse Patch(object requestDto) { throw new NotImplementedException(); } - public TResponse Patch(object requestDto) + public TResponse Patch(string relativeOrAbsoluteUrl, object requestDto) { throw new NotImplementedException(); } - public TResponse Patch(string relativeOrAbsoluteUrl, object requestDto) + public TResponse Send(string httpMethod, string relativeOrAbsoluteUrl, object request) { throw new NotImplementedException(); } @@ -311,53 +272,73 @@ public void CustomMethod(string httpVerb, IReturnVoid requestDto) throw new NotImplementedException(); } - public HttpWebResponse CustomMethod(string httpVerb, object requestDto) + public TResponse CustomMethod(string httpVerb, IReturn requestDto) { throw new NotImplementedException(); } - public TResponse CustomMethod(string httpVerb, IReturn requestDto) + public TResponse CustomMethod(string httpVerb, object requestDto) { throw new NotImplementedException(); } - public TResponse CustomMethod(string httpVerb, object requestDto) + public TResponse PostFile(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, string mimeType) { throw new NotImplementedException(); } - public HttpWebResponse Head(IReturn requestDto) + public TResponse PostFileWithRequest( + Stream fileToUpload, string fileName, object request, string fieldName = "upload") { throw new NotImplementedException(); } - public HttpWebResponse Head(object requestDto) + private static void HandleException(Exception exception, Action onError) { - throw new NotImplementedException(); + var response = (TResponse)typeof(TResponse).CreateInstance(); + if (response is IHasResponseStatus hasResponseStatus) + { + hasResponseStatus.ResponseStatus = new ResponseStatus { + ErrorCode = exception.GetType().Name, + Message = exception.Message, + StackTrace = exception.StackTrace, + }; + } + var webServiceEx = new WebServiceException(exception.Message, exception); + onError?.Invoke(response, webServiceEx); } - public HttpWebResponse Head(string relativeOrAbsoluteUrl) + public void SetCredentials(string userName, string password) { throw new NotImplementedException(); } - public TResponse PostFile(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, string mimeType) + public Task GetAsync(string relativeOrAbsoluteUrl, CancellationToken token = default) { throw new NotImplementedException(); } - public TResponse PostFileWithRequest( - Stream fileToUpload, string fileName, object request, string fieldName = "upload") + public Task DeleteAsync(string relativeOrAbsoluteUrl, CancellationToken token = default) { - throw new NotImplementedException(); + var tcs = new TaskCompletionSource(); + try + { + var response = parent.ExecutePath(HttpMethods.Delete, new UrlParts(relativeOrAbsoluteUrl), default(TResponse)); + tcs.SetResult(response); + } + catch (Exception ex) + { + HandleException(ex, (TResponse r, Exception rex) => tcs.SetException(rex)); + } + return tcs.Task; } - public Task SendAsync(object requestDto) + public Task PostAsync(string relativeOrAbsoluteUrl, object request, CancellationToken token = default) { var tcs = new TaskCompletionSource(); try { - var response = (TResponse)ServiceManager.Execute(requestDto); + var response = parent.ExecutePath(HttpMethods.Post, new UrlParts(relativeOrAbsoluteUrl), request); tcs.SetResult(response); } catch (Exception ex) @@ -367,73 +348,117 @@ public Task SendAsync(object requestDto) return tcs.Task; } - private static void HandleException(Exception exception, Action onError) + public Task PutAsync(string relativeOrAbsoluteUrl, object request, CancellationToken token = default) { - var response = (TResponse)typeof(TResponse).CreateInstance(); - var hasResponseStatus = response as IHasResponseStatus; - if (hasResponseStatus != null) + var tcs = new TaskCompletionSource(); + try { - hasResponseStatus.ResponseStatus = new ResponseStatus { - ErrorCode = exception.GetType().Name, - Message = exception.Message, - StackTrace = exception.StackTrace, - }; + var response = parent.ExecutePath(HttpMethods.Put, new UrlParts(relativeOrAbsoluteUrl), request); + tcs.SetResult(response); } - var webServiceEx = new WebServiceException(exception.Message, exception); - if (onError != null) onError(response, webServiceEx); + catch (Exception ex) + { + HandleException(ex, (TResponse r, Exception rex) => tcs.SetException(rex)); + } + return tcs.Task; } - public void SetCredentials(string userName, string password) + public Task CustomMethodAsync(string httpVerb, string relativeOrAbsoluteUrl, object request, + CancellationToken token = default) { throw new NotImplementedException(); } - public Task GetAsync(IReturn requestDto) + public Task SendAsync(string httpMethod, string absoluteUrl, object request, CancellationToken token = default) { throw new NotImplementedException(); } - public Task GetAsync(object requestDto) + public void CancelAsync() { throw new NotImplementedException(); } - public Task GetAsync(string relativeOrAbsoluteUrl) + public void Dispose() { } + public TResponse PostFileWithRequest(string relativeOrAbsoluteUrl, FileInfo fileToUpload, object request, string fieldName = "upload") { - var tcs = new TaskCompletionSource(); - try + throw new NotImplementedException(); + } + + public TResponse PostFileWithRequest(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, object request, string fieldName = "upload") + { + throw new NotImplementedException(); + } + + public TResponse PostFilesWithRequest(object request, IEnumerable files) + { + throw new NotImplementedException(); + } + + public TResponse PostFilesWithRequest(string relativeOrAbsoluteUrl, object request, IEnumerable files) + { + throw new NotImplementedException(); + } + + public int Version { get; set; } + public string SessionId { get; set; } + + public TResponse Send(object request) + { + var message = MessageFactory.Create(request); + var response = ServiceManager.ExecuteMessage(message); + if (response is IHttpResult httpResult) { - var response = parent.ExecutePath(HttpMethods.Get, new UrlParts(relativeOrAbsoluteUrl), default(TResponse)); - tcs.SetResult(response); + if (httpResult.StatusCode >= HttpStatusCode.BadRequest) + { + var webEx = new WebServiceException(httpResult.StatusDescription) + { + ResponseDto = httpResult.Response, + StatusCode = httpResult.Status, + }; + throw webEx; + } + return (TResponse)httpResult.Response; } - catch (Exception ex) + + var responseStatus = response.GetResponseStatus(); + var isError = responseStatus?.ErrorCode != null; + if (isError) { - HandleException(ex, (TResponse r, Exception rex) => tcs.SetException(rex)); + var webEx = new WebServiceException(responseStatus.Message) + { + ResponseDto = response, + StatusCode = responseStatus.Errors != null && responseStatus.Errors.Count > 0 + ? 400 + : 500, + }; + throw webEx; } - return tcs.Task; + + return (TResponse)response; } - public Task GetAsync(IReturnVoid requestDto) + public List SendAll(IEnumerable requests) { throw new NotImplementedException(); } - public Task DeleteAsync(IReturn requestDto) + public void Publish(object requestDto) { - throw new NotImplementedException(); + SendOneWay(requestDto); } - public Task DeleteAsync(object requestDto) + public void PublishAll(IEnumerable requestDtos) { throw new NotImplementedException(); } - public Task DeleteAsync(string relativeOrAbsoluteUrl) + public Task SendAsync(object requestDto, CancellationToken token = default) { var tcs = new TaskCompletionSource(); try { - var response = parent.ExecutePath(HttpMethods.Delete, new UrlParts(relativeOrAbsoluteUrl), default(TResponse)); + var response = (TResponse)ServiceManager.Execute(requestDto); tcs.SetResult(response); } catch (Exception ex) @@ -443,103 +468,108 @@ public Task DeleteAsync(string relativeOrAbsoluteUrl) return tcs.Task; } - public Task DeleteAsync(IReturnVoid requestDto) + public Task> SendAllAsync(IEnumerable requests, CancellationToken token = default) { throw new NotImplementedException(); } - public Task PostAsync(IReturn requestDto) + public Task PublishAsync(object requestDto, CancellationToken token = default) + { + return SendAsync(requestDto, token); + } + + public Task PublishAllAsync(IEnumerable requestDtos, CancellationToken token = default) { throw new NotImplementedException(); } - public Task PostAsync(object requestDto) + public string BearerToken { get; set; } + public Task GetAsync(IReturn requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task PostAsync(IReturnVoid requestDto) + public Task GetAsync(object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task PutAsync(IReturn requestDto) + public Task GetAsync(IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task PutAsync(object requestDto) + public Task DeleteAsync(IReturn requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task PutAsync(IReturnVoid requestDto) + public Task DeleteAsync(object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task CustomMethodAsync(string httpVerb, IReturn requestDto) + public Task DeleteAsync(IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task CustomMethodAsync(string httpVerb, object requestDto) + public Task PostAsync(IReturn requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task CustomMethodAsync(string httpVerb, IReturnVoid requestDto) + public Task PostAsync(object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task PostAsync(string relativeOrAbsoluteUrl, object request) + public Task PostAsync(IReturnVoid requestDto, CancellationToken token = default) { - var tcs = new TaskCompletionSource(); - try - { - var response = parent.ExecutePath(HttpMethods.Post, new UrlParts(relativeOrAbsoluteUrl), request); - tcs.SetResult(response); - } - catch (Exception ex) - { - HandleException(ex, (TResponse r, Exception rex) => tcs.SetException(rex)); - } - return tcs.Task; + throw new NotImplementedException(); } - public Task PutAsync(string relativeOrAbsoluteUrl, object request) + public Task PutAsync(IReturn requestDto, CancellationToken token = default) { - var tcs = new TaskCompletionSource(); - try - { - var response = parent.ExecutePath(HttpMethods.Put, new UrlParts(relativeOrAbsoluteUrl), request); - tcs.SetResult(response); - } - catch (Exception ex) - { - HandleException(ex, (TResponse r, Exception rex) => tcs.SetException(rex)); - } - return tcs.Task; + throw new NotImplementedException(); } - public void CancelAsync() + public Task PutAsync(object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public void SendAsync(object requestDto, Action onSuccess, Action onError) + public Task PutAsync(IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public void Dispose() { } - public TResponse PostFileWithRequest(string relativeOrAbsoluteUrl, FileInfo fileToUpload, object request, string fieldName = "upload") + public Task PatchAsync(IReturn requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public TResponse PostFileWithRequest(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, object request, string fieldName = "upload") + public Task PatchAsync(object requestDto, CancellationToken token = default) + { + throw new NotImplementedException(); + } + + public Task PatchAsync(IReturnVoid requestDto, CancellationToken token = default) + { + throw new NotImplementedException(); + } + + public Task CustomMethodAsync(string httpVerb, IReturn requestDto, CancellationToken token = default) + { + throw new NotImplementedException(); + } + + public Task CustomMethodAsync(string httpVerb, object requestDto, CancellationToken token = default) + { + throw new NotImplementedException(); + } + + public Task CustomMethodAsync(string httpVerb, IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } @@ -555,7 +585,7 @@ private class UrlParts public UrlParts(string pathInfo) { this.PathInfo = pathInfo.UrlDecode(); - var qsIndex = pathInfo.IndexOf("?"); + var qsIndex = pathInfo.IndexOf("?", StringComparison.Ordinal); if (qsIndex != -1) { var qs = pathInfo.Substring(qsIndex + 1); @@ -611,36 +641,37 @@ public object ExecutePath( Dictionary formData, string requestBody) { - var httpHandler = GetHandler(httpMethod, pathInfo); - var contentType = (formData != null && formData.Count > 0) ? MimeTypes.FormUrlEncoded : requestBody != null ? MimeTypes.Json : null; var httpReq = new MockHttpRequest( - httpHandler.RequestName, httpMethod, contentType, + nameof(MockHttpRequest), + httpMethod, + contentType, pathInfo, queryString.ToNameValueCollection(), - requestBody == null ? null : new MemoryStream(Encoding.UTF8.GetBytes(requestBody)), + requestBody == null ? null : Encoding.UTF8.GetBytes(requestBody).InMemoryStream(), formData.ToNameValueCollection() ); - var request = httpHandler.CreateRequest(httpReq, httpHandler.RequestName); + var httpHandler = (IRequestHttpHandler)GetHandler(httpReq); + httpReq.OperationName = httpHandler.RequestName; + + var request = httpHandler.CreateRequestAsync(httpReq, httpHandler.RequestName).Result; object response; try { - response = httpHandler.GetResponse(httpReq, request); + response = httpHandler.GetResponseAsync(httpReq, request).Result; } catch (Exception ex) { response = DtoUtils.CreateErrorResponse(request, ex); } - var httpRes = response as IHttpResult; - if (httpRes != null) + if (response is IHttpResult httpRes) { - var httpError = httpRes as IHttpError; - if (httpError != null) + if (httpRes is IHttpError httpError) { throw new WebServiceException(httpError.Message) { StatusCode = httpError.Status, @@ -648,16 +679,13 @@ public object ExecutePath( }; } var hasResponseStatus = httpRes.Response as IHasResponseStatus; - if (hasResponseStatus != null) + var status = hasResponseStatus?.ResponseStatus; + if (status != null && !status.ErrorCode.IsNullOrEmpty()) { - var status = hasResponseStatus.ResponseStatus; - if (status != null && !status.ErrorCode.IsNullOrEmpty()) - { - throw new WebServiceException(status.Message) { - StatusCode = (int)HttpStatusCode.InternalServerError, - ResponseDto = httpRes.Response, - }; - } + throw new WebServiceException(status.Message) { + StatusCode = (int)HttpStatusCode.InternalServerError, + ResponseDto = httpRes.Response, + }; } return httpRes.Response; @@ -690,31 +718,34 @@ public object GetRequest( Dictionary formData, string requestBody) { - var httpHandler = GetHandler(httpMethod, pathInfo); - var contentType = (formData != null && formData.Count > 0) ? MimeTypes.FormUrlEncoded : requestBody != null ? MimeTypes.Json : null; var httpReq = new MockHttpRequest( - httpHandler.RequestName, httpMethod, contentType, + nameof(MockHttpRequest), + httpMethod, + contentType, pathInfo, queryString.ToNameValueCollection(), - requestBody == null ? null : new MemoryStream(Encoding.UTF8.GetBytes(requestBody)), + requestBody == null ? null : Encoding.UTF8.GetBytes(requestBody).InMemoryStream(), formData.ToNameValueCollection() ); - var request = httpHandler.CreateRequest(httpReq, httpHandler.RequestName); + var httpHandler = (IRequestHttpHandler)GetHandler(httpReq); + httpReq.OperationName = httpHandler.RequestName; + + var request = httpHandler.CreateRequestAsync(httpReq, httpHandler.RequestName).Result; return request; } - private static ServiceStackHandlerBase GetHandler(string httpMethod, string pathInfo) + private static ServiceStackHandlerBase GetHandler(IHttpRequest httpReq) { - var httpHandler = HttpHandlerFactory.GetHandlerForPathInfo(httpMethod, pathInfo, pathInfo, null) as ServiceStackHandlerBase; + var httpHandler = HttpHandlerFactory.GetHandlerForPathInfo(httpReq, null) as ServiceStackHandlerBase; if (httpHandler == null) - throw new NotSupportedException(pathInfo); + throw new NotSupportedException(httpReq.PathInfo); return httpHandler; } } -} \ No newline at end of file +} diff --git a/tests/ServiceStack.Common.Tests/TestsConfig.cs b/tests/ServiceStack.Common.Tests/TestsConfig.cs new file mode 100644 index 00000000000..d72d7091671 --- /dev/null +++ b/tests/ServiceStack.Common.Tests/TestsConfig.cs @@ -0,0 +1,23 @@ +using System; +using Amazon.DynamoDBv2; + +namespace ServiceStack.Common.Tests +{ + public class TestsConfig + { + public static readonly string RabbitMqHost = Environment.GetEnvironmentVariable("CI_RABBITMQ") ?? "localhost"; + + public static readonly string SqlServerConnString = Environment.GetEnvironmentVariable("MSSQL_CONNECTION") ?? "Server=localhost;Database=test;User Id=test;Password=test;"; + public static readonly string PostgreSqlConnString = Environment.GetEnvironmentVariable("PGSQL_CONNECTION") ?? "Server=localhost;Port=5432;User Id=test;Password=test;Database=test;Pooling=true;MinPoolSize=0;MaxPoolSize=200"; + + public static AmazonDynamoDBClient CreateDynamoDBClient() + { + var dynamoClient = new AmazonDynamoDBClient("keyId", "key", new AmazonDynamoDBConfig + { + ServiceURL = Environment.GetEnvironmentVariable("CI_DYNAMODB") ?? "http://localhost:8000", + }); + + return dynamoClient; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/Text/AdhocJsTests.cs b/tests/ServiceStack.Common.Tests/Text/AdhocJsTests.cs index 11616c70e31..b09362202f4 100644 --- a/tests/ServiceStack.Common.Tests/Text/AdhocJsTests.cs +++ b/tests/ServiceStack.Common.Tests/Text/AdhocJsTests.cs @@ -43,7 +43,7 @@ public void Can_Serialize_Array_of_chars() [Test] public void Can_Serialize_Array_with_nulls() { - using (JsConfig.With(includeNullValues:true)) + using (JsConfig.With(new Config { IncludeNullValues = true })) { var t = new { Name = "MyName", @@ -73,7 +73,6 @@ public void Deserialize_array_with_null_elements() { var json = "[{\"Value\": \"a\"},null,{\"Value\": \"b\"}]"; var o = JsonSerializer.DeserializeFromString(json); - o.PrintDump(); } } } \ No newline at end of file diff --git a/tests/ServiceStack.Common.Tests/UrlExtensionTests.cs b/tests/ServiceStack.Common.Tests/UrlExtensionTests.cs index c26835633a8..bfb8d3a7c88 100644 --- a/tests/ServiceStack.Common.Tests/UrlExtensionTests.cs +++ b/tests/ServiceStack.Common.Tests/UrlExtensionTests.cs @@ -24,15 +24,15 @@ public class FallbackJustId : IReturn } [Route("/route/{Id}")] - public class FieldId : IReturn - { - public readonly long Id; + public class FieldId : IReturn + { + public readonly long Id; - public FieldId(long id) - { - Id = id; - } - } + public FieldId(long id) + { + Id = id; + } + } [Route("/route/{Ids}")] public class ArrayIds : IReturn @@ -81,26 +81,42 @@ public class RequestWithNamedDataMembers : IReturn public string Excluded { get; set; } } - public enum Gender - { - None = 0, - Male, - Female - } + public enum Gender + { + None = 0, + Male, + Female + } - [Route("/route/{Id}")] - public class RequestWithValueTypes : IReturn - { - public long Id { get; set; } + [Route("/route/{Id}")] + public class RequestWithValueTypes : IReturn + { + public long Id { get; set; } - public Gender Gender1 { get; set; } + public Gender Gender1 { get; set; } - public Gender? Gender2 { get; set; } - } + public Gender? Gender2 { get; set; } + } + + [Route("/thing/{Id}/point", "POST")] + [DataContract] + public class IdWithAlias : IReturn + { + [DataMember(Name = "id")] + public int Id { get; set; } + } [TestFixture] public class UrlExtensionTests { +#if !NETCORE + [Test] + public void GetLeftAuthority_equals_GetUriPartialAuthority() + { + var uri = new Uri("http://www.domain.org:8080/path/info?query=string"); + Assert.That(uri.GetLeftAuthority(), Is.EqualTo(uri.GetLeftPart(UriPartial.Authority))); + } +#endif [Test] public void Can_create_url_with_JustId() { @@ -129,16 +145,21 @@ public void Can_create_url_with_FallbackJustId() } [Test] - public void Can_create_url_with_FieldId() - { - using (JsConfig.BeginScope()) - { - JsConfig.IncludePublicFields = true; - var url = new FieldId(1).ToUrl("GET"); - Assert.That(url, Is.EqualTo("/route/1")); + public void Can_create_url_with_FieldId() + { + using (JsConfig.With(new ServiceStack.Text.Config { IncludePublicFields = true })) + { + var url = new FieldId(1).ToUrl("GET"); + Assert.That(url, Is.EqualTo("/route/1")); + } + } - } - } + [Test] + public void Can_create_POST_url_with_IdWithAlias() + { + var url = new IdWithAlias { Id = 1 }.ToPostUrl(); + Assert.That(url, Is.EqualTo("/thing/1/point")); + } [Test] public void Can_create_url_with_ArrayIds() @@ -168,40 +189,40 @@ public void Use_data_member_names_on_querystring() Assert.That(url, Is.EqualTo("/route/1?inc=Yes")); } - [Test] - public void Cannot_use_default_for_non_nullable_value_types_on_querystring() - { - var url = new RequestWithValueTypes {Id = 1, Gender1 = Gender.None}.ToUrl("GET"); - Assert.That(url, Is.EqualTo("/route/1")); - } - - [Test] - public void Can_use_non_default_for_non_nullable_value_types_on_querystring() - { - var url = new RequestWithValueTypes { Id = 1, Gender1 = Gender.Male }.ToUrl("GET"); - Assert.That(url, Is.EqualTo("/route/1?gender1=Male")); - } - - [Test] - public void Can_use_default_for_nullable_value_types_on_querystring() - { - var url = new RequestWithValueTypes { Id = 1, Gender2 = Gender.None }.ToUrl("GET"); - Assert.That(url, Is.EqualTo("/route/1?gender2=None")); - } - - [Test] - public void Cannot_use_null_for_nullable_value_types_on_querystring() - { - var url = new RequestWithValueTypes { Id = 1, Gender2 = null }.ToUrl("GET"); - Assert.That(url, Is.EqualTo("/route/1")); - } - - [Test] - public void Can_use_non_default_for_nullable_value_types_on_querystring() - { - var url = new RequestWithValueTypes { Id = 1, Gender2 = Gender.Male }.ToUrl("GET"); - Assert.That(url, Is.EqualTo("/route/1?gender2=Male")); - } + [Test] + public void Cannot_use_default_for_non_nullable_value_types_on_querystring() + { + var url = new RequestWithValueTypes { Id = 1, Gender1 = Gender.None }.ToUrl("GET"); + Assert.That(url, Is.EqualTo("/route/1")); + } + + [Test] + public void Can_use_non_default_for_non_nullable_value_types_on_querystring() + { + var url = new RequestWithValueTypes { Id = 1, Gender1 = Gender.Male }.ToUrl("GET"); + Assert.That(url, Is.EqualTo("/route/1?gender1=Male")); + } + + [Test] + public void Can_use_default_for_nullable_value_types_on_querystring() + { + var url = new RequestWithValueTypes { Id = 1, Gender2 = Gender.None }.ToUrl("GET"); + Assert.That(url, Is.EqualTo("/route/1?gender2=None")); + } + + [Test] + public void Cannot_use_null_for_nullable_value_types_on_querystring() + { + var url = new RequestWithValueTypes { Id = 1, Gender2 = null }.ToUrl("GET"); + Assert.That(url, Is.EqualTo("/route/1")); + } + + [Test] + public void Can_use_non_default_for_nullable_value_types_on_querystring() + { + var url = new RequestWithValueTypes { Id = 1, Gender2 = Gender.Male }.ToUrl("GET"); + Assert.That(url, Is.EqualTo("/route/1?gender2=Male")); + } [Test] public void Can_combine_Uris_with_toUrl() @@ -212,12 +233,12 @@ public void Can_combine_Uris_with_toUrl() Assert.That(new Uri(serviceEndpoint, actionUrl).ToString(), Is.EqualTo("http://localhost/api/route/1")); } - [Test] - public void Can_use_default_for_non_nullable_value_types_on_path() - { - var url = new RequestWithValueTypes { Id = 0 }.ToUrl("GET"); - Assert.That(url, Is.EqualTo("/route/0")); - } + [Test] + public void Can_use_default_for_non_nullable_value_types_on_path() + { + var url = new RequestWithValueTypes { Id = 0 }.ToUrl("GET"); + Assert.That(url, Is.EqualTo("/route/0")); + } [Route("/images/{ImagePath*}")] public class WildCardPath : IReturn diff --git a/tests/ServiceStack.Common.Tests/ValidationTests.cs b/tests/ServiceStack.Common.Tests/ValidationTests.cs index 95ab6b95023..21c2d633e6e 100644 --- a/tests/ServiceStack.Common.Tests/ValidationTests.cs +++ b/tests/ServiceStack.Common.Tests/ValidationTests.cs @@ -1,7 +1,11 @@ -using System.Collections.Generic; +#if !NETCORE_SUPPORT +using System.Collections.Generic; +using System.Linq; using NUnit.Framework; using ServiceStack.FluentValidation; +using ServiceStack.Messaging; using ServiceStack.Testing; +using ServiceStack.Text; using ServiceStack.Validation; namespace ServiceStack.Common.Tests @@ -26,11 +30,13 @@ public DtoBValidator() } } - public class DtoAResponse + public class DtoA : IReturn { + public string FieldA { get; set; } + public List Items { get; set; } } - public class DtoA : IReturn + public class DtoAResponse { public string FieldA { get; set; } public List Items { get; set; } @@ -43,6 +49,14 @@ public class DtoB internal interface IDtoBValidator : IValidator {} + public class DtoAService : Service + { + public object Any(DtoA request) + { + return request.ConvertTo(); + } + } + [TestFixture] public class ValidationTests { @@ -51,19 +65,34 @@ public void Can_register_IDtoBValidator_separately() { using (var appHost = new BasicAppHost { + ConfigureAppHost = host => { + host.RegisterService(); + host.Plugins.Add(new ValidationFeature()); + }, ConfigureContainer = c => { c.RegisterAs(); c.RegisterValidators(typeof(DtoARequestValidator).Assembly); } }.Init()) { - var c = appHost.Container; - var dtoAValidator = (DtoARequestValidator)c.TryResolve>(); + var dtoAValidator = (DtoARequestValidator)appHost.TryResolve>(); Assert.That(dtoAValidator, Is.Not.Null); Assert.That(dtoAValidator.dtoBValidator, Is.Not.Null); - Assert.That(c.TryResolve>(), Is.Not.Null); - Assert.That(c.TryResolve(), Is.Not.Null); + Assert.That(appHost.TryResolve>(), Is.Not.Null); + Assert.That(appHost.TryResolve(), Is.Not.Null); + + var result = dtoAValidator.Validate(new DtoA()); + Assert.That(result.IsValid, Is.False); + Assert.That(result.Errors.Count, Is.EqualTo(1)); + + result = dtoAValidator.Validate(new DtoA { FieldA = "foo", Items = new[] { new DtoB() }.ToList() }); + Assert.That(result.IsValid, Is.False); + Assert.That(result.Errors.Count, Is.EqualTo(1)); + + result = dtoAValidator.Validate(new DtoA { FieldA = "foo", Items = new[] { new DtoB { FieldB = "bar" } }.ToList() }); + Assert.That(result.IsValid, Is.True); } } } -} \ No newline at end of file +} +#endif diff --git a/tests/ServiceStack.Common.Tests/Xlinq/XlinqExtensionsTests.cs b/tests/ServiceStack.Common.Tests/Xlinq/XlinqExtensionsTests.cs index e1d0f66e0c2..0dde88c3db7 100644 --- a/tests/ServiceStack.Common.Tests/Xlinq/XlinqExtensionsTests.cs +++ b/tests/ServiceStack.Common.Tests/Xlinq/XlinqExtensionsTests.cs @@ -1,3 +1,4 @@ +#if !NETCORE_SUPPORT using System; using System.Xml.Linq; using NUnit.Framework; @@ -9,65 +10,67 @@ namespace ServiceStack.Common.Tests.Xlinq { - [TestFixture] - public class XlinqExtensionsTests - { - string xml = "" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""; + [TestFixture] + public class XlinqExtensionsTests + { + string xml = "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""; - public class XmlData : IHasId - { - [AutoIncrement] - public int Id { get; set; } - public string Day { get; set; } - public string Name { get; set; } - public int Time { get; set; } - public int Amount { get; set; } - public decimal Price { get; set; } - } + public class XmlData : IHasId + { + [AutoIncrement] + public int Id { get; set; } + public string Day { get; set; } + public string Name { get; set; } + public int Time { get; set; } + public int Amount { get; set; } + public decimal Price { get; set; } + } - [Test] - public void Insert_data_from_xml_into_db() - { - //OrmLiteConfig.DialectProvider = SqlServerOrmLiteDialectProvider.Instance; - OrmLiteConfig.DialectProvider = SqliteOrmLiteDialectProvider.Instance; + [Test] + public void Insert_data_from_xml_into_db() + { + //OrmLiteConfig.DialectProvider = SqlServerOrmLiteDialectProvider.Instance; + OrmLiteConfig.DialectProvider = SqliteOrmLiteDialectProvider.Instance; - var element2 = XElement.Parse(xml).AnyElement("Body").AnyElement("Element1").AnyElement("Element2"); + var element2 = XElement.Parse(xml).AnyElement("Body").AnyElement("Element1").AnyElement("Element2"); - using (var db = ":memory:".OpenDbConnection()) - { - db.CreateTable(true); - foreach (var element3 in element2.AllElements("Element3")) - { - var xmlData = new XmlData { - Day = element2.AnyAttribute("day").Value, - Name = element3.AnyAttribute("name").Value, - Time = int.Parse(element3.FirstElement().AnyAttribute("time").Value), - Amount = int.Parse(element3.FirstElement().FirstElement().AnyAttribute("amount").Value), - Price = decimal.Parse(element3.FirstElement().FirstElement().AnyAttribute("price").Value), - }; - db.Insert(xmlData); - } - db.Select().ForEach(x => Console.WriteLine(TypeSerializer.SerializeToString(x))); - } - } + using (var db = ":memory:".OpenDbConnection()) + { + db.CreateTable(true); + foreach (var element3 in element2.AllElements("Element3")) + { + var xmlData = new XmlData + { + Day = element2.AnyAttribute("day").Value, + Name = element3.AnyAttribute("name").Value, + Time = int.Parse(element3.FirstElement().AnyAttribute("time").Value), + Amount = int.Parse(element3.FirstElement().FirstElement().AnyAttribute("amount").Value), + Price = decimal.Parse(element3.FirstElement().FirstElement().AnyAttribute("price").Value), + }; + db.Insert(xmlData); + } + db.Select().ForEach(x => Console.WriteLine(TypeSerializer.SerializeToString(x))); + } + } - } -} \ No newline at end of file + } +} +#endif diff --git a/tests/ServiceStack.Common.Tests/app.config b/tests/ServiceStack.Common.Tests/app.config deleted file mode 100644 index 3e05c78c7aa..00000000000 --- a/tests/ServiceStack.Common.Tests/app.config +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/ServiceStack.Common.Tests/ci.app.config b/tests/ServiceStack.Common.Tests/ci.app.config deleted file mode 100644 index 26173945e37..00000000000 --- a/tests/ServiceStack.Common.Tests/ci.app.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/tests/ServiceStack.Common.Tests/packages.config b/tests/ServiceStack.Common.Tests/packages.config deleted file mode 100644 index a2bd85ed95d..00000000000 --- a/tests/ServiceStack.Common.Tests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/tests/ServiceStack.Core.SelfHostTests/AsyncRestClientTests.cs b/tests/ServiceStack.Core.SelfHostTests/AsyncRestClientTests.cs new file mode 100644 index 00000000000..b6fa79cbb55 --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/AsyncRestClientTests.cs @@ -0,0 +1,234 @@ +//TODO: fix test failures when running on Linux build agent +#if NETCORE + +using System; +using System.IO; +using System.Net; +using System.Threading.Tasks; +using NUnit.Framework; +using RestFiles.ServiceModel; +using ServiceStack; + +/* For syntax highlighting and better readability of this file, view it on GitHub: + * https://github.com/ServiceStack/ServiceStack.Examples/blob/master/src/RestFiles/RestFiles.Tests/AsyncRestClientTests.cs + */ + +namespace RestFiles.Tests +{ + /// + /// These test show how you can call ServiceStack REST web services asynchronously using an IRestClientAsync. + /// + /// Async service calls are a great for GUI apps as they can be called without blocking the UI thread. + /// They are also great for performance as no time is spent on blocking IO calls. + /// + [TestFixture] + public class AsyncRestClientTests + { + public const string WebServiceHostUrl = "http://localhost:8080/"; + private const string ReadmeFileContents = "THIS IS A README FILE"; + private const string ReplacedFileContents = "THIS README FILE HAS BEEN REPLACED"; + private const string TestUploadFileContents = "THIS FILE IS USED FOR UPLOADING IN TESTS"; + public string FilesRootDir; + + ServiceStackHost appHost; + + [OneTimeSetUp] + public void TextFixtureSetUp() + { + appHost = new TestAppHost() + .Init() + .Start(TestAppHost.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() => appHost.Dispose(); + + [SetUp] + public void OnBeforeEachTest() + { + //Setup the files directory with some test files and folders + FilesRootDir = appHost.MapProjectPath("~/App_Data/files/"); + if (Directory.Exists(FilesRootDir)) + { + Directory.Delete(FilesRootDir, true); + } + Directory.CreateDirectory(FilesRootDir + "SubFolder"); + Directory.CreateDirectory(FilesRootDir + "SubFolder2"); + File.WriteAllText(Path.Combine(FilesRootDir, "README.txt"), ReadmeFileContents); + File.WriteAllText(Path.Combine(FilesRootDir, "TESTUPLOAD.txt"), TestUploadFileContents); + } + + public IRestClientAsync CreateAsyncRestClient() + { + return new JsonServiceClient(WebServiceHostUrl); //Best choice for Ajax web apps, faster than XML + //return new XmlServiceClient(WebServiceHostUrl); //Ubiquitous structured data format best for supporting non .NET clients + //return new JsvServiceClient(WebServiceHostUrl); //Fastest, most compact and resilient format great for .NET to .NET client / server + } + + private static void FailOnAsyncError(T response, Exception ex) + { + Assert.Fail(ex.Message); + } + + [Test] + public async Task Can_GetAsync_to_retrieve_existing_file() + { + var restClient = CreateAsyncRestClient(); + + var response = await restClient.GetAsync("files/README.txt"); + + Assert.That(response.File.Contents, Is.EqualTo("THIS IS A README FILE")); + } + + [Test] + public async Task Can_GetAsync_to_retrieve_existing_folder_listing() + { + var restClient = CreateAsyncRestClient(); + + var response = await restClient.GetAsync("files/"); + + Assert.That(response.Directory.Folders.Count, Is.EqualTo(2)); + Assert.That(response.Directory.Files.Count, Is.EqualTo(2)); + } + + [Test] + public void Can_WebRequest_POST_upload_file_to_save_new_file_and_create_new_Directory() + { + var webRequest = WebRequest.Create(WebServiceHostUrl + "files/UploadedFiles/"); + + var fileToUpload = new FileInfo(FilesRootDir + "TESTUPLOAD.txt"); + using (var stream = fileToUpload.OpenRead()) + { + webRequest.UploadFile(stream, fileToUpload.Name); + var webRes = PclExport.Instance.GetResponse(webRequest); + } + + Assert.That(Directory.Exists(FilesRootDir + "UploadedFiles")); + Assert.That(File.ReadAllText(FilesRootDir + "UploadedFiles/TESTUPLOAD.txt"), + Is.EqualTo(TestUploadFileContents)); + } + + [Test] + public void Can_RestClient_POST_upload_file_to_save_new_file_and_create_new_Directory() + { + var restClient = (IRestClient)CreateAsyncRestClient(); + + var fileToUpload = new FileInfo(FilesRootDir + "TESTUPLOAD.txt"); + restClient.PostFile("files/UploadedFiles/", + fileToUpload, MimeTypes.GetMimeType(fileToUpload.Name)); + + Assert.That(Directory.Exists(FilesRootDir + "UploadedFiles")); + Assert.That(File.ReadAllText(FilesRootDir + "UploadedFiles/TESTUPLOAD.txt"), + Is.EqualTo(TestUploadFileContents)); + } + + [Test] + public async Task Can_PutAsync_to_replace_text_content_of_an_existing_file() + { + var restClient = CreateAsyncRestClient(); + + var response = await restClient.PutAsync("files/README.txt", + new Files { TextContents = ReplacedFileContents }); + + Assert.That(File.ReadAllText(FilesRootDir + "README.txt"), + Is.EqualTo(ReplacedFileContents)); + } + + [Test] + public async Task Can_DeleteAsync_to_replace_text_content_of_an_existing_file() + { + var restClient = CreateAsyncRestClient(); + + var response = await restClient.DeleteAsync("files/README.txt"); + + Assert.That(!File.Exists(FilesRootDir + "README.txt")); + } + + + /* + * Error Handling Tests + */ + [Test] + public async Task GET_a_file_that_doesnt_exist_throws_a_404_FileNotFoundException() + { + var restClient = CreateAsyncRestClient(); + + try + { + await restClient.GetAsync("files/UnknownFolder"); + } + catch (WebServiceException webEx) + { + var response = (FilesResponse)webEx.ResponseDto; + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(FileNotFoundException).Name)); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("Could not find: UnknownFolder")); + } + } + + [Test] + public async Task POST_to_an_existing_file_throws_a_500_NotSupportedException() + { + var restClient = (IRestClient)CreateAsyncRestClient(); + + var fileToUpload = new FileInfo(FilesRootDir + "TESTUPLOAD.txt"); + + try + { + var response = restClient.PostFile("files/README.txt", + fileToUpload, MimeTypes.GetMimeType(fileToUpload.Name)); + + Assert.Fail("Should fail with NotSupportedException"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(405)); + var response = (FilesResponse)webEx.ResponseDto; + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(NotSupportedException).Name)); + Assert.That(response.ResponseStatus.Message, + Is.EqualTo("POST only supports uploading new files. Use PUT to replace contents of an existing file")); + } + } + + [Test] + public async Task PUT_to_replace_a_non_existing_file_throws_404() + { + var restClient = CreateAsyncRestClient(); + + try + { + await restClient.PutAsync("files/non-existing-file.txt", + new Files { TextContents = ReplacedFileContents }); + } + catch (WebServiceException webEx) + { + var response = (FilesResponse)webEx.ResponseDto; + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(FileNotFoundException).Name)); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("Could not find: non-existing-file.txt")); + } + } + + [Test] + public async Task DELETE_a_non_existing_file_throws_404() + { + var restClient = CreateAsyncRestClient(); + + try + { + await restClient.DeleteAsync("files/non-existing-file.txt"); + } + catch (WebServiceException webEx) + { + var response = (FilesResponse)webEx.ResponseDto; + + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(FileNotFoundException).Name)); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("Could not find: non-existing-file.txt")); + } + } + + } +} + +#endif diff --git a/tests/ServiceStack.Core.SelfHostTests/BasicSelfHostTest.cs b/tests/ServiceStack.Core.SelfHostTests/BasicSelfHostTest.cs new file mode 100644 index 00000000000..0dec1c23a6a --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/BasicSelfHostTest.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.Core.SelfHostTests +{ + public class Hello : IReturn + { + public string Name { get; set; } + } + + public class HelloResponse + { + public string Result { get; set; } + } + + public class BasicHostServices : Service + { + public object Any(Hello request) => + new HelloResponse { Result = $"Hello, {request.Name}!" }; + } + + [TestFixture] + public class BasicSelfHostTest + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base("Basic SelfHost test", typeof(BasicHostServices).GetAssembly()) { } + + public override void Configure(Container container) + { + } + } + + private readonly ServiceStackHost appHost; + + public BasicSelfHostTest() + { + appHost = new AppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Can_run_basic_SelfHost() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + var response = client.Get(new Hello { Name = "AppSelfHostBase" }); + + Assert.That(response.Result, Is.EqualTo("Hello, AppSelfHostBase!")); + } + + } +} diff --git a/tests/ServiceStack.Core.SelfHostTests/CachedServiceTests.cs b/tests/ServiceStack.Core.SelfHostTests/CachedServiceTests.cs new file mode 100644 index 00000000000..97a8fa2171c --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/CachedServiceTests.cs @@ -0,0 +1,109 @@ +using System.Reflection; +using System.Runtime.Serialization; +using Funq; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using RazorRockstars; +using ServiceStack; +using ServiceStack.Data; +using ServiceStack.OrmLite; + +namespace ServiceStack.Core.SelfHostTests +{ + [DataContract] + [Route("/cached/rockstars/gateway")] + public class CachedRockstarsGateway : IGet, IReturn { } + + [DataContract] + [Route("/cached/rockstars")] + public class CachedRockstars : IGet, IReturn { } + + [CacheResponse(Duration = 60 * 60, MaxAge = 30 * 60)] + public class CachedServices : Service + { + public object Get(CachedRockstarsGateway request) => + Gateway.Send(new SearchRockstars()); + + public object Get(CachedRockstars request) => + new RockstarsResponse { + Total = Db.Scalar("select count(*) from Rockstar"), + Results = Db.Select() + }; + } + + [TestFixture] + public class CachedServiceTests + { + private ServiceStackHost appHost; + + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(CachedServiceTests), typeof(CachedServices).GetAssembly()) {} + + public override void Configure(Container container) + { + container.AddSingleton( + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + using (var db = container.GetService().Open()) + { + db.CreateTableIfNotExists(); + db.InsertAll(RockstarsService.SeedData); + } + } + } + + public CachedServiceTests() + { + appHost = new AppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + protected virtual IServiceClient CreateClient() => + new JsonServiceClient(Config.AbsoluteBaseUri); + + [Test] + public void Can_call_cached_Service() + { + appHost.GetCacheClient().FlushAll(); + + var client = CreateClient(); + + var response = client.Get(new CachedRockstars()); + Assert.That(response.Total, Is.EqualTo(RockstarsService.SeedData.Length)); + Assert.That(response.Results.Count, Is.EqualTo(RockstarsService.SeedData.Length)); + } + + [Test] + public void Can_call_cached_Service_via_Gateway() + { + appHost.GetCacheClient().FlushAll(); + + var client = CreateClient(); + + var response = client.Get(new CachedRockstarsGateway()); + Assert.That(response.Total, Is.EqualTo(RockstarsService.SeedData.Length)); + Assert.That(response.Results.Count, Is.EqualTo(RockstarsService.SeedData.Length)); + } + + [Test] + public void Does_return_same_response_from_multiple_cached_calls() + { + appHost.GetCacheClient().FlushAll(); + + var url = Config.AbsoluteBaseUri.CombineWith(new CachedRockstars().ToGetUrl()); + var originalBytes = url.GetBytesFromUrl(); + + for (var i = 0; i < 3; i++) + { + var fromCacheBytes = url.GetBytesFromUrl(); + + Assert.That(fromCacheBytes, Is.EqualTo(originalBytes)); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Core.SelfHostTests/Config.cs b/tests/ServiceStack.Core.SelfHostTests/Config.cs new file mode 100644 index 00000000000..6f194e0629c --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/Config.cs @@ -0,0 +1,12 @@ +namespace ServiceStack.Core.SelfHostTests +{ + public class Config + { + public const string ServiceStackBaseUri = "http://localhost:20000"; + public const string AbsoluteBaseUri = ServiceStackBaseUri + "/"; + public const string ListeningOn = ServiceStackBaseUri + "/"; + + public const string AspNetBaseUri = "http://localhost:50000/"; + public const string AspNetServiceStackBaseUri = AspNetBaseUri + "api"; + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Core.SelfHostTests/CustomerRestExample.cs b/tests/ServiceStack.Core.SelfHostTests/CustomerRestExample.cs new file mode 100644 index 00000000000..37667e17b9b --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/CustomerRestExample.cs @@ -0,0 +1,157 @@ +using System.Collections.Generic; +using Funq; +using NUnit.Framework; +using ServiceStack; +using ServiceStack.Data; +using ServiceStack.DataAnnotations; +using ServiceStack.OrmLite; + +namespace NewApi.Customers +{ + public class AppHost : AppSelfHostBase + { + public AppHost() : base("Customer REST Example", typeof(CustomerService).GetAssembly()) { } + + public override void Configure(Container container) + { + container.Register(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + using (var db = container.Resolve().Open()) + { + db.CreateTableIfNotExists(); + } + } + } + + [Route("/customers", "GET")] + public class GetCustomers : IReturn { } + + public class GetCustomersResponse + { + public List Results { get; set; } + } + + [Route("/customers/{Id}", "GET")] + public class GetCustomer : IReturn + { + public int Id { get; set; } + } + + [Route("/customers", "POST")] + public class CreateCustomer : IReturn + { + public string Name { get; set; } + } + + [Route("/customers/{Id}", "PUT")] + public class UpdateCustomer : IReturn + { + public int Id { get; set; } + + public string Name { get; set; } + } + + [Route("/customers/{Id}", "DELETE")] + public class DeleteCustomer : IReturnVoid + { + public int Id { get; set; } + } + + public class Customer + { + [AutoIncrement] + public int Id { get; set; } + + public string Name { get; set; } + } + + public class CustomerService : Service + { + public object Get(GetCustomers request) + { + return new GetCustomersResponse { Results = Db.Select() }; + } + + public object Get(GetCustomer request) + { + return Db.SingleById(request.Id); + } + + public object Post(CreateCustomer request) + { + var customer = new Customer { Name = request.Name }; + Db.Save(customer); + return customer; + } + + public object Put(UpdateCustomer request) + { + var customer = Db.SingleById(request.Id); + if (customer == null) + throw HttpError.NotFound("Customer '{0}' does not exist".Fmt(request.Id)); + + customer.Name = request.Name; + Db.Update(customer); + + return customer; + } + + public void Delete(DeleteCustomer request) + { + Db.DeleteById(request.Id); + } + } + + + [TestFixture] + public class CustomerRestExample + { + const string BaseUri = "http://localhost:1337/"; + + ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = new AppHost() + .Init() + .Start(BaseUri); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() => appHost.Dispose(); + + [Test] + public void Run_Customer_REST_Example() + { + var client = new JsonServiceClient(BaseUri); + + //GET /customers + var all = client.Get(new GetCustomers()); + Assert.That(all.Results.Count, Is.EqualTo(0)); + + //POST /customers + var customer = client.Post(new CreateCustomer { Name = "Foo" }); + Assert.That(customer.Id, Is.EqualTo(1)); + //GET /customer/1 + customer = client.Get(new GetCustomer { Id = customer.Id }); + Assert.That(customer.Name, Is.EqualTo("Foo")); + + //GET /customers + all = client.Get(new GetCustomers()); + Assert.That(all.Results.Count, Is.EqualTo(1)); + + //PUT /customers/1 + customer = client.Put(new UpdateCustomer { Id = customer.Id, Name = "Bar" }); + Assert.That(customer.Name, Is.EqualTo("Bar")); + + //DELETE /customers/1 + client.Delete(new DeleteCustomer { Id = customer.Id }); + //GET /customers + all = client.Get(new GetCustomers()); + Assert.That(all.Results.Count, Is.EqualTo(0)); + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.Core.SelfHostTests/NetCoreIntegrationTests.cs b/tests/ServiceStack.Core.SelfHostTests/NetCoreIntegrationTests.cs new file mode 100644 index 00000000000..9962467c956 --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/NetCoreIntegrationTests.cs @@ -0,0 +1,324 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Internal; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Http.Extensions; +using Microsoft.AspNetCore.Http.Internal; +using Microsoft.Extensions.Primitives; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.Core.SelfHostTests +{ + public interface IDep + { + int Count { get; } + Dep Dep { get; } + } + public class Dep + { + private static int count; + public int Count => count; + public Dep() { count++; } + } + + public interface INetCoreSingleton : IDep { } + public class NetCoreSingleton : INetCoreSingleton + { + private static int count; + public int Count => count; + public NetCoreSingleton(Dep dep) //.NET Core forcing code-bloat + { + count++; + Dep = dep; + } + public Dep Dep { get; set; } + } + + public interface INetCoreScoped : IDep { } + public class NetCoreScoped : INetCoreScoped + { + internal static int count; + public int Count => count; + public NetCoreScoped(Dep dep) + { + count++; + Dep = dep; + } + public Dep Dep { get; set; } + } + + public class NetCoreScopedRequest + { + internal static int count; + public int Count => count; + public NetCoreScopedRequest(Dep dep) + { + count++; + Dep = dep; + } + public Dep Dep { get; set; } + } + + public interface INetCoreTransient : IDep { } + public class NetCoreTransient : INetCoreTransient + { + private static int count; + public int Count => count; + public NetCoreTransient(Dep dep) + { + count++; + Dep = dep; + } + public Dep Dep { get; set; } + } + + public class NetCoreInstance : IDep + { + private static int count; + public int Count => count; + public NetCoreInstance() { count++; } + public Dep Dep { get; set; } + } + + public interface IFunqSingleton : IDep { } + public class FunqSingleton : IFunqSingleton + { + private static int count; + public int Count => count; + public FunqSingleton() { count++; } + public Dep Dep { get; set; } + } + + public interface IFunqScoped : IDep { } + public class FunqScoped : IFunqScoped + { + private static int count; + public int Count => count; + public FunqScoped() { count++; } + public Dep Dep { get; set; } + } + + public interface IFunqTransient : IDep { } + public class FunqTransient : IFunqTransient + { + private static int count; + public int Count => count; + public FunqTransient() { count++; } + public Dep Dep { get; set; } + } + + public class FunqInstance : IDep + { + private static int count; + public int Count => count; + public FunqInstance() { count++; } + public Dep Dep { get; set; } + } + + [TestFixture] + public class NetCoreIntegrationTests + { + public class Startup + { + public void ConfigureServices(IServiceCollection services) + { + services.AddSingleton() + .AddSingleton(new NetCoreInstance()) + .AddScoped() + .AddScoped() + .AddTransient() + .AddTransient(); + } + + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + { + loggerFactory.AddConsole(); + + app.UseServiceStack(new AppHost()); + + app.Run(async context => + { + context.Request.EnableRewind(); + await context.Response.WriteAsync("Hello World!!!"); + }); + } + } + + public class Ioc : IReturn + { + public string Name { get; set; } + } + + public class IocResponse + { + public Dictionary Results { get; set; } + } + + public class IocServices : Service + { + public INetCoreSingleton NetCoreSingleton { get; set; } + public NetCoreInstance NetCoreInstance { get; set; } + public INetCoreScoped NetCoreScoped { get; set; } + public INetCoreTransient NetCoreTransient { get; set; } + + public IFunqSingleton FunqSingleton { get; set; } + public FunqInstance FunqInstance { get; set; } + public IFunqScoped FunqScoped { get; set; } + public IFunqTransient FunqTransient { get; set; } + + public object Any(Ioc request) + { + if (NetCoreSingleton == null) + throw new ArgumentNullException(nameof(NetCoreSingleton)); + if (NetCoreInstance == null) + throw new ArgumentNullException(nameof(NetCoreInstance)); + if (NetCoreScoped == null) + throw new ArgumentNullException(nameof(NetCoreScoped)); + if (NetCoreTransient == null) + throw new ArgumentNullException(nameof(NetCoreTransient)); + + if (NetCoreSingleton.Dep == null) + throw new ArgumentException(nameof(NetCoreSingleton), "!Dep"); + if (NetCoreInstance.Dep != null) + throw new ArgumentException(nameof(NetCoreInstance), "Dep"); + if (NetCoreScoped.Dep == null) + throw new ArgumentException(nameof(NetCoreScoped), "!Dep"); + if (NetCoreTransient.Dep == null) + throw new ArgumentException(nameof(NetCoreTransient), "!Dep"); + + if (FunqSingleton == null) + throw new ArgumentNullException(nameof(FunqSingleton)); + if (FunqInstance == null) + throw new ArgumentNullException(nameof(FunqInstance)); + if (FunqScoped == null) + throw new ArgumentNullException(nameof(FunqScoped)); + if (FunqTransient == null) + throw new ArgumentNullException(nameof(FunqTransient)); + + if (FunqSingleton.Dep == null) + throw new ArgumentException(nameof(FunqSingleton), "!Dep"); + if (FunqInstance.Dep != null) + throw new ArgumentException(nameof(FunqInstance), "Dep"); + if (FunqScoped.Dep == null) + throw new ArgumentException(nameof(FunqScoped), "!Dep"); + if (FunqTransient.Dep == null) + throw new ArgumentException(nameof(FunqTransient), "!Dep"); + + var netCoreRequestScope = Request.TryResolve(); + if (netCoreRequestScope.Dep == null) + throw new ArgumentException(nameof(netCoreRequestScope), "!Dep"); + + return new IocResponse + { + Results = new Dictionary + { + { "NetCoreSingleton", NetCoreSingleton.Count }, + { "NetCoreInstance", NetCoreInstance.Count }, + { "NetCoreScoped", NetCoreScoped.Count }, + { "NetCoreTransient", NetCoreTransient.Count }, + { "FunqSingleton", FunqSingleton.Count }, + { "FunqInstance", FunqInstance.Count }, + { "FunqScoped", FunqScoped.Count }, + { "FunqTransient", FunqTransient.Count }, + { "NetCoreScopedRequest", netCoreRequestScope.Count }, + } + }; + } + } + + public class AppHost : AppHostBase + { + public AppHost() + : base(".NET Core Test", typeof(IocServices).GetAssembly()) { } + + public override void Configure(Container container) + { + container.AddSingleton() + .AddSingleton(new FunqInstance()) + .AddScoped() + .AddTransient(); + } + } + + class ReqeustScopeStartup + { + public void ConfigureServices(IServiceCollection services) + { + services.AddScoped() + .AddTransient(); + } + + public void Configure(IApplicationBuilder app) + { + app.Use((ctx, next) => + { + var dep = ctx.RequestServices.GetService(); + //var dep = app.ApplicationServices.GetService(); //Request Scope doesn't work here + ctx.Response.Body.Write($"Count: {dep.Count}"); + return Task.FromResult(0); + }); + } + } + + [Test] + public void Does_return_new_Scoped_dependency_per_request() + { + using (var host = new WebHostBuilder() + .UseKestrel() + .UseStartup() + .UseUrls(Config.AbsoluteBaseUri) + .Build()) + { + host.Start(); + + 5.Times(i => Config.AbsoluteBaseUri.GetStringFromUrl()); + + Assert.That(NetCoreScoped.count, Is.GreaterThanOrEqualTo(5)); + } + } + + [Test] + public void Does_resolve_deps_in_ConfigureServices() + { + using (var host = new WebHostBuilder() + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseStartup() + .UseUrls(Config.AbsoluteBaseUri) + .Build()) + { + host.Start(); + + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + var response = client.Get(new Ioc()); + Assert.That(response.Results.Count, Is.EqualTo(9)); + Assert.That(response.Results.Values.ToList().All(x => x == 1)); + + 4.Times(i => response = client.Get(new Ioc())); + + Assert.That(response.Results.Where(x => x.Key.EndsWith("Singleton")).All(e => e.Value == 1)); + Assert.That(response.Results.Where(x => x.Key.EndsWith("Instance")).All(e => e.Value == 1)); + + //Should really be 5 but because deps are resolved for app.ApplicationServices instead of + //request.RequestServices request scoped deps behave like a singleton + Assert.That(response.Results["NetCoreScoped"], Is.EqualTo(1)); + + Assert.That(response.Results["NetCoreScopedRequest"], Is.EqualTo(5)); + Assert.That(response.Results["FunqScoped"], Is.EqualTo(5)); + Assert.That(response.Results.Where(x => x.Key.EndsWith("Transient")).All(e => e.Value == 5)); + + HostContext.AppHost.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Core.SelfHostTests/Properties/AssemblyInfo.cs b/tests/ServiceStack.Core.SelfHostTests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..0401d5c26fa --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ServiceStack.Core.SelfHostTests")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("97002c10-48c4-4711-961b-f3e3d4fc3e4e")] diff --git a/tests/ServiceStack.Core.SelfHostTests/RestFilesServices.cs b/tests/ServiceStack.Core.SelfHostTests/RestFilesServices.cs new file mode 100644 index 00000000000..e4973689932 --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/RestFilesServices.cs @@ -0,0 +1,225 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using RestFiles.ServiceModel; +using RestFiles.ServiceModel.Types; +using ServiceStack; +using ServiceStack.IO; + +namespace RestFiles.ServiceModel +{ + [Route("/files")] + [Route("/files/{Path*}")] + public class Files + { + public string Path { get; set; } + public string TextContents { get; set; } + public bool ForDownload { get; set; } + } + + /// + /// Define your ServiceStack web service response (i.e. Response DTO). + /// + public class FilesResponse : IHasResponseStatus + { + public FolderResult Directory { get; set; } + public FileResult File { get; set; } + + /// + /// Gets or sets the ResponseStatus. The built-in IoC used with ServiceStack autowires this property. + /// + public ResponseStatus ResponseStatus { get; set; } + } +} + +namespace RestFiles.ServiceModel.Types +{ + public class File + { + public string Name { get; set; } + public string Extension { get; set; } + public long FileSizeBytes { get; set; } + public DateTime ModifiedDate { get; set; } + public bool IsTextFile { get; set; } + } + + public class FileResult + { + public string Name { get; set; } + public string Extension { get; set; } + public long FileSizeBytes { get; set; } + public DateTime ModifiedDate { get; set; } + public bool IsTextFile { get; set; } + public string Contents { get; set; } + } + public class Folder + { + public string Name { get; set; } + public DateTime ModifiedDate { get; set; } + public int FileCount { get; set; } + } + public class FolderResult + { + public FolderResult() + { + Folders = new List(); + Files = new List(); + } + + public List Folders { get; set; } + public List Files { get; set; } + } +} + +namespace RestFiles.ServiceInterface +{ + public class AppConfig + { + public string RootDirectory { get; set; } + + public List TextFileExtensions { get; set; } + + public List ExcludeDirectories { get; set; } + } + + /// + /// Define your ServiceStack web service request (i.e. Request DTO). + /// + public class FilesService : Service + { + public AppConfig Config { get; set; } + + public object Get(Files request) + { + var targetPath = GetAndValidateExistingPath(request); + + var isDirectory = VirtualFiles.IsDirectory(targetPath); + + if (!isDirectory && request.ForDownload) + return new HttpResult(VirtualFiles.GetFile(targetPath), asAttachment: true); + + var response = isDirectory + ? new FilesResponse { Directory = GetFolderResult(targetPath) } + : new FilesResponse { File = GetFileResult(targetPath) }; + + return response; + } + + public object Post(Files request) + { + var targetDir = GetPath(request); + + if (VirtualFiles.IsFile(targetDir)) + throw new NotSupportedException( + "POST only supports uploading new files. Use PUT to replace contents of an existing file"); + + foreach (var uploadedFile in base.Request.Files) + { + var newFilePath = targetDir.CombineWith(uploadedFile.FileName); + VirtualFiles.WriteFile(newFilePath, uploadedFile.InputStream); + } + + return new FilesResponse(); + } + + public void Put(Files request) + { + var targetFile = VirtualFiles.GetFile(GetAndValidateExistingPath(request)); + + if (!Config.TextFileExtensions.Contains(targetFile.Extension)) + throw new NotSupportedException("PUT Can only update text files, not: " + targetFile.Extension); + + if (request.TextContents == null) + throw new ArgumentNullException("TextContents"); + + VirtualFiles.WriteFile(targetFile.VirtualPath, request.TextContents); + } + + public void Delete(Files request) + { + var targetFile = GetAndValidateExistingPath(request); + VirtualFiles.DeleteFile(targetFile); + } + + private FolderResult GetFolderResult(string targetPath) + { + var result = new FolderResult(); + + var dir = VirtualFiles.GetDirectory(targetPath); + foreach (var subDir in dir.Directories) + { + if (Config.ExcludeDirectories.Contains(subDir.Name)) continue; + + result.Folders.Add(new Folder + { + Name = subDir.Name, + ModifiedDate = subDir.LastModified, + FileCount = subDir.GetFiles().Count(), + }); + } + + foreach (var fileInfo in dir.GetFiles()) + { + result.Files.Add(new ServiceModel.Types.File + { + Name = fileInfo.Name, + Extension = fileInfo.Extension, + FileSizeBytes = fileInfo.Length, + ModifiedDate = fileInfo.LastModified, + IsTextFile = Config.TextFileExtensions.Contains(fileInfo.Extension), + }); + } + + return result; + } + + private string GetPath(Files request) + { + return Config.RootDirectory.CombineWith(GetSafePath(request.Path)); + } + + private string GetAndValidateExistingPath(Files request) + { + var targetPath = GetPath(request); + if (!VirtualFiles.IsFile(targetPath) && !VirtualFiles.IsDirectory(targetPath)) + throw new HttpError(HttpStatusCode.NotFound, new FileNotFoundException("Could not find: " + request.Path)); + + return targetPath; + } + + private FileResult GetFileResult(string filePath) + { + var file = VirtualFiles.GetFile(filePath); + var isTextFile = Config.TextFileExtensions.Contains(file.Extension); + + return new FileResult + { + Name = file.Name, + Extension = file.Extension, + FileSizeBytes = file.Length, + IsTextFile = isTextFile, + Contents = isTextFile ? VirtualFiles.GetFile(file.VirtualPath).ReadAllText() : null, + ModifiedDate = file.LastModified, + }; + } + + public static string GetSafePath(string filePath) + { + if (string.IsNullOrEmpty(filePath)) return string.Empty; + + //Strip invalid chars + foreach (var invalidChar in Path.GetInvalidPathChars()) + { + filePath = filePath.Replace(invalidChar.ToString(), string.Empty); + } + + return filePath + .TrimStart('.', '/', '\\') //Remove illegal chars at the start + .Replace('\\', '/') //Switch all to use the same seperator + .Replace("../", string.Empty) //Remove access to top-level directories anywhere else + .Replace('/', Path.DirectorySeparatorChar); //Switch all to use the OS seperator + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Core.SelfHostTests/RockstarsService.cs b/tests/ServiceStack.Core.SelfHostTests/RockstarsService.cs new file mode 100644 index 00000000000..e339e471807 --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/RockstarsService.cs @@ -0,0 +1,107 @@ +using System.Collections.Generic; +using ServiceStack; +using ServiceStack.DataAnnotations; +using ServiceStack.OrmLite; +using ServiceStack.Text; + +namespace RazorRockstars +{ + [Route("/rockstars")] + [Route("/rockstars/{Id}")] + [Route("/rockstars/aged/{Age}")] + public class SearchRockstars : IReturn + { + public int? Age { get; set; } + public int Id { get; set; } + } + + [Route("/rockstars/delete/{Id}")] + public class DeleteRockstar + { + public int Id { get; set; } + } + + [Route("/reset")] + public class ResetRockstars { } + + [Csv(CsvBehavior.FirstEnumerable)] + public class RockstarsResponse + { + public int Total { get; set; } + public int? Aged { get; set; } + public List Results { get; set; } + } + + //Poco Data Model for OrmLite + SeedData + [Route("/rockstars", "POST")] + public class Rockstar + { + [AutoIncrement] + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public int? Age { get; set; } + public bool Alive { get; set; } + + public string Url => "/stars/{0}/{1}/".Fmt(Alive ? "alive" : "dead", LastName.ToLower()); + + public Rockstar() { } + public Rockstar(int id, string firstName, string lastName, int age, bool alive) + { + Id = id; + FirstName = firstName; + LastName = lastName; + Age = age; + Alive = alive; + } + } + + [ClientCanSwapTemplates] + [DefaultView("Rockstars")] + public class RockstarsService : Service + { + public static Rockstar[] SeedData = new[] { + new Rockstar(1, "Jimi", "Hendrix", 27, false), + new Rockstar(2, "Janis", "Joplin", 27, false), + new Rockstar(4, "Kurt", "Cobain", 27, false), + new Rockstar(5, "Elvis", "Presley", 42, false), + new Rockstar(6, "Michael", "Jackson", 50, false), + new Rockstar(7, "Eddie", "Vedder", 47, true), + new Rockstar(8, "Dave", "Grohl", 43, true), + new Rockstar(9, "Courtney", "Love", 48, true), + new Rockstar(10, "Bruce", "Springsteen", 62, true), + }; + + public object Get(SearchRockstars request) + { + return new RockstarsResponse { + Aged = request.Age, + Total = Db.Scalar("select count(*) from Rockstar"), + Results = request.Id != default(int) + ? Db.Select(q => q.Id == request.Id) + : request.Age.HasValue + ? Db.Select(q => q.Age == request.Age.Value) + : Db.Select() + }; + } + + public object Any(DeleteRockstar request) + { + Db.DeleteById(request.Id); + return Get(new SearchRockstars()); + } + + public object Post(Rockstar request) + { + Db.Insert(request); + return Get(new SearchRockstars()); + } + + public object Any(ResetRockstars request) + { + Db.DropAndCreateTable(); + Db.InsertAll(SeedData); + return Get(new SearchRockstars()); + } + } +} diff --git a/tests/ServiceStack.Core.SelfHostTests/ServiceStack.Core.SelfHostTests.csproj b/tests/ServiceStack.Core.SelfHostTests/ServiceStack.Core.SelfHostTests.csproj new file mode 100644 index 00000000000..f8944cef53d --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/ServiceStack.Core.SelfHostTests.csproj @@ -0,0 +1,46 @@ + + + + netcoreapp1.1 + portable + ServiceStack.Core.SelfHostTests + Library + ServiceStack.Core.SelfHostTests + aspnet-ServiceStack.Core.SelfHostTests-20161005100548 + 1.1.1 + $(PackageTargetFallback);dnxcore50 + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + $(DefineConstants);NETCORE_SUPPORT;NETCORE + + + + + + + diff --git a/tests/ServiceStack.Core.SelfHostTests/SyncRestClientTests.cs b/tests/ServiceStack.Core.SelfHostTests/SyncRestClientTests.cs new file mode 100644 index 00000000000..63579a6cb79 --- /dev/null +++ b/tests/ServiceStack.Core.SelfHostTests/SyncRestClientTests.cs @@ -0,0 +1,234 @@ +//TODO: fix test failures when running on Linux build agent +#if NETCORE + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Funq; +using NUnit.Framework; +using RestFiles.ServiceInterface; +using RestFiles.ServiceModel; +using ServiceStack; +using File = System.IO.File; + +namespace RestFiles.Tests +{ + public class TestAppHost + : AppSelfHostBase + { + public const string ListeningOn = "http://localhost:8080/"; + + public TestAppHost() + : base("Self Host Integration Tests", typeof(FilesService).GetAssembly()) { } + + public AppConfig Config { get; set; } + + public override void Configure(Container container) + { + this.Config = new AppConfig + { + RootDirectory = "App_Data/files/", + TextFileExtensions = "txt,sln,proj,cs,config,asax".Split(',').ToList(), + ExcludeDirectories = new List(), + }; + container.Register(this.Config); + } + } + + [TestFixture] + public class SyncRestClientTests + { + public const string WebServiceHostUrl = "http://localhost:8080/"; + private const string ReadmeFileContents = "THIS IS A README FILE"; + private const string ReplacedFileContents = "THIS README FILE HAS BEEN REPLACED"; + private const string TestUploadFileContents = "THIS FILE IS USED FOR UPLOADING IN TESTS"; + public string FilesRootDir; + + ServiceStackHost appHost; + + [OneTimeSetUp] + public void TextFixtureSetUp() + { + appHost = new TestAppHost() + .Init() + .Start(TestAppHost.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() => appHost.Dispose(); + + [SetUp] + public void OnBeforeEachTest() + { + //Setup the files directory with some test files and folders + FilesRootDir = appHost.MapProjectPath("~/App_Data/files/"); + if (Directory.Exists(FilesRootDir)) + { + Directory.Delete(FilesRootDir, true); + } + Directory.CreateDirectory(FilesRootDir + "SubFolder"); + Directory.CreateDirectory(FilesRootDir + "SubFolder2"); + File.WriteAllText(Path.Combine(FilesRootDir, "README.txt"), ReadmeFileContents); + File.WriteAllText(Path.Combine(FilesRootDir, "TESTUPLOAD.txt"), TestUploadFileContents); + } + + /// + /// Choose your favourite format to run tests with + /// + public IRestClient CreateRestClient() + { + return new JsonServiceClient(WebServiceHostUrl); //Best choice for Ajax web apps, 3x faster than XML + } + + [Test] + public void Can_Get_to_retrieve_existing_file() + { + var restClient = CreateRestClient(); + + var response = restClient.Get("files/README.txt"); + + Assert.That(response.File.Contents, Is.EqualTo("THIS IS A README FILE")); + } + + [Test] + public void Can_Get_to_retrieve_existing_folder_listing() + { + var restClient = CreateRestClient(); + + var response = restClient.Get("files/"); + + Assert.That(response.Directory.Folders.Count, Is.EqualTo(2)); + Assert.That(response.Directory.Files.Count, Is.EqualTo(2)); + } + + [Test] + public void Can_WebRequest_POST_upload_file_to_save_new_file_and_create_new_Directory() + { + var restClient = CreateRestClient(); + + var fileToUpload = new FileInfo(FilesRootDir + "TESTUPLOAD.txt"); + + var response = restClient.PostFile("files/UploadedFiles/", + fileToUpload, MimeTypes.GetMimeType(fileToUpload.Name)); + + Assert.That(Directory.Exists(FilesRootDir + "UploadedFiles")); + Assert.That(File.ReadAllText(FilesRootDir + "UploadedFiles/TESTUPLOAD.txt"), + Is.EqualTo(TestUploadFileContents)); + } + + [Test] + public void Can_Put_to_replace_text_content_of_an_existing_file() + { + var restClient = CreateRestClient(); + + var response = restClient.Put(WebServiceHostUrl + "files/README.txt", + new Files { TextContents = ReplacedFileContents }); + + Assert.That(File.ReadAllText(FilesRootDir + "README.txt"), + Is.EqualTo(ReplacedFileContents)); + } + + [Test] + public void Can_Delete_to_replace_text_content_of_an_existing_file() + { + var restClient = CreateRestClient(); + + var response = restClient.Delete("files/README.txt"); + + Assert.That(!File.Exists(FilesRootDir + "README.txt")); + } + + + /* + * Error Handling Tests + */ + [Test] + public void GET_a_file_that_doesnt_exist_throws_a_404_FileNotFoundException() + { + var restClient = CreateRestClient(); + + try + { + var response = restClient.Get(WebServiceHostUrl + "files/UnknownFolder"); + + Assert.Fail("Should fail with 404 FileNotFoundException"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + var response = (FilesResponse)webEx.ResponseDto; + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(FileNotFoundException).Name)); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("Could not find: UnknownFolder")); + } + } + + [Test] + public void POST_to_an_existing_file_throws_a_500_NotSupportedException() + { + var restClient = CreateRestClient(); + + var fileToUpload = new FileInfo(FilesRootDir + "TESTUPLOAD.txt"); + + try + { + var response = restClient.PostFile(WebServiceHostUrl + "files/README.txt", + fileToUpload, MimeTypes.GetMimeType(fileToUpload.Name)); + + Assert.Fail("Should fail with NotSupportedException"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(405)); + var response = (FilesResponse)webEx.ResponseDto; + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(NotSupportedException).Name)); + Assert.That(response.ResponseStatus.Message, + Is.EqualTo("POST only supports uploading new files. Use PUT to replace contents of an existing file")); + } + } + + [Test] + public void PUT_to_replace_a_non_existing_file_throws_404() + { + var restClient = CreateRestClient(); + + try + { + var response = restClient.Put(WebServiceHostUrl + "files/non-existing-file.txt", + new Files { TextContents = ReplacedFileContents }); + + Assert.Fail("Should fail with 404 FileNotFoundException"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + var response = (FilesResponse)webEx.ResponseDto; + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(FileNotFoundException).Name)); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("Could not find: non-existing-file.txt")); + } + } + + [Test] + public void DELETE_a_non_existing_file_throws_404() + { + var restClient = CreateRestClient(); + + try + { + var response = restClient.Delete(WebServiceHostUrl + "files/non-existing-file.txt"); + + Assert.Fail("Should fail with 404 FileNotFoundException"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + var response = (FilesResponse)webEx.ResponseDto; + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(FileNotFoundException).Name)); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("Could not find: non-existing-file.txt")); + } + } + + } +} + +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/AutoQueryCrudModels.cs b/tests/ServiceStack.Extensions.Tests/AutoQueryCrudModels.cs new file mode 100644 index 00000000000..3802c821b02 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/AutoQueryCrudModels.cs @@ -0,0 +1,686 @@ +#if AUTOQUERY_CRUD +using System; +using System.Runtime.Serialization; +using System.Threading.Tasks; +using ServiceStack.DataAnnotations; + +namespace ServiceStack.Extensions.Tests +{ + [DataContract] + public abstract class RockstarBase + { + [DataMember(Order = 1)] + public string FirstName { get; set; } + [DataMember(Order = 2)] + public string LastName { get; set; } + [DataMember(Order = 3)] + public int? Age { get; set; } + [DataMember(Order = 4)] + public DateTime DateOfBirth { get; set; } + [DataMember(Order = 5)] + public DateTime? DateDied { get; set; } + [DataMember(Order = 6)] + public LivingStatus LivingStatus { get; set; } + } + + [Alias(nameof(Rockstar))] + [DataContract] + public class RockstarAuto : RockstarBase + { + [AutoIncrement] + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [DataContract] + public class RockstarAutoGuid : RockstarBase + { + [AutoId] + [DataMember(Order = 1)] + public Guid Id { get; set; } + } + + [DataContract] + public class RockstarAudit : RockstarBase + { + [AutoIncrement] + [DataMember(Order = 1)] + public int Id { get; set; } + + [DataMember(Order = 2)] + public DateTime CreatedDate { get; set; } + [DataMember(Order = 3)] + public string CreatedBy { get; set; } + [DataMember(Order = 4)] + public string CreatedInfo { get; set; } + [DataMember(Order = 5)] + public DateTime ModifiedDate { get; set; } + [DataMember(Order = 6)] + public string ModifiedBy { get; set; } + [DataMember(Order = 7)] + public string ModifiedInfo { get; set; } + } + + public interface IAudit + { + DateTime CreatedDate { get; set; } + string CreatedBy { get; set; } + string CreatedInfo { get; set; } + DateTime ModifiedDate { get; set; } + string ModifiedBy { get; set; } + string ModifiedInfo { get; set; } + DateTime? SoftDeletedDate { get; set; } + string SoftDeletedBy { get; set; } + string SoftDeletedInfo { get; set; } + } + + public interface IAuditTenant : IAudit + { + int TenantId { get; set; } + } + + [DataContract] + public abstract class AuditBase : IAudit + { + [DataMember(Order = 1)] + public DateTime CreatedDate { get; set; } + + [Required] + [DataMember(Order = 2)] + public string CreatedBy { get; set; } + + [Required] + [DataMember(Order = 3)] + public string CreatedInfo { get; set; } + + [DataMember(Order = 4)] + public DateTime ModifiedDate { get; set; } + + [Required] + [DataMember(Order = 5)] + public string ModifiedBy { get; set; } + + [Required] + [DataMember(Order = 6)] + public string ModifiedInfo { get; set; } + + [Index] //Check if Deleted + [DataMember(Order = 7)] + public DateTime? SoftDeletedDate { get; set; } + + [DataMember(Order = 8)] + public string SoftDeletedBy { get; set; } + [DataMember(Order = 9)] + public string SoftDeletedInfo { get; set; } + } + + [DataContract] + public class RockstarAuditTenant : AuditBase + { + [Index] + [DataMember(Order = 1)] + public int TenantId { get; set; } + + [AutoIncrement] + [DataMember(Order = 2)] + public int Id { get; set; } + + [DataMember(Order = 3)] + public string FirstName { get; set; } + [DataMember(Order = 4)] + public string LastName { get; set; } + [DataMember(Order = 5)] + public int? Age { get; set; } + [DataMember(Order = 6)] + public DateTime DateOfBirth { get; set; } + [DataMember(Order = 7)] + public DateTime? DateDied { get; set; } + [DataMember(Order = 8)] + public LivingStatus LivingStatus { get; set; } + } + + [DataContract] + public class RockstarVersion : RockstarBase + { + [AutoIncrement] + [DataMember(Order = 1)] + public int Id { get; set; } + + [DataMember(Order = 2)] + public ulong RowVersion { get; set; } + } + + [DataContract] + public class CreateRockstar : RockstarBase, ICreateDb, IReturn { } + + [DataContract] + public class CreateRockstarResponse + { + [DataMember(Order = 1)] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class CreateRockstarWithReturn : RockstarBase, ICreateDb, + IReturn { } + + [DataContract] + public class CreateRockstarWithVoidReturn : RockstarBase, ICreateDb, IReturnVoid { } + + [DataContract] + public class CreateRockstarWithAutoGuid : RockstarBase, ICreateDb, + IReturn { } + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(RockstarAudit.CreatedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.CreatedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.CreatedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [AutoPopulate(nameof(RockstarAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [DataContract] + public class CreateRockstarAudit : RockstarBase, ICreateDb, IReturn { } + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(IAudit.CreatedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.CreatedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.CreatedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [AutoPopulate(nameof(IAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [DataContract] + public abstract class CreateAuditBase : ICreateDb, IReturn { } + + [AutoPopulate(nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + [DataContract] + public abstract class CreateAuditTenantBase : CreateAuditBase { } + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(IAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [DataContract] + public abstract class UpdateAuditBase : IUpdateDb
      , IReturn { } + + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + [DataContract] + public abstract class UpdateAuditTenantBase : UpdateAuditBase { } + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(IAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [DataContract] + public abstract class PatchAuditBase : IPatchDb
      , IReturn { } + + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + [DataContract] + public abstract class PatchAuditTenantBase : PatchAuditBase { } + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(IAudit.SoftDeletedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.SoftDeletedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.SoftDeletedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [DataContract] + public abstract class SoftDeleteAuditBase : IUpdateDb
      , IReturn { } + + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + [DataContract] + public abstract class SoftDeleteAuditTenantBase : SoftDeleteAuditBase { } + + [ValidateRequest("IsAuthenticated")] + [AutoFilter(QueryTerm.Ensure, nameof(IAudit.SoftDeletedDate), Template = SqlTemplate.IsNull)] + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + [DataContract] + public abstract class QueryDbTenant : QueryDb { } + + [DataContract] + public class CreateRockstarAuditTenant : CreateAuditTenantBase, IHasBearerToken + { + [DataMember(Order = 1)] + public string BearerToken { get; set; } //Authenticate MQ Requests + [DataMember(Order = 2)] + public string FirstName { get; set; } + [DataMember(Order = 3)] + public string LastName { get; set; } + [DataMember(Order = 4)] + public int? Age { get; set; } + [DataMember(Order = 5)] + public DateTime DateOfBirth { get; set; } + [DataMember(Order = 6)] + public DateTime? DateDied { get; set; } + [DataMember(Order = 7)] + public LivingStatus LivingStatus { get; set; } + } + + [DataContract] + public class UpdateRockstarAuditTenant : UpdateAuditTenantBase, IHasBearerToken + { + [DataMember(Order = 1)] + public string BearerToken { get; set; } //Authenticate MQ Requests + [DataMember(Order = 2)] + public int Id { get; set; } + [DataMember(Order = 3)] + public string FirstName { get; set; } + [DataMember(Order = 4)] + public LivingStatus? LivingStatus { get; set; } + } + + [DataContract] + public class PatchRockstarAuditTenant : PatchAuditTenantBase, IHasBearerToken + { + [DataMember(Order = 1)] + public string BearerToken { get; set; } //Authenticate MQ Requests + [DataMember(Order = 2)] + public int Id { get; set; } + [DataMember(Order = 3)] + public string FirstName { get; set; } + [DataMember(Order = 4)] + public LivingStatus? LivingStatus { get; set; } + } + + [DataContract] + public class CreateRockstarAuditTenantGateway : IReturn, IPost + { + [DataMember(Order = 1)] + public string FirstName { get; set; } + [DataMember(Order = 2)] + public string LastName { get; set; } + [DataMember(Order = 3)] + public int? Age { get; set; } + [DataMember(Order = 4)] + public DateTime DateOfBirth { get; set; } + [DataMember(Order = 5)] + public DateTime? DateDied { get; set; } + [DataMember(Order = 6)] + public LivingStatus LivingStatus { get; set; } + } + + [DataContract] + public class UpdateRockstarAuditTenantGateway : IReturn, IPut + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string FirstName { get; set; } + [DataMember(Order = 3)] + public LivingStatus? LivingStatus { get; set; } + } + + [DataContract] + public class PatchRockstarAuditTenantGateway : IReturn, IPatch + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string FirstName { get; set; } + [DataMember(Order = 3)] + public LivingStatus? LivingStatus { get; set; } + } + + [DataContract] + public class RealDeleteAuditTenantGateway : IReturn, IDelete + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [DataContract] + public class SoftDeleteAuditTenant : SoftDeleteAuditTenantBase + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [Authenticate] + [DataContract] + public class CreateRockstarAuditTenantMq : IReturnVoid + { + [DataMember(Order = 1)] + public string FirstName { get; set; } + [DataMember(Order = 2)] + public string LastName { get; set; } + [DataMember(Order = 3)] + public int? Age { get; set; } + [DataMember(Order = 4)] + public DateTime DateOfBirth { get; set; } + [DataMember(Order = 5)] + public DateTime? DateDied { get; set; } + [DataMember(Order = 6)] + public LivingStatus LivingStatus { get; set; } + } + + [Authenticate] + [DataContract] + public class UpdateRockstarAuditTenantMq : IPut, IReturnVoid + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string FirstName { get; set; } + [DataMember(Order = 3)] + public LivingStatus? LivingStatus { get; set; } + } + + [DataContract] + public class PatchRockstarAuditTenantMq : IPatch, IReturnVoid + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string FirstName { get; set; } + [DataMember(Order = 3)] + public LivingStatus? LivingStatus { get; set; } + } + + [DataContract] + public class RealDeleteAuditTenantMq : IDelete, IReturnVoid + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [Authenticate] + [AutoPopulate(nameof(RockstarAudit.CreatedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.CreatedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.CreatedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [AutoPopulate(nameof(RockstarAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [DataContract] + public class CreateRockstarAuditMqToken : RockstarBase, ICreateDb, IReturn, IHasBearerToken + { + [DataMember(Order = 1)] + public string BearerToken { get; set; } + } + + + [Authenticate] + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + [DataContract] + public class RealDeleteAuditTenant : IDeleteDb, IReturn, IHasBearerToken + { + [DataMember(Order = 1)] + public string BearerToken { get; set; } //Authenticate MQ Requests + [DataMember(Order = 2)] + public int Id { get; set; } + [DataMember(Order = 3)] + public int? Age { get; set; } + } + + [DataContract] + public class QueryRockstarAudit : QueryDbTenant + { + [DataMember(Order = 1)] + public int? Id { get; set; } + } + + [QueryDb(QueryTerm.Or)] + [AutoFilter(QueryTerm.Ensure, nameof(AuditBase.SoftDeletedDate), SqlTemplate.IsNull)] + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + [DataContract] + public class QueryRockstarAuditSubOr : QueryDb + { + [DataMember(Order = 1)] + public string FirstNameStartsWith { get; set; } + [DataMember(Order = 2)] + public int? AgeOlderThan { get; set; } + } + + [DataContract] + public class CreateRockstarVersion : RockstarBase, ICreateDb, + IReturn { } + + [DataContract] + public class RockstarWithIdResponse + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class RockstarWithIdAndCountResponse + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public int Count { get; set; } + [DataMember(Order = 3)] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class RockstarWithIdAndRowVersionResponse + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public uint RowVersion { get; set; } + [DataMember(Order = 3)] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class RockstarWithIdAndResultResponse + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public RockstarAuto Result { get; set; } + [DataMember(Order = 3)] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class CreateRockstarWithReturnGuidResponse + { + [DataMember(Order = 1)] + public Guid Id { get; set; } + [DataMember(Order = 2)] + public RockstarAutoGuid Result { get; set; } + [DataMember(Order = 3)] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class CreateRockstarAdhocNonDefaults : ICreateDb, IReturn + { + [DataMember(Order = 1)] + public string FirstName { get; set; } + [DataMember(Order = 2)] + public string LastName { get; set; } + + [AutoDefault(Value = 21)] + [DataMember(Order = 3)] + public int? Age { get; set; } + + [AutoDefault(Expression = "date(2001,1,1)")] + [DataMember(Order = 4)] + public DateTime DateOfBirth { get; set; } + + [AutoDefault(Eval = "utcNow")] + [DataMember(Order = 5)] + public DateTime? DateDied { get; set; } + + [AutoDefault(Value = global::ServiceStack.Extensions.Tests.LivingStatus.Dead)] + [DataMember(Order = 6)] + public LivingStatus? LivingStatus { get; set; } + } + + [DataContract] + public class CreateRockstarAutoMap : ICreateDb, IReturn + { + [AutoMap(nameof(RockstarAuto.FirstName))] + [DataMember(Order = 1)] + public string MapFirstName { get; set; } + + [AutoMap(nameof(RockstarAuto.LastName))] + [DataMember(Order = 2)] + public string MapLastName { get; set; } + + [AutoMap(nameof(RockstarAuto.Age))] + [AutoDefault(Value = 21)] + [DataMember(Order = 3)] + public int? MapAge { get; set; } + + [AutoMap(nameof(RockstarAuto.DateOfBirth))] + [AutoDefault(Expression = "date(2001,1,1)")] + [DataMember(Order = 4)] + public DateTime MapDateOfBirth { get; set; } + + [AutoMap(nameof(RockstarAuto.DateDied))] + [AutoDefault(Eval = "utcNow")] + [DataMember(Order = 5)] + public DateTime? MapDateDied { get; set; } + + [AutoMap(nameof(RockstarAuto.LivingStatus))] + [AutoDefault(Value = LivingStatus.Dead)] + [DataMember(Order = 6)] + public LivingStatus? MapLivingStatus { get; set; } + } + + [DataContract] + public class UpdateRockstar : RockstarBase, IUpdateDb, IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [Authenticate] + [AutoPopulate(nameof(RockstarAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [DataContract] + public class UpdateRockstarAudit : RockstarBase, IPatchDb, IReturn + { + [DataMember(Order = 1)] + // [DataMember(Order = 11)] + public int Id { get; set; } + + // [DataMember(Order = 2)] + // [DataMember(Order = 12)] + // public new string FirstName { get; set; } + + //1. Commenting out property resolves issue + //2. When using 1,2 index throws Grpc.Core.RpcException: Status(StatusCode=Unknown, Detail="Exception was thrown by handler.") + //3. When Index changed to 11,12 causes empty DTO to be sent + // [DataMember(Order = 13)] + // public new LivingStatus? LivingStatus { get; set; } //overridden property + } + + [Authenticate] + [DataContract] + public class DeleteRockstarAudit : IDeleteDb, IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [DataContract] + public class UpdateRockstarVersion : RockstarBase, IPatchDb, + IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public ulong RowVersion { get; set; } + } + + [DataContract] + public class PatchRockstar : RockstarBase, IPatchDb, IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [DataContract] + public class UpdateRockstarAdhocNonDefaults : IUpdateDb, IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + + [AutoUpdate(AutoUpdateStyle.NonDefaults)] + [DataMember(Order = 2)] + public string FirstName { get; set; } + + [DataMember(Order = 3)] + public string LastName { get; set; } + + [AutoDefault(Value = 21)] + [DataMember(Order = 4)] + public int? Age { get; set; } + + [AutoDefault(Expression = "date(2001,1,1)")] + [DataMember(Order = 5)] + public DateTime DateOfBirth { get; set; } + + [AutoDefault(Eval = "utcNow")] + [DataMember(Order = 6)] + public DateTime? DateDied { get; set; } + + [AutoUpdate(AutoUpdateStyle.NonDefaults), AutoDefault(Value = LivingStatus.Dead)] + [DataMember(Order = 7)] + public LivingStatus LivingStatus { get; set; } + } + + [DataContract] + public class DeleteRockstar : IDeleteDb, IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [DataContract] + public class DeleteRockstarFilters : IDeleteDb, IReturn + { + [DataMember(Order = 1)] + public string FirstName { get; set; } + [DataMember(Order = 2)] + public string LastName { get; set; } + [DataMember(Order = 3)] + public int? Age { get; set; } + } + + [DataContract] + public class DeleteRockstarCountResponse + { + [DataMember(Order = 1)] + public int Count { get; set; } + [DataMember(Order = 2)] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class CreateNamedRockstar : RockstarBase, ICreateDb, IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [DataContract] + public class UpdateNamedRockstar : RockstarBase, IUpdateDb, IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + //[ConnectionInfo] on AutoCrudConnectionInfoServices + [DataContract] + public class CreateConnectionInfoRockstar : RockstarBase, ICreateDb, + IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + } + + [DataContract] + public class UpdateConnectionInfoRockstar : RockstarBase, IUpdateDb, + IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/AutoQueryCrudTests.Validate.cs b/tests/ServiceStack.Extensions.Tests/AutoQueryCrudTests.Validate.cs new file mode 100644 index 00000000000..554d73e7a73 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/AutoQueryCrudTests.Validate.cs @@ -0,0 +1,719 @@ +#if AUTOQUERY_CRUD +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.Model; +using ServiceStack.OrmLite; +using ServiceStack.Script; +using ServiceStack.Validation; +using ServiceStack.Web; + +namespace ServiceStack.Extensions.Tests +{ + public class NoRockstarAlbumReferences : TypeValidator + { + public NoRockstarAlbumReferences() + : base("HasForeignKeyReferences", "Has RockstarAlbum References") {} + + public override async Task IsValidAsync(object dto, IRequest request) + { + //Example of using compiled accessor delegates to access `Id` property + //var id = TypeProperties.Get(dto.GetType()).GetPublicGetter("Id")(dto).ConvertTo(); + + var id = ((IHasId)dto).Id; + using var db = HostContext.AppHost.GetDbConnection(request); + return !await db.ExistsAsync(x => x.RockstarId == id); + } + } + + public class MyValidators : ScriptMethods + { + public ITypeValidator NoRockstarAlbumReferences() => new NoRockstarAlbumReferences(); + } + + public partial class AutoQueryCrudTests + { + private bool UseDbSource = true; + + partial void OnConfigure(AutoQueryAppHost host, Container container) + { + host.ScriptContext.ScriptMethods.AddRange(new ScriptMethods[] { + new DbScriptsAsync(), + new MyValidators(), + }); + + host.Plugins.Add(new ValidationFeature { + ConditionErrorCodes = { + [ValidationConditions.IsOdd] = "NotOdd", + }, + ErrorCodeMessages = { + ["NotOdd"] = "{PropertyName} must be odd", + ["RuleMessage"] = "ErrorCodeMessages for RuleMessage", + } + }); + + if (UseDbSource) + { + container.Register(c => + new OrmLiteValidationSource(c.Resolve(), host.GetMemoryCacheClient())); + } + else + { + container.Register(new MemoryValidationSource()); + } + + var validationSource = container.Resolve(); + validationSource.InitSchema(); + validationSource.SaveValidationRulesAsync(new List { + new ValidationRule { Type = nameof(DynamicValidationRules), Validator = "IsAuthenticated" }, + new ValidationRule { Type = nameof(DynamicValidationRules), Field = nameof(DynamicValidationRules.LastName), Validator = "NotNull" }, + new ValidationRule { Type = nameof(DynamicValidationRules), Field = nameof(DynamicValidationRules.Age), Validator = "InclusiveBetween(13,100)" }, + }); + } + + private static void AssertErrorResponse(WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(ex.ErrorMessage, Is.EqualTo("'First Name' must not be empty.")); + var status = ex.ResponseStatus; + Assert.That(status.Errors.Count, Is.EqualTo(3)); + + var fieldError = status.Errors.First(x => x.FieldName == nameof(RockstarBase.FirstName)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(fieldError.Message, Is.EqualTo("'First Name' must not be empty.")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(RockstarBase.Age)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(fieldError.Message, Is.EqualTo("'Age' must not be empty.")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(RockstarBase.LastName)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(fieldError.Message, Is.EqualTo("'Last Name' must not be empty.")); + } + + [Test] + public void Does_validate_when_no_Abstract_validator() + { + try + { + var response = client.Post(new NoAbstractValidator { + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + AssertErrorResponse(ex); + Console.WriteLine(ex); + } + + try + { + var response = client.Post(new NoAbstractValidator { + FirstName = "A", + LastName = "B", + Age = 12, + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo("InclusiveBetween")); + Assert.That(ex.ErrorMessage, Is.EqualTo("'Age' must be between 13 and 100. You entered 12.")); + var status = ex.ResponseStatus; + Assert.That(status.Errors.Count, Is.EqualTo(1)); + } + + client.Post(new NoAbstractValidator { + FirstName = "A", + LastName = "B", + Age = 13, + DateOfBirth = new DateTime(2001,1,1), + }); + } + + [Test] + public void Does_validate_DynamicValidationRules_combined_with_IValidationSource_rules() + { + try + { + var anonClient = CreateClient(); + var response = anonClient.Post(new DynamicValidationRules { + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int) HttpStatusCode.Unauthorized)); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.Unauthorized))); + } + + var authClient = CreateAuthClient(); + try + { + var response = authClient.Post(new DynamicValidationRules { + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + AssertErrorResponse(ex); + Console.WriteLine(ex); + } + + try + { + var response = authClient.Post(new DynamicValidationRules { + FirstName = "A", + LastName = "B", + Age = 12, + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo("InclusiveBetween")); + Assert.That(ex.ErrorMessage, Is.EqualTo("'Age' must be between 13 and 100. You entered 12.")); + var status = ex.ResponseStatus; + Assert.That(status.Errors.Count, Is.EqualTo(1)); + } + + authClient.Post(new DynamicValidationRules { + FirstName = "A", + LastName = "B", + Age = 13, + DateOfBirth = new DateTime(2001,1,1), + }); + } + + [Test] + public void Does_validate_combined_declarative_and_AbstractValidator() + { + try + { + var response = client.Post(new ValidateCreateRockstar()); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + AssertErrorResponse(ex); + Console.WriteLine(ex); + } + } + + [Test] + public void Does_validate_all_NotEmpty_Fields() + { + try + { + var response = client.Post(new EmptyValidators()); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ResponseStatus.Errors.Count, + Is.EqualTo(typeof(EmptyValidators).GetPublicProperties().Length)); + Assert.That(ex.ResponseStatus.Errors.All(x => x.ErrorCode == "NotEmpty")); + Console.WriteLine(ex); + } + } + + [Test] + public void Does_Validate_TriggerAllValidators() + { + try + { + var response = client.Post(new TriggerAllValidators { + CreditCard = "NotCreditCard", + Email = "NotEmail", + Empty = "NotEmpty", + Equal = "NotEqual", + ExclusiveBetween = 1, + GreaterThan = 1, + GreaterThanOrEqual = 1, + InclusiveBetween = 1, + Length = "Length", + LessThan = 20, + LessThanOrEqual = 20, + NotEmpty = "", + NotEqual = "NotEqual", + Null = "NotNull", + RegularExpression = "FOO", + ScalePrecision = 123.456m + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.AssertTriggerValidators(); + Console.WriteLine(ex); + } + } + + [Test] + public void Does_use_CustomErrorMessages() + { + try + { + var response = client.Post(new CustomValidationErrors()); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Console.WriteLine(ex); + var status = ex.ResponseStatus; + Assert.That(ex.ErrorCode, Is.EqualTo("ZERROR")); + Assert.That(ex.ErrorMessage, Is.EqualTo("'Custom Error Code' must not be empty.")); + Assert.That(status.Errors.Count, Is.EqualTo(typeof(CustomValidationErrors).GetProperties().Length)); + + var fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.CustomErrorCode)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("ZERROR")); + Assert.That(fieldError.Message, Is.EqualTo("'Custom Error Code' must not be empty.")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.CustomErrorCodeAndMessage)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("ZERROR")); + Assert.That(fieldError.Message, Is.EqualTo("Custom Error Code And Message has to be between 1 and 2, you: 0")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.ErrorCodeRule)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("RuleMessage")); + Assert.That(fieldError.Message, Is.EqualTo("ErrorCodeMessages for RuleMessage")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.IsOddCondition)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("NotOdd")); + Assert.That(fieldError.Message, Is.EqualTo("Is Odd Condition must be odd")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.IsOddAndOverTwoDigitsCondition)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("RuleMessage")); + Assert.That(fieldError.Message, Is.EqualTo("ErrorCodeMessages for RuleMessage")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.IsOddOrOverTwoDigitsCondition)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("ScriptCondition")); + Assert.That(fieldError.Message, Is.EqualTo("The specified condition was not met for 'Is Odd Or Over Two Digits Condition'.")); + } + } + + [Test] + public void Can_satisfy_combined_conditions() + { + try + { + var response = client.Post(new CustomValidationErrors { + IsOddAndOverTwoDigitsCondition = 101 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ResponseStatus.Errors.Count, Is.EqualTo(typeof(CustomValidationErrors).GetProperties().Length - 1)); + Assert.That(ex.ResponseStatus.Errors.All(x => x.FieldName != nameof(CustomValidationErrors.IsOddAndOverTwoDigitsCondition))); + } + try + { + var response = client.Post(new CustomValidationErrors { + IsOddOrOverTwoDigitsCondition = 102 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ResponseStatus.Errors.Count, Is.EqualTo(typeof(CustomValidationErrors).GetProperties().Length - 1)); + Assert.That(ex.ResponseStatus.Errors.All(x => x.FieldName != nameof(CustomValidationErrors.IsOddOrOverTwoDigitsCondition))); + } + } + + [Test] + public void Does_OnlyValidatesRequest() + { + try + { + var response = client.Post(new OnlyValidatesRequest { + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.ErrorCode, Is.EqualTo("RuleMessage")); + Assert.That(ex.ErrorMessage, Is.EqualTo("ErrorCodeMessages for RuleMessage")); + Assert.That(ex.GetFieldErrors().Count, Is.EqualTo(0)); + } + + try + { + var response = client.Post(new OnlyValidatesRequest { + Test = 101 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(401)); + Assert.That(ex.ErrorCode, Is.EqualTo("AssertFailed2")); + Assert.That(ex.ErrorMessage, Is.EqualTo("2nd Assert Failed")); + Assert.That(ex.GetFieldErrors().Count, Is.EqualTo(0)); + } + + try + { + var response = client.Post(new OnlyValidatesRequest { + Test = 1001 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(ex.GetFieldErrors().Count, Is.EqualTo(1)); + } + } + + [Test] + public void Can_use_custom_Guid_Id_and_DateTimeOffset() + { + try + { + client.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + var response = client.Post(new CreateBookmark { + Description = "Description", + Slug = "Slug", + Title = "Title", + Url = "Url", + }); + + Assert.That(response.Id, Is.Not.EqualTo(new Guid())); + Assert.That(response.Result.Id, Is.EqualTo(response.Id)); + Assert.That(response.Result.Description, Is.EqualTo("Description")); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + + [Test] + public void Does_validate_TestAuthValidators() + { + try + { + var anonClient = CreateClient(); + anonClient.Post(new TestAuthValidators()); + Assert.Fail("Should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(401)); + Assert.That(e.ErrorCode, Is.EqualTo("Unauthorized")); + Assert.That(e.ErrorMessage, Is.EqualTo("Not Authenticated")); + } + + try + { + var employeeClient = CreateClient(); + + employeeClient.Post(new Authenticate { + provider = "credentials", + UserName = "employee@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + employeeClient.Post(new TestAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(403)); + Assert.That(e.ErrorCode, Is.EqualTo("Forbidden")); + Assert.That(e.ErrorMessage, Is.EqualTo("Manager Role Required")); + } + + try + { + var managerClient = CreateClient(); + + managerClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + managerClient.Post(new TestAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + + try + { + var adminClient = CreateClient(); + + adminClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + adminClient.Post(new TestAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + } + + + [Test] + public void Does_validate_TestMultiAuthValidators() + { + try + { + var anonClient = CreateClient(); + anonClient.Post(new TestMultiAuthValidators()); + Assert.Fail("Should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(401)); + Assert.That(e.ErrorCode, Is.EqualTo("Unauthorized")); + Assert.That(e.ErrorMessage, Is.EqualTo("Not Authenticated")); + } + + try + { + var employeeClient = CreateClient(); + + employeeClient.Post(new Authenticate { + provider = "credentials", + UserName = "employee@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + employeeClient.Post(new TestMultiAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(403)); + Assert.That(e.ErrorCode, Is.EqualTo("Forbidden")); + Assert.That(e.ErrorMessage, Is.EqualTo("Manager Role Required")); + } + + try + { + var managerClient = CreateClient(); + + managerClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + managerClient.Post(new TestMultiAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + + try + { + var adminClient = CreateClient(); + + adminClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + adminClient.Post(new TestMultiAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + } + + [Test] + public void Does_validate_TestIsAdmin() + { + var userNames = new[] { "employee@email.com", "manager" }; + foreach (var userName in userNames) + { + var userClient = CreateClient(); + if (userName != null) + { + try + { + var managerClient = CreateClient(); + + managerClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + managerClient.Post(new TestIsAdmin()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(403)); + Assert.That(e.ErrorCode, Is.EqualTo("Forbidden")); + Assert.That(e.ErrorMessage, Is.EqualTo("Admin Role Required")); + } + } + } + + try + { + var adminClient = CreateClient(); + + adminClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + adminClient.Post(new TestIsAdmin()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + } + + [Test] + public void Does_validate_TestDbCondition() + { + using var db = appHost.Resolve().OpenDbConnection(); + db.DropAndCreateTable(); + + try + { + db.Insert(new RockstarAlbum { Id = 1, Name = "An Album", Genre = "Pop", RockstarId = 1 }); + var response = client.Post(new TestDbCondition { + Id = 1, + }); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("HasForeignKeyReferences")); + } + + try + { + db.Delete(x => x.RockstarId == 1); + var response = client.Post(new TestDbCondition { + Id = 1, + }); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); //success! + } + } + + [Test] + public void Does_validate_TestDbValidator() + { + using var db = appHost.Resolve().OpenDbConnection(); + db.DropAndCreateTable(); + + try + { + db.Insert(new RockstarAlbum { Id = 1, Name = "An Album", Genre = "Pop", RockstarId = 1 }); + var response = client.Post(new TestDbValidator { + Id = 1, + }); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("HasForeignKeyReferences")); + } + + try + { + db.Delete(x => x.RockstarId == 1); + var response = client.Post(new TestDbValidator { + Id = 1, + }); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); //success! + } + } + } + + public static class ValidationUtils + { + public static void AssertTriggerValidators(this WebServiceException ex) + { + var errors = ex.ResponseStatus.Errors; + Assert.That(errors.First(x => x.FieldName == "CreditCard").ErrorCode, Is.EqualTo("CreditCard")); + Assert.That(errors.First(x => x.FieldName == "Email").ErrorCode, Is.EqualTo("Email")); + Assert.That(errors.First(x => x.FieldName == "Email").ErrorCode, Is.EqualTo("Email")); + Assert.That(errors.First(x => x.FieldName == "Empty").ErrorCode, Is.EqualTo("Empty")); + Assert.That(errors.First(x => x.FieldName == "Equal").ErrorCode, Is.EqualTo("Equal")); + Assert.That(errors.First(x => x.FieldName == "ExclusiveBetween").ErrorCode, Is.EqualTo("ExclusiveBetween")); + Assert.That(errors.First(x => x.FieldName == "GreaterThan").ErrorCode, Is.EqualTo("GreaterThan")); + Assert.That(errors.First(x => x.FieldName == "GreaterThanOrEqual").ErrorCode, Is.EqualTo("GreaterThanOrEqual")); + Assert.That(errors.First(x => x.FieldName == "InclusiveBetween").ErrorCode, Is.EqualTo("InclusiveBetween")); + Assert.That(errors.First(x => x.FieldName == "Length").ErrorCode, Is.EqualTo("Length")); + Assert.That(errors.First(x => x.FieldName == "LessThan").ErrorCode, Is.EqualTo("LessThan")); + Assert.That(errors.First(x => x.FieldName == "LessThanOrEqual").ErrorCode, Is.EqualTo("LessThanOrEqual")); + Assert.That(errors.First(x => x.FieldName == "NotEmpty").ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(errors.First(x => x.FieldName == "NotEqual").ErrorCode, Is.EqualTo("NotEqual")); + Assert.That(errors.First(x => x.FieldName == "Null").ErrorCode, Is.EqualTo("Null")); + Assert.That(errors.First(x => x.FieldName == "RegularExpression").ErrorCode, Is.EqualTo("RegularExpression")); + Assert.That(errors.First(x => x.FieldName == "ScalePrecision").ErrorCode, Is.EqualTo("ScalePrecision")); + } + } + +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/AutoQueryCrudTests.ValidateModels.cs b/tests/ServiceStack.Extensions.Tests/AutoQueryCrudTests.ValidateModels.cs new file mode 100644 index 00000000000..a46457cb39b --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/AutoQueryCrudTests.ValidateModels.cs @@ -0,0 +1,360 @@ +#if AUTOQUERY_CRUD +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using ServiceStack.FluentValidation; +using ServiceStack.Model; + +namespace ServiceStack.Extensions.Tests +{ + public static class ValidationConditions + { + public const string IsOdd = "it.isOdd()"; + public const string IsOver2Digits = "it.log10() > 2"; + } + + [DataContract] + public class ValidateCreateRockstar + : ICreateDb, IReturn + { + [Validate(nameof(ValidateScripts.NotNull))] + // [Validate("NotNull")] + [DataMember(Order = 1)] + public string FirstName { get; set; } + + //Added by Fluent Validator + [DataMember(Order = 2)] + public string LastName { get; set; } + + // [Validate("[" + nameof(ValidateScripts.NotNull) + "," + nameof(ValidateScripts.Length) + "(13,100)]")] e.g. Typed + // [Validate("[NotNull,Length(13,100)]")] + [ValidateNotNull] + [ValidateInclusiveBetween(13,100)] + [DataMember(Order = 3)] + public int? Age { get; set; } + + [Validate("NotEmpty(default('DateTime'))")] + //[Validate("NotEmpty")] equivalent to above thanks to: Validators.AppendDefaultValueOnEmptyValidators + [DataMember(Order = 4)] + public DateTime DateOfBirth { get; set; } + + [DataMember(Order = 5)] + public DateTime? DateDied { get; set; } + + [DataMember(Order = 6)] + public LivingStatus LivingStatus { get; set; } + } + + public class ValidateCreateRockstarValidator : AbstractValidator + { + public ValidateCreateRockstarValidator() + { + RuleFor(x => x.LastName).NotNull(); + } + } + + [AutoPopulate(nameof(LivingStatus), Value = LivingStatus.Alive)] + [DataContract] + public class NoAbstractValidator + : ICreateDb, IReturn + { + [ValidateNotNull] + [DataMember(Order = 1)] + public string FirstName { get; set; } + + [ValidateNotNull] + [DataMember(Order = 2)] + public string LastName { get; set; } + + [ValidateNotNull,ValidateInclusiveBetween(13,100)] + [DataMember(Order = 3)] + public int? Age { get; set; } + + [ValidateNotEmpty] + [DataMember(Order = 4)] + public DateTime DateOfBirth { get; set; } + + [DataMember(Order = 5)] + public LivingStatus LivingStatus { get; set; } + } + + [DataContract] + public class EmptyValidators + : ICreateDb, IReturn + { + // [Validate("NotEmpty(0)")] + [ValidateNotEmpty] + [DataMember(Order = 1)] + public int Int { get; set; } + [ValidateNotEmpty] + [DataMember(Order = 2)] + public int? NInt { get; set; } + [ValidateNotEmpty] + // [Validate("NotEmpty(default('System.TimeSpan'))")] + [DataMember(Order = 3)] + public TimeSpan TimeSpan { get; set; } + [ValidateNotEmpty] + [DataMember(Order = 4)] + public TimeSpan? NTimeSpan { get; set; } + [ValidateNotEmpty] + [DataMember(Order = 5)] + public string String { get; set; } + [ValidateNotEmpty] + [DataMember(Order = 6)] + public int[] IntArray { get; set; } + [ValidateNotEmpty] + [DataMember(Order = 7)] + public List StringList { get; set; } + } + + [DataContract] + public class TriggerAllValidators + : ICreateDb, IReturn + { + [ValidateCreditCard] + [DataMember(Order = 1)] + public string CreditCard { get; set; } + [ValidateEmail] + [DataMember(Order = 2)] + public string Email { get; set; } + [ValidateEmpty] + [DataMember(Order = 3)] + public string Empty { get; set; } + [ValidateEqual("Equal")] + [DataMember(Order = 4)] + public string Equal { get; set; } + [ValidateExclusiveBetween(10, 20)] + [DataMember(Order = 5)] + public int ExclusiveBetween { get; set; } + [ValidateGreaterThanOrEqual(10)] + [DataMember(Order = 6)] + public int GreaterThanOrEqual { get; set; } + [ValidateGreaterThan(10)] + [DataMember(Order = 7)] + public int GreaterThan { get; set; } + [ValidateInclusiveBetween(10, 20)] + [DataMember(Order = 8)] + public int InclusiveBetween { get; set; } + [ValidateExactLength(10)] + [DataMember(Order = 9)] + public string Length { get; set; } + [ValidateLessThanOrEqual(10)] + [DataMember(Order = 10)] + public int LessThanOrEqual { get; set; } + [ValidateLessThan(10)] + [DataMember(Order = 11)] + public int LessThan { get; set; } + [ValidateNotEmpty] + [DataMember(Order = 12)] + public string NotEmpty { get; set; } + [ValidateNotEqual("NotEqual")] + [DataMember(Order = 13)] + public string NotEqual { get; set; } + [ValidateNull] + [DataMember(Order = 14)] + public string Null { get; set; } + [ValidateRegularExpression("^[a-z]*$")] + [DataMember(Order = 15)] + public string RegularExpression { get; set; } + [ValidateScalePrecision(1,1)] + [DataMember(Order = 16)] + public decimal ScalePrecision { get; set; } + } + + [DataContract] + public class DynamicValidationRules + : ICreateDb, IReturn + { + [ValidateNotNull] + [DataMember(Order = 1)] + public string FirstName { get; set; } + + //[Validate("NotNull")] added in IValidationSource + [DataMember(Order = 2)] + public string LastName { get; set; } + + // [Validate("[NotNull,InclusiveBetween(13,100)]")] + [ValidateNotNull] + //[Validate("InclusiveBetween(13,100)")] added in IValidationSource + [DataMember(Order = 3)] + public int? Age { get; set; } + + [ValidateNotEmpty] + [DataMember(Order = 4)] + public DateTime DateOfBirth { get; set; } + + [DataMember(Order = 5)] + public LivingStatus LivingStatus { get; set; } + } + + [DataContract] + public class CustomValidationErrors + : ICreateDb, IReturn + { + // Just overrides ErrorCode + [ValidateNotNull(ErrorCode = "ZERROR")] + [DataMember(Order = 1)] + public string CustomErrorCode { get; set; } + + // Overrides both ErrorCode & Message + [ValidateInclusiveBetween(1,2, ErrorCode = "ZERROR", + Message = "{PropertyName} has to be between {From} and {To}, you: {PropertyValue}")] + [DataMember(Order = 2)] + public int CustomErrorCodeAndMessage { get; set; } + + // Overrides ErrorCode & uses Message from Validators + [ValidateNotNull(ErrorCode = "RuleMessage")] + [DataMember(Order = 3)] + public string ErrorCodeRule { get; set; } + + // Overrides ErrorCode & uses Message from Validators + [Validate(Condition = ValidationConditions.IsOdd)] + [DataMember(Order = 4)] + public int IsOddCondition { get; set; } + + // Combined typed conditions + Error code + [Validate(AllConditions = new[]{ ValidationConditions.IsOdd, ValidationConditions.IsOver2Digits }, ErrorCode = "RuleMessage")] + [DataMember(Order = 5)] + public int IsOddAndOverTwoDigitsCondition { get; set; } + + // Combined typed conditions + unknown error code + [Validate(AnyConditions = new[]{ ValidationConditions.IsOdd, ValidationConditions.IsOver2Digits })] + [DataMember(Order = 6)] + public int IsOddOrOverTwoDigitsCondition { get; set; } + } + + [ValidateRequest("HasRole('Manager')")] + [DataContract] + public class TestAuthValidators + : ICreateDb, IReturn + { + [ValidateNotNull] //doesn't get validated if ValidateRequest is invalid + [DataMember(Order = 1)] + public string NotNull { get; set; } + } + + [ValidateIsAuthenticated, ValidateHasRole("Manager")] + [DataContract] + public class TestMultiAuthValidators + : ICreateDb, IReturn + { + [ValidateNotNull] //doesn't get validated if ValidateRequest is invalid + [DataMember(Order = 1)] + public string NotNull { get; set; } + } + + [ValidateIsAdmin] + [DataContract] + public class TestIsAdmin + : ICreateDb, IReturn + { + [ValidateNotNull] //doesn't get validated if ValidateRequest is invalid + [DataMember(Order = 1)] + public string NotNull { get; set; } + } + + [ValidateRequest(Condition = "!dbExistsSync('SELECT * FROM RockstarAlbum WHERE RockstarId = @Id', { dto.Id })", + ErrorCode = "HasForeignKeyReferences")] + [DataContract] + public class TestDbCondition + : ICreateDb, IReturn + { + [DataMember(Order = 1)] + public int Id { get; set; } + + [ValidateNotNull] //doesn't get validated if ValidateRequest is invalid + [DataMember(Order = 2)] + public string NotNull { get; set; } + } + + [ValidateRequest("NoRockstarAlbumReferences")] + [DataContract] + public class TestDbValidator + : ICreateDb, IReturn, IHasId + { + [DataMember(Order = 1)] + public int Id { get; set; } + + [ValidateNotNull] //doesn't get validated if ValidateRequest is invalid + [DataMember(Order = 2)] + public string NotNull { get; set; } + } + + [ValidateRequest(Conditions = new[]{ "it.Test.isOdd()", "it.Test.log10() > 2" }, ErrorCode = "RuleMessage")] + [ValidateRequest(Condition = "it.Test.log10() > 3", ErrorCode = "AssertFailed2", Message = "2nd Assert Failed", StatusCode = 401)] + [DataContract] + public class OnlyValidatesRequest + : ICreateDb, IReturn + { + // Combined typed conditions + Error code + [DataMember(Order = 1)] + public int Test { get; set; } + + [Validate("NotNull")] //doesn't get validated if ValidateRequest is invalid + [DataMember(Order = 2)] + public string NotNull { get; set; } + } + + + [DataContract] + public class DaoBase + { + [DataMember(Order = 1)] + public virtual Guid Id { get; set; } + [DataMember(Order = 2)] + public virtual DateTime CreateDate { get; set; } + [DataMember(Order = 3)] + public virtual string CreatedBy { get; set; } + [DataMember(Order = 4)] + public virtual DateTime ModifiedDate { get; set; } + [DataMember(Order = 5)] + public virtual string ModifiedBy { get; set; } + } + + [DataContract] + public class Bookmark : DaoBase + { + [DataMember(Order = 1)] + public string Slug { get; set; } + [DataMember(Order = 2)] + public string Title { get; set; } + [DataMember(Order = 3)] + public string Description { get; set; } + [DataMember(Order = 4)] + public string Url { get; set; } + } + + [DataContract] + public class QueryBookmarks : QueryDb { } + + // custom script methods + [AutoPopulate(nameof(Bookmark.Id), Eval = "nguid")] + [AutoPopulate(nameof(Bookmark.CreatedBy), Eval = "userAuthId")] + [AutoPopulate(nameof(Bookmark.CreateDate), Eval = "utcNow")] + [AutoPopulate(nameof(Bookmark.ModifiedBy), Eval = "userAuthId")] + [AutoPopulate(nameof(Bookmark.ModifiedDate), Eval = "utcNow")] + [DataContract] + public class CreateBookmark : ICreateDb, IReturn + { + [DataMember(Order = 1)] + public string Slug { get; set; } + [DataMember(Order = 2)] + public string Title { get; set; } + [DataMember(Order = 3)] + public string Description { get; set; } + [DataMember(Order = 4)] + public string Url { get; set; } + } + + [DataContract] + public class CreateBookmarkResponse + { + [DataMember(Order = 1)] + public Guid Id { get; set; } + [DataMember(Order = 2)] + public Bookmark Result { get; set; } + [DataMember(Order = 3)] + public ResponseStatus ResponseStatus { get; set; } + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/AutoQueryCrudTests.cs b/tests/ServiceStack.Extensions.Tests/AutoQueryCrudTests.cs new file mode 100644 index 00000000000..db3e0da88dc --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/AutoQueryCrudTests.cs @@ -0,0 +1,1216 @@ +#if AUTOQUERY_CRUD +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Configuration; +using ServiceStack.Data; +using ServiceStack.Messaging; +using ServiceStack.OrmLite; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.Extensions.Tests +{ + public class AutoCrudGatewayServices : Service + { + public async Task Any(CreateRockstarAuditTenantGateway request) + { + var gatewayRequest = request.ConvertTo(); + var sync = Gateway.Send(gatewayRequest); + var response = await Gateway.SendAsync(gatewayRequest); + return response; + } + + public async Task Any(UpdateRockstarAuditTenantGateway request) + { + var gatewayRequest = request.ConvertTo(); + var sync = Gateway.Send(gatewayRequest); + var response = await Gateway.SendAsync(gatewayRequest); + return response; + } + + public async Task Any(PatchRockstarAuditTenantGateway request) + { + var gatewayRequest = request.ConvertTo(); + var sync = Gateway.Send(gatewayRequest); + var response = await Gateway.SendAsync(gatewayRequest); + return response; + } + + public async Task Any(RealDeleteAuditTenantGateway request) + { + var gatewayRequest = request.ConvertTo(); + var sync = Gateway.Send(gatewayRequest); + var response = await Gateway.SendAsync(gatewayRequest); + return response; + } + + public void Any(CreateRockstarAuditTenantMq request) + { + var mqRequest = request.ConvertTo(); + Request.PopulateRequestDtoIfAuthenticated(mqRequest); + PublishMessage(mqRequest); + } + + public void Any(UpdateRockstarAuditTenantMq request) + { + var mqRequest = request.ConvertTo(); + Request.PopulateRequestDtoIfAuthenticated(mqRequest); + PublishMessage(mqRequest); + } + + public void Any(PatchRockstarAuditTenantMq request) + { + var mqRequest = request.ConvertTo(); + Request.PopulateRequestDtoIfAuthenticated(mqRequest); + PublishMessage(mqRequest); + } + + public void Any(RealDeleteAuditTenantMq request) + { + var mqRequest = request.ConvertTo(); + Request.PopulateRequestDtoIfAuthenticated(mqRequest); + PublishMessage(mqRequest); + } + } + + [ConnectionInfo(NamedConnection = AutoQueryAppHost.SqlServerNamedConnection)] + public class AutoCrudConnectionInfoServices : Service + { + public IAutoQueryDb AutoQuery { get; set; } + + public Task Any(CreateConnectionInfoRockstar request) => + AutoQuery.CreateAsync(request, Request); + + public Task Any(UpdateConnectionInfoRockstar request) => + AutoQuery.UpdateAsync(request, Request); + } + + public partial class AutoQueryCrudTests + { + private readonly ServiceStackHost appHost; + public GrpcServiceClient client; + + private static readonly int TotalRockstars = AutoQueryAppHost.SeedRockstars.Length; + private static readonly int TotalAlbums = AutoQueryAppHost.SeedAlbums.Length; + private const string TenantId = nameof(TenantId); + private static readonly byte[] AuthKey = AesUtils.CreateKey(); + public static string JwtUserToken = null; + + partial void OnConfigure(AutoQueryAppHost host, Funq.Container container); + + public AutoQueryCrudTests() + { + appHost = new AutoQueryAppHost { + ConfigureFn = (host,container) => { + + container.AddSingleton(c => + new OrmLiteCrudEvents(c.Resolve()) { + NamedConnections = { AutoQueryAppHost.SqlServerNamedConnection } + }.Reset() //Drop and re-create AutoCrudEvent Table + ); + container.Resolve().InitSchema(); + + container.AddSingleton(c => + new InMemoryAuthRepository()); + host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] { + new CredentialsAuthProvider(host.AppSettings), + new JwtAuthProvider(host.AppSettings) { + RequireSecureConnection = false, + AuthKey = AuthKey, + CreatePayloadFilter = (obj, session) => { + obj[nameof(AuthUserSession.City)] = ((AuthUserSession)session).City; + } + }, + })); + + var jwtProvider = host.GetPlugin().AuthProviders.OfType().First(); + JwtUserToken = jwtProvider.CreateJwtBearerToken(new AuthUserSession { + Id = SessionExtensions.CreateRandomSessionId(), + UserName = "jwtuser", + FirstName = "JWT", + LastName = "User", + DisplayName = "JWT User", + City = "Japan", + }); + + var authRepo = container.Resolve(); + authRepo.InitSchema(); + + authRepo.CreateUserAuth(new UserAuth { + Id = 1, + Email = "admin@email.com", + DisplayName = "Admin User", + City = "London", + Roles = new List { + RoleNames.Admin + } + }, "p@55wOrd"); + + authRepo.CreateUserAuth(new UserAuth { + Id = 2, + UserName = "manager", + DisplayName = "The Manager", + City = "Perth", + Roles = new List { + "Employee", + "Manager", + } + }, "p@55wOrd"); + + authRepo.CreateUserAuth(new UserAuth { + Id = 3, + Email = "employee@email.com", + DisplayName = "An Employee", + City = "Manhattan", + Roles = new List { + "Employee", + } + }, "p@55wOrd"); + + void AddTenantId(IRequest req, IResponse res, object dto) + { + var userSession = req.SessionAs(); + if (userSession.IsAuthenticated) + { + req.SetItem(TenantId, userSession.City switch { + "London" => 10, + "Perth" => 10, + _ => 20, + }); + } + } + + host.GlobalRequestFilters.Add(AddTenantId); + host.GlobalMessageRequestFilters.Add(AddTenantId); + + container.AddSingleton(c => new BackgroundMqService()); + var mqService = container.Resolve(); + mqService.RegisterHandler(host.ExecuteMessage); + mqService.RegisterHandler(host.ExecuteMessage); + mqService.RegisterHandler(host.ExecuteMessage); + mqService.RegisterHandler(host.ExecuteMessage); + mqService.RegisterHandler(host.ExecuteMessage); + host.AfterInitCallbacks.Add(_ => mqService.Start()); + + OnConfigure(host, container); + } + } + .Init() + .Start(TestsConfig.ListeningOn); + + using var db = appHost.TryResolve().OpenDbConnection(); + db.CreateTable(); + db.CreateTable(); + db.CreateTable(); + db.CreateTable(); + db.CreateTable(); + + AutoMapping.RegisterPopulator((Dictionary target, CreateRockstarWithAutoGuid source) => { + if (source.FirstName == "Created") + { + target[nameof(source.LivingStatus)] = LivingStatus.Dead; + } + }); + + client = CreateClient(); + } + + private static GrpcServiceClient CreateClient() => TestsConfig.GetInsecureClient(); + + [OneTimeTearDown] + public void TestFixtureTearDown() => appHost.Dispose(); + + public List Rockstars => AutoQueryAppHost.SeedRockstars.ToList(); + + public List PagingTests => AutoQueryAppHost.SeedPagingTest.ToList(); + + private static GrpcServiceClient CreateAuthClient() + { + var authClient = CreateClient(); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + return authClient; + } + + [Test] + public void Can_CreateRockstar() + { + var request = new CreateRockstar { + FirstName = "Return", + LastName = "Empty", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var response = client.Post(request); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.Single(x => x.LastName == "Empty"); + Assert.That(newRockstar.FirstName, Is.EqualTo("Return")); + } + + [Test] + public void Can_CreateRockstarWithReturn() + { + var request = new CreateRockstarWithReturn { + FirstName = "Return", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,2,1), + LivingStatus = LivingStatus.Alive, + }; + + var response = client.Post(request); + + Assert.That(response.Id, Is.GreaterThan(0)); + var newRockstar = response.Result; + Assert.That(newRockstar.LastName, Is.EqualTo("Result")); + } + + [Test] + public void Can_CreateRockstarWithVoidReturn() + { + var request = new CreateRockstarWithVoidReturn { + FirstName = "Return", + LastName = "Void", + Age = 20, + DateOfBirth = new DateTime(2001,3,1), + LivingStatus = LivingStatus.Alive, + }; + + client.Post(request); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.Single(x => x.LastName == "Void"); + Assert.That(newRockstar.FirstName, Is.EqualTo("Return")); + } + + [Test] + public void Can_CreateRockstarWithAutoGuid() + { + var request = new CreateRockstarWithAutoGuid { + FirstName = "Create", + LastName = "AutoId", + Age = 20, + DateOfBirth = new DateTime(2001,4,1), + LivingStatus = LivingStatus.Alive, + }; + + var response = client.Post(request); + + Assert.That(response.Id, Is.Not.Null); + var newRockstar = response.Result; + Assert.That(newRockstar.Id, Is.EqualTo(response.Id)); + Assert.That(newRockstar.LastName, Is.EqualTo("AutoId")); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + } + + [Test] + public void Can_CreateRockstarWithAutoGuid_with_Custom_Mapping() + { + var request = new CreateRockstarWithAutoGuid { + FirstName = "Created", + LastName = "AutoId", + Age = 20, + DateOfBirth = new DateTime(2001,5,1), + LivingStatus = LivingStatus.Alive, + }; + + var response = client.Post(request); + + Assert.That(response.Id, Is.Not.Null); + var newRockstar = response.Result; + Assert.That(newRockstar.Id, Is.EqualTo(response.Id)); + Assert.That(newRockstar.LastName, Is.EqualTo("AutoId")); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Dead)); //overridden by RegisterPopulator + } + + [Test] + public void Can_UpdateRockstar() + { + var createResponse = client.Post(new CreateRockstarWithReturn { + FirstName = "UpdateReturn", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + }); + + var request = new UpdateRockstar { + Id = createResponse.Id, + LastName = "UpdateResult", + }; + + var response = client.Put(request); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.FirstName, Is.Null); + Assert.That(newRockstar.LastName, Is.EqualTo("UpdateResult")); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + } + + [Test] + public void Can_PatchRockstar() + { + var createRequest = new CreateRockstarWithReturn { + FirstName = "UpdateReturn", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + }; + var createResponse = client.Post(createRequest); + + var request = new PatchRockstar { + Id = createResponse.Id, + LastName = "UpdateResult", + }; + + var response = client.Patch(request); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.LastName, Is.EqualTo("UpdateResult")); + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.FirstName)); + Assert.That(newRockstar.Age, Is.EqualTo(createRequest.Age)); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(createRequest.LivingStatus)); + } + + [Test] + public void Can_UpdateRockstarAdhocNonDefaults() + { + var createRequest = new CreateRockstarWithReturn { + FirstName = "UpdateReturn", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + }; + var createResponse = client.Post(createRequest); + + var request = new UpdateRockstarAdhocNonDefaults { + Id = createResponse.Id, + LastName = "UpdateResult", + }; + + using (JsConfig.With(new Text.Config { AssumeUtc = true })) + { + var response = client.Put(request); + } + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.LastName, Is.EqualTo("UpdateResult")); + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.FirstName)); //[AutoUpdate(AutoUpdateStyle.NonDefaults)] + Assert.That(newRockstar.Age, Is.EqualTo(21)); //[AutoDefault(Value = 21)] + //[AutoDefault(Eval = "date(2001,1,1)")] + Assert.That(newRockstar.DateOfBirth, Is.EqualTo(new DateTime(2001,1,1))); + Assert.That(newRockstar.DateDied.Value.Date, Is.EqualTo(DateTime.UtcNow.Date)); + //[AutoUpdate(AutoUpdateStyle.NonDefaults), AutoDefault(Value = LivingStatus.Dead)] + Assert.That(newRockstar.LivingStatus, Is.EqualTo(createRequest.LivingStatus)); + } + + [Test] + public void Does_throw_when_no_rows_updated() + { + try + { + client.Put(new UpdateRockstar { + Id = 100, + LastName = "UpdateRockstar", + }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(OptimisticConcurrencyException))); + } + } + + [Test] + public void Can_Delete_CreateRockstarWithReturn() + { + var request = new CreateRockstarWithReturn { + FirstName = "Delete", + LastName = "Rockstar", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(request); + + using var db = appHost.GetDbConnection(); + + var newRockstar = db.Single(x => x.Id == createResponse.Id); + Assert.That(newRockstar, Is.Not.Null); + + var response = client.Delete(new DeleteRockstar { + Id = createResponse.Id + }); + + newRockstar = db.Single(x => x.Id == createResponse.Id); + Assert.That(newRockstar, Is.Null); + } + + [Test] + public void Does_throw_for_Delete_without_filters() + { + var request = new CreateRockstarWithReturn { + FirstName = "Delete", + LastName = "Rockstar", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(request); + + try + { + var response = client.Delete(new DeleteRockstar()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(NotSupportedException))); + } + } + + [Test] + public void Can_delete_with_multiple_non_PrimaryKey_filters() + { + var requests = 5.Times(i => new CreateRockstarWithReturn { + FirstName = "Delete", + LastName = "Filter" + i, + Age = 23, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }); + + requests.Each(x => client.Post(x)); + + try + { + client.Delete(new DeleteRockstarFilters()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(NotSupportedException))); + } + + using var db = appHost.GetDbConnection(); + + var response = client.Delete(new DeleteRockstarFilters { Age = 23, LastName = "Filter1" }); + Assert.That(response.Count, Is.EqualTo(1)); + var remaining = db.Select(x => x.Age == 23); + Assert.That(remaining.Count, Is.EqualTo(5 - 1)); + + response = client.Delete(new DeleteRockstarFilters { Age = 23 }); + Assert.That(response.Count, Is.EqualTo(4)); + remaining = db.Select(x => x.Age == 23); + Assert.That(remaining.Count, Is.EqualTo(0)); + } + + [Test] + public void Can_CreateRockstarAdhocNonDefaults() + { + var createRequest = new CreateRockstarAdhocNonDefaults { + FirstName = "Create", + LastName = "Defaults", + }; + + using var jsScope = JsConfig.With(new Text.Config { AssumeUtc = true }); + var createResponse = client.Post(createRequest); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.LastName, Is.EqualTo("Defaults")); + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.FirstName)); + Assert.That(newRockstar.Age, Is.EqualTo(21)); //[AutoDefault(Value = 21)] + //[AutoDefault(Eval = "date(2001,1,1)")] + Assert.That(newRockstar.DateOfBirth, Is.EqualTo(new DateTime(2001,1,1))); + Assert.That(newRockstar.DateDied.Value.Date, Is.EqualTo(DateTime.UtcNow.Date)); + //[AutoDefault(Value = global::ServiceStack.WebHost.Endpoints.Tests.LivingStatus.Dead)] + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + } + + [Test] + public void Can_CreateRockstarAutoMap() + { + var createRequest = new CreateRockstarAutoMap { + MapFirstName = "Map", + MapLastName = "Defaults", + MapDateOfBirth = new DateTime(2002,2,2), + MapLivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(createRequest); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.LastName, Is.EqualTo("Defaults")); + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.MapFirstName)); + Assert.That(newRockstar.Age, Is.EqualTo(21)); //[AutoDefault(Value = 21)] + //[AutoDefault(Eval = "date(2001,1,1)")] + Assert.That(newRockstar.DateOfBirth.Date, Is.EqualTo(new DateTime(2002,2,2).Date)); + Assert.That(newRockstar.DateDied.Value.Date, Is.EqualTo(DateTime.UtcNow.Date)); + //[AutoDefault(Value = LivingStatus.Alive)] + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + } + + [Test] + public void Can_CreateRockstarAudit() + { + var authClient = CreateClient(); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + var createResponse = authClient.Post(new CreateRockstarAudit { + FirstName = "Create", + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.FirstName, Is.EqualTo("Create")); + Assert.That(newRockstar.LastName, Is.EqualTo("Audit")); + Assert.That(newRockstar.Age, Is.EqualTo(20)); + Assert.That(newRockstar.DateOfBirth.Date, Is.EqualTo(new DateTime(2002,2,2).Date)); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + Assert.That(newRockstar.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(newRockstar.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.ModifiedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.ModifiedInfo, Is.EqualTo("Admin User (London)")); + + authClient = CreateClient(); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + authClient.Patch(new UpdateRockstarAudit { + Id = createResponse.Id, + FirstName = "Updated", + // LivingStatus = LivingStatus.Alive, + }); + + newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.FirstName, Is.EqualTo("Updated")); + // Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + Assert.That(newRockstar.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(newRockstar.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.ModifiedBy, Is.EqualTo("manager")); + Assert.That(newRockstar.ModifiedInfo, Is.EqualTo("The Manager (Perth)")); + + authClient.Delete(new DeleteRockstarAudit { + Id = createResponse.Id, + }); + + newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar, Is.Null); + } + + [Test] + public async Task Can_CreateRockstarAuditTenant_with_Events() + { + var dbEvents = (OrmLiteCrudEvents) appHost.Resolve(); + dbEvents.Clear(); + + var authClient = CreateAuthClient(); + var id = CreateAndSoftDeleteRockstarAuditTenant(authClient); + + using var db = appHost.GetDbConnection(); + + void assertState(RockstarAuditTenant result) + { + Assert.That(result.Id, Is.EqualTo(id)); + Assert.That(result.FirstName, Is.EqualTo("Updated & Patched")); + Assert.That(result.LastName, Is.EqualTo("Audit")); + Assert.That(result.Age, Is.EqualTo(20)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(new DateTime(2002, 2, 2).Date)); + Assert.That(result.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + + Assert.That(result.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(result.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(result.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(result.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(result.ModifiedBy, Is.EqualTo("manager")); + Assert.That(result.ModifiedInfo, Is.EqualTo("The Manager (Perth)")); + } + + var crudEvents = db.Select(); + // events.PrintDump(); + Assert.That(crudEvents.Count, Is.EqualTo(4)); + Assert.That(crudEvents.Count(x => x.RequestType == nameof(CreateRockstarAuditTenant)), Is.EqualTo(1)); + Assert.That(crudEvents.Count(x => x.RequestType == nameof(UpdateRockstarAuditTenant)), Is.EqualTo(1)); + Assert.That(crudEvents.Count(x => x.RequestType == nameof(PatchRockstarAuditTenant)), Is.EqualTo(1)); + Assert.That(crudEvents.Count(x => x.RequestType == nameof(SoftDeleteAuditTenant)), Is.EqualTo(1)); + + var newRockstar = db.SingleById(id); + assertState(newRockstar); + + db.DeleteById(id); + Assert.That(db.SingleById(id), Is.Null); + + // OrmLiteUtils.PrintSql(); + + var eventsPlayer = new CrudEventsExecutor(appHost); + foreach (var crudEvent in dbEvents.GetEvents(db)) + { + await eventsPlayer.ExecuteAsync(crudEvent); + } + + crudEvents = db.Select(); + Assert.That(crudEvents.Count, Is.EqualTo(4)); // Should not be any new events created by executor + + newRockstar = db.SingleById(id); //uses the same Id + assertState(newRockstar); // State should be the same + } + + [Test] + public void Can_CreateRockstarAuditTenant() + { + var authClient = CreateAuthClient(); + CreateAndSoftDeleteRockstarAuditTenant(authClient); + } + + private int CreateAndSoftDeleteRockstarAuditTenant(GrpcServiceClient authClient) + { + using var db = appHost.GetDbConnection(); + db.DeleteAll(); + + var createRequest = new CreateRockstarAuditTenant { + FirstName = "Create", + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002, 2, 2), + LivingStatus = LivingStatus.Dead, + }; + var createResponse = authClient.Post(createRequest); + var id = createResponse.Id; + Assert.That(id, Is.GreaterThan(0)); + var result = createResponse.Result; + + Assert.That(result.FirstName, Is.EqualTo(createRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(createRequest.LivingStatus)); + + var newRockstar = db.SingleById(id); + Assert.That(newRockstar.TenantId, Is.EqualTo(10)); //admin.City London => 10 + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.FirstName)); + Assert.That(newRockstar.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(newRockstar.Age, Is.EqualTo(createRequest.Age)); + Assert.That(newRockstar.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(createRequest.LivingStatus)); + + Assert.That(newRockstar.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(newRockstar.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.ModifiedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.ModifiedInfo, Is.EqualTo("Admin User (London)")); + + Assert.That(authClient.Get(new QueryRockstarAudit {Id = id}).Results.Count, + Is.EqualTo(1)); + + authClient = CreateClient(); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + var updateRequest = new UpdateRockstarAuditTenant { + Id = id, + FirstName = "Updated", + LivingStatus = LivingStatus.Alive, + }; + var updateResponse = authClient.Put(updateRequest); + + void assertUpdated(RockstarAuto result) + { + Assert.That(result.FirstName, Does.StartWith(updateRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(updateRequest.LivingStatus)); + } + + Assert.That(updateResponse.Id, Is.EqualTo(id)); + assertUpdated(updateResponse.Result); + + newRockstar = db.SingleById(id); + Assert.That(newRockstar.FirstName, Is.EqualTo("Updated")); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + + Assert.That(newRockstar.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(newRockstar.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.ModifiedBy, Is.EqualTo("manager")); + Assert.That(newRockstar.ModifiedInfo, Is.EqualTo("The Manager (Perth)")); + + Assert.That(authClient.Get(new QueryRockstarAuditSubOr { + FirstNameStartsWith = "Up", + AgeOlderThan = 18, + }).Results.Count, + Is.EqualTo(1)); + + var patchRequest = new PatchRockstarAuditTenant { + Id = id, + FirstName = updateRequest.FirstName + " & Patched" + }; + var patchResponse = authClient.Patch(patchRequest); + Assert.That(patchResponse.Result.FirstName, Is.EqualTo("Updated & Patched")); + assertUpdated(patchResponse.Result); + + var softDeleteResponse = authClient.Put(new SoftDeleteAuditTenant { + Id = id, + }); + + Assert.That(softDeleteResponse.Id, Is.EqualTo(id)); + assertUpdated(softDeleteResponse.Result); + + newRockstar = db.SingleById(id); + Assert.That(newRockstar.SoftDeletedDate.Value.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.SoftDeletedBy, Is.EqualTo("manager")); + Assert.That(newRockstar.SoftDeletedInfo, Is.EqualTo("The Manager (Perth)")); + + Assert.That(authClient.Get(new QueryRockstarAudit { Id = id }).Results?.Count ?? 0, + Is.EqualTo(0)); + + Assert.That(authClient.Get(new QueryRockstarAuditSubOr { + FirstNameStartsWith = "Up", + AgeOlderThan = 18, + }).Results?.Count ?? 0, + Is.EqualTo(0)); + + return id; + } + + [Test] + public void Can_CreateRockstarAuditTenant_with_RealDelete() + { + var authClient = CreateAuthClient(); + var id = CreateAndSoftDeleteRockstarAuditTenant(authClient); + + using var db = appHost.GetDbConnection(); + + var realDeleteResponse = authClient.Delete(new RealDeleteAuditTenant { + Id = id, + Age = 99 //non matching filter + }); + Assert.That(realDeleteResponse.Id, Is.EqualTo(id)); + Assert.That(realDeleteResponse.Count, Is.EqualTo(0)); + var newRockstar = db.SingleById(id); + Assert.That(newRockstar, Is.Not.Null); + + realDeleteResponse = authClient.Delete(new RealDeleteAuditTenant { + Id = id, + }); + Assert.That(realDeleteResponse.Id, Is.EqualTo(id)); + Assert.That(realDeleteResponse.Count, Is.EqualTo(1)); + newRockstar = db.SingleById(id); + Assert.That(newRockstar, Is.Null); + } + + [Test] + public void Can_CreateRockstarAuditTenantGateway_Gateway() + { + var authClient = CreateClient(); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + var createRequest = new CreateRockstarAuditTenantGateway { + FirstName = "CreateGateway", + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }; + + var createResponse = authClient.Post(createRequest); + Assert.That(createResponse.Id, Is.GreaterThan(0)); + var result = createResponse.Result; + + var updateRequest = new UpdateRockstarAuditTenantGateway { + Id = createResponse.Id, + FirstName = "UpdatedGateway", + LivingStatus = LivingStatus.Alive, + }; + var updateResponse = authClient.Put(updateRequest); + result = updateResponse.Result; + + Assert.That(updateResponse.Id, Is.EqualTo(createResponse.Id)); + Assert.That(result.FirstName, Is.EqualTo(updateRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(updateRequest.LivingStatus)); + + var patchRequest = new PatchRockstarAuditTenantGateway { + Id = createResponse.Id, + FirstName = "PatchedGateway", + LivingStatus = LivingStatus.Alive, + }; + var patchResponse = authClient.Patch(patchRequest); + result = patchResponse.Result; + + Assert.That(updateResponse.Id, Is.EqualTo(createResponse.Id)); + Assert.That(result.FirstName, Is.EqualTo(patchRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(patchRequest.LivingStatus)); + + var deleteRequest = authClient.Delete(new RealDeleteAuditTenantGateway { + Id = createResponse.Id, + }); + Assert.That(deleteRequest.Id, Is.EqualTo(createResponse.Id)); + } + + [Test] + public void Can_CreateRockstarAuditTenantMq() + { + var authClient = CreateClient(); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + }); + + var createRequest = new CreateRockstarAuditTenantMq { + FirstName = nameof(CreateRockstarAuditTenantMq), + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }; + + authClient.Post(createRequest); + + using var db = appHost.GetDbConnection(); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(CreateRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + var result = db.Single(x => x.FirstName == nameof(CreateRockstarAuditTenantMq)); + + var updateRequest = new UpdateRockstarAuditTenantMq { + Id = result.Id, + FirstName = nameof(UpdateRockstarAuditTenantMq), + LivingStatus = LivingStatus.Alive, + }; + authClient.Put(updateRequest); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(UpdateRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + result = db.Single(x => x.FirstName == nameof(UpdateRockstarAuditTenantMq)); + + Assert.That(result.FirstName, Is.EqualTo(updateRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(updateRequest.LivingStatus)); + + var patchRequest = new PatchRockstarAuditTenantMq { + Id = result.Id, + FirstName = nameof(PatchRockstarAuditTenantMq), + LivingStatus = LivingStatus.Alive, + }; + authClient.Patch(patchRequest); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + result = db.Single(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)); + + Assert.That(result.FirstName, Is.EqualTo(patchRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(patchRequest.LivingStatus)); + + authClient.Delete(new RealDeleteAuditTenantMq { + Id = result.Id, + }); + + ExecUtils.RetryUntilTrue(() => + !db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + + Assert.That(db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), Is.False); + } + + [Test] + public void Can_CreateRockstarAuditTenant_Send() + { + var authClient = CreateClient(); + var authResponse = authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + var createRequest = new CreateRockstarAuditTenant { + FirstName = nameof(CreateRockstarAuditTenant), + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }; + + authClient.Send(createRequest); + + using var db = appHost.GetDbConnection(); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(CreateRockstarAuditTenant)), + TimeSpan.FromSeconds(2)); + var result = db.Single(x => x.FirstName == nameof(CreateRockstarAuditTenant)); + + var updateRequest = new UpdateRockstarAuditTenant { + Id = result.Id, + FirstName = nameof(UpdateRockstarAuditTenant), + LivingStatus = LivingStatus.Alive, + }; + authClient.Send(updateRequest); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(UpdateRockstarAuditTenant)), + TimeSpan.FromSeconds(2)); + result = db.Single(x => x.FirstName == nameof(UpdateRockstarAuditTenant)); + + Assert.That(result.FirstName, Is.EqualTo(updateRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(updateRequest.LivingStatus)); + + var patchRequest = new PatchRockstarAuditTenant { + Id = result.Id, + FirstName = nameof(PatchRockstarAuditTenant), + LivingStatus = LivingStatus.Alive, + }; + authClient.Send(patchRequest); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenant)), + TimeSpan.FromSeconds(2)); + result = db.Single(x => x.FirstName == nameof(PatchRockstarAuditTenant)); + + Assert.That(result.FirstName, Is.EqualTo(patchRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(patchRequest.LivingStatus)); + + authClient.Delete(new RealDeleteAuditTenant { + Id = result.Id, + }); + + ExecUtils.RetryUntilTrue(() => + !db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + + Assert.That(db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), Is.False); + } + + [Test] + public void Can_CreateRockstarAuditMqToken_OneWay() + { + var createRequest = new CreateRockstarAuditMqToken { + BearerToken = JwtUserToken, + FirstName = nameof(CreateRockstarAuditMqToken), + LastName = "JWT", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }; + + client.Send(createRequest); + + using var db = appHost.GetDbConnection(); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(CreateRockstarAuditMqToken)), + TimeSpan.FromSeconds(2)); + + var result = db.Single(x => x.FirstName == nameof(CreateRockstarAuditMqToken)); + Assert.That(result.Id, Is.GreaterThan(0)); + Assert.That(result.FirstName, Is.EqualTo(nameof(CreateRockstarAuditMqToken))); + Assert.That(result.LastName, Is.EqualTo("JWT")); + Assert.That(result.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + Assert.That(result.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(result.CreatedBy, Is.EqualTo("jwtuser")); + Assert.That(result.CreatedInfo, Is.EqualTo("JWT User (Japan)")); + Assert.That(result.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(result.ModifiedBy, Is.EqualTo("jwtuser")); + Assert.That(result.ModifiedInfo, Is.EqualTo("JWT User (Japan)")); + } + + [Test] + public void Can_UpdateRockstarVersion() + { + var createResponse = client.Post(new CreateRockstarVersion { + FirstName = "Create", + LastName = "Version", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + }); + + try + { + client.Patch(new UpdateRockstarVersion { + Id = createResponse.Id, + LastName = "UpdateVersion2", + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(OptimisticConcurrencyException))); + } + + var response = client.Patch(new UpdateRockstarVersion { + Id = createResponse.Id, + LastName = "UpdateVersion3", + RowVersion = createResponse.RowVersion, + }); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.RowVersion, Is.Not.EqualTo(default(uint))); + Assert.That(newRockstar.FirstName, Is.EqualTo("Create")); + Assert.That(newRockstar.LastName, Is.EqualTo("UpdateVersion3")); + + try + { + client.Patch(new UpdateRockstarVersion { + Id = createResponse.Id, + LastName = "UpdateVersion4", + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(OptimisticConcurrencyException))); + } + } + + [Test] + public void Can_NamedConnection_AutoCrud_Services() + { + var createRequest = new CreateNamedRockstar { + Id = 10, + FirstName = "Named", + LastName = "SqlServer", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(createRequest); + Assert.That(createResponse.Id, Is.EqualTo(10)); + Assert.That(createResponse.Result, Is.Not.Null); + + using var db = appHost.Resolve() + .OpenDbConnection(AutoQueryAppHost.SqlServerNamedConnection); + + var newRockstar = db.Single(x => x.LastName == "SqlServer"); + Assert.That(newRockstar.FirstName, Is.EqualTo("Named")); + + var updateRequest = new UpdateNamedRockstar { + Id = 10, + FirstName = "Updated", + Age = 21, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Dead, + }; + + var updateResponse = client.Put(updateRequest); + + Assert.That(updateResponse.Id, Is.EqualTo(10)); + Assert.That(updateResponse.Result.FirstName, Is.EqualTo("Updated")); + Assert.That(updateResponse.Result.Age, Is.EqualTo(21)); + Assert.That(updateResponse.Result.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + } + + [Test] + public void Can_ConnectionInfo_AutoCrud_Services() + { + var createRequest = new CreateConnectionInfoRockstar { + Id = 11, + FirstName = "Named", + LastName = "SqlServer", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(createRequest); + Assert.That(createResponse.Id, Is.EqualTo(11)); + Assert.That(createResponse.Result, Is.Not.Null); + + using var db = appHost.Resolve() + .OpenDbConnection(AutoQueryAppHost.SqlServerNamedConnection); + + var newRockstar = db.Single(x => x.LastName == "SqlServer"); + Assert.That(newRockstar.FirstName, Is.EqualTo("Named")); + + var updateRequest = new UpdateConnectionInfoRockstar { + Id = 11, + FirstName = "Updated", + Age = 21, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Dead, + }; + + var updateResponse = client.Put(updateRequest); + + Assert.That(updateResponse.Id, Is.EqualTo(11)); + Assert.That(updateResponse.Result.FirstName, Is.EqualTo("Updated")); + Assert.That(updateResponse.Result.Age, Is.EqualTo(21)); + Assert.That(updateResponse.Result.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + } + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/GrpcAuthTests.cs b/tests/ServiceStack.Extensions.Tests/GrpcAuthTests.cs new file mode 100644 index 00000000000..2ee29b39f3d --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/GrpcAuthTests.cs @@ -0,0 +1,398 @@ +using System; +using System.Linq; +using System.Net; +using System.Runtime.Serialization; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf.Grpc.Client; +using ServiceStack.Auth; +using ServiceStack.Text; +using ServiceStack.Validation; + +namespace ServiceStack.Extensions.Tests +{ + [DataContract] + public class HelloJwt : IReturn, IHasBearerToken + { + [DataMember(Order = 1)] + public string Name { get; set; } + [DataMember(Order = 2)] + public string BearerToken { get; set; } + } + [DataContract] + public class HelloJwtResponse + { + [DataMember(Order = 1)] + public string Result { get; set; } + [DataMember(Order = 2)] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class Secured : IReturn + { + [DataMember(Order = 1)] + public string Name { get; set; } + } + + [DataContract] + public class SecuredResponse + { + [DataMember(Order = 1)] + public string Result { get; set; } + + [DataMember(Order = 2)] + public ResponseStatus ResponseStatus { get; set; } + } + + [Authenticate] + public class AuthServices : Service + { + public object Any(HelloJwt request) + { + return new HelloJwtResponse { Result = $"Hello, {request.Name}" }; + } + + public object Post(Secured request) + { + return new SecuredResponse { Result = $"Hello, {request.Name}" }; + } + } + + [DataContract] + public class RequiresAuth : IReturn, IHasBearerToken + { + [DataMember(Order = 1)] + public string Name { get; set; } + [DataMember(Order = 2)] + public string BearerToken { get; set; } + } + + [Authenticate] + public class RequiresAuthService : Service + { + public static ApiKey LastApiKey; + + public object Any(RequiresAuth request) + { + LastApiKey = base.Request.GetApiKey(); + return request; + } + } + + public class GrpcAuthTests + { + public static readonly byte[] AuthKey = AesUtils.CreateKey(); + public const string Username = "mythz"; + public const string Password = "p@55word"; + + private static IManageApiKeys apiRepo; + private const string userId = "1"; + private static ApiKey liveKey; + private static ApiKey testKey; + + public class AppHost : AppSelfHostBase + { + public static ApiKey LastApiKey; + public AppHost() + : base(nameof(GrpcTests), typeof(MyServices).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new ValidationFeature()); + Plugins.Add(new GrpcFeature(App)); + + container.Register(new InMemoryAuthRepository()); + container.Resolve().InitSchema(); + + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] + { + new BasicAuthProvider(), + new CredentialsAuthProvider(), + new JwtAuthProvider + { + AuthKey = AuthKey, + RequireSecureConnection = false, + AllowInQueryString = true, + AllowInFormData = true, + IncludeJwtInConvertSessionToTokenResponse = true, + }, + new ApiKeyAuthProvider(AppSettings) { RequireSecureConnection = false }, + })); + + Plugins.Add(new RegistrationFeature()); + + GlobalRequestFilters.Add((req, res, dto) => + { + LastApiKey = req.GetApiKey(); + }); + + AfterInitCallbacks.Add(host => { + + var authRepo = GetAuthRepository(); + (authRepo as InMemoryAuthRepository).Clear(); + authRepo.CreateUserAuth(new UserAuth + { + Id = userId.ToInt(), + UserName = Username, + FirstName = "First", + LastName = "Last", + DisplayName = "Display", + }, Password); + + apiRepo = (IManageApiKeys)container.Resolve(); + var apiKeyProvider = (ApiKeyAuthProvider)AuthenticateService.GetAuthProvider(ApiKeyAuthProvider.Name); + var apiKeys = apiKeyProvider.GenerateNewApiKeys(userId); + using (authRepo as IDisposable) + { + apiRepo.StoreAll(apiKeys); + } + liveKey = apiKeys.First(x => x.Environment == "live"); + testKey = apiKeys.First(x => x.Environment == "test"); + }); + } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; + }); + } + + public override void Configure(IServiceCollection services) + { + services.AddServiceStackGrpc(); + } + + public override void Configure(IApplicationBuilder app) + { + app.UseRouting(); + } + } + + private readonly ServiceStackHost appHost; + public GrpcAuthTests() + { + appHost = new AppHost() + .Init() + .Start(TestsConfig.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + private static string CreateExpiredToken() + { + var jwtProvider = (JwtAuthProvider)AuthenticateService.GetAuthProvider(JwtAuthProviderReader.Name); + jwtProvider.CreatePayloadFilter = (jwtPayload, session) => + jwtPayload["exp"] = DateTime.UtcNow.AddSeconds(-1).ToUnixTime().ToString(); + + var token = jwtProvider.CreateJwtBearerToken(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }); + + jwtProvider.CreatePayloadFilter = null; + return token; + } + + private async Task GetRefreshToken() + { + var authClient = GetClient(); + var response = await authClient.SendAsync(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + }); + return response.RefreshToken; + } + + private static GrpcServiceClient GetClient() => TestsConfig.GetInsecureClient(); + + protected virtual async Task GetClientWithRefreshToken(string refreshToken = null, string accessToken = null) + { + if (refreshToken == null) + { + refreshToken = await GetRefreshToken(); + } + + var client = GetClient(); + client.RefreshToken = refreshToken; + client.BearerToken = accessToken; + return client; + } + + protected virtual GrpcServiceClient GetClientWithBasicAuthCredentials() + { + var client = GetClient(); + client.SetCredentials(Username, Password); + return client; + } + + [Test] + public async Task Can_not_access_Secured_without_Auth() + { + var client = GetClient(); + + try + { + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.Message.Print(); + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.Unauthorized))); + } + } + + [Test] + public async Task Can_access_Secured_using_BasicAuth() + { + var client = GetClientWithBasicAuthCredentials(); + + var request = new Secured { Name = "test" }; + + var response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + + response = await client.PostAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + } + + [Test] + public async Task Can_ConvertSessionToToken() + { + var authClient = GetClient(); + var authResponse = await authClient.SendAsync(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + }); + Assert.That(authResponse.SessionId, Is.Not.Null); + Assert.That(authResponse.UserName, Is.EqualTo(Username)); + Assert.That(authResponse.BearerToken, Is.Not.Null); + + authClient.SessionId = authResponse.SessionId; + + var response = await authClient.SendAsync(new HelloJwt { Name = "from auth service" }); + Assert.That(response.Result, Is.EqualTo("Hello, from auth service")); + + authClient.BearerToken = (await authClient.SendAsync(new ConvertSessionToToken())).AccessToken; + Assert.That(authClient.BearerToken, Is.Not.Null); + + authClient.SessionId = null; + + response = await authClient.SendAsync(new HelloJwt { Name = "from auth service" }); + Assert.That(response.Result, Is.EqualTo("Hello, from auth service")); + } + + [Test] + public async Task Invalid_RefreshToken_throws_RefreshTokenException() + { + var client = await GetClientWithRefreshToken("Invalid.Refresh.Token"); + try + { + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.Fail("Should throw"); + } + catch (RefreshTokenException ex) + { + ex.Message.Print(); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + } + } + + [Test] + public async Task Can_Auto_reconnect_with_just_RefreshToken() + { + var client = await GetClientWithRefreshToken(); + + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + + response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + } + + [Test] + public async Task Can_Auto_reconnect_with_RefreshToken_after_expired_token() + { + var client = await GetClientWithRefreshToken(await GetRefreshToken(), CreateExpiredToken()); + + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + + response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + } + + [Test] + public async Task Does_return_token_on_subsequent_BasicAuth_Authentication_requests() + { + var client = GetClientWithBasicAuthCredentials(); + + var response = await client.PostAsync(new Authenticate()); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + + response = await client.PostAsync(new Authenticate()); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + } + + [Test] + public async Task Can_Authenticate_with_ApiKey() + { + AppHost.LastApiKey = null; + RequiresAuthService.LastApiKey = null; + + var client = GetClient(); + client.BearerToken = liveKey.Id; + + var request = new RequiresAuth { Name = "foo" }; + var response = await client.SendAsync(request); + Assert.That(response.Name, Is.EqualTo(request.Name)); + + Assert.That(AppHost.LastApiKey.Id, Is.EqualTo(liveKey.Id)); + Assert.That(RequiresAuthService.LastApiKey.Id, Is.EqualTo(liveKey.Id)); + + client.BearerToken = testKey.Id; + var testResponse = await client.SendAsync(new Secured { Name = "test" }); + Assert.That(testResponse.Result, Is.EqualTo("Hello, test")); + + Assert.That(AppHost.LastApiKey.Id, Is.EqualTo(testKey.Id)); + } + + [Test] + public async Task Does_allow_ApiKey_in_IHasBearerToken_RequestDto() + { + AppHost.LastApiKey = null; + RequiresAuthService.LastApiKey = null; + + var client = GetClient(); + + var request = new RequiresAuth { BearerToken = liveKey.Id, Name = "foo" }; + var response = await client.SendAsync(request); + Assert.That(response.Name, Is.EqualTo(request.Name)); + + Assert.That(AppHost.LastApiKey.Id, Is.EqualTo(liveKey.Id)); + Assert.That(RequiresAuthService.LastApiKey.Id, Is.EqualTo(liveKey.Id)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/GrpcAutoQueryTests.cs b/tests/ServiceStack.Extensions.Tests/GrpcAutoQueryTests.cs new file mode 100644 index 00000000000..3d769f80a94 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/GrpcAutoQueryTests.cs @@ -0,0 +1,1933 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Runtime.Serialization; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf; +using ProtoBuf.Grpc.Client; +using ServiceStack.Data; +using ServiceStack.DataAnnotations; +using ServiceStack.Logging; +using ServiceStack.OrmLite; +using ServiceStack.Script; +using ServiceStack.Text; +using ServiceStack.Validation; + +namespace ServiceStack.Extensions.Tests +{ + [DataContract] + public class Rockstar + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string FirstName { get; set; } + [DataMember(Order = 3)] + public string LastName { get; set; } + [DataMember(Order = 4)] + public int? Age { get; set; } + [DataMember(Order = 5)] + public DateTime DateOfBirth { get; set; } + [DataMember(Order = 6)] + public DateTime? DateDied { get; set; } + [DataMember(Order = 7)] + public LivingStatus LivingStatus { get; set; } + } + + public enum LivingStatus + { + Alive, + Dead + } + + [DataContract] + public class PagingTest + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string Name { get; set; } + [DataMember(Order = 3)] + public int Value { get; set; } + } + + + [Alias("Rockstar")] + [NamedConnection("SqlServer")] + [DataContract] + public class NamedRockstar : Rockstar { } + + [Route("/query/namedrockstars")] + [DataContract] + public class QueryNamedRockstars : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [Route("/query/rockstars")] + [DataContract, Id(10), Tag(Keywords.Dynamic)] + public class QueryRockstars : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [Route("/query/rockstaralbums")] + [DataContract] + public class QueryRockstarAlbums : QueryDb + { + [DataMember(Order = 1)] + public int? Id { get; set; } + [DataMember(Order = 2)] + public int? RockstarId { get; set; } + [DataMember(Order = 3)] + public string Name { get; set; } + [DataMember(Order = 4)] + public string Genre { get; set; } + [DataMember(Order = 5)] + public int[] IdBetween { get; set; } + } + + [Route("/query/pagingtest")] + [DataContract] + public class QueryPagingTest : QueryDb + { + [DataMember(Order = 1)] + public int? Id { get; set; } + [DataMember(Order = 2)] + public string Name { get; set; } + [DataMember(Order = 3)] + public int? Value { get; set; } + } + + [DataContract] + public class QueryRockstarsConventions : QueryDb + { + [DataMember(Order = 1)] + public DateTime? DateOfBirthGreaterThan { get; set; } + [DataMember(Order = 2)] + public DateTime? DateDiedLessThan { get; set; } + [DataMember(Order = 3)] + public int[] Ids { get; set; } + [DataMember(Order = 4)] + public int? AgeOlderThan { get; set; } + [DataMember(Order = 5)] + public int? AgeGreaterThanOrEqualTo { get; set; } + [DataMember(Order = 6)] + public int? AgeGreaterThan { get; set; } + [DataMember(Order = 7)] + public int? GreaterThanAge { get; set; } + [DataMember(Order = 8)] + public string FirstNameStartsWith { get; set; } + [DataMember(Order = 9)] + public string LastNameEndsWith { get; set; } + [DataMember(Order = 10)] + public string LastNameContains { get; set; } + [DataMember(Order = 11)] + public string RockstarAlbumNameContains { get; set; } + [DataMember(Order = 12)] + public int? RockstarIdAfter { get; set; } + [DataMember(Order = 13)] + public int? RockstarIdOnOrAfter { get; set; } + } + + [DataContract] + public class QueryCustomRockstars : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [Route("/customrockstars")] + [DataContract] + public class QueryJoinedRockstarAlbums : QueryDb, IJoin + { + [DataMember(Order = 1)] + public int? Age { get; set; } + [DataMember(Order = 2)] + public string RockstarAlbumName { get; set; } + } + + [DataContract] + public class QueryRockstarAlbumsImplicit : QueryDb, IJoin + { + } + + [DataContract] + public class QueryRockstarAlbumsLeftJoin : QueryDb, ILeftJoin + { + [DataMember(Order = 1)] + public int? Age { get; set; } + [DataMember(Order = 2)] + public string AlbumName { get; set; } + [DataMember(Order = 3)] + public int? IdNotEqualTo { get; set; } + } + + [DataContract] + public class QueryRockstarAlbumsCustomLeftJoin : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + [DataMember(Order = 2)] + public string AlbumName { get; set; } + [DataMember(Order = 3)] + public int? IdNotEqualTo { get; set; } + } + + [DataContract] + public class QueryMultiJoinRockstar : QueryDb, + IJoin, + IJoin + { + [DataMember(Order = 1)] + public int? Age { get; set; } + [DataMember(Order = 2)] + public string RockstarAlbumName { get; set; } + [DataMember(Order = 3)] + public string RockstarGenreName { get; set; } + } + + [DataContract] + public class QueryOverridedRockstars : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [DataContract] + public class QueryOverridedCustomRockstars : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [DataContract] + public class QueryCaseInsensitiveOrderBy : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [DataContract] + public class QueryFieldRockstars : QueryDb + { + [DataMember(Order = 1)] + public string FirstName { get; set; } //default to 'AND FirstName = {Value}' + + [DataMember(Order = 2)] + public string[] FirstNames { get; set; } //Collections default to 'FirstName IN ({Values}) + + [QueryDbField(Operand = ">=")] + [DataMember(Order = 3)] + public int? Age { get; set; } + + [QueryDbField(Template = "UPPER({Field}) LIKE UPPER({Value})", Field = "FirstName")] + [DataMember(Order = 4)] + public string FirstNameCaseInsensitive { get; set; } + + [QueryDbField(Template = "{Field} LIKE {Value}", Field = "FirstName", ValueFormat = "{0}%")] + [DataMember(Order = 5)] + public string FirstNameStartsWith { get; set; } + + [QueryDbField(Template = "{Field} LIKE {Value}", Field = "LastName", ValueFormat = "%{0}")] + [DataMember(Order = 6)] + public string LastNameEndsWith { get; set; } + + [QueryDbField(Template = "{Field} BETWEEN {Value1} AND {Value2}", Field = "FirstName")] + [DataMember(Order = 7)] + public string[] FirstNameBetween { get; set; } + + [QueryDbField(Term = QueryTerm.Or, Template = "UPPER({Field}) LIKE UPPER({Value})", Field = "LastName")] + [DataMember(Order = 8)] + public string OrLastName { get; set; } + } + + [DataContract] + public class QueryRockstarAlias : QueryDb, + IJoin + { + [DataMember(Order = 1)] + public int? Age { get; set; } + [DataMember(Order = 2)] + public string RockstarAlbumName { get; set; } + } + + [DataContract] + public class RockstarAlias + { + [DataMember(Order = 1)] + [Alias("Id")] + public int RockstarId { get; set; } + + [DataMember(Order = 2)] + public string FirstName { get; set; } + + [DataMember(Order = 3)] + [Alias("LastName")] + public string Surname { get; set; } + + [DataMember(Name = "album", Order = 4)] + public string RockstarAlbumName { get; set; } + } + + [DataContract] + public class QueryFieldRockstarsDynamic : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [DataContract] + public class QueryRockstarsFilter : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [DataContract] + public class QueryCustomRockstarsFilter : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + public interface IFilterRockstars { } + [DataContract] + public class QueryRockstarsIFilter : QueryDb, IFilterRockstars + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [QueryDb(QueryTerm.Or)] + [Route("/OrRockstars")] + [DataContract] + public class QueryOrRockstars : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + [DataMember(Order = 2)] + public string FirstName { get; set; } + } + + [DataContract] + public class QueryRockstarsImplicit : QueryDb {} + + [Route("/OrRockstarsFields")] + [DataContract] + public class QueryOrRockstarsFields : QueryDb + { + [QueryDbField(Term = QueryTerm.Or)] + [DataMember(Order = 1)] + public string FirstName { get; set; } + + [QueryDbField(Term = QueryTerm.Or)] + [DataMember(Order = 2)] + public string LastName { get; set; } + } + + [DataContract] + public class QueryFieldsImplicitConventions : QueryDb + { + [QueryDbField(Term = QueryTerm.Or)] + [DataMember(Order = 1)] + public string FirstNameContains { get; set; } + + [QueryDbField(Term = QueryTerm.Or)] + [DataMember(Order = 2)] + public string LastNameEndsWith { get; set; } + } + + [QueryDb(QueryTerm.Or)] + [DataContract] + public class QueryGetRockstars : QueryDb + { + [DataMember(Order = 1)] + public int[] Ids { get; set; } + [DataMember(Order = 2)] + public List Ages { get; set; } + [DataMember(Order = 3)] + public List FirstNames { get; set; } + [DataMember(Order = 4)] + public int[] IdsBetween { get; set; } + } + + [DataContract] + public class QueryRockstarFilters : QueryDb + { + [DataMember(Order = 1)] + public int[] Ids { get; set; } + [DataMember(Order = 2)] + public List Ages { get; set; } + [DataMember(Order = 3)] + public List FirstNames { get; set; } + [DataMember(Order = 4)] + public int[] IdsBetween { get; set; } + } + + [QueryDb(QueryTerm.Or)] + [DataContract] + public class QueryGetRockstarsDynamic : QueryDb {} + +// [References(typeof(RockstarAlbumGenreGlobalIndex))] + [DataContract] + public class RockstarAlbum + { + [AutoIncrement] + [DataMember(Order = 1)] + public int Id { get; set; } + [References(typeof(Rockstar))] + [DataMember(Order = 2)] + public int RockstarId { get; set; } + [DataMember(Order = 3)] + public string Name { get; set; } + [Index] + [DataMember(Order = 4)] + public string Genre { get; set; } + } + + [DataContract] + public class RockstarGenre + { + [AutoIncrement] + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public int RockstarId { get; set; } + [DataMember(Order = 3)] + public string Name { get; set; } + } + + [DataContract] + public class CustomRockstar + { + [DataMember(Order = 1)] + public string FirstName { get; set; } + [DataMember(Order = 2)] + public string LastName { get; set; } + [DataMember(Order = 3)] + public int? Age { get; set; } + [DataMember(Order = 4)] + public string RockstarAlbumName { get; set; } + [DataMember(Order = 5)] + public string RockstarGenreName { get; set; } + } + + [DataContract] + public class QueryCustomRockstarsSchema : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [Schema("dbo")] + [DataContract] + public class CustomRockstarSchema + { + [DataMember(Order = 1)] + public string FirstName { get; set; } + [DataMember(Order = 2)] + public string LastName { get; set; } + [DataMember(Order = 3)] + public int? Age { get; set; } + [DataMember(Order = 4)] + public string RockstarAlbumName { get; set; } + [DataMember(Order = 5)] + public string RockstarGenreName { get; set; } + } + + [Route("/movies/search")] + [QueryDb(QueryTerm.And)] //Default + [DataContract] + public class SearchMovies : QueryDb {} + + [Route("/movies")] + [QueryDb(QueryTerm.Or)] + [DataContract] + public class QueryMovies : QueryDb + { + [DataMember(Order = 1)] + public int[] Ids { get; set; } + [DataMember(Order = 2)] + public string[] ImdbIds { get; set; } + [DataMember(Order = 3)] + public string[] Ratings { get; set; } + } + +// [References(typeof(MovieTitleIndex))] + [DataContract] + public class Movie + { + [AutoIncrement] + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string ImdbId { get; set; } + [DataMember(Order = 3)] + public string Title { get; set; } + [DataMember(Order = 4)] + public string Rating { get; set; } + [DataMember(Order = 5)] + public decimal Score { get; set; } + [DataMember(Order = 6)] + public string Director { get; set; } + [DataMember(Order = 7)] + public DateTime ReleaseDate { get; set; } + [DataMember(Order = 8)] + public string TagLine { get; set; } + [DataMember(Order = 9)] + public List Genres { get; set; } + } + + [DataContract] + public class StreamMovies : QueryDb + { + [DataMember(Order = 1)] + public string[] Ratings { get; set; } + } + + [DataContract] + public class QueryUnknownRockstars : QueryDb + { + [DataMember(Order = 1)] + public int UnknownInt { get; set; } + [DataMember(Order = 2)] + public string UnknownProperty { get; set; } + } + + [Route("/query/rockstar-references")] + [DataContract] + public class QueryRockstarsWithReferences : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [DataContract] + public class QueryCustomRockstarsReferences : QueryDb + { + [DataMember(Order = 1)] + public int? Age { get; set; } + } + + [Alias("Rockstar")] + [DataContract] + public class RockstarReference + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string FirstName { get; set; } + [DataMember(Order = 3)] + public string LastName { get; set; } + [DataMember(Order = 4)] + public int? Age { get; set; } + + [Reference] + [DataMember(Order = 5)] + public List Albums { get; set; } + } + + [Route("/query/all-fields")] + [DataContract] + public class QueryAllFields : QueryDb + { + [DataMember(Order = 1)] + public virtual Guid? Guid { get; set; } + } + + [DataContract] + public class AllFields + { + [DataMember(Order = 1)] + public virtual int Id { get; set; } + [DataMember(Order = 2)] + public virtual int? NullableId { get; set; } + [DataMember(Order = 3)] + public virtual byte Byte { get; set; } + [DataMember(Order = 4)] + public virtual short Short { get; set; } + [DataMember(Order = 5)] + public virtual int Int { get; set; } + [DataMember(Order = 6)] + public virtual long Long { get; set; } + [DataMember(Order = 7)] + public virtual ushort UShort { get; set; } + [DataMember(Order = 8)] + public virtual uint UInt { get; set; } + [DataMember(Order = 9)] + public virtual ulong ULong { get; set; } + [DataMember(Order = 10)] + public virtual float Float { get; set; } + [DataMember(Order = 11)] + public virtual double Double { get; set; } + [DataMember(Order = 12)] + public virtual decimal Decimal { get; set; } + [DataMember(Order = 13)] + public virtual string String { get; set; } + [DataMember(Order = 14)] + public virtual DateTime DateTime { get; set; } + [DataMember(Order = 15)] + public virtual TimeSpan TimeSpan { get; set; } + [DataMember(Order = 16)] + public virtual Guid Guid { get; set; } + [DataMember(Order = 17)] + public virtual DateTime? NullableDateTime { get; set; } + [DataMember(Order = 18)] + public virtual TimeSpan? NullableTimeSpan { get; set; } + [DataMember(Order = 19)] + public virtual Guid? NullableGuid { get; set; } + [DataMember(Order = 20)] + public HttpStatusCode Enum { get; set; } + [DataMember(Order = 21)] + public HttpStatusCode? NullableEnum { get; set; } + } + + [EnumAsInt] + public enum SomeEnumAsInt + { + Value0 = 0, + Value1 = 1, + Value2 = 2, + Value3 = 3, + } + + public enum SomeEnum + { + // Enum values must be unique globally + // https://stackoverflow.com/questions/13802844/protobuf-net-into-proto-generates-enum-conflicts + [ProtoEnum(Name="SomeEnum_Value0")] + Value0 = 0, + [ProtoEnum(Name="SomeEnum_Value1")] + Value1 = 1, + [ProtoEnum(Name="SomeEnum_Value2")] + Value2 = 2, + [ProtoEnum(Name="SomeEnum_Value3")] + Value3 = 3 + } + + [DataContract] + public class TypeWithEnum + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string Name { get; set; } + [DataMember(Order = 3)] + public SomeEnum SomeEnum { get; set; } + [DataMember(Order = 4)] + public SomeEnumAsInt SomeEnumAsInt { get; set; } + [DataMember(Order = 5)] + public SomeEnum? NSomeEnum { get; set; } + [DataMember(Order = 6)] + public SomeEnumAsInt? NSomeEnumAsInt { get; set; } + } + + [Route("/query-enums")] + [DataContract] + public class QueryTypeWithEnums : QueryDb {} + + [DataContract] + public class Adhoc + { + [DataMember(Order = 1)] + public int Id { get; set; } + + [DataMember(Name = "first_name", Order = 2)] + public string FirstName { get; set; } + + [DataMember(Order = 3)] + public string LastName { get; set; } + } + + [DataContract] + [Route("/adhoc-rockstars")] + public class QueryAdhocRockstars : QueryDb + { + [DataMember(Name = "first_name", Order = 1)] + public string FirstName { get; set; } + } + + [DataContract] + [Route("/adhoc")] + public class QueryAdhoc : QueryDb {} + + public class AutoQueryService : Service + { + public IAutoQueryDb AutoQuery { get; set; } + + //Override with custom impl + public object Get(QueryOverridedRockstars dto) + { + var q = AutoQuery.CreateQuery(dto, Request.GetRequestParams()); + q.Take(1); + return AutoQuery.Execute(dto, q); + } + + public object Get(QueryOverridedCustomRockstars dto) + { + var q = AutoQuery.CreateQuery(dto, Request.GetRequestParams()); + q.Take(1); + return AutoQuery.Execute(dto, q); + } + + public object Get(QueryCaseInsensitiveOrderBy dto) + { + var q = AutoQuery.CreateQuery(dto, Request); + if (q.OrderByExpression != null) + q.OrderByExpression += " COLLATE NOCASE"; + + return AutoQuery.Execute(dto, q); + } + + public object Get(StreamMovies dto) + { + var q = AutoQuery.CreateQuery(dto, Request.GetRequestParams()); + q.Take(2); + return AutoQuery.Execute(dto, q); + } + + public object Get(QueryCustomRockstarsReferences request) + { + var q = AutoQuery.CreateQuery(request, Request.GetRequestParams()); + var response = new QueryResponse + { + Offset = q.Offset.GetValueOrDefault(0), + Results = Db.LoadSelect(q, include:new string[0]), + Total = (int)Db.Count(q), + }; + return response; + } + + public object Get(QueryRockstarAlbumsCustomLeftJoin query) + { + var q = AutoQuery.CreateQuery(query, Request) + .LeftJoin((r, a) => r.Id == a.RockstarId); + return AutoQuery.Execute(query, q); + } + } + + public interface IChangeDb + { + string NamedConnection { get; set; } + string ConnectionString { get; set; } + string ProviderName { get; set; } + } + + [Route("/querychangedb")] + [DataContract] + public class QueryChangeDb : QueryDb, IChangeDb + { + [DataMember(Order = 1)] + public string NamedConnection { get; set; } + [DataMember(Order = 2)] + public string ConnectionString { get; set; } + [DataMember(Order = 3)] + public string ProviderName { get; set; } + } + + [Route("/changedb")] + [DataContract] + public class ChangeDb : IReturn, IChangeDb + { + [DataMember(Order = 1)] + public string NamedConnection { get; set; } + [DataMember(Order = 2)] + public string ConnectionString { get; set; } + [DataMember(Order = 3)] + public string ProviderName { get; set; } + } + + [DataContract] + public class ChangeDbResponse + { + [DataMember(Order = 1)] + public List Results { get; set; } + } + + [DataContract] + public class DynamicDbServices : Service + { + public object Get(ChangeDb request) + { + return new ChangeDbResponse { Results = Db.Select() }; + } + } + + [DataContract] + public class ChangeConnectionInfo : IReturn { } + [DataContract] + public class QueryChangeConnectionInfo : QueryDb { } + + [ConnectionInfo(NamedConnection = AutoQueryAppHost.SqlServerNamedConnection)] + [DataContract] + public class NamedConnectionServices : Service + { + public IAutoQueryDb AutoQuery { get; set; } + + public object Get(ChangeConnectionInfo request) + { + return new ChangeDbResponse { Results = Db.Select() }; + } + + public object Get(QueryChangeConnectionInfo query) + { + return AutoQuery.Execute(query, AutoQuery.CreateQuery(query, Request), Request); + } + } + + [Alias(nameof(Rockstar))] + [DataContract] + public class CustomSelectRockstar + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string FirstName { get; set; } + [DataMember(Order = 3)] + public string LastName { get; set; } + [CustomSelect("Age * 2")] + [DataMember(Order = 4)] + public int? Age { get; set; } + } + + [DataContract] + public class QueryJoinedRockstarAlbumsCustomSelect : QueryDb, + IJoin + { + [DataMember(Order = 1)] + public int? Age { get; set; } + [DataMember(Order = 2)] + public string RockstarAlbumName { get; set; } + } + + [DataContract] + public class CustomSelectRockstarResponse + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string FirstName { get; set; } + [DataMember(Order = 3)] + public int? Age { get; set; } + } + + [DataContract] + public class QueryJoinedRockstarAlbumsCustomSelectResponse : QueryDb, + IJoin + { + [DataMember(Order = 1)] + public int? Age { get; set; } + [DataMember(Order = 2)] + public string RockstarAlbumName { get; set; } + } + + public class TestsConfig + { + public static readonly int Port = 20000; + public static readonly string BaseUri = Environment.GetEnvironmentVariable("CI_BASEURI") ?? $"http://localhost:{Port}"; + public static readonly string AbsoluteBaseUri = BaseUri + "/"; + + public static readonly string HostNameBaseUrl = $"http://DESKTOP-BCS76J0:{Port}/"; //Allow fiddler + public static readonly string AnyHostBaseUrl = $"http://*:{Port}/"; //Allow capturing by fiddler + + public static readonly string ListeningOn = BaseUri + "/"; + public static readonly string RabbitMQConnString = Environment.GetEnvironmentVariable("CI_RABBITMQ") ?? "localhost"; + public static readonly string SqlServerConnString = Environment.GetEnvironmentVariable("MSSQL_CONNECTION") ?? "Server=localhost;Database=test;User Id=test;Password=test;"; + public static readonly string PostgreSqlConnString = Environment.GetEnvironmentVariable("PGSQL_CONNECTION") ?? "Server=localhost;Port=5432;User Id=test;Password=test;Database=test;Pooling=true;MinPoolSize=0;MaxPoolSize=200"; + public static readonly string DynamoDbServiceURL = Environment.GetEnvironmentVariable("CI_DYNAMODB") ?? "http://localhost:8000"; + + public const string AspNetBaseUri = "http://localhost:50000/"; + public const string AspNetServiceStackBaseUri = AspNetBaseUri + "api"; + + public static GrpcServiceClient GetInsecureClient() + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + var client = new GrpcServiceClient(BaseUri); + return client; + } + } + + public static class TestUtils + { + public static void AddRequiredConfig(this ScriptContext context) + { + context.ScriptMethods.AddRange(new ScriptMethods[] { + new DbScriptsAsync(), + new MyValidators(), + }); + } + } + + public class AutoQueryAppHost : AppSelfHostBase + { + public AutoQueryAppHost() + : base("AutoQuery", typeof(AutoQueryService).Assembly) { } + + public static readonly string SqlServerConnString = TestsConfig.SqlServerConnString; + public const string SqlServerNamedConnection = "SqlServer"; + public const string SqlServerProvider = "SqlServer2012"; + + public static string SqliteFileConnString = "~/App_Data/autoquery.sqlite".MapProjectPath(); + + public Action ConfigureFn { get; set; } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; + }); + } + + public override void Configure(IServiceCollection services) + { + services.AddServiceStackGrpc(); + } + + public Action ConfigureGrpc { get; set; } + + public override void Configure(Container container) + { + var grpcFeature = new GrpcFeature(App); + ConfigureGrpc?.Invoke(grpcFeature); + Plugins.Add(grpcFeature); + + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); + container.Register(dbFactory); + + dbFactory.RegisterConnection(SqlServerNamedConnection, SqlServerConnString, SqlServer2012Dialect.Provider); + dbFactory.RegisterDialectProvider(SqlServerProvider, SqlServer2012Dialect.Provider); + + using (var db = dbFactory.OpenDbConnection(SqlServerNamedConnection)) + { + db.DropTable(); + db.DropAndCreateTable(); + + db.Insert(new NamedRockstar { + Id = 1, + FirstName = "Microsoft", + LastName = "SQL Server", + Age = 27, + DateOfBirth = new DateTime(1989,1,1), + LivingStatus = LivingStatus.Alive, + }); + } + + using (var db = dbFactory.OpenDbConnectionString(SqliteFileConnString)) + { + db.DropTable(); + db.DropAndCreateTable(); + db.Insert(new Rockstar { + Id = 1, + FirstName = "Sqlite", + LastName = "File DB", + Age = 16, + DateOfBirth = new DateTime(2000, 8, 1), + LivingStatus = LivingStatus.Alive, + }); + } + + RegisterTypedRequestFilter((req, res, dto) => + req.Items[Keywords.DbInfo] = dto.ConvertTo()); + + //container.Register( + // new OrmLiteConnectionFactory("Server=localhost;Database=test;User Id=test;Password=test;", + // SqlServerDialect.Provider)); + + //container.Register( + // new OrmLiteConnectionFactory("Server=localhost;Database=test;User Id=test;Password=test;", + // SqlServer2012Dialect.Provider)); + + //container.Register( + // new OrmLiteConnectionFactory("Server=localhost;Database=test;UID=root;Password=test", + // MySqlDialect.Provider)); + + //container.Register( + // new OrmLiteConnectionFactory("Server=localhost;Port=5432;User Id=test;Password=test;Database=test;Pooling=true;MinPoolSize=0;MaxPoolSize=200", + // PostgreSqlDialect.Provider)); + + using (var db = container.Resolve().Open()) + { + db.DropTable(); + db.DropTable(); + db.CreateTable(); + db.CreateTable(); + + db.DropAndCreateTable(); + db.DropAndCreateTable(); + db.DropAndCreateTable(); + + db.InsertAll(SeedRockstars); + db.InsertAll(SeedAlbums); + db.InsertAll(SeedGenres); + db.InsertAll(SeedMovies); + db.InsertAll(SeedPagingTest); + + db.DropAndCreateTable(); + db.Insert(new AllFields + { + Id = 1, + NullableId = 2, + Byte = 3, + DateTime = new DateTime(2001, 01, 01), + NullableDateTime = new DateTime(2002, 02, 02), + Decimal = 4, + Double = 5.5, + Float = 6.6f, + Guid = new Guid("3EE6865A-4149-4940-B7A2-F952E0FEFC5E"), + NullableGuid = new Guid("7A2FDDD8-4BB0-4735-8230-A6AC79088489"), + Long = 7, + Short = 8, + String = "string", + TimeSpan = TimeSpan.FromHours(1), + NullableTimeSpan = TimeSpan.FromDays(1), + UInt = 9, + ULong = 10, + UShort = 11, + Enum = HttpStatusCode.MethodNotAllowed, + NullableEnum = HttpStatusCode.MethodNotAllowed, + }); + + db.DropAndCreateTable(); + db.InsertAll(SeedRockstars.Map(x => new Adhoc + { + Id = x.Id, + FirstName = x.FirstName, + LastName = x.LastName + })); + + db.CreateTable(); + + db.Insert(new TypeWithEnum { Id = 1, Name = "Value1", SomeEnum = SomeEnum.Value1, NSomeEnum = SomeEnum.Value1, SomeEnumAsInt = SomeEnumAsInt.Value1, NSomeEnumAsInt = SomeEnumAsInt.Value1 }); + db.Insert(new TypeWithEnum { Id = 2, Name = "Value2", SomeEnum = SomeEnum.Value2, NSomeEnum = SomeEnum.Value2, SomeEnumAsInt = SomeEnumAsInt.Value2, NSomeEnumAsInt = SomeEnumAsInt.Value2 }); + db.Insert(new TypeWithEnum { Id = 3, Name = "Value3", SomeEnum = SomeEnum.Value3, NSomeEnum = SomeEnum.Value3, SomeEnumAsInt = SomeEnumAsInt.Value3, NSomeEnumAsInt = SomeEnumAsInt.Value3 }); + } + + var autoQuery = new AutoQueryFeature + { + MaxLimit = 100, + EnableRawSqlFilters = true, + ResponseFilters = { + ctx => { + var executedCmds = new List(); + var supportedFns = new Dictionary>(StringComparer.OrdinalIgnoreCase) + { + {"ADD", (a,b) => a + b }, + {"MULTIPLY", (a,b) => a * b }, + {"DIVIDE", (a,b) => a / b }, + {"SUBTRACT", (a,b) => a - b }, + }; + foreach (var cmd in ctx.Commands) + { + if (!supportedFns.TryGetValue(cmd.Name, out var fn)) continue; + var label = !cmd.Suffix.IsNullOrWhiteSpace() ? cmd.Suffix.Trim().ToString() : cmd.ToString(); + ctx.Response.Meta[label] = fn(cmd.Args[0].ParseInt32(), cmd.Args[1].ParseInt32()).ToString(); + executedCmds.Add(cmd); + } + ctx.Commands.RemoveAll(executedCmds.Contains); + } + } + } + .RegisterQueryFilter((q, dto, req) => + q.And(x => x.LastName.EndsWith("son")) + ) + .RegisterQueryFilter((q, dto, req) => + q.And(x => x.LastName.EndsWith("son")) + ) + .RegisterQueryFilter((q, dto, req) => + q.And(x => x.LastName.EndsWith("son")) + ); + + Plugins.Add(autoQuery); + + ConfigureFn?.Invoke(this,container); + } + + public static Rockstar[] SeedRockstars = new[] { + new Rockstar { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1942, 11, 27), DateDied = new DateTime(1970, 09, 18), }, + new Rockstar { Id = 2, FirstName = "Jim", LastName = "Morrison", Age = 27, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1943, 12, 08), DateDied = new DateTime(1971, 07, 03), }, + new Rockstar { Id = 3, FirstName = "Kurt", LastName = "Cobain", Age = 27, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1967, 02, 20), DateDied = new DateTime(1994, 04, 05), }, + new Rockstar { Id = 4, FirstName = "Elvis", LastName = "Presley", Age = 42, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1935, 01, 08), DateDied = new DateTime(1977, 08, 16), }, + new Rockstar { Id = 5, FirstName = "David", LastName = "Grohl", Age = 44, LivingStatus = LivingStatus.Alive, DateOfBirth = new DateTime(1969, 01, 14), }, + new Rockstar { Id = 6, FirstName = "Eddie", LastName = "Vedder", Age = 48, LivingStatus = LivingStatus.Alive, DateOfBirth = new DateTime(1964, 12, 23), }, + new Rockstar { Id = 7, FirstName = "Michael", LastName = "Jackson", Age = 50, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1958, 08, 29), DateDied = new DateTime(2009, 06, 05), }, + }; + + public static RockstarAlbum[] SeedAlbums = new[] { + new RockstarAlbum { Id = 1, RockstarId = 1, Name = "Electric Ladyland", Genre = "Funk" }, + new RockstarAlbum { Id = 2, RockstarId = 3, Name = "Bleach", Genre = "Grunge" }, + new RockstarAlbum { Id = 3, RockstarId = 3, Name = "Nevermind", Genre = "Grunge" }, + new RockstarAlbum { Id = 4, RockstarId = 3, Name = "In Utero", Genre = "Grunge" }, + new RockstarAlbum { Id = 5, RockstarId = 3, Name = "Incesticide", Genre = "Grunge" }, + new RockstarAlbum { Id = 6, RockstarId = 3, Name = "MTV Unplugged in New York", Genre = "Acoustic" }, + new RockstarAlbum { Id = 7, RockstarId = 5, Name = "Foo Fighters", Genre = "Grunge" }, + new RockstarAlbum { Id = 8, RockstarId = 6, Name = "Into the Wild", Genre = "Folk" }, + }; + + public static RockstarGenre[] SeedGenres = new[] { + new RockstarGenre { RockstarId = 1, Name = "Rock" }, + new RockstarGenre { RockstarId = 3, Name = "Grunge" }, + new RockstarGenre { RockstarId = 5, Name = "Alternative Rock" }, + new RockstarGenre { RockstarId = 6, Name = "Folk Rock" }, + }; + + public static Movie[] SeedMovies = new[] { + new Movie { ImdbId = "tt0111161", Title = "The Shawshank Redemption", Score = 9.2m, Director = "Frank Darabont", ReleaseDate = new DateTime(1995,2,17), TagLine = "Fear can hold you prisoner. Hope can set you free.", Genres = new List{"Crime","Drama"}, Rating = "R", }, + new Movie { ImdbId = "tt0068646", Title = "The Godfather", Score = 9.2m, Director = "Francis Ford Coppola", ReleaseDate = new DateTime(1972,3,24), TagLine = "An offer you can't refuse.", Genres = new List {"Crime","Drama", "Thriller"}, Rating = "R", }, + new Movie { ImdbId = "tt1375666", Title = "Inception", Score = 9.2m, Director = "Christopher Nolan", ReleaseDate = new DateTime(2010,7,16), TagLine = "Your mind is the scene of the crime", Genres = new List{"Action", "Mystery", "Sci-Fi", "Thriller"}, Rating = "PG-13", }, + new Movie { ImdbId = "tt0071562", Title = "The Godfather: Part II", Score = 9.0m, Director = "Francis Ford Coppola", ReleaseDate = new DateTime(1974,12,20), Genres = new List {"Crime","Drama", "Thriller"}, Rating = "R", }, + new Movie { ImdbId = "tt0060196", Title = "The Good, the Bad and the Ugly", Score = 9.0m, Director = "Sergio Leone", ReleaseDate = new DateTime(1967,12,29), TagLine = "They formed an alliance of hate to steal a fortune in dead man's gold", Genres = new List{"Adventure","Western"}, Rating = "R", }, + new Movie { ImdbId = "tt0114709", Title = "Toy Story", Score = 8.3m, Director = "John Lasseter", ReleaseDate = new DateTime(1995,11,22), TagLine = "A cowboy doll is profoundly threatened and jealous when a new spaceman figure supplants him as top toy in a boy's room.", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "G", }, + new Movie { ImdbId = "tt2294629", Title = "Frozen", Score = 7.8m, Director = "Chris Buck", ReleaseDate = new DateTime(2013,11,27), TagLine = "Fearless optimist Anna teams up with Kristoff in an epic journey, encountering Everest-like conditions, and a hilarious snowman named Olaf", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "PG", }, + new Movie { ImdbId = "tt1453405", Title = "Monsters University", Score = 7.4m, Director = "Dan Scanlon", ReleaseDate = new DateTime(2013,06,21), TagLine = "A look at the relationship between Mike and Sulley during their days at Monsters University -- when they weren't necessarily the best of friends.", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "G", }, + new Movie { ImdbId = "tt0468569", Title = "The Dark Knight", Score = 9.0m, Director = "Christopher Nolan", ReleaseDate = new DateTime(2008,07,18), TagLine = "When Batman, Gordon and Harvey Dent launch an assault on the mob, they let the clown out of the box, the Joker, bent on turning Gotham on itself and bringing any heroes down to his level.", Genres = new List{"Action","Crime","Drama"}, Rating = "PG-13", }, + new Movie { ImdbId = "tt0109830", Title = "Forrest Gump", Score = 8.8m, Director = "Robert Zemeckis", ReleaseDate = new DateTime(1996,07,06), TagLine = "Forrest Gump, while not intelligent, has accidentally been present at many historic moments, but his true love, Jenny Curran, eludes him.", Genres = new List{"Drama","Romance"}, Rating = "PG-13", }, + }; + + public static PagingTest[] SeedPagingTest = 250.Times(i => new PagingTest { Id = i, Name = "Name" + i, Value = i % 2 }).ToArray(); + + public override void Configure(IApplicationBuilder app) + { + app.UseRouting(); + } + } + + public class GrpcAutoQueryTests + { + private readonly ServiceStackHost appHost; + public IServiceClientAsync client; + + private static readonly int TotalRockstars = AutoQueryAppHost.SeedRockstars.Length; + private static readonly int TotalAlbums = AutoQueryAppHost.SeedAlbums.Length; + + public GrpcAutoQueryTests() + { + ConsoleLogFactory.Configure(); + appHost = new AutoQueryAppHost() + .Init() + .Start(TestsConfig.ListeningOn); + + GrpcClientFactory.AllowUnencryptedHttp2 = true; + client = new GrpcServiceClient(TestsConfig.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + public List Rockstars => AutoQueryAppHost.SeedRockstars.ToList(); + + public List PagingTests => AutoQueryAppHost.SeedPagingTest.ToList(); + + [Test] + public async Task Can_execute_basic_query() + { + var response = await client.GetAsync(new QueryRockstars { Include = "Total" }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + } + + [Test] + public async Task Can_execute_basic_query_NamedRockstar() + { + var response = await client.GetAsync(new QueryNamedRockstars { Include = "Total" }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].LastName, Is.EqualTo("SQL Server")); + } + + [Test] + public async Task Can_execute_overridden_basic_query() + { + var response = await client.GetAsync(new QueryOverridedRockstars { Include = "Total" }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + } + + [Test] + public async Task Can_execute_overridden_basic_query_with_case_insensitive_orderBy() + { + var response = await client.GetAsync(new QueryCaseInsensitiveOrderBy { Age = 27, OrderBy = "FirstName" }); + + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_AdhocRockstars_query() + { + var request = new QueryAdhocRockstars { FirstName = "Jimi", Include = "Total" }; + + Assert.That(request.ToGetUrl(), Is.EqualTo("/adhoc-rockstars?first_name=Jimi&include=Total")); + + var response = await client.GetAsync(request); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo(request.FirstName)); + } + + [Test] + public async Task Can_execute_explicit_equality_condition_on_overridden_CustomRockstar() + { + var response = await client.GetAsync(new QueryOverridedCustomRockstars { Age = 27, Include = "Total" }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + } + + [Test] + public async Task Can_execute_basic_query_with_limits() + { + var response = await client.GetAsync(new QueryRockstars { Skip = 2, Include = "Total" }); + Assert.That(response.Offset, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 2)); + + response = await client.GetAsync(new QueryRockstars { Take = 2, Include = "Total" }); + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetAsync(new QueryRockstars { Skip = 2, Take = 2, Include = "Total" }); + Assert.That(response.Offset, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public async Task Can_execute_explicit_equality_condition() + { + var response = await client.GetAsync(new QueryRockstars { Age = 27, Include = "Total" }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_explicit_equality_condition_implicitly() + { + var client = new GrpcServiceClient(TestsConfig.ListeningOn) { + RequestFilter = ctx => { + ctx.RequestHeaders.Add("query.Age", "27"); + ctx.RequestHeaders.Add("query.Include", "Total"); + } + }; + var response = await client.GetAsync(new QueryRockstarsImplicit()); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_explicit_equality_condition_on_CustomRockstar() + { + var response = await client.GetAsync(new QueryCustomRockstars { Age = 27, Include = "Total" }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_explicit_equality_condition_on_CustomRockstarSchema() + { + var response = await client.GetAsync(new QueryCustomRockstarsSchema { Age = 27, Include = "Total" }); + + response.PrintDump(); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results[0].FirstName, Is.Not.Null); + Assert.That(response.Results[0].LastName, Is.Not.Null); + Assert.That(response.Results[0].Age, Is.EqualTo(27)); + } + + [Test] + public async Task Can_execute_query_with_JOIN_on_RockstarAlbums() + { + var response = await client.GetAsync(new QueryJoinedRockstarAlbums { Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(TotalAlbums)); + Assert.That(response.Results.Count, Is.EqualTo(TotalAlbums)); + var albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York", "Foo Fighters", "Into the Wild", + })); + + response = await client.GetAsync(new QueryJoinedRockstarAlbums { Age = 27, Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(6)); + Assert.That(response.Results.Count, Is.EqualTo(6)); + albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York", + })); + + response = await client.GetAsync(new QueryJoinedRockstarAlbums { RockstarAlbumName = "Nevermind", Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { "Nevermind" })); + } + + [Test] + public async Task Can_execute_query_with_JOIN_on_RockstarAlbums_and_CustomSelectRockstar() + { + var response = await client.GetAsync(new QueryJoinedRockstarAlbumsCustomSelect { Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(TotalAlbums)); + Assert.That(response.Results.Count, Is.EqualTo(TotalAlbums)); + var ages = response.Results.Select(x => x.Age); + Assert.That(ages.Contains(27 * 2)); + + var customRes = await client.GetAsync(new QueryJoinedRockstarAlbumsCustomSelectResponse { Include = "Total" }); + Assert.That(customRes.Total, Is.EqualTo(TotalAlbums)); + Assert.That(customRes.Results.Count, Is.EqualTo(TotalAlbums)); + ages = customRes.Results.Select(x => x.Age); + Assert.That(ages.Contains(27 * 2)); + } + + [Test] + public async Task Can_execute_query_with_multiple_JOINs_on_Rockstar_Albums_and_Genres() + { + var response = await client.GetAsync(new QueryMultiJoinRockstar { Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(TotalAlbums)); + Assert.That(response.Results.Count, Is.EqualTo(TotalAlbums)); + var albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York", "Foo Fighters", "Into the Wild", + })); + + var genreNames = response.Results.Select(x => x.RockstarGenreName).Distinct(); + Assert.That(genreNames, Is.EquivalentTo(new[] { + "Rock", "Grunge", "Alternative Rock", "Folk Rock" + })); + + response = await client.GetAsync(new QueryMultiJoinRockstar { RockstarAlbumName = "Nevermind", Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { "Nevermind" })); + + response = await client.GetAsync(new QueryMultiJoinRockstar { RockstarGenreName = "Folk Rock", Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + albumNames = response.Results.Select(x => x.RockstarGenreName); + Assert.That(albumNames, Is.EquivalentTo(new[] { "Folk Rock" })); + } + + [Test] + public async Task Can_execute_query_with_LEFTJOIN_on_RockstarAlbums() + { + var response = await client.GetAsync(new QueryRockstarAlbumsLeftJoin { IdNotEqualTo = 3, Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(TotalRockstars - 1)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 1)); + var albumNames = response.Results.Where(x => x.RockstarAlbumName != null).Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Foo Fighters", "Into the Wild" + })); + } + + [Test] + public async Task Can_execute_query_with_custom_LEFTJOIN_on_RockstarAlbums() + { + var response = await client.GetAsync(new QueryRockstarAlbumsCustomLeftJoin { IdNotEqualTo = 3, Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(TotalRockstars - 1)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 1)); + var albumNames = response.Results.Where(x => x.RockstarAlbumName != null).Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Foo Fighters", "Into the Wild" + })); + } + + [Test] + public async Task Can_execute_custom_QueryFields() + { + QueryResponse response; + response = await client.GetAsync(new QueryFieldRockstars { FirstName = "Jim" }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + response = await client.GetAsync(new QueryFieldRockstars { FirstNames = new[] { "Jim","Kurt" } }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetAsync(new QueryFieldRockstars { FirstNameCaseInsensitive = "jim" }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + response = await client.GetAsync(new QueryFieldRockstars { FirstNameStartsWith = "Jim" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetAsync(new QueryFieldRockstars { LastNameEndsWith = "son" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetAsync(new QueryFieldRockstars { FirstNameBetween = new[] {"A","F"} }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetAsync(new QueryFieldRockstars + { + LastNameEndsWith = "son", + OrLastName = "Hendrix" + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetAsync(new QueryFieldRockstars + { + FirstNameStartsWith = "Jim", + OrLastName = "Presley" + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetAsync(new QueryFieldRockstars { Age = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + } + + [Test] + public async Task Can_execute_combination_of_QueryFields() + { + QueryResponse response; + + response = await client.GetAsync(new QueryFieldRockstars + { + FirstNameStartsWith = "Jim", + LastNameEndsWith = "son", + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + response = await client.GetAsync(new QueryFieldRockstars + { + FirstNameStartsWith = "Jim", + OrLastName = "Cobain", + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Does_escape_values() + { + QueryResponse response; + + response = await client.GetAsync(new QueryFieldRockstars + { + FirstNameStartsWith = "Jim'\"", + }); + Assert.That(response.Results?.Count ?? 0, Is.EqualTo(0)); + } + + [Test] + public async Task Does_use_custom_model_to_select_columns() + { + var response = await client.GetAsync(new QueryRockstarAlias { RockstarAlbumName = "Nevermind" }); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].RockstarId, Is.EqualTo(3)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Kurt")); + Assert.That(response.Results[0].RockstarAlbumName, Is.EqualTo("Nevermind")); + } + + [Test] + public async Task Does_allow_adding_attributes_dynamically() + { + typeof(QueryFieldRockstarsDynamic) + .GetProperty("Age") + .AddAttributes(new QueryDbFieldAttribute { Operand = ">=" }); + + var response = await client.GetAsync(new QueryFieldRockstarsDynamic { Age = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + } + + [Test] + public async Task Does_execute_typed_QueryFilters() + { + // QueryFilter appends additional: x => x.LastName.EndsWith("son") + var response = await client.GetAsync(new QueryRockstarsFilter { Age = 27 }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + var custom = await client.GetAsync(new QueryCustomRockstarsFilter { Age = 27 }); + Assert.That(custom.Results.Count, Is.EqualTo(1)); + + response = await client.GetAsync(new QueryRockstarsIFilter { Age = 27 }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + } + + [Test] + public async Task Can_execute_OR_QueryFilters() + { + var response = await client.GetAsync(new QueryOrRockstars { Age = 42, FirstName = "Jim" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public async Task Does_retain_implicit_convention_when_not_overriding_template_or_ValueFormat() + { + var response = await client.GetAsync(new QueryFieldsImplicitConventions { FirstNameContains = "im" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetAsync(new QueryFieldsImplicitConventions { LastNameEndsWith = "son" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public async Task Can_execute_OR_QueryFilters_Fields() + { + var response = await client.GetAsync(new QueryOrRockstarsFields + { + FirstName = "Jim", + LastName = "Vedder", + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public async Task Can_execute_Explicit_conventions() + { + var response = await client.GetAsync(new QueryRockstarsConventions { Ids = new[] {1, 2, 3} }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetAsync(new QueryRockstarsConventions { AgeOlderThan = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetAsync(new QueryRockstarsConventions { AgeGreaterThanOrEqualTo = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + + response = await client.GetAsync(new QueryRockstarsConventions { AgeGreaterThan = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = await client.GetAsync(new QueryRockstarsConventions { GreaterThanAge = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetAsync(new QueryRockstarsConventions { FirstNameStartsWith = "Jim" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + response = await client.GetAsync(new QueryRockstarsConventions { LastNameEndsWith = "son" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + response = await client.GetAsync(new QueryRockstarsConventions { LastNameContains = "e" }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetAsync(new QueryRockstarsConventions { DateOfBirthGreaterThan = new DateTime(1960, 01, 01) }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = await client.GetAsync(new QueryRockstarsConventions { DateDiedLessThan = new DateTime(1980, 01, 01) }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_In_OR_Queries() + { + QueryResponse response; + response = await client.GetAsync(new QueryGetRockstars()); + Assert.That(response.Results?.Count ?? 0, Is.EqualTo(0)); + + response = await client.GetAsync(new QueryGetRockstars { Ids = new[] { 1, 2, 3 } }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetAsync(new QueryGetRockstars { Ages = new[] { 42, 44 }.ToList() }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetAsync(new QueryGetRockstars { FirstNames = new[] { "Jim", "Kurt" }.ToList() }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetAsync(new QueryGetRockstars { IdsBetween = new[] { 1, 3 } }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Does_ignore_empty_collection_filters_by_default() + { + QueryResponse response; + response = await client.GetAsync(new QueryRockstarFilters()); + Assert.That(response.Results.Count, Is.EqualTo(AutoQueryAppHost.SeedRockstars.Length)); + + response = await client.GetAsync(new QueryRockstarFilters + { + Ids = new int[] {}, + Ages = new List(), + FirstNames = new List(), + IdsBetween = new int[] {}, + }); + Assert.That(response.Results.Count, Is.EqualTo(AutoQueryAppHost.SeedRockstars.Length)); + } + + [Test] + public async Task Can_query_Movie_Ratings() + { + var response = await client.GetAsync(new QueryMovies { Ratings = new[] {"G","PG-13"} }); + Assert.That(response.Results.Count, Is.EqualTo(5)); + + response = await client.GetAsync(new QueryMovies { + Ids = new[] { 1, 2 }, + ImdbIds = new[] { "tt0071562", "tt0060196" }, + Ratings = new[] { "G", "PG-13" } + }); + Assert.That(response.Results.Count, Is.EqualTo(9)); + } + + [Test] + public async Task Does_implicitly_OrderBy_PrimaryKey_when_limits_is_specified() + { + var movies = await client.GetAsync(new SearchMovies { Take = 100 }); + var ids = movies.Results.Map(x => x.Id); + var orderedIds = ids.OrderBy(x => x); + Assert.That(ids, Is.EqualTo(orderedIds)); + + var rockstars = await client.GetAsync(new SearchMovies { Take = 100 }); + ids = rockstars.Results.Map(x => x.Id); + orderedIds = ids.OrderBy(x => x); + Assert.That(ids, Is.EqualTo(orderedIds)); + } + + [Test] + public async Task Can_OrderBy_queries() + { + var movies = await client.GetAsync(new SearchMovies { Take = 100, OrderBy = "ImdbId" }); + var ids = movies.Results.Map(x => x.ImdbId); + var orderedIds = ids.OrderBy(x => x).ToList(); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetAsync(new SearchMovies { Take = 100, OrderBy = "Rating,ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating).ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetAsync(new SearchMovies { Take = 100, OrderByDesc = "ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = ids.OrderByDescending(x => x).ToList(); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetAsync(new SearchMovies { Take = 100, OrderByDesc = "Rating,ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetAsync(new SearchMovies { Take = 100, OrderBy = "Rating,-ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetAsync(new SearchMovies { Take = 100, OrderByDesc = "Rating,-ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + } + + [Test] + public async Task Does_not_query_Ignored_properties() + { + var response = await client.GetAsync(new QueryUnknownRockstars { + UnknownProperty = "Foo", + UnknownInt = 1, + Include = "Total" + }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + } + + [Test] + public async Task Can_Query_Rockstars_with_References() + { + var response = await client.GetAsync(new QueryRockstarsWithReferences { + Age = 27 + }); + + Assert.That(response.Results.Count, Is.EqualTo(3)); + + var jimi = response.Results.First(x => x.FirstName == "Jimi"); + Assert.That(jimi.Albums.Count, Is.EqualTo(1)); + Assert.That(jimi.Albums[0].Name, Is.EqualTo("Electric Ladyland")); + + var jim = response.Results.First(x => x.FirstName == "Jim"); + Assert.That(jim.Albums, Is.Null); + + var kurt = response.Results.First(x => x.FirstName == "Kurt"); + Assert.That(kurt.Albums.Count, Is.EqualTo(5)); + + response = await client.GetAsync(new QueryRockstarsWithReferences + { + Age = 27, + Fields = "Id,FirstName,Age" + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results.All(x => x.Id > 0)); + Assert.That(response.Results.All(x => x.LastName == null)); + Assert.That(response.Results.All(x => x.Albums == null)); + + response = await client.GetAsync(new QueryRockstarsWithReferences + { + Age = 27, + Fields = "Id,FirstName,Age,Albums" + }); + Assert.That(response.Results.Where(x => x.FirstName != "Jim").All(x => x.Albums != null)); + } + + [Test] + public async Task Can_Query_RockstarReference_without_References() + { + var response = await client.GetAsync(new QueryCustomRockstarsReferences + { + Age = 27 + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results.All(x => x.Albums == null)); + } + + [Test] + public async Task Can_Query_AllFields_Guid() + { + var guid = new Guid("3EE6865A-4149-4940-B7A2-F952E0FEFC5E"); + var response = await client.GetAsync(new QueryAllFields { + Guid = guid + }); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + + Assert.That(response.Results[0].Guid, Is.EqualTo(guid)); + } + + [Test] + public async Task Does_populate_Total() + { + var response = await client.GetAsync(new QueryRockstars { Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta, Is.Null); + + response = await client.GetAsync(new QueryRockstars { Include = "COUNT" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = await client.GetAsync(new QueryRockstars { Include = "COUNT(*)" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = await client.GetAsync(new QueryRockstars { Include = "COUNT(DISTINCT LivingStatus), Total" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = await client.GetAsync(new QueryRockstars { Include = "Count(*), Min(Age), Max(Age), Sum(Id)" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = await client.GetAsync(new QueryRockstars { Age = 27, Include = "Count(*), Min(Age), Max(Age), Sum(Id)" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count(x => x.Age == 27))); + } + + [Test] + public async Task Can_Include_Aggregates_in_AutoQuery() + { + var response = await client.GetAsync(new QueryRockstars { Include = "COUNT" }); + Assert.That(response.Meta["COUNT(*)"], Is.EqualTo(Rockstars.Count.ToString())); + + response = await client.GetAsync(new QueryRockstars { Include = "COUNT(*)" }); + Assert.That(response.Meta["COUNT(*)"], Is.EqualTo(Rockstars.Count.ToString())); + + response = await client.GetAsync(new QueryRockstars { Include = "COUNT(DISTINCT LivingStatus)" }); + Assert.That(response.Meta["COUNT(DISTINCT LivingStatus)"], Is.EqualTo("2")); + + response = await client.GetAsync(new QueryRockstars { Include = "MIN(Age)" }); + Assert.That(response.Meta["MIN(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + + response = await client.GetAsync(new QueryRockstars { Include = "Count(*), Min(Age), Max(Age), Sum(Id), Avg(Age)", OrderBy = "Id" }); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(Rockstars.Count.ToString())); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Max(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["Sum(Id)"], Is.EqualTo(Rockstars.Map(x => x.Id).Sum().ToString())); + Assert.That(double.Parse(response.Meta["Avg(Age)"]), Is.EqualTo(Rockstars.Average(x => x.Age)).Within(1d)); + //Not supported by Sqlite + //Assert.That(response.Meta["First(Id)"], Is.EqualTo(Rockstars.First().Id.ToString())); + //Assert.That(response.Meta["Last(Id)"], Is.EqualTo(Rockstars.Last().Id.ToString())); + + response = await client.GetAsync(new QueryRockstars { Age = 27, Include = "Count(*), Min(Age), Max(Age), Sum(Id), Avg(Age)", OrderBy = "Id" }); + var rockstars27 = Rockstars.Where(x => x.Age == 27).ToList(); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(rockstars27.Count.ToString())); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(rockstars27.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Max(Age)"], Is.EqualTo(rockstars27.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["Sum(Id)"], Is.EqualTo(rockstars27.Map(x => x.Id).Sum().ToString())); + Assert.That(double.Parse(response.Meta["Avg(Age)"]), Is.EqualTo(rockstars27.Average(x => x.Age)).Within(1d)); + //Not supported by Sqlite + //Assert.That(response.Meta["First(Id)"], Is.EqualTo(rockstars27.First().Id.ToString())); + //Assert.That(response.Meta["Last(Id)"], Is.EqualTo(rockstars27.Last().Id.ToString())); + } + + [Test] + public async Task Does_ignore_unknown_aggregate_commands() + { + var response = await client.GetAsync(new QueryRockstars { Include = "FOO(1), Total" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta, Is.Null); + + response = await client.GetAsync(new QueryRockstars { Include = "FOO(1), Min(Age), Bar('a') alias, Count(*), Baz(1,'foo')" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(Rockstars.Count.ToString())); + } + + [Test] + public async Task Can_Include_Aggregates_in_AutoQuery_with_Aliases() + { + var response = await client.GetAsync(new QueryRockstars { Include = "COUNT(*) count" }); + Assert.That(response.Meta["count"], Is.EqualTo(Rockstars.Count.ToString())); + + response = await client.GetAsync(new QueryRockstars { Include = "COUNT(DISTINCT LivingStatus) as uniquestatus" }); + Assert.That(response.Meta["uniquestatus"], Is.EqualTo("2")); + + response = await client.GetAsync(new QueryRockstars { Include = "MIN(Age) minage" }); + Assert.That(response.Meta["minage"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + + response = await client.GetAsync(new QueryRockstars { Include = "Count(*) count, Min(Age) min, Max(Age) max, Sum(Id) sum" }); + Assert.That(response.Meta["count"], Is.EqualTo(Rockstars.Count.ToString())); + Assert.That(response.Meta["min"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["max"], Is.EqualTo(Rockstars.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["sum"], Is.EqualTo(Rockstars.Map(x => x.Id).Sum().ToString())); + } + + [Test] + public async Task Can_execute_custom_aggregate_functions() + { + var response = await client.GetAsync(new QueryRockstars { + Include = "ADD(6,2), Multiply(6,2) SixTimesTwo, Subtract(6,2), divide(6,2) TheDivide" + }); + Assert.That(response.Meta["ADD(6,2)"], Is.EqualTo("8")); + Assert.That(response.Meta["SixTimesTwo"], Is.EqualTo("12")); + Assert.That(response.Meta["Subtract(6,2)"], Is.EqualTo("4")); + Assert.That(response.Meta["TheDivide"], Is.EqualTo("3")); + } + + [Test] + public async Task Sending_empty_ChangeDb_returns_default_info() + { + var response = await client.GetAsync(new ChangeDb()); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + + var aqResponse = await client.GetAsync(new QueryChangeDb()); + Assert.That(aqResponse.Results.Count, Is.EqualTo(TotalRockstars)); + } + + [Test] + public async Task Can_ChangeDb_with_Named_Connection() + { + var response = await client.GetAsync(new ChangeDb { NamedConnection = AutoQueryAppHost.SqlServerNamedConnection }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Microsoft")); + + var aqResponse = await client.GetAsync(new QueryChangeDb { NamedConnection = AutoQueryAppHost.SqlServerNamedConnection }); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Microsoft")); + } + + [Test] + public async Task Can_ChangeDb_with_ConnectionString() + { + var response = await client.GetAsync(new ChangeDb { ConnectionString = AutoQueryAppHost.SqliteFileConnString }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Sqlite")); + + var aqResponse = await client.GetAsync(new QueryChangeDb { ConnectionString = AutoQueryAppHost.SqliteFileConnString }); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Sqlite")); + } + + [Test] + public async Task Can_ChangeDb_with_ConnectionString_and_Provider() + { + var response = await client.GetAsync(new ChangeDb + { + ConnectionString = AutoQueryAppHost.SqlServerConnString, + ProviderName = AutoQueryAppHost.SqlServerProvider, + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Microsoft")); + + var aqResponse = await client.GetAsync(new QueryChangeDb + { + ConnectionString = AutoQueryAppHost.SqlServerConnString, + ProviderName = AutoQueryAppHost.SqlServerProvider, + }); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Microsoft")); + } + + [Test] + public async Task Can_Change_Named_Connection_with_ConnectionInfoAttribute() + { + var response = await client.GetAsync(new ChangeConnectionInfo()); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Microsoft")); + + var aqResponse = await client.GetAsync(new QueryChangeConnectionInfo()); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Microsoft")); + } + + [Test] + public async Task Does_return_MaxLimit_results() + { + QueryResponse response; + response = await client.GetAsync(new QueryPagingTest { Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(100)); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count)); + + response = await client.GetAsync(new QueryPagingTest { Skip = 200, Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(PagingTests.Skip(200).Count())); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count)); + + response = await client.GetAsync(new QueryPagingTest { Value = 1, Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(100)); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count(x => x.Value == 1))); + } + + [Test] + public async Task Can_query_on_ForeignKey_and_Index() + { + QueryResponse response; + response = await client.GetAsync(new QueryRockstarAlbums { RockstarId = 3, Include = "Total" }); //Hash + Assert.That(response.Results.Count, Is.EqualTo(5)); + Assert.That(response.Total, Is.EqualTo(5)); + + response = await client.GetAsync(new QueryRockstarAlbums { RockstarId = 3, Id = 3, Include = "Total" }); //Hash + Range + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Name, Is.EqualTo("Nevermind")); + + //Hash + Range BETWEEN + response = await client.GetAsync(new QueryRockstarAlbums + { + RockstarId = 3, + IdBetween = new[] { 2, 3 }, + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(2)); + + //Hash + Range BETWEEN + Filter + response = await client.GetAsync(new QueryRockstarAlbums + { + RockstarId = 3, + IdBetween = new[] { 2, 3 }, + Name = "Nevermind", + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Id, Is.EqualTo(3)); + + //Hash + LocalSecondaryIndex + response = await client.GetAsync(new QueryRockstarAlbums { RockstarId = 3, Genre = "Grunge", Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + Assert.That(response.Total, Is.EqualTo(4)); + + response.PrintDump(); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/GrpcIntegrationTests.cs b/tests/ServiceStack.Extensions.Tests/GrpcIntegrationTests.cs new file mode 100644 index 00000000000..9039c6c596c --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/GrpcIntegrationTests.cs @@ -0,0 +1,75 @@ +using System; +using System.Runtime.Serialization; +using System.Security.Cryptography.X509Certificates; +using System.Threading.Tasks; +using NUnit.Framework; +using ProtoBuf.Grpc.Client; +using ServiceStack.Text; + +namespace ServiceStack.Extensions.Tests +{ + public class GrpcIntegrationTests + { + [Route("/hello")] + [Route("/hello/{Name}")] + [DataContract] + public partial class Hello + : IReturn + { + [DataMember(Order = 1)] + public virtual string Name { get; set; } + } + + [DataContract] + public partial class HelloResponse + { + [DataMember(Order = 1)] + public virtual string Result { get; set; } + + [DataMember(Order = 2)] + public virtual ResponseStatus ResponseStatus { get; set; } + } + + // [Test] // Integration Test + public async Task Can_call_external_secure_service_using_remote_certificate() + { + try + { + // File.WriteAllBytes("grpc.crt", "https://todoworld.servicestack.net/grpc.crt".GetBytesFromUrl()); + // var cert = new X509Certificate2("grpc.crt"); + var cert = new X509Certificate2("https://todoworld.servicestack.net/grpc.crt".GetBytesFromUrl()); + + var client = new GrpcServiceClient("https://todoworld.servicestack.net:50051", + cert, GrpcUtils.AllowSelfSignedCertificatesFrom("todoworld.servicestack.net")); + + var response = await client.GetAsync(new Hello {Name = "gRPC SSL C# 50051"}); + response.Result.Print(); + + client = new GrpcServiceClient("https://todoworld.servicestack.net:5051", + cert, GrpcUtils.AllowSelfSignedCertificatesFrom("todoworld.servicestack.net")); + + response = await client.GetAsync(new Hello {Name = "gRPC SSL C# 5051"}); + + response.Result.Print(); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + + // [Test] // Integration Test + public async Task Can_call_external_plaintext_service() + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + var client = new GrpcServiceClient("http://todoworld.servicestack.net:50054"); + var response = await client.GetAsync(new Hello {Name = "gRPC Text C# 50054"}); + response.Result.Print(); + + client = new GrpcServiceClient("http://todoworld.servicestack.net:5054"); + response = await client.GetAsync(new Hello {Name = "gRPC Text C# 5054"}); + response.Result.Print(); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/GrpcServerEventsTests.cs b/tests/ServiceStack.Extensions.Tests/GrpcServerEventsTests.cs new file mode 100644 index 00000000000..28865b0b83b --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/GrpcServerEventsTests.cs @@ -0,0 +1,130 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf.Grpc.Client; +using ServiceStack.Text; + +namespace ServiceStack.Extensions.Tests +{ + public class GrpcServerEventsTests + { + public class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(GrpcServerEventsTests), typeof(MyServices).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new GrpcFeature(App)); + Plugins.Add(new ServerEventsFeature()); + } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => { + listenOptions.Protocols = HttpProtocols.Http2; + }); + } + + public override void Configure(IServiceCollection services) => services.AddServiceStackGrpc(); + + public override void Configure(IApplicationBuilder app) => app.UseRouting(); + } + + private readonly ServiceStackHost appHost; + public GrpcServerEventsTests() + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + appHost = new AppHost() + .Init() + .Start(TestsConfig.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + private static GrpcServiceClient GetClient() => new GrpcServiceClient(TestsConfig.BaseUri); + + [Test] + public async Task Can_subscribe_to_ServerEvents() + { + var client = GetClient(); + + void AssertMessage(StreamServerEventsResponse msg) + { + Assert.That(msg.EventId, Is.GreaterThan(0)); + Assert.That(msg.Channels, Is.EqualTo(new[] { "home" })); + Assert.That(msg.Json, Is.Not.Null); + Assert.That(msg.Op, Is.EqualTo("cmd")); + Assert.That(msg.UserId, Is.EqualTo("-1")); + Assert.That(msg.DisplayName, Is.Not.Null); + Assert.That(msg.ProfileUrl, Is.Not.Null); + Assert.That(msg.IsAuthenticated, Is.False); + } + + var i = 0; + await foreach (var msg in client.StreamAsync(new StreamServerEvents { Channels = new[] { "home" } })) + { + if (i == 0) + { + Assert.That(msg.Selector, Is.EqualTo("cmd.onConnect")); + Assert.That(msg.Id, Is.Not.Null); + Assert.That(msg.UnRegisterUrl, Is.Not.Null); + Assert.That(msg.UpdateSubscriberUrl, Is.Not.Null); + Assert.That(msg.HeartbeatUrl, Is.Not.Null); + Assert.That(msg.HeartbeatIntervalMs, Is.GreaterThan(0)); + Assert.That(msg.IdleTimeoutMs, Is.GreaterThan(0)); + AssertMessage(msg); + } + else if (i == 1) + { + Assert.That(msg.Selector, Is.EqualTo("cmd.onJoin")); + AssertMessage(msg); + } + + $"\n\n{i}".Print(); + msg.PrintDump(); + + if (++i == 2) + break; + } + Assert.That(i, Is.EqualTo(2)); + } + + [Test] + public async Task Does_receive_all_messages() + { + var client1 = GetClient(); + var client2 = GetClient(); + + Task.Factory.StartNew(async () => { + await Task.Delay(500); + await client2.PostAsync(new PostChatToChannel { + Channel = "send", + From = nameof(client2), + Message = "Hello from client2", + Selector = "cmd.chat", + }); + }); + + var responses = new List(); + await foreach (var msg in client1.StreamAsync(new StreamServerEvents { Channels = new[] { "send" } })) + { + responses.Add(msg); + + if (msg.Selector == "cmd.chat") + break; + } + + Assert.That(responses[0].Selector, Is.EqualTo("cmd.onConnect")); + Assert.That(responses[1].Selector, Is.EqualTo("cmd.onJoin")); + Assert.That(responses[2].Selector, Is.EqualTo("cmd.chat")); + var obj = (Dictionary) JSON.parse(responses[2].Json); + Assert.That(obj["message"], Is.EqualTo("Hello from client2")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/GrpcTests.cs b/tests/ServiceStack.Extensions.Tests/GrpcTests.cs new file mode 100644 index 00000000000..328e95a9f29 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/GrpcTests.cs @@ -0,0 +1,934 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Runtime.CompilerServices; +using System.Runtime.Serialization; +using System.ServiceModel; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using Grpc.Core; +using Grpc.Net.Client; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf; +using ProtoBuf.Grpc.Client; +using ProtoBuf.Grpc.Configuration; +using ProtoBuf.Grpc.Server; +using ServiceStack.Auth; +using ServiceStack.FluentValidation; +using ServiceStack.FluentValidation.Validators; +using ServiceStack.Model; +using ServiceStack.Text; +using ServiceStack.Validation; + +namespace ServiceStack.Extensions.Tests +{ + [ServiceContract(Name = "Hyper.Calculator")] + public interface ICalculator + { + ValueTask MultiplyAsync(MultiplyRequest request); + } + + [DataContract] + public class MultiplyRequest + { + [DataMember(Order = 1)] + public int X { get; set; } + + [DataMember(Order = 2)] + public int Y { get; set; } + } + + [DataContract] + public class MultiplyResult + { + [DataMember(Order = 1)] + public int Result { get; set; } + } + +// [ServiceContract] +// public interface ITimeService +// { +// IAsyncEnumerable SubscribeAsync(CallContext context = default); +// } + +// [ProtoContract] +// public class TimeResult +// { +// [ProtoMember(1, DataFormat = DataFormat.WellKnown)] +// public DateTime Time { get; set; } +// } + + public class MyCalculator : ICalculator + { + ValueTask ICalculator.MultiplyAsync(MultiplyRequest request) + { + var result = new MultiplyResult { Result = request.X * request.Y }; + return new ValueTask(result); + } + } + +// public class MyTimeService : ITimeService +// { +// public IAsyncEnumerable SubscribeAsync(CallContext context = default) +// => SubscribeAsyncImpl(default); // context.CancellationToken); +// +// private async IAsyncEnumerable SubscribeAsyncImpl([EnumeratorCancellation] CancellationToken cancel) +// { +// while (!cancel.IsCancellationRequested) +// { +// await Task.Delay(TimeSpan.FromSeconds(10)); +// yield return new TimeResult { Time = DateTime.UtcNow }; +// } +// } +// } + + public class Startup + { + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + services.AddCodeFirstGrpc(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app) + { + app.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapGrpcService(); +// endpoints.MapGrpcService(); + }); + } + } + + [DataContract] + public class Multiply : IReturn + { + [DataMember(Order = 1)] + public int X { get; set; } + + [DataMember(Order = 2)] + public int Y { get; set; } + } + + [DataContract] + public class MultiplyResponse + { + [DataMember(Order = 1)] + public int Result { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class Incr : IReturnVoid + { + internal static int Counter = 0; + + [DataMember(Order = 1)] + public int Amount { get; set; } + } + + [DataContract] + public class GetHello : IReturn, IGet + { + [DataMember(Order = 1)] + public string Name { get; set; } + } + + [DataContract] + public class AnyHello : IReturn + { + [DataMember(Order = 1)] + public string Name { get; set; } + } + + [DataContract] + public class HelloResponse + { + [DataMember(Order = 1)] + public string Result { get; set; } + [DataMember(Order = 2)] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract] + public class Throw : IReturn + { + [DataMember(Order = 1)] + public string Message { get; set; } + } + + [DataContract] + public class ThrowVoid : IReturnVoid + { + [DataMember(Order = 1)] + public string Message { get; set; } + } + + [DataContract] + public class AddHeader : IReturnVoid + { + [DataMember(Order = 1)] + public string Name { get; set; } + [DataMember(Order = 2)] + public string Value { get; set; } + } + + [DataContract] + public class TriggerValidators : IReturn + { + [DataMember(Order = 1)] + public string CreditCard { get; set; } + [DataMember(Order = 2)] + public string Email { get; set; } + [DataMember(Order = 3)] + public string Empty { get; set; } + [DataMember(Order = 4)] + public string Equal { get; set; } + [DataMember(Order = 5)] + public int ExclusiveBetween { get; set; } + [DataMember(Order = 6)] + public int GreaterThanOrEqual { get; set; } + [DataMember(Order = 7)] + public int GreaterThan { get; set; } + [DataMember(Order = 8)] + public int InclusiveBetween { get; set; } + [DataMember(Order = 9)] + public string Length { get; set; } + [DataMember(Order = 10)] + public int LessThanOrEqual { get; set; } + [DataMember(Order = 11)] + public int LessThan { get; set; } + [DataMember(Order = 12)] + public string NotEmpty { get; set; } + [DataMember(Order = 13)] + public string NotEqual { get; set; } + [DataMember(Order = 14)] + public string Null { get; set; } + [DataMember(Order = 15)] + public string RegularExpression { get; set; } + [DataMember(Order = 16)] + public decimal ScalePrecision { get; set; } + } + + public class TriggerValidatorsValidator : AbstractValidator + { + public TriggerValidatorsValidator() + { + RuleFor(x => x.CreditCard).CreditCard(); + RuleFor(x => x.Email).EmailAddress(); + RuleFor(x => x.Empty).Empty(); + RuleFor(x => x.Equal).Equal("Equal"); + RuleFor(x => x.ExclusiveBetween).ExclusiveBetween(10, 20); + RuleFor(x => x.GreaterThanOrEqual).GreaterThanOrEqualTo(10); + RuleFor(x => x.GreaterThan).GreaterThan(10); + RuleFor(x => x.InclusiveBetween).InclusiveBetween(10, 20); + RuleFor(x => x.Length).Length(10); + RuleFor(x => x.LessThanOrEqual).LessThanOrEqualTo(10); + RuleFor(x => x.LessThan).LessThan(10); + RuleFor(x => x.NotEmpty).NotEmpty(); + RuleFor(x => x.NotEqual).NotEqual("NotEqual"); + RuleFor(x => x.Null).Null(); + RuleFor(x => x.RegularExpression).Matches(@"^[a-z]*$"); + RuleFor(x => x.ScalePrecision).SetValidator(new ScalePrecisionValidator(1, 1)); + } + } + + [Route("/channels/{Channel}/chat")] + [DataContract] + public class PostChatToChannel : IReturn, IPost + { + [DataMember(Order = 1)] + public string From { get; set; } + [DataMember(Order = 2)] + public string ToUserId { get; set; } + [DataMember(Order = 3)] + public string Channel { get; set; } + [DataMember(Order = 4)] + public string Message { get; set; } + [DataMember(Order = 5)] + public string Selector { get; set; } + } + + [DataContract] + public class ChatMessage + { + [DataMember(Order = 1)] + public long Id { get; set; } + [DataMember(Order = 2)] + public string Channel { get; set; } + [DataMember(Order = 3)] + public string FromUserId { get; set; } + [DataMember(Order = 4)] + public string FromName { get; set; } + [DataMember(Order = 5)] + public string DisplayName { get; set; } + [DataMember(Order = 6)] + public string Message { get; set; } + [DataMember(Order = 7)] + public string UserAuthId { get; set; } + [DataMember(Order = 8)] + public bool Private { get; set; } + } + + public class CustomException : Exception, IResponseStatusConvertible, IHasStatusCode + { + public ResponseStatus ToResponseStatus() => new ResponseStatus + { + ErrorCode = "CustomErrorCode", + Message = "Custom Error Message", + }; + + public int StatusCode { get; } = 401; + } + + [DataContract] + public class ThrowCustom : IReturn {} + + [DataContract] + public class ThrowCustomResponse + { + [DataMember(Order = 1)] + public ResponseStatus ResponseStatus { get; set; } + } + + + public class MyServices : Service + { + public Task Post(Multiply request) + { + var result = new MultiplyResponse { Result = request.X * request.Y }; + return Task.FromResult(result); + } + + public void Any(Incr request) + { + request.Amount.Times(x => Interlocked.Increment(ref Incr.Counter)); + } + + public object Get(GetHello request) => new HelloResponse { Result = $"Hello, {request.Name}!" }; + + public object Any(AnyHello request) => new HelloResponse { Result = $"Hello, {request.Name}!" }; + + public object Get(Throw request) => throw new Exception(request.Message ?? "Error in Throw"); + + public void Get(ThrowVoid request) => throw new Exception(request.Message ?? "Error in ThrowVoid"); + + public object Get(ThrowCustom request) => request; //thrown in Global Request Filters + + public object Post(TriggerValidators request) => new EmptyResponse(); + + public void Get(AddHeader request) + { + Response.AddHeader(request.Name, request.Value); + } + + public IServerEvents ServerEvents { get; set; } + public int Id = 0; + + public async Task Any(PostChatToChannel request) + { + var msg = new ChatMessage + { + Id = Id++, + Channel = request.Channel, + FromUserId = request.From, + FromName = request.From, + Message = request.Message.HtmlEncode(), + }; + + await ServerEvents.NotifyChannelAsync(request.Channel, request.Selector, msg); + + return msg; + } + } + + /// + /// TODO: + /// - Exceptions + /// - Validation + /// - Auth + /// - JWT + /// - Basic Auth + /// - AutoQuery + /// - Multitenancy? + /// + + public class GrpcTests + { + public class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(GrpcTests), typeof(MyServices).Assembly) { } + + public override void Configure(Container container) + { + RegisterService(); + + Plugins.Add(new ValidationFeature()); + Plugins.Add(new GrpcFeature(App)); + + GlobalRequestFilters.Add((req, res, dto) => { + if (dto is ThrowCustom) + throw new CustomException(); + }); + } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; + }); + } + + public override void Configure(IServiceCollection services) + { + services.AddServiceStackGrpc(); + } + + public override void Configure(IApplicationBuilder app) + { + app.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapGrpcService(); + }); + } + } + + private readonly ServiceStackHost appHost; + public GrpcTests() + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + appHost = new AppHost() + .Init() + .Start(TestsConfig.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + private static GrpcServiceClient GetClient() => new GrpcServiceClient(TestsConfig.BaseUri); + + [Test] + public async Task Can_call_MultiplyRequest_Grpc_Service_ICalculator() + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + using var http = GrpcChannel.ForAddress(TestsConfig.BaseUri); + var calculator = http.CreateGrpcService(); + var result = await calculator.MultiplyAsync(new MultiplyRequest { X = 12, Y = 4 }); + Assert.That(result.Result, Is.EqualTo(48)); + } + + [Test] + public async Task Can_call_Multiply_Grpc_Service_GrpcChannel() + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + using var http = GrpcChannel.ForAddress(TestsConfig.BaseUri); + + var response = await http.CreateCallInvoker().Execute(new Multiply { X = 12, Y = 4 }, "GrpcServices", + GrpcConfig.GetServiceName(HttpMethods.Post, nameof(Multiply))); + + Assert.That(response.Result, Is.EqualTo(48)); + } + + [Test] + public async Task Can_call_Multiply_Grpc_Service_GrpcServiceClient() + { + using var client = GetClient(); + + var response = await client.PostAsync(new Multiply { X = 12, Y = 4 }); + Assert.That(response.Result, Is.EqualTo(48)); + } + + [Test] + public void Can_call_Multiply_Grpc_Service_GrpcServiceClient_sync() + { + using var client = GetClient(); + + var response = client.Post(new Multiply { X = 12, Y = 4 }); + Assert.That(response.Result, Is.EqualTo(48)); + } + + [Test] + public async Task Can_call_Incr_ReturnVoid_GrpcServiceClient() + { + using var client = GetClient(); + + Incr.Counter = 0; + + await client.PublishAsync(new Incr { Amount = 1 }); + Assert.That(Incr.Counter, Is.EqualTo(1)); + + await client.PublishAsync(new Incr { Amount = 2 }); + Assert.That(Incr.Counter, Is.EqualTo(3)); + } + + [Test] + public async Task Can_call_GetHello_with_Get_or_Send() + { + using var client = GetClient(); + + var response = await client.GetAsync(new GetHello { Name = "GET" }); + Assert.That(response.Result, Is.EqualTo($"Hello, GET!")); + + response = await client.SendAsync(new GetHello { Name = "SEND" }); + Assert.That(response.Result, Is.EqualTo($"Hello, SEND!")); + } + + [Test] + public void Can_call_GetHello_with_Get_or_Send_sync() + { + using var client = GetClient(); + + var response = client.Get(new GetHello { Name = "GET" }); + Assert.That(response.Result, Is.EqualTo($"Hello, GET!")); + + response = client.Send(new GetHello { Name = "SEND" }); + Assert.That(response.Result, Is.EqualTo($"Hello, SEND!")); + } + + [Test] + public async Task Can_call_AnyHello_with_Get_Post_or_Send() + { + using var client = GetClient(); + + var response = await client.GetAsync(new AnyHello { Name = "GET" }); + Assert.That(response.Result, Is.EqualTo($"Hello, GET!")); + + response = await client.PostAsync(new AnyHello { Name = "POST" }); + Assert.That(response.Result, Is.EqualTo($"Hello, POST!")); + + response = await client.SendAsync(new GetHello { Name = "SEND" }); + Assert.That(response.Result, Is.EqualTo($"Hello, SEND!")); + } + + [Test] + public void Can_call_AnyHello_with_Get_Post_or_Send_sync() + { + using var client = GetClient(); + + var response = client.Get(new AnyHello { Name = "GET" }); + Assert.That(response.Result, Is.EqualTo($"Hello, GET!")); + + response = client.Post(new AnyHello { Name = "POST" }); + Assert.That(response.Result, Is.EqualTo($"Hello, POST!")); + + response = client.Send(new GetHello { Name = "SEND" }); + Assert.That(response.Result, Is.EqualTo($"Hello, SEND!")); + } + + [Test] + public async Task Can_call_AnyHello_Batch() + { + using var client = GetClient(); + + var requests = new[] { + new AnyHello {Name = "A"}, + new AnyHello {Name = "B"}, + new AnyHello {Name = "C"}, + }; + var responses = await client.SendAllAsync(requests); + Assert.That( responses.Map(x => x.Result), Is.EqualTo(new[] { + $"Hello, A!", + $"Hello, B!", + $"Hello, C!", + })); + } + + [Test] + public void Can_call_AnyHello_Batch_sync() + { + using var client = GetClient(); + + var requests = new[] { + new AnyHello {Name = "A"}, + new AnyHello {Name = "B"}, + new AnyHello {Name = "C"}, + }; + var responses = client.SendAll(requests); + Assert.That( responses.Map(x => x.Result), Is.EqualTo(new[] { + $"Hello, A!", + $"Hello, B!", + $"Hello, C!", + })); + } + + [Test] + public async Task Can_call_Incr_Batch_ReturnVoid() + { + using var client = GetClient(); + + Incr.Counter = 0; + + var requests = new[] { + new Incr {Amount = 1}, + new Incr {Amount = 2}, + new Incr {Amount = 3}, + }; + await client.PublishAllAsync(requests); + + Assert.That(Incr.Counter, Is.EqualTo(1 + 2 + 3)); + } + + [Test] + public void Can_call_Incr_Batch_ReturnVoid_sync() + { + using var client = GetClient(); + + Incr.Counter = 0; + + var requests = new[] { + new Incr {Amount = 1}, + new Incr {Amount = 2}, + new Incr {Amount = 3}, + }; + client.PublishAll(requests); + + Assert.That(Incr.Counter, Is.EqualTo(1 + 2 + 3)); + } + + [Test] + public async Task Does_throw_WebServiceException() + { + using var client = GetClient(); + + try + { + await client.GetAsync(new Throw { Message = "throw test" }); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(500)); + Assert.That(e.Message, Is.EqualTo("throw test")); + } + } + + [Test] + public void Does_throw_WebServiceException_sync() + { + using var client = GetClient(); + + try + { + client.Get(new Throw { Message = "throw test" }); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(500)); + Assert.That(e.Message, Is.EqualTo("throw test")); + } + } + + [Test] + public async Task Does_throw_WebServiceException_ReturnVoid() + { + using var client = GetClient(); + + try + { + await client.GetAsync(new ThrowVoid { Message = "throw test" }); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(500)); + Assert.That(e.Message, Is.EqualTo("throw test")); + } + } + + [Test] + public void Does_throw_WebServiceException_ReturnVoid_sync() + { + using var client = GetClient(); + + try + { + client.Get(new ThrowVoid { Message = "throw test" }); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(500)); + Assert.That(e.Message, Is.EqualTo("throw test")); + } + } + + [Test] + public async Task Triggering_all_validators_returns_right_ErrorCode() + { + var client = GetClient(); + var request = new TriggerValidators + { + CreditCard = "NotCreditCard", + Email = "NotEmail", + Empty = "NotEmpty", + Equal = "NotEqual", + ExclusiveBetween = 1, + GreaterThan = 1, + GreaterThanOrEqual = 1, + InclusiveBetween = 1, + Length = "Length", + LessThan = 20, + LessThanOrEqual = 20, + NotEmpty = "", + NotEqual = "NotEqual", + Null = "NotNull", + RegularExpression = "FOO", + ScalePrecision = 123.456m + }; + + try + { + var response = await client.PostAsync(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + //ex.ResponseStatus.PrintDump(); + Assert.That(ex.StatusCode, Is.EqualTo(400)); + var errors = ex.ResponseStatus.Errors; + Assert.That(errors.First(x => x.FieldName == "CreditCard").ErrorCode, Is.EqualTo("CreditCard")); + Assert.That(errors.First(x => x.FieldName == "Email").ErrorCode, Is.EqualTo("Email")); + Assert.That(errors.First(x => x.FieldName == "Email").ErrorCode, Is.EqualTo("Email")); + Assert.That(errors.First(x => x.FieldName == "Empty").ErrorCode, Is.EqualTo("Empty")); + Assert.That(errors.First(x => x.FieldName == "Equal").ErrorCode, Is.EqualTo("Equal")); + Assert.That(errors.First(x => x.FieldName == "ExclusiveBetween").ErrorCode, Is.EqualTo("ExclusiveBetween")); + Assert.That(errors.First(x => x.FieldName == "GreaterThan").ErrorCode, Is.EqualTo("GreaterThan")); + Assert.That(errors.First(x => x.FieldName == "GreaterThanOrEqual").ErrorCode, Is.EqualTo("GreaterThanOrEqual")); + Assert.That(errors.First(x => x.FieldName == "InclusiveBetween").ErrorCode, Is.EqualTo("InclusiveBetween")); + Assert.That(errors.First(x => x.FieldName == "Length").ErrorCode, Is.EqualTo("Length")); + Assert.That(errors.First(x => x.FieldName == "LessThan").ErrorCode, Is.EqualTo("LessThan")); + Assert.That(errors.First(x => x.FieldName == "LessThanOrEqual").ErrorCode, Is.EqualTo("LessThanOrEqual")); + Assert.That(errors.First(x => x.FieldName == "NotEmpty").ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(errors.First(x => x.FieldName == "NotEqual").ErrorCode, Is.EqualTo("NotEqual")); + Assert.That(errors.First(x => x.FieldName == "Null").ErrorCode, Is.EqualTo("Null")); + Assert.That(errors.First(x => x.FieldName == "RegularExpression").ErrorCode, Is.EqualTo("RegularExpression")); + Assert.That(errors.First(x => x.FieldName == "ScalePrecision").ErrorCode, Is.EqualTo("ScalePrecision")); + } + } + + [Test] + public async Task Does_throw_WebServiceException_on_CustomException() + { + using var client = GetClient(); + + try + { + await client.GetAsync(new ThrowCustom()); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(401)); + Assert.That(e.Message, Is.EqualTo("Custom Error Message")); + } + } + + [Test] + public async Task Does_return_Custom_Headers() + { + var client = GetClient(); + string customHeader = null; + client.ResponseFilter = ctx => customHeader = ctx.GetHeader("X-Custom"); + + await client.GetAsync(new AddHeader { Name = "X-Custom", Value = "A" }); + Assert.That(customHeader, Is.EqualTo("A")); + } + + [Test] + public async Task Can_download_file() + { + var client = GetClient(); + var response = await client.GetAsync(new GetFile { Path = "/js/ss-utils.js" }); + AssertSSUtils(response); + } + + private static void AssertSSUtils(FileContent response) + { + Assert.That(response.Name, Is.EqualTo("ss-utils.js")); + Assert.That(response.Length, Is.GreaterThan(0)); + Assert.That(response.Length, Is.EqualTo(response.Body.Length)); + var str = response.Body.FromUtf8Bytes(); + Assert.That(str, Does.Contain("if (!$.ss) $.ss = {};")); + } + + private static void AssertFiles(List responses) + { + Assert.That(responses.Count, Is.EqualTo(3)); + AssertSSUtils(responses[0]); + Assert.That(responses[1].Name, Is.EqualTo("hot-loader.js")); + Assert.That(responses[2].Name, Is.EqualTo("hot-fileloader.js")); + } + + [Test] + public async Task Can_download_multiple_files() + { + var client = GetClient(); + + var files = new[] { + new GetFile { Path = "/js/ss-utils.js" }, + new GetFile { Path = "/js/hot-loader.js" }, + new GetFile { Path = "/js/not-exists.js" }, + new GetFile { Path = "/js/hot-fileloader.js" }, + }; + + var responses = await client.SendAllAsync(files); + + Assert.That(responses.Count, Is.EqualTo(files.Length)); + Assert.That(responses[2].ResponseStatus.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.NotFound))); + responses = responses.Where(x => x.ResponseStatus == null).ToList(); + AssertFiles(responses); + } + + [Test] + public async Task Can_stream_multiple_files() + { + var client = GetClient(); + + var request = new StreamFiles { + Paths = new List { + "/js/ss-utils.js", + "/js/hot-loader.js", + "/js/not-exists.js", + "/js/hot-fileloader.js", + } + }; + + var files = new List(); + await foreach (var file in client.StreamAsync(request)) + { + files.Add(file); + } + Assert.That(files.Count, Is.EqualTo(request.Paths.Count)); + Assert.That(files[2].ResponseStatus.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.NotFound))); + files = files.Where(x => x.ResponseStatus == null).ToList(); + AssertFiles(files); + } + + static string GetServiceProto() + => GrpcConfig.TypeModel.GetSchema(MetaTypeConfig.GetMetaType().Type, ProtoBuf.Meta.ProtoSyntax.Proto3); + + [Test] + public void CheckServiceProto_BaseType() + { + var schema = GetServiceProto(); + Assert.AreEqual(@"syntax = ""proto3""; +package ServiceStack.Extensions.Tests; + +message Bar { + string Y = 2; +} +message Foo { + string X = 1; + oneof subtype { + Bar Bar = 210304982; + } +} +", schema); + } + + [Test] + public void CheckServiceProto_DerivedType() + { + var schema = GetServiceProto(); + Assert.AreEqual(@"syntax = ""proto3""; +package ServiceStack.Extensions.Tests; + +message Bar { + string Y = 2; +} +message Foo { + string X = 1; + oneof subtype { + Bar Bar = 210304982; + } +} +", schema); + } + + [Test] + public void CheckServiceProto_QueryDb_ShouldBeOffset() + { + var schema = GetServiceProto(); + Assert.AreEqual(@"syntax = ""proto3""; +package ServiceStack.Extensions.Tests; + +message QueryFoos { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + string X = 201; +} +", schema); + } + + [Test] + public void CheckServiceProto_CustomRequestDto_ShouldBeOffset() + { + var schema = GetServiceProto(); + Assert.AreEqual(@"syntax = ""proto3""; +package ServiceStack.Extensions.Tests; + +message CustomRequestDto { + int32 PageName = 42; + string Name = 105; +} +", schema); + } + + [DataContract] + public class Foo + { + [DataMember(Order = 1)] + public string X { get; set; } + } + + [DataContract] + public class Bar : Foo + { + [DataMember(Order = 2)] + public string Y { get; set; } + } + + [Route("/query/foos")] + [DataContract] + public class QueryFoos : QueryDb + { + [DataMember(Order = 1)] + public string X { get; set; } + } + + [DataContract] + public abstract class CustomRequestDtoBase : IReturnVoid + { + [DataMember(Order = 42, Name = "PageName")] + public int Page { get; set; } + } + + [DataContract] + public class CustomRequestDto : CustomRequestDtoBase + { + [DataMember(Order = 5)] + public string Name { get; set; } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/GrpcTodoTests.cs b/tests/ServiceStack.Extensions.Tests/GrpcTodoTests.cs new file mode 100644 index 00000000000..cc47d58031e --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/GrpcTodoTests.cs @@ -0,0 +1,273 @@ +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Runtime.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf.Grpc.Client; + +namespace ServiceStack.Extensions.Tests +{ + [DataContract] + public class Todo + { + [DataMember(Order = 1)] + public long Id { get; set; } + + [DataMember(Order = 2)] + public string Title { get; set; } + + [DataMember(Order = 3)] + public int Order { get; set; } + + [DataMember(Order = 4)] + public bool Completed { get; set; } + } + + [Route("/todos", "GET")] + [DataContract] + public class GetTodos : IReturn {} + [DataContract] + public class GetTodosResponse + { + [DataMember(Order = 1)] + public List Results { get; set; } + [DataMember(Order = 2)] + public ResponseStatus ResponseStatus { get; set; } + } + + [Route("/todos/{Id}", "GET")] + [DataContract] + public class GetTodo : IReturn + { + [DataMember(Order = 1)] + public long Id { get; set; } + } + [DataContract] + public class GetTodoResponse + { + [DataMember(Order = 1)] + public Todo Result { get; set; } + [DataMember(Order = 2)] + public ResponseStatus ResponseStatus { get; set; } + } + + [Route("/todos", "POST")] + [DataContract] + public class CreateTodo : IReturn + { + [DataMember(Order = 1)] + public string Title { get; set; } + + [DataMember(Order = 2)] + public int Order { get; set; } + } + [DataContract] + public class CreateTodoResponse + { + [DataMember(Order = 1)] + public Todo Result { get; set; } + [DataMember(Order = 2)] + public ResponseStatus ResponseStatus { get; set; } + } + + [Route("/todos/{Id}", "PUT")] + [DataContract] + public class UpdateTodo : IReturnVoid + { + [DataMember(Order = 1)] + public long Id { get; set; } + + [DataMember(Order = 2)] + public string Title { get; set; } + + [DataMember(Order = 3)] + public int Order { get; set; } + + [DataMember(Order = 4)] + public bool Completed { get; set; } + } + + [Route("/todos/{Id}", "DELETE")] + [DataContract] + public class DeleteTodo : IReturnVoid + { + [DataMember(Order = 1)] + public long Id { get; set; } + } + + [Route("/todos", "DELETE")] + [DataContract] + public class DeleteTodos : IReturnVoid + { + [DataMember(Order = 1)] + public List Ids { get; set; } + } + + [Route("/todos/reset", "POST")] + [DataContract] + public class ResetTodos : IReturnVoid {} + + public class TodoServices : Service + { + private static long Counter = 0; + public static List Todos { get; } = new List(); + + public IServerEvents ServerEvents { get; set; } + + public object Get(GetTodo request) => new GetTodoResponse { Result = Todos.FirstOrDefault(x => x.Id == request.Id) }; + + public object Get(GetTodos request) => new GetTodosResponse { Results = Todos }; + + public async Task Post(CreateTodo request) + { + var todo = request.ConvertTo(); + todo.Id = Interlocked.Increment(ref Counter); + Todos.Add(todo); + await ServerEvents.NotifyChannelAsync("todos", "todos.create", todo); + return new CreateTodoResponse { Result = todo }; + } + + public Task Put(UpdateTodo request) + { + var todo = Todos.FirstOrDefault(x => x.Id == request.Id) + ?? throw HttpError.NotFound($"Todo with Id '{request.Id}' does not exit"); + todo.PopulateWith(request); + return ServerEvents.NotifyChannelAsync("todos", "todos.update", todo); + } + + public Task Delete(DeleteTodo request) + { + Todos.RemoveAll(x => x.Id == request.Id); + return ServerEvents.NotifyChannelAsync("todos", "todos.delete", request.Id); + } + + public Task Delete(DeleteTodos request) + { + if (request.Ids.IsEmpty()) + return Task.CompletedTask; + + Todos.RemoveAll(x => request.Ids.Contains(x.Id)); + var tasks = request.Ids.Map(x => ServerEvents.NotifyChannelAsync("todos", "todos.delete", x)); + return Task.WhenAll(tasks); + } + + public void Post(ResetTodos request) + { + Counter = 0; + Todos.Clear(); + } + } + + public class GrpcTodoTests + { + private readonly ServiceStackHost appHost; + + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(GrpcTests), typeof(TodoServices).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new GrpcFeature(App)); + Plugins.Add(new ServerEventsFeature()); + + } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; + }); + } + + public override void Configure(IServiceCollection services) + { + services.AddServiceStackGrpc(); + } + + public override void Configure(IApplicationBuilder app) + { + app.UseRouting(); + } + } + + public GrpcTodoTests() + { + appHost = new AppHost() + .Init() + .Start(TestsConfig.BaseUri); + + GrpcClientFactory.AllowUnencryptedHttp2 = true; + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + public IServiceClientAsync CreateClient() => new GrpcServiceClient(TestsConfig.BaseUri); + + [Test] + public async Task Can_CreateTodo() + { + var client = CreateClient(); + await client.PostAsync(new ResetTodos()); + + var response = await client.PostAsync(new CreateTodo { + Title = "A", + Order = 1, + }); + + Assert.That(response.Result.Id, Is.GreaterThan(0)); + Assert.That(response.Result.Title, Is.EqualTo("A")); + Assert.That(response.Result.Order, Is.EqualTo(1)); + Assert.That(response.Result.Completed, Is.False); + + await client.SendAllAsync(new [] { + new CreateTodo { Title = "B", Order = 2 }, + new CreateTodo { Title = "C", Order = 3 }, + }); + + var allTodos = await client.GetAsync(new GetTodos()); + Assert.That(allTodos.Results.Map(x => x.Title), Is.EqualTo(new[]{"A","B","C"})); + } + + [Test] + public async Task Does_CRUD_Example() + { + var client = CreateClient(); + await client.PostAsync(new ResetTodos()); + + //GET /todos + var all = await client.GetAsync(new GetTodos()); + Assert.That(all.Results?.Count ?? 0, Is.EqualTo(0)); + + //POST /todos + var todo = (await client.PostAsync(new CreateTodo { Title = "ServiceStack" })).Result; + Assert.That(todo.Id, Is.EqualTo(1)); + //GET /todos/1 + todo = (await client.GetAsync(new GetTodo { Id = todo.Id })).Result; + Assert.That(todo.Title, Is.EqualTo("ServiceStack")); + + //GET /todos + all = await client.GetAsync(new GetTodos()); + Assert.That(all.Results.Count, Is.EqualTo(1)); + + //PUT /todos/1 + await client.PutAsync(new UpdateTodo { Id = todo.Id, Title = "gRPC" }); + todo = (await client.GetAsync(new GetTodo { Id = todo.Id })).Result; + Assert.That(todo.Title, Is.EqualTo("gRPC")); + + //DELETE /todos/1 + await client.DeleteAsync(new DeleteTodo { Id = todo.Id }); + //GET /todos + all = await client.GetAsync(new GetTodos()); + Assert.That(all.Results?.Count ?? 0, Is.EqualTo(0)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/Issues/GrpcServiceIssues.cs b/tests/ServiceStack.Extensions.Tests/Issues/GrpcServiceIssues.cs new file mode 100644 index 00000000000..32ed2e23eda --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Issues/GrpcServiceIssues.cs @@ -0,0 +1,115 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf.Grpc.Client; +using ServiceStack.Auth; +using ServiceStack.Validation; + +namespace ServiceStack.Extensions.Tests.Issues +{ + [Route("/endswith/{Suffix}", Summary = "suffix")] + [DataContract] + public class EndsWithSuffixRequest : IReturn + { + [DataMember(Order = 1), ApiMember(Name = "Suffix", Description = "Suffix", DataType = "string", IsRequired = true)] + public string Suffix { get; set; } + } + + [DataContract] + public class EndsWithSuffixResponse + { + [DataMember(Order = 1)] + public SearchResult Result { get; set; } + + [DataMember(Order = 2)] + public int Count { get; set; } + + [DataMember(Order = 3)] + public List Words { get; set; } + } + + [DataContract] + public class SearchResult + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public string Suffix { get; set; } + } + + public class GrpcIssueServices : Service + { + public object Any(EndsWithSuffixRequest request) => new EndsWithSuffixResponse { + Result = new SearchResult { Suffix = request.Suffix } + }; + } + + public partial class GrpcServiceIssues + { + public class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(GrpcServiceIssues), typeof(MyServices).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new ValidationFeature()); + Plugins.Add(new GrpcFeature(App)); + } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; + }); + } + + public override void Configure(IServiceCollection services) + { + services.AddServiceStackGrpc(); + } + + public override void Configure(IApplicationBuilder app) + { + app.UseRouting(); + } + } + + public static readonly int Port = 20000; + public static readonly string BaseUri = $"http://localhost:{Port}"; + public static readonly string ListeningOn = BaseUri + "/"; + + private readonly ServiceStackHost appHost; + public GrpcServiceIssues() + { + appHost = new AppHost() + .Init() + .Start(ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + public static GrpcServiceClient CreateClient() + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + var client = new GrpcServiceClient(BaseUri); + return client; + } + + [Test] + public async Task Can_call_EndsWithSuffixRequest() + { + var client = CreateClient(); + var request = new EndsWithSuffixRequest { Suffix = "TheSuffix" }; + var response = await client.GetAsync(request); + Assert.That(response.Result.Suffix, Is.EqualTo(request.Suffix)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/ProtobufTests.cs b/tests/ServiceStack.Extensions.Tests/ProtobufTests.cs new file mode 100644 index 00000000000..dd1a204a533 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/ProtobufTests.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.Serialization; +using NUnit.Framework; +using ProtoBuf.Meta; +using ServiceStack.Text; + +namespace ServiceStack.Extensions.Tests +{ + [DataContract] + public class Query + { + [DataMember(Order = 1)] + public virtual string Include { get; set; } + } + + [DataContract] + public class NonGenericQueryBase : QueryBase {} + + [DataContract] + public class NonGenericMyQueryBase : MyQueryBase {} + + [DataContract] + public abstract class MyQueryBase + { + [DataMember(Order = 1)] + public virtual string Include { get; set; } + } + + [DataContract] + public abstract class HiddenBase + { + [DataMember(Order = 1)] + public string FirstName { get; set; } + [DataMember(Order = 2)] + public LivingStatus LivingStatus { get; set; } + } + + [DataContract] + public class Shadowed : HiddenBase + { + [DataMember(Order = 1)] + public int Id { get; set; } + [DataMember(Order = 2)] + public new string FirstName { get; set; } + [DataMember(Order = 3)] + public new LivingStatus? LivingStatus { get; set; } //overridden property + } + + public class ProtobufTests + { + public T Serialize(T dto, TypeModel model = null) + { + if (model != null) + { + byte[] bytes = null; + using (var ms = new MemoryStream()) + { + model.Serialize(ms, dto); + bytes = ms.ToArray(); + } + using (var ms = new MemoryStream(bytes)) + { + var to = (T) model.Deserialize(ms, (object)null, typeof(T)); + return to; + } + } + else + { + var bytes = GrpcMarshaller.Instance.Serializer(dto); + var to = GrpcMarshaller.Instance.Deserializer(bytes); + return to; + } + } + + public T SerializeGrpc(T dto) + { + var bytes = GrpcMarshaller.Instance.Serializer(dto); + var to = GrpcMarshaller.Instance.Deserializer(bytes); + return to; + } + + [Test] + public void Can_Serialize_Query() + { + var dto = new Query { Include = "Total" }; + var to = Serialize(dto); + Assert.That(to.Include, Is.EqualTo(dto.Include)); + } + + [Test] + public void Can_Serialize_QueryRockstars_TypeModel() + { + var model = RuntimeTypeModel.Create(); + + //var metaType = model.Add(typeof(QueryBase), true); + model[typeof(QueryBase)].AddSubType(101, typeof(QueryDb)); + model[typeof(QueryDb)].AddSubType(101, typeof(QueryRockstars)); + + var dto = new QueryRockstars { Include = "Total" }; + var to = Serialize(dto, model); + Assert.That(to.Include, Is.EqualTo(dto.Include)); + } + + [Test] + public void Can_Serialize_QueryRockstars() + { + var dto = new QueryRockstars { Include = "Total" }; + var to = SerializeGrpc(dto); + Assert.That(to.Include, Is.EqualTo(dto.Include)); + } + + [Test] + public void Can_Serialize_QueryResponse_NamedRockstar() + { +// GrpcUtils.Register(); + var dto = new QueryResponse { + Total = 1, + Results = new List { + new NamedRockstar { + Id = 1, + FirstName = "Microsoft", + LastName = "SQL Server", + Age = 27, + DateOfBirth = new DateTime(1989,1,1), + LivingStatus = LivingStatus.Alive, + } + } + }; + var to = SerializeGrpc(dto); + to.PrintDump(); + Assert.That(to.Results[0].LastName, Is.EqualTo("SQL Server")); + } + + [Test] + public void Can_serialize_bytes() + { + var dto = new FileContent { + Body = "abc".ToUtf8Bytes(), + }; + var toDto = SerializeGrpc(dto); + Assert.That(toDto.Body, Is.EqualTo(dto.Body)); + } + + [Test] + public void Can_serialize_hidden_property() + { + var dto = new Shadowed { + Id = 1, + FirstName = "Updated", + LivingStatus = LivingStatus.Dead, + }; + var toDto = SerializeGrpc(dto); + Assert.That(toDto.Id, Is.EqualTo(dto.Id)); + Assert.That(toDto.FirstName, Is.EqualTo(dto.FirstName)); + Assert.That(toDto.LivingStatus, Is.EqualTo(dto.LivingStatus)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/Protoc/Bcl.cs b/tests/ServiceStack.Extensions.Tests/Protoc/Bcl.cs new file mode 100644 index 00000000000..c9e68e8ed80 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Protoc/Bcl.cs @@ -0,0 +1,1118 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: bcl.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace ProtoBuf.Bcl { + + /// Holder for reflection information generated from bcl.proto + public static partial class BclReflection { + + #region Descriptor + /// File descriptor for bcl.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static BclReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CgliY2wucHJvdG8SA2JjbCKuAQoIVGltZVNwYW4SDQoFdmFsdWUYASABKBIS", + "KgoFc2NhbGUYAiABKA4yGy5iY2wuVGltZVNwYW4uVGltZVNwYW5TY2FsZSJn", + "Cg1UaW1lU3BhblNjYWxlEggKBERBWVMQABIJCgVIT1VSUxABEgsKB01JTlVU", + "RVMQAhILCgdTRUNPTkRTEAMSEAoMTUlMTElTRUNPTkRTEAQSCQoFVElDS1MQ", + "BRIKCgZNSU5NQVgQDyKNAgoIRGF0ZVRpbWUSDQoFdmFsdWUYASABKBISKgoF", + "c2NhbGUYAiABKA4yGy5iY2wuRGF0ZVRpbWUuVGltZVNwYW5TY2FsZRIoCgRr", + "aW5kGAMgASgOMhouYmNsLkRhdGVUaW1lLkRhdGVUaW1lS2luZCJnCg1UaW1l", + "U3BhblNjYWxlEggKBERBWVMQABIJCgVIT1VSUxABEgsKB01JTlVURVMQAhIL", + "CgdTRUNPTkRTEAMSEAoMTUlMTElTRUNPTkRTEAQSCQoFVElDS1MQBRIKCgZN", + "SU5NQVgQDyIzCgxEYXRlVGltZUtpbmQSDwoLVU5TUEVDSUZJRUQQABIHCgNV", + "VEMQARIJCgVMT0NBTBACIpEBCg5OZXRPYmplY3RQcm94eRIZChFleGlzdGlu", + "Z09iamVjdEtleRgBIAEoBRIUCgxuZXdPYmplY3RLZXkYAiABKAUSFwoPZXhp", + "c3RpbmdUeXBlS2V5GAMgASgFEhIKCm5ld1R5cGVLZXkYBCABKAUSEAoIdHlw", + "ZU5hbWUYCCABKAkSDwoHcGF5bG9hZBgKIAEoDCIeCgRHdWlkEgoKAmxvGAEg", + "ASgGEgoKAmhpGAIgASgGIjQKB0RlY2ltYWwSCgoCbG8YASABKAQSCgoCaGkY", + "AiABKA0SEQoJc2lnblNjYWxlGAMgASgNQg+qAgxQcm90b0J1Zi5CY2xiBnBy", + "b3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::ProtoBuf.Bcl.TimeSpan), global::ProtoBuf.Bcl.TimeSpan.Parser, new[]{ "Value", "Scale" }, null, new[]{ typeof(global::ProtoBuf.Bcl.TimeSpan.Types.TimeSpanScale) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtoBuf.Bcl.DateTime), global::ProtoBuf.Bcl.DateTime.Parser, new[]{ "Value", "Scale", "Kind" }, null, new[]{ typeof(global::ProtoBuf.Bcl.DateTime.Types.TimeSpanScale), typeof(global::ProtoBuf.Bcl.DateTime.Types.DateTimeKind) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtoBuf.Bcl.NetObjectProxy), global::ProtoBuf.Bcl.NetObjectProxy.Parser, new[]{ "ExistingObjectKey", "NewObjectKey", "ExistingTypeKey", "NewTypeKey", "TypeName", "Payload" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtoBuf.Bcl.Guid), global::ProtoBuf.Bcl.Guid.Parser, new[]{ "Lo", "Hi" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtoBuf.Bcl.Decimal), global::ProtoBuf.Bcl.Decimal.Parser, new[]{ "Lo", "Hi", "SignScale" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class TimeSpan : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TimeSpan()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtoBuf.Bcl.BclReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TimeSpan() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TimeSpan(TimeSpan other) : this() { + value_ = other.value_; + scale_ = other.scale_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TimeSpan Clone() { + return new TimeSpan(this); + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 1; + private long value_; + /// + /// the size of the timespan (in units of the selected scale) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Value { + get { return value_; } + set { + value_ = value; + } + } + + /// Field number for the "scale" field. + public const int ScaleFieldNumber = 2; + private global::ProtoBuf.Bcl.TimeSpan.Types.TimeSpanScale scale_ = 0; + /// + /// the scale of the timespan [default = DAYS] + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtoBuf.Bcl.TimeSpan.Types.TimeSpanScale Scale { + get { return scale_; } + set { + scale_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TimeSpan); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TimeSpan other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Value != other.Value) return false; + if (Scale != other.Scale) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Value != 0L) hash ^= Value.GetHashCode(); + if (Scale != 0) hash ^= Scale.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Value != 0L) { + output.WriteRawTag(8); + output.WriteSInt64(Value); + } + if (Scale != 0) { + output.WriteRawTag(16); + output.WriteEnum((int) Scale); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Value != 0L) { + size += 1 + pb::CodedOutputStream.ComputeSInt64Size(Value); + } + if (Scale != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Scale); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TimeSpan other) { + if (other == null) { + return; + } + if (other.Value != 0L) { + Value = other.Value; + } + if (other.Scale != 0) { + Scale = other.Scale; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Value = input.ReadSInt64(); + break; + } + case 16: { + Scale = (global::ProtoBuf.Bcl.TimeSpan.Types.TimeSpanScale) input.ReadEnum(); + break; + } + } + } + } + + #region Nested types + /// Container for nested types declared in the TimeSpan message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + public enum TimeSpanScale { + [pbr::OriginalName("DAYS")] Days = 0, + [pbr::OriginalName("HOURS")] Hours = 1, + [pbr::OriginalName("MINUTES")] Minutes = 2, + [pbr::OriginalName("SECONDS")] Seconds = 3, + [pbr::OriginalName("MILLISECONDS")] Milliseconds = 4, + [pbr::OriginalName("TICKS")] Ticks = 5, + /// + /// dubious + /// + [pbr::OriginalName("MINMAX")] Minmax = 15, + } + + } + #endregion + + } + + public sealed partial class DateTime : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DateTime()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtoBuf.Bcl.BclReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DateTime() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DateTime(DateTime other) : this() { + value_ = other.value_; + scale_ = other.scale_; + kind_ = other.kind_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DateTime Clone() { + return new DateTime(this); + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 1; + private long value_; + /// + /// the offset (in units of the selected scale) from 1970/01/01 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Value { + get { return value_; } + set { + value_ = value; + } + } + + /// Field number for the "scale" field. + public const int ScaleFieldNumber = 2; + private global::ProtoBuf.Bcl.DateTime.Types.TimeSpanScale scale_ = 0; + /// + /// the scale of the timespan [default = DAYS] + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtoBuf.Bcl.DateTime.Types.TimeSpanScale Scale { + get { return scale_; } + set { + scale_ = value; + } + } + + /// Field number for the "kind" field. + public const int KindFieldNumber = 3; + private global::ProtoBuf.Bcl.DateTime.Types.DateTimeKind kind_ = 0; + /// + /// the kind of date/time being represented [default = UNSPECIFIED] + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtoBuf.Bcl.DateTime.Types.DateTimeKind Kind { + get { return kind_; } + set { + kind_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DateTime); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DateTime other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Value != other.Value) return false; + if (Scale != other.Scale) return false; + if (Kind != other.Kind) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Value != 0L) hash ^= Value.GetHashCode(); + if (Scale != 0) hash ^= Scale.GetHashCode(); + if (Kind != 0) hash ^= Kind.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Value != 0L) { + output.WriteRawTag(8); + output.WriteSInt64(Value); + } + if (Scale != 0) { + output.WriteRawTag(16); + output.WriteEnum((int) Scale); + } + if (Kind != 0) { + output.WriteRawTag(24); + output.WriteEnum((int) Kind); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Value != 0L) { + size += 1 + pb::CodedOutputStream.ComputeSInt64Size(Value); + } + if (Scale != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Scale); + } + if (Kind != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Kind); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DateTime other) { + if (other == null) { + return; + } + if (other.Value != 0L) { + Value = other.Value; + } + if (other.Scale != 0) { + Scale = other.Scale; + } + if (other.Kind != 0) { + Kind = other.Kind; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Value = input.ReadSInt64(); + break; + } + case 16: { + Scale = (global::ProtoBuf.Bcl.DateTime.Types.TimeSpanScale) input.ReadEnum(); + break; + } + case 24: { + Kind = (global::ProtoBuf.Bcl.DateTime.Types.DateTimeKind) input.ReadEnum(); + break; + } + } + } + } + + #region Nested types + /// Container for nested types declared in the DateTime message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + public enum TimeSpanScale { + [pbr::OriginalName("DAYS")] Days = 0, + [pbr::OriginalName("HOURS")] Hours = 1, + [pbr::OriginalName("MINUTES")] Minutes = 2, + [pbr::OriginalName("SECONDS")] Seconds = 3, + [pbr::OriginalName("MILLISECONDS")] Milliseconds = 4, + [pbr::OriginalName("TICKS")] Ticks = 5, + /// + /// dubious + /// + [pbr::OriginalName("MINMAX")] Minmax = 15, + } + + public enum DateTimeKind { + /// + /// The time represented is not specified as either local time or Coordinated Universal Time (UTC). + /// + [pbr::OriginalName("UNSPECIFIED")] Unspecified = 0, + /// + /// The time represented is UTC. + /// + [pbr::OriginalName("UTC")] Utc = 1, + /// + /// The time represented is local time. + /// + [pbr::OriginalName("LOCAL")] Local = 2, + } + + } + #endregion + + } + + public sealed partial class NetObjectProxy : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NetObjectProxy()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtoBuf.Bcl.BclReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NetObjectProxy() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NetObjectProxy(NetObjectProxy other) : this() { + existingObjectKey_ = other.existingObjectKey_; + newObjectKey_ = other.newObjectKey_; + existingTypeKey_ = other.existingTypeKey_; + newTypeKey_ = other.newTypeKey_; + typeName_ = other.typeName_; + payload_ = other.payload_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NetObjectProxy Clone() { + return new NetObjectProxy(this); + } + + /// Field number for the "existingObjectKey" field. + public const int ExistingObjectKeyFieldNumber = 1; + private int existingObjectKey_; + /// + /// for a tracked object, the key of the **first** time this object was seen + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ExistingObjectKey { + get { return existingObjectKey_; } + set { + existingObjectKey_ = value; + } + } + + /// Field number for the "newObjectKey" field. + public const int NewObjectKeyFieldNumber = 2; + private int newObjectKey_; + /// + /// for a tracked object, a **new** key, the first time this object is seen + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int NewObjectKey { + get { return newObjectKey_; } + set { + newObjectKey_ = value; + } + } + + /// Field number for the "existingTypeKey" field. + public const int ExistingTypeKeyFieldNumber = 3; + private int existingTypeKey_; + /// + /// for dynamic typing, the key of the **first** time this type was seen + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ExistingTypeKey { + get { return existingTypeKey_; } + set { + existingTypeKey_ = value; + } + } + + /// Field number for the "newTypeKey" field. + public const int NewTypeKeyFieldNumber = 4; + private int newTypeKey_; + /// + /// for dynamic typing, a **new** key, the first time this type is seen + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int NewTypeKey { + get { return newTypeKey_; } + set { + newTypeKey_ = value; + } + } + + /// Field number for the "typeName" field. + public const int TypeNameFieldNumber = 8; + private string typeName_ = ""; + /// + /// for dynamic typing, the name of the type (only present along with newTypeKey) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string TypeName { + get { return typeName_; } + set { + typeName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "payload" field. + public const int PayloadFieldNumber = 10; + private pb::ByteString payload_ = pb::ByteString.Empty; + /// + /// the new string/value (only present along with newObjectKey) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString Payload { + get { return payload_; } + set { + payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as NetObjectProxy); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(NetObjectProxy other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ExistingObjectKey != other.ExistingObjectKey) return false; + if (NewObjectKey != other.NewObjectKey) return false; + if (ExistingTypeKey != other.ExistingTypeKey) return false; + if (NewTypeKey != other.NewTypeKey) return false; + if (TypeName != other.TypeName) return false; + if (Payload != other.Payload) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ExistingObjectKey != 0) hash ^= ExistingObjectKey.GetHashCode(); + if (NewObjectKey != 0) hash ^= NewObjectKey.GetHashCode(); + if (ExistingTypeKey != 0) hash ^= ExistingTypeKey.GetHashCode(); + if (NewTypeKey != 0) hash ^= NewTypeKey.GetHashCode(); + if (TypeName.Length != 0) hash ^= TypeName.GetHashCode(); + if (Payload.Length != 0) hash ^= Payload.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (ExistingObjectKey != 0) { + output.WriteRawTag(8); + output.WriteInt32(ExistingObjectKey); + } + if (NewObjectKey != 0) { + output.WriteRawTag(16); + output.WriteInt32(NewObjectKey); + } + if (ExistingTypeKey != 0) { + output.WriteRawTag(24); + output.WriteInt32(ExistingTypeKey); + } + if (NewTypeKey != 0) { + output.WriteRawTag(32); + output.WriteInt32(NewTypeKey); + } + if (TypeName.Length != 0) { + output.WriteRawTag(66); + output.WriteString(TypeName); + } + if (Payload.Length != 0) { + output.WriteRawTag(82); + output.WriteBytes(Payload); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ExistingObjectKey != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ExistingObjectKey); + } + if (NewObjectKey != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NewObjectKey); + } + if (ExistingTypeKey != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ExistingTypeKey); + } + if (NewTypeKey != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NewTypeKey); + } + if (TypeName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeName); + } + if (Payload.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Payload); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(NetObjectProxy other) { + if (other == null) { + return; + } + if (other.ExistingObjectKey != 0) { + ExistingObjectKey = other.ExistingObjectKey; + } + if (other.NewObjectKey != 0) { + NewObjectKey = other.NewObjectKey; + } + if (other.ExistingTypeKey != 0) { + ExistingTypeKey = other.ExistingTypeKey; + } + if (other.NewTypeKey != 0) { + NewTypeKey = other.NewTypeKey; + } + if (other.TypeName.Length != 0) { + TypeName = other.TypeName; + } + if (other.Payload.Length != 0) { + Payload = other.Payload; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ExistingObjectKey = input.ReadInt32(); + break; + } + case 16: { + NewObjectKey = input.ReadInt32(); + break; + } + case 24: { + ExistingTypeKey = input.ReadInt32(); + break; + } + case 32: { + NewTypeKey = input.ReadInt32(); + break; + } + case 66: { + TypeName = input.ReadString(); + break; + } + case 82: { + Payload = input.ReadBytes(); + break; + } + } + } + } + + } + + public sealed partial class Guid : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Guid()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtoBuf.Bcl.BclReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Guid() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Guid(Guid other) : this() { + lo_ = other.lo_; + hi_ = other.hi_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Guid Clone() { + return new Guid(this); + } + + /// Field number for the "lo" field. + public const int LoFieldNumber = 1; + private ulong lo_; + /// + /// the first 8 bytes of the guid (note:crazy-endian) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong Lo { + get { return lo_; } + set { + lo_ = value; + } + } + + /// Field number for the "hi" field. + public const int HiFieldNumber = 2; + private ulong hi_; + /// + /// the second 8 bytes of the guid (note:crazy-endian) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong Hi { + get { return hi_; } + set { + hi_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Guid); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Guid other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Lo != other.Lo) return false; + if (Hi != other.Hi) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Lo != 0UL) hash ^= Lo.GetHashCode(); + if (Hi != 0UL) hash ^= Hi.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Lo != 0UL) { + output.WriteRawTag(9); + output.WriteFixed64(Lo); + } + if (Hi != 0UL) { + output.WriteRawTag(17); + output.WriteFixed64(Hi); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Lo != 0UL) { + size += 1 + 8; + } + if (Hi != 0UL) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Guid other) { + if (other == null) { + return; + } + if (other.Lo != 0UL) { + Lo = other.Lo; + } + if (other.Hi != 0UL) { + Hi = other.Hi; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + Lo = input.ReadFixed64(); + break; + } + case 17: { + Hi = input.ReadFixed64(); + break; + } + } + } + } + + } + + public sealed partial class Decimal : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Decimal()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtoBuf.Bcl.BclReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Decimal() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Decimal(Decimal other) : this() { + lo_ = other.lo_; + hi_ = other.hi_; + signScale_ = other.signScale_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Decimal Clone() { + return new Decimal(this); + } + + /// Field number for the "lo" field. + public const int LoFieldNumber = 1; + private ulong lo_; + /// + /// the first 64 bits of the underlying value + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong Lo { + get { return lo_; } + set { + lo_ = value; + } + } + + /// Field number for the "hi" field. + public const int HiFieldNumber = 2; + private uint hi_; + /// + /// the last 32 bis of the underlying value + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint Hi { + get { return hi_; } + set { + hi_ = value; + } + } + + /// Field number for the "signScale" field. + public const int SignScaleFieldNumber = 3; + private uint signScale_; + /// + /// the number of decimal digits (bits 1-16), and the sign (bit 0) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint SignScale { + get { return signScale_; } + set { + signScale_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Decimal); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Decimal other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Lo != other.Lo) return false; + if (Hi != other.Hi) return false; + if (SignScale != other.SignScale) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Lo != 0UL) hash ^= Lo.GetHashCode(); + if (Hi != 0) hash ^= Hi.GetHashCode(); + if (SignScale != 0) hash ^= SignScale.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Lo != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(Lo); + } + if (Hi != 0) { + output.WriteRawTag(16); + output.WriteUInt32(Hi); + } + if (SignScale != 0) { + output.WriteRawTag(24); + output.WriteUInt32(SignScale); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Lo != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Lo); + } + if (Hi != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Hi); + } + if (SignScale != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(SignScale); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Decimal other) { + if (other == null) { + return; + } + if (other.Lo != 0UL) { + Lo = other.Lo; + } + if (other.Hi != 0) { + Hi = other.Hi; + } + if (other.SignScale != 0) { + SignScale = other.SignScale; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Lo = input.ReadUInt64(); + break; + } + case 16: { + Hi = input.ReadUInt32(); + break; + } + case 24: { + SignScale = input.ReadUInt32(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/tests/ServiceStack.Extensions.Tests/Protoc/ProtocAuthTests.cs b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocAuthTests.cs new file mode 100644 index 00000000000..4c4a8f53f20 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocAuthTests.cs @@ -0,0 +1,378 @@ +using System; +using System.IO; +using System.Linq; +using System.Net; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using Grpc.Core; +using Grpc.Core.Interceptors; +using Grpc.Net.Client; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf.Grpc.Client; +using ServiceStack.Auth; +using ServiceStack.Text; +using ServiceStack.Validation; + +namespace ServiceStack.Extensions.Tests.Protoc +{ + public class ProtocAuthTests + { + public static readonly byte[] AuthKey = AesUtils.CreateKey(); + public const string Username = "mythz"; + public const string Password = "p@55word"; + + private static IManageApiKeys apiRepo; + private const string userId = "1"; + private static ApiKey liveKey; + private static ApiKey testKey; + + public class AppHost : AppSelfHostBase + { + public static ApiKey LastApiKey; + public AppHost() + : base(nameof(ProtocTests), typeof(MyServices).Assembly) { } + + public override void Configure(Container container) + { + RegisterService(); + Plugins.Add(new GrpcFeature(App) { + CreateDynamicService = GrpcConfig.AutoQueryOrDynamicAttribute // required by protoc AutoQuery Tests + }); + + Plugins.Add(new ValidationFeature()); + Plugins.Add(new AutoQueryFeature()); + + container.Register(new InMemoryAuthRepository()); + container.Resolve().InitSchema(); + + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] + { + new BasicAuthProvider(), + new CredentialsAuthProvider(), + new JwtAuthProvider + { + AuthKey = AuthKey, + RequireSecureConnection = false, + AllowInQueryString = true, + AllowInFormData = true, + IncludeJwtInConvertSessionToTokenResponse = true, + }, + new ApiKeyAuthProvider(AppSettings) { RequireSecureConnection = false }, + })); + + Plugins.Add(new RegistrationFeature()); + + GlobalRequestFilters.Add((req, res, dto) => + { + LastApiKey = req.GetApiKey(); + }); + + AfterInitCallbacks.Add(host => { + + var authRepo = GetAuthRepository(); + (authRepo as InMemoryAuthRepository)?.Clear(); + + authRepo.CreateUserAuth(new UserAuth + { + Id = userId.ToInt(), + UserName = Username, + FirstName = "First", + LastName = "Last", + DisplayName = "Display", + }, Password); + + apiRepo = (IManageApiKeys)container.Resolve(); + var apiKeyProvider = (ApiKeyAuthProvider)AuthenticateService.GetAuthProvider(ApiKeyAuthProvider.Name); + var apiKeys = apiKeyProvider.GenerateNewApiKeys(userId); + using (authRepo as IDisposable) + { + apiRepo.StoreAll(apiKeys); + } + liveKey = apiKeys.First(x => x.Environment == "live"); + testKey = apiKeys.First(x => x.Environment == "test"); + }); + + ScriptContext.AddRequiredConfig(); + } + + public override void Configure(IServiceCollection services) + { + services.AddServiceStackGrpc(); + } + + public override void Configure(IApplicationBuilder app) + { + app.UseRouting(); + } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; // use for tests + // listenOptions.Protocols = HttpProtocols.Http1AndHttp2; // use for UpdateProto + }); + } + } + + // [Test] public void TestProtoTypes() => TestsConfig.BaseUri.CombineWith("/types/proto").GetStringFromUrl().Print(); + // [Test] // needs: listenOptions.Protocols = HttpProtocols.Http1AndHttp2; + public void UpdateProto() + { + Directory.GetCurrentDirectory().Print(); + var protoc = TestsConfig.BaseUri.CombineWith("/types/proto").GetStringFromUrl(); + protoc = protoc.Replace("ServiceStack.Extensions.Tests","ServiceStack.Extensions.Tests.Protoc"); + + Directory.SetCurrentDirectory("../../../Protoc"); + File.WriteAllText("services.proto", protoc); + ExecUtils.ShellExec("x proto-csharp services.proto"); + } + + private readonly ServiceStackHost appHost; + public ProtocAuthTests() + { + appHost = new AppHost() + .Init() + .Start(TestsConfig.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + private static string CreateExpiredToken() + { + var jwtProvider = (JwtAuthProvider)AuthenticateService.GetAuthProvider(JwtAuthProviderReader.Name); + jwtProvider.CreatePayloadFilter = (jwtPayload, session) => + jwtPayload["exp"] = DateTime.UtcNow.AddSeconds(-1).ToUnixTime().ToString(); + + var token = jwtProvider.CreateJwtBearerToken(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }); + + jwtProvider.CreatePayloadFilter = null; + return token; + } + + private static GrpcServices.GrpcServicesClient GetClient(Action init = null) => + ProtocTests.GetClient(init); + + private async Task GetRefreshToken() + { + var authClient = GetClient(); + var response = await authClient.PostAuthenticateAsync(new Authenticate + { + Provider = "credentials", + UserName = Username, + Password = Password, + }); + return response.RefreshToken; + } + + protected virtual async Task GetClientWithRefreshToken(string refreshToken = null, string accessToken = null) + { + if (refreshToken == null) + { + refreshToken = await GetRefreshToken(); + } + + var client = GetClient(c => { + c.RefreshToken = refreshToken; + c.BearerToken = accessToken; + }); + return client; + } + + protected virtual GrpcServices.GrpcServicesClient GetClientWithBasicAuthCredentials() + { + var client = GetClient(c => { + c.UserName = Username; + c.Password = Password; + }); + return client; + } + + [Test] + public async Task Can_not_access_Secured_without_Auth() + { + var client = GetClient(); + + try + { + var request = new Secured { Name = "test" }; + var response = await client.PostSecuredAsync(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.Message.Print(); + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.Unauthorized))); + } + } + + [Test] + public async Task Can_access_Secured_using_BasicAuth() + { + var client = GetClientWithBasicAuthCredentials(); + + var request = new Secured { Name = "test" }; + + var response = await client.PostSecuredAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + + response = await client.PostSecuredAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + } + + [Test] + public async Task Can_ConvertSessionToToken() + { + var authClient = GetClient(); + var authResponse = await authClient.PostAuthenticateAsync(new Authenticate + { + Provider = "credentials", + UserName = Username, + Password = Password, + }); + Assert.That(authResponse.SessionId, Is.Not.Null); + Assert.That(authResponse.UserName, Is.EqualTo(Username)); + Assert.That(authResponse.BearerToken, Is.Not.Null); + + authClient = GetClient(c => c.SessionId = authResponse.SessionId); + + var response = await authClient.PostHelloJwtAsync(new HelloJwt { Name = "from auth service" }); + Assert.That(response.Result, Is.EqualTo("Hello, from auth service")); + + GrpcClientConfig config = null; + string bearerToken = null; + authClient = GetClient(c => { + bearerToken = authClient.PostConvertSessionToToken(new ConvertSessionToToken()).AccessToken; + (config = c).BearerToken = bearerToken; + }); + + Assert.That(bearerToken, Is.Not.Null); + + config.SessionId = null; + + response = await authClient.PostHelloJwtAsync(new HelloJwt { Name = "from auth service" }); + Assert.That(response.Result, Is.EqualTo("Hello, from auth service")); + } + + [Test] + public async Task Invalid_RefreshToken_throws_RefreshTokenException() + { + var client = await GetClientWithRefreshToken("Invalid.Refresh.Token"); + try + { + var request = new Secured { Name = "test" }; + var response = await client.PostSecuredAsync(request); + Assert.Fail("Should throw"); + } + catch (RefreshTokenException ex) + { + ex.Message.Print(); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + } + } + + [Test] + public async Task Can_Auto_reconnect_with_just_RefreshToken() + { + var client = await GetClientWithRefreshToken(); + + var request = new Secured { Name = "test" }; + var response = await client.PostSecuredAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + + response = await client.PostSecuredAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + } + + [Test] + public async Task Can_Auto_reconnect_with_RefreshToken_after_expired_token() + { + var client = await GetClientWithRefreshToken(await GetRefreshToken(), CreateExpiredToken()); + + var request = new Secured { Name = "test" }; + var response = await client.PostSecuredAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + + response = await client.PostSecuredAsync(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + } + + [Test] + public void Can_Auto_reconnect_with_RefreshToken_after_expired_token_Sync() + { + var client = GetClientWithRefreshToken(GetRefreshToken().Result, CreateExpiredToken()).Result; + + var request = new Secured { Name = "test" }; + var response = client.PostSecured(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + + response = client.PostSecured(request); + Assert.That(response.Result, Is.EqualTo("Hello, test")); + } + + [Test] + public async Task Does_return_token_on_subsequent_BasicAuth_Authentication_requests() + { + var client = GetClientWithBasicAuthCredentials(); + + var response = await client.PostAuthenticateAsync(new Authenticate()); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + + response = await client.PostAuthenticateAsync(new Authenticate()); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + } + + [Test] + public async Task Can_Authenticate_with_ApiKey() + { + AppHost.LastApiKey = null; + RequiresAuthService.LastApiKey = null; + + var client = GetClient(c => c.BearerToken = liveKey.Id); + + var request = new RequiresAuth { Name = "foo" }; + var response = await client.PostRequiresAuthAsync(request); + Assert.That(response.Name, Is.EqualTo(request.Name)); + + Assert.That(AppHost.LastApiKey.Id, Is.EqualTo(liveKey.Id)); + Assert.That(RequiresAuthService.LastApiKey.Id, Is.EqualTo(liveKey.Id)); + + client = GetClient(c => c.BearerToken = testKey.Id); + var testResponse = await client.PostSecuredAsync(new Secured { Name = "test" }); + Assert.That(testResponse.Result, Is.EqualTo("Hello, test")); + + Assert.That(AppHost.LastApiKey.Id, Is.EqualTo(testKey.Id)); + } + + [Test] + public async Task Does_allow_ApiKey_in_IHasBearerToken_RequestDto() + { + AppHost.LastApiKey = null; + RequiresAuthService.LastApiKey = null; + + var client = GetClient(); + + var request = new RequiresAuth { BearerToken = liveKey.Id, Name = "foo" }; + var response = await client.PostRequiresAuthAsync(request); + Assert.That(response.Name, Is.EqualTo(request.Name)); + + Assert.That(AppHost.LastApiKey.Id, Is.EqualTo(liveKey.Id)); + Assert.That(RequiresAuthService.LastApiKey.Id, Is.EqualTo(liveKey.Id)); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/Protoc/ProtocDynamicAutoQueryTests.cs b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocDynamicAutoQueryTests.cs new file mode 100644 index 00000000000..b38a6a36061 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocDynamicAutoQueryTests.cs @@ -0,0 +1,1231 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Logging; +using ServiceStack.Text; + +namespace ServiceStack.Extensions.Tests.Protoc +{ + public class ProtocDynamicAutoQueryTests + { + private readonly ServiceStackHost appHost; + public GrpcServices.GrpcServicesClient client; + + private static readonly int TotalRockstars = AutoQueryAppHost.SeedRockstars.Length; + private static readonly int TotalAlbums = AutoQueryAppHost.SeedAlbums.Length; + + public ProtocDynamicAutoQueryTests() + { + ConsoleLogFactory.Configure(); + appHost = new AutoQueryAppHost { + ConfigureGrpc = feature => feature.CreateDynamicService = GrpcConfig.AutoQueryOrDynamicAttribute + } + .Init() + .Start(TestsConfig.ListeningOn); + + client = ProtocTests.GetClient(); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + public List Rockstars => AutoQueryAppHost.SeedRockstars.Map(x => x.ConvertTo()); + + public List PagingTests => AutoQueryAppHost.SeedPagingTest.Map(x => x.ConvertTo()); + + [Test] + public async Task Can_execute_basic_query_dynamic() + { + var response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + {"Include", "Total"}, + } + }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + } + + [Test] + public async Task Can_execute_basic_query_NamedRockstar() + { + var response = await client.GetDynamicQueryNamedRockstarsAsync(new DynamicRequest { + Params = { + {"Include", "Total"}, + } + }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].LastName, Is.EqualTo("SQL Server")); + } + + [Test] + public async Task Can_execute_overridden_basic_query() + { + var response = await client.GetDynamicQueryOverridedRockstarsAsync(new DynamicRequest { + Params = { + {"Include", "Total"}, + } + }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + } + + [Test] + public async Task Can_execute_overridden_basic_query_with_case_insensitive_orderBy() + { + var response = await client.GetDynamicQueryCaseInsensitiveOrderByAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "OrderBy", "FirstName" }, + } + }); + + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_AdhocRockstars_query() + { + var response = await client.GetDynamicQueryAdhocRockstarsAsync(new DynamicRequest { + Params = { + { "FirstName", "Jimi" }, + { "Include", "Total" }, + } + }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Jimi")); + } + + [Test] + public async Task Can_execute_explicit_equality_condition_on_overridden_CustomRockstar() + { + var response = await client.GetDynamicQueryOverridedCustomRockstarsAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Include", "Total" }, + } + }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + } + + [Test] + public async Task Can_execute_basic_query_with_limits() + { + var response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Skip", "2" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Offset, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 2)); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Take", "2" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Skip", "2" }, + { "Take", "2" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Offset, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public async Task Can_execute_explicit_equality_condition() + { + var response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Include", "Total" }, + } + }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_explicit_equality_condition_implicitly() + { + var response = await client.GetDynamicQueryRockstarsImplicitAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Include", "Total" }, + } + }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_explicit_equality_condition_on_CustomRockstar() + { + var response = await client.GetDynamicQueryCustomRockstarsAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Include", "Total" }, + } + }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_explicit_equality_condition_on_CustomRockstarSchema() + { + var response = await client.GetDynamicQueryCustomRockstarsSchemaAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Include", "Total" }, + } + }); + + response.PrintDump(); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results[0].FirstName, Is.Not.Null); + Assert.That(response.Results[0].LastName, Is.Not.Null); + Assert.That(response.Results[0].Age, Is.EqualTo(27)); + } + + [Test] + public async Task Can_execute_query_with_JOIN_on_RockstarAlbums() + { + var response = await client.GetDynamicQueryJoinedRockstarAlbumsAsync(new DynamicRequest { + Params = { + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(TotalAlbums)); + Assert.That(response.Results.Count, Is.EqualTo(TotalAlbums)); + var albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York", "Foo Fighters", "Into the Wild", + })); + + response = await client.GetDynamicQueryJoinedRockstarAlbumsAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(6)); + Assert.That(response.Results.Count, Is.EqualTo(6)); + albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York", + })); + + response = await client.GetDynamicQueryJoinedRockstarAlbumsAsync(new DynamicRequest { + Params = { + { "RockstarAlbumName", "Nevermind" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { "Nevermind" })); + } + + [Test] + public async Task Can_execute_query_with_JOIN_on_RockstarAlbums_and_CustomSelectRockstar() + { + var response = await client.GetDynamicQueryJoinedRockstarAlbumsCustomSelectAsync(new DynamicRequest { + Params = { + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(TotalAlbums)); + Assert.That(response.Results.Count, Is.EqualTo(TotalAlbums)); + var ages = response.Results.Select(x => x.Age); + Assert.That(ages.Contains(27 * 2)); + + var customRes = await client.GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponseAsync(new DynamicRequest { + Params = { + { "Include", "Total" }, + } + }); + Assert.That(customRes.Total, Is.EqualTo(TotalAlbums)); + Assert.That(customRes.Results.Count, Is.EqualTo(TotalAlbums)); + ages = customRes.Results.Select(x => x.Age); + Assert.That(ages.Contains(27 * 2)); + } + + [Test] + public async Task Can_execute_query_with_multiple_JOINs_on_Rockstar_Albums_and_Genres() + { + var response = await client.GetDynamicQueryMultiJoinRockstarAsync(new DynamicRequest { + Params = { + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(TotalAlbums)); + Assert.That(response.Results.Count, Is.EqualTo(TotalAlbums)); + var albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York", "Foo Fighters", "Into the Wild", + })); + + var genreNames = response.Results.Select(x => x.RockstarGenreName).Distinct(); + Assert.That(genreNames, Is.EquivalentTo(new[] { + "Rock", "Grunge", "Alternative Rock", "Folk Rock" + })); + + response = await client.GetDynamicQueryMultiJoinRockstarAsync(new DynamicRequest { + Params = { + { "RockstarAlbumName", "Nevermind" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { "Nevermind" })); + + response = await client.GetDynamicQueryMultiJoinRockstarAsync(new DynamicRequest { + Params = { + { "RockstarGenreName", "Folk Rock" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + albumNames = response.Results.Select(x => x.RockstarGenreName); + Assert.That(albumNames, Is.EquivalentTo(new[] { "Folk Rock" })); + } + + [Test] + public async Task Can_execute_query_with_LEFTJOIN_on_RockstarAlbums() + { + var response = await client.GetDynamicQueryRockstarAlbumsLeftJoinAsync(new DynamicRequest { + Params = { + { "IdNotEqualTo", "3" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(TotalRockstars - 1)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 1)); + var albumNames = response.Results.Where(x => !x.RockstarAlbumName.IsEmpty()).Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Foo Fighters", "Into the Wild" + })); + } + + [Test] + public async Task Can_execute_query_with_custom_LEFTJOIN_on_RockstarAlbums() + { + var response = await client.GetDynamicQueryRockstarAlbumsCustomLeftJoinAsync(new DynamicRequest { + Params = { + { "IdNotEqualTo", "3" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(TotalRockstars - 1)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 1)); + var albumNames = response.Results.Where(x => !x.RockstarAlbumName.IsEmpty()).Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Foo Fighters", "Into the Wild" + })); + } + + [Test] + public async Task Can_execute_custom_QueryFields() + { + var response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "FirstName", "Jim" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "FirstNames", "Jim,Kurt" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "FirstNameCaseInsensitive", "Jim" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "FirstNameStartsWith", "Jim" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "LastNameEndsWith", "son" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "FirstNameBetween", "A,F" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "LastNameEndsWith", "son" }, + { "OrLastName", "Hendrix" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "FirstNameStartsWith", "Jim" }, + { "OrLastName", "Presley" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "Age", "42" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + } + + [Test] + public async Task Can_execute_combination_of_QueryFields() + { + var response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "FirstNameStartsWith", "Jim" }, + { "LastNameEndsWith", "son" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "FirstNameStartsWith", "Jim" }, + { "OrLastName", "Cobain" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Does_escape_values() + { + var response = await client.GetDynamicQueryFieldRockstarsAsync(new DynamicRequest { + Params = { + { "FirstNameStartsWith", "Jim'\"" }, + } + }); + Assert.That(response.Results?.Count ?? 0, Is.EqualTo(0)); + } + + [Test] + public async Task Does_use_custom_model_to_select_columns() + { + var response = await client.GetDynamicQueryRockstarAliasAsync(new DynamicRequest { + Params = { + { "RockstarAlbumName", "Nevermind" }, + { "OrLastName", "Cobain" }, + } + }); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].RockstarId, Is.EqualTo(3)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Kurt")); + Assert.That(response.Results[0].Album, Is.EqualTo("Nevermind")); + } + + // [Test] + // public async Task Does_allow_adding_attributes_dynamically() + // { + // typeof(QueryFieldRockstarsDynamic) + // .GetProperty("Age") + // .AddAttributes(new QueryDbFieldAttribute { Operand = ">=" }); + // + // var response = await client.GetDynamicQueryFieldRockstarsDynamicAsync(new DynamicRequest { + // Params = { + // { "Age", "42" }, + // } + // }); + // Assert.That(response.Results.Count, Is.EqualTo(4)); + // } + + [Test] + public async Task Does_execute_typed_QueryFilters() + { + // QueryFilter appends additional: x => x.LastName.EndsWith("son") + var response = await client.GetDynamicQueryRockstarsFilterAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + var custom = await client.GetDynamicQueryCustomRockstarsFilterAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + } + }); + Assert.That(custom.Results.Count, Is.EqualTo(1)); + + response = await client.GetDynamicQueryRockstarsIFilterAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + } + + [Test] + public async Task Can_execute_OR_QueryFilters() + { + var response = await client.GetDynamicQueryOrRockstarsAsync(new DynamicRequest { + Params = { + { "Age", "42" }, + { "FirstName", "Jim" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public async Task Does_retain_implicit_convention_when_not_overriding_template_or_ValueFormat() + { + var response = await client.GetDynamicQueryFieldsImplicitConventionsAsync(new DynamicRequest { + Params = { + { "FirstNameContains", "im" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetDynamicQueryFieldsImplicitConventionsAsync(new DynamicRequest { + Params = { + { "LastNameEndsWith", "son" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public async Task Can_execute_OR_QueryFilters_Fields() + { + var response = await client.GetDynamicQueryOrRockstarsFieldsAsync(new DynamicRequest { + Params = { + { "FirstName", "Jim" }, + { "LastName", "Vedder" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public async Task Can_execute_Explicit_conventions() + { + var response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "Ids", "1,2,3" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "AgeOlderThan", "42" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "AgeGreaterThanOrEqualTo", "42" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + + response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "AgeGreaterThan", "42" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "GreaterThanAge", "42" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "FirstNameStartsWith", "Jim" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "LastNameEndsWith", "son" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "LastNameContains", "e" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "DateOfBirthGreaterThan", "1960-01-01" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = await client.GetDynamicQueryRockstarsConventionsAsync(new DynamicRequest { + Params = { + { "DateDiedLessThan", "1980-01-01" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Can_execute_In_OR_Queries() + { + var response = await client.GetDynamicQueryGetRockstarsAsync(new DynamicRequest()); + Assert.That(response.Results?.Count ?? 0, Is.EqualTo(0)); + + response = await client.GetDynamicQueryGetRockstarsAsync(new DynamicRequest { + Params = { + { "Ids", "1,2,3" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = await client.GetDynamicQueryGetRockstarsAsync(new DynamicRequest { + Params = { + { "Ages", "42,44" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetDynamicQueryGetRockstarsAsync(new DynamicRequest { + Params = { + { "FirstNames", "Jim,Kurt" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = await client.GetDynamicQueryGetRockstarsAsync(new DynamicRequest { + Params = { + { "IdsBetween", "1,3" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public async Task Does_ignore_empty_collection_filters_by_default() + { + var response = await client.GetDynamicQueryRockstarFiltersAsync(new DynamicRequest()); + Assert.That(response.Results.Count, Is.EqualTo(AutoQueryAppHost.SeedRockstars.Length)); + + response = await client.GetDynamicQueryRockstarFiltersAsync(new DynamicRequest + { + Params = { + { "Ids", "[]" }, + { "Ages", "[]" }, + { "FirstNames", "[]" }, + { "IdsBetween", "[]" }, + }, + }); + Assert.That(response.Results.Count, Is.EqualTo(AutoQueryAppHost.SeedRockstars.Length)); + } + + [Test] + public async Task Can_query_Movie_Ratings() + { + var response = await client.GetDynamicQueryMoviesAsync(new DynamicRequest { + Params = { + { "Ratings", "G,PG-13" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(5)); + + response = await client.GetDynamicQueryMoviesAsync(new DynamicRequest { + Params = { + { "Ids", "1,2" }, + { "ImdbIds", "tt0071562,tt0060196" }, + { "Ratings", "G,PG-13" }, + }, + }); + Assert.That(response.Results.Count, Is.EqualTo(9)); + } + + [Test] + public async Task Does_implicitly_OrderBy_PrimaryKey_when_limits_is_specified() + { + var movies = await client.GetDynamicSearchMoviesAsync(new DynamicRequest { + Params = { + { "Take", "100" }, + } + }); + var ids = movies.Results.Map(x => x.Id); + var orderedIds = ids.OrderBy(x => x); + Assert.That(ids, Is.EqualTo(orderedIds)); + + var rockstars = await client.GetDynamicSearchMoviesAsync(new DynamicRequest { + Params = { + { "Take", "100" }, + } + }); + ids = rockstars.Results.Map(x => x.Id); + orderedIds = ids.OrderBy(x => x); + Assert.That(ids, Is.EqualTo(orderedIds)); + } + + [Test] + public async Task Can_OrderBy_queries() + { + var movies = await client.GetDynamicSearchMoviesAsync(new DynamicRequest { + Params = { + { "Take", "100" }, + { "OrderBy", "ImdbId" }, + } + }); + var ids = movies.Results.Map(x => x.ImdbId); + var orderedIds = ids.OrderBy(x => x).ToList(); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetDynamicSearchMoviesAsync(new DynamicRequest { + Params = { + { "Take", "100" }, + { "OrderBy", "Rating,ImdbId" }, + } + }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating).ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetDynamicSearchMoviesAsync(new DynamicRequest { + Params = { + { "Take", "100" }, + { "OrderByDesc", "ImdbId" }, + } + }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = ids.OrderByDescending(x => x).ToList(); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetDynamicSearchMoviesAsync(new DynamicRequest { + Params = { + { "Take", "100" }, + { "OrderByDesc", "Rating,ImdbId" }, + } + }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetDynamicSearchMoviesAsync(new DynamicRequest { + Params = { + { "Take", "100" }, + { "OrderBy", "Rating,-ImdbId" }, + } + }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = await client.GetDynamicSearchMoviesAsync(new DynamicRequest { + Params = { + { "Take", "100" }, + { "OrderByDesc", "Rating,-ImdbId" }, + } + }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + } + + [Test] + public async Task Does_not_query_Ignored_properties() + { + var response = await client.GetDynamicQueryUnknownRockstarsAsync(new DynamicRequest { + Params = { + { "UnknownProperty", "Foo" }, + { "UnknownInt", "1" }, + { "Include", "Total" }, + } + }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + } + + [Test] + public async Task Can_Query_Rockstars_with_References() + { + var response = await client.GetDynamicQueryRockstarsWithReferencesAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + } + }); + + Assert.That(response.Results.Count, Is.EqualTo(3)); + + var jimi = response.Results.First(x => x.FirstName == "Jimi"); + Assert.That(jimi.Albums.Count, Is.EqualTo(1)); + Assert.That(jimi.Albums[0].Name, Is.EqualTo("Electric Ladyland")); + + var jim = response.Results.First(x => x.FirstName == "Jim"); + Assert.That(jim.Albums.Count, Is.EqualTo(0)); + + var kurt = response.Results.First(x => x.FirstName == "Kurt"); + Assert.That(kurt.Albums.Count, Is.EqualTo(5)); + + response = await client.GetDynamicQueryRockstarsWithReferencesAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Fields", "Id,FirstName,Age" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results.All(x => x.Id > 0)); + Assert.That(response.Results.All(x => x.LastName.IsEmpty())); + Assert.That(response.Results.All(x => x.Albums.Count == 0)); + + response = await client.GetDynamicQueryRockstarsWithReferencesAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Fields", "Id,FirstName,Age,Albums" }, + } + }); + Assert.That(response.Results.Where(x => x.FirstName != "Jim").All(x => x.Albums.Count > 0)); + } + + [Test] + public async Task Can_Query_RockstarReference_without_References() + { + var response = await client.GetDynamicQueryCustomRockstarsReferencesAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results.All(x => x.Albums.Count == 0)); + } + + [Test] + public async Task Can_Query_AllFields_Guid() + { + var guid = new Guid("3EE6865A-4149-4940-B7A2-F952E0FEFC5E"); + var response = await client.GetDynamicQueryAllFieldsAsync(new DynamicRequest { + Params = { + { "Guid", "3EE6865A-4149-4940-B7A2-F952E0FEFC5E" }, + } + }); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + + // Assert.That(ProtocTests.ToGuid(response.Results[0].Guid), Is.EqualTo(guid)); + Assert.That(response.Results[0].Guid, Is.EqualTo(guid.ToString())); + } + + [Test] + public async Task Does_populate_Total() + { + var response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta.Count, Is.EqualTo(0)); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "COUNT" }, + } + }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "COUNT(*)" }, + } + }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "COUNT(DISTINCT LivingStatus), Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "Count(*), Min(Age), Max(Age), Sum(Id)" }, + } + }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Include", "Count(*), Min(Age), Max(Age), Sum(Id)" }, + } + }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count(x => x.Age == 27))); + } + + [Test] + public async Task Can_Include_Aggregates_in_AutoQuery() + { + var response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "COUNT" }, + } + }); + Assert.That(response.Meta["COUNT(*)"], Is.EqualTo(Rockstars.Count.ToString())); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "COUNT(*)" }, + } + }); + Assert.That(response.Meta["COUNT(*)"], Is.EqualTo(Rockstars.Count.ToString())); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "COUNT(DISTINCT LivingStatus)" }, + } + }); + Assert.That(response.Meta["COUNT(DISTINCT LivingStatus)"], Is.EqualTo("2")); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "MIN(Age)" }, + } + }); + Assert.That(response.Meta["MIN(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "Count(*), Min(Age), Max(Age), Sum(Id), Avg(Age)" }, + { "OrderBy", "Id" }, + } + }); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(Rockstars.Count.ToString())); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Max(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["Sum(Id)"], Is.EqualTo(Rockstars.Map(x => x.Id).Sum().ToString())); + Assert.That(double.Parse(response.Meta["Avg(Age)"]), Is.EqualTo(Rockstars.Average(x => x.Age)).Within(1d)); + //Not supported by Sqlite + //Assert.That(response.Meta["First(Id)"], Is.EqualTo(Rockstars.First().Id.ToString())); + //Assert.That(response.Meta["Last(Id)"], Is.EqualTo(Rockstars.Last().Id.ToString())); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Age", "27" }, + { "Include", "Count(*), Min(Age), Max(Age), Sum(Id), Avg(Age)" }, + { "OrderBy", "Id" }, + } + }); + var rockstars27 = Rockstars.Where(x => x.Age == 27).ToList(); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(rockstars27.Count.ToString())); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(rockstars27.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Max(Age)"], Is.EqualTo(rockstars27.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["Sum(Id)"], Is.EqualTo(rockstars27.Map(x => x.Id).Sum().ToString())); + Assert.That(double.Parse(response.Meta["Avg(Age)"]), Is.EqualTo(rockstars27.Average(x => x.Age)).Within(1d)); + //Not supported by Sqlite + //Assert.That(response.Meta["First(Id)"], Is.EqualTo(rockstars27.First().Id.ToString())); + //Assert.That(response.Meta["Last(Id)"], Is.EqualTo(rockstars27.Last().Id.ToString())); + } + + [Test] + public async Task Does_ignore_unknown_aggregate_commands() + { + var response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "FOO(1), Total" }, + } + }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta.Count, Is.EqualTo(0)); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "FOO(1), Min(Age), Bar('a') alias, Count(*), Baz(1,'foo')" }, + } + }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(Rockstars.Count.ToString())); + } + + [Test] + public async Task Can_Include_Aggregates_in_AutoQuery_with_Aliases() + { + var response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "COUNT(*) count" }, + } + }); + Assert.That(response.Meta["count"], Is.EqualTo(Rockstars.Count.ToString())); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "COUNT(DISTINCT LivingStatus) as uniquestatus" }, + } + }); + Assert.That(response.Meta["uniquestatus"], Is.EqualTo("2")); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "MIN(Age) minage" }, + } + }); + Assert.That(response.Meta["minage"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + + response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "Count(*) count, Min(Age) min, Max(Age) max, Sum(Id) sum" }, + } + }); + Assert.That(response.Meta["count"], Is.EqualTo(Rockstars.Count.ToString())); + Assert.That(response.Meta["min"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["max"], Is.EqualTo(Rockstars.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["sum"], Is.EqualTo(Rockstars.Map(x => x.Id).Sum().ToString())); + } + + [Test] + public async Task Can_execute_custom_aggregate_functions() + { + var response = await client.GetDynamicQueryRockstarsAsync(new DynamicRequest { + Params = { + { "Include", "ADD(6,2), Multiply(6,2) SixTimesTwo, Subtract(6,2), divide(6,2) TheDivide" }, + } + }); + Assert.That(response.Meta["ADD(6,2)"], Is.EqualTo("8")); + Assert.That(response.Meta["SixTimesTwo"], Is.EqualTo("12")); + Assert.That(response.Meta["Subtract(6,2)"], Is.EqualTo("4")); + Assert.That(response.Meta["TheDivide"], Is.EqualTo("3")); + } + + [Test] + public async Task Sending_empty_ChangeDb_returns_default_info() + { + var response = await client.GetChangeDbAsync(new ChangeDb()); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + + var aqResponse = await client.GetDynamicQueryChangeDbAsync(new DynamicRequest()); + Assert.That(aqResponse.Results.Count, Is.EqualTo(TotalRockstars)); + } + + [Test] + public async Task Can_ChangeDb_with_Named_Connection() + { + var response = await client.GetChangeDbAsync(new ChangeDb { NamedConnection = AutoQueryAppHost.SqlServerNamedConnection }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Microsoft")); + + var aqResponse = await client.GetDynamicQueryChangeDbAsync(new DynamicRequest { + Params = { + { "NamedConnection", AutoQueryAppHost.SqlServerNamedConnection }, + } + }); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Microsoft")); + } + + [Test] + public async Task Can_ChangeDb_with_ConnectionString() + { + var response = await client.GetChangeDbAsync(new ChangeDb { ConnectionString = AutoQueryAppHost.SqliteFileConnString }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Sqlite")); + + var aqResponse = await client.GetDynamicQueryChangeDbAsync(new DynamicRequest { + Params = { + { "ConnectionString", AutoQueryAppHost.SqliteFileConnString }, + } + }); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Sqlite")); + } + + [Test] + public async Task Can_ChangeDb_with_ConnectionString_and_Provider() + { + var response = await client.GetChangeDbAsync(new ChangeDb + { + ConnectionString = AutoQueryAppHost.SqlServerConnString, + ProviderName = AutoQueryAppHost.SqlServerProvider, + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Microsoft")); + + var aqResponse = await client.GetDynamicQueryChangeDbAsync(new DynamicRequest { + Params = { + { "ConnectionString", AutoQueryAppHost.SqlServerConnString }, + { "ProviderName", AutoQueryAppHost.SqlServerProvider }, + } + }); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Microsoft")); + } + + [Test] + public async Task Can_Change_Named_Connection_with_ConnectionInfoAttribute() + { + var response = await client.GetChangeConnectionInfoAsync(new ChangeConnectionInfo()); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Microsoft")); + + var aqResponse = await client.GetDynamicQueryChangeConnectionInfoAsync(new DynamicRequest()); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Microsoft")); + } + + [Test] + public async Task Does_return_MaxLimit_results() + { + var response = await client.GetDynamicQueryPagingTestAsync(new DynamicRequest { + Params = { + { "Include", "Total" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(100)); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count)); + + response = await client.GetDynamicQueryPagingTestAsync(new DynamicRequest { + Params = { + { "Skip", "200" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(PagingTests.Skip(200).Count())); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count)); + + response = await client.GetDynamicQueryPagingTestAsync(new DynamicRequest { + Params = { + { "Value", "1" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(100)); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count(x => x.Value == 1))); + } + + [Test] + public async Task Can_query_on_ForeignKey_and_Index() + { + var response = await client.GetDynamicQueryRockstarAlbumsAsync(new DynamicRequest { + Params = { + { "RockstarId", "3" }, + { "Include", "Total" }, + } + }); //Hash + Assert.That(response.Results.Count, Is.EqualTo(5)); + Assert.That(response.Total, Is.EqualTo(5)); + + response = await client.GetDynamicQueryRockstarAlbumsAsync(new DynamicRequest { + Params = { + { "RockstarId", "3" }, + { "Id", "3" }, + { "Include", "Total" }, + } + }); //Hash + Range + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Name, Is.EqualTo("Nevermind")); + + //Hash + Range BETWEEN + response = await client.GetDynamicQueryRockstarAlbumsAsync(new DynamicRequest { + Params = { + { "RockstarId", "3" }, + { "IdBetween", "2,3" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(2)); + + //Hash + Range BETWEEN + Filter + response = await client.GetDynamicQueryRockstarAlbumsAsync(new DynamicRequest { + Params = { + { "RockstarId", "3" }, + { "IdBetween", "2,3" }, + { "Name", "Nevermind" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Id, Is.EqualTo(3)); + + //Hash + LocalSecondaryIndex + response = await client.GetDynamicQueryRockstarAlbumsAsync(new DynamicRequest { + Params = { + { "RockstarId", "3" }, + { "Genre", "Grunge" }, + { "Include", "Total" }, + } + }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + Assert.That(response.Total, Is.EqualTo(4)); + + response.PrintDump(); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/Protoc/ProtocServerEventsTests.cs b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocServerEventsTests.cs new file mode 100644 index 00000000000..cc992717f35 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocServerEventsTests.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf.Grpc.Client; +using ServiceStack.Text; + +namespace ServiceStack.Extensions.Tests.Protoc +{ + public class ProtocServerEventsTests + { + public class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(GrpcServerEventsTests), typeof(MyServices).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new GrpcFeature(App)); + Plugins.Add(new ServerEventsFeature()); + } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => { + listenOptions.Protocols = HttpProtocols.Http2; + }); + } + + public override void Configure(IServiceCollection services) => services.AddServiceStackGrpc(); + + public override void Configure(IApplicationBuilder app) => app.UseRouting(); + } + + private readonly ServiceStackHost appHost; + public ProtocServerEventsTests() + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + appHost = new AppHost() + .Init() + .Start(TestsConfig.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + private static GrpcServices.GrpcServicesClient GetClient(Action init = null) => + ProtocTests.GetClient(init); + + [Test] + public async Task Can_subscribe_to_ServerEvents() + { + var client = GetClient(); + + void AssertMessage(StreamServerEventsResponse msg) + { + Assert.That(msg.EventId, Is.GreaterThan(0)); + Assert.That(msg.Channels, Is.EqualTo(new[] { "home" })); + Assert.That(msg.Json, Is.Not.Null); + Assert.That(msg.Op, Is.EqualTo("cmd")); + Assert.That(msg.UserId, Is.EqualTo("-1")); + Assert.That(msg.DisplayName, Is.Not.Null); + Assert.That(msg.ProfileUrl, Is.Not.Null); + Assert.That(msg.IsAuthenticated, Is.False); + } + + var i = 0; + var stream = client.ServerStreamServerEvents(new StreamServerEvents { Channels = {"home"} }).ResponseStream; + while (await stream.MoveNext(default)) + { + var msg = stream.Current; + if (i == 0) + { + Assert.That(msg.Selector, Is.EqualTo("cmd.onConnect")); + Assert.That(msg.Id, Is.Not.Null); + Assert.That(msg.UnRegisterUrl, Is.Not.Null); + Assert.That(msg.UpdateSubscriberUrl, Is.Not.Null); + Assert.That(msg.HeartbeatUrl, Is.Not.Null); + Assert.That(msg.HeartbeatIntervalMs, Is.GreaterThan(0)); + Assert.That(msg.IdleTimeoutMs, Is.GreaterThan(0)); + AssertMessage(msg); + } + else if (i == 1) + { + Assert.That(msg.Selector, Is.EqualTo("cmd.onJoin")); + AssertMessage(msg); + } + + $"\n\n{i}".Print(); + msg.PrintDump(); + + if (++i == 2) + break; + } + Assert.That(i, Is.EqualTo(2)); + } + + [Test] + public async Task Does_receive_all_messages() + { + var client1 = GetClient(); + var client2 = GetClient(); + + Task.Factory.StartNew(async () => { + await Task.Delay(500); + await client2.CallPostChatToChannelAsync(new PostChatToChannel { + Channel = "send", + From = nameof(client2), + Message = "Hello from client2", + Selector = "cmd.chat", + }); + }); + + var responses = new List(); + var stream = client1.ServerStreamServerEvents(new StreamServerEvents { Channels = {"send"} }).ResponseStream; + while (await stream.MoveNext(default)) + { + var msg = stream.Current; + responses.Add(msg); + + if (msg.Selector == "cmd.chat") + break; + } + + Assert.That(responses[0].Selector, Is.EqualTo("cmd.onConnect")); + Assert.That(responses[1].Selector, Is.EqualTo("cmd.onJoin")); + Assert.That(responses[2].Selector, Is.EqualTo("cmd.chat")); + var obj = (Dictionary) JSON.parse(responses[2].Json); + Assert.That(obj["message"], Is.EqualTo("Hello from client2")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/Protoc/ProtocTests.cs b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocTests.cs new file mode 100644 index 00000000000..1683c167f4d --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocTests.cs @@ -0,0 +1,429 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf.Grpc.Client; +using ServiceStack.Text; +using ServiceStack.Validation; + +namespace ServiceStack.Extensions.Tests.Protoc +{ + public class ProtocTests + { + public class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ProtocTests), typeof(MyServices).Assembly) { } + + public override void Configure(Container container) + { + RegisterService(); + + Plugins.Add(new ValidationFeature()); + Plugins.Add(new GrpcFeature(App)); + + GlobalRequestFilters.Add((req, res, dto) => { + if (dto is ServiceStack.Extensions.Tests.ThrowCustom) + throw new CustomException(); + }); + } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; + }); + } + + public override void Configure(IServiceCollection services) + { + services.AddServiceStackGrpc(); + } + + public override void Configure(IApplicationBuilder app) + { + app.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapGrpcService(); + }); + } + } + + private readonly ServiceStackHost appHost; + public ProtocTests() + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + appHost = new AppHost() + .Init() + .Start(TestsConfig.BaseUri); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + + public static GrpcServices.GrpcServicesClient GetClient(Action init=null) + { + GrpcClientFactory.AllowUnencryptedHttp2 = true; + GrpcServiceStack.ParseResponseStatus = bytes => ResponseStatus.Parser.ParseFrom(bytes); + + var config = new GrpcClientConfig(); + init?.Invoke(config); + var client = new GrpcServices.GrpcServicesClient( + GrpcServiceStack.Client(TestsConfig.BaseUri, config)); + return client; + } + + [Test] + public async Task Can_call_Multiply_Grpc_Service_GrpcServiceClient() + { + var client = GetClient(); + + var response = await client.PostMultiplyAsync(new Multiply { X = 12, Y = 4 }); + Assert.That(response.Result, Is.EqualTo(48)); + } + + [Test] + public void Can_call_Multiply_Grpc_Service_GrpcServiceClient_sync() + { + var client = GetClient(); + + var response = client.PostMultiply(new Multiply { X = 12, Y = 4 }); + Assert.That(response.Result, Is.EqualTo(48)); + } + + [Test] + public async Task Can_call_Incr_ReturnVoid_GrpcServiceClient() + { + var client = GetClient(); + + ServiceStack.Extensions.Tests.Incr.Counter = 0; + + await client.PostIncrAsync(new Incr { Amount = 1 }); + Assert.That(ServiceStack.Extensions.Tests.Incr.Counter, Is.EqualTo(1)); + + await client.PostIncrAsync(new Incr { Amount = 2 }); + Assert.That(ServiceStack.Extensions.Tests.Incr.Counter, Is.EqualTo(3)); + } + + [Test] + public async Task Can_call_GetHello_with_Get() + { + var client = GetClient(); + + var response = await client.CallGetHelloAsync(new GetHello { Name = "GET" }); + Assert.That(response.Result, Is.EqualTo($"Hello, GET!")); + } + + [Test] + public void Can_call_GetHello_with_Get_sync() + { + var client = GetClient(); + + var response = client.CallGetHello(new GetHello { Name = "GET" }); + Assert.That(response.Result, Is.EqualTo($"Hello, GET!")); + } + + [Test] + public async Task Can_call_AnyHello_with_Get_Post_or_Send() + { + var client = GetClient(); + + var response = await client.GetAnyHelloAsync(new AnyHello { Name = "GET" }); + Assert.That(response.Result, Is.EqualTo($"Hello, GET!")); + + response = await client.PostAnyHelloAsync(new AnyHello { Name = "POST" }); + Assert.That(response.Result, Is.EqualTo($"Hello, POST!")); + } + + [Test] + public void Can_call_AnyHello_with_Get_Post_or_Send_sync() + { + var client = GetClient(); + + var response = client.GetAnyHello(new AnyHello { Name = "GET" }); + Assert.That(response.Result, Is.EqualTo($"Hello, GET!")); + + response = client.PostAnyHello(new AnyHello { Name = "POST" }); + Assert.That(response.Result, Is.EqualTo($"Hello, POST!")); + } + + [Test] + public async Task Does_throw_WebServiceException() + { + var client = GetClient(); + + try + { + await client.GetThrowAsync(new Throw { Message = "throw test" }); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(500)); + Assert.That(e.Message, Is.EqualTo("throw test")); + } + } + + [Test] + public void Does_throw_WebServiceException_sync() + { + var client = GetClient(); + + try + { + client.GetThrow(new Throw { Message = "throw test" }); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(500)); + Assert.That(e.Message, Is.EqualTo("throw test")); + } + } + + [Test] + public async Task Does_throw_WebServiceException_ReturnVoid() + { + var client = GetClient(); + + try + { + await client.GetThrowVoidAsync(new ThrowVoid { Message = "throw test" }); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(500)); + Assert.That(e.Message, Is.EqualTo("throw test")); + } + } + + [Test] + public void Does_throw_WebServiceException_ReturnVoid_sync() + { + var client = GetClient(); + + try + { + client.GetThrowVoid(new ThrowVoid { Message = "throw test" }); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(500)); + Assert.That(e.Message, Is.EqualTo("throw test")); + } + } + + public static ProtoBuf.Bcl.Decimal ToProtoBufDecimal(decimal value) + { + // https://github.com/protobuf-net/protobuf-net/blob/master/src/protobuf-net.Core/Internal/PrimaryTypeProvider.Decimal.cs + var to = new ProtoBuf.Bcl.Decimal(); + int[] bits = decimal.GetBits(value); + ulong a = ((ulong) bits[1]) << 32, b = ((ulong) bits[0]) & 0xFFFFFFFFL; + to.Lo = a | b; + to.Hi = (uint) bits[2]; + to.SignScale = (uint) (((bits[3] >> 15) & 0x01FE) | ((bits[3] >> 31) & 0x0001)); + return to; + } + + public static Guid ToGuid(ProtoBuf.Bcl.Guid value) + { + // https://github.com/protobuf-net/protobuf-net/blob/master/src/protobuf-net.Core/Internal/PrimaryTypeProvider.Guid.cs + var low = value.Lo; + var high = value.Hi; + uint a = (uint)(low >> 32), b = (uint)low, c = (uint)(high >> 32), d = (uint)high; + return new Guid((int)b, (short)a, (short)(a >> 16), + (byte)d, (byte)(d >> 8), (byte)(d >> 16), (byte)(d >> 24), + (byte)c, (byte)(c >> 8), (byte)(c >> 16), (byte)(c >> 24)); + } + + [Test] + public async Task Triggering_all_validators_returns_right_ErrorCode() + { + var client = GetClient(); + + var request = new TriggerValidators + { + CreditCard = "NotCreditCard", + Email = "NotEmail", + Empty = "NotEmpty", + Equal = "NotEqual", + ExclusiveBetween = 1, + GreaterThan = 1, + GreaterThanOrEqual = 1, + InclusiveBetween = 1, + Length = "Length", + LessThan = 20, + LessThanOrEqual = 20, + NotEmpty = "", + NotEqual = "NotEqual", + Null = "NotNull", + RegularExpression = "FOO", + ScalePrecision = 123.456m.ToString(CultureInfo.InvariantCulture) + }; + + try + { + var response = await client.PostTriggerValidatorsAsync(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + //ex.ResponseStatus.PrintDump(); + AssertTriggerValidatorsResponse(ex); + } + } + + [Test] + public async Task Triggering_all_validators_returns_right_ErrorCode_from_Headers() + { + var client = GetClient(); + + try + { + var response = await client.PostTriggerValidatorsAsync(new TriggerValidators(), + GrpcUtils.ToHeaders(new { + CreditCard = "NotCreditCard", + Email = "NotEmail", + Empty = "NotEmpty", + Equal = "NotEqual", + ExclusiveBetween = 1, + GreaterThan = 1, + GreaterThanOrEqual = 1, + InclusiveBetween = 1, + Length = "Length", + LessThan = 20, + LessThanOrEqual = 20, + NotEmpty = "", + NotEqual = "NotEqual", + Null = "NotNull", + RegularExpression = "FOO", + ScalePrecision = 123.456m + })); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + //ex.ResponseStatus.PrintDump(); + AssertTriggerValidatorsResponse(ex); + } + } + + private static void AssertTriggerValidatorsResponse(WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + var errors = ex.ResponseStatus.Errors; + Assert.That(errors.First(x => x.FieldName == "CreditCard").ErrorCode, Is.EqualTo("CreditCard")); + Assert.That(errors.First(x => x.FieldName == "Email").ErrorCode, Is.EqualTo("Email")); + Assert.That(errors.First(x => x.FieldName == "Email").ErrorCode, Is.EqualTo("Email")); + Assert.That(errors.First(x => x.FieldName == "Empty").ErrorCode, Is.EqualTo("Empty")); + Assert.That(errors.First(x => x.FieldName == "Equal").ErrorCode, Is.EqualTo("Equal")); + Assert.That(errors.First(x => x.FieldName == "ExclusiveBetween").ErrorCode, Is.EqualTo("ExclusiveBetween")); + Assert.That(errors.First(x => x.FieldName == "GreaterThan").ErrorCode, Is.EqualTo("GreaterThan")); + Assert.That(errors.First(x => x.FieldName == "GreaterThanOrEqual").ErrorCode, Is.EqualTo("GreaterThanOrEqual")); + Assert.That(errors.First(x => x.FieldName == "InclusiveBetween").ErrorCode, Is.EqualTo("InclusiveBetween")); + Assert.That(errors.First(x => x.FieldName == "Length").ErrorCode, Is.EqualTo("Length")); + Assert.That(errors.First(x => x.FieldName == "LessThan").ErrorCode, Is.EqualTo("LessThan")); + Assert.That(errors.First(x => x.FieldName == "LessThanOrEqual").ErrorCode, Is.EqualTo("LessThanOrEqual")); + Assert.That(errors.First(x => x.FieldName == "NotEmpty").ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(errors.First(x => x.FieldName == "NotEqual").ErrorCode, Is.EqualTo("NotEqual")); + Assert.That(errors.First(x => x.FieldName == "Null").ErrorCode, Is.EqualTo("Null")); + Assert.That(errors.First(x => x.FieldName == "RegularExpression").ErrorCode, Is.EqualTo("RegularExpression")); + Assert.That(errors.First(x => x.FieldName == "ScalePrecision").ErrorCode, Is.EqualTo("ScalePrecision")); + } + + [Test] + public async Task Does_throw_WebServiceException_on_CustomException() + { + var client = GetClient(); + + try + { + await client.GetThrowCustomAsync(new ThrowCustom()); + Assert.Fail("should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(401)); + Assert.That(e.Message, Is.EqualTo("Custom Error Message")); + } + } + + [Test] + public async Task Does_return_Custom_Headers() + { + string customHeader = null; + var client = GetClient(c => { + c.ResponseFilter = ctx => customHeader = ctx.GetHeader("X-Custom"); + }); + + await client.GetAddHeaderAsync(new AddHeader { Name = "X-Custom", Value = "A" }); + Assert.That(customHeader, Is.EqualTo("A")); + } + + [Test] + public async Task Can_download_file() + { + var client = GetClient(); + var response = await client.CallGetFileAsync(new GetFile { Path = "/js/ss-utils.js" }); + AssertSSUtils(response); + } + + private static void AssertSSUtils(FileContent response) + { + Assert.That(response.Name, Is.EqualTo("ss-utils.js")); + Assert.That(response.Length, Is.GreaterThan(0)); + Assert.That(response.Length, Is.EqualTo(response.Body.Length)); + var str = response.Body.Span.FromUtf8Bytes(); + Assert.That(str, Does.Contain("if (!$.ss) $.ss = {};")); + } + + private static void AssertFiles(List responses) + { + Assert.That(responses.Count, Is.EqualTo(3)); + AssertSSUtils(responses[0]); + Assert.That(responses[1].Name, Is.EqualTo("hot-loader.js")); + Assert.That(responses[2].Name, Is.EqualTo("hot-fileloader.js")); + } + + [Test] + public async Task Can_stream_multiple_files() + { + var client = GetClient(); + + var request = new StreamFiles { + Paths = { + "/js/ss-utils.js", + "/js/hot-loader.js", + "/js/not-exists.js", + "/js/hot-fileloader.js", + } + }; + + var files = new List(); + var stream = client.ServerStreamFiles(request).ResponseStream; + while (await stream.MoveNext(default)) + { + var file = stream.Current; + files.Add(file); + } + + Assert.That(files.Count, Is.EqualTo(request.Paths.Count)); + Assert.That(files[2].ResponseStatus.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.NotFound))); + files = files.Where(x => x.ResponseStatus == null).ToList(); + AssertFiles(files); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/Protoc/ProtocTodoTests.cs b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocTodoTests.cs new file mode 100644 index 00000000000..f058e37dabe --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Protoc/ProtocTodoTests.cs @@ -0,0 +1,109 @@ +using System; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; +using ProtoBuf.Grpc.Client; + +namespace ServiceStack.Extensions.Tests.Protoc +{ + public class ProtocTodoTests + { + private readonly ServiceStackHost appHost; + + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(GrpcTests), typeof(TodoServices).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new GrpcFeature(App)); + Plugins.Add(new ServerEventsFeature()); + + } + + public override void ConfigureKestrel(KestrelServerOptions options) + { + options.ListenLocalhost(TestsConfig.Port, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; + }); + } + + public override void Configure(IServiceCollection services) + { + services.AddServiceStackGrpc(); + } + + public override void Configure(IApplicationBuilder app) + { + app.UseRouting(); + } + } + + public ProtocTodoTests() + { + appHost = new AppHost() + .Init() + .Start(TestsConfig.BaseUri); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + private static GrpcServices.GrpcServicesClient GetClient(Action init = null) => + ProtocTests.GetClient(init); + + [Test] + public async Task Can_CreateTodo() + { + var client = GetClient(); + await client.PostResetTodosAsync(new ResetTodos()); + + var response = await client.PostCreateTodoAsync(new CreateTodo { + Title = "A", + Order = 1, + }); + + Assert.That(response.Result.Id, Is.GreaterThan(0)); + Assert.That(response.Result.Title, Is.EqualTo("A")); + Assert.That(response.Result.Order, Is.EqualTo(1)); + Assert.That(response.Result.Completed, Is.False); + } + + [Test] + public async Task Does_CRUD_Example() + { + var client = GetClient(); + await client.PostResetTodosAsync(new ResetTodos()); + + //GET /todos + var all = await client.CallGetTodosAsync(new GetTodos()); + Assert.That(all.Results?.Count ?? 0, Is.EqualTo(0)); + + //POST /todos + var todo = (await client.PostCreateTodoAsync(new CreateTodo { Title = "ServiceStack" })).Result; + Assert.That(todo.Id, Is.EqualTo(1)); + //GET /todos/1 + todo = (await client.CallGetTodoAsync(new GetTodo { Id = todo.Id })).Result; + Assert.That(todo.Title, Is.EqualTo("ServiceStack")); + + //GET /todos + all = await client.CallGetTodosAsync(new GetTodos()); + Assert.That(all.Results.Count, Is.EqualTo(1)); + + //PUT /todos/1 + await client.PutUpdateTodoAsync(new UpdateTodo { Id = todo.Id, Title = "gRPC" }); + todo = (await client.CallGetTodoAsync(new GetTodo { Id = todo.Id })).Result; + Assert.That(todo.Title, Is.EqualTo("gRPC")); + + //DELETE /todos/1 + await client.CallDeleteTodoAsync(new DeleteTodo { Id = todo.Id }); + //GET /todos + all = await client.CallGetTodosAsync(new GetTodos()); + Assert.That(all.Results?.Count ?? 0, Is.EqualTo(0)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Extensions.Tests/Protoc/Services.cs b/tests/ServiceStack.Extensions.Tests/Protoc/Services.cs new file mode 100644 index 00000000000..189c1677821 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Protoc/Services.cs @@ -0,0 +1,53600 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: services.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace ServiceStack.Extensions.Tests.Protoc { + + /// Holder for reflection information generated from services.proto + public static partial class ServicesReflection { + + #region Descriptor + /// File descriptor for services.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ServicesReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg5zZXJ2aWNlcy5wcm90bxofZ29vZ2xlL3Byb3RvYnVmL3RpbWVzdGFtcC5w", + "cm90bxoeZ29vZ2xlL3Byb3RvYnVmL2R1cmF0aW9uLnByb3RvIigKCUFkZEhl", + "YWRlchIMCgROYW1lGAEgASgJEg0KBVZhbHVlGAIgASgJIjkKBUFkaG9jEgoK", + "AklkGAEgASgFEhIKCmZpcnN0X25hbWUYAiABKAkSEAoITGFzdE5hbWUYAyAB", + "KAkigAQKCUFsbEZpZWxkcxIKCgJJZBgBIAEoBRISCgpOdWxsYWJsZUlkGAIg", + "ASgFEgwKBEJ5dGUYAyABKA0SDQoFU2hvcnQYBCABKAUSCwoDSW50GAUgASgF", + "EgwKBExvbmcYBiABKAMSDgoGVVNob3J0GAcgASgNEgwKBFVJbnQYCCABKA0S", + "DQoFVUxvbmcYCSABKAQSDQoFRmxvYXQYCiABKAISDgoGRG91YmxlGAsgASgB", + "Eg8KB0RlY2ltYWwYDCABKAkSDgoGU3RyaW5nGA0gASgJEiwKCERhdGVUaW1l", + "GA4gASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIrCghUaW1lU3Bh", + "bhgPIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbhIMCgRHdWlkGBAg", + "ASgJEjQKEE51bGxhYmxlRGF0ZVRpbWUYESABKAsyGi5nb29nbGUucHJvdG9i", + "dWYuVGltZXN0YW1wEjMKEE51bGxhYmxlVGltZVNwYW4YEiABKAsyGS5nb29n", + "bGUucHJvdG9idWYuRHVyYXRpb24SFAoMTnVsbGFibGVHdWlkGBMgASgJEh0K", + "BEVudW0YFCABKA4yDy5IdHRwU3RhdHVzQ29kZRIlCgxOdWxsYWJsZUVudW0Y", + "FSABKA4yDy5IdHRwU3RhdHVzQ29kZSIYCghBbnlIZWxsbxIMCgROYW1lGAEg", + "ASgJIpYBCgtBc3NpZ25Sb2xlcxIQCghVc2VyTmFtZRgBIAEoCRITCgtQZXJt", + "aXNzaW9ucxgCIAMoCRINCgVSb2xlcxgDIAMoCRIkCgRNZXRhGAQgAygLMhYu", + "QXNzaWduUm9sZXMuTWV0YUVudHJ5GisKCU1ldGFFbnRyeRILCgNrZXkYASAB", + "KAkSDQoFdmFsdWUYAiABKAk6AjgBIsMBChNBc3NpZ25Sb2xlc1Jlc3BvbnNl", + "EhAKCEFsbFJvbGVzGAEgAygJEhYKDkFsbFBlcm1pc3Npb25zGAIgAygJEiwK", + "BE1ldGEYAyADKAsyHi5Bc3NpZ25Sb2xlc1Jlc3BvbnNlLk1ldGFFbnRyeRIn", + "Cg5SZXNwb25zZVN0YXR1cxgEIAEoCzIPLlJlc3BvbnNlU3RhdHVzGisKCU1l", + "dGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIugCCglB", + "dWRpdEJhc2USLwoLQ3JlYXRlZERhdGUYASABKAsyGi5nb29nbGUucHJvdG9i", + "dWYuVGltZXN0YW1wEhEKCUNyZWF0ZWRCeRgCIAEoCRITCgtDcmVhdGVkSW5m", + "bxgDIAEoCRIwCgxNb2RpZmllZERhdGUYBCABKAsyGi5nb29nbGUucHJvdG9i", + "dWYuVGltZXN0YW1wEhIKCk1vZGlmaWVkQnkYBSABKAkSFAoMTW9kaWZpZWRJ", + "bmZvGAYgASgJEjMKD1NvZnREZWxldGVkRGF0ZRgHIAEoCzIaLmdvb2dsZS5w", + "cm90b2J1Zi5UaW1lc3RhbXASFQoNU29mdERlbGV0ZWRCeRgIIAEoCRIXCg9T", + "b2Z0RGVsZXRlZEluZm8YCSABKAkSNgoTUm9ja3N0YXJBdWRpdFRlbmFudBiC", + "haR4IAEoCzIULlJvY2tzdGFyQXVkaXRUZW5hbnRIAEIJCgdzdWJ0eXBlIqkD", + "CgxBdXRoZW50aWNhdGUSEAoIcHJvdmlkZXIYASABKAkSDQoFU3RhdGUYAiAB", + "KAkSEwoLb2F1dGhfdG9rZW4YAyABKAkSFgoOb2F1dGhfdmVyaWZpZXIYBCAB", + "KAkSEAoIVXNlck5hbWUYBSABKAkSEAoIUGFzc3dvcmQYBiABKAkSEgoKUmVt", + "ZW1iZXJNZRgHIAEoCBIRCglFcnJvclZpZXcYCSABKAkSDQoFbm9uY2UYCiAB", + "KAkSCwoDdXJpGAsgASgJEhAKCHJlc3BvbnNlGAwgASgJEgsKA3FvcBgNIAEo", + "CRIKCgJuYxgOIAEoCRIOCgZjbm9uY2UYDyABKAkSFgoOVXNlVG9rZW5Db29r", + "aWUYECABKAgSEwoLQWNjZXNzVG9rZW4YESABKAkSGQoRQWNjZXNzVG9rZW5T", + "ZWNyZXQYEiABKAkSDQoFc2NvcGUYEyABKAkSJQoETWV0YRgUIAMoCzIXLkF1", + "dGhlbnRpY2F0ZS5NZXRhRW50cnkaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEo", + "CRINCgV2YWx1ZRgCIAEoCToCOAEi3QIKFEF1dGhlbnRpY2F0ZVJlc3BvbnNl", + "Eg4KBlVzZXJJZBgBIAEoCRIRCglTZXNzaW9uSWQYAiABKAkSEAoIVXNlck5h", + "bWUYAyABKAkSEwoLRGlzcGxheU5hbWUYBCABKAkSEwoLUmVmZXJyZXJVcmwY", + "BSABKAkSEwoLQmVhcmVyVG9rZW4YBiABKAkSFAoMUmVmcmVzaFRva2VuGAcg", + "ASgJEhIKClByb2ZpbGVVcmwYCCABKAkSDQoFUm9sZXMYCSADKAkSEwoLUGVy", + "bWlzc2lvbnMYCiADKAkSJwoOUmVzcG9uc2VTdGF0dXMYCyABKAsyDy5SZXNw", + "b25zZVN0YXR1cxItCgRNZXRhGAwgAygLMh8uQXV0aGVudGljYXRlUmVzcG9u", + "c2UuTWV0YUVudHJ5GisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFs", + "dWUYAiABKAk6AjgBIhAKA0JhchIJCgFZGAIgASgJIkkKCEJvb2ttYXJrEgwK", + "BFNsdWcYASABKAkSDQoFVGl0bGUYAiABKAkSEwoLRGVzY3JpcHRpb24YAyAB", + "KAkSCwoDVXJsGAQgASgJIhYKFENoYW5nZUNvbm5lY3Rpb25JbmZvIlMKCENo", + "YW5nZURiEhcKD05hbWVkQ29ubmVjdGlvbhgBIAEoCRIYChBDb25uZWN0aW9u", + "U3RyaW5nGAIgASgJEhQKDFByb3ZpZGVyTmFtZRgDIAEoCSIuChBDaGFuZ2VE", + "YlJlc3BvbnNlEhoKB1Jlc3VsdHMYASADKAsyCS5Sb2Nrc3RhciKbAQoLQ2hh", + "dE1lc3NhZ2USCgoCSWQYASABKAMSDwoHQ2hhbm5lbBgCIAEoCRISCgpGcm9t", + "VXNlcklkGAMgASgJEhAKCEZyb21OYW1lGAQgASgJEhMKC0Rpc3BsYXlOYW1l", + "GAUgASgJEg8KB01lc3NhZ2UYBiABKAkSEgoKVXNlckF1dGhJZBgHIAEoCRIP", + "CgdQcml2YXRlGAggASgIIo0BChVDb252ZXJ0U2Vzc2lvblRvVG9rZW4SFwoP", + "UHJlc2VydmVTZXNzaW9uGAEgASgIEi4KBE1ldGEYAiADKAsyIC5Db252ZXJ0", + "U2Vzc2lvblRvVG9rZW4uTWV0YUVudHJ5GisKCU1ldGFFbnRyeRILCgNrZXkY", + "ASABKAkSDQoFdmFsdWUYAiABKAk6AjgBItgBCh1Db252ZXJ0U2Vzc2lvblRv", + "VG9rZW5SZXNwb25zZRI2CgRNZXRhGAEgAygLMiguQ29udmVydFNlc3Npb25U", + "b1Rva2VuUmVzcG9uc2UuTWV0YUVudHJ5EhMKC0FjY2Vzc1Rva2VuGAIgASgJ", + "EhQKDFJlZnJlc2hUb2tlbhgDIAEoCRInCg5SZXNwb25zZVN0YXR1cxgEIAEo", + "CzIPLlJlc3BvbnNlU3RhdHVzGisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkS", + "DQoFdmFsdWUYAiABKAk6AjgBIkUKQ0NyZWF0ZUF1ZGl0QmFzZV9Sb2Nrc3Rh", + "ckF1ZGl0VGVuYW50X1JvY2tzdGFyV2l0aElkQW5kUmVzdWx0UmVzcG9uc2Ui", + "SwpJQ3JlYXRlQXVkaXRUZW5hbnRCYXNlX1JvY2tzdGFyQXVkaXRUZW5hbnRf", + "Um9ja3N0YXJXaXRoSWRBbmRSZXN1bHRSZXNwb25zZSJPCg5DcmVhdGVCb29r", + "bWFyaxIMCgRTbHVnGAEgASgJEg0KBVRpdGxlGAIgASgJEhMKC0Rlc2NyaXB0", + "aW9uGAMgASgJEgsKA1VybBgEIAEoCSJnChZDcmVhdGVCb29rbWFya1Jlc3Bv", + "bnNlEgoKAklkGAEgASgJEhgKBlJlc3VsdBgCIAEoCzIILkRhb0Jhc2USJwoO", + "UmVzcG9uc2VTdGF0dXMYAyABKAsyDy5SZXNwb25zZVN0YXR1cyLgAQocQ3Jl", + "YXRlQ29ubmVjdGlvbkluZm9Sb2Nrc3RhchIRCglGaXJzdE5hbWUYASABKAkS", + "EAoITGFzdE5hbWUYAiABKAkSCwoDQWdlGAMgASgFEi8KC0RhdGVPZkJpcnRo", + "GAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIsCghEYXRlRGll", + "ZBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASIwoMTGl2aW5n", + "U3RhdHVzGAYgASgOMg0uTGl2aW5nU3RhdHVzEgoKAklkGGUgASgFItcBChND", + "cmVhdGVOYW1lZFJvY2tzdGFyEhEKCUZpcnN0TmFtZRgBIAEoCRIQCghMYXN0", + "TmFtZRgCIAEoCRILCgNBZ2UYAyABKAUSLwoLRGF0ZU9mQmlydGgYBCABKAsy", + "Gi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiwKCERhdGVEaWVkGAUgASgL", + "MhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIjCgxMaXZpbmdTdGF0dXMY", + "BiABKA4yDS5MaXZpbmdTdGF0dXMSCgoCSWQYZSABKAUixgEKDkNyZWF0ZVJv", + "Y2tzdGFyEhEKCUZpcnN0TmFtZRgBIAEoCRIQCghMYXN0TmFtZRgCIAEoCRIL", + "CgNBZ2UYAyABKAUSLwoLRGF0ZU9mQmlydGgYBCABKAsyGi5nb29nbGUucHJv", + "dG9idWYuVGltZXN0YW1wEiwKCERhdGVEaWVkGAUgASgLMhouZ29vZ2xlLnBy", + "b3RvYnVmLlRpbWVzdGFtcBIjCgxMaXZpbmdTdGF0dXMYBiABKA4yDS5MaXZp", + "bmdTdGF0dXMi1gEKHkNyZWF0ZVJvY2tzdGFyQWRob2NOb25EZWZhdWx0cxIR", + "CglGaXJzdE5hbWUYASABKAkSEAoITGFzdE5hbWUYAiABKAkSCwoDQWdlGAMg", + "ASgFEi8KC0RhdGVPZkJpcnRoGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRp", + "bWVzdGFtcBIsCghEYXRlRGllZBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5U", + "aW1lc3RhbXASIwoMTGl2aW5nU3RhdHVzGAYgASgOMg0uTGl2aW5nU3RhdHVz", + "IssBChNDcmVhdGVSb2Nrc3RhckF1ZGl0EhEKCUZpcnN0TmFtZRgBIAEoCRIQ", + "CghMYXN0TmFtZRgCIAEoCRILCgNBZ2UYAyABKAUSLwoLRGF0ZU9mQmlydGgY", + "BCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiwKCERhdGVEaWVk", + "GAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIjCgxMaXZpbmdT", + "dGF0dXMYBiABKA4yDS5MaXZpbmdTdGF0dXMi5wEKGkNyZWF0ZVJvY2tzdGFy", + "QXVkaXRNcVRva2VuEhEKCUZpcnN0TmFtZRgBIAEoCRIQCghMYXN0TmFtZRgC", + "IAEoCRILCgNBZ2UYAyABKAUSLwoLRGF0ZU9mQmlydGgYBCABKAsyGi5nb29n", + "bGUucHJvdG9idWYuVGltZXN0YW1wEiwKCERhdGVEaWVkGAUgASgLMhouZ29v", + "Z2xlLnByb3RvYnVmLlRpbWVzdGFtcBIjCgxMaXZpbmdTdGF0dXMYBiABKA4y", + "DS5MaXZpbmdTdGF0dXMSEwoLQmVhcmVyVG9rZW4YZSABKAki7QEKGUNyZWF0", + "ZVJvY2tzdGFyQXVkaXRUZW5hbnQSFAoLQmVhcmVyVG9rZW4YyQEgASgJEhIK", + "CUZpcnN0TmFtZRjKASABKAkSEQoITGFzdE5hbWUYywEgASgJEgwKA0FnZRjM", + "ASABKAUSMAoLRGF0ZU9mQmlydGgYzQEgASgLMhouZ29vZ2xlLnByb3RvYnVm", + "LlRpbWVzdGFtcBItCghEYXRlRGllZBjOASABKAsyGi5nb29nbGUucHJvdG9i", + "dWYuVGltZXN0YW1wEiQKDExpdmluZ1N0YXR1cxjPASABKA4yDS5MaXZpbmdT", + "dGF0dXMi2AEKIENyZWF0ZVJvY2tzdGFyQXVkaXRUZW5hbnRHYXRld2F5EhEK", + "CUZpcnN0TmFtZRgBIAEoCRIQCghMYXN0TmFtZRgCIAEoCRILCgNBZ2UYAyAB", + "KAUSLwoLRGF0ZU9mQmlydGgYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGlt", + "ZXN0YW1wEiwKCERhdGVEaWVkGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRp", + "bWVzdGFtcBIjCgxMaXZpbmdTdGF0dXMYBiABKA4yDS5MaXZpbmdTdGF0dXMi", + "0wEKG0NyZWF0ZVJvY2tzdGFyQXVkaXRUZW5hbnRNcRIRCglGaXJzdE5hbWUY", + "ASABKAkSEAoITGFzdE5hbWUYAiABKAkSCwoDQWdlGAMgASgFEi8KC0RhdGVP", + "ZkJpcnRoGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIsCghE", + "YXRlRGllZBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASIwoM", + "TGl2aW5nU3RhdHVzGAYgASgOMg0uTGl2aW5nU3RhdHVzIt8BChVDcmVhdGVS", + "b2Nrc3RhckF1dG9NYXASFAoMTWFwRmlyc3ROYW1lGAEgASgJEhMKC01hcExh", + "c3ROYW1lGAIgASgJEg4KBk1hcEFnZRgDIAEoBRIyCg5NYXBEYXRlT2ZCaXJ0", + "aBgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASLwoLTWFwRGF0", + "ZURpZWQYBSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiYKD01h", + "cExpdmluZ1N0YXR1cxgGIAEoDjINLkxpdmluZ1N0YXR1cyJBChZDcmVhdGVS", + "b2Nrc3RhclJlc3BvbnNlEicKDlJlc3BvbnNlU3RhdHVzGAEgASgLMg8uUmVz", + "cG9uc2VTdGF0dXMizQEKFUNyZWF0ZVJvY2tzdGFyVmVyc2lvbhIRCglGaXJz", + "dE5hbWUYASABKAkSEAoITGFzdE5hbWUYAiABKAkSCwoDQWdlGAMgASgFEi8K", + "C0RhdGVPZkJpcnRoGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFt", + "cBIsCghEYXRlRGllZBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3Rh", + "bXASIwoMTGl2aW5nU3RhdHVzGAYgASgOMg0uTGl2aW5nU3RhdHVzItIBChpD", + "cmVhdGVSb2Nrc3RhcldpdGhBdXRvR3VpZBIRCglGaXJzdE5hbWUYASABKAkS", + "EAoITGFzdE5hbWUYAiABKAkSCwoDQWdlGAMgASgFEi8KC0RhdGVPZkJpcnRo", + "GAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIsCghEYXRlRGll", + "ZBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASIwoMTGl2aW5n", + "U3RhdHVzGAYgASgOMg0uTGl2aW5nU3RhdHVzItABChhDcmVhdGVSb2Nrc3Rh", + "cldpdGhSZXR1cm4SEQoJRmlyc3ROYW1lGAEgASgJEhAKCExhc3ROYW1lGAIg", + "ASgJEgsKA0FnZRgDIAEoBRIvCgtEYXRlT2ZCaXJ0aBgEIAEoCzIaLmdvb2ds", + "ZS5wcm90b2J1Zi5UaW1lc3RhbXASLAoIRGF0ZURpZWQYBSABKAsyGi5nb29n", + "bGUucHJvdG9idWYuVGltZXN0YW1wEiMKDExpdmluZ1N0YXR1cxgGIAEoDjIN", + "LkxpdmluZ1N0YXR1cyJ6CiRDcmVhdGVSb2Nrc3RhcldpdGhSZXR1cm5HdWlk", + "UmVzcG9uc2USCgoCSWQYASABKAkSHQoGUmVzdWx0GAIgASgLMg0uUm9ja3N0", + "YXJCYXNlEicKDlJlc3BvbnNlU3RhdHVzGAMgASgLMg8uUmVzcG9uc2VTdGF0", + "dXMi1AEKHENyZWF0ZVJvY2tzdGFyV2l0aFZvaWRSZXR1cm4SEQoJRmlyc3RO", + "YW1lGAEgASgJEhAKCExhc3ROYW1lGAIgASgJEgsKA0FnZRgDIAEoBRIvCgtE", + "YXRlT2ZCaXJ0aBgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAS", + "LAoIRGF0ZURpZWQYBSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1w", + "EiMKDExpdmluZ1N0YXR1cxgGIAEoDjINLkxpdmluZ1N0YXR1cyIqCgpDcmVh", + "dGVUb2RvEg0KBVRpdGxlGAEgASgJEg0KBU9yZGVyGAIgASgFIlQKEkNyZWF0", + "ZVRvZG9SZXNwb25zZRIVCgZSZXN1bHQYASABKAsyBS5Ub2RvEicKDlJlc3Bv", + "bnNlU3RhdHVzGAIgASgLMg8uUmVzcG9uc2VTdGF0dXMieAoOQ3VzdG9tUm9j", + "a3N0YXISEQoJRmlyc3ROYW1lGAEgASgJEhAKCExhc3ROYW1lGAIgASgJEgsK", + "A0FnZRgDIAEoBRIZChFSb2Nrc3RhckFsYnVtTmFtZRgEIAEoCRIZChFSb2Nr", + "c3RhckdlbnJlTmFtZRgFIAEoCSJ+ChRDdXN0b21Sb2Nrc3RhclNjaGVtYRIR", + "CglGaXJzdE5hbWUYASABKAkSEAoITGFzdE5hbWUYAiABKAkSCwoDQWdlGAMg", + "ASgFEhkKEVJvY2tzdGFyQWxidW1OYW1lGAQgASgJEhkKEVJvY2tzdGFyR2Vu", + "cmVOYW1lGAUgASgJIlQKFEN1c3RvbVNlbGVjdFJvY2tzdGFyEgoKAklkGAEg", + "ASgFEhEKCUZpcnN0TmFtZRgCIAEoCRIQCghMYXN0TmFtZRgDIAEoCRILCgNB", + "Z2UYBCABKAUiSgocQ3VzdG9tU2VsZWN0Um9ja3N0YXJSZXNwb25zZRIKCgJJ", + "ZBgBIAEoBRIRCglGaXJzdE5hbWUYAiABKAkSCwoDQWdlGAMgASgFItIBChZD", + "dXN0b21WYWxpZGF0aW9uRXJyb3JzEhcKD0N1c3RvbUVycm9yQ29kZRgBIAEo", + "CRIhChlDdXN0b21FcnJvckNvZGVBbmRNZXNzYWdlGAIgASgFEhUKDUVycm9y", + "Q29kZVJ1bGUYAyABKAkSFgoOSXNPZGRDb25kaXRpb24YBCABKAUSJgoeSXNP", + "ZGRBbmRPdmVyVHdvRGlnaXRzQ29uZGl0aW9uGAUgASgFEiUKHUlzT2RkT3JP", + "dmVyVHdvRGlnaXRzQ29uZGl0aW9uGAYgASgFIswBCgdEYW9CYXNlEgoKAklk", + "GAEgASgJEi4KCkNyZWF0ZURhdGUYAiABKAsyGi5nb29nbGUucHJvdG9idWYu", + "VGltZXN0YW1wEhEKCUNyZWF0ZWRCeRgDIAEoCRIwCgxNb2RpZmllZERhdGUY", + "BCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEhIKCk1vZGlmaWVk", + "QnkYBSABKAkSIQoIQm9va21hcmsY4/XF0QEgASgLMgkuQm9va21hcmtIAEIJ", + "CgdzdWJ0eXBlIhwKDkRlbGV0ZVJvY2tzdGFyEgoKAklkGAEgASgFIiEKE0Rl", + "bGV0ZVJvY2tzdGFyQXVkaXQSCgoCSWQYASABKAUiVQobRGVsZXRlUm9ja3N0", + "YXJDb3VudFJlc3BvbnNlEg0KBUNvdW50GAEgASgFEicKDlJlc3BvbnNlU3Rh", + "dHVzGAIgASgLMg8uUmVzcG9uc2VTdGF0dXMiSQoVRGVsZXRlUm9ja3N0YXJG", + "aWx0ZXJzEhEKCUZpcnN0TmFtZRgBIAEoCRIQCghMYXN0TmFtZRgCIAEoCRIL", + "CgNBZ2UYAyABKAUiGAoKRGVsZXRlVG9kbxIKCgJJZBgBIAEoAyIeCgtEZWxl", + "dGVUb2RvcxIPCgNJZHMYASADKANCAhAAImwKDkR5bmFtaWNSZXF1ZXN0EisK", + "BlBhcmFtcxgBIAMoCzIbLkR5bmFtaWNSZXF1ZXN0LlBhcmFtc0VudHJ5Gi0K", + "C1BhcmFtc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEi", + "oAEKFkR5bmFtaWNWYWxpZGF0aW9uUnVsZXMSEQoJRmlyc3ROYW1lGAEgASgJ", + "EhAKCExhc3ROYW1lGAIgASgJEgsKA0FnZRgDIAEoBRIvCgtEYXRlT2ZCaXJ0", + "aBgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASIwoMTGl2aW5n", + "U3RhdHVzGAUgASgOMg0uTGl2aW5nU3RhdHVzIjgKDUVtcHR5UmVzcG9uc2US", + "JwoOUmVzcG9uc2VTdGF0dXMYASABKAsyDy5SZXNwb25zZVN0YXR1cyLBAQoP", + "RW1wdHlWYWxpZGF0b3JzEgsKA0ludBgBIAEoBRIMCgROSW50GAIgASgFEisK", + "CFRpbWVTcGFuGAMgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uEiwK", + "CU5UaW1lU3BhbhgEIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbhIO", + "CgZTdHJpbmcYBSABKAkSFAoISW50QXJyYXkYBiADKAVCAhAAEhIKClN0cmlu", + "Z0xpc3QYByADKAkiJwoVRW5kc1dpdGhTdWZmaXhSZXF1ZXN0Eg4KBlN1ZmZp", + "eBgBIAEoCSJVChZFbmRzV2l0aFN1ZmZpeFJlc3BvbnNlEh0KBlJlc3VsdBgB", + "IAEoCzINLlNlYXJjaFJlc3VsdBINCgVDb3VudBgCIAEoBRINCgVXb3JkcxgD", + "IAMoCSIHCgVFbnRyeSJwCgtGaWxlQ29udGVudBIMCgROYW1lGAEgASgJEgwK", + "BFR5cGUYAiABKAkSDgoGTGVuZ3RoGAMgASgFEgwKBEJvZHkYBCABKAwSJwoO", + "UmVzcG9uc2VTdGF0dXMYBSABKAsyDy5SZXNwb25zZVN0YXR1cyIzCgNGb28S", + "CQoBWBgBIAEoCRIWCgNCYXIY1v+jZCABKAsyBC5CYXJIAEIJCgdzdWJ0eXBl", + "IpQBCg5HZXRBY2Nlc3NUb2tlbhIUCgxSZWZyZXNoVG9rZW4YASABKAkSFgoO", + "VXNlVG9rZW5Db29raWUYAiABKAgSJwoETWV0YRgDIAMoCzIZLkdldEFjY2Vz", + "c1Rva2VuLk1ldGFFbnRyeRorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0K", + "BXZhbHVlGAIgASgJOgI4ASK0AQoWR2V0QWNjZXNzVG9rZW5SZXNwb25zZRIT", + "CgtBY2Nlc3NUb2tlbhgBIAEoCRIvCgRNZXRhGAIgAygLMiEuR2V0QWNjZXNz", + "VG9rZW5SZXNwb25zZS5NZXRhRW50cnkSJwoOUmVzcG9uc2VTdGF0dXMYAyAB", + "KAsyDy5SZXNwb25zZVN0YXR1cxorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJ", + "Eg0KBXZhbHVlGAIgASgJOgI4ASJzCgpHZXRBcGlLZXlzEhMKC0Vudmlyb25t", + "ZW50GAEgASgJEiMKBE1ldGEYAiADKAsyFS5HZXRBcGlLZXlzLk1ldGFFbnRy", + "eRorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4", + "ASK1AQoSR2V0QXBpS2V5c1Jlc3BvbnNlEhwKB1Jlc3VsdHMYASADKAsyCy5V", + "c2VyQXBpS2V5EisKBE1ldGEYAiADKAsyHS5HZXRBcGlLZXlzUmVzcG9uc2Uu", + "TWV0YUVudHJ5EicKDlJlc3BvbnNlU3RhdHVzGAMgASgLMg8uUmVzcG9uc2VT", + "dGF0dXMaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEo", + "CToCOAEiFwoHR2V0RmlsZRIMCgRQYXRoGAEgASgJIhgKCEdldEhlbGxvEgwK", + "BE5hbWUYASABKAkiFQoHR2V0VG9kbxIKCgJJZBgBIAEoAyJRCg9HZXRUb2Rv", + "UmVzcG9uc2USFQoGUmVzdWx0GAEgASgLMgUuVG9kbxInCg5SZXNwb25zZVN0", + "YXR1cxgCIAEoCzIPLlJlc3BvbnNlU3RhdHVzIgoKCEdldFRvZG9zIlMKEEdl", + "dFRvZG9zUmVzcG9uc2USFgoHUmVzdWx0cxgBIAMoCzIFLlRvZG8SJwoOUmVz", + "cG9uc2VTdGF0dXMYAiABKAsyDy5SZXNwb25zZVN0YXR1cyItCghIZWxsb0p3", + "dBIMCgROYW1lGAEgASgJEhMKC0JlYXJlclRva2VuGAIgASgJIksKEEhlbGxv", + "Snd0UmVzcG9uc2USDgoGUmVzdWx0GAEgASgJEicKDlJlc3BvbnNlU3RhdHVz", + "GAIgASgLMg8uUmVzcG9uc2VTdGF0dXMiSAoNSGVsbG9SZXNwb25zZRIOCgZS", + "ZXN1bHQYASABKAkSJwoOUmVzcG9uc2VTdGF0dXMYAiABKAsyDy5SZXNwb25z", + "ZVN0YXR1cyIWCgRJbmNyEg4KBkFtb3VudBgBIAEoBSK1AQoFTW92aWUSCgoC", + "SWQYASABKAUSDgoGSW1kYklkGAIgASgJEg0KBVRpdGxlGAMgASgJEg4KBlJh", + "dGluZxgEIAEoCRINCgVTY29yZRgFIAEoCRIQCghEaXJlY3RvchgGIAEoCRIv", + "CgtSZWxlYXNlRGF0ZRgHIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3Rh", + "bXASDwoHVGFnTGluZRgIIAEoCRIOCgZHZW5yZXMYCSADKAkiIAoITXVsdGlw", + "bHkSCQoBWBgBIAEoBRIJCgFZGAIgASgFIiIKEE11bHRpcGx5UmVzcG9uc2US", + "DgoGUmVzdWx0GAEgASgFIg8KDU5hbWVkUm9ja3N0YXIinQEKE05vQWJzdHJh", + "Y3RWYWxpZGF0b3ISEQoJRmlyc3ROYW1lGAEgASgJEhAKCExhc3ROYW1lGAIg", + "ASgJEgsKA0FnZRgDIAEoBRIvCgtEYXRlT2ZCaXJ0aBgEIAEoCzIaLmdvb2ds", + "ZS5wcm90b2J1Zi5UaW1lc3RhbXASIwoMTGl2aW5nU3RhdHVzGAUgASgOMg0u", + "TGl2aW5nU3RhdHVzIjUKFE9ubHlWYWxpZGF0ZXNSZXF1ZXN0EgwKBFRlc3QY", + "ASABKAUSDwoHTm90TnVsbBgCIAEoCSI1CgpQYWdpbmdUZXN0EgoKAklkGAEg", + "ASgFEgwKBE5hbWUYAiABKAkSDQoFVmFsdWUYAyABKAUiRApCUGF0Y2hBdWRp", + "dEJhc2VfUm9ja3N0YXJBdWRpdFRlbmFudF9Sb2Nrc3RhcldpdGhJZEFuZFJl", + "c3VsdFJlc3BvbnNlIkoKSFBhdGNoQXVkaXRUZW5hbnRCYXNlX1JvY2tzdGFy", + "QXVkaXRUZW5hbnRfUm9ja3N0YXJXaXRoSWRBbmRSZXN1bHRSZXNwb25zZSLR", + "AQoNUGF0Y2hSb2Nrc3RhchIRCglGaXJzdE5hbWUYASABKAkSEAoITGFzdE5h", + "bWUYAiABKAkSCwoDQWdlGAMgASgFEi8KC0RhdGVPZkJpcnRoGAQgASgLMhou", + "Z29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIsCghEYXRlRGllZBgFIAEoCzIa", + "Lmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASIwoMTGl2aW5nU3RhdHVzGAYg", + "ASgOMg0uTGl2aW5nU3RhdHVzEgoKAklkGGUgASgFIncKGFBhdGNoUm9ja3N0", + "YXJBdWRpdFRlbmFudBIUCgtCZWFyZXJUb2tlbhjJASABKAkSCwoCSWQYygEg", + "ASgFEhIKCUZpcnN0TmFtZRjLASABKAkSJAoMTGl2aW5nU3RhdHVzGMwBIAEo", + "DjINLkxpdmluZ1N0YXR1cyJlCh9QYXRjaFJvY2tzdGFyQXVkaXRUZW5hbnRH", + "YXRld2F5EgoKAklkGAEgASgFEhEKCUZpcnN0TmFtZRgCIAEoCRIjCgxMaXZp", + "bmdTdGF0dXMYAyABKA4yDS5MaXZpbmdTdGF0dXMiYAoaUGF0Y2hSb2Nrc3Rh", + "ckF1ZGl0VGVuYW50TXESCgoCSWQYASABKAUSEQoJRmlyc3ROYW1lGAIgASgJ", + "EiMKDExpdmluZ1N0YXR1cxgDIAEoDjINLkxpdmluZ1N0YXR1cyJnChFQb3N0", + "Q2hhdFRvQ2hhbm5lbBIMCgRGcm9tGAEgASgJEhAKCFRvVXNlcklkGAIgASgJ", + "Eg8KB0NoYW5uZWwYAyABKAkSDwoHTWVzc2FnZRgEIAEoCRIQCghTZWxlY3Rv", + "chgFIAEoCSLBAQoKUXVlcnlBZGhvYxIMCgRTa2lwGAEgASgFEgwKBFRha2UY", + "AiABKAUSDwoHT3JkZXJCeRgDIAEoCRITCgtPcmRlckJ5RGVzYxgEIAEoCRIP", + "CgdJbmNsdWRlGAUgASgJEg4KBkZpZWxkcxgGIAEoCRIjCgRNZXRhGAcgAygL", + "MhUuUXVlcnlBZGhvYy5NZXRhRW50cnkaKwoJTWV0YUVudHJ5EgsKA2tleRgB", + "IAEoCRINCgV2YWx1ZRgCIAEoCToCOAEi6AEKE1F1ZXJ5QWRob2NSb2Nrc3Rh", + "cnMSDAoEU2tpcBgBIAEoBRIMCgRUYWtlGAIgASgFEg8KB09yZGVyQnkYAyAB", + "KAkSEwoLT3JkZXJCeURlc2MYBCABKAkSDwoHSW5jbHVkZRgFIAEoCRIOCgZG", + "aWVsZHMYBiABKAkSLAoETWV0YRgHIAMoCzIeLlF1ZXJ5QWRob2NSb2Nrc3Rh", + "cnMuTWV0YUVudHJ5EhMKCmZpcnN0X25hbWUYyQEgASgJGisKCU1ldGFFbnRy", + "eRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBItgBCg5RdWVyeUFs", + "bEZpZWxkcxIMCgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJC", + "eRgDIAEoCRITCgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJ", + "Eg4KBkZpZWxkcxgGIAEoCRInCgRNZXRhGAcgAygLMhkuUXVlcnlBbGxGaWVs", + "ZHMuTWV0YUVudHJ5Eg0KBEd1aWQYyQEgASgJGisKCU1ldGFFbnRyeRILCgNr", + "ZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIskBCg5RdWVyeUJvb2ttYXJr", + "cxIMCgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEo", + "CRITCgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZp", + "ZWxkcxgGIAEoCRInCgRNZXRhGAcgAygLMhkuUXVlcnlCb29rbWFya3MuTWV0", + "YUVudHJ5GisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiAB", + "KAk6AjgBIvEBChtRdWVyeUNhc2VJbnNlbnNpdGl2ZU9yZGVyQnkSDAoEU2tp", + "cBgBIAEoBRIMCgRUYWtlGAIgASgFEg8KB09yZGVyQnkYAyABKAkSEwoLT3Jk", + "ZXJCeURlc2MYBCABKAkSDwoHSW5jbHVkZRgFIAEoCRIOCgZGaWVsZHMYBiAB", + "KAkSNAoETWV0YRgHIAMoCzImLlF1ZXJ5Q2FzZUluc2Vuc2l0aXZlT3JkZXJC", + "eS5NZXRhRW50cnkSDAoDQWdlGMkBIAEoBRorCglNZXRhRW50cnkSCwoDa2V5", + "GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLfAQoZUXVlcnlDaGFuZ2VDb25u", + "ZWN0aW9uSW5mbxIMCgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3Jk", + "ZXJCeRgDIAEoCRITCgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUg", + "ASgJEg4KBkZpZWxkcxgGIAEoCRIyCgRNZXRhGAcgAygLMiQuUXVlcnlDaGFu", + "Z2VDb25uZWN0aW9uSW5mby5NZXRhRW50cnkaKwoJTWV0YUVudHJ5EgsKA2tl", + "eRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEikwIKDVF1ZXJ5Q2hhbmdlRGIS", + "DAoEU2tpcBgBIAEoBRIMCgRUYWtlGAIgASgFEg8KB09yZGVyQnkYAyABKAkS", + "EwoLT3JkZXJCeURlc2MYBCABKAkSDwoHSW5jbHVkZRgFIAEoCRIOCgZGaWVs", + "ZHMYBiABKAkSJgoETWV0YRgHIAMoCzIYLlF1ZXJ5Q2hhbmdlRGIuTWV0YUVu", + "dHJ5EhgKD05hbWVkQ29ubmVjdGlvbhjJASABKAkSGQoQQ29ubmVjdGlvblN0", + "cmluZxjKASABKAkSFQoMUHJvdmlkZXJOYW1lGMsBIAEoCRorCglNZXRhRW50", + "cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLjAQoUUXVlcnlD", + "dXN0b21Sb2Nrc3RhcnMSDAoEU2tpcBgBIAEoBRIMCgRUYWtlGAIgASgFEg8K", + "B09yZGVyQnkYAyABKAkSEwoLT3JkZXJCeURlc2MYBCABKAkSDwoHSW5jbHVk", + "ZRgFIAEoCRIOCgZGaWVsZHMYBiABKAkSLQoETWV0YRgHIAMoCzIfLlF1ZXJ5", + "Q3VzdG9tUm9ja3N0YXJzLk1ldGFFbnRyeRIMCgNBZ2UYyQEgASgFGisKCU1l", + "dGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIu8BChpR", + "dWVyeUN1c3RvbVJvY2tzdGFyc0ZpbHRlchIMCgRTa2lwGAEgASgFEgwKBFRh", + "a2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRITCgtPcmRlckJ5RGVzYxgEIAEo", + "CRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxkcxgGIAEoCRIzCgRNZXRhGAcg", + "AygLMiUuUXVlcnlDdXN0b21Sb2Nrc3RhcnNGaWx0ZXIuTWV0YUVudHJ5EgwK", + "A0FnZRjJASABKAUaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1", + "ZRgCIAEoCToCOAEi9wEKHlF1ZXJ5Q3VzdG9tUm9ja3N0YXJzUmVmZXJlbmNl", + "cxIMCgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEo", + "CRITCgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZp", + "ZWxkcxgGIAEoCRI3CgRNZXRhGAcgAygLMikuUXVlcnlDdXN0b21Sb2Nrc3Rh", + "cnNSZWZlcmVuY2VzLk1ldGFFbnRyeRIMCgNBZ2UYyQEgASgFGisKCU1ldGFF", + "bnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIu8BChpRdWVy", + "eUN1c3RvbVJvY2tzdGFyc1NjaGVtYRIMCgRTa2lwGAEgASgFEgwKBFRha2UY", + "AiABKAUSDwoHT3JkZXJCeRgDIAEoCRITCgtPcmRlckJ5RGVzYxgEIAEoCRIP", + "CgdJbmNsdWRlGAUgASgJEg4KBkZpZWxkcxgGIAEoCRIzCgRNZXRhGAcgAygL", + "MiUuUXVlcnlDdXN0b21Sb2Nrc3RhcnNTY2hlbWEuTWV0YUVudHJ5EgwKA0Fn", + "ZRjJASABKAUaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgC", + "IAEoCToCOAEiMAouUXVlcnlEYlRlbmFudF9Sb2Nrc3RhckF1ZGl0VGVuYW50", + "X1JvY2tzdGFyQXV0byKWAwoTUXVlcnlGaWVsZFJvY2tzdGFycxIMCgRTa2lw", + "GAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRITCgtPcmRl", + "ckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxkcxgGIAEo", + "CRIsCgRNZXRhGAcgAygLMh4uUXVlcnlGaWVsZFJvY2tzdGFycy5NZXRhRW50", + "cnkSEgoJRmlyc3ROYW1lGMkBIAEoCRITCgpGaXJzdE5hbWVzGMoBIAMoCRIM", + "CgNBZ2UYywEgASgFEiEKGEZpcnN0TmFtZUNhc2VJbnNlbnNpdGl2ZRjMASAB", + "KAkSHAoTRmlyc3ROYW1lU3RhcnRzV2l0aBjNASABKAkSGQoQTGFzdE5hbWVF", + "bmRzV2l0aBjOASABKAkSGQoQRmlyc3ROYW1lQmV0d2VlbhjPASADKAkSEwoK", + "T3JMYXN0TmFtZRjQASABKAkaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRIN", + "CgV2YWx1ZRgCIAEoCToCOAEi7wEKGlF1ZXJ5RmllbGRSb2Nrc3RhcnNEeW5h", + "bWljEgwKBFNraXAYASABKAUSDAoEVGFrZRgCIAEoBRIPCgdPcmRlckJ5GAMg", + "ASgJEhMKC09yZGVyQnlEZXNjGAQgASgJEg8KB0luY2x1ZGUYBSABKAkSDgoG", + "RmllbGRzGAYgASgJEjMKBE1ldGEYByADKAsyJS5RdWVyeUZpZWxkUm9ja3N0", + "YXJzRHluYW1pYy5NZXRhRW50cnkSDAoDQWdlGMkBIAEoBRorCglNZXRhRW50", + "cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASKgAgoeUXVlcnlG", + "aWVsZHNJbXBsaWNpdENvbnZlbnRpb25zEgwKBFNraXAYASABKAUSDAoEVGFr", + "ZRgCIAEoBRIPCgdPcmRlckJ5GAMgASgJEhMKC09yZGVyQnlEZXNjGAQgASgJ", + "Eg8KB0luY2x1ZGUYBSABKAkSDgoGRmllbGRzGAYgASgJEjcKBE1ldGEYByAD", + "KAsyKS5RdWVyeUZpZWxkc0ltcGxpY2l0Q29udmVudGlvbnMuTWV0YUVudHJ5", + "EhoKEUZpcnN0TmFtZUNvbnRhaW5zGMkBIAEoCRIZChBMYXN0TmFtZUVuZHNX", + "aXRoGMoBIAEoCRorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVl", + "GAIgASgJOgI4ASLLAQoJUXVlcnlGb29zEgwKBFNraXAYASABKAUSDAoEVGFr", + "ZRgCIAEoBRIPCgdPcmRlckJ5GAMgASgJEhMKC09yZGVyQnlEZXNjGAQgASgJ", + "Eg8KB0luY2x1ZGUYBSABKAkSDgoGRmllbGRzGAYgASgJEiIKBE1ldGEYByAD", + "KAsyFC5RdWVyeUZvb3MuTWV0YUVudHJ5EgoKAVgYyQEgASgJGisKCU1ldGFF", + "bnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIqICChFRdWVy", + "eUdldFJvY2tzdGFycxIMCgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoH", + "T3JkZXJCeRgDIAEoCRITCgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRl", + "GAUgASgJEg4KBkZpZWxkcxgGIAEoCRIqCgRNZXRhGAcgAygLMhwuUXVlcnlH", + "ZXRSb2Nrc3RhcnMuTWV0YUVudHJ5EhAKA0lkcxjJASADKAVCAhAAEhEKBEFn", + "ZXMYygEgAygFQgIQABITCgpGaXJzdE5hbWVzGMsBIAMoCRIXCgpJZHNCZXR3", + "ZWVuGMwBIAMoBUICEAAaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2", + "YWx1ZRgCIAEoCToCOAEi3QEKGFF1ZXJ5R2V0Um9ja3N0YXJzRHluYW1pYxIM", + "CgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRIT", + "CgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxk", + "cxgGIAEoCRIxCgRNZXRhGAcgAygLMiMuUXVlcnlHZXRSb2Nrc3RhcnNEeW5h", + "bWljLk1ldGFFbnRyeRorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0KBXZh", + "bHVlGAIgASgJOgI4ASKJAgoZUXVlcnlKb2luZWRSb2Nrc3RhckFsYnVtcxIM", + "CgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRIT", + "CgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxk", + "cxgGIAEoCRIyCgRNZXRhGAcgAygLMiQuUXVlcnlKb2luZWRSb2Nrc3RhckFs", + "YnVtcy5NZXRhRW50cnkSDAoDQWdlGMkBIAEoBRIaChFSb2Nrc3RhckFsYnVt", + "TmFtZRjKASABKAkaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1", + "ZRgCIAEoCToCOAEioQIKJVF1ZXJ5Sm9pbmVkUm9ja3N0YXJBbGJ1bXNDdXN0", + "b21TZWxlY3QSDAoEU2tpcBgBIAEoBRIMCgRUYWtlGAIgASgFEg8KB09yZGVy", + "QnkYAyABKAkSEwoLT3JkZXJCeURlc2MYBCABKAkSDwoHSW5jbHVkZRgFIAEo", + "CRIOCgZGaWVsZHMYBiABKAkSPgoETWV0YRgHIAMoCzIwLlF1ZXJ5Sm9pbmVk", + "Um9ja3N0YXJBbGJ1bXNDdXN0b21TZWxlY3QuTWV0YUVudHJ5EgwKA0FnZRjJ", + "ASABKAUSGgoRUm9ja3N0YXJBbGJ1bU5hbWUYygEgASgJGisKCU1ldGFFbnRy", + "eRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIrECCi1RdWVyeUpv", + "aW5lZFJvY2tzdGFyQWxidW1zQ3VzdG9tU2VsZWN0UmVzcG9uc2USDAoEU2tp", + "cBgBIAEoBRIMCgRUYWtlGAIgASgFEg8KB09yZGVyQnkYAyABKAkSEwoLT3Jk", + "ZXJCeURlc2MYBCABKAkSDwoHSW5jbHVkZRgFIAEoCRIOCgZGaWVsZHMYBiAB", + "KAkSRgoETWV0YRgHIAMoCzI4LlF1ZXJ5Sm9pbmVkUm9ja3N0YXJBbGJ1bXND", + "dXN0b21TZWxlY3RSZXNwb25zZS5NZXRhRW50cnkSDAoDQWdlGMkBIAEoBRIa", + "ChFSb2Nrc3RhckFsYnVtTmFtZRjKASABKAkaKwoJTWV0YUVudHJ5EgsKA2tl", + "eRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEi+QEKC1F1ZXJ5TW92aWVzEgwK", + "BFNraXAYASABKAUSDAoEVGFrZRgCIAEoBRIPCgdPcmRlckJ5GAMgASgJEhMK", + "C09yZGVyQnlEZXNjGAQgASgJEg8KB0luY2x1ZGUYBSABKAkSDgoGRmllbGRz", + "GAYgASgJEiQKBE1ldGEYByADKAsyFi5RdWVyeU1vdmllcy5NZXRhRW50cnkS", + "EAoDSWRzGMkBIAMoBUICEAASEAoHSW1kYklkcxjKASADKAkSEAoHUmF0aW5n", + "cxjLASADKAkaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgC", + "IAEoCToCOAEinwIKFlF1ZXJ5TXVsdGlKb2luUm9ja3N0YXISDAoEU2tpcBgB", + "IAEoBRIMCgRUYWtlGAIgASgFEg8KB09yZGVyQnkYAyABKAkSEwoLT3JkZXJC", + "eURlc2MYBCABKAkSDwoHSW5jbHVkZRgFIAEoCRIOCgZGaWVsZHMYBiABKAkS", + "LwoETWV0YRgHIAMoCzIhLlF1ZXJ5TXVsdGlKb2luUm9ja3N0YXIuTWV0YUVu", + "dHJ5EgwKA0FnZRjJASABKAUSGgoRUm9ja3N0YXJBbGJ1bU5hbWUYygEgASgJ", + "EhoKEVJvY2tzdGFyR2VucmVOYW1lGMsBIAEoCRorCglNZXRhRW50cnkSCwoD", + "a2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLhAQoTUXVlcnlOYW1lZFJv", + "Y2tzdGFycxIMCgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJC", + "eRgDIAEoCRITCgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJ", + "Eg4KBkZpZWxkcxgGIAEoCRIsCgRNZXRhGAcgAygLMh4uUXVlcnlOYW1lZFJv", + "Y2tzdGFycy5NZXRhRW50cnkSDAoDQWdlGMkBIAEoBRorCglNZXRhRW50cnkS", + "CwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLvAQoQUXVlcnlPclJv", + "Y2tzdGFycxIMCgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJC", + "eRgDIAEoCRITCgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJ", + "Eg4KBkZpZWxkcxgGIAEoCRIpCgRNZXRhGAcgAygLMhsuUXVlcnlPclJvY2tz", + "dGFycy5NZXRhRW50cnkSDAoDQWdlGMkBIAEoBRISCglGaXJzdE5hbWUYygEg", + "ASgJGisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6", + "AjgBIoACChZRdWVyeU9yUm9ja3N0YXJzRmllbGRzEgwKBFNraXAYASABKAUS", + "DAoEVGFrZRgCIAEoBRIPCgdPcmRlckJ5GAMgASgJEhMKC09yZGVyQnlEZXNj", + "GAQgASgJEg8KB0luY2x1ZGUYBSABKAkSDgoGRmllbGRzGAYgASgJEi8KBE1l", + "dGEYByADKAsyIS5RdWVyeU9yUm9ja3N0YXJzRmllbGRzLk1ldGFFbnRyeRIS", + "CglGaXJzdE5hbWUYyQEgASgJEhEKCExhc3ROYW1lGMoBIAEoCRorCglNZXRh", + "RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASL1AQodUXVl", + "cnlPdmVycmlkZWRDdXN0b21Sb2Nrc3RhcnMSDAoEU2tpcBgBIAEoBRIMCgRU", + "YWtlGAIgASgFEg8KB09yZGVyQnkYAyABKAkSEwoLT3JkZXJCeURlc2MYBCAB", + "KAkSDwoHSW5jbHVkZRgFIAEoCRIOCgZGaWVsZHMYBiABKAkSNgoETWV0YRgH", + "IAMoCzIoLlF1ZXJ5T3ZlcnJpZGVkQ3VzdG9tUm9ja3N0YXJzLk1ldGFFbnRy", + "eRIMCgNBZ2UYyQEgASgFGisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoF", + "dmFsdWUYAiABKAk6AjgBIukBChdRdWVyeU92ZXJyaWRlZFJvY2tzdGFycxIM", + "CgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRIT", + "CgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxk", + "cxgGIAEoCRIwCgRNZXRhGAcgAygLMiIuUXVlcnlPdmVycmlkZWRSb2Nrc3Rh", + "cnMuTWV0YUVudHJ5EgwKA0FnZRjJASABKAUaKwoJTWV0YUVudHJ5EgsKA2tl", + "eRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEi9wEKD1F1ZXJ5UGFnaW5nVGVz", + "dBIMCgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEo", + "CRITCgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZp", + "ZWxkcxgGIAEoCRIoCgRNZXRhGAcgAygLMhouUXVlcnlQYWdpbmdUZXN0Lk1l", + "dGFFbnRyeRILCgJJZBjJASABKAUSDQoETmFtZRjKASABKAkSDgoFVmFsdWUY", + "ywEgASgFGisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiAB", + "KAk6AjgBItEBChNRdWVyeVJlc3BvbnNlX0FkaG9jEg4KBk9mZnNldBgBIAEo", + "BRINCgVUb3RhbBgCIAEoBRIXCgdSZXN1bHRzGAMgAygLMgYuQWRob2MSLAoE", + "TWV0YRgEIAMoCzIeLlF1ZXJ5UmVzcG9uc2VfQWRob2MuTWV0YUVudHJ5EicK", + "DlJlc3BvbnNlU3RhdHVzGAUgASgLMg8uUmVzcG9uc2VTdGF0dXMaKwoJTWV0", + "YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEi3QEKF1F1", + "ZXJ5UmVzcG9uc2VfQWxsRmllbGRzEg4KBk9mZnNldBgBIAEoBRINCgVUb3Rh", + "bBgCIAEoBRIbCgdSZXN1bHRzGAMgAygLMgouQWxsRmllbGRzEjAKBE1ldGEY", + "BCADKAsyIi5RdWVyeVJlc3BvbnNlX0FsbEZpZWxkcy5NZXRhRW50cnkSJwoO", + "UmVzcG9uc2VTdGF0dXMYBSABKAsyDy5SZXNwb25zZVN0YXR1cxorCglNZXRh", + "RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLZAQoWUXVl", + "cnlSZXNwb25zZV9Cb29rbWFyaxIOCgZPZmZzZXQYASABKAUSDQoFVG90YWwY", + "AiABKAUSGQoHUmVzdWx0cxgDIAMoCzIILkRhb0Jhc2USLwoETWV0YRgEIAMo", + "CzIhLlF1ZXJ5UmVzcG9uc2VfQm9va21hcmsuTWV0YUVudHJ5EicKDlJlc3Bv", + "bnNlU3RhdHVzGAUgASgLMg8uUmVzcG9uc2VTdGF0dXMaKwoJTWV0YUVudHJ5", + "EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEi7AEKHFF1ZXJ5UmVz", + "cG9uc2VfQ3VzdG9tUm9ja3N0YXISDgoGT2Zmc2V0GAEgASgFEg0KBVRvdGFs", + "GAIgASgFEiAKB1Jlc3VsdHMYAyADKAsyDy5DdXN0b21Sb2Nrc3RhchI1CgRN", + "ZXRhGAQgAygLMicuUXVlcnlSZXNwb25zZV9DdXN0b21Sb2Nrc3Rhci5NZXRh", + "RW50cnkSJwoOUmVzcG9uc2VTdGF0dXMYBSABKAsyDy5SZXNwb25zZVN0YXR1", + "cxorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4", + "ASL+AQoiUXVlcnlSZXNwb25zZV9DdXN0b21Sb2Nrc3RhclNjaGVtYRIOCgZP", + "ZmZzZXQYASABKAUSDQoFVG90YWwYAiABKAUSJgoHUmVzdWx0cxgDIAMoCzIV", + "LkN1c3RvbVJvY2tzdGFyU2NoZW1hEjsKBE1ldGEYBCADKAsyLS5RdWVyeVJl", + "c3BvbnNlX0N1c3RvbVJvY2tzdGFyU2NoZW1hLk1ldGFFbnRyeRInCg5SZXNw", + "b25zZVN0YXR1cxgFIAEoCzIPLlJlc3BvbnNlU3RhdHVzGisKCU1ldGFFbnRy", + "eRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIv4BCiJRdWVyeVJl", + "c3BvbnNlX0N1c3RvbVNlbGVjdFJvY2tzdGFyEg4KBk9mZnNldBgBIAEoBRIN", + "CgVUb3RhbBgCIAEoBRImCgdSZXN1bHRzGAMgAygLMhUuQ3VzdG9tU2VsZWN0", + "Um9ja3N0YXISOwoETWV0YRgEIAMoCzItLlF1ZXJ5UmVzcG9uc2VfQ3VzdG9t", + "U2VsZWN0Um9ja3N0YXIuTWV0YUVudHJ5EicKDlJlc3BvbnNlU3RhdHVzGAUg", + "ASgLMg8uUmVzcG9uc2VTdGF0dXMaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEo", + "CRINCgV2YWx1ZRgCIAEoCToCOAEilgIKKlF1ZXJ5UmVzcG9uc2VfQ3VzdG9t", + "U2VsZWN0Um9ja3N0YXJSZXNwb25zZRIOCgZPZmZzZXQYASABKAUSDQoFVG90", + "YWwYAiABKAUSLgoHUmVzdWx0cxgDIAMoCzIdLkN1c3RvbVNlbGVjdFJvY2tz", + "dGFyUmVzcG9uc2USQwoETWV0YRgEIAMoCzI1LlF1ZXJ5UmVzcG9uc2VfQ3Vz", + "dG9tU2VsZWN0Um9ja3N0YXJSZXNwb25zZS5NZXRhRW50cnkSJwoOUmVzcG9u", + "c2VTdGF0dXMYBSABKAsyDy5SZXNwb25zZVN0YXR1cxorCglNZXRhRW50cnkS", + "CwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLLAQoRUXVlcnlSZXNw", + "b25zZV9Gb28SDgoGT2Zmc2V0GAEgASgFEg0KBVRvdGFsGAIgASgFEhUKB1Jl", + "c3VsdHMYAyADKAsyBC5Gb28SKgoETWV0YRgEIAMoCzIcLlF1ZXJ5UmVzcG9u", + "c2VfRm9vLk1ldGFFbnRyeRInCg5SZXNwb25zZVN0YXR1cxgFIAEoCzIPLlJl", + "c3BvbnNlU3RhdHVzGisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFs", + "dWUYAiABKAk6AjgBItEBChNRdWVyeVJlc3BvbnNlX01vdmllEg4KBk9mZnNl", + "dBgBIAEoBRINCgVUb3RhbBgCIAEoBRIXCgdSZXN1bHRzGAMgAygLMgYuTW92", + "aWUSLAoETWV0YRgEIAMoCzIeLlF1ZXJ5UmVzcG9uc2VfTW92aWUuTWV0YUVu", + "dHJ5EicKDlJlc3BvbnNlU3RhdHVzGAUgASgLMg8uUmVzcG9uc2VTdGF0dXMa", + "KwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEi", + "5AEKG1F1ZXJ5UmVzcG9uc2VfTmFtZWRSb2Nrc3RhchIOCgZPZmZzZXQYASAB", + "KAUSDQoFVG90YWwYAiABKAUSGgoHUmVzdWx0cxgDIAMoCzIJLlJvY2tzdGFy", + "EjQKBE1ldGEYBCADKAsyJi5RdWVyeVJlc3BvbnNlX05hbWVkUm9ja3N0YXIu", + "TWV0YUVudHJ5EicKDlJlc3BvbnNlU3RhdHVzGAUgASgLMg8uUmVzcG9uc2VT", + "dGF0dXMaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEo", + "CToCOAEi4AEKGFF1ZXJ5UmVzcG9uc2VfUGFnaW5nVGVzdBIOCgZPZmZzZXQY", + "ASABKAUSDQoFVG90YWwYAiABKAUSHAoHUmVzdWx0cxgDIAMoCzILLlBhZ2lu", + "Z1Rlc3QSMQoETWV0YRgEIAMoCzIjLlF1ZXJ5UmVzcG9uc2VfUGFnaW5nVGVz", + "dC5NZXRhRW50cnkSJwoOUmVzcG9uc2VTdGF0dXMYBSABKAsyDy5SZXNwb25z", + "ZVN0YXR1cxorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIg", + "ASgJOgI4ASLaAQoWUXVlcnlSZXNwb25zZV9Sb2Nrc3RhchIOCgZPZmZzZXQY", + "ASABKAUSDQoFVG90YWwYAiABKAUSGgoHUmVzdWx0cxgDIAMoCzIJLlJvY2tz", + "dGFyEi8KBE1ldGEYBCADKAsyIS5RdWVyeVJlc3BvbnNlX1JvY2tzdGFyLk1l", + "dGFFbnRyeRInCg5SZXNwb25zZVN0YXR1cxgFIAEoCzIPLlJlc3BvbnNlU3Rh", + "dHVzGisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6", + "AjgBIukBChtRdWVyeVJlc3BvbnNlX1JvY2tzdGFyQWxidW0SDgoGT2Zmc2V0", + "GAEgASgFEg0KBVRvdGFsGAIgASgFEh8KB1Jlc3VsdHMYAyADKAsyDi5Sb2Nr", + "c3RhckFsYnVtEjQKBE1ldGEYBCADKAsyJi5RdWVyeVJlc3BvbnNlX1JvY2tz", + "dGFyQWxidW0uTWV0YUVudHJ5EicKDlJlc3BvbnNlU3RhdHVzGAUgASgLMg8u", + "UmVzcG9uc2VTdGF0dXMaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2", + "YWx1ZRgCIAEoCToCOAEi6QEKG1F1ZXJ5UmVzcG9uc2VfUm9ja3N0YXJBbGlh", + "cxIOCgZPZmZzZXQYASABKAUSDQoFVG90YWwYAiABKAUSHwoHUmVzdWx0cxgD", + "IAMoCzIOLlJvY2tzdGFyQWxpYXMSNAoETWV0YRgEIAMoCzImLlF1ZXJ5UmVz", + "cG9uc2VfUm9ja3N0YXJBbGlhcy5NZXRhRW50cnkSJwoOUmVzcG9uc2VTdGF0", + "dXMYBSABKAsyDy5SZXNwb25zZVN0YXR1cxorCglNZXRhRW50cnkSCwoDa2V5", + "GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLmAQoaUXVlcnlSZXNwb25zZV9S", + "b2Nrc3RhckF1dG8SDgoGT2Zmc2V0GAEgASgFEg0KBVRvdGFsGAIgASgFEh4K", + "B1Jlc3VsdHMYAyADKAsyDS5Sb2Nrc3RhckJhc2USMwoETWV0YRgEIAMoCzIl", + "LlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXJBdXRvLk1ldGFFbnRyeRInCg5SZXNw", + "b25zZVN0YXR1cxgFIAEoCzIPLlJlc3BvbnNlU3RhdHVzGisKCU1ldGFFbnRy", + "eRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIvUBCh9RdWVyeVJl", + "c3BvbnNlX1JvY2tzdGFyUmVmZXJlbmNlEg4KBk9mZnNldBgBIAEoBRINCgVU", + "b3RhbBgCIAEoBRIjCgdSZXN1bHRzGAMgAygLMhIuUm9ja3N0YXJSZWZlcmVu", + "Y2USOAoETWV0YRgEIAMoCzIqLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXJSZWZl", + "cmVuY2UuTWV0YUVudHJ5EicKDlJlc3BvbnNlU3RhdHVzGAUgASgLMg8uUmVz", + "cG9uc2VTdGF0dXMaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1", + "ZRgCIAEoCToCOAEi5gEKGlF1ZXJ5UmVzcG9uc2VfVHlwZVdpdGhFbnVtEg4K", + "Bk9mZnNldBgBIAEoBRINCgVUb3RhbBgCIAEoBRIeCgdSZXN1bHRzGAMgAygL", + "Mg0uVHlwZVdpdGhFbnVtEjMKBE1ldGEYBCADKAsyJS5RdWVyeVJlc3BvbnNl", + "X1R5cGVXaXRoRW51bS5NZXRhRW50cnkSJwoOUmVzcG9uc2VTdGF0dXMYBSAB", + "KAsyDy5SZXNwb25zZVN0YXR1cxorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJ", + "Eg0KBXZhbHVlGAIgASgJOgI4ASKsAgoTUXVlcnlSb2Nrc3RhckFsYnVtcxIM", + "CgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRIT", + "CgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxk", + "cxgGIAEoCRIsCgRNZXRhGAcgAygLMh4uUXVlcnlSb2Nrc3RhckFsYnVtcy5N", + "ZXRhRW50cnkSCwoCSWQYyQEgASgFEhMKClJvY2tzdGFySWQYygEgASgFEg0K", + "BE5hbWUYywEgASgJEg4KBUdlbnJlGMwBIAEoCRIWCglJZEJldHdlZW4YzQEg", + "AygFQgIQABorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIg", + "ASgJOgI4ASKoAgohUXVlcnlSb2Nrc3RhckFsYnVtc0N1c3RvbUxlZnRKb2lu", + "EgwKBFNraXAYASABKAUSDAoEVGFrZRgCIAEoBRIPCgdPcmRlckJ5GAMgASgJ", + "EhMKC09yZGVyQnlEZXNjGAQgASgJEg8KB0luY2x1ZGUYBSABKAkSDgoGRmll", + "bGRzGAYgASgJEjoKBE1ldGEYByADKAsyLC5RdWVyeVJvY2tzdGFyQWxidW1z", + "Q3VzdG9tTGVmdEpvaW4uTWV0YUVudHJ5EgwKA0FnZRjJASABKAUSEgoJQWxi", + "dW1OYW1lGMoBIAEoCRIVCgxJZE5vdEVxdWFsVG8YywEgASgFGisKCU1ldGFF", + "bnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIuMBChtRdWVy", + "eVJvY2tzdGFyQWxidW1zSW1wbGljaXQSDAoEU2tpcBgBIAEoBRIMCgRUYWtl", + "GAIgASgFEg8KB09yZGVyQnkYAyABKAkSEwoLT3JkZXJCeURlc2MYBCABKAkS", + "DwoHSW5jbHVkZRgFIAEoCRIOCgZGaWVsZHMYBiABKAkSNAoETWV0YRgHIAMo", + "CzImLlF1ZXJ5Um9ja3N0YXJBbGJ1bXNJbXBsaWNpdC5NZXRhRW50cnkaKwoJ", + "TWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEinAIK", + "G1F1ZXJ5Um9ja3N0YXJBbGJ1bXNMZWZ0Sm9pbhIMCgRTa2lwGAEgASgFEgwK", + "BFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRITCgtPcmRlckJ5RGVzYxgE", + "IAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxkcxgGIAEoCRI0CgRNZXRh", + "GAcgAygLMiYuUXVlcnlSb2Nrc3RhckFsYnVtc0xlZnRKb2luLk1ldGFFbnRy", + "eRIMCgNBZ2UYyQEgASgFEhIKCUFsYnVtTmFtZRjKASABKAkSFQoMSWROb3RF", + "cXVhbFRvGMsBIAEoBRorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0KBXZh", + "bHVlGAIgASgJOgI4ASL7AQoSUXVlcnlSb2Nrc3RhckFsaWFzEgwKBFNraXAY", + "ASABKAUSDAoEVGFrZRgCIAEoBRIPCgdPcmRlckJ5GAMgASgJEhMKC09yZGVy", + "QnlEZXNjGAQgASgJEg8KB0luY2x1ZGUYBSABKAkSDgoGRmllbGRzGAYgASgJ", + "EisKBE1ldGEYByADKAsyHS5RdWVyeVJvY2tzdGFyQWxpYXMuTWV0YUVudHJ5", + "EgwKA0FnZRjJASABKAUSGgoRUm9ja3N0YXJBbGJ1bU5hbWUYygEgASgJGisK", + "CU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIt4B", + "ChJRdWVyeVJvY2tzdGFyQXVkaXQSDAoEU2tpcBgBIAEoBRIMCgRUYWtlGAIg", + "ASgFEg8KB09yZGVyQnkYAyABKAkSEwoLT3JkZXJCeURlc2MYBCABKAkSDwoH", + "SW5jbHVkZRgFIAEoCRIOCgZGaWVsZHMYBiABKAkSKwoETWV0YRgHIAMoCzId", + "LlF1ZXJ5Um9ja3N0YXJBdWRpdC5NZXRhRW50cnkSCwoCSWQYrQIgASgFGisK", + "CU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIpAC", + "ChdRdWVyeVJvY2tzdGFyQXVkaXRTdWJPchIMCgRTa2lwGAEgASgFEgwKBFRh", + "a2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRITCgtPcmRlckJ5RGVzYxgEIAEo", + "CRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxkcxgGIAEoCRIwCgRNZXRhGAcg", + "AygLMiIuUXVlcnlSb2Nrc3RhckF1ZGl0U3ViT3IuTWV0YUVudHJ5EhwKE0Zp", + "cnN0TmFtZVN0YXJ0c1dpdGgYyQEgASgJEhUKDEFnZU9sZGVyVGhhbhjKASAB", + "KAUaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToC", + "OAEiqAIKFFF1ZXJ5Um9ja3N0YXJGaWx0ZXJzEgwKBFNraXAYASABKAUSDAoE", + "VGFrZRgCIAEoBRIPCgdPcmRlckJ5GAMgASgJEhMKC09yZGVyQnlEZXNjGAQg", + "ASgJEg8KB0luY2x1ZGUYBSABKAkSDgoGRmllbGRzGAYgASgJEi0KBE1ldGEY", + "ByADKAsyHy5RdWVyeVJvY2tzdGFyRmlsdGVycy5NZXRhRW50cnkSEAoDSWRz", + "GMkBIAMoBUICEAASEQoEQWdlcxjKASADKAVCAhAAEhMKCkZpcnN0TmFtZXMY", + "ywEgAygJEhcKCklkc0JldHdlZW4YzAEgAygFQgIQABorCglNZXRhRW50cnkS", + "CwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLXAQoOUXVlcnlSb2Nr", + "c3RhcnMSDAoEU2tpcBgBIAEoBRIMCgRUYWtlGAIgASgFEg8KB09yZGVyQnkY", + "AyABKAkSEwoLT3JkZXJCeURlc2MYBCABKAkSDwoHSW5jbHVkZRgFIAEoCRIO", + "CgZGaWVsZHMYBiABKAkSJwoETWV0YRgHIAMoCzIZLlF1ZXJ5Um9ja3N0YXJz", + "Lk1ldGFFbnRyeRIMCgNBZ2UYyQEgASgFGisKCU1ldGFFbnRyeRILCgNrZXkY", + "ASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIoAFChlRdWVyeVJvY2tzdGFyc0Nv", + "bnZlbnRpb25zEgwKBFNraXAYASABKAUSDAoEVGFrZRgCIAEoBRIPCgdPcmRl", + "ckJ5GAMgASgJEhMKC09yZGVyQnlEZXNjGAQgASgJEg8KB0luY2x1ZGUYBSAB", + "KAkSDgoGRmllbGRzGAYgASgJEjIKBE1ldGEYByADKAsyJC5RdWVyeVJvY2tz", + "dGFyc0NvbnZlbnRpb25zLk1ldGFFbnRyeRI7ChZEYXRlT2ZCaXJ0aEdyZWF0", + "ZXJUaGFuGMkBIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASNQoQ", + "RGF0ZURpZWRMZXNzVGhhbhjKASABKAsyGi5nb29nbGUucHJvdG9idWYuVGlt", + "ZXN0YW1wEhAKA0lkcxjLASADKAVCAhAAEhUKDEFnZU9sZGVyVGhhbhjMASAB", + "KAUSIAoXQWdlR3JlYXRlclRoYW5PckVxdWFsVG8YzQEgASgFEhcKDkFnZUdy", + "ZWF0ZXJUaGFuGM4BIAEoBRIXCg5HcmVhdGVyVGhhbkFnZRjPASABKAUSHAoT", + "Rmlyc3ROYW1lU3RhcnRzV2l0aBjQASABKAkSGQoQTGFzdE5hbWVFbmRzV2l0", + "aBjRASABKAkSGQoQTGFzdE5hbWVDb250YWlucxjSASABKAkSIgoZUm9ja3N0", + "YXJBbGJ1bU5hbWVDb250YWlucxjTASABKAkSGAoPUm9ja3N0YXJJZEFmdGVy", + "GNQBIAEoBRIcChNSb2Nrc3RhcklkT25PckFmdGVyGNUBIAEoBRorCglNZXRh", + "RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLjAQoUUXVl", + "cnlSb2Nrc3RhcnNGaWx0ZXISDAoEU2tpcBgBIAEoBRIMCgRUYWtlGAIgASgF", + "Eg8KB09yZGVyQnkYAyABKAkSEwoLT3JkZXJCeURlc2MYBCABKAkSDwoHSW5j", + "bHVkZRgFIAEoCRIOCgZGaWVsZHMYBiABKAkSLQoETWV0YRgHIAMoCzIfLlF1", + "ZXJ5Um9ja3N0YXJzRmlsdGVyLk1ldGFFbnRyeRIMCgNBZ2UYyQEgASgFGisK", + "CU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIuUB", + "ChVRdWVyeVJvY2tzdGFyc0lGaWx0ZXISDAoEU2tpcBgBIAEoBRIMCgRUYWtl", + "GAIgASgFEg8KB09yZGVyQnkYAyABKAkSEwoLT3JkZXJCeURlc2MYBCABKAkS", + "DwoHSW5jbHVkZRgFIAEoCRIOCgZGaWVsZHMYBiABKAkSLgoETWV0YRgHIAMo", + "CzIgLlF1ZXJ5Um9ja3N0YXJzSUZpbHRlci5NZXRhRW50cnkSDAoDQWdlGMkB", + "IAEoBRorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJ", + "OgI4ASLZAQoWUXVlcnlSb2Nrc3RhcnNJbXBsaWNpdBIMCgRTa2lwGAEgASgF", + "EgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRITCgtPcmRlckJ5RGVz", + "YxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxkcxgGIAEoCRIvCgRN", + "ZXRhGAcgAygLMiEuUXVlcnlSb2Nrc3RhcnNJbXBsaWNpdC5NZXRhRW50cnka", + "KwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEi", + "8wEKHFF1ZXJ5Um9ja3N0YXJzV2l0aFJlZmVyZW5jZXMSDAoEU2tpcBgBIAEo", + "BRIMCgRUYWtlGAIgASgFEg8KB09yZGVyQnkYAyABKAkSEwoLT3JkZXJCeURl", + "c2MYBCABKAkSDwoHSW5jbHVkZRgFIAEoCRIOCgZGaWVsZHMYBiABKAkSNQoE", + "TWV0YRgHIAMoCzInLlF1ZXJ5Um9ja3N0YXJzV2l0aFJlZmVyZW5jZXMuTWV0", + "YUVudHJ5EgwKA0FnZRjJASABKAUaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEo", + "CRINCgV2YWx1ZRgCIAEoCToCOAEi0QEKElF1ZXJ5VHlwZVdpdGhFbnVtcxIM", + "CgRTa2lwGAEgASgFEgwKBFRha2UYAiABKAUSDwoHT3JkZXJCeRgDIAEoCRIT", + "CgtPcmRlckJ5RGVzYxgEIAEoCRIPCgdJbmNsdWRlGAUgASgJEg4KBkZpZWxk", + "cxgGIAEoCRIrCgRNZXRhGAcgAygLMh0uUXVlcnlUeXBlV2l0aEVudW1zLk1l", + "dGFFbnRyeRorCglNZXRhRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIg", + "ASgJOgI4ASKGAgoVUXVlcnlVbmtub3duUm9ja3N0YXJzEgwKBFNraXAYASAB", + "KAUSDAoEVGFrZRgCIAEoBRIPCgdPcmRlckJ5GAMgASgJEhMKC09yZGVyQnlE", + "ZXNjGAQgASgJEg8KB0luY2x1ZGUYBSABKAkSDgoGRmllbGRzGAYgASgJEi4K", + "BE1ldGEYByADKAsyIC5RdWVyeVVua25vd25Sb2Nrc3RhcnMuTWV0YUVudHJ5", + "EhMKClVua25vd25JbnQYyQEgASgFEhgKD1Vua25vd25Qcm9wZXJ0eRjKASAB", + "KAkaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToC", + "OAEiRQoVUmVhbERlbGV0ZUF1ZGl0VGVuYW50EhMKC0JlYXJlclRva2VuGAEg", + "ASgJEgoKAklkGAIgASgFEgsKA0FnZRgDIAEoBSIqChxSZWFsRGVsZXRlQXVk", + "aXRUZW5hbnRHYXRld2F5EgoKAklkGAEgASgFIiUKF1JlYWxEZWxldGVBdWRp", + "dFRlbmFudE1xEgoKAklkGAEgASgFIoEBChFSZWdlbmVyYXRlQXBpS2V5cxIT", + "CgtFbnZpcm9ubWVudBgBIAEoCRIqCgRNZXRhGAIgAygLMhwuUmVnZW5lcmF0", + "ZUFwaUtleXMuTWV0YUVudHJ5GisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkS", + "DQoFdmFsdWUYAiABKAk6AjgBIsMBChlSZWdlbmVyYXRlQXBpS2V5c1Jlc3Bv", + "bnNlEhwKB1Jlc3VsdHMYASADKAsyCy5Vc2VyQXBpS2V5EjIKBE1ldGEYAiAD", + "KAsyJC5SZWdlbmVyYXRlQXBpS2V5c1Jlc3BvbnNlLk1ldGFFbnRyeRInCg5S", + "ZXNwb25zZVN0YXR1cxgDIAEoCzIPLlJlc3BvbnNlU3RhdHVzGisKCU1ldGFF", + "bnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIoYCCghSZWdp", + "c3RlchIQCghVc2VyTmFtZRgBIAEoCRIRCglGaXJzdE5hbWUYAiABKAkSEAoI", + "TGFzdE5hbWUYAyABKAkSEwoLRGlzcGxheU5hbWUYBCABKAkSDQoFRW1haWwY", + "BSABKAkSEAoIUGFzc3dvcmQYBiABKAkSFwoPQ29uZmlybVBhc3N3b3JkGAcg", + "ASgJEhEKCUF1dG9Mb2dpbhgIIAEoCBIRCglFcnJvclZpZXcYCiABKAkSIQoE", + "TWV0YRgLIAMoCzITLlJlZ2lzdGVyLk1ldGFFbnRyeRorCglNZXRhRW50cnkS", + "CwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASKIAgoQUmVnaXN0ZXJS", + "ZXNwb25zZRIOCgZVc2VySWQYASABKAkSEQoJU2Vzc2lvbklkGAIgASgJEhAK", + "CFVzZXJOYW1lGAMgASgJEhMKC1JlZmVycmVyVXJsGAQgASgJEhMKC0JlYXJl", + "clRva2VuGAUgASgJEhQKDFJlZnJlc2hUb2tlbhgGIAEoCRInCg5SZXNwb25z", + "ZVN0YXR1cxgHIAEoCzIPLlJlc3BvbnNlU3RhdHVzEikKBE1ldGEYCCADKAsy", + "Gy5SZWdpc3RlclJlc3BvbnNlLk1ldGFFbnRyeRorCglNZXRhRW50cnkSCwoD", + "a2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASIxCgxSZXF1aXJlc0F1dGgS", + "DAoETmFtZRgBIAEoCRITCgtCZWFyZXJUb2tlbhgCIAEoCSIMCgpSZXNldFRv", + "ZG9zIpsBCg1SZXNwb25zZUVycm9yEhEKCUVycm9yQ29kZRgBIAEoCRIRCglG", + "aWVsZE5hbWUYAiABKAkSDwoHTWVzc2FnZRgDIAEoCRImCgRNZXRhGAQgAygL", + "MhguUmVzcG9uc2VFcnJvci5NZXRhRW50cnkaKwoJTWV0YUVudHJ5EgsKA2tl", + "eRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEivgEKDlJlc3BvbnNlU3RhdHVz", + "EhEKCUVycm9yQ29kZRgBIAEoCRIPCgdNZXNzYWdlGAIgASgJEhIKClN0YWNr", + "VHJhY2UYAyABKAkSHgoGRXJyb3JzGAQgAygLMg4uUmVzcG9uc2VFcnJvchIn", + "CgRNZXRhGAUgAygLMhkuUmVzcG9uc2VTdGF0dXMuTWV0YUVudHJ5GisKCU1l", + "dGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIoQCCghS", + "b2Nrc3RhchIKCgJJZBgBIAEoBRIRCglGaXJzdE5hbWUYAiABKAkSEAoITGFz", + "dE5hbWUYAyABKAkSCwoDQWdlGAQgASgFEi8KC0RhdGVPZkJpcnRoGAUgASgL", + "MhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIsCghEYXRlRGllZBgGIAEo", + "CzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASIwoMTGl2aW5nU3RhdHVz", + "GAcgASgOMg0uTGl2aW5nU3RhdHVzEisKDU5hbWVkUm9ja3N0YXIYqNzGpAEg", + "ASgLMg4uTmFtZWRSb2Nrc3RhckgAQgkKB3N1YnR5cGUiTAoNUm9ja3N0YXJB", + "bGJ1bRIKCgJJZBgBIAEoBRISCgpSb2Nrc3RhcklkGAIgASgFEgwKBE5hbWUY", + "AyABKAkSDQoFR2VucmUYBCABKAkiVgoNUm9ja3N0YXJBbGlhcxISCgpSb2Nr", + "c3RhcklkGAEgASgFEhEKCUZpcnN0TmFtZRgCIAEoCRIPCgdTdXJuYW1lGAMg", + "ASgJEg0KBWFsYnVtGAQgASgJItABCg1Sb2Nrc3RhckF1ZGl0EgoKAklkGAEg", + "ASgFEi8KC0NyZWF0ZWREYXRlGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRp", + "bWVzdGFtcBIRCglDcmVhdGVkQnkYAyABKAkSEwoLQ3JlYXRlZEluZm8YBCAB", + "KAkSMAoMTW9kaWZpZWREYXRlGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRp", + "bWVzdGFtcBISCgpNb2RpZmllZEJ5GAYgASgJEhQKDE1vZGlmaWVkSW5mbxgH", + "IAEoCSLpAQoTUm9ja3N0YXJBdWRpdFRlbmFudBIQCghUZW5hbnRJZBgBIAEo", + "BRIKCgJJZBgCIAEoBRIRCglGaXJzdE5hbWUYAyABKAkSEAoITGFzdE5hbWUY", + "BCABKAkSCwoDQWdlGAUgASgFEi8KC0RhdGVPZkJpcnRoGAYgASgLMhouZ29v", + "Z2xlLnByb3RvYnVmLlRpbWVzdGFtcBIsCghEYXRlRGllZBgHIAEoCzIaLmdv", + "b2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASIwoMTGl2aW5nU3RhdHVzGAggASgO", + "Mg0uTGl2aW5nU3RhdHVzIhoKDFJvY2tzdGFyQXV0bxIKCgJJZBgBIAEoBSIe", + "ChBSb2Nrc3RhckF1dG9HdWlkEgoKAklkGAEgASgJIogDCgxSb2Nrc3RhckJh", + "c2USEQoJRmlyc3ROYW1lGAEgASgJEhAKCExhc3ROYW1lGAIgASgJEgsKA0Fn", + "ZRgDIAEoBRIvCgtEYXRlT2ZCaXJ0aBgEIAEoCzIaLmdvb2dsZS5wcm90b2J1", + "Zi5UaW1lc3RhbXASLAoIRGF0ZURpZWQYBSABKAsyGi5nb29nbGUucHJvdG9i", + "dWYuVGltZXN0YW1wEiMKDExpdmluZ1N0YXR1cxgGIAEoDjINLkxpdmluZ1N0", + "YXR1cxIwChBSb2Nrc3RhckF1dG9HdWlkGL2k7ysgASgLMhEuUm9ja3N0YXJB", + "dXRvR3VpZEgAEigKDFJvY2tzdGFyQXV0bxif+P4rIAEoCzINLlJvY2tzdGFy", + "QXV0b0gAEioKDVJvY2tzdGFyQXVkaXQY+MuUOSABKAsyDi5Sb2Nrc3RhckF1", + "ZGl0SAASLwoPUm9ja3N0YXJWZXJzaW9uGKOq85gBIAEoCzIQLlJvY2tzdGFy", + "VmVyc2lvbkgAQgkKB3N1YnR5cGUiPQoNUm9ja3N0YXJHZW5yZRIKCgJJZBgB", + "IAEoBRISCgpSb2Nrc3RhcklkGAIgASgFEgwKBE5hbWUYAyABKAkicQoRUm9j", + "a3N0YXJSZWZlcmVuY2USCgoCSWQYASABKAUSEQoJRmlyc3ROYW1lGAIgASgJ", + "EhAKCExhc3ROYW1lGAMgASgJEgsKA0FnZRgEIAEoBRIeCgZBbGJ1bXMYBSAD", + "KAsyDi5Sb2Nrc3RhckFsYnVtIjEKD1JvY2tzdGFyVmVyc2lvbhIKCgJJZBgB", + "IAEoBRISCgpSb3dWZXJzaW9uGAIgASgEImQKHlJvY2tzdGFyV2l0aElkQW5k", + "Q291bnRSZXNwb25zZRIKCgJJZBgBIAEoBRINCgVDb3VudBgCIAEoBRInCg5S", + "ZXNwb25zZVN0YXR1cxgDIAEoCzIPLlJlc3BvbnNlU3RhdHVzInUKH1JvY2tz", + "dGFyV2l0aElkQW5kUmVzdWx0UmVzcG9uc2USCgoCSWQYASABKAUSHQoGUmVz", + "dWx0GAIgASgLMg0uUm9ja3N0YXJCYXNlEicKDlJlc3BvbnNlU3RhdHVzGAMg", + "ASgLMg8uUmVzcG9uc2VTdGF0dXMibgojUm9ja3N0YXJXaXRoSWRBbmRSb3dW", + "ZXJzaW9uUmVzcG9uc2USCgoCSWQYASABKAUSEgoKUm93VmVyc2lvbhgCIAEo", + "DRInCg5SZXNwb25zZVN0YXR1cxgDIAEoCzIPLlJlc3BvbnNlU3RhdHVzIk0K", + "FlJvY2tzdGFyV2l0aElkUmVzcG9uc2USCgoCSWQYASABKAUSJwoOUmVzcG9u", + "c2VTdGF0dXMYAiABKAsyDy5SZXNwb25zZVN0YXR1cyLFAQoMU2VhcmNoTW92", + "aWVzEgwKBFNraXAYASABKAUSDAoEVGFrZRgCIAEoBRIPCgdPcmRlckJ5GAMg", + "ASgJEhMKC09yZGVyQnlEZXNjGAQgASgJEg8KB0luY2x1ZGUYBSABKAkSDgoG", + "RmllbGRzGAYgASgJEiUKBE1ldGEYByADKAsyFy5TZWFyY2hNb3ZpZXMuTWV0", + "YUVudHJ5GisKCU1ldGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiAB", + "KAk6AjgBIioKDFNlYXJjaFJlc3VsdBIKCgJJZBgBIAEoBRIOCgZTdWZmaXgY", + "AiABKAkiFwoHU2VjdXJlZBIMCgROYW1lGAEgASgJIkoKD1NlY3VyZWRSZXNw", + "b25zZRIOCgZSZXN1bHQYASABKAkSJwoOUmVzcG9uc2VTdGF0dXMYAiABKAsy", + "Dy5SZXNwb25zZVN0YXR1cyJJCkdTb2Z0RGVsZXRlQXVkaXRCYXNlX1JvY2tz", + "dGFyQXVkaXRUZW5hbnRfUm9ja3N0YXJXaXRoSWRBbmRSZXN1bHRSZXNwb25z", + "ZSIkChVTb2Z0RGVsZXRlQXVkaXRUZW5hbnQSCwoCSWQYyQEgASgFIk8KTVNv", + "ZnREZWxldGVBdWRpdFRlbmFudEJhc2VfUm9ja3N0YXJBdWRpdFRlbmFudF9S", + "b2Nrc3RhcldpdGhJZEFuZFJlc3VsdFJlc3BvbnNlIhwKC1N0cmVhbUZpbGVz", + "Eg0KBVBhdGhzGAEgAygJItcBCgxTdHJlYW1Nb3ZpZXMSDAoEU2tpcBgBIAEo", + "BRIMCgRUYWtlGAIgASgFEg8KB09yZGVyQnkYAyABKAkSEwoLT3JkZXJCeURl", + "c2MYBCABKAkSDwoHSW5jbHVkZRgFIAEoCRIOCgZGaWVsZHMYBiABKAkSJQoE", + "TWV0YRgHIAMoCzIXLlN0cmVhbU1vdmllcy5NZXRhRW50cnkSEAoHUmF0aW5n", + "cxjJASADKAkaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgC", + "IAEoCToCOAEiJgoSU3RyZWFtU2VydmVyRXZlbnRzEhAKCENoYW5uZWxzGAEg", + "AygJIpsEChpTdHJlYW1TZXJ2ZXJFdmVudHNSZXNwb25zZRIPCgdFdmVudElk", + "GAEgASgDEg8KB0NoYW5uZWwYAiABKAkSEAoIU2VsZWN0b3IYBCABKAkSDAoE", + "SnNvbhgFIAEoCRIKCgJPcBgGIAEoCRIOCgZUYXJnZXQYByABKAkSEwoLQ3Nz", + "U2VsZWN0b3IYCCABKAkSMwoETWV0YRgJIAMoCzIlLlN0cmVhbVNlcnZlckV2", + "ZW50c1Jlc3BvbnNlLk1ldGFFbnRyeRIOCgZVc2VySWQYCiABKAkSEwoLRGlz", + "cGxheU5hbWUYCyABKAkSEgoKUHJvZmlsZVVybBgMIAEoCRIXCg9Jc0F1dGhl", + "bnRpY2F0ZWQYDSABKAgSEAoIQ2hhbm5lbHMYDiADKAkSEQoJQ3JlYXRlZEF0", + "GA8gASgDEgoKAklkGBUgASgJEhUKDVVuUmVnaXN0ZXJVcmwYFiABKAkSGwoT", + "VXBkYXRlU3Vic2NyaWJlclVybBgXIAEoCRIUCgxIZWFydGJlYXRVcmwYGCAB", + "KAkSGwoTSGVhcnRiZWF0SW50ZXJ2YWxNcxgZIAEoAxIVCg1JZGxlVGltZW91", + "dE1zGBogASgDEicKDlJlc3BvbnNlU3RhdHVzGB4gASgLMg8uUmVzcG9uc2VT", + "dGF0dXMaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEo", + "CToCOAEiJQoSVGVzdEF1dGhWYWxpZGF0b3JzEg8KB05vdE51bGwYASABKAki", + "LgoPVGVzdERiQ29uZGl0aW9uEgoKAklkGAEgASgFEg8KB05vdE51bGwYAiAB", + "KAkiLgoPVGVzdERiVmFsaWRhdG9yEgoKAklkGAEgASgFEg8KB05vdE51bGwY", + "AiABKAkiHgoLVGVzdElzQWRtaW4SDwoHTm90TnVsbBgBIAEoCSIqChdUZXN0", + "TXVsdGlBdXRoVmFsaWRhdG9ycxIPCgdOb3ROdWxsGAEgASgJIhgKBVRocm93", + "Eg8KB01lc3NhZ2UYASABKAkiDQoLVGhyb3dDdXN0b20iPgoTVGhyb3dDdXN0", + "b21SZXNwb25zZRInCg5SZXNwb25zZVN0YXR1cxgBIAEoCzIPLlJlc3BvbnNl", + "U3RhdHVzIhwKCVRocm93Vm9pZBIPCgdNZXNzYWdlGAEgASgJIkMKBFRvZG8S", + "CgoCSWQYASABKAMSDQoFVGl0bGUYAiABKAkSDQoFT3JkZXIYAyABKAUSEQoJ", + "Q29tcGxldGVkGAQgASgIItwCChRUcmlnZ2VyQWxsVmFsaWRhdG9ycxISCgpD", + "cmVkaXRDYXJkGAEgASgJEg0KBUVtYWlsGAIgASgJEg0KBUVtcHR5GAMgASgJ", + "Eg0KBUVxdWFsGAQgASgJEhgKEEV4Y2x1c2l2ZUJldHdlZW4YBSABKAUSGgoS", + "R3JlYXRlclRoYW5PckVxdWFsGAYgASgFEhMKC0dyZWF0ZXJUaGFuGAcgASgF", + "EhgKEEluY2x1c2l2ZUJldHdlZW4YCCABKAUSDgoGTGVuZ3RoGAkgASgJEhcK", + "D0xlc3NUaGFuT3JFcXVhbBgKIAEoBRIQCghMZXNzVGhhbhgLIAEoBRIQCghO", + "b3RFbXB0eRgMIAEoCRIQCghOb3RFcXVhbBgNIAEoCRIMCgROdWxsGA4gASgJ", + "EhkKEVJlZ3VsYXJFeHByZXNzaW9uGA8gASgJEhYKDlNjYWxlUHJlY2lzaW9u", + "GBAgASgJItkCChFUcmlnZ2VyVmFsaWRhdG9ycxISCgpDcmVkaXRDYXJkGAEg", + "ASgJEg0KBUVtYWlsGAIgASgJEg0KBUVtcHR5GAMgASgJEg0KBUVxdWFsGAQg", + "ASgJEhgKEEV4Y2x1c2l2ZUJldHdlZW4YBSABKAUSGgoSR3JlYXRlclRoYW5P", + "ckVxdWFsGAYgASgFEhMKC0dyZWF0ZXJUaGFuGAcgASgFEhgKEEluY2x1c2l2", + "ZUJldHdlZW4YCCABKAUSDgoGTGVuZ3RoGAkgASgJEhcKD0xlc3NUaGFuT3JF", + "cXVhbBgKIAEoBRIQCghMZXNzVGhhbhgLIAEoBRIQCghOb3RFbXB0eRgMIAEo", + "CRIQCghOb3RFcXVhbBgNIAEoCRIMCgROdWxsGA4gASgJEhkKEVJlZ3VsYXJF", + "eHByZXNzaW9uGA8gASgJEhYKDlNjYWxlUHJlY2lzaW9uGBAgASgJIrIBCgxU", + "eXBlV2l0aEVudW0SCgoCSWQYASABKAUSDAoETmFtZRgCIAEoCRIbCghTb21l", + "RW51bRgDIAEoDjIJLlNvbWVFbnVtEiUKDVNvbWVFbnVtQXNJbnQYBCABKA4y", + "Di5Tb21lRW51bUFzSW50EhwKCU5Tb21lRW51bRgFIAEoDjIJLlNvbWVFbnVt", + "EiYKDk5Tb21lRW51bUFzSW50GAYgASgOMg4uU29tZUVudW1Bc0ludCKaAQoN", + "VW5Bc3NpZ25Sb2xlcxIQCghVc2VyTmFtZRgBIAEoCRITCgtQZXJtaXNzaW9u", + "cxgCIAMoCRINCgVSb2xlcxgDIAMoCRImCgRNZXRhGAQgAygLMhguVW5Bc3Np", + "Z25Sb2xlcy5NZXRhRW50cnkaKwoJTWV0YUVudHJ5EgsKA2tleRgBIAEoCRIN", + "CgV2YWx1ZRgCIAEoCToCOAEixwEKFVVuQXNzaWduUm9sZXNSZXNwb25zZRIQ", + "CghBbGxSb2xlcxgBIAMoCRIWCg5BbGxQZXJtaXNzaW9ucxgCIAMoCRIuCgRN", + "ZXRhGAMgAygLMiAuVW5Bc3NpZ25Sb2xlc1Jlc3BvbnNlLk1ldGFFbnRyeRIn", + "Cg5SZXNwb25zZVN0YXR1cxgEIAEoCzIPLlJlc3BvbnNlU3RhdHVzGisKCU1l", + "dGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIkUKQ1Vw", + "ZGF0ZUF1ZGl0QmFzZV9Sb2Nrc3RhckF1ZGl0VGVuYW50X1JvY2tzdGFyV2l0", + "aElkQW5kUmVzdWx0UmVzcG9uc2UiSwpJVXBkYXRlQXVkaXRUZW5hbnRCYXNl", + "X1JvY2tzdGFyQXVkaXRUZW5hbnRfUm9ja3N0YXJXaXRoSWRBbmRSZXN1bHRS", + "ZXNwb25zZSLgAQocVXBkYXRlQ29ubmVjdGlvbkluZm9Sb2Nrc3RhchIRCglG", + "aXJzdE5hbWUYASABKAkSEAoITGFzdE5hbWUYAiABKAkSCwoDQWdlGAMgASgF", + "Ei8KC0RhdGVPZkJpcnRoGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVz", + "dGFtcBIsCghEYXRlRGllZBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1l", + "c3RhbXASIwoMTGl2aW5nU3RhdHVzGAYgASgOMg0uTGl2aW5nU3RhdHVzEgoK", + "AklkGGUgASgFItcBChNVcGRhdGVOYW1lZFJvY2tzdGFyEhEKCUZpcnN0TmFt", + "ZRgBIAEoCRIQCghMYXN0TmFtZRgCIAEoCRILCgNBZ2UYAyABKAUSLwoLRGF0", + "ZU9mQmlydGgYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiwK", + "CERhdGVEaWVkGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIj", + "CgxMaXZpbmdTdGF0dXMYBiABKA4yDS5MaXZpbmdTdGF0dXMSCgoCSWQYZSAB", + "KAUi0gEKDlVwZGF0ZVJvY2tzdGFyEhEKCUZpcnN0TmFtZRgBIAEoCRIQCghM", + "YXN0TmFtZRgCIAEoCRILCgNBZ2UYAyABKAUSLwoLRGF0ZU9mQmlydGgYBCAB", + "KAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiwKCERhdGVEaWVkGAUg", + "ASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIjCgxMaXZpbmdTdGF0", + "dXMYBiABKA4yDS5MaXZpbmdTdGF0dXMSCgoCSWQYZSABKAUi4gEKHlVwZGF0", + "ZVJvY2tzdGFyQWRob2NOb25EZWZhdWx0cxIKCgJJZBgBIAEoBRIRCglGaXJz", + "dE5hbWUYAiABKAkSEAoITGFzdE5hbWUYAyABKAkSCwoDQWdlGAQgASgFEi8K", + "C0RhdGVPZkJpcnRoGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFt", + "cBIsCghEYXRlRGllZBgGIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3Rh", + "bXASIwoMTGl2aW5nU3RhdHVzGAcgASgOMg0uTGl2aW5nU3RhdHVzItcBChNV", + "cGRhdGVSb2Nrc3RhckF1ZGl0EhEKCUZpcnN0TmFtZRgBIAEoCRIQCghMYXN0", + "TmFtZRgCIAEoCRILCgNBZ2UYAyABKAUSLwoLRGF0ZU9mQmlydGgYBCABKAsy", + "Gi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiwKCERhdGVEaWVkGAUgASgL", + "MhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIjCgxMaXZpbmdTdGF0dXMY", + "BiABKA4yDS5MaXZpbmdTdGF0dXMSCgoCSWQYZSABKAUieAoZVXBkYXRlUm9j", + "a3N0YXJBdWRpdFRlbmFudBIUCgtCZWFyZXJUb2tlbhjJASABKAkSCwoCSWQY", + "ygEgASgFEhIKCUZpcnN0TmFtZRjLASABKAkSJAoMTGl2aW5nU3RhdHVzGMwB", + "IAEoDjINLkxpdmluZ1N0YXR1cyJmCiBVcGRhdGVSb2Nrc3RhckF1ZGl0VGVu", + "YW50R2F0ZXdheRIKCgJJZBgBIAEoBRIRCglGaXJzdE5hbWUYAiABKAkSIwoM", + "TGl2aW5nU3RhdHVzGAMgASgOMg0uTGl2aW5nU3RhdHVzImEKG1VwZGF0ZVJv", + "Y2tzdGFyQXVkaXRUZW5hbnRNcRIKCgJJZBgBIAEoBRIRCglGaXJzdE5hbWUY", + "AiABKAkSIwoMTGl2aW5nU3RhdHVzGAMgASgOMg0uTGl2aW5nU3RhdHVzIu0B", + "ChVVcGRhdGVSb2Nrc3RhclZlcnNpb24SEQoJRmlyc3ROYW1lGAEgASgJEhAK", + "CExhc3ROYW1lGAIgASgJEgsKA0FnZRgDIAEoBRIvCgtEYXRlT2ZCaXJ0aBgE", + "IAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASLAoIRGF0ZURpZWQY", + "BSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiMKDExpdmluZ1N0", + "YXR1cxgGIAEoDjINLkxpdmluZ1N0YXR1cxIKCgJJZBhlIAEoBRISCgpSb3dW", + "ZXJzaW9uGGYgASgEIkkKClVwZGF0ZVRvZG8SCgoCSWQYASABKAMSDQoFVGl0", + "bGUYAiABKAkSDQoFT3JkZXIYAyABKAUSEQoJQ29tcGxldGVkGAQgASgIIqwB", + "CgpVc2VyQXBpS2V5EgsKA0tleRgBIAEoCRIPCgdLZXlUeXBlGAIgASgJEi4K", + "CkV4cGlyeURhdGUYAyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1w", + "EiMKBE1ldGEYBCADKAsyFS5Vc2VyQXBpS2V5Lk1ldGFFbnRyeRorCglNZXRh", + "RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASLOAQoWVmFs", + "aWRhdGVDcmVhdGVSb2Nrc3RhchIRCglGaXJzdE5hbWUYASABKAkSEAoITGFz", + "dE5hbWUYAiABKAkSCwoDQWdlGAMgASgFEi8KC0RhdGVPZkJpcnRoGAQgASgL", + "MhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIsCghEYXRlRGllZBgFIAEo", + "CzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASIwoMTGl2aW5nU3RhdHVz", + "GAYgASgOMg0uTGl2aW5nU3RhdHVzKo8LCg5IdHRwU3RhdHVzQ29kZRIICgRa", + "RVJPEAASDAoIQ29udGludWUQZBIWChJTd2l0Y2hpbmdQcm90b2NvbHMQZRIO", + "CgpQcm9jZXNzaW5nEGYSDgoKRWFybHlIaW50cxBnEgcKAk9LEMgBEgwKB0Ny", + "ZWF0ZWQQyQESDQoIQWNjZXB0ZWQQygESIAobTm9uQXV0aG9yaXRhdGl2ZUlu", + "Zm9ybWF0aW9uEMsBEg4KCU5vQ29udGVudBDMARIRCgxSZXNldENvbnRlbnQQ", + "zQESEwoOUGFydGlhbENvbnRlbnQQzgESEAoLTXVsdGlTdGF0dXMQzwESFAoP", + "QWxyZWFkeVJlcG9ydGVkENABEgsKBklNVXNlZBDiARIUCg9NdWx0aXBsZUNo", + "b2ljZXMQrAISDgoJQW1iaWd1b3VzEKwCEhUKEE1vdmVkUGVybWFuZW50bHkQ", + "rQISCgoFTW92ZWQQrQISCgoFRm91bmQQrgISDQoIUmVkaXJlY3QQrgISDQoI", + "U2VlT3RoZXIQrwISEwoOUmVkaXJlY3RNZXRob2QQrwISEAoLTm90TW9kaWZp", + "ZWQQsAISDQoIVXNlUHJveHkQsQISCwoGVW51c2VkELICEhYKEVRlbXBvcmFy", + "eVJlZGlyZWN0ELMCEhUKEFJlZGlyZWN0S2VlcFZlcmIQswISFgoRUGVybWFu", + "ZW50UmVkaXJlY3QQtAISDwoKQmFkUmVxdWVzdBCQAxIRCgxVbmF1dGhvcml6", + "ZWQQkQMSFAoPUGF5bWVudFJlcXVpcmVkEJIDEg4KCUZvcmJpZGRlbhCTAxIN", + "CghOb3RGb3VuZBCUAxIVChBNZXRob2ROb3RBbGxvd2VkEJUDEhIKDU5vdEFj", + "Y2VwdGFibGUQlgMSIAobUHJveHlBdXRoZW50aWNhdGlvblJlcXVpcmVkEJcD", + "EhMKDlJlcXVlc3RUaW1lb3V0EJgDEg0KCENvbmZsaWN0EJkDEgkKBEdvbmUQ", + "mgMSEwoOTGVuZ3RoUmVxdWlyZWQQmwMSFwoSUHJlY29uZGl0aW9uRmFpbGVk", + "EJwDEhoKFVJlcXVlc3RFbnRpdHlUb29MYXJnZRCdAxIWChFSZXF1ZXN0VXJp", + "VG9vTG9uZxCeAxIZChRVbnN1cHBvcnRlZE1lZGlhVHlwZRCfAxIhChxSZXF1", + "ZXN0ZWRSYW5nZU5vdFNhdGlzZmlhYmxlEKADEhYKEUV4cGVjdGF0aW9uRmFp", + "bGVkEKEDEhcKEk1pc2RpcmVjdGVkUmVxdWVzdBClAxIYChNVbnByb2Nlc3Nh", + "YmxlRW50aXR5EKYDEgsKBkxvY2tlZBCnAxIVChBGYWlsZWREZXBlbmRlbmN5", + "EKgDEhQKD1VwZ3JhZGVSZXF1aXJlZBCqAxIZChRQcmVjb25kaXRpb25SZXF1", + "aXJlZBCsAxIUCg9Ub29NYW55UmVxdWVzdHMQrQMSIAobUmVxdWVzdEhlYWRl", + "ckZpZWxkc1Rvb0xhcmdlEK8DEh8KGlVuYXZhaWxhYmxlRm9yTGVnYWxSZWFz", + "b25zEMMDEhgKE0ludGVybmFsU2VydmVyRXJyb3IQ9AMSEwoOTm90SW1wbGVt", + "ZW50ZWQQ9QMSDwoKQmFkR2F0ZXdheRD2AxIXChJTZXJ2aWNlVW5hdmFpbGFi", + "bGUQ9wMSEwoOR2F0ZXdheVRpbWVvdXQQ+AMSHAoXSHR0cFZlcnNpb25Ob3RT", + "dXBwb3J0ZWQQ+QMSGgoVVmFyaWFudEFsc29OZWdvdGlhdGVzEPoDEhgKE0lu", + "c3VmZmljaWVudFN0b3JhZ2UQ+wMSEQoMTG9vcERldGVjdGVkEPwDEhAKC05v", + "dEV4dGVuZGVkEP4DEiIKHU5ldHdvcmtBdXRoZW50aWNhdGlvblJlcXVpcmVk", + "EP8DGgIQASojCgxMaXZpbmdTdGF0dXMSCQoFQWxpdmUQABIICgREZWFkEAEq", + "XgoIU29tZUVudW0SEwoPU29tZUVudW1fVmFsdWUwEAASEwoPU29tZUVudW1f", + "VmFsdWUxEAESEwoPU29tZUVudW1fVmFsdWUyEAISEwoPU29tZUVudW1fVmFs", + "dWUzEAMqPwoNU29tZUVudW1Bc0ludBIKCgZWYWx1ZTAQABIKCgZWYWx1ZTEQ", + "ARIKCgZWYWx1ZTIQAhIKCgZWYWx1ZTMQAzLbcgoMR3JwY1NlcnZpY2VzEiwK", + "DEdldEFkZEhlYWRlchIKLkFkZEhlYWRlchoOLkVtcHR5UmVzcG9uc2UiABIq", + "CgtHZXRBbnlIZWxsbxIJLkFueUhlbGxvGg4uSGVsbG9SZXNwb25zZSIAEisK", + "DFBvc3RBbnlIZWxsbxIJLkFueUhlbGxvGg4uSGVsbG9SZXNwb25zZSIAEioK", + "C1B1dEFueUhlbGxvEgkuQW55SGVsbG8aDi5IZWxsb1Jlc3BvbnNlIgASLQoO", + "RGVsZXRlQW55SGVsbG8SCS5BbnlIZWxsbxoOLkhlbGxvUmVzcG9uc2UiABI3", + "Cg9Qb3N0QXNzaWduUm9sZXMSDC5Bc3NpZ25Sb2xlcxoULkFzc2lnblJvbGVz", + "UmVzcG9uc2UiABI9ChNPcHRpb25zQXV0aGVudGljYXRlEg0uQXV0aGVudGlj", + "YXRlGhUuQXV0aGVudGljYXRlUmVzcG9uc2UiABI5Cg9HZXRBdXRoZW50aWNh", + "dGUSDS5BdXRoZW50aWNhdGUaFS5BdXRoZW50aWNhdGVSZXNwb25zZSIAEjoK", + "EFBvc3RBdXRoZW50aWNhdGUSDS5BdXRoZW50aWNhdGUaFS5BdXRoZW50aWNh", + "dGVSZXNwb25zZSIAEjwKEkRlbGV0ZUF1dGhlbnRpY2F0ZRINLkF1dGhlbnRp", + "Y2F0ZRoVLkF1dGhlbnRpY2F0ZVJlc3BvbnNlIgASRQoXR2V0Q2hhbmdlQ29u", + "bmVjdGlvbkluZm8SFS5DaGFuZ2VDb25uZWN0aW9uSW5mbxoRLkNoYW5nZURi", + "UmVzcG9uc2UiABItCgtHZXRDaGFuZ2VEYhIJLkNoYW5nZURiGhEuQ2hhbmdl", + "RGJSZXNwb25zZSIAElUKGVBvc3RDb252ZXJ0U2Vzc2lvblRvVG9rZW4SFi5D", + "b252ZXJ0U2Vzc2lvblRvVG9rZW4aHi5Db252ZXJ0U2Vzc2lvblRvVG9rZW5S", + "ZXNwb25zZSIAEkAKElBvc3RDcmVhdGVCb29rbWFyaxIPLkNyZWF0ZUJvb2tt", + "YXJrGhcuQ3JlYXRlQm9va21hcmtSZXNwb25zZSIAEmUKIFBvc3RDcmVhdGVD", + "b25uZWN0aW9uSW5mb1JvY2tzdGFyEh0uQ3JlYXRlQ29ubmVjdGlvbkluZm9S", + "b2Nrc3RhchogLlJvY2tzdGFyV2l0aElkQW5kUmVzdWx0UmVzcG9uc2UiABJT", + "ChdQb3N0Q3JlYXRlTmFtZWRSb2Nrc3RhchIULkNyZWF0ZU5hbWVkUm9ja3N0", + "YXIaIC5Sb2Nrc3RhcldpdGhJZEFuZFJlc3VsdFJlc3BvbnNlIgASQAoSUG9z", + "dENyZWF0ZVJvY2tzdGFyEg8uQ3JlYXRlUm9ja3N0YXIaFy5DcmVhdGVSb2Nr", + "c3RhclJlc3BvbnNlIgASaQoiUG9zdENyZWF0ZVJvY2tzdGFyQWRob2NOb25E", + "ZWZhdWx0cxIfLkNyZWF0ZVJvY2tzdGFyQWRob2NOb25EZWZhdWx0cxogLlJv", + "Y2tzdGFyV2l0aElkQW5kUmVzdWx0UmVzcG9uc2UiABJKChdQb3N0Q3JlYXRl", + "Um9ja3N0YXJBdWRpdBIULkNyZWF0ZVJvY2tzdGFyQXVkaXQaFy5Sb2Nrc3Rh", + "cldpdGhJZFJlc3BvbnNlIgASWAoeUG9zdENyZWF0ZVJvY2tzdGFyQXVkaXRN", + "cVRva2VuEhsuQ3JlYXRlUm9ja3N0YXJBdWRpdE1xVG9rZW4aFy5Sb2Nrc3Rh", + "cldpdGhJZFJlc3BvbnNlIgASXwodUG9zdENyZWF0ZVJvY2tzdGFyQXVkaXRU", + "ZW5hbnQSGi5DcmVhdGVSb2Nrc3RhckF1ZGl0VGVuYW50GiAuUm9ja3N0YXJX", + "aXRoSWRBbmRSZXN1bHRSZXNwb25zZSIAEm0KJFBvc3RDcmVhdGVSb2Nrc3Rh", + "ckF1ZGl0VGVuYW50R2F0ZXdheRIhLkNyZWF0ZVJvY2tzdGFyQXVkaXRUZW5h", + "bnRHYXRld2F5GiAuUm9ja3N0YXJXaXRoSWRBbmRSZXN1bHRSZXNwb25zZSIA", + "ElAKHkdldENyZWF0ZVJvY2tzdGFyQXVkaXRUZW5hbnRNcRIcLkNyZWF0ZVJv", + "Y2tzdGFyQXVkaXRUZW5hbnRNcRoOLkVtcHR5UmVzcG9uc2UiABJRCh9Qb3N0", + "Q3JlYXRlUm9ja3N0YXJBdWRpdFRlbmFudE1xEhwuQ3JlYXRlUm9ja3N0YXJB", + "dWRpdFRlbmFudE1xGg4uRW1wdHlSZXNwb25zZSIAElAKHlB1dENyZWF0ZVJv", + "Y2tzdGFyQXVkaXRUZW5hbnRNcRIcLkNyZWF0ZVJvY2tzdGFyQXVkaXRUZW5h", + "bnRNcRoOLkVtcHR5UmVzcG9uc2UiABJTCiFEZWxldGVDcmVhdGVSb2Nrc3Rh", + "ckF1ZGl0VGVuYW50TXESHC5DcmVhdGVSb2Nrc3RhckF1ZGl0VGVuYW50TXEa", + "Di5FbXB0eVJlc3BvbnNlIgASVwoZUG9zdENyZWF0ZVJvY2tzdGFyQXV0b01h", + "cBIWLkNyZWF0ZVJvY2tzdGFyQXV0b01hcBogLlJvY2tzdGFyV2l0aElkQW5k", + "UmVzdWx0UmVzcG9uc2UiABJbChlQb3N0Q3JlYXRlUm9ja3N0YXJWZXJzaW9u", + "EhYuQ3JlYXRlUm9ja3N0YXJWZXJzaW9uGiQuUm9ja3N0YXJXaXRoSWRBbmRS", + "b3dWZXJzaW9uUmVzcG9uc2UiABJmCh5Qb3N0Q3JlYXRlUm9ja3N0YXJXaXRo", + "QXV0b0d1aWQSGy5DcmVhdGVSb2Nrc3RhcldpdGhBdXRvR3VpZBolLkNyZWF0", + "ZVJvY2tzdGFyV2l0aFJldHVybkd1aWRSZXNwb25zZSIAEl0KHFBvc3RDcmVh", + "dGVSb2Nrc3RhcldpdGhSZXR1cm4SGS5DcmVhdGVSb2Nrc3RhcldpdGhSZXR1", + "cm4aIC5Sb2Nrc3RhcldpdGhJZEFuZFJlc3VsdFJlc3BvbnNlIgASUwogUG9z", + "dENyZWF0ZVJvY2tzdGFyV2l0aFZvaWRSZXR1cm4SHS5DcmVhdGVSb2Nrc3Rh", + "cldpdGhWb2lkUmV0dXJuGg4uRW1wdHlSZXNwb25zZSIAEjQKDlBvc3RDcmVh", + "dGVUb2RvEgsuQ3JlYXRlVG9kbxoTLkNyZWF0ZVRvZG9SZXNwb25zZSIAElAK", + "GlBvc3RDdXN0b21WYWxpZGF0aW9uRXJyb3JzEhcuQ3VzdG9tVmFsaWRhdGlv", + "bkVycm9ycxoXLlJvY2tzdGFyV2l0aElkUmVzcG9uc2UiABI3ChJDYWxsRGVs", + "ZXRlUm9ja3N0YXISDy5EZWxldGVSb2Nrc3RhchoOLkVtcHR5UmVzcG9uc2Ui", + "ABJSChdDYWxsRGVsZXRlUm9ja3N0YXJBdWRpdBIULkRlbGV0ZVJvY2tzdGFy", + "QXVkaXQaHy5Sb2Nrc3RhcldpdGhJZEFuZENvdW50UmVzcG9uc2UiABJTChlD", + "YWxsRGVsZXRlUm9ja3N0YXJGaWx0ZXJzEhYuRGVsZXRlUm9ja3N0YXJGaWx0", + "ZXJzGhwuRGVsZXRlUm9ja3N0YXJDb3VudFJlc3BvbnNlIgASLwoOQ2FsbERl", + "bGV0ZVRvZG8SCy5EZWxldGVUb2RvGg4uRW1wdHlSZXNwb25zZSIAEjEKD0Nh", + "bGxEZWxldGVUb2RvcxIMLkRlbGV0ZVRvZG9zGg4uRW1wdHlSZXNwb25zZSIA", + "ElAKIkdldER5bmFtaWNRdWVyeUdldFJvY2tzdGFyc0R5bmFtaWMSDy5EeW5h", + "bWljUmVxdWVzdBoXLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABJeCiRHZXRE", + "eW5hbWljUXVlcnlDdXN0b21Sb2Nrc3RhcnNTY2hlbWESDy5EeW5hbWljUmVx", + "dWVzdBojLlF1ZXJ5UmVzcG9uc2VfQ3VzdG9tUm9ja3N0YXJTY2hlbWEiABJB", + "ChZHZXREeW5hbWljU2VhcmNoTW92aWVzEg8uRHluYW1pY1JlcXVlc3QaFC5R", + "dWVyeVJlc3BvbnNlX01vdmllIgASQAoVR2V0RHluYW1pY1F1ZXJ5TW92aWVz", + "Eg8uRHluYW1pY1JlcXVlc3QaFC5RdWVyeVJlc3BvbnNlX01vdmllIgASTQof", + "R2V0RHluYW1pY1F1ZXJ5VW5rbm93blJvY2tzdGFycxIPLkR5bmFtaWNSZXF1", + "ZXN0GhcuUXVlcnlSZXNwb25zZV9Sb2Nrc3RhciIAEl0KJkdldER5bmFtaWNR", + "dWVyeVJvY2tzdGFyc1dpdGhSZWZlcmVuY2VzEg8uRHluYW1pY1JlcXVlc3Qa", + "IC5RdWVyeVJlc3BvbnNlX1JvY2tzdGFyUmVmZXJlbmNlIgASRwoYR2V0RHlu", + "YW1pY1F1ZXJ5QWxsRmllbGRzEg8uRHluYW1pY1JlcXVlc3QaGC5RdWVyeVJl", + "c3BvbnNlX0FsbEZpZWxkcyIAEk4KHEdldER5bmFtaWNRdWVyeVR5cGVXaXRo", + "RW51bXMSDy5EeW5hbWljUmVxdWVzdBobLlF1ZXJ5UmVzcG9uc2VfVHlwZVdp", + "dGhFbnVtIgASSwodR2V0RHluYW1pY1F1ZXJ5QWRob2NSb2Nrc3RhcnMSDy5E", + "eW5hbWljUmVxdWVzdBoXLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABI/ChRH", + "ZXREeW5hbWljUXVlcnlBZGhvYxIPLkR5bmFtaWNSZXF1ZXN0GhQuUXVlcnlS", + "ZXNwb25zZV9BZGhvYyIAEkUKF0dldER5bmFtaWNRdWVyeUNoYW5nZURiEg8u", + "RHluYW1pY1JlcXVlc3QaFy5RdWVyeVJlc3BvbnNlX1JvY2tzdGFyIgASaQov", + "R2V0RHluYW1pY1F1ZXJ5Sm9pbmVkUm9ja3N0YXJBbGJ1bXNDdXN0b21TZWxl", + "Y3QSDy5EeW5hbWljUmVxdWVzdBojLlF1ZXJ5UmVzcG9uc2VfQ3VzdG9tU2Vs", + "ZWN0Um9ja3N0YXIiABJ5CjdHZXREeW5hbWljUXVlcnlKb2luZWRSb2Nrc3Rh", + "ckFsYnVtc0N1c3RvbVNlbGVjdFJlc3BvbnNlEg8uRHluYW1pY1JlcXVlc3Qa", + "Ky5RdWVyeVJlc3BvbnNlX0N1c3RvbVNlbGVjdFJvY2tzdGFyUmVzcG9uc2Ui", + "ABI8ChNHZXREeW5hbWljUXVlcnlGb29zEg8uRHluYW1pY1JlcXVlc3QaEi5R", + "dWVyeVJlc3BvbnNlX0ZvbyIAEk8KIUdldER5bmFtaWNRdWVyeU92ZXJyaWRl", + "ZFJvY2tzdGFycxIPLkR5bmFtaWNSZXF1ZXN0GhcuUXVlcnlSZXNwb25zZV9S", + "b2Nrc3RhciIAElsKJ0dldER5bmFtaWNRdWVyeU92ZXJyaWRlZEN1c3RvbVJv", + "Y2tzdGFycxIPLkR5bmFtaWNSZXF1ZXN0Gh0uUXVlcnlSZXNwb25zZV9DdXN0", + "b21Sb2Nrc3RhciIAElMKJUdldER5bmFtaWNRdWVyeUNhc2VJbnNlbnNpdGl2", + "ZU9yZGVyQnkSDy5EeW5hbWljUmVxdWVzdBoXLlF1ZXJ5UmVzcG9uc2VfUm9j", + "a3N0YXIiABJBChZHZXREeW5hbWljU3RyZWFtTW92aWVzEg8uRHluYW1pY1Jl", + "cXVlc3QaFC5RdWVyeVJlc3BvbnNlX01vdmllIgASXwooR2V0RHluYW1pY1F1", + "ZXJ5Q3VzdG9tUm9ja3N0YXJzUmVmZXJlbmNlcxIPLkR5bmFtaWNSZXF1ZXN0", + "GiAuUXVlcnlSZXNwb25zZV9Sb2Nrc3RhclJlZmVyZW5jZSIAEl8KK0dldER5", + "bmFtaWNRdWVyeVJvY2tzdGFyQWxidW1zQ3VzdG9tTGVmdEpvaW4SDy5EeW5h", + "bWljUmVxdWVzdBodLlF1ZXJ5UmVzcG9uc2VfQ3VzdG9tUm9ja3N0YXIiABJR", + "CiNHZXREeW5hbWljUXVlcnlDaGFuZ2VDb25uZWN0aW9uSW5mbxIPLkR5bmFt", + "aWNSZXF1ZXN0GhcuUXVlcnlSZXNwb25zZV9Sb2Nrc3RhciIAEk4KHEdldER5", + "bmFtaWNRdWVyeVJvY2tzdGFyQXVkaXQSDy5EeW5hbWljUmVxdWVzdBobLlF1", + "ZXJ5UmVzcG9uc2VfUm9ja3N0YXJBdXRvIgASUwohR2V0RHluYW1pY1F1ZXJ5", + "Um9ja3N0YXJBdWRpdFN1Yk9yEg8uRHluYW1pY1JlcXVlc3QaGy5RdWVyeVJl", + "c3BvbnNlX1JvY2tzdGFyQXV0byIAEkYKGEdldER5bmFtaWNRdWVyeUJvb2tt", + "YXJrcxIPLkR5bmFtaWNSZXF1ZXN0GhcuUXVlcnlSZXNwb25zZV9Cb29rbWFy", + "ayIAElAKHUdldER5bmFtaWNRdWVyeU5hbWVkUm9ja3N0YXJzEg8uRHluYW1p", + "Y1JlcXVlc3QaHC5RdWVyeVJlc3BvbnNlX05hbWVkUm9ja3N0YXIiABJGChhH", + "ZXREeW5hbWljUXVlcnlSb2Nrc3RhcnMSDy5EeW5hbWljUmVxdWVzdBoXLlF1", + "ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABJQCh1HZXREeW5hbWljUXVlcnlSb2Nr", + "c3RhckFsYnVtcxIPLkR5bmFtaWNSZXF1ZXN0GhwuUXVlcnlSZXNwb25zZV9S", + "b2Nrc3RhckFsYnVtIgASSQoZR2V0RHluYW1pY1F1ZXJ5UGFnaW5nVGVzdBIP", + "LkR5bmFtaWNSZXF1ZXN0GhkuUXVlcnlSZXNwb25zZV9QYWdpbmdUZXN0IgAS", + "UQojR2V0RHluYW1pY1F1ZXJ5Um9ja3N0YXJzQ29udmVudGlvbnMSDy5EeW5h", + "bWljUmVxdWVzdBoXLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABJSCh5HZXRE", + "eW5hbWljUXVlcnlDdXN0b21Sb2Nrc3RhcnMSDy5EeW5hbWljUmVxdWVzdBod", + "LlF1ZXJ5UmVzcG9uc2VfQ3VzdG9tUm9ja3N0YXIiABJXCiNHZXREeW5hbWlj", + "UXVlcnlKb2luZWRSb2Nrc3RhckFsYnVtcxIPLkR5bmFtaWNSZXF1ZXN0Gh0u", + "UXVlcnlSZXNwb25zZV9DdXN0b21Sb2Nrc3RhciIAElkKJUdldER5bmFtaWNR", + "dWVyeVJvY2tzdGFyQWxidW1zSW1wbGljaXQSDy5EeW5hbWljUmVxdWVzdBod", + "LlF1ZXJ5UmVzcG9uc2VfQ3VzdG9tUm9ja3N0YXIiABJZCiVHZXREeW5hbWlj", + "UXVlcnlSb2Nrc3RhckFsYnVtc0xlZnRKb2luEg8uRHluYW1pY1JlcXVlc3Qa", + "HS5RdWVyeVJlc3BvbnNlX0N1c3RvbVJvY2tzdGFyIgASVAogR2V0RHluYW1p", + "Y1F1ZXJ5TXVsdGlKb2luUm9ja3N0YXISDy5EeW5hbWljUmVxdWVzdBodLlF1", + "ZXJ5UmVzcG9uc2VfQ3VzdG9tUm9ja3N0YXIiABJLCh1HZXREeW5hbWljUXVl", + "cnlGaWVsZFJvY2tzdGFycxIPLkR5bmFtaWNSZXF1ZXN0GhcuUXVlcnlSZXNw", + "b25zZV9Sb2Nrc3RhciIAEk8KHEdldER5bmFtaWNRdWVyeVJvY2tzdGFyQWxp", + "YXMSDy5EeW5hbWljUmVxdWVzdBocLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXJB", + "bGlhcyIAElIKJEdldER5bmFtaWNRdWVyeUZpZWxkUm9ja3N0YXJzRHluYW1p", + "YxIPLkR5bmFtaWNSZXF1ZXN0GhcuUXVlcnlSZXNwb25zZV9Sb2Nrc3RhciIA", + "EkwKHkdldER5bmFtaWNRdWVyeVJvY2tzdGFyc0ZpbHRlchIPLkR5bmFtaWNS", + "ZXF1ZXN0GhcuUXVlcnlSZXNwb25zZV9Sb2Nrc3RhciIAElgKJEdldER5bmFt", + "aWNRdWVyeUN1c3RvbVJvY2tzdGFyc0ZpbHRlchIPLkR5bmFtaWNSZXF1ZXN0", + "Gh0uUXVlcnlSZXNwb25zZV9DdXN0b21Sb2Nrc3RhciIAEk0KH0dldER5bmFt", + "aWNRdWVyeVJvY2tzdGFyc0lGaWx0ZXISDy5EeW5hbWljUmVxdWVzdBoXLlF1", + "ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABJIChpHZXREeW5hbWljUXVlcnlPclJv", + "Y2tzdGFycxIPLkR5bmFtaWNSZXF1ZXN0GhcuUXVlcnlSZXNwb25zZV9Sb2Nr", + "c3RhciIAEk4KIEdldER5bmFtaWNRdWVyeVJvY2tzdGFyc0ltcGxpY2l0Eg8u", + "RHluYW1pY1JlcXVlc3QaFy5RdWVyeVJlc3BvbnNlX1JvY2tzdGFyIgASTgog", + "R2V0RHluYW1pY1F1ZXJ5T3JSb2Nrc3RhcnNGaWVsZHMSDy5EeW5hbWljUmVx", + "dWVzdBoXLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABJWCihHZXREeW5hbWlj", + "UXVlcnlGaWVsZHNJbXBsaWNpdENvbnZlbnRpb25zEg8uRHluYW1pY1JlcXVl", + "c3QaFy5RdWVyeVJlc3BvbnNlX1JvY2tzdGFyIgASSQobR2V0RHluYW1pY1F1", + "ZXJ5R2V0Um9ja3N0YXJzEg8uRHluYW1pY1JlcXVlc3QaFy5RdWVyeVJlc3Bv", + "bnNlX1JvY2tzdGFyIgASTAoeR2V0RHluYW1pY1F1ZXJ5Um9ja3N0YXJGaWx0", + "ZXJzEg8uRHluYW1pY1JlcXVlc3QaFy5RdWVyeVJlc3BvbnNlX1JvY2tzdGFy", + "IgASUAoaUG9zdER5bmFtaWNWYWxpZGF0aW9uUnVsZXMSFy5EeW5hbWljVmFs", + "aWRhdGlvblJ1bGVzGhcuUm9ja3N0YXJXaXRoSWRSZXNwb25zZSIAEkIKE1Bv", + "c3RFbXB0eVZhbGlkYXRvcnMSEC5FbXB0eVZhbGlkYXRvcnMaFy5Sb2Nrc3Rh", + "cldpdGhJZFJlc3BvbnNlIgASTQoYR2V0RW5kc1dpdGhTdWZmaXhSZXF1ZXN0", + "EhYuRW5kc1dpdGhTdWZmaXhSZXF1ZXN0GhcuRW5kc1dpdGhTdWZmaXhSZXNw", + "b25zZSIAEk4KGVBvc3RFbmRzV2l0aFN1ZmZpeFJlcXVlc3QSFi5FbmRzV2l0", + "aFN1ZmZpeFJlcXVlc3QaFy5FbmRzV2l0aFN1ZmZpeFJlc3BvbnNlIgASTQoY", + "UHV0RW5kc1dpdGhTdWZmaXhSZXF1ZXN0EhYuRW5kc1dpdGhTdWZmaXhSZXF1", + "ZXN0GhcuRW5kc1dpdGhTdWZmaXhSZXNwb25zZSIAElAKG0RlbGV0ZUVuZHNX", + "aXRoU3VmZml4UmVxdWVzdBIWLkVuZHNXaXRoU3VmZml4UmVxdWVzdBoXLkVu", + "ZHNXaXRoU3VmZml4UmVzcG9uc2UiABJAChJQb3N0R2V0QWNjZXNzVG9rZW4S", + "Dy5HZXRBY2Nlc3NUb2tlbhoXLkdldEFjY2Vzc1Rva2VuUmVzcG9uc2UiABI0", + "Cg5DYWxsR2V0QXBpS2V5cxILLkdldEFwaUtleXMaEy5HZXRBcGlLZXlzUmVz", + "cG9uc2UiABInCgtDYWxsR2V0RmlsZRIILkdldEZpbGUaDC5GaWxlQ29udGVu", + "dCIAEisKDENhbGxHZXRIZWxsbxIJLkdldEhlbGxvGg4uSGVsbG9SZXNwb25z", + "ZSIAEisKC0NhbGxHZXRUb2RvEgguR2V0VG9kbxoQLkdldFRvZG9SZXNwb25z", + "ZSIAEi4KDENhbGxHZXRUb2RvcxIJLkdldFRvZG9zGhEuR2V0VG9kb3NSZXNw", + "b25zZSIAEi0KC0dldEhlbGxvSnd0EgkuSGVsbG9Kd3QaES5IZWxsb0p3dFJl", + "c3BvbnNlIgASLgoMUG9zdEhlbGxvSnd0EgkuSGVsbG9Kd3QaES5IZWxsb0p3", + "dFJlc3BvbnNlIgASLQoLUHV0SGVsbG9Kd3QSCS5IZWxsb0p3dBoRLkhlbGxv", + "Snd0UmVzcG9uc2UiABIwCg5EZWxldGVIZWxsb0p3dBIJLkhlbGxvSnd0GhEu", + "SGVsbG9Kd3RSZXNwb25zZSIAEiIKB0dldEluY3ISBS5JbmNyGg4uRW1wdHlS", + "ZXNwb25zZSIAEiMKCFBvc3RJbmNyEgUuSW5jchoOLkVtcHR5UmVzcG9uc2Ui", + "ABIiCgdQdXRJbmNyEgUuSW5jchoOLkVtcHR5UmVzcG9uc2UiABIlCgpEZWxl", + "dGVJbmNyEgUuSW5jchoOLkVtcHR5UmVzcG9uc2UiABIuCgxQb3N0TXVsdGlw", + "bHkSCS5NdWx0aXBseRoRLk11bHRpcGx5UmVzcG9uc2UiABJKChdQb3N0Tm9B", + "YnN0cmFjdFZhbGlkYXRvchIULk5vQWJzdHJhY3RWYWxpZGF0b3IaFy5Sb2Nr", + "c3RhcldpdGhJZFJlc3BvbnNlIgASTAoYUG9zdE9ubHlWYWxpZGF0ZXNSZXF1", + "ZXN0EhUuT25seVZhbGlkYXRlc1JlcXVlc3QaFy5Sb2Nrc3RhcldpdGhJZFJl", + "c3BvbnNlIgASNQoRQ2FsbFBhdGNoUm9ja3N0YXISDi5QYXRjaFJvY2tzdGFy", + "Gg4uRW1wdHlSZXNwb25zZSIAEl0KHENhbGxQYXRjaFJvY2tzdGFyQXVkaXRU", + "ZW5hbnQSGS5QYXRjaFJvY2tzdGFyQXVkaXRUZW5hbnQaIC5Sb2Nrc3Rhcldp", + "dGhJZEFuZFJlc3VsdFJlc3BvbnNlIgASawojQ2FsbFBhdGNoUm9ja3N0YXJB", + "dWRpdFRlbmFudEdhdGV3YXkSIC5QYXRjaFJvY2tzdGFyQXVkaXRUZW5hbnRH", + "YXRld2F5GiAuUm9ja3N0YXJXaXRoSWRBbmRSZXN1bHRSZXNwb25zZSIAEk8K", + "HkNhbGxQYXRjaFJvY2tzdGFyQXVkaXRUZW5hbnRNcRIbLlBhdGNoUm9ja3N0", + "YXJBdWRpdFRlbmFudE1xGg4uRW1wdHlSZXNwb25zZSIAEjsKFUNhbGxQb3N0", + "Q2hhdFRvQ2hhbm5lbBISLlBvc3RDaGF0VG9DaGFubmVsGgwuQ2hhdE1lc3Nh", + "Z2UiABI0Cg1HZXRRdWVyeUFkaG9jEgsuUXVlcnlBZGhvYxoULlF1ZXJ5UmVz", + "cG9uc2VfQWRob2MiABJJChZHZXRRdWVyeUFkaG9jUm9ja3N0YXJzEhQuUXVl", + "cnlBZGhvY1JvY2tzdGFycxoXLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABJA", + "ChFHZXRRdWVyeUFsbEZpZWxkcxIPLlF1ZXJ5QWxsRmllbGRzGhguUXVlcnlS", + "ZXNwb25zZV9BbGxGaWVsZHMiABI/ChFHZXRRdWVyeUJvb2ttYXJrcxIPLlF1", + "ZXJ5Qm9va21hcmtzGhcuUXVlcnlSZXNwb25zZV9Cb29rbWFyayIAElkKHkdl", + "dFF1ZXJ5Q2FzZUluc2Vuc2l0aXZlT3JkZXJCeRIcLlF1ZXJ5Q2FzZUluc2Vu", + "c2l0aXZlT3JkZXJCeRoXLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABJVChxH", + "ZXRRdWVyeUNoYW5nZUNvbm5lY3Rpb25JbmZvEhouUXVlcnlDaGFuZ2VDb25u", + "ZWN0aW9uSW5mbxoXLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABI9ChBHZXRR", + "dWVyeUNoYW5nZURiEg4uUXVlcnlDaGFuZ2VEYhoXLlF1ZXJ5UmVzcG9uc2Vf", + "Um9ja3N0YXIiABJRChdHZXRRdWVyeUN1c3RvbVJvY2tzdGFycxIVLlF1ZXJ5", + "Q3VzdG9tUm9ja3N0YXJzGh0uUXVlcnlSZXNwb25zZV9DdXN0b21Sb2Nrc3Rh", + "ciIAEl0KHUdldFF1ZXJ5Q3VzdG9tUm9ja3N0YXJzRmlsdGVyEhsuUXVlcnlD", + "dXN0b21Sb2Nrc3RhcnNGaWx0ZXIaHS5RdWVyeVJlc3BvbnNlX0N1c3RvbVJv", + "Y2tzdGFyIgASaAohR2V0UXVlcnlDdXN0b21Sb2Nrc3RhcnNSZWZlcmVuY2Vz", + "Eh8uUXVlcnlDdXN0b21Sb2Nrc3RhcnNSZWZlcmVuY2VzGiAuUXVlcnlSZXNw", + "b25zZV9Sb2Nrc3RhclJlZmVyZW5jZSIAEmMKHUdldFF1ZXJ5Q3VzdG9tUm9j", + "a3N0YXJzU2NoZW1hEhsuUXVlcnlDdXN0b21Sb2Nrc3RhcnNTY2hlbWEaIy5R", + "dWVyeVJlc3BvbnNlX0N1c3RvbVJvY2tzdGFyU2NoZW1hIgASSQoWR2V0UXVl", + "cnlGaWVsZFJvY2tzdGFycxIULlF1ZXJ5RmllbGRSb2Nrc3RhcnMaFy5RdWVy", + "eVJlc3BvbnNlX1JvY2tzdGFyIgASVwodR2V0UXVlcnlGaWVsZFJvY2tzdGFy", + "c0R5bmFtaWMSGy5RdWVyeUZpZWxkUm9ja3N0YXJzRHluYW1pYxoXLlF1ZXJ5", + "UmVzcG9uc2VfUm9ja3N0YXIiABJfCiFHZXRRdWVyeUZpZWxkc0ltcGxpY2l0", + "Q29udmVudGlvbnMSHy5RdWVyeUZpZWxkc0ltcGxpY2l0Q29udmVudGlvbnMa", + "Fy5RdWVyeVJlc3BvbnNlX1JvY2tzdGFyIgASMAoMR2V0UXVlcnlGb29zEgou", + "UXVlcnlGb29zGhIuUXVlcnlSZXNwb25zZV9Gb28iABJFChRHZXRRdWVyeUdl", + "dFJvY2tzdGFycxISLlF1ZXJ5R2V0Um9ja3N0YXJzGhcuUXVlcnlSZXNwb25z", + "ZV9Sb2Nrc3RhciIAElMKG0dldFF1ZXJ5R2V0Um9ja3N0YXJzRHluYW1pYxIZ", + "LlF1ZXJ5R2V0Um9ja3N0YXJzRHluYW1pYxoXLlF1ZXJ5UmVzcG9uc2VfUm9j", + "a3N0YXIiABJbChxHZXRRdWVyeUpvaW5lZFJvY2tzdGFyQWxidW1zEhouUXVl", + "cnlKb2luZWRSb2Nrc3RhckFsYnVtcxodLlF1ZXJ5UmVzcG9uc2VfQ3VzdG9t", + "Um9ja3N0YXIiABJ5CihHZXRRdWVyeUpvaW5lZFJvY2tzdGFyQWxidW1zQ3Vz", + "dG9tU2VsZWN0EiYuUXVlcnlKb2luZWRSb2Nrc3RhckFsYnVtc0N1c3RvbVNl", + "bGVjdBojLlF1ZXJ5UmVzcG9uc2VfQ3VzdG9tU2VsZWN0Um9ja3N0YXIiABKR", + "AQowR2V0UXVlcnlKb2luZWRSb2Nrc3RhckFsYnVtc0N1c3RvbVNlbGVjdFJl", + "c3BvbnNlEi4uUXVlcnlKb2luZWRSb2Nrc3RhckFsYnVtc0N1c3RvbVNlbGVj", + "dFJlc3BvbnNlGisuUXVlcnlSZXNwb25zZV9DdXN0b21TZWxlY3RSb2Nrc3Rh", + "clJlc3BvbnNlIgASNgoOR2V0UXVlcnlNb3ZpZXMSDC5RdWVyeU1vdmllcxoU", + "LlF1ZXJ5UmVzcG9uc2VfTW92aWUiABJVChlHZXRRdWVyeU11bHRpSm9pblJv", + "Y2tzdGFyEhcuUXVlcnlNdWx0aUpvaW5Sb2Nrc3RhchodLlF1ZXJ5UmVzcG9u", + "c2VfQ3VzdG9tUm9ja3N0YXIiABJOChZHZXRRdWVyeU5hbWVkUm9ja3N0YXJz", + "EhQuUXVlcnlOYW1lZFJvY2tzdGFycxocLlF1ZXJ5UmVzcG9uc2VfTmFtZWRS", + "b2Nrc3RhciIAEkMKE0dldFF1ZXJ5T3JSb2Nrc3RhcnMSES5RdWVyeU9yUm9j", + "a3N0YXJzGhcuUXVlcnlSZXNwb25zZV9Sb2Nrc3RhciIAEk8KGUdldFF1ZXJ5", + "T3JSb2Nrc3RhcnNGaWVsZHMSFy5RdWVyeU9yUm9ja3N0YXJzRmllbGRzGhcu", + "UXVlcnlSZXNwb25zZV9Sb2Nrc3RhciIAEmMKIEdldFF1ZXJ5T3ZlcnJpZGVk", + "Q3VzdG9tUm9ja3N0YXJzEh4uUXVlcnlPdmVycmlkZWRDdXN0b21Sb2Nrc3Rh", + "cnMaHS5RdWVyeVJlc3BvbnNlX0N1c3RvbVJvY2tzdGFyIgASUQoaR2V0UXVl", + "cnlPdmVycmlkZWRSb2Nrc3RhcnMSGC5RdWVyeU92ZXJyaWRlZFJvY2tzdGFy", + "cxoXLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABJDChJHZXRRdWVyeVBhZ2lu", + "Z1Rlc3QSEC5RdWVyeVBhZ2luZ1Rlc3QaGS5RdWVyeVJlc3BvbnNlX1BhZ2lu", + "Z1Rlc3QiABJOChZHZXRRdWVyeVJvY2tzdGFyQWxidW1zEhQuUXVlcnlSb2Nr", + "c3RhckFsYnVtcxocLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXJBbGJ1bSIAEmsK", + "JEdldFF1ZXJ5Um9ja3N0YXJBbGJ1bXNDdXN0b21MZWZ0Sm9pbhIiLlF1ZXJ5", + "Um9ja3N0YXJBbGJ1bXNDdXN0b21MZWZ0Sm9pbhodLlF1ZXJ5UmVzcG9uc2Vf", + "Q3VzdG9tUm9ja3N0YXIiABJfCh5HZXRRdWVyeVJvY2tzdGFyQWxidW1zSW1w", + "bGljaXQSHC5RdWVyeVJvY2tzdGFyQWxidW1zSW1wbGljaXQaHS5RdWVyeVJl", + "c3BvbnNlX0N1c3RvbVJvY2tzdGFyIgASXwoeR2V0UXVlcnlSb2Nrc3RhckFs", + "YnVtc0xlZnRKb2luEhwuUXVlcnlSb2Nrc3RhckFsYnVtc0xlZnRKb2luGh0u", + "UXVlcnlSZXNwb25zZV9DdXN0b21Sb2Nrc3RhciIAEkwKFUdldFF1ZXJ5Um9j", + "a3N0YXJBbGlhcxITLlF1ZXJ5Um9ja3N0YXJBbGlhcxocLlF1ZXJ5UmVzcG9u", + "c2VfUm9ja3N0YXJBbGlhcyIAEksKFUdldFF1ZXJ5Um9ja3N0YXJBdWRpdBIT", + "LlF1ZXJ5Um9ja3N0YXJBdWRpdBobLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXJB", + "dXRvIgASVQoaR2V0UXVlcnlSb2Nrc3RhckF1ZGl0U3ViT3ISGC5RdWVyeVJv", + "Y2tzdGFyQXVkaXRTdWJPchobLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXJBdXRv", + "IgASSwoXR2V0UXVlcnlSb2Nrc3RhckZpbHRlcnMSFS5RdWVyeVJvY2tzdGFy", + "RmlsdGVycxoXLlF1ZXJ5UmVzcG9uc2VfUm9ja3N0YXIiABI/ChFHZXRRdWVy", + "eVJvY2tzdGFycxIPLlF1ZXJ5Um9ja3N0YXJzGhcuUXVlcnlSZXNwb25zZV9S", + "b2Nrc3RhciIAElUKHEdldFF1ZXJ5Um9ja3N0YXJzQ29udmVudGlvbnMSGi5R", + "dWVyeVJvY2tzdGFyc0NvbnZlbnRpb25zGhcuUXVlcnlSZXNwb25zZV9Sb2Nr", + "c3RhciIAEksKF0dldFF1ZXJ5Um9ja3N0YXJzRmlsdGVyEhUuUXVlcnlSb2Nr", + "c3RhcnNGaWx0ZXIaFy5RdWVyeVJlc3BvbnNlX1JvY2tzdGFyIgASTQoYR2V0", + "UXVlcnlSb2Nrc3RhcnNJRmlsdGVyEhYuUXVlcnlSb2Nrc3RhcnNJRmlsdGVy", + "GhcuUXVlcnlSZXNwb25zZV9Sb2Nrc3RhciIAEk8KGUdldFF1ZXJ5Um9ja3N0", + "YXJzSW1wbGljaXQSFy5RdWVyeVJvY2tzdGFyc0ltcGxpY2l0GhcuUXVlcnlS", + "ZXNwb25zZV9Sb2Nrc3RhciIAEmQKH0dldFF1ZXJ5Um9ja3N0YXJzV2l0aFJl", + "ZmVyZW5jZXMSHS5RdWVyeVJvY2tzdGFyc1dpdGhSZWZlcmVuY2VzGiAuUXVl", + "cnlSZXNwb25zZV9Sb2Nrc3RhclJlZmVyZW5jZSIAEksKFUdldFF1ZXJ5VHlw", + "ZVdpdGhFbnVtcxITLlF1ZXJ5VHlwZVdpdGhFbnVtcxobLlF1ZXJ5UmVzcG9u", + "c2VfVHlwZVdpdGhFbnVtIgASTQoYR2V0UXVlcnlVbmtub3duUm9ja3N0YXJz", + "EhYuUXVlcnlVbmtub3duUm9ja3N0YXJzGhcuUXVlcnlSZXNwb25zZV9Sb2Nr", + "c3RhciIAElgKG0RlbGV0ZVJlYWxEZWxldGVBdWRpdFRlbmFudBIWLlJlYWxE", + "ZWxldGVBdWRpdFRlbmFudBofLlJvY2tzdGFyV2l0aElkQW5kQ291bnRSZXNw", + "b25zZSIAEmYKIkRlbGV0ZVJlYWxEZWxldGVBdWRpdFRlbmFudEdhdGV3YXkS", + "HS5SZWFsRGVsZXRlQXVkaXRUZW5hbnRHYXRld2F5Gh8uUm9ja3N0YXJXaXRo", + "SWRBbmRDb3VudFJlc3BvbnNlIgASSwodRGVsZXRlUmVhbERlbGV0ZUF1ZGl0", + "VGVuYW50TXESGC5SZWFsRGVsZXRlQXVkaXRUZW5hbnRNcRoOLkVtcHR5UmVz", + "cG9uc2UiABJJChVQb3N0UmVnZW5lcmF0ZUFwaUtleXMSEi5SZWdlbmVyYXRl", + "QXBpS2V5cxoaLlJlZ2VuZXJhdGVBcGlLZXlzUmVzcG9uc2UiABItCgtQdXRS", + "ZWdpc3RlchIJLlJlZ2lzdGVyGhEuUmVnaXN0ZXJSZXNwb25zZSIAEi4KDFBv", + "c3RSZWdpc3RlchIJLlJlZ2lzdGVyGhEuUmVnaXN0ZXJSZXNwb25zZSIAEjEK", + "D0dldFJlcXVpcmVzQXV0aBINLlJlcXVpcmVzQXV0aBoNLlJlcXVpcmVzQXV0", + "aCIAEjIKEFBvc3RSZXF1aXJlc0F1dGgSDS5SZXF1aXJlc0F1dGgaDS5SZXF1", + "aXJlc0F1dGgiABIxCg9QdXRSZXF1aXJlc0F1dGgSDS5SZXF1aXJlc0F1dGga", + "DS5SZXF1aXJlc0F1dGgiABI0ChJEZWxldGVSZXF1aXJlc0F1dGgSDS5SZXF1", + "aXJlc0F1dGgaDS5SZXF1aXJlc0F1dGgiABIvCg5Qb3N0UmVzZXRUb2RvcxIL", + "LlJlc2V0VG9kb3MaDi5FbXB0eVJlc3BvbnNlIgASOAoPR2V0U2VhcmNoTW92", + "aWVzEg0uU2VhcmNoTW92aWVzGhQuUXVlcnlSZXNwb25zZV9Nb3ZpZSIAEisK", + "C1Bvc3RTZWN1cmVkEgguU2VjdXJlZBoQLlNlY3VyZWRSZXNwb25zZSIAElYK", + "GFB1dFNvZnREZWxldGVBdWRpdFRlbmFudBIWLlNvZnREZWxldGVBdWRpdFRl", + "bmFudBogLlJvY2tzdGFyV2l0aElkQW5kUmVzdWx0UmVzcG9uc2UiABIzChFT", + "ZXJ2ZXJTdHJlYW1GaWxlcxIMLlN0cmVhbUZpbGVzGgwuRmlsZUNvbnRlbnQi", + "ADABEjgKD0dldFN0cmVhbU1vdmllcxINLlN0cmVhbU1vdmllcxoULlF1ZXJ5", + "UmVzcG9uc2VfTW92aWUiABJQChhTZXJ2ZXJTdHJlYW1TZXJ2ZXJFdmVudHMS", + "Ey5TdHJlYW1TZXJ2ZXJFdmVudHMaGy5TdHJlYW1TZXJ2ZXJFdmVudHNSZXNw", + "b25zZSIAMAESSAoWUG9zdFRlc3RBdXRoVmFsaWRhdG9ycxITLlRlc3RBdXRo", + "VmFsaWRhdG9ycxoXLlJvY2tzdGFyV2l0aElkUmVzcG9uc2UiABJCChNQb3N0", + "VGVzdERiQ29uZGl0aW9uEhAuVGVzdERiQ29uZGl0aW9uGhcuUm9ja3N0YXJX", + "aXRoSWRSZXNwb25zZSIAEkIKE1Bvc3RUZXN0RGJWYWxpZGF0b3ISEC5UZXN0", + "RGJWYWxpZGF0b3IaFy5Sb2Nrc3RhcldpdGhJZFJlc3BvbnNlIgASOgoPUG9z", + "dFRlc3RJc0FkbWluEgwuVGVzdElzQWRtaW4aFy5Sb2Nrc3RhcldpdGhJZFJl", + "c3BvbnNlIgASUgobUG9zdFRlc3RNdWx0aUF1dGhWYWxpZGF0b3JzEhguVGVz", + "dE11bHRpQXV0aFZhbGlkYXRvcnMaFy5Sb2Nrc3RhcldpdGhJZFJlc3BvbnNl", + "IgASJAoIR2V0VGhyb3cSBi5UaHJvdxoOLkhlbGxvUmVzcG9uc2UiABI2Cg5H", + "ZXRUaHJvd0N1c3RvbRIMLlRocm93Q3VzdG9tGhQuVGhyb3dDdXN0b21SZXNw", + "b25zZSIAEiwKDEdldFRocm93Vm9pZBIKLlRocm93Vm9pZBoOLkVtcHR5UmVz", + "cG9uc2UiABJMChhQb3N0VHJpZ2dlckFsbFZhbGlkYXRvcnMSFS5UcmlnZ2Vy", + "QWxsVmFsaWRhdG9ycxoXLlJvY2tzdGFyV2l0aElkUmVzcG9uc2UiABI9ChVQ", + "b3N0VHJpZ2dlclZhbGlkYXRvcnMSEi5UcmlnZ2VyVmFsaWRhdG9ycxoOLkVt", + "cHR5UmVzcG9uc2UiABI9ChFQb3N0VW5Bc3NpZ25Sb2xlcxIOLlVuQXNzaWdu", + "Um9sZXMaFi5VbkFzc2lnblJvbGVzUmVzcG9uc2UiABJkCh9QdXRVcGRhdGVD", + "b25uZWN0aW9uSW5mb1JvY2tzdGFyEh0uVXBkYXRlQ29ubmVjdGlvbkluZm9S", + "b2Nrc3RhchogLlJvY2tzdGFyV2l0aElkQW5kUmVzdWx0UmVzcG9uc2UiABJS", + "ChZQdXRVcGRhdGVOYW1lZFJvY2tzdGFyEhQuVXBkYXRlTmFtZWRSb2Nrc3Rh", + "chogLlJvY2tzdGFyV2l0aElkQW5kUmVzdWx0UmVzcG9uc2UiABI2ChFQdXRV", + "cGRhdGVSb2Nrc3RhchIPLlVwZGF0ZVJvY2tzdGFyGg4uRW1wdHlSZXNwb25z", + "ZSIAElYKIVB1dFVwZGF0ZVJvY2tzdGFyQWRob2NOb25EZWZhdWx0cxIfLlVw", + "ZGF0ZVJvY2tzdGFyQWRob2NOb25EZWZhdWx0cxoOLkVtcHR5UmVzcG9uc2Ui", + "ABJCChhQYXRjaFVwZGF0ZVJvY2tzdGFyQXVkaXQSFC5VcGRhdGVSb2Nrc3Rh", + "ckF1ZGl0Gg4uRW1wdHlSZXNwb25zZSIAEl4KHFB1dFVwZGF0ZVJvY2tzdGFy", + "QXVkaXRUZW5hbnQSGi5VcGRhdGVSb2Nrc3RhckF1ZGl0VGVuYW50GiAuUm9j", + "a3N0YXJXaXRoSWRBbmRSZXN1bHRSZXNwb25zZSIAEmwKI1B1dFVwZGF0ZVJv", + "Y2tzdGFyQXVkaXRUZW5hbnRHYXRld2F5EiEuVXBkYXRlUm9ja3N0YXJBdWRp", + "dFRlbmFudEdhdGV3YXkaIC5Sb2Nrc3RhcldpdGhJZEFuZFJlc3VsdFJlc3Bv", + "bnNlIgASUAoeUHV0VXBkYXRlUm9ja3N0YXJBdWRpdFRlbmFudE1xEhwuVXBk", + "YXRlUm9ja3N0YXJBdWRpdFRlbmFudE1xGg4uRW1wdHlSZXNwb25zZSIAElwK", + "GlBhdGNoVXBkYXRlUm9ja3N0YXJWZXJzaW9uEhYuVXBkYXRlUm9ja3N0YXJW", + "ZXJzaW9uGiQuUm9ja3N0YXJXaXRoSWRBbmRSb3dWZXJzaW9uUmVzcG9uc2Ui", + "ABIuCg1QdXRVcGRhdGVUb2RvEgsuVXBkYXRlVG9kbxoOLkVtcHR5UmVzcG9u", + "c2UiABJQChpQb3N0VmFsaWRhdGVDcmVhdGVSb2Nrc3RhchIXLlZhbGlkYXRl", + "Q3JlYXRlUm9ja3N0YXIaFy5Sb2Nrc3RhcldpdGhJZFJlc3BvbnNlIgBCTqoC", + "JFNlcnZpY2VTdGFjay5FeHRlbnNpb25zLlRlc3RzLlByb3RvY8oCJFNlcnZp", + "Y2VTdGFjay5FeHRlbnNpb25zLlRlc3RzLlByb3RvY2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ServiceStack.Extensions.Tests.Protoc.HttpStatusCode), typeof(global::ServiceStack.Extensions.Tests.Protoc.LivingStatus), typeof(global::ServiceStack.Extensions.Tests.Protoc.SomeEnum), typeof(global::ServiceStack.Extensions.Tests.Protoc.SomeEnumAsInt), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.AddHeader), global::ServiceStack.Extensions.Tests.Protoc.AddHeader.Parser, new[]{ "Name", "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Adhoc), global::ServiceStack.Extensions.Tests.Protoc.Adhoc.Parser, new[]{ "Id", "FirstName", "LastName" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.AllFields), global::ServiceStack.Extensions.Tests.Protoc.AllFields.Parser, new[]{ "Id", "NullableId", "Byte", "Short", "Int", "Long", "UShort", "UInt", "ULong", "Float", "Double", "Decimal", "String", "DateTime", "TimeSpan", "Guid", "NullableDateTime", "NullableTimeSpan", "NullableGuid", "Enum", "NullableEnum" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.AnyHello), global::ServiceStack.Extensions.Tests.Protoc.AnyHello.Parser, new[]{ "Name" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.AssignRoles), global::ServiceStack.Extensions.Tests.Protoc.AssignRoles.Parser, new[]{ "UserName", "Permissions", "Roles", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.AssignRolesResponse), global::ServiceStack.Extensions.Tests.Protoc.AssignRolesResponse.Parser, new[]{ "AllRoles", "AllPermissions", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.AuditBase), global::ServiceStack.Extensions.Tests.Protoc.AuditBase.Parser, new[]{ "CreatedDate", "CreatedBy", "CreatedInfo", "ModifiedDate", "ModifiedBy", "ModifiedInfo", "SoftDeletedDate", "SoftDeletedBy", "SoftDeletedInfo", "RockstarAuditTenant" }, new[]{ "Subtype" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Authenticate), global::ServiceStack.Extensions.Tests.Protoc.Authenticate.Parser, new[]{ "Provider", "State", "OauthToken", "OauthVerifier", "UserName", "Password", "RememberMe", "ErrorView", "Nonce", "Uri", "Response", "Qop", "Nc", "Cnonce", "UseTokenCookie", "AccessToken", "AccessTokenSecret", "Scope", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse), global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse.Parser, new[]{ "UserId", "SessionId", "UserName", "DisplayName", "ReferrerUrl", "BearerToken", "RefreshToken", "ProfileUrl", "Roles", "Permissions", "ResponseStatus", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Bar), global::ServiceStack.Extensions.Tests.Protoc.Bar.Parser, new[]{ "Y" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Bookmark), global::ServiceStack.Extensions.Tests.Protoc.Bookmark.Parser, new[]{ "Slug", "Title", "Description", "Url" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ChangeConnectionInfo), global::ServiceStack.Extensions.Tests.Protoc.ChangeConnectionInfo.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ChangeDb), global::ServiceStack.Extensions.Tests.Protoc.ChangeDb.Parser, new[]{ "NamedConnection", "ConnectionString", "ProviderName" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ChangeDbResponse), global::ServiceStack.Extensions.Tests.Protoc.ChangeDbResponse.Parser, new[]{ "Results" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ChatMessage), global::ServiceStack.Extensions.Tests.Protoc.ChatMessage.Parser, new[]{ "Id", "Channel", "FromUserId", "FromName", "DisplayName", "Message", "UserAuthId", "Private" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToToken), global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToToken.Parser, new[]{ "PreserveSession", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToTokenResponse), global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToTokenResponse.Parser, new[]{ "Meta", "AccessToken", "RefreshToken", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse), global::ServiceStack.Extensions.Tests.Protoc.CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse), global::ServiceStack.Extensions.Tests.Protoc.CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateBookmark), global::ServiceStack.Extensions.Tests.Protoc.CreateBookmark.Parser, new[]{ "Slug", "Title", "Description", "Url" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateBookmarkResponse), global::ServiceStack.Extensions.Tests.Protoc.CreateBookmarkResponse.Parser, new[]{ "Id", "Result", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateConnectionInfoRockstar), global::ServiceStack.Extensions.Tests.Protoc.CreateConnectionInfoRockstar.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateNamedRockstar), global::ServiceStack.Extensions.Tests.Protoc.CreateNamedRockstar.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstar), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstar.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAdhocNonDefaults), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAdhocNonDefaults.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAudit), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAudit.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditMqToken), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditMqToken.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "BearerToken" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenant), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenant.Parser, new[]{ "BearerToken", "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantGateway), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantGateway.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAutoMap), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAutoMap.Parser, new[]{ "MapFirstName", "MapLastName", "MapAge", "MapDateOfBirth", "MapDateDied", "MapLivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarResponse), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarResponse.Parser, new[]{ "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarVersion), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarVersion.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithAutoGuid), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithAutoGuid.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturn), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturn.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturnGuidResponse), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturnGuidResponse.Parser, new[]{ "Id", "Result", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithVoidReturn), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithVoidReturn.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateTodo), global::ServiceStack.Extensions.Tests.Protoc.CreateTodo.Parser, new[]{ "Title", "Order" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CreateTodoResponse), global::ServiceStack.Extensions.Tests.Protoc.CreateTodoResponse.Parser, new[]{ "Result", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CustomRockstar), global::ServiceStack.Extensions.Tests.Protoc.CustomRockstar.Parser, new[]{ "FirstName", "LastName", "Age", "RockstarAlbumName", "RockstarGenreName" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CustomRockstarSchema), global::ServiceStack.Extensions.Tests.Protoc.CustomRockstarSchema.Parser, new[]{ "FirstName", "LastName", "Age", "RockstarAlbumName", "RockstarGenreName" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CustomSelectRockstar), global::ServiceStack.Extensions.Tests.Protoc.CustomSelectRockstar.Parser, new[]{ "Id", "FirstName", "LastName", "Age" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CustomSelectRockstarResponse), global::ServiceStack.Extensions.Tests.Protoc.CustomSelectRockstarResponse.Parser, new[]{ "Id", "FirstName", "Age" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.CustomValidationErrors), global::ServiceStack.Extensions.Tests.Protoc.CustomValidationErrors.Parser, new[]{ "CustomErrorCode", "CustomErrorCodeAndMessage", "ErrorCodeRule", "IsOddCondition", "IsOddAndOverTwoDigitsCondition", "IsOddOrOverTwoDigitsCondition" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.DaoBase), global::ServiceStack.Extensions.Tests.Protoc.DaoBase.Parser, new[]{ "Id", "CreateDate", "CreatedBy", "ModifiedDate", "ModifiedBy", "Bookmark" }, new[]{ "Subtype" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstar), global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstar.Parser, new[]{ "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarAudit), global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarAudit.Parser, new[]{ "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarCountResponse), global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarCountResponse.Parser, new[]{ "Count", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarFilters), global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarFilters.Parser, new[]{ "FirstName", "LastName", "Age" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodo), global::ServiceStack.Extensions.Tests.Protoc.DeleteTodo.Parser, new[]{ "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodos), global::ServiceStack.Extensions.Tests.Protoc.DeleteTodos.Parser, new[]{ "Ids" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest), global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest.Parser, new[]{ "Params" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.DynamicValidationRules), global::ServiceStack.Extensions.Tests.Protoc.DynamicValidationRules.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse), global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse.Parser, new[]{ "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.EmptyValidators), global::ServiceStack.Extensions.Tests.Protoc.EmptyValidators.Parser, new[]{ "Int", "NInt", "TimeSpan", "NTimeSpan", "String", "IntArray", "StringList" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest), global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest.Parser, new[]{ "Suffix" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse), global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse.Parser, new[]{ "Result", "Count", "Words" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Entry), global::ServiceStack.Extensions.Tests.Protoc.Entry.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.FileContent), global::ServiceStack.Extensions.Tests.Protoc.FileContent.Parser, new[]{ "Name", "Type", "Length", "Body", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Foo), global::ServiceStack.Extensions.Tests.Protoc.Foo.Parser, new[]{ "X", "Bar" }, new[]{ "Subtype" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetAccessToken), global::ServiceStack.Extensions.Tests.Protoc.GetAccessToken.Parser, new[]{ "RefreshToken", "UseTokenCookie", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetAccessTokenResponse), global::ServiceStack.Extensions.Tests.Protoc.GetAccessTokenResponse.Parser, new[]{ "AccessToken", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetApiKeys), global::ServiceStack.Extensions.Tests.Protoc.GetApiKeys.Parser, new[]{ "Environment", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetApiKeysResponse), global::ServiceStack.Extensions.Tests.Protoc.GetApiKeysResponse.Parser, new[]{ "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetFile), global::ServiceStack.Extensions.Tests.Protoc.GetFile.Parser, new[]{ "Path" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetHello), global::ServiceStack.Extensions.Tests.Protoc.GetHello.Parser, new[]{ "Name" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetTodo), global::ServiceStack.Extensions.Tests.Protoc.GetTodo.Parser, new[]{ "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetTodoResponse), global::ServiceStack.Extensions.Tests.Protoc.GetTodoResponse.Parser, new[]{ "Result", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetTodos), global::ServiceStack.Extensions.Tests.Protoc.GetTodos.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.GetTodosResponse), global::ServiceStack.Extensions.Tests.Protoc.GetTodosResponse.Parser, new[]{ "Results", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt), global::ServiceStack.Extensions.Tests.Protoc.HelloJwt.Parser, new[]{ "Name", "BearerToken" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse), global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse.Parser, new[]{ "Result", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.HelloResponse), global::ServiceStack.Extensions.Tests.Protoc.HelloResponse.Parser, new[]{ "Result", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Incr), global::ServiceStack.Extensions.Tests.Protoc.Incr.Parser, new[]{ "Amount" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Movie), global::ServiceStack.Extensions.Tests.Protoc.Movie.Parser, new[]{ "Id", "ImdbId", "Title", "Rating", "Score", "Director", "ReleaseDate", "TagLine", "Genres" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Multiply), global::ServiceStack.Extensions.Tests.Protoc.Multiply.Parser, new[]{ "X", "Y" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.MultiplyResponse), global::ServiceStack.Extensions.Tests.Protoc.MultiplyResponse.Parser, new[]{ "Result" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.NamedRockstar), global::ServiceStack.Extensions.Tests.Protoc.NamedRockstar.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.NoAbstractValidator), global::ServiceStack.Extensions.Tests.Protoc.NoAbstractValidator.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.OnlyValidatesRequest), global::ServiceStack.Extensions.Tests.Protoc.OnlyValidatesRequest.Parser, new[]{ "Test", "NotNull" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.PagingTest), global::ServiceStack.Extensions.Tests.Protoc.PagingTest.Parser, new[]{ "Id", "Name", "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse), global::ServiceStack.Extensions.Tests.Protoc.PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse), global::ServiceStack.Extensions.Tests.Protoc.PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstar), global::ServiceStack.Extensions.Tests.Protoc.PatchRockstar.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenant), global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenant.Parser, new[]{ "BearerToken", "Id", "FirstName", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantGateway), global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantGateway.Parser, new[]{ "Id", "FirstName", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantMq), global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantMq.Parser, new[]{ "Id", "FirstName", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.PostChatToChannel), global::ServiceStack.Extensions.Tests.Protoc.PostChatToChannel.Parser, new[]{ "From", "ToUserId", "Channel", "Message", "Selector" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhoc), global::ServiceStack.Extensions.Tests.Protoc.QueryAdhoc.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhocRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryAdhocRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "FirstName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryAllFields), global::ServiceStack.Extensions.Tests.Protoc.QueryAllFields.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Guid" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryBookmarks), global::ServiceStack.Extensions.Tests.Protoc.QueryBookmarks.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryCaseInsensitiveOrderBy), global::ServiceStack.Extensions.Tests.Protoc.QueryCaseInsensitiveOrderBy.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeConnectionInfo), global::ServiceStack.Extensions.Tests.Protoc.QueryChangeConnectionInfo.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeDb), global::ServiceStack.Extensions.Tests.Protoc.QueryChangeDb.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "NamedConnection", "ConnectionString", "ProviderName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsFilter), global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsFilter.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsReferences), global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsReferences.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsSchema), global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsSchema.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryDbTenant_RockstarAuditTenant_RockstarAuto), global::ServiceStack.Extensions.Tests.Protoc.QueryDbTenant_RockstarAuditTenant_RockstarAuto.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "FirstName", "FirstNames", "Age", "FirstNameCaseInsensitive", "FirstNameStartsWith", "LastNameEndsWith", "FirstNameBetween", "OrLastName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstarsDynamic), global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstarsDynamic.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldsImplicitConventions), global::ServiceStack.Extensions.Tests.Protoc.QueryFieldsImplicitConventions.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "FirstNameContains", "LastNameEndsWith" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryFoos), global::ServiceStack.Extensions.Tests.Protoc.QueryFoos.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "X" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Ids", "Ages", "FirstNames", "IdsBetween" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstarsDynamic), global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstarsDynamic.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbums), global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbums.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age", "RockstarAlbumName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelect), global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelect.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age", "RockstarAlbumName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelectResponse), global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelectResponse.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age", "RockstarAlbumName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryMovies), global::ServiceStack.Extensions.Tests.Protoc.QueryMovies.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Ids", "ImdbIds", "Ratings" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryMultiJoinRockstar), global::ServiceStack.Extensions.Tests.Protoc.QueryMultiJoinRockstar.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age", "RockstarAlbumName", "RockstarGenreName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryNamedRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryNamedRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age", "FirstName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstarsFields), global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstarsFields.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "FirstName", "LastName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedCustomRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedCustomRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryPagingTest), global::ServiceStack.Extensions.Tests.Protoc.QueryPagingTest.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Id", "Name", "Value" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Adhoc), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Adhoc.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_AllFields), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_AllFields.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Bookmark), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Bookmark.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstarSchema), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstarSchema.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstar), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstar.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstarResponse), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstarResponse.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Foo), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Foo.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_NamedRockstar), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_NamedRockstar.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_PagingTest), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_PagingTest.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlbum), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlbum.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlias), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlias.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_TypeWithEnum), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_TypeWithEnum.Parser, new[]{ "Offset", "Total", "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbums), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbums.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Id", "RockstarId", "Name", "Genre", "IdBetween" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsCustomLeftJoin), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsCustomLeftJoin.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age", "AlbumName", "IdNotEqualTo" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsImplicit), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsImplicit.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsLeftJoin), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsLeftJoin.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age", "AlbumName", "IdNotEqualTo" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlias), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlias.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age", "RockstarAlbumName" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAudit), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAudit.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Id" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAuditSubOr), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAuditSubOr.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "FirstNameStartsWith", "AgeOlderThan" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarFilters), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarFilters.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Ids", "Ages", "FirstNames", "IdsBetween" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsConventions), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsConventions.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "DateOfBirthGreaterThan", "DateDiedLessThan", "Ids", "AgeOlderThan", "AgeGreaterThanOrEqualTo", "AgeGreaterThan", "GreaterThanAge", "FirstNameStartsWith", "LastNameEndsWith", "LastNameContains", "RockstarAlbumNameContains", "RockstarIdAfter", "RockstarIdOnOrAfter" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsFilter), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsFilter.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsIFilter), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsIFilter.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsImplicit), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsImplicit.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsWithReferences), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsWithReferences.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Age" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryTypeWithEnums), global::ServiceStack.Extensions.Tests.Protoc.QueryTypeWithEnums.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.QueryUnknownRockstars), global::ServiceStack.Extensions.Tests.Protoc.QueryUnknownRockstars.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "UnknownInt", "UnknownProperty" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenant), global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenant.Parser, new[]{ "BearerToken", "Id", "Age" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantGateway), global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantGateway.Parser, new[]{ "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantMq), global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantMq.Parser, new[]{ "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeys), global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeys.Parser, new[]{ "Environment", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeysResponse), global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeysResponse.Parser, new[]{ "Results", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Register), global::ServiceStack.Extensions.Tests.Protoc.Register.Parser, new[]{ "UserName", "FirstName", "LastName", "DisplayName", "Email", "Password", "ConfirmPassword", "AutoLogin", "ErrorView", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RegisterResponse), global::ServiceStack.Extensions.Tests.Protoc.RegisterResponse.Parser, new[]{ "UserId", "SessionId", "UserName", "ReferrerUrl", "BearerToken", "RefreshToken", "ResponseStatus", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth), global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth.Parser, new[]{ "Name", "BearerToken" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ResetTodos), global::ServiceStack.Extensions.Tests.Protoc.ResetTodos.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ResponseError), global::ServiceStack.Extensions.Tests.Protoc.ResponseError.Parser, new[]{ "ErrorCode", "FieldName", "Message", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus), global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus.Parser, new[]{ "ErrorCode", "Message", "StackTrace", "Errors", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Rockstar), global::ServiceStack.Extensions.Tests.Protoc.Rockstar.Parser, new[]{ "Id", "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "NamedRockstar" }, new[]{ "Subtype" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarAlbum), global::ServiceStack.Extensions.Tests.Protoc.RockstarAlbum.Parser, new[]{ "Id", "RockstarId", "Name", "Genre" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarAlias), global::ServiceStack.Extensions.Tests.Protoc.RockstarAlias.Parser, new[]{ "RockstarId", "FirstName", "Surname", "Album" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarAudit), global::ServiceStack.Extensions.Tests.Protoc.RockstarAudit.Parser, new[]{ "Id", "CreatedDate", "CreatedBy", "CreatedInfo", "ModifiedDate", "ModifiedBy", "ModifiedInfo" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarAuditTenant), global::ServiceStack.Extensions.Tests.Protoc.RockstarAuditTenant.Parser, new[]{ "TenantId", "Id", "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarAuto), global::ServiceStack.Extensions.Tests.Protoc.RockstarAuto.Parser, new[]{ "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarAutoGuid), global::ServiceStack.Extensions.Tests.Protoc.RockstarAutoGuid.Parser, new[]{ "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarBase), global::ServiceStack.Extensions.Tests.Protoc.RockstarBase.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "RockstarAutoGuid", "RockstarAuto", "RockstarAudit", "RockstarVersion" }, new[]{ "Subtype" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarGenre), global::ServiceStack.Extensions.Tests.Protoc.RockstarGenre.Parser, new[]{ "Id", "RockstarId", "Name" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarReference), global::ServiceStack.Extensions.Tests.Protoc.RockstarReference.Parser, new[]{ "Id", "FirstName", "LastName", "Age", "Albums" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarVersion), global::ServiceStack.Extensions.Tests.Protoc.RockstarVersion.Parser, new[]{ "Id", "RowVersion" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndCountResponse), global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndCountResponse.Parser, new[]{ "Id", "Count", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse), global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse.Parser, new[]{ "Id", "Result", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndRowVersionResponse), global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndRowVersionResponse.Parser, new[]{ "Id", "RowVersion", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse), global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse.Parser, new[]{ "Id", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.SearchMovies), global::ServiceStack.Extensions.Tests.Protoc.SearchMovies.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.SearchResult), global::ServiceStack.Extensions.Tests.Protoc.SearchResult.Parser, new[]{ "Id", "Suffix" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Secured), global::ServiceStack.Extensions.Tests.Protoc.Secured.Parser, new[]{ "Name" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.SecuredResponse), global::ServiceStack.Extensions.Tests.Protoc.SecuredResponse.Parser, new[]{ "Result", "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse), global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenant), global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenant.Parser, new[]{ "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse), global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.StreamFiles), global::ServiceStack.Extensions.Tests.Protoc.StreamFiles.Parser, new[]{ "Paths" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.StreamMovies), global::ServiceStack.Extensions.Tests.Protoc.StreamMovies.Parser, new[]{ "Skip", "Take", "OrderBy", "OrderByDesc", "Include", "Fields", "Meta", "Ratings" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.StreamServerEvents), global::ServiceStack.Extensions.Tests.Protoc.StreamServerEvents.Parser, new[]{ "Channels" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.StreamServerEventsResponse), global::ServiceStack.Extensions.Tests.Protoc.StreamServerEventsResponse.Parser, new[]{ "EventId", "Channel", "Selector", "Json", "Op", "Target", "CssSelector", "Meta", "UserId", "DisplayName", "ProfileUrl", "IsAuthenticated", "Channels", "CreatedAt", "Id", "UnRegisterUrl", "UpdateSubscriberUrl", "HeartbeatUrl", "HeartbeatIntervalMs", "IdleTimeoutMs", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.TestAuthValidators), global::ServiceStack.Extensions.Tests.Protoc.TestAuthValidators.Parser, new[]{ "NotNull" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.TestDbCondition), global::ServiceStack.Extensions.Tests.Protoc.TestDbCondition.Parser, new[]{ "Id", "NotNull" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.TestDbValidator), global::ServiceStack.Extensions.Tests.Protoc.TestDbValidator.Parser, new[]{ "Id", "NotNull" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.TestIsAdmin), global::ServiceStack.Extensions.Tests.Protoc.TestIsAdmin.Parser, new[]{ "NotNull" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.TestMultiAuthValidators), global::ServiceStack.Extensions.Tests.Protoc.TestMultiAuthValidators.Parser, new[]{ "NotNull" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Throw), global::ServiceStack.Extensions.Tests.Protoc.Throw.Parser, new[]{ "Message" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ThrowCustom), global::ServiceStack.Extensions.Tests.Protoc.ThrowCustom.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ThrowCustomResponse), global::ServiceStack.Extensions.Tests.Protoc.ThrowCustomResponse.Parser, new[]{ "ResponseStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ThrowVoid), global::ServiceStack.Extensions.Tests.Protoc.ThrowVoid.Parser, new[]{ "Message" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.Todo), global::ServiceStack.Extensions.Tests.Protoc.Todo.Parser, new[]{ "Id", "Title", "Order", "Completed" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.TriggerAllValidators), global::ServiceStack.Extensions.Tests.Protoc.TriggerAllValidators.Parser, new[]{ "CreditCard", "Email", "Empty", "Equal", "ExclusiveBetween", "GreaterThanOrEqual", "GreaterThan", "InclusiveBetween", "Length", "LessThanOrEqual", "LessThan", "NotEmpty", "NotEqual", "Null", "RegularExpression", "ScalePrecision" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.TriggerValidators), global::ServiceStack.Extensions.Tests.Protoc.TriggerValidators.Parser, new[]{ "CreditCard", "Email", "Empty", "Equal", "ExclusiveBetween", "GreaterThanOrEqual", "GreaterThan", "InclusiveBetween", "Length", "LessThanOrEqual", "LessThan", "NotEmpty", "NotEqual", "Null", "RegularExpression", "ScalePrecision" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.TypeWithEnum), global::ServiceStack.Extensions.Tests.Protoc.TypeWithEnum.Parser, new[]{ "Id", "Name", "SomeEnum", "SomeEnumAsInt", "NSomeEnum", "NSomeEnumAsInt" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UnAssignRoles), global::ServiceStack.Extensions.Tests.Protoc.UnAssignRoles.Parser, new[]{ "UserName", "Permissions", "Roles", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UnAssignRolesResponse), global::ServiceStack.Extensions.Tests.Protoc.UnAssignRolesResponse.Parser, new[]{ "AllRoles", "AllPermissions", "Meta", "ResponseStatus" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse), global::ServiceStack.Extensions.Tests.Protoc.UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse), global::ServiceStack.Extensions.Tests.Protoc.UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateConnectionInfoRockstar), global::ServiceStack.Extensions.Tests.Protoc.UpdateConnectionInfoRockstar.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateNamedRockstar), global::ServiceStack.Extensions.Tests.Protoc.UpdateNamedRockstar.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstar), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstar.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAdhocNonDefaults), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAdhocNonDefaults.Parser, new[]{ "Id", "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAudit), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAudit.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "Id" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenant), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenant.Parser, new[]{ "BearerToken", "Id", "FirstName", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantGateway), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantGateway.Parser, new[]{ "Id", "FirstName", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantMq), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantMq.Parser, new[]{ "Id", "FirstName", "LivingStatus" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarVersion), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarVersion.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus", "Id", "RowVersion" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UpdateTodo), global::ServiceStack.Extensions.Tests.Protoc.UpdateTodo.Parser, new[]{ "Id", "Title", "Order", "Completed" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.UserApiKey), global::ServiceStack.Extensions.Tests.Protoc.UserApiKey.Parser, new[]{ "Key", "KeyType", "ExpiryDate", "Meta" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::ServiceStack.Extensions.Tests.Protoc.ValidateCreateRockstar), global::ServiceStack.Extensions.Tests.Protoc.ValidateCreateRockstar.Parser, new[]{ "FirstName", "LastName", "Age", "DateOfBirth", "DateDied", "LivingStatus" }, null, null, null) + })); + } + #endregion + + } + #region Enums + public enum HttpStatusCode { + /// + /// proto3 requires a zero value as the first item (it can be named anything) + /// + [pbr::OriginalName("ZERO")] Zero = 0, + [pbr::OriginalName("Continue")] Continue = 100, + [pbr::OriginalName("SwitchingProtocols")] SwitchingProtocols = 101, + [pbr::OriginalName("Processing")] Processing = 102, + [pbr::OriginalName("EarlyHints")] EarlyHints = 103, + [pbr::OriginalName("OK")] Ok = 200, + [pbr::OriginalName("Created")] Created = 201, + [pbr::OriginalName("Accepted")] Accepted = 202, + [pbr::OriginalName("NonAuthoritativeInformation")] NonAuthoritativeInformation = 203, + [pbr::OriginalName("NoContent")] NoContent = 204, + [pbr::OriginalName("ResetContent")] ResetContent = 205, + [pbr::OriginalName("PartialContent")] PartialContent = 206, + [pbr::OriginalName("MultiStatus")] MultiStatus = 207, + [pbr::OriginalName("AlreadyReported")] AlreadyReported = 208, + [pbr::OriginalName("IMUsed")] Imused = 226, + [pbr::OriginalName("MultipleChoices")] MultipleChoices = 300, + [pbr::OriginalName("Ambiguous", PreferredAlias = false)] Ambiguous = 300, + [pbr::OriginalName("MovedPermanently")] MovedPermanently = 301, + [pbr::OriginalName("Moved", PreferredAlias = false)] Moved = 301, + [pbr::OriginalName("Found")] Found = 302, + [pbr::OriginalName("Redirect", PreferredAlias = false)] Redirect = 302, + [pbr::OriginalName("SeeOther")] SeeOther = 303, + [pbr::OriginalName("RedirectMethod", PreferredAlias = false)] RedirectMethod = 303, + [pbr::OriginalName("NotModified")] NotModified = 304, + [pbr::OriginalName("UseProxy")] UseProxy = 305, + [pbr::OriginalName("Unused")] Unused = 306, + [pbr::OriginalName("TemporaryRedirect")] TemporaryRedirect = 307, + [pbr::OriginalName("RedirectKeepVerb", PreferredAlias = false)] RedirectKeepVerb = 307, + [pbr::OriginalName("PermanentRedirect")] PermanentRedirect = 308, + [pbr::OriginalName("BadRequest")] BadRequest = 400, + [pbr::OriginalName("Unauthorized")] Unauthorized = 401, + [pbr::OriginalName("PaymentRequired")] PaymentRequired = 402, + [pbr::OriginalName("Forbidden")] Forbidden = 403, + [pbr::OriginalName("NotFound")] NotFound = 404, + [pbr::OriginalName("MethodNotAllowed")] MethodNotAllowed = 405, + [pbr::OriginalName("NotAcceptable")] NotAcceptable = 406, + [pbr::OriginalName("ProxyAuthenticationRequired")] ProxyAuthenticationRequired = 407, + [pbr::OriginalName("RequestTimeout")] RequestTimeout = 408, + [pbr::OriginalName("Conflict")] Conflict = 409, + [pbr::OriginalName("Gone")] Gone = 410, + [pbr::OriginalName("LengthRequired")] LengthRequired = 411, + [pbr::OriginalName("PreconditionFailed")] PreconditionFailed = 412, + [pbr::OriginalName("RequestEntityTooLarge")] RequestEntityTooLarge = 413, + [pbr::OriginalName("RequestUriTooLong")] RequestUriTooLong = 414, + [pbr::OriginalName("UnsupportedMediaType")] UnsupportedMediaType = 415, + [pbr::OriginalName("RequestedRangeNotSatisfiable")] RequestedRangeNotSatisfiable = 416, + [pbr::OriginalName("ExpectationFailed")] ExpectationFailed = 417, + [pbr::OriginalName("MisdirectedRequest")] MisdirectedRequest = 421, + [pbr::OriginalName("UnprocessableEntity")] UnprocessableEntity = 422, + [pbr::OriginalName("Locked")] Locked = 423, + [pbr::OriginalName("FailedDependency")] FailedDependency = 424, + [pbr::OriginalName("UpgradeRequired")] UpgradeRequired = 426, + [pbr::OriginalName("PreconditionRequired")] PreconditionRequired = 428, + [pbr::OriginalName("TooManyRequests")] TooManyRequests = 429, + [pbr::OriginalName("RequestHeaderFieldsTooLarge")] RequestHeaderFieldsTooLarge = 431, + [pbr::OriginalName("UnavailableForLegalReasons")] UnavailableForLegalReasons = 451, + [pbr::OriginalName("InternalServerError")] InternalServerError = 500, + [pbr::OriginalName("NotImplemented")] NotImplemented = 501, + [pbr::OriginalName("BadGateway")] BadGateway = 502, + [pbr::OriginalName("ServiceUnavailable")] ServiceUnavailable = 503, + [pbr::OriginalName("GatewayTimeout")] GatewayTimeout = 504, + [pbr::OriginalName("HttpVersionNotSupported")] HttpVersionNotSupported = 505, + [pbr::OriginalName("VariantAlsoNegotiates")] VariantAlsoNegotiates = 506, + [pbr::OriginalName("InsufficientStorage")] InsufficientStorage = 507, + [pbr::OriginalName("LoopDetected")] LoopDetected = 508, + [pbr::OriginalName("NotExtended")] NotExtended = 510, + [pbr::OriginalName("NetworkAuthenticationRequired")] NetworkAuthenticationRequired = 511, + } + + public enum LivingStatus { + [pbr::OriginalName("Alive")] Alive = 0, + [pbr::OriginalName("Dead")] Dead = 1, + } + + public enum SomeEnum { + [pbr::OriginalName("SomeEnum_Value0")] Value0 = 0, + [pbr::OriginalName("SomeEnum_Value1")] Value1 = 1, + [pbr::OriginalName("SomeEnum_Value2")] Value2 = 2, + [pbr::OriginalName("SomeEnum_Value3")] Value3 = 3, + } + + public enum SomeEnumAsInt { + [pbr::OriginalName("Value0")] Value0 = 0, + [pbr::OriginalName("Value1")] Value1 = 1, + [pbr::OriginalName("Value2")] Value2 = 2, + [pbr::OriginalName("Value3")] Value3 = 3, + } + + #endregion + + #region Messages + public sealed partial class AddHeader : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddHeader()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AddHeader() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AddHeader(AddHeader other) : this() { + name_ = other.name_; + value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AddHeader Clone() { + return new AddHeader(this); + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Value" field. + public const int ValueFieldNumber = 2; + private string value_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Value { + get { return value_; } + set { + value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AddHeader); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AddHeader other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (Value != other.Value) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Value.Length != 0) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Value.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Value.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Value); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AddHeader other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Value.Length != 0) { + Value = other.Value; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Value = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class Adhoc : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Adhoc()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Adhoc() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Adhoc(Adhoc other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + lastName_ = other.lastName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Adhoc Clone() { + return new Adhoc(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "first_name" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 3; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Adhoc); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Adhoc other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(LastName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Adhoc other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 26: { + LastName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class AllFields : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AllFields()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AllFields() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AllFields(AllFields other) : this() { + id_ = other.id_; + nullableId_ = other.nullableId_; + byte_ = other.byte_; + short_ = other.short_; + int_ = other.int_; + long_ = other.long_; + uShort_ = other.uShort_; + uInt_ = other.uInt_; + uLong_ = other.uLong_; + float_ = other.float_; + double_ = other.double_; + decimal_ = other.decimal_; + string_ = other.string_; + dateTime_ = other.dateTime_ != null ? other.dateTime_.Clone() : null; + timeSpan_ = other.timeSpan_ != null ? other.timeSpan_.Clone() : null; + guid_ = other.guid_; + nullableDateTime_ = other.nullableDateTime_ != null ? other.nullableDateTime_.Clone() : null; + nullableTimeSpan_ = other.nullableTimeSpan_ != null ? other.nullableTimeSpan_.Clone() : null; + nullableGuid_ = other.nullableGuid_; + enum_ = other.enum_; + nullableEnum_ = other.nullableEnum_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AllFields Clone() { + return new AllFields(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "NullableId" field. + public const int NullableIdFieldNumber = 2; + private int nullableId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int NullableId { + get { return nullableId_; } + set { + nullableId_ = value; + } + } + + /// Field number for the "Byte" field. + public const int ByteFieldNumber = 3; + private uint byte_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint Byte { + get { return byte_; } + set { + byte_ = value; + } + } + + /// Field number for the "Short" field. + public const int ShortFieldNumber = 4; + private int short_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Short { + get { return short_; } + set { + short_ = value; + } + } + + /// Field number for the "Int" field. + public const int IntFieldNumber = 5; + private int int_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Int { + get { return int_; } + set { + int_ = value; + } + } + + /// Field number for the "Long" field. + public const int LongFieldNumber = 6; + private long long_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Long { + get { return long_; } + set { + long_ = value; + } + } + + /// Field number for the "UShort" field. + public const int UShortFieldNumber = 7; + private uint uShort_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint UShort { + get { return uShort_; } + set { + uShort_ = value; + } + } + + /// Field number for the "UInt" field. + public const int UIntFieldNumber = 8; + private uint uInt_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint UInt { + get { return uInt_; } + set { + uInt_ = value; + } + } + + /// Field number for the "ULong" field. + public const int ULongFieldNumber = 9; + private ulong uLong_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong ULong { + get { return uLong_; } + set { + uLong_ = value; + } + } + + /// Field number for the "Float" field. + public const int FloatFieldNumber = 10; + private float float_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public float Float { + get { return float_; } + set { + float_ = value; + } + } + + /// Field number for the "Double" field. + public const int DoubleFieldNumber = 11; + private double double_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double Double { + get { return double_; } + set { + double_ = value; + } + } + + /// Field number for the "Decimal" field. + public const int DecimalFieldNumber = 12; + private string decimal_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Decimal { + get { return decimal_; } + set { + decimal_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "String" field. + public const int StringFieldNumber = 13; + private string string_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string String { + get { return string_; } + set { + string_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "DateTime" field. + public const int DateTimeFieldNumber = 14; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateTime_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateTime { + get { return dateTime_; } + set { + dateTime_ = value; + } + } + + /// Field number for the "TimeSpan" field. + public const int TimeSpanFieldNumber = 15; + private global::Google.Protobuf.WellKnownTypes.Duration timeSpan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Duration TimeSpan { + get { return timeSpan_; } + set { + timeSpan_ = value; + } + } + + /// Field number for the "Guid" field. + public const int GuidFieldNumber = 16; + private string guid_ = ""; + /// + /// default value could not be applied: 00000000-0000-0000-0000-000000000000 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Guid { + get { return guid_; } + set { + guid_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "NullableDateTime" field. + public const int NullableDateTimeFieldNumber = 17; + private global::Google.Protobuf.WellKnownTypes.Timestamp nullableDateTime_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp NullableDateTime { + get { return nullableDateTime_; } + set { + nullableDateTime_ = value; + } + } + + /// Field number for the "NullableTimeSpan" field. + public const int NullableTimeSpanFieldNumber = 18; + private global::Google.Protobuf.WellKnownTypes.Duration nullableTimeSpan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Duration NullableTimeSpan { + get { return nullableTimeSpan_; } + set { + nullableTimeSpan_ = value; + } + } + + /// Field number for the "NullableGuid" field. + public const int NullableGuidFieldNumber = 19; + private string nullableGuid_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NullableGuid { + get { return nullableGuid_; } + set { + nullableGuid_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Enum" field. + public const int EnumFieldNumber = 20; + private global::ServiceStack.Extensions.Tests.Protoc.HttpStatusCode enum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.HttpStatusCode Enum { + get { return enum_; } + set { + enum_ = value; + } + } + + /// Field number for the "NullableEnum" field. + public const int NullableEnumFieldNumber = 21; + private global::ServiceStack.Extensions.Tests.Protoc.HttpStatusCode nullableEnum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.HttpStatusCode NullableEnum { + get { return nullableEnum_; } + set { + nullableEnum_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AllFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AllFields other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (NullableId != other.NullableId) return false; + if (Byte != other.Byte) return false; + if (Short != other.Short) return false; + if (Int != other.Int) return false; + if (Long != other.Long) return false; + if (UShort != other.UShort) return false; + if (UInt != other.UInt) return false; + if (ULong != other.ULong) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Float, other.Float)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Double, other.Double)) return false; + if (Decimal != other.Decimal) return false; + if (String != other.String) return false; + if (!object.Equals(DateTime, other.DateTime)) return false; + if (!object.Equals(TimeSpan, other.TimeSpan)) return false; + if (Guid != other.Guid) return false; + if (!object.Equals(NullableDateTime, other.NullableDateTime)) return false; + if (!object.Equals(NullableTimeSpan, other.NullableTimeSpan)) return false; + if (NullableGuid != other.NullableGuid) return false; + if (Enum != other.Enum) return false; + if (NullableEnum != other.NullableEnum) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (NullableId != 0) hash ^= NullableId.GetHashCode(); + if (Byte != 0) hash ^= Byte.GetHashCode(); + if (Short != 0) hash ^= Short.GetHashCode(); + if (Int != 0) hash ^= Int.GetHashCode(); + if (Long != 0L) hash ^= Long.GetHashCode(); + if (UShort != 0) hash ^= UShort.GetHashCode(); + if (UInt != 0) hash ^= UInt.GetHashCode(); + if (ULong != 0UL) hash ^= ULong.GetHashCode(); + if (Float != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Float); + if (Double != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Double); + if (Decimal.Length != 0) hash ^= Decimal.GetHashCode(); + if (String.Length != 0) hash ^= String.GetHashCode(); + if (dateTime_ != null) hash ^= DateTime.GetHashCode(); + if (timeSpan_ != null) hash ^= TimeSpan.GetHashCode(); + if (Guid.Length != 0) hash ^= Guid.GetHashCode(); + if (nullableDateTime_ != null) hash ^= NullableDateTime.GetHashCode(); + if (nullableTimeSpan_ != null) hash ^= NullableTimeSpan.GetHashCode(); + if (NullableGuid.Length != 0) hash ^= NullableGuid.GetHashCode(); + if (Enum != 0) hash ^= Enum.GetHashCode(); + if (NullableEnum != 0) hash ^= NullableEnum.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (NullableId != 0) { + output.WriteRawTag(16); + output.WriteInt32(NullableId); + } + if (Byte != 0) { + output.WriteRawTag(24); + output.WriteUInt32(Byte); + } + if (Short != 0) { + output.WriteRawTag(32); + output.WriteInt32(Short); + } + if (Int != 0) { + output.WriteRawTag(40); + output.WriteInt32(Int); + } + if (Long != 0L) { + output.WriteRawTag(48); + output.WriteInt64(Long); + } + if (UShort != 0) { + output.WriteRawTag(56); + output.WriteUInt32(UShort); + } + if (UInt != 0) { + output.WriteRawTag(64); + output.WriteUInt32(UInt); + } + if (ULong != 0UL) { + output.WriteRawTag(72); + output.WriteUInt64(ULong); + } + if (Float != 0F) { + output.WriteRawTag(85); + output.WriteFloat(Float); + } + if (Double != 0D) { + output.WriteRawTag(89); + output.WriteDouble(Double); + } + if (Decimal.Length != 0) { + output.WriteRawTag(98); + output.WriteString(Decimal); + } + if (String.Length != 0) { + output.WriteRawTag(106); + output.WriteString(String); + } + if (dateTime_ != null) { + output.WriteRawTag(114); + output.WriteMessage(DateTime); + } + if (timeSpan_ != null) { + output.WriteRawTag(122); + output.WriteMessage(TimeSpan); + } + if (Guid.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteString(Guid); + } + if (nullableDateTime_ != null) { + output.WriteRawTag(138, 1); + output.WriteMessage(NullableDateTime); + } + if (nullableTimeSpan_ != null) { + output.WriteRawTag(146, 1); + output.WriteMessage(NullableTimeSpan); + } + if (NullableGuid.Length != 0) { + output.WriteRawTag(154, 1); + output.WriteString(NullableGuid); + } + if (Enum != 0) { + output.WriteRawTag(160, 1); + output.WriteEnum((int) Enum); + } + if (NullableEnum != 0) { + output.WriteRawTag(168, 1); + output.WriteEnum((int) NullableEnum); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (NullableId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NullableId); + } + if (Byte != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Byte); + } + if (Short != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Short); + } + if (Int != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Int); + } + if (Long != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Long); + } + if (UShort != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(UShort); + } + if (UInt != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(UInt); + } + if (ULong != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(ULong); + } + if (Float != 0F) { + size += 1 + 4; + } + if (Double != 0D) { + size += 1 + 8; + } + if (Decimal.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Decimal); + } + if (String.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(String); + } + if (dateTime_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateTime); + } + if (timeSpan_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(TimeSpan); + } + if (Guid.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(Guid); + } + if (nullableDateTime_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(NullableDateTime); + } + if (nullableTimeSpan_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(NullableTimeSpan); + } + if (NullableGuid.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(NullableGuid); + } + if (Enum != 0) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) Enum); + } + if (NullableEnum != 0) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) NullableEnum); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AllFields other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.NullableId != 0) { + NullableId = other.NullableId; + } + if (other.Byte != 0) { + Byte = other.Byte; + } + if (other.Short != 0) { + Short = other.Short; + } + if (other.Int != 0) { + Int = other.Int; + } + if (other.Long != 0L) { + Long = other.Long; + } + if (other.UShort != 0) { + UShort = other.UShort; + } + if (other.UInt != 0) { + UInt = other.UInt; + } + if (other.ULong != 0UL) { + ULong = other.ULong; + } + if (other.Float != 0F) { + Float = other.Float; + } + if (other.Double != 0D) { + Double = other.Double; + } + if (other.Decimal.Length != 0) { + Decimal = other.Decimal; + } + if (other.String.Length != 0) { + String = other.String; + } + if (other.dateTime_ != null) { + if (dateTime_ == null) { + DateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateTime.MergeFrom(other.DateTime); + } + if (other.timeSpan_ != null) { + if (timeSpan_ == null) { + TimeSpan = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + TimeSpan.MergeFrom(other.TimeSpan); + } + if (other.Guid.Length != 0) { + Guid = other.Guid; + } + if (other.nullableDateTime_ != null) { + if (nullableDateTime_ == null) { + NullableDateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + NullableDateTime.MergeFrom(other.NullableDateTime); + } + if (other.nullableTimeSpan_ != null) { + if (nullableTimeSpan_ == null) { + NullableTimeSpan = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + NullableTimeSpan.MergeFrom(other.NullableTimeSpan); + } + if (other.NullableGuid.Length != 0) { + NullableGuid = other.NullableGuid; + } + if (other.Enum != 0) { + Enum = other.Enum; + } + if (other.NullableEnum != 0) { + NullableEnum = other.NullableEnum; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 16: { + NullableId = input.ReadInt32(); + break; + } + case 24: { + Byte = input.ReadUInt32(); + break; + } + case 32: { + Short = input.ReadInt32(); + break; + } + case 40: { + Int = input.ReadInt32(); + break; + } + case 48: { + Long = input.ReadInt64(); + break; + } + case 56: { + UShort = input.ReadUInt32(); + break; + } + case 64: { + UInt = input.ReadUInt32(); + break; + } + case 72: { + ULong = input.ReadUInt64(); + break; + } + case 85: { + Float = input.ReadFloat(); + break; + } + case 89: { + Double = input.ReadDouble(); + break; + } + case 98: { + Decimal = input.ReadString(); + break; + } + case 106: { + String = input.ReadString(); + break; + } + case 114: { + if (dateTime_ == null) { + DateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateTime); + break; + } + case 122: { + if (timeSpan_ == null) { + TimeSpan = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(TimeSpan); + break; + } + case 130: { + Guid = input.ReadString(); + break; + } + case 138: { + if (nullableDateTime_ == null) { + NullableDateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(NullableDateTime); + break; + } + case 146: { + if (nullableTimeSpan_ == null) { + NullableTimeSpan = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(NullableTimeSpan); + break; + } + case 154: { + NullableGuid = input.ReadString(); + break; + } + case 160: { + Enum = (global::ServiceStack.Extensions.Tests.Protoc.HttpStatusCode) input.ReadEnum(); + break; + } + case 168: { + NullableEnum = (global::ServiceStack.Extensions.Tests.Protoc.HttpStatusCode) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class AnyHello : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AnyHello()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnyHello() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnyHello(AnyHello other) : this() { + name_ = other.name_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnyHello Clone() { + return new AnyHello(this); + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AnyHello); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AnyHello other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AnyHello other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class AssignRoles : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AssignRoles()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AssignRoles() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AssignRoles(AssignRoles other) : this() { + userName_ = other.userName_; + permissions_ = other.permissions_.Clone(); + roles_ = other.roles_.Clone(); + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AssignRoles Clone() { + return new AssignRoles(this); + } + + /// Field number for the "UserName" field. + public const int UserNameFieldNumber = 1; + private string userName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserName { + get { return userName_; } + set { + userName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Permissions" field. + public const int PermissionsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_permissions_codec + = pb::FieldCodec.ForString(18); + private readonly pbc::RepeatedField permissions_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Permissions { + get { return permissions_; } + } + + /// Field number for the "Roles" field. + public const int RolesFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_roles_codec + = pb::FieldCodec.ForString(26); + private readonly pbc::RepeatedField roles_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Roles { + get { return roles_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AssignRoles); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AssignRoles other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (UserName != other.UserName) return false; + if(!permissions_.Equals(other.permissions_)) return false; + if(!roles_.Equals(other.roles_)) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (UserName.Length != 0) hash ^= UserName.GetHashCode(); + hash ^= permissions_.GetHashCode(); + hash ^= roles_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (UserName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(UserName); + } + permissions_.WriteTo(output, _repeated_permissions_codec); + roles_.WriteTo(output, _repeated_roles_codec); + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (UserName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserName); + } + size += permissions_.CalculateSize(_repeated_permissions_codec); + size += roles_.CalculateSize(_repeated_roles_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AssignRoles other) { + if (other == null) { + return; + } + if (other.UserName.Length != 0) { + UserName = other.UserName; + } + permissions_.Add(other.permissions_); + roles_.Add(other.roles_); + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + UserName = input.ReadString(); + break; + } + case 18: { + permissions_.AddEntriesFrom(input, _repeated_permissions_codec); + break; + } + case 26: { + roles_.AddEntriesFrom(input, _repeated_roles_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class AssignRolesResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AssignRolesResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AssignRolesResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AssignRolesResponse(AssignRolesResponse other) : this() { + allRoles_ = other.allRoles_.Clone(); + allPermissions_ = other.allPermissions_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AssignRolesResponse Clone() { + return new AssignRolesResponse(this); + } + + /// Field number for the "AllRoles" field. + public const int AllRolesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_allRoles_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField allRoles_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField AllRoles { + get { return allRoles_; } + } + + /// Field number for the "AllPermissions" field. + public const int AllPermissionsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_allPermissions_codec + = pb::FieldCodec.ForString(18); + private readonly pbc::RepeatedField allPermissions_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField AllPermissions { + get { return allPermissions_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 3; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 26); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 4; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AssignRolesResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AssignRolesResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!allRoles_.Equals(other.allRoles_)) return false; + if(!allPermissions_.Equals(other.allPermissions_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= allRoles_.GetHashCode(); + hash ^= allPermissions_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + allRoles_.WriteTo(output, _repeated_allRoles_codec); + allPermissions_.WriteTo(output, _repeated_allPermissions_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(34); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += allRoles_.CalculateSize(_repeated_allRoles_codec); + size += allPermissions_.CalculateSize(_repeated_allPermissions_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AssignRolesResponse other) { + if (other == null) { + return; + } + allRoles_.Add(other.allRoles_); + allPermissions_.Add(other.allPermissions_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + allRoles_.AddEntriesFrom(input, _repeated_allRoles_codec); + break; + } + case 18: { + allPermissions_.AddEntriesFrom(input, _repeated_allPermissions_codec); + break; + } + case 26: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 34: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class AuditBase : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AuditBase()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AuditBase() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AuditBase(AuditBase other) : this() { + createdDate_ = other.createdDate_ != null ? other.createdDate_.Clone() : null; + createdBy_ = other.createdBy_; + createdInfo_ = other.createdInfo_; + modifiedDate_ = other.modifiedDate_ != null ? other.modifiedDate_.Clone() : null; + modifiedBy_ = other.modifiedBy_; + modifiedInfo_ = other.modifiedInfo_; + softDeletedDate_ = other.softDeletedDate_ != null ? other.softDeletedDate_.Clone() : null; + softDeletedBy_ = other.softDeletedBy_; + softDeletedInfo_ = other.softDeletedInfo_; + switch (other.SubtypeCase) { + case SubtypeOneofCase.RockstarAuditTenant: + RockstarAuditTenant = other.RockstarAuditTenant.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AuditBase Clone() { + return new AuditBase(this); + } + + /// Field number for the "CreatedDate" field. + public const int CreatedDateFieldNumber = 1; + private global::Google.Protobuf.WellKnownTypes.Timestamp createdDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp CreatedDate { + get { return createdDate_; } + set { + createdDate_ = value; + } + } + + /// Field number for the "CreatedBy" field. + public const int CreatedByFieldNumber = 2; + private string createdBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CreatedBy { + get { return createdBy_; } + set { + createdBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "CreatedInfo" field. + public const int CreatedInfoFieldNumber = 3; + private string createdInfo_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CreatedInfo { + get { return createdInfo_; } + set { + createdInfo_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ModifiedDate" field. + public const int ModifiedDateFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp modifiedDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp ModifiedDate { + get { return modifiedDate_; } + set { + modifiedDate_ = value; + } + } + + /// Field number for the "ModifiedBy" field. + public const int ModifiedByFieldNumber = 5; + private string modifiedBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ModifiedBy { + get { return modifiedBy_; } + set { + modifiedBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ModifiedInfo" field. + public const int ModifiedInfoFieldNumber = 6; + private string modifiedInfo_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ModifiedInfo { + get { return modifiedInfo_; } + set { + modifiedInfo_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "SoftDeletedDate" field. + public const int SoftDeletedDateFieldNumber = 7; + private global::Google.Protobuf.WellKnownTypes.Timestamp softDeletedDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp SoftDeletedDate { + get { return softDeletedDate_; } + set { + softDeletedDate_ = value; + } + } + + /// Field number for the "SoftDeletedBy" field. + public const int SoftDeletedByFieldNumber = 8; + private string softDeletedBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SoftDeletedBy { + get { return softDeletedBy_; } + set { + softDeletedBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "SoftDeletedInfo" field. + public const int SoftDeletedInfoFieldNumber = 9; + private string softDeletedInfo_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SoftDeletedInfo { + get { return softDeletedInfo_; } + set { + softDeletedInfo_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RockstarAuditTenant" field. + public const int RockstarAuditTenantFieldNumber = 252248706; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.RockstarAuditTenant RockstarAuditTenant { + get { return subtypeCase_ == SubtypeOneofCase.RockstarAuditTenant ? (global::ServiceStack.Extensions.Tests.Protoc.RockstarAuditTenant) subtype_ : null; } + set { + subtype_ = value; + subtypeCase_ = value == null ? SubtypeOneofCase.None : SubtypeOneofCase.RockstarAuditTenant; + } + } + + private object subtype_; + /// Enum of possible cases for the "subtype" oneof. + public enum SubtypeOneofCase { + None = 0, + RockstarAuditTenant = 252248706, + } + private SubtypeOneofCase subtypeCase_ = SubtypeOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SubtypeOneofCase SubtypeCase { + get { return subtypeCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSubtype() { + subtypeCase_ = SubtypeOneofCase.None; + subtype_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AuditBase); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AuditBase other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(CreatedDate, other.CreatedDate)) return false; + if (CreatedBy != other.CreatedBy) return false; + if (CreatedInfo != other.CreatedInfo) return false; + if (!object.Equals(ModifiedDate, other.ModifiedDate)) return false; + if (ModifiedBy != other.ModifiedBy) return false; + if (ModifiedInfo != other.ModifiedInfo) return false; + if (!object.Equals(SoftDeletedDate, other.SoftDeletedDate)) return false; + if (SoftDeletedBy != other.SoftDeletedBy) return false; + if (SoftDeletedInfo != other.SoftDeletedInfo) return false; + if (!object.Equals(RockstarAuditTenant, other.RockstarAuditTenant)) return false; + if (SubtypeCase != other.SubtypeCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (createdDate_ != null) hash ^= CreatedDate.GetHashCode(); + if (CreatedBy.Length != 0) hash ^= CreatedBy.GetHashCode(); + if (CreatedInfo.Length != 0) hash ^= CreatedInfo.GetHashCode(); + if (modifiedDate_ != null) hash ^= ModifiedDate.GetHashCode(); + if (ModifiedBy.Length != 0) hash ^= ModifiedBy.GetHashCode(); + if (ModifiedInfo.Length != 0) hash ^= ModifiedInfo.GetHashCode(); + if (softDeletedDate_ != null) hash ^= SoftDeletedDate.GetHashCode(); + if (SoftDeletedBy.Length != 0) hash ^= SoftDeletedBy.GetHashCode(); + if (SoftDeletedInfo.Length != 0) hash ^= SoftDeletedInfo.GetHashCode(); + if (subtypeCase_ == SubtypeOneofCase.RockstarAuditTenant) hash ^= RockstarAuditTenant.GetHashCode(); + hash ^= (int) subtypeCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (createdDate_ != null) { + output.WriteRawTag(10); + output.WriteMessage(CreatedDate); + } + if (CreatedBy.Length != 0) { + output.WriteRawTag(18); + output.WriteString(CreatedBy); + } + if (CreatedInfo.Length != 0) { + output.WriteRawTag(26); + output.WriteString(CreatedInfo); + } + if (modifiedDate_ != null) { + output.WriteRawTag(34); + output.WriteMessage(ModifiedDate); + } + if (ModifiedBy.Length != 0) { + output.WriteRawTag(42); + output.WriteString(ModifiedBy); + } + if (ModifiedInfo.Length != 0) { + output.WriteRawTag(50); + output.WriteString(ModifiedInfo); + } + if (softDeletedDate_ != null) { + output.WriteRawTag(58); + output.WriteMessage(SoftDeletedDate); + } + if (SoftDeletedBy.Length != 0) { + output.WriteRawTag(66); + output.WriteString(SoftDeletedBy); + } + if (SoftDeletedInfo.Length != 0) { + output.WriteRawTag(74); + output.WriteString(SoftDeletedInfo); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarAuditTenant) { + output.WriteRawTag(146, 168, 160, 194, 7); + output.WriteMessage(RockstarAuditTenant); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (createdDate_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(CreatedDate); + } + if (CreatedBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CreatedBy); + } + if (CreatedInfo.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CreatedInfo); + } + if (modifiedDate_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ModifiedDate); + } + if (ModifiedBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ModifiedBy); + } + if (ModifiedInfo.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ModifiedInfo); + } + if (softDeletedDate_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SoftDeletedDate); + } + if (SoftDeletedBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SoftDeletedBy); + } + if (SoftDeletedInfo.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SoftDeletedInfo); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarAuditTenant) { + size += 5 + pb::CodedOutputStream.ComputeMessageSize(RockstarAuditTenant); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AuditBase other) { + if (other == null) { + return; + } + if (other.createdDate_ != null) { + if (createdDate_ == null) { + CreatedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + CreatedDate.MergeFrom(other.CreatedDate); + } + if (other.CreatedBy.Length != 0) { + CreatedBy = other.CreatedBy; + } + if (other.CreatedInfo.Length != 0) { + CreatedInfo = other.CreatedInfo; + } + if (other.modifiedDate_ != null) { + if (modifiedDate_ == null) { + ModifiedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + ModifiedDate.MergeFrom(other.ModifiedDate); + } + if (other.ModifiedBy.Length != 0) { + ModifiedBy = other.ModifiedBy; + } + if (other.ModifiedInfo.Length != 0) { + ModifiedInfo = other.ModifiedInfo; + } + if (other.softDeletedDate_ != null) { + if (softDeletedDate_ == null) { + SoftDeletedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + SoftDeletedDate.MergeFrom(other.SoftDeletedDate); + } + if (other.SoftDeletedBy.Length != 0) { + SoftDeletedBy = other.SoftDeletedBy; + } + if (other.SoftDeletedInfo.Length != 0) { + SoftDeletedInfo = other.SoftDeletedInfo; + } + switch (other.SubtypeCase) { + case SubtypeOneofCase.RockstarAuditTenant: + if (RockstarAuditTenant == null) { + RockstarAuditTenant = new global::ServiceStack.Extensions.Tests.Protoc.RockstarAuditTenant(); + } + RockstarAuditTenant.MergeFrom(other.RockstarAuditTenant); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (createdDate_ == null) { + CreatedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(CreatedDate); + break; + } + case 18: { + CreatedBy = input.ReadString(); + break; + } + case 26: { + CreatedInfo = input.ReadString(); + break; + } + case 34: { + if (modifiedDate_ == null) { + ModifiedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(ModifiedDate); + break; + } + case 42: { + ModifiedBy = input.ReadString(); + break; + } + case 50: { + ModifiedInfo = input.ReadString(); + break; + } + case 58: { + if (softDeletedDate_ == null) { + SoftDeletedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(SoftDeletedDate); + break; + } + case 66: { + SoftDeletedBy = input.ReadString(); + break; + } + case 74: { + SoftDeletedInfo = input.ReadString(); + break; + } + case 2017989650: { + global::ServiceStack.Extensions.Tests.Protoc.RockstarAuditTenant subBuilder = new global::ServiceStack.Extensions.Tests.Protoc.RockstarAuditTenant(); + if (subtypeCase_ == SubtypeOneofCase.RockstarAuditTenant) { + subBuilder.MergeFrom(RockstarAuditTenant); + } + input.ReadMessage(subBuilder); + RockstarAuditTenant = subBuilder; + break; + } + } + } + } + + } + + public sealed partial class Authenticate : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Authenticate()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Authenticate() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Authenticate(Authenticate other) : this() { + provider_ = other.provider_; + state_ = other.state_; + oauthToken_ = other.oauthToken_; + oauthVerifier_ = other.oauthVerifier_; + userName_ = other.userName_; + password_ = other.password_; + rememberMe_ = other.rememberMe_; + errorView_ = other.errorView_; + nonce_ = other.nonce_; + uri_ = other.uri_; + response_ = other.response_; + qop_ = other.qop_; + nc_ = other.nc_; + cnonce_ = other.cnonce_; + useTokenCookie_ = other.useTokenCookie_; + accessToken_ = other.accessToken_; + accessTokenSecret_ = other.accessTokenSecret_; + scope_ = other.scope_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Authenticate Clone() { + return new Authenticate(this); + } + + /// Field number for the "provider" field. + public const int ProviderFieldNumber = 1; + private string provider_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Provider { + get { return provider_; } + set { + provider_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "State" field. + public const int StateFieldNumber = 2; + private string state_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string State { + get { return state_; } + set { + state_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "oauth_token" field. + public const int OauthTokenFieldNumber = 3; + private string oauthToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OauthToken { + get { return oauthToken_; } + set { + oauthToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "oauth_verifier" field. + public const int OauthVerifierFieldNumber = 4; + private string oauthVerifier_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OauthVerifier { + get { return oauthVerifier_; } + set { + oauthVerifier_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "UserName" field. + public const int UserNameFieldNumber = 5; + private string userName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserName { + get { return userName_; } + set { + userName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Password" field. + public const int PasswordFieldNumber = 6; + private string password_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Password { + get { return password_; } + set { + password_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RememberMe" field. + public const int RememberMeFieldNumber = 7; + private bool rememberMe_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool RememberMe { + get { return rememberMe_; } + set { + rememberMe_ = value; + } + } + + /// Field number for the "ErrorView" field. + public const int ErrorViewFieldNumber = 9; + private string errorView_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ErrorView { + get { return errorView_; } + set { + errorView_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "nonce" field. + public const int NonceFieldNumber = 10; + private string nonce_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Nonce { + get { return nonce_; } + set { + nonce_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "uri" field. + public const int UriFieldNumber = 11; + private string uri_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Uri { + get { return uri_; } + set { + uri_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "response" field. + public const int ResponseFieldNumber = 12; + private string response_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Response { + get { return response_; } + set { + response_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "qop" field. + public const int QopFieldNumber = 13; + private string qop_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Qop { + get { return qop_; } + set { + qop_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "nc" field. + public const int NcFieldNumber = 14; + private string nc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Nc { + get { return nc_; } + set { + nc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "cnonce" field. + public const int CnonceFieldNumber = 15; + private string cnonce_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Cnonce { + get { return cnonce_; } + set { + cnonce_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "UseTokenCookie" field. + public const int UseTokenCookieFieldNumber = 16; + private bool useTokenCookie_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool UseTokenCookie { + get { return useTokenCookie_; } + set { + useTokenCookie_ = value; + } + } + + /// Field number for the "AccessToken" field. + public const int AccessTokenFieldNumber = 17; + private string accessToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string AccessToken { + get { return accessToken_; } + set { + accessToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "AccessTokenSecret" field. + public const int AccessTokenSecretFieldNumber = 18; + private string accessTokenSecret_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string AccessTokenSecret { + get { return accessTokenSecret_; } + set { + accessTokenSecret_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "scope" field. + public const int ScopeFieldNumber = 19; + private string scope_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Scope { + get { return scope_; } + set { + scope_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 20; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 162); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Authenticate); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Authenticate other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Provider != other.Provider) return false; + if (State != other.State) return false; + if (OauthToken != other.OauthToken) return false; + if (OauthVerifier != other.OauthVerifier) return false; + if (UserName != other.UserName) return false; + if (Password != other.Password) return false; + if (RememberMe != other.RememberMe) return false; + if (ErrorView != other.ErrorView) return false; + if (Nonce != other.Nonce) return false; + if (Uri != other.Uri) return false; + if (Response != other.Response) return false; + if (Qop != other.Qop) return false; + if (Nc != other.Nc) return false; + if (Cnonce != other.Cnonce) return false; + if (UseTokenCookie != other.UseTokenCookie) return false; + if (AccessToken != other.AccessToken) return false; + if (AccessTokenSecret != other.AccessTokenSecret) return false; + if (Scope != other.Scope) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Provider.Length != 0) hash ^= Provider.GetHashCode(); + if (State.Length != 0) hash ^= State.GetHashCode(); + if (OauthToken.Length != 0) hash ^= OauthToken.GetHashCode(); + if (OauthVerifier.Length != 0) hash ^= OauthVerifier.GetHashCode(); + if (UserName.Length != 0) hash ^= UserName.GetHashCode(); + if (Password.Length != 0) hash ^= Password.GetHashCode(); + if (RememberMe != false) hash ^= RememberMe.GetHashCode(); + if (ErrorView.Length != 0) hash ^= ErrorView.GetHashCode(); + if (Nonce.Length != 0) hash ^= Nonce.GetHashCode(); + if (Uri.Length != 0) hash ^= Uri.GetHashCode(); + if (Response.Length != 0) hash ^= Response.GetHashCode(); + if (Qop.Length != 0) hash ^= Qop.GetHashCode(); + if (Nc.Length != 0) hash ^= Nc.GetHashCode(); + if (Cnonce.Length != 0) hash ^= Cnonce.GetHashCode(); + if (UseTokenCookie != false) hash ^= UseTokenCookie.GetHashCode(); + if (AccessToken.Length != 0) hash ^= AccessToken.GetHashCode(); + if (AccessTokenSecret.Length != 0) hash ^= AccessTokenSecret.GetHashCode(); + if (Scope.Length != 0) hash ^= Scope.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Provider.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Provider); + } + if (State.Length != 0) { + output.WriteRawTag(18); + output.WriteString(State); + } + if (OauthToken.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OauthToken); + } + if (OauthVerifier.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OauthVerifier); + } + if (UserName.Length != 0) { + output.WriteRawTag(42); + output.WriteString(UserName); + } + if (Password.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Password); + } + if (RememberMe != false) { + output.WriteRawTag(56); + output.WriteBool(RememberMe); + } + if (ErrorView.Length != 0) { + output.WriteRawTag(74); + output.WriteString(ErrorView); + } + if (Nonce.Length != 0) { + output.WriteRawTag(82); + output.WriteString(Nonce); + } + if (Uri.Length != 0) { + output.WriteRawTag(90); + output.WriteString(Uri); + } + if (Response.Length != 0) { + output.WriteRawTag(98); + output.WriteString(Response); + } + if (Qop.Length != 0) { + output.WriteRawTag(106); + output.WriteString(Qop); + } + if (Nc.Length != 0) { + output.WriteRawTag(114); + output.WriteString(Nc); + } + if (Cnonce.Length != 0) { + output.WriteRawTag(122); + output.WriteString(Cnonce); + } + if (UseTokenCookie != false) { + output.WriteRawTag(128, 1); + output.WriteBool(UseTokenCookie); + } + if (AccessToken.Length != 0) { + output.WriteRawTag(138, 1); + output.WriteString(AccessToken); + } + if (AccessTokenSecret.Length != 0) { + output.WriteRawTag(146, 1); + output.WriteString(AccessTokenSecret); + } + if (Scope.Length != 0) { + output.WriteRawTag(154, 1); + output.WriteString(Scope); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Provider.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Provider); + } + if (State.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(State); + } + if (OauthToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OauthToken); + } + if (OauthVerifier.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OauthVerifier); + } + if (UserName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserName); + } + if (Password.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Password); + } + if (RememberMe != false) { + size += 1 + 1; + } + if (ErrorView.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorView); + } + if (Nonce.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Nonce); + } + if (Uri.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Uri); + } + if (Response.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Response); + } + if (Qop.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Qop); + } + if (Nc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Nc); + } + if (Cnonce.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Cnonce); + } + if (UseTokenCookie != false) { + size += 2 + 1; + } + if (AccessToken.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(AccessToken); + } + if (AccessTokenSecret.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(AccessTokenSecret); + } + if (Scope.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(Scope); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Authenticate other) { + if (other == null) { + return; + } + if (other.Provider.Length != 0) { + Provider = other.Provider; + } + if (other.State.Length != 0) { + State = other.State; + } + if (other.OauthToken.Length != 0) { + OauthToken = other.OauthToken; + } + if (other.OauthVerifier.Length != 0) { + OauthVerifier = other.OauthVerifier; + } + if (other.UserName.Length != 0) { + UserName = other.UserName; + } + if (other.Password.Length != 0) { + Password = other.Password; + } + if (other.RememberMe != false) { + RememberMe = other.RememberMe; + } + if (other.ErrorView.Length != 0) { + ErrorView = other.ErrorView; + } + if (other.Nonce.Length != 0) { + Nonce = other.Nonce; + } + if (other.Uri.Length != 0) { + Uri = other.Uri; + } + if (other.Response.Length != 0) { + Response = other.Response; + } + if (other.Qop.Length != 0) { + Qop = other.Qop; + } + if (other.Nc.Length != 0) { + Nc = other.Nc; + } + if (other.Cnonce.Length != 0) { + Cnonce = other.Cnonce; + } + if (other.UseTokenCookie != false) { + UseTokenCookie = other.UseTokenCookie; + } + if (other.AccessToken.Length != 0) { + AccessToken = other.AccessToken; + } + if (other.AccessTokenSecret.Length != 0) { + AccessTokenSecret = other.AccessTokenSecret; + } + if (other.Scope.Length != 0) { + Scope = other.Scope; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Provider = input.ReadString(); + break; + } + case 18: { + State = input.ReadString(); + break; + } + case 26: { + OauthToken = input.ReadString(); + break; + } + case 34: { + OauthVerifier = input.ReadString(); + break; + } + case 42: { + UserName = input.ReadString(); + break; + } + case 50: { + Password = input.ReadString(); + break; + } + case 56: { + RememberMe = input.ReadBool(); + break; + } + case 74: { + ErrorView = input.ReadString(); + break; + } + case 82: { + Nonce = input.ReadString(); + break; + } + case 90: { + Uri = input.ReadString(); + break; + } + case 98: { + Response = input.ReadString(); + break; + } + case 106: { + Qop = input.ReadString(); + break; + } + case 114: { + Nc = input.ReadString(); + break; + } + case 122: { + Cnonce = input.ReadString(); + break; + } + case 128: { + UseTokenCookie = input.ReadBool(); + break; + } + case 138: { + AccessToken = input.ReadString(); + break; + } + case 146: { + AccessTokenSecret = input.ReadString(); + break; + } + case 154: { + Scope = input.ReadString(); + break; + } + case 162: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class AuthenticateResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AuthenticateResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AuthenticateResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AuthenticateResponse(AuthenticateResponse other) : this() { + userId_ = other.userId_; + sessionId_ = other.sessionId_; + userName_ = other.userName_; + displayName_ = other.displayName_; + referrerUrl_ = other.referrerUrl_; + bearerToken_ = other.bearerToken_; + refreshToken_ = other.refreshToken_; + profileUrl_ = other.profileUrl_; + roles_ = other.roles_.Clone(); + permissions_ = other.permissions_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AuthenticateResponse Clone() { + return new AuthenticateResponse(this); + } + + /// Field number for the "UserId" field. + public const int UserIdFieldNumber = 1; + private string userId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserId { + get { return userId_; } + set { + userId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "SessionId" field. + public const int SessionIdFieldNumber = 2; + private string sessionId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SessionId { + get { return sessionId_; } + set { + sessionId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "UserName" field. + public const int UserNameFieldNumber = 3; + private string userName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserName { + get { return userName_; } + set { + userName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "DisplayName" field. + public const int DisplayNameFieldNumber = 4; + private string displayName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string DisplayName { + get { return displayName_; } + set { + displayName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ReferrerUrl" field. + public const int ReferrerUrlFieldNumber = 5; + private string referrerUrl_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ReferrerUrl { + get { return referrerUrl_; } + set { + referrerUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "BearerToken" field. + public const int BearerTokenFieldNumber = 6; + private string bearerToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BearerToken { + get { return bearerToken_; } + set { + bearerToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RefreshToken" field. + public const int RefreshTokenFieldNumber = 7; + private string refreshToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RefreshToken { + get { return refreshToken_; } + set { + refreshToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ProfileUrl" field. + public const int ProfileUrlFieldNumber = 8; + private string profileUrl_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ProfileUrl { + get { return profileUrl_; } + set { + profileUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Roles" field. + public const int RolesFieldNumber = 9; + private static readonly pb::FieldCodec _repeated_roles_codec + = pb::FieldCodec.ForString(74); + private readonly pbc::RepeatedField roles_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Roles { + get { return roles_; } + } + + /// Field number for the "Permissions" field. + public const int PermissionsFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_permissions_codec + = pb::FieldCodec.ForString(82); + private readonly pbc::RepeatedField permissions_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Permissions { + get { return permissions_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 11; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 12; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 98); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AuthenticateResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AuthenticateResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (UserId != other.UserId) return false; + if (SessionId != other.SessionId) return false; + if (UserName != other.UserName) return false; + if (DisplayName != other.DisplayName) return false; + if (ReferrerUrl != other.ReferrerUrl) return false; + if (BearerToken != other.BearerToken) return false; + if (RefreshToken != other.RefreshToken) return false; + if (ProfileUrl != other.ProfileUrl) return false; + if(!roles_.Equals(other.roles_)) return false; + if(!permissions_.Equals(other.permissions_)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (UserId.Length != 0) hash ^= UserId.GetHashCode(); + if (SessionId.Length != 0) hash ^= SessionId.GetHashCode(); + if (UserName.Length != 0) hash ^= UserName.GetHashCode(); + if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); + if (ReferrerUrl.Length != 0) hash ^= ReferrerUrl.GetHashCode(); + if (BearerToken.Length != 0) hash ^= BearerToken.GetHashCode(); + if (RefreshToken.Length != 0) hash ^= RefreshToken.GetHashCode(); + if (ProfileUrl.Length != 0) hash ^= ProfileUrl.GetHashCode(); + hash ^= roles_.GetHashCode(); + hash ^= permissions_.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (UserId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(UserId); + } + if (SessionId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SessionId); + } + if (UserName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(UserName); + } + if (DisplayName.Length != 0) { + output.WriteRawTag(34); + output.WriteString(DisplayName); + } + if (ReferrerUrl.Length != 0) { + output.WriteRawTag(42); + output.WriteString(ReferrerUrl); + } + if (BearerToken.Length != 0) { + output.WriteRawTag(50); + output.WriteString(BearerToken); + } + if (RefreshToken.Length != 0) { + output.WriteRawTag(58); + output.WriteString(RefreshToken); + } + if (ProfileUrl.Length != 0) { + output.WriteRawTag(66); + output.WriteString(ProfileUrl); + } + roles_.WriteTo(output, _repeated_roles_codec); + permissions_.WriteTo(output, _repeated_permissions_codec); + if (responseStatus_ != null) { + output.WriteRawTag(90); + output.WriteMessage(ResponseStatus); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (UserId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserId); + } + if (SessionId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SessionId); + } + if (UserName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserName); + } + if (DisplayName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DisplayName); + } + if (ReferrerUrl.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ReferrerUrl); + } + if (BearerToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BearerToken); + } + if (RefreshToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RefreshToken); + } + if (ProfileUrl.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ProfileUrl); + } + size += roles_.CalculateSize(_repeated_roles_codec); + size += permissions_.CalculateSize(_repeated_permissions_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AuthenticateResponse other) { + if (other == null) { + return; + } + if (other.UserId.Length != 0) { + UserId = other.UserId; + } + if (other.SessionId.Length != 0) { + SessionId = other.SessionId; + } + if (other.UserName.Length != 0) { + UserName = other.UserName; + } + if (other.DisplayName.Length != 0) { + DisplayName = other.DisplayName; + } + if (other.ReferrerUrl.Length != 0) { + ReferrerUrl = other.ReferrerUrl; + } + if (other.BearerToken.Length != 0) { + BearerToken = other.BearerToken; + } + if (other.RefreshToken.Length != 0) { + RefreshToken = other.RefreshToken; + } + if (other.ProfileUrl.Length != 0) { + ProfileUrl = other.ProfileUrl; + } + roles_.Add(other.roles_); + permissions_.Add(other.permissions_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + UserId = input.ReadString(); + break; + } + case 18: { + SessionId = input.ReadString(); + break; + } + case 26: { + UserName = input.ReadString(); + break; + } + case 34: { + DisplayName = input.ReadString(); + break; + } + case 42: { + ReferrerUrl = input.ReadString(); + break; + } + case 50: { + BearerToken = input.ReadString(); + break; + } + case 58: { + RefreshToken = input.ReadString(); + break; + } + case 66: { + ProfileUrl = input.ReadString(); + break; + } + case 74: { + roles_.AddEntriesFrom(input, _repeated_roles_codec); + break; + } + case 82: { + permissions_.AddEntriesFrom(input, _repeated_permissions_codec); + break; + } + case 90: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + case 98: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class Bar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Bar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Bar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Bar(Bar other) : this() { + y_ = other.y_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Bar Clone() { + return new Bar(this); + } + + /// Field number for the "Y" field. + public const int YFieldNumber = 2; + private string y_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Y { + get { return y_; } + set { + y_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Bar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Bar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Y != other.Y) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Y.Length != 0) hash ^= Y.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Y.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Y); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Y.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Y); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Bar other) { + if (other == null) { + return; + } + if (other.Y.Length != 0) { + Y = other.Y; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 18: { + Y = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class Bookmark : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Bookmark()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Bookmark() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Bookmark(Bookmark other) : this() { + slug_ = other.slug_; + title_ = other.title_; + description_ = other.description_; + url_ = other.url_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Bookmark Clone() { + return new Bookmark(this); + } + + /// Field number for the "Slug" field. + public const int SlugFieldNumber = 1; + private string slug_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Slug { + get { return slug_; } + set { + slug_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Title" field. + public const int TitleFieldNumber = 2; + private string title_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Title { + get { return title_; } + set { + title_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Description" field. + public const int DescriptionFieldNumber = 3; + private string description_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Description { + get { return description_; } + set { + description_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Url" field. + public const int UrlFieldNumber = 4; + private string url_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Url { + get { return url_; } + set { + url_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Bookmark); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Bookmark other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Slug != other.Slug) return false; + if (Title != other.Title) return false; + if (Description != other.Description) return false; + if (Url != other.Url) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Slug.Length != 0) hash ^= Slug.GetHashCode(); + if (Title.Length != 0) hash ^= Title.GetHashCode(); + if (Description.Length != 0) hash ^= Description.GetHashCode(); + if (Url.Length != 0) hash ^= Url.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Slug.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Slug); + } + if (Title.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Title); + } + if (Description.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Description); + } + if (Url.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Url); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Slug.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Slug); + } + if (Title.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Title); + } + if (Description.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Description); + } + if (Url.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Url); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Bookmark other) { + if (other == null) { + return; + } + if (other.Slug.Length != 0) { + Slug = other.Slug; + } + if (other.Title.Length != 0) { + Title = other.Title; + } + if (other.Description.Length != 0) { + Description = other.Description; + } + if (other.Url.Length != 0) { + Url = other.Url; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Slug = input.ReadString(); + break; + } + case 18: { + Title = input.ReadString(); + break; + } + case 26: { + Description = input.ReadString(); + break; + } + case 34: { + Url = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class ChangeConnectionInfo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChangeConnectionInfo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChangeConnectionInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChangeConnectionInfo(ChangeConnectionInfo other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChangeConnectionInfo Clone() { + return new ChangeConnectionInfo(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ChangeConnectionInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ChangeConnectionInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ChangeConnectionInfo other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class ChangeDb : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChangeDb()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChangeDb() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChangeDb(ChangeDb other) : this() { + namedConnection_ = other.namedConnection_; + connectionString_ = other.connectionString_; + providerName_ = other.providerName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChangeDb Clone() { + return new ChangeDb(this); + } + + /// Field number for the "NamedConnection" field. + public const int NamedConnectionFieldNumber = 1; + private string namedConnection_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NamedConnection { + get { return namedConnection_; } + set { + namedConnection_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ConnectionString" field. + public const int ConnectionStringFieldNumber = 2; + private string connectionString_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ConnectionString { + get { return connectionString_; } + set { + connectionString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ProviderName" field. + public const int ProviderNameFieldNumber = 3; + private string providerName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ProviderName { + get { return providerName_; } + set { + providerName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ChangeDb); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ChangeDb other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (NamedConnection != other.NamedConnection) return false; + if (ConnectionString != other.ConnectionString) return false; + if (ProviderName != other.ProviderName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (NamedConnection.Length != 0) hash ^= NamedConnection.GetHashCode(); + if (ConnectionString.Length != 0) hash ^= ConnectionString.GetHashCode(); + if (ProviderName.Length != 0) hash ^= ProviderName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (NamedConnection.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NamedConnection); + } + if (ConnectionString.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ConnectionString); + } + if (ProviderName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(ProviderName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (NamedConnection.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NamedConnection); + } + if (ConnectionString.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ConnectionString); + } + if (ProviderName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ProviderName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ChangeDb other) { + if (other == null) { + return; + } + if (other.NamedConnection.Length != 0) { + NamedConnection = other.NamedConnection; + } + if (other.ConnectionString.Length != 0) { + ConnectionString = other.ConnectionString; + } + if (other.ProviderName.Length != 0) { + ProviderName = other.ProviderName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + NamedConnection = input.ReadString(); + break; + } + case 18: { + ConnectionString = input.ReadString(); + break; + } + case 26: { + ProviderName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class ChangeDbResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChangeDbResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChangeDbResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChangeDbResponse(ChangeDbResponse other) : this() { + results_ = other.results_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChangeDbResponse Clone() { + return new ChangeDbResponse(this); + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(10, global::ServiceStack.Extensions.Tests.Protoc.Rockstar.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ChangeDbResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ChangeDbResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!results_.Equals(other.results_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= results_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + results_.WriteTo(output, _repeated_results_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += results_.CalculateSize(_repeated_results_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ChangeDbResponse other) { + if (other == null) { + return; + } + results_.Add(other.results_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + } + } + } + + } + + public sealed partial class ChatMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChatMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChatMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChatMessage(ChatMessage other) : this() { + id_ = other.id_; + channel_ = other.channel_; + fromUserId_ = other.fromUserId_; + fromName_ = other.fromName_; + displayName_ = other.displayName_; + message_ = other.message_; + userAuthId_ = other.userAuthId_; + private_ = other.private_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChatMessage Clone() { + return new ChatMessage(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private long id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Channel" field. + public const int ChannelFieldNumber = 2; + private string channel_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Channel { + get { return channel_; } + set { + channel_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "FromUserId" field. + public const int FromUserIdFieldNumber = 3; + private string fromUserId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FromUserId { + get { return fromUserId_; } + set { + fromUserId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "FromName" field. + public const int FromNameFieldNumber = 4; + private string fromName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FromName { + get { return fromName_; } + set { + fromName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "DisplayName" field. + public const int DisplayNameFieldNumber = 5; + private string displayName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string DisplayName { + get { return displayName_; } + set { + displayName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Message" field. + public const int MessageFieldNumber = 6; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "UserAuthId" field. + public const int UserAuthIdFieldNumber = 7; + private string userAuthId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserAuthId { + get { return userAuthId_; } + set { + userAuthId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Private" field. + public const int PrivateFieldNumber = 8; + private bool private_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Private { + get { return private_; } + set { + private_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ChatMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ChatMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Channel != other.Channel) return false; + if (FromUserId != other.FromUserId) return false; + if (FromName != other.FromName) return false; + if (DisplayName != other.DisplayName) return false; + if (Message != other.Message) return false; + if (UserAuthId != other.UserAuthId) return false; + if (Private != other.Private) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0L) hash ^= Id.GetHashCode(); + if (Channel.Length != 0) hash ^= Channel.GetHashCode(); + if (FromUserId.Length != 0) hash ^= FromUserId.GetHashCode(); + if (FromName.Length != 0) hash ^= FromName.GetHashCode(); + if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); + if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (UserAuthId.Length != 0) hash ^= UserAuthId.GetHashCode(); + if (Private != false) hash ^= Private.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Id); + } + if (Channel.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Channel); + } + if (FromUserId.Length != 0) { + output.WriteRawTag(26); + output.WriteString(FromUserId); + } + if (FromName.Length != 0) { + output.WriteRawTag(34); + output.WriteString(FromName); + } + if (DisplayName.Length != 0) { + output.WriteRawTag(42); + output.WriteString(DisplayName); + } + if (Message.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Message); + } + if (UserAuthId.Length != 0) { + output.WriteRawTag(58); + output.WriteString(UserAuthId); + } + if (Private != false) { + output.WriteRawTag(64); + output.WriteBool(Private); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); + } + if (Channel.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Channel); + } + if (FromUserId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FromUserId); + } + if (FromName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FromName); + } + if (DisplayName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DisplayName); + } + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (UserAuthId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserAuthId); + } + if (Private != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ChatMessage other) { + if (other == null) { + return; + } + if (other.Id != 0L) { + Id = other.Id; + } + if (other.Channel.Length != 0) { + Channel = other.Channel; + } + if (other.FromUserId.Length != 0) { + FromUserId = other.FromUserId; + } + if (other.FromName.Length != 0) { + FromName = other.FromName; + } + if (other.DisplayName.Length != 0) { + DisplayName = other.DisplayName; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + if (other.UserAuthId.Length != 0) { + UserAuthId = other.UserAuthId; + } + if (other.Private != false) { + Private = other.Private; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt64(); + break; + } + case 18: { + Channel = input.ReadString(); + break; + } + case 26: { + FromUserId = input.ReadString(); + break; + } + case 34: { + FromName = input.ReadString(); + break; + } + case 42: { + DisplayName = input.ReadString(); + break; + } + case 50: { + Message = input.ReadString(); + break; + } + case 58: { + UserAuthId = input.ReadString(); + break; + } + case 64: { + Private = input.ReadBool(); + break; + } + } + } + } + + } + + public sealed partial class ConvertSessionToToken : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConvertSessionToToken()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[15]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertSessionToToken() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertSessionToToken(ConvertSessionToToken other) : this() { + preserveSession_ = other.preserveSession_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertSessionToToken Clone() { + return new ConvertSessionToToken(this); + } + + /// Field number for the "PreserveSession" field. + public const int PreserveSessionFieldNumber = 1; + private bool preserveSession_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool PreserveSession { + get { return preserveSession_; } + set { + preserveSession_ = value; + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 2; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 18); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ConvertSessionToToken); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ConvertSessionToToken other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (PreserveSession != other.PreserveSession) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (PreserveSession != false) hash ^= PreserveSession.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (PreserveSession != false) { + output.WriteRawTag(8); + output.WriteBool(PreserveSession); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (PreserveSession != false) { + size += 1 + 1; + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ConvertSessionToToken other) { + if (other == null) { + return; + } + if (other.PreserveSession != false) { + PreserveSession = other.PreserveSession; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + PreserveSession = input.ReadBool(); + break; + } + case 18: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class ConvertSessionToTokenResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConvertSessionToTokenResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[16]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertSessionToTokenResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertSessionToTokenResponse(ConvertSessionToTokenResponse other) : this() { + meta_ = other.meta_.Clone(); + accessToken_ = other.accessToken_; + refreshToken_ = other.refreshToken_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertSessionToTokenResponse Clone() { + return new ConvertSessionToTokenResponse(this); + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 10); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "AccessToken" field. + public const int AccessTokenFieldNumber = 2; + private string accessToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string AccessToken { + get { return accessToken_; } + set { + accessToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RefreshToken" field. + public const int RefreshTokenFieldNumber = 3; + private string refreshToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RefreshToken { + get { return refreshToken_; } + set { + refreshToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 4; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ConvertSessionToTokenResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ConvertSessionToTokenResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!Meta.Equals(other.Meta)) return false; + if (AccessToken != other.AccessToken) return false; + if (RefreshToken != other.RefreshToken) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= Meta.GetHashCode(); + if (AccessToken.Length != 0) hash ^= AccessToken.GetHashCode(); + if (RefreshToken.Length != 0) hash ^= RefreshToken.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + meta_.WriteTo(output, _map_meta_codec); + if (AccessToken.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AccessToken); + } + if (RefreshToken.Length != 0) { + output.WriteRawTag(26); + output.WriteString(RefreshToken); + } + if (responseStatus_ != null) { + output.WriteRawTag(34); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += meta_.CalculateSize(_map_meta_codec); + if (AccessToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(AccessToken); + } + if (RefreshToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RefreshToken); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ConvertSessionToTokenResponse other) { + if (other == null) { + return; + } + meta_.Add(other.meta_); + if (other.AccessToken.Length != 0) { + AccessToken = other.AccessToken; + } + if (other.RefreshToken.Length != 0) { + RefreshToken = other.RefreshToken; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 18: { + AccessToken = input.ReadString(); + break; + } + case 26: { + RefreshToken = input.ReadString(); + break; + } + case 34: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[17]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse Clone() { + return new CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[18]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse Clone() { + return new CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class CreateBookmark : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateBookmark()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[19]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateBookmark() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateBookmark(CreateBookmark other) : this() { + slug_ = other.slug_; + title_ = other.title_; + description_ = other.description_; + url_ = other.url_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateBookmark Clone() { + return new CreateBookmark(this); + } + + /// Field number for the "Slug" field. + public const int SlugFieldNumber = 1; + private string slug_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Slug { + get { return slug_; } + set { + slug_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Title" field. + public const int TitleFieldNumber = 2; + private string title_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Title { + get { return title_; } + set { + title_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Description" field. + public const int DescriptionFieldNumber = 3; + private string description_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Description { + get { return description_; } + set { + description_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Url" field. + public const int UrlFieldNumber = 4; + private string url_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Url { + get { return url_; } + set { + url_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateBookmark); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateBookmark other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Slug != other.Slug) return false; + if (Title != other.Title) return false; + if (Description != other.Description) return false; + if (Url != other.Url) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Slug.Length != 0) hash ^= Slug.GetHashCode(); + if (Title.Length != 0) hash ^= Title.GetHashCode(); + if (Description.Length != 0) hash ^= Description.GetHashCode(); + if (Url.Length != 0) hash ^= Url.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Slug.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Slug); + } + if (Title.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Title); + } + if (Description.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Description); + } + if (Url.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Url); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Slug.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Slug); + } + if (Title.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Title); + } + if (Description.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Description); + } + if (Url.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Url); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateBookmark other) { + if (other == null) { + return; + } + if (other.Slug.Length != 0) { + Slug = other.Slug; + } + if (other.Title.Length != 0) { + Title = other.Title; + } + if (other.Description.Length != 0) { + Description = other.Description; + } + if (other.Url.Length != 0) { + Url = other.Url; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Slug = input.ReadString(); + break; + } + case 18: { + Title = input.ReadString(); + break; + } + case 26: { + Description = input.ReadString(); + break; + } + case 34: { + Url = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class CreateBookmarkResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateBookmarkResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[20]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateBookmarkResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateBookmarkResponse(CreateBookmarkResponse other) : this() { + id_ = other.id_; + result_ = other.result_ != null ? other.result_.Clone() : null; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateBookmarkResponse Clone() { + return new CreateBookmarkResponse(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// default value could not be applied: 00000000-0000-0000-0000-000000000000 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.DaoBase result_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.DaoBase Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateBookmarkResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateBookmarkResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(Result, other.Result)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (result_ != null) hash ^= Result.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (result_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Result); + } + if (responseStatus_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (result_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateBookmarkResponse other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + if (other.result_ != null) { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.DaoBase(); + } + Result.MergeFrom(other.Result); + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.DaoBase(); + } + input.ReadMessage(Result); + break; + } + case 26: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class CreateConnectionInfoRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateConnectionInfoRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[21]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateConnectionInfoRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateConnectionInfoRockstar(CreateConnectionInfoRockstar other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateConnectionInfoRockstar Clone() { + return new CreateConnectionInfoRockstar(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 101; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateConnectionInfoRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateConnectionInfoRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (Id != 0) { + output.WriteRawTag(168, 6); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateConnectionInfoRockstar other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 808: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class CreateNamedRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateNamedRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[22]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateNamedRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateNamedRockstar(CreateNamedRockstar other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateNamedRockstar Clone() { + return new CreateNamedRockstar(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 101; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateNamedRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateNamedRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (Id != 0) { + output.WriteRawTag(168, 6); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateNamedRockstar other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 808: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[23]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstar(CreateRockstar other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstar Clone() { + return new CreateRockstar(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstar other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarAdhocNonDefaults : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarAdhocNonDefaults()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[24]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAdhocNonDefaults() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAdhocNonDefaults(CreateRockstarAdhocNonDefaults other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAdhocNonDefaults Clone() { + return new CreateRockstarAdhocNonDefaults(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarAdhocNonDefaults); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarAdhocNonDefaults other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarAdhocNonDefaults other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarAudit : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarAudit()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[25]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAudit() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAudit(CreateRockstarAudit other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAudit Clone() { + return new CreateRockstarAudit(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarAudit); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarAudit other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarAudit other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarAuditMqToken : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarAuditMqToken()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[26]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditMqToken() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditMqToken(CreateRockstarAuditMqToken other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + bearerToken_ = other.bearerToken_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditMqToken Clone() { + return new CreateRockstarAuditMqToken(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "BearerToken" field. + public const int BearerTokenFieldNumber = 101; + private string bearerToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BearerToken { + get { return bearerToken_; } + set { + bearerToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarAuditMqToken); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarAuditMqToken other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (BearerToken != other.BearerToken) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (BearerToken.Length != 0) hash ^= BearerToken.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (BearerToken.Length != 0) { + output.WriteRawTag(170, 6); + output.WriteString(BearerToken); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (BearerToken.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(BearerToken); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarAuditMqToken other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + if (other.BearerToken.Length != 0) { + BearerToken = other.BearerToken; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 810: { + BearerToken = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarAuditTenant : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarAuditTenant()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[27]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditTenant() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditTenant(CreateRockstarAuditTenant other) : this() { + bearerToken_ = other.bearerToken_; + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditTenant Clone() { + return new CreateRockstarAuditTenant(this); + } + + /// Field number for the "BearerToken" field. + public const int BearerTokenFieldNumber = 201; + private string bearerToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BearerToken { + get { return bearerToken_; } + set { + bearerToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 202; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 203; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 204; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 205; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 206; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 207; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarAuditTenant); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarAuditTenant other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BearerToken != other.BearerToken) return false; + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BearerToken.Length != 0) hash ^= BearerToken.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (BearerToken.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(BearerToken); + } + if (FirstName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(218, 12); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(224, 12); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(234, 12); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(242, 12); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(248, 12); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BearerToken.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(BearerToken); + } + if (FirstName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarAuditTenant other) { + if (other == null) { + return; + } + if (other.BearerToken.Length != 0) { + BearerToken = other.BearerToken; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 1610: { + BearerToken = input.ReadString(); + break; + } + case 1618: { + FirstName = input.ReadString(); + break; + } + case 1626: { + LastName = input.ReadString(); + break; + } + case 1632: { + Age = input.ReadInt32(); + break; + } + case 1642: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 1650: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 1656: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarAuditTenantGateway : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarAuditTenantGateway()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[28]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditTenantGateway() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditTenantGateway(CreateRockstarAuditTenantGateway other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditTenantGateway Clone() { + return new CreateRockstarAuditTenantGateway(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarAuditTenantGateway); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarAuditTenantGateway other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarAuditTenantGateway other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarAuditTenantMq : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarAuditTenantMq()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[29]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditTenantMq() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditTenantMq(CreateRockstarAuditTenantMq other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAuditTenantMq Clone() { + return new CreateRockstarAuditTenantMq(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarAuditTenantMq); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarAuditTenantMq other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarAuditTenantMq other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarAutoMap : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarAutoMap()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[30]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAutoMap() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAutoMap(CreateRockstarAutoMap other) : this() { + mapFirstName_ = other.mapFirstName_; + mapLastName_ = other.mapLastName_; + mapAge_ = other.mapAge_; + mapDateOfBirth_ = other.mapDateOfBirth_ != null ? other.mapDateOfBirth_.Clone() : null; + mapDateDied_ = other.mapDateDied_ != null ? other.mapDateDied_.Clone() : null; + mapLivingStatus_ = other.mapLivingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarAutoMap Clone() { + return new CreateRockstarAutoMap(this); + } + + /// Field number for the "MapFirstName" field. + public const int MapFirstNameFieldNumber = 1; + private string mapFirstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string MapFirstName { + get { return mapFirstName_; } + set { + mapFirstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "MapLastName" field. + public const int MapLastNameFieldNumber = 2; + private string mapLastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string MapLastName { + get { return mapLastName_; } + set { + mapLastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "MapAge" field. + public const int MapAgeFieldNumber = 3; + private int mapAge_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int MapAge { + get { return mapAge_; } + set { + mapAge_ = value; + } + } + + /// Field number for the "MapDateOfBirth" field. + public const int MapDateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp mapDateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp MapDateOfBirth { + get { return mapDateOfBirth_; } + set { + mapDateOfBirth_ = value; + } + } + + /// Field number for the "MapDateDied" field. + public const int MapDateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp mapDateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp MapDateDied { + get { return mapDateDied_; } + set { + mapDateDied_ = value; + } + } + + /// Field number for the "MapLivingStatus" field. + public const int MapLivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus mapLivingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus MapLivingStatus { + get { return mapLivingStatus_; } + set { + mapLivingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarAutoMap); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarAutoMap other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (MapFirstName != other.MapFirstName) return false; + if (MapLastName != other.MapLastName) return false; + if (MapAge != other.MapAge) return false; + if (!object.Equals(MapDateOfBirth, other.MapDateOfBirth)) return false; + if (!object.Equals(MapDateDied, other.MapDateDied)) return false; + if (MapLivingStatus != other.MapLivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (MapFirstName.Length != 0) hash ^= MapFirstName.GetHashCode(); + if (MapLastName.Length != 0) hash ^= MapLastName.GetHashCode(); + if (MapAge != 0) hash ^= MapAge.GetHashCode(); + if (mapDateOfBirth_ != null) hash ^= MapDateOfBirth.GetHashCode(); + if (mapDateDied_ != null) hash ^= MapDateDied.GetHashCode(); + if (MapLivingStatus != 0) hash ^= MapLivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (MapFirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(MapFirstName); + } + if (MapLastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(MapLastName); + } + if (MapAge != 0) { + output.WriteRawTag(24); + output.WriteInt32(MapAge); + } + if (mapDateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(MapDateOfBirth); + } + if (mapDateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(MapDateDied); + } + if (MapLivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) MapLivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (MapFirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(MapFirstName); + } + if (MapLastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(MapLastName); + } + if (MapAge != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(MapAge); + } + if (mapDateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(MapDateOfBirth); + } + if (mapDateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(MapDateDied); + } + if (MapLivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) MapLivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarAutoMap other) { + if (other == null) { + return; + } + if (other.MapFirstName.Length != 0) { + MapFirstName = other.MapFirstName; + } + if (other.MapLastName.Length != 0) { + MapLastName = other.MapLastName; + } + if (other.MapAge != 0) { + MapAge = other.MapAge; + } + if (other.mapDateOfBirth_ != null) { + if (mapDateOfBirth_ == null) { + MapDateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + MapDateOfBirth.MergeFrom(other.MapDateOfBirth); + } + if (other.mapDateDied_ != null) { + if (mapDateDied_ == null) { + MapDateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + MapDateDied.MergeFrom(other.MapDateDied); + } + if (other.MapLivingStatus != 0) { + MapLivingStatus = other.MapLivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + MapFirstName = input.ReadString(); + break; + } + case 18: { + MapLastName = input.ReadString(); + break; + } + case 24: { + MapAge = input.ReadInt32(); + break; + } + case 34: { + if (mapDateOfBirth_ == null) { + MapDateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(MapDateOfBirth); + break; + } + case 42: { + if (mapDateDied_ == null) { + MapDateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(MapDateDied); + break; + } + case 48: { + MapLivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[31]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarResponse(CreateRockstarResponse other) : this() { + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarResponse Clone() { + return new CreateRockstarResponse(this); + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 1; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (responseStatus_ != null) { + output.WriteRawTag(10); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarResponse other) { + if (other == null) { + return; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarVersion : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarVersion()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[32]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarVersion() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarVersion(CreateRockstarVersion other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarVersion Clone() { + return new CreateRockstarVersion(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarVersion); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarVersion other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarVersion other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarWithAutoGuid : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarWithAutoGuid()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[33]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithAutoGuid() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithAutoGuid(CreateRockstarWithAutoGuid other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithAutoGuid Clone() { + return new CreateRockstarWithAutoGuid(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarWithAutoGuid); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarWithAutoGuid other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarWithAutoGuid other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarWithReturn : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarWithReturn()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[34]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithReturn() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithReturn(CreateRockstarWithReturn other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithReturn Clone() { + return new CreateRockstarWithReturn(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarWithReturn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarWithReturn other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarWithReturn other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarWithReturnGuidResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarWithReturnGuidResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[35]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithReturnGuidResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithReturnGuidResponse(CreateRockstarWithReturnGuidResponse other) : this() { + id_ = other.id_; + result_ = other.result_ != null ? other.result_.Clone() : null; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithReturnGuidResponse Clone() { + return new CreateRockstarWithReturnGuidResponse(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// default value could not be applied: 00000000-0000-0000-0000-000000000000 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.RockstarBase result_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.RockstarBase Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarWithReturnGuidResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarWithReturnGuidResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(Result, other.Result)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (result_ != null) hash ^= Result.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (result_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Result); + } + if (responseStatus_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (result_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarWithReturnGuidResponse other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + if (other.result_ != null) { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.RockstarBase(); + } + Result.MergeFrom(other.Result); + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.RockstarBase(); + } + input.ReadMessage(Result); + break; + } + case 26: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class CreateRockstarWithVoidReturn : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRockstarWithVoidReturn()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[36]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithVoidReturn() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithVoidReturn(CreateRockstarWithVoidReturn other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRockstarWithVoidReturn Clone() { + return new CreateRockstarWithVoidReturn(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRockstarWithVoidReturn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRockstarWithVoidReturn other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRockstarWithVoidReturn other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class CreateTodo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateTodo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[37]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateTodo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateTodo(CreateTodo other) : this() { + title_ = other.title_; + order_ = other.order_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateTodo Clone() { + return new CreateTodo(this); + } + + /// Field number for the "Title" field. + public const int TitleFieldNumber = 1; + private string title_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Title { + get { return title_; } + set { + title_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Order" field. + public const int OrderFieldNumber = 2; + private int order_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Order { + get { return order_; } + set { + order_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateTodo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateTodo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Title != other.Title) return false; + if (Order != other.Order) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Title.Length != 0) hash ^= Title.GetHashCode(); + if (Order != 0) hash ^= Order.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Title.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Title); + } + if (Order != 0) { + output.WriteRawTag(16); + output.WriteInt32(Order); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Title.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Title); + } + if (Order != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Order); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateTodo other) { + if (other == null) { + return; + } + if (other.Title.Length != 0) { + Title = other.Title; + } + if (other.Order != 0) { + Order = other.Order; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Title = input.ReadString(); + break; + } + case 16: { + Order = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class CreateTodoResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateTodoResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[38]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateTodoResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateTodoResponse(CreateTodoResponse other) : this() { + result_ = other.result_ != null ? other.result_.Clone() : null; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateTodoResponse Clone() { + return new CreateTodoResponse(this); + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 1; + private global::ServiceStack.Extensions.Tests.Protoc.Todo result_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.Todo Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateTodoResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateTodoResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Result, other.Result)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (result_ != null) hash ^= Result.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (result_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Result); + } + if (responseStatus_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (result_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateTodoResponse other) { + if (other == null) { + return; + } + if (other.result_ != null) { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.Todo(); + } + Result.MergeFrom(other.Result); + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.Todo(); + } + input.ReadMessage(Result); + break; + } + case 18: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class CustomRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[39]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomRockstar(CustomRockstar other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + rockstarAlbumName_ = other.rockstarAlbumName_; + rockstarGenreName_ = other.rockstarGenreName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomRockstar Clone() { + return new CustomRockstar(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "RockstarAlbumName" field. + public const int RockstarAlbumNameFieldNumber = 4; + private string rockstarAlbumName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarAlbumName { + get { return rockstarAlbumName_; } + set { + rockstarAlbumName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RockstarGenreName" field. + public const int RockstarGenreNameFieldNumber = 5; + private string rockstarGenreName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarGenreName { + get { return rockstarGenreName_; } + set { + rockstarGenreName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (RockstarAlbumName != other.RockstarAlbumName) return false; + if (RockstarGenreName != other.RockstarGenreName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (RockstarAlbumName.Length != 0) hash ^= RockstarAlbumName.GetHashCode(); + if (RockstarGenreName.Length != 0) hash ^= RockstarGenreName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (RockstarAlbumName.Length != 0) { + output.WriteRawTag(34); + output.WriteString(RockstarAlbumName); + } + if (RockstarGenreName.Length != 0) { + output.WriteRawTag(42); + output.WriteString(RockstarGenreName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (RockstarAlbumName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RockstarAlbumName); + } + if (RockstarGenreName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RockstarGenreName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomRockstar other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.RockstarAlbumName.Length != 0) { + RockstarAlbumName = other.RockstarAlbumName; + } + if (other.RockstarGenreName.Length != 0) { + RockstarGenreName = other.RockstarGenreName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + RockstarAlbumName = input.ReadString(); + break; + } + case 42: { + RockstarGenreName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class CustomRockstarSchema : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomRockstarSchema()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[40]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomRockstarSchema() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomRockstarSchema(CustomRockstarSchema other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + rockstarAlbumName_ = other.rockstarAlbumName_; + rockstarGenreName_ = other.rockstarGenreName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomRockstarSchema Clone() { + return new CustomRockstarSchema(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "RockstarAlbumName" field. + public const int RockstarAlbumNameFieldNumber = 4; + private string rockstarAlbumName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarAlbumName { + get { return rockstarAlbumName_; } + set { + rockstarAlbumName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RockstarGenreName" field. + public const int RockstarGenreNameFieldNumber = 5; + private string rockstarGenreName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarGenreName { + get { return rockstarGenreName_; } + set { + rockstarGenreName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomRockstarSchema); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomRockstarSchema other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (RockstarAlbumName != other.RockstarAlbumName) return false; + if (RockstarGenreName != other.RockstarGenreName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (RockstarAlbumName.Length != 0) hash ^= RockstarAlbumName.GetHashCode(); + if (RockstarGenreName.Length != 0) hash ^= RockstarGenreName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (RockstarAlbumName.Length != 0) { + output.WriteRawTag(34); + output.WriteString(RockstarAlbumName); + } + if (RockstarGenreName.Length != 0) { + output.WriteRawTag(42); + output.WriteString(RockstarGenreName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (RockstarAlbumName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RockstarAlbumName); + } + if (RockstarGenreName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RockstarGenreName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomRockstarSchema other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.RockstarAlbumName.Length != 0) { + RockstarAlbumName = other.RockstarAlbumName; + } + if (other.RockstarGenreName.Length != 0) { + RockstarGenreName = other.RockstarGenreName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + RockstarAlbumName = input.ReadString(); + break; + } + case 42: { + RockstarGenreName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class CustomSelectRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomSelectRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[41]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomSelectRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomSelectRockstar(CustomSelectRockstar other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomSelectRockstar Clone() { + return new CustomSelectRockstar(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 3; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 4; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomSelectRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomSelectRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(32); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomSelectRockstar other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 26: { + LastName = input.ReadString(); + break; + } + case 32: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class CustomSelectRockstarResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomSelectRockstarResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[42]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomSelectRockstarResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomSelectRockstarResponse(CustomSelectRockstarResponse other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomSelectRockstarResponse Clone() { + return new CustomSelectRockstarResponse(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomSelectRockstarResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomSelectRockstarResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomSelectRockstarResponse other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class CustomValidationErrors : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomValidationErrors()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[43]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomValidationErrors() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomValidationErrors(CustomValidationErrors other) : this() { + customErrorCode_ = other.customErrorCode_; + customErrorCodeAndMessage_ = other.customErrorCodeAndMessage_; + errorCodeRule_ = other.errorCodeRule_; + isOddCondition_ = other.isOddCondition_; + isOddAndOverTwoDigitsCondition_ = other.isOddAndOverTwoDigitsCondition_; + isOddOrOverTwoDigitsCondition_ = other.isOddOrOverTwoDigitsCondition_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomValidationErrors Clone() { + return new CustomValidationErrors(this); + } + + /// Field number for the "CustomErrorCode" field. + public const int CustomErrorCodeFieldNumber = 1; + private string customErrorCode_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CustomErrorCode { + get { return customErrorCode_; } + set { + customErrorCode_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "CustomErrorCodeAndMessage" field. + public const int CustomErrorCodeAndMessageFieldNumber = 2; + private int customErrorCodeAndMessage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CustomErrorCodeAndMessage { + get { return customErrorCodeAndMessage_; } + set { + customErrorCodeAndMessage_ = value; + } + } + + /// Field number for the "ErrorCodeRule" field. + public const int ErrorCodeRuleFieldNumber = 3; + private string errorCodeRule_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ErrorCodeRule { + get { return errorCodeRule_; } + set { + errorCodeRule_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "IsOddCondition" field. + public const int IsOddConditionFieldNumber = 4; + private int isOddCondition_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int IsOddCondition { + get { return isOddCondition_; } + set { + isOddCondition_ = value; + } + } + + /// Field number for the "IsOddAndOverTwoDigitsCondition" field. + public const int IsOddAndOverTwoDigitsConditionFieldNumber = 5; + private int isOddAndOverTwoDigitsCondition_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int IsOddAndOverTwoDigitsCondition { + get { return isOddAndOverTwoDigitsCondition_; } + set { + isOddAndOverTwoDigitsCondition_ = value; + } + } + + /// Field number for the "IsOddOrOverTwoDigitsCondition" field. + public const int IsOddOrOverTwoDigitsConditionFieldNumber = 6; + private int isOddOrOverTwoDigitsCondition_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int IsOddOrOverTwoDigitsCondition { + get { return isOddOrOverTwoDigitsCondition_; } + set { + isOddOrOverTwoDigitsCondition_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomValidationErrors); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomValidationErrors other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (CustomErrorCode != other.CustomErrorCode) return false; + if (CustomErrorCodeAndMessage != other.CustomErrorCodeAndMessage) return false; + if (ErrorCodeRule != other.ErrorCodeRule) return false; + if (IsOddCondition != other.IsOddCondition) return false; + if (IsOddAndOverTwoDigitsCondition != other.IsOddAndOverTwoDigitsCondition) return false; + if (IsOddOrOverTwoDigitsCondition != other.IsOddOrOverTwoDigitsCondition) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (CustomErrorCode.Length != 0) hash ^= CustomErrorCode.GetHashCode(); + if (CustomErrorCodeAndMessage != 0) hash ^= CustomErrorCodeAndMessage.GetHashCode(); + if (ErrorCodeRule.Length != 0) hash ^= ErrorCodeRule.GetHashCode(); + if (IsOddCondition != 0) hash ^= IsOddCondition.GetHashCode(); + if (IsOddAndOverTwoDigitsCondition != 0) hash ^= IsOddAndOverTwoDigitsCondition.GetHashCode(); + if (IsOddOrOverTwoDigitsCondition != 0) hash ^= IsOddOrOverTwoDigitsCondition.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (CustomErrorCode.Length != 0) { + output.WriteRawTag(10); + output.WriteString(CustomErrorCode); + } + if (CustomErrorCodeAndMessage != 0) { + output.WriteRawTag(16); + output.WriteInt32(CustomErrorCodeAndMessage); + } + if (ErrorCodeRule.Length != 0) { + output.WriteRawTag(26); + output.WriteString(ErrorCodeRule); + } + if (IsOddCondition != 0) { + output.WriteRawTag(32); + output.WriteInt32(IsOddCondition); + } + if (IsOddAndOverTwoDigitsCondition != 0) { + output.WriteRawTag(40); + output.WriteInt32(IsOddAndOverTwoDigitsCondition); + } + if (IsOddOrOverTwoDigitsCondition != 0) { + output.WriteRawTag(48); + output.WriteInt32(IsOddOrOverTwoDigitsCondition); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (CustomErrorCode.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CustomErrorCode); + } + if (CustomErrorCodeAndMessage != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(CustomErrorCodeAndMessage); + } + if (ErrorCodeRule.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorCodeRule); + } + if (IsOddCondition != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(IsOddCondition); + } + if (IsOddAndOverTwoDigitsCondition != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(IsOddAndOverTwoDigitsCondition); + } + if (IsOddOrOverTwoDigitsCondition != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(IsOddOrOverTwoDigitsCondition); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomValidationErrors other) { + if (other == null) { + return; + } + if (other.CustomErrorCode.Length != 0) { + CustomErrorCode = other.CustomErrorCode; + } + if (other.CustomErrorCodeAndMessage != 0) { + CustomErrorCodeAndMessage = other.CustomErrorCodeAndMessage; + } + if (other.ErrorCodeRule.Length != 0) { + ErrorCodeRule = other.ErrorCodeRule; + } + if (other.IsOddCondition != 0) { + IsOddCondition = other.IsOddCondition; + } + if (other.IsOddAndOverTwoDigitsCondition != 0) { + IsOddAndOverTwoDigitsCondition = other.IsOddAndOverTwoDigitsCondition; + } + if (other.IsOddOrOverTwoDigitsCondition != 0) { + IsOddOrOverTwoDigitsCondition = other.IsOddOrOverTwoDigitsCondition; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + CustomErrorCode = input.ReadString(); + break; + } + case 16: { + CustomErrorCodeAndMessage = input.ReadInt32(); + break; + } + case 26: { + ErrorCodeRule = input.ReadString(); + break; + } + case 32: { + IsOddCondition = input.ReadInt32(); + break; + } + case 40: { + IsOddAndOverTwoDigitsCondition = input.ReadInt32(); + break; + } + case 48: { + IsOddOrOverTwoDigitsCondition = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class DaoBase : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DaoBase()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[44]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DaoBase() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DaoBase(DaoBase other) : this() { + id_ = other.id_; + createDate_ = other.createDate_ != null ? other.createDate_.Clone() : null; + createdBy_ = other.createdBy_; + modifiedDate_ = other.modifiedDate_ != null ? other.modifiedDate_.Clone() : null; + modifiedBy_ = other.modifiedBy_; + switch (other.SubtypeCase) { + case SubtypeOneofCase.Bookmark: + Bookmark = other.Bookmark.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DaoBase Clone() { + return new DaoBase(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// default value could not be applied: 00000000-0000-0000-0000-000000000000 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "CreateDate" field. + public const int CreateDateFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Timestamp createDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp CreateDate { + get { return createDate_; } + set { + createDate_ = value; + } + } + + /// Field number for the "CreatedBy" field. + public const int CreatedByFieldNumber = 3; + private string createdBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CreatedBy { + get { return createdBy_; } + set { + createdBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ModifiedDate" field. + public const int ModifiedDateFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp modifiedDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp ModifiedDate { + get { return modifiedDate_; } + set { + modifiedDate_ = value; + } + } + + /// Field number for the "ModifiedBy" field. + public const int ModifiedByFieldNumber = 5; + private string modifiedBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ModifiedBy { + get { return modifiedBy_; } + set { + modifiedBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Bookmark" field. + public const int BookmarkFieldNumber = 439450339; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.Bookmark Bookmark { + get { return subtypeCase_ == SubtypeOneofCase.Bookmark ? (global::ServiceStack.Extensions.Tests.Protoc.Bookmark) subtype_ : null; } + set { + subtype_ = value; + subtypeCase_ = value == null ? SubtypeOneofCase.None : SubtypeOneofCase.Bookmark; + } + } + + private object subtype_; + /// Enum of possible cases for the "subtype" oneof. + public enum SubtypeOneofCase { + None = 0, + Bookmark = 439450339, + } + private SubtypeOneofCase subtypeCase_ = SubtypeOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SubtypeOneofCase SubtypeCase { + get { return subtypeCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSubtype() { + subtypeCase_ = SubtypeOneofCase.None; + subtype_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DaoBase); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DaoBase other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(CreateDate, other.CreateDate)) return false; + if (CreatedBy != other.CreatedBy) return false; + if (!object.Equals(ModifiedDate, other.ModifiedDate)) return false; + if (ModifiedBy != other.ModifiedBy) return false; + if (!object.Equals(Bookmark, other.Bookmark)) return false; + if (SubtypeCase != other.SubtypeCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (createDate_ != null) hash ^= CreateDate.GetHashCode(); + if (CreatedBy.Length != 0) hash ^= CreatedBy.GetHashCode(); + if (modifiedDate_ != null) hash ^= ModifiedDate.GetHashCode(); + if (ModifiedBy.Length != 0) hash ^= ModifiedBy.GetHashCode(); + if (subtypeCase_ == SubtypeOneofCase.Bookmark) hash ^= Bookmark.GetHashCode(); + hash ^= (int) subtypeCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (createDate_ != null) { + output.WriteRawTag(18); + output.WriteMessage(CreateDate); + } + if (CreatedBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(CreatedBy); + } + if (modifiedDate_ != null) { + output.WriteRawTag(34); + output.WriteMessage(ModifiedDate); + } + if (ModifiedBy.Length != 0) { + output.WriteRawTag(42); + output.WriteString(ModifiedBy); + } + if (subtypeCase_ == SubtypeOneofCase.Bookmark) { + output.WriteRawTag(154, 174, 175, 140, 13); + output.WriteMessage(Bookmark); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (createDate_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(CreateDate); + } + if (CreatedBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CreatedBy); + } + if (modifiedDate_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ModifiedDate); + } + if (ModifiedBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ModifiedBy); + } + if (subtypeCase_ == SubtypeOneofCase.Bookmark) { + size += 5 + pb::CodedOutputStream.ComputeMessageSize(Bookmark); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DaoBase other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + if (other.createDate_ != null) { + if (createDate_ == null) { + CreateDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + CreateDate.MergeFrom(other.CreateDate); + } + if (other.CreatedBy.Length != 0) { + CreatedBy = other.CreatedBy; + } + if (other.modifiedDate_ != null) { + if (modifiedDate_ == null) { + ModifiedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + ModifiedDate.MergeFrom(other.ModifiedDate); + } + if (other.ModifiedBy.Length != 0) { + ModifiedBy = other.ModifiedBy; + } + switch (other.SubtypeCase) { + case SubtypeOneofCase.Bookmark: + if (Bookmark == null) { + Bookmark = new global::ServiceStack.Extensions.Tests.Protoc.Bookmark(); + } + Bookmark.MergeFrom(other.Bookmark); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + if (createDate_ == null) { + CreateDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(CreateDate); + break; + } + case 26: { + CreatedBy = input.ReadString(); + break; + } + case 34: { + if (modifiedDate_ == null) { + ModifiedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(ModifiedDate); + break; + } + case 42: { + ModifiedBy = input.ReadString(); + break; + } + case 3515602714: { + global::ServiceStack.Extensions.Tests.Protoc.Bookmark subBuilder = new global::ServiceStack.Extensions.Tests.Protoc.Bookmark(); + if (subtypeCase_ == SubtypeOneofCase.Bookmark) { + subBuilder.MergeFrom(Bookmark); + } + input.ReadMessage(subBuilder); + Bookmark = subBuilder; + break; + } + } + } + } + + } + + public sealed partial class DeleteRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[45]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstar(DeleteRockstar other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstar Clone() { + return new DeleteRockstar(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DeleteRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DeleteRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DeleteRockstar other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class DeleteRockstarAudit : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteRockstarAudit()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[46]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstarAudit() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstarAudit(DeleteRockstarAudit other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstarAudit Clone() { + return new DeleteRockstarAudit(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DeleteRockstarAudit); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DeleteRockstarAudit other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DeleteRockstarAudit other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class DeleteRockstarCountResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteRockstarCountResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[47]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstarCountResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstarCountResponse(DeleteRockstarCountResponse other) : this() { + count_ = other.count_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstarCountResponse Clone() { + return new DeleteRockstarCountResponse(this); + } + + /// Field number for the "Count" field. + public const int CountFieldNumber = 1; + private int count_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Count { + get { return count_; } + set { + count_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DeleteRockstarCountResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DeleteRockstarCountResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Count != other.Count) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Count != 0) hash ^= Count.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Count != 0) { + output.WriteRawTag(8); + output.WriteInt32(Count); + } + if (responseStatus_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Count != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Count); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DeleteRockstarCountResponse other) { + if (other == null) { + return; + } + if (other.Count != 0) { + Count = other.Count; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Count = input.ReadInt32(); + break; + } + case 18: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class DeleteRockstarFilters : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteRockstarFilters()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[48]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstarFilters() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstarFilters(DeleteRockstarFilters other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRockstarFilters Clone() { + return new DeleteRockstarFilters(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DeleteRockstarFilters); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DeleteRockstarFilters other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DeleteRockstarFilters other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class DeleteTodo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteTodo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[49]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteTodo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteTodo(DeleteTodo other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteTodo Clone() { + return new DeleteTodo(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private long id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DeleteTodo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DeleteTodo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0L) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DeleteTodo other) { + if (other == null) { + return; + } + if (other.Id != 0L) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt64(); + break; + } + } + } + } + + } + + public sealed partial class DeleteTodos : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteTodos()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[50]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteTodos() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteTodos(DeleteTodos other) : this() { + ids_ = other.ids_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteTodos Clone() { + return new DeleteTodos(this); + } + + /// Field number for the "Ids" field. + public const int IdsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_ids_codec + = pb::FieldCodec.ForInt64(8); + private readonly pbc::RepeatedField ids_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ids { + get { return ids_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DeleteTodos); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DeleteTodos other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!ids_.Equals(other.ids_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= ids_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + ids_.WriteTo(output, _repeated_ids_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += ids_.CalculateSize(_repeated_ids_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DeleteTodos other) { + if (other == null) { + return; + } + ids_.Add(other.ids_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + ids_.AddEntriesFrom(input, _repeated_ids_codec); + break; + } + } + } + } + + } + + public sealed partial class DynamicRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DynamicRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[51]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DynamicRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DynamicRequest(DynamicRequest other) : this() { + params_ = other.params_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DynamicRequest Clone() { + return new DynamicRequest(this); + } + + /// Field number for the "Params" field. + public const int ParamsFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_params_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 10); + private readonly pbc::MapField params_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Params { + get { return params_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DynamicRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DynamicRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!Params.Equals(other.Params)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= Params.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + params_.WriteTo(output, _map_params_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += params_.CalculateSize(_map_params_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DynamicRequest other) { + if (other == null) { + return; + } + params_.Add(other.params_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + params_.AddEntriesFrom(input, _map_params_codec); + break; + } + } + } + } + + } + + public sealed partial class DynamicValidationRules : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DynamicValidationRules()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[52]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DynamicValidationRules() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DynamicValidationRules(DynamicValidationRules other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DynamicValidationRules Clone() { + return new DynamicValidationRules(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DynamicValidationRules); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DynamicValidationRules other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (LivingStatus != 0) { + output.WriteRawTag(40); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DynamicValidationRules other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 40: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class EmptyResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EmptyResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[53]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EmptyResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EmptyResponse(EmptyResponse other) : this() { + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EmptyResponse Clone() { + return new EmptyResponse(this); + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 1; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as EmptyResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(EmptyResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (responseStatus_ != null) { + output.WriteRawTag(10); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(EmptyResponse other) { + if (other == null) { + return; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class EmptyValidators : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EmptyValidators()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[54]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EmptyValidators() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EmptyValidators(EmptyValidators other) : this() { + int_ = other.int_; + nInt_ = other.nInt_; + timeSpan_ = other.timeSpan_ != null ? other.timeSpan_.Clone() : null; + nTimeSpan_ = other.nTimeSpan_ != null ? other.nTimeSpan_.Clone() : null; + string_ = other.string_; + intArray_ = other.intArray_.Clone(); + stringList_ = other.stringList_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EmptyValidators Clone() { + return new EmptyValidators(this); + } + + /// Field number for the "Int" field. + public const int IntFieldNumber = 1; + private int int_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Int { + get { return int_; } + set { + int_ = value; + } + } + + /// Field number for the "NInt" field. + public const int NIntFieldNumber = 2; + private int nInt_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int NInt { + get { return nInt_; } + set { + nInt_ = value; + } + } + + /// Field number for the "TimeSpan" field. + public const int TimeSpanFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Duration timeSpan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Duration TimeSpan { + get { return timeSpan_; } + set { + timeSpan_ = value; + } + } + + /// Field number for the "NTimeSpan" field. + public const int NTimeSpanFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Duration nTimeSpan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Duration NTimeSpan { + get { return nTimeSpan_; } + set { + nTimeSpan_ = value; + } + } + + /// Field number for the "String" field. + public const int StringFieldNumber = 5; + private string string_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string String { + get { return string_; } + set { + string_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "IntArray" field. + public const int IntArrayFieldNumber = 6; + private static readonly pb::FieldCodec _repeated_intArray_codec + = pb::FieldCodec.ForInt32(48); + private readonly pbc::RepeatedField intArray_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField IntArray { + get { return intArray_; } + } + + /// Field number for the "StringList" field. + public const int StringListFieldNumber = 7; + private static readonly pb::FieldCodec _repeated_stringList_codec + = pb::FieldCodec.ForString(58); + private readonly pbc::RepeatedField stringList_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField StringList { + get { return stringList_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as EmptyValidators); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(EmptyValidators other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Int != other.Int) return false; + if (NInt != other.NInt) return false; + if (!object.Equals(TimeSpan, other.TimeSpan)) return false; + if (!object.Equals(NTimeSpan, other.NTimeSpan)) return false; + if (String != other.String) return false; + if(!intArray_.Equals(other.intArray_)) return false; + if(!stringList_.Equals(other.stringList_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Int != 0) hash ^= Int.GetHashCode(); + if (NInt != 0) hash ^= NInt.GetHashCode(); + if (timeSpan_ != null) hash ^= TimeSpan.GetHashCode(); + if (nTimeSpan_ != null) hash ^= NTimeSpan.GetHashCode(); + if (String.Length != 0) hash ^= String.GetHashCode(); + hash ^= intArray_.GetHashCode(); + hash ^= stringList_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Int != 0) { + output.WriteRawTag(8); + output.WriteInt32(Int); + } + if (NInt != 0) { + output.WriteRawTag(16); + output.WriteInt32(NInt); + } + if (timeSpan_ != null) { + output.WriteRawTag(26); + output.WriteMessage(TimeSpan); + } + if (nTimeSpan_ != null) { + output.WriteRawTag(34); + output.WriteMessage(NTimeSpan); + } + if (String.Length != 0) { + output.WriteRawTag(42); + output.WriteString(String); + } + intArray_.WriteTo(output, _repeated_intArray_codec); + stringList_.WriteTo(output, _repeated_stringList_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Int != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Int); + } + if (NInt != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NInt); + } + if (timeSpan_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(TimeSpan); + } + if (nTimeSpan_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(NTimeSpan); + } + if (String.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(String); + } + size += intArray_.CalculateSize(_repeated_intArray_codec); + size += stringList_.CalculateSize(_repeated_stringList_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(EmptyValidators other) { + if (other == null) { + return; + } + if (other.Int != 0) { + Int = other.Int; + } + if (other.NInt != 0) { + NInt = other.NInt; + } + if (other.timeSpan_ != null) { + if (timeSpan_ == null) { + TimeSpan = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + TimeSpan.MergeFrom(other.TimeSpan); + } + if (other.nTimeSpan_ != null) { + if (nTimeSpan_ == null) { + NTimeSpan = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + NTimeSpan.MergeFrom(other.NTimeSpan); + } + if (other.String.Length != 0) { + String = other.String; + } + intArray_.Add(other.intArray_); + stringList_.Add(other.stringList_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Int = input.ReadInt32(); + break; + } + case 16: { + NInt = input.ReadInt32(); + break; + } + case 26: { + if (timeSpan_ == null) { + TimeSpan = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(TimeSpan); + break; + } + case 34: { + if (nTimeSpan_ == null) { + NTimeSpan = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(NTimeSpan); + break; + } + case 42: { + String = input.ReadString(); + break; + } + case 50: + case 48: { + intArray_.AddEntriesFrom(input, _repeated_intArray_codec); + break; + } + case 58: { + stringList_.AddEntriesFrom(input, _repeated_stringList_codec); + break; + } + } + } + } + + } + + public sealed partial class EndsWithSuffixRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EndsWithSuffixRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[55]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EndsWithSuffixRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EndsWithSuffixRequest(EndsWithSuffixRequest other) : this() { + suffix_ = other.suffix_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EndsWithSuffixRequest Clone() { + return new EndsWithSuffixRequest(this); + } + + /// Field number for the "Suffix" field. + public const int SuffixFieldNumber = 1; + private string suffix_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Suffix { + get { return suffix_; } + set { + suffix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as EndsWithSuffixRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(EndsWithSuffixRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Suffix != other.Suffix) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Suffix.Length != 0) hash ^= Suffix.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Suffix.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Suffix); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Suffix.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Suffix); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(EndsWithSuffixRequest other) { + if (other == null) { + return; + } + if (other.Suffix.Length != 0) { + Suffix = other.Suffix; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Suffix = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class EndsWithSuffixResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EndsWithSuffixResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[56]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EndsWithSuffixResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EndsWithSuffixResponse(EndsWithSuffixResponse other) : this() { + result_ = other.result_ != null ? other.result_.Clone() : null; + count_ = other.count_; + words_ = other.words_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EndsWithSuffixResponse Clone() { + return new EndsWithSuffixResponse(this); + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 1; + private global::ServiceStack.Extensions.Tests.Protoc.SearchResult result_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.SearchResult Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "Count" field. + public const int CountFieldNumber = 2; + private int count_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Count { + get { return count_; } + set { + count_ = value; + } + } + + /// Field number for the "Words" field. + public const int WordsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_words_codec + = pb::FieldCodec.ForString(26); + private readonly pbc::RepeatedField words_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Words { + get { return words_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as EndsWithSuffixResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(EndsWithSuffixResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Result, other.Result)) return false; + if (Count != other.Count) return false; + if(!words_.Equals(other.words_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (result_ != null) hash ^= Result.GetHashCode(); + if (Count != 0) hash ^= Count.GetHashCode(); + hash ^= words_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (result_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Result); + } + if (Count != 0) { + output.WriteRawTag(16); + output.WriteInt32(Count); + } + words_.WriteTo(output, _repeated_words_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (result_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); + } + if (Count != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Count); + } + size += words_.CalculateSize(_repeated_words_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(EndsWithSuffixResponse other) { + if (other == null) { + return; + } + if (other.result_ != null) { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.SearchResult(); + } + Result.MergeFrom(other.Result); + } + if (other.Count != 0) { + Count = other.Count; + } + words_.Add(other.words_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.SearchResult(); + } + input.ReadMessage(Result); + break; + } + case 16: { + Count = input.ReadInt32(); + break; + } + case 26: { + words_.AddEntriesFrom(input, _repeated_words_codec); + break; + } + } + } + } + + } + + public sealed partial class Entry : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Entry()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[57]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Entry() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Entry(Entry other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Entry Clone() { + return new Entry(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Entry); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Entry other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Entry other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class FileContent : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileContent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[58]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public FileContent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public FileContent(FileContent other) : this() { + name_ = other.name_; + type_ = other.type_; + length_ = other.length_; + body_ = other.body_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public FileContent Clone() { + return new FileContent(this); + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Type" field. + public const int TypeFieldNumber = 2; + private string type_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Type { + get { return type_; } + set { + type_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Length" field. + public const int LengthFieldNumber = 3; + private int length_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Length { + get { return length_; } + set { + length_ = value; + } + } + + /// Field number for the "Body" field. + public const int BodyFieldNumber = 4; + private pb::ByteString body_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString Body { + get { return body_; } + set { + body_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as FileContent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(FileContent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (Type != other.Type) return false; + if (Length != other.Length) return false; + if (Body != other.Body) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Type.Length != 0) hash ^= Type.GetHashCode(); + if (Length != 0) hash ^= Length.GetHashCode(); + if (Body.Length != 0) hash ^= Body.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Type.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Type); + } + if (Length != 0) { + output.WriteRawTag(24); + output.WriteInt32(Length); + } + if (Body.Length != 0) { + output.WriteRawTag(34); + output.WriteBytes(Body); + } + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Type.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Type); + } + if (Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Length); + } + if (Body.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Body); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(FileContent other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Type.Length != 0) { + Type = other.Type; + } + if (other.Length != 0) { + Length = other.Length; + } + if (other.Body.Length != 0) { + Body = other.Body; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Type = input.ReadString(); + break; + } + case 24: { + Length = input.ReadInt32(); + break; + } + case 34: { + Body = input.ReadBytes(); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class Foo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Foo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[59]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Foo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Foo(Foo other) : this() { + x_ = other.x_; + switch (other.SubtypeCase) { + case SubtypeOneofCase.Bar: + Bar = other.Bar.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Foo Clone() { + return new Foo(this); + } + + /// Field number for the "X" field. + public const int XFieldNumber = 1; + private string x_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string X { + get { return x_; } + set { + x_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Bar" field. + public const int BarFieldNumber = 210304982; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.Bar Bar { + get { return subtypeCase_ == SubtypeOneofCase.Bar ? (global::ServiceStack.Extensions.Tests.Protoc.Bar) subtype_ : null; } + set { + subtype_ = value; + subtypeCase_ = value == null ? SubtypeOneofCase.None : SubtypeOneofCase.Bar; + } + } + + private object subtype_; + /// Enum of possible cases for the "subtype" oneof. + public enum SubtypeOneofCase { + None = 0, + Bar = 210304982, + } + private SubtypeOneofCase subtypeCase_ = SubtypeOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SubtypeOneofCase SubtypeCase { + get { return subtypeCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSubtype() { + subtypeCase_ = SubtypeOneofCase.None; + subtype_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Foo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Foo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (X != other.X) return false; + if (!object.Equals(Bar, other.Bar)) return false; + if (SubtypeCase != other.SubtypeCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (X.Length != 0) hash ^= X.GetHashCode(); + if (subtypeCase_ == SubtypeOneofCase.Bar) hash ^= Bar.GetHashCode(); + hash ^= (int) subtypeCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (X.Length != 0) { + output.WriteRawTag(10); + output.WriteString(X); + } + if (subtypeCase_ == SubtypeOneofCase.Bar) { + output.WriteRawTag(178, 253, 159, 162, 6); + output.WriteMessage(Bar); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (X.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(X); + } + if (subtypeCase_ == SubtypeOneofCase.Bar) { + size += 5 + pb::CodedOutputStream.ComputeMessageSize(Bar); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Foo other) { + if (other == null) { + return; + } + if (other.X.Length != 0) { + X = other.X; + } + switch (other.SubtypeCase) { + case SubtypeOneofCase.Bar: + if (Bar == null) { + Bar = new global::ServiceStack.Extensions.Tests.Protoc.Bar(); + } + Bar.MergeFrom(other.Bar); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + X = input.ReadString(); + break; + } + case 1682439858: { + global::ServiceStack.Extensions.Tests.Protoc.Bar subBuilder = new global::ServiceStack.Extensions.Tests.Protoc.Bar(); + if (subtypeCase_ == SubtypeOneofCase.Bar) { + subBuilder.MergeFrom(Bar); + } + input.ReadMessage(subBuilder); + Bar = subBuilder; + break; + } + } + } + } + + } + + public sealed partial class GetAccessToken : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetAccessToken()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[60]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetAccessToken() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetAccessToken(GetAccessToken other) : this() { + refreshToken_ = other.refreshToken_; + useTokenCookie_ = other.useTokenCookie_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetAccessToken Clone() { + return new GetAccessToken(this); + } + + /// Field number for the "RefreshToken" field. + public const int RefreshTokenFieldNumber = 1; + private string refreshToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RefreshToken { + get { return refreshToken_; } + set { + refreshToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "UseTokenCookie" field. + public const int UseTokenCookieFieldNumber = 2; + private bool useTokenCookie_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool UseTokenCookie { + get { return useTokenCookie_; } + set { + useTokenCookie_ = value; + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 3; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 26); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetAccessToken); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetAccessToken other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (RefreshToken != other.RefreshToken) return false; + if (UseTokenCookie != other.UseTokenCookie) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (RefreshToken.Length != 0) hash ^= RefreshToken.GetHashCode(); + if (UseTokenCookie != false) hash ^= UseTokenCookie.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (RefreshToken.Length != 0) { + output.WriteRawTag(10); + output.WriteString(RefreshToken); + } + if (UseTokenCookie != false) { + output.WriteRawTag(16); + output.WriteBool(UseTokenCookie); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (RefreshToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RefreshToken); + } + if (UseTokenCookie != false) { + size += 1 + 1; + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetAccessToken other) { + if (other == null) { + return; + } + if (other.RefreshToken.Length != 0) { + RefreshToken = other.RefreshToken; + } + if (other.UseTokenCookie != false) { + UseTokenCookie = other.UseTokenCookie; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + RefreshToken = input.ReadString(); + break; + } + case 16: { + UseTokenCookie = input.ReadBool(); + break; + } + case 26: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class GetAccessTokenResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetAccessTokenResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[61]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetAccessTokenResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetAccessTokenResponse(GetAccessTokenResponse other) : this() { + accessToken_ = other.accessToken_; + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetAccessTokenResponse Clone() { + return new GetAccessTokenResponse(this); + } + + /// Field number for the "AccessToken" field. + public const int AccessTokenFieldNumber = 1; + private string accessToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string AccessToken { + get { return accessToken_; } + set { + accessToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 2; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 18); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetAccessTokenResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetAccessTokenResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (AccessToken != other.AccessToken) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (AccessToken.Length != 0) hash ^= AccessToken.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (AccessToken.Length != 0) { + output.WriteRawTag(10); + output.WriteString(AccessToken); + } + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (AccessToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(AccessToken); + } + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetAccessTokenResponse other) { + if (other == null) { + return; + } + if (other.AccessToken.Length != 0) { + AccessToken = other.AccessToken; + } + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + AccessToken = input.ReadString(); + break; + } + case 18: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 26: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class GetApiKeys : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetApiKeys()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[62]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetApiKeys() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetApiKeys(GetApiKeys other) : this() { + environment_ = other.environment_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetApiKeys Clone() { + return new GetApiKeys(this); + } + + /// Field number for the "Environment" field. + public const int EnvironmentFieldNumber = 1; + private string environment_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Environment { + get { return environment_; } + set { + environment_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 2; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 18); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetApiKeys); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetApiKeys other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Environment != other.Environment) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Environment.Length != 0) hash ^= Environment.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Environment.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Environment); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Environment.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Environment); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetApiKeys other) { + if (other == null) { + return; + } + if (other.Environment.Length != 0) { + Environment = other.Environment; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Environment = input.ReadString(); + break; + } + case 18: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class GetApiKeysResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetApiKeysResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[63]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetApiKeysResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetApiKeysResponse(GetApiKeysResponse other) : this() { + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetApiKeysResponse Clone() { + return new GetApiKeysResponse(this); + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(10, global::ServiceStack.Extensions.Tests.Protoc.UserApiKey.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 2; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 18); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetApiKeysResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetApiKeysResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetApiKeysResponse other) { + if (other == null) { + return; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 18: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 26: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class GetFile : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetFile()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[64]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetFile() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetFile(GetFile other) : this() { + path_ = other.path_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetFile Clone() { + return new GetFile(this); + } + + /// Field number for the "Path" field. + public const int PathFieldNumber = 1; + private string path_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Path { + get { return path_; } + set { + path_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetFile); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetFile other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Path != other.Path) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Path.Length != 0) hash ^= Path.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Path.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Path); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Path.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Path); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetFile other) { + if (other == null) { + return; + } + if (other.Path.Length != 0) { + Path = other.Path; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Path = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class GetHello : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetHello()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[65]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetHello() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetHello(GetHello other) : this() { + name_ = other.name_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetHello Clone() { + return new GetHello(this); + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetHello); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetHello other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetHello other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class GetTodo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetTodo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[66]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodo(GetTodo other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodo Clone() { + return new GetTodo(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private long id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetTodo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetTodo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0L) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetTodo other) { + if (other == null) { + return; + } + if (other.Id != 0L) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt64(); + break; + } + } + } + } + + } + + public sealed partial class GetTodoResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetTodoResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[67]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodoResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodoResponse(GetTodoResponse other) : this() { + result_ = other.result_ != null ? other.result_.Clone() : null; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodoResponse Clone() { + return new GetTodoResponse(this); + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 1; + private global::ServiceStack.Extensions.Tests.Protoc.Todo result_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.Todo Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetTodoResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetTodoResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Result, other.Result)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (result_ != null) hash ^= Result.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (result_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Result); + } + if (responseStatus_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (result_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetTodoResponse other) { + if (other == null) { + return; + } + if (other.result_ != null) { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.Todo(); + } + Result.MergeFrom(other.Result); + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.Todo(); + } + input.ReadMessage(Result); + break; + } + case 18: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class GetTodos : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetTodos()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[68]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodos() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodos(GetTodos other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodos Clone() { + return new GetTodos(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetTodos); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetTodos other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetTodos other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class GetTodosResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetTodosResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[69]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodosResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodosResponse(GetTodosResponse other) : this() { + results_ = other.results_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetTodosResponse Clone() { + return new GetTodosResponse(this); + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(10, global::ServiceStack.Extensions.Tests.Protoc.Todo.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetTodosResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetTodosResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!results_.Equals(other.results_)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= results_.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + results_.WriteTo(output, _repeated_results_codec); + if (responseStatus_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += results_.CalculateSize(_repeated_results_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetTodosResponse other) { + if (other == null) { + return; + } + results_.Add(other.results_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 18: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class HelloJwt : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HelloJwt()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[70]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HelloJwt() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HelloJwt(HelloJwt other) : this() { + name_ = other.name_; + bearerToken_ = other.bearerToken_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HelloJwt Clone() { + return new HelloJwt(this); + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "BearerToken" field. + public const int BearerTokenFieldNumber = 2; + private string bearerToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BearerToken { + get { return bearerToken_; } + set { + bearerToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as HelloJwt); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(HelloJwt other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (BearerToken != other.BearerToken) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (BearerToken.Length != 0) hash ^= BearerToken.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (BearerToken.Length != 0) { + output.WriteRawTag(18); + output.WriteString(BearerToken); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (BearerToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BearerToken); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(HelloJwt other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.BearerToken.Length != 0) { + BearerToken = other.BearerToken; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + BearerToken = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class HelloJwtResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HelloJwtResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[71]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HelloJwtResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HelloJwtResponse(HelloJwtResponse other) : this() { + result_ = other.result_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HelloJwtResponse Clone() { + return new HelloJwtResponse(this); + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 1; + private string result_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Result { + get { return result_; } + set { + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as HelloJwtResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(HelloJwtResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Result != other.Result) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Result.Length != 0) hash ^= Result.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Result.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Result); + } + if (responseStatus_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Result.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Result); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(HelloJwtResponse other) { + if (other == null) { + return; + } + if (other.Result.Length != 0) { + Result = other.Result; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Result = input.ReadString(); + break; + } + case 18: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class HelloResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HelloResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[72]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HelloResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HelloResponse(HelloResponse other) : this() { + result_ = other.result_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HelloResponse Clone() { + return new HelloResponse(this); + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 1; + private string result_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Result { + get { return result_; } + set { + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as HelloResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(HelloResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Result != other.Result) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Result.Length != 0) hash ^= Result.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Result.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Result); + } + if (responseStatus_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Result.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Result); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(HelloResponse other) { + if (other == null) { + return; + } + if (other.Result.Length != 0) { + Result = other.Result; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Result = input.ReadString(); + break; + } + case 18: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class Incr : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Incr()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[73]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Incr() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Incr(Incr other) : this() { + amount_ = other.amount_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Incr Clone() { + return new Incr(this); + } + + /// Field number for the "Amount" field. + public const int AmountFieldNumber = 1; + private int amount_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Amount { + get { return amount_; } + set { + amount_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Incr); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Incr other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Amount != other.Amount) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Amount != 0) hash ^= Amount.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Amount != 0) { + output.WriteRawTag(8); + output.WriteInt32(Amount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Amount != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Amount); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Incr other) { + if (other == null) { + return; + } + if (other.Amount != 0) { + Amount = other.Amount; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Amount = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class Movie : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Movie()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[74]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Movie() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Movie(Movie other) : this() { + id_ = other.id_; + imdbId_ = other.imdbId_; + title_ = other.title_; + rating_ = other.rating_; + score_ = other.score_; + director_ = other.director_; + releaseDate_ = other.releaseDate_ != null ? other.releaseDate_.Clone() : null; + tagLine_ = other.tagLine_; + genres_ = other.genres_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Movie Clone() { + return new Movie(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "ImdbId" field. + public const int ImdbIdFieldNumber = 2; + private string imdbId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ImdbId { + get { return imdbId_; } + set { + imdbId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Title" field. + public const int TitleFieldNumber = 3; + private string title_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Title { + get { return title_; } + set { + title_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Rating" field. + public const int RatingFieldNumber = 4; + private string rating_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Rating { + get { return rating_; } + set { + rating_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Score" field. + public const int ScoreFieldNumber = 5; + private string score_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Score { + get { return score_; } + set { + score_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Director" field. + public const int DirectorFieldNumber = 6; + private string director_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Director { + get { return director_; } + set { + director_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ReleaseDate" field. + public const int ReleaseDateFieldNumber = 7; + private global::Google.Protobuf.WellKnownTypes.Timestamp releaseDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp ReleaseDate { + get { return releaseDate_; } + set { + releaseDate_ = value; + } + } + + /// Field number for the "TagLine" field. + public const int TagLineFieldNumber = 8; + private string tagLine_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string TagLine { + get { return tagLine_; } + set { + tagLine_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Genres" field. + public const int GenresFieldNumber = 9; + private static readonly pb::FieldCodec _repeated_genres_codec + = pb::FieldCodec.ForString(74); + private readonly pbc::RepeatedField genres_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Genres { + get { return genres_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Movie); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Movie other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (ImdbId != other.ImdbId) return false; + if (Title != other.Title) return false; + if (Rating != other.Rating) return false; + if (Score != other.Score) return false; + if (Director != other.Director) return false; + if (!object.Equals(ReleaseDate, other.ReleaseDate)) return false; + if (TagLine != other.TagLine) return false; + if(!genres_.Equals(other.genres_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (ImdbId.Length != 0) hash ^= ImdbId.GetHashCode(); + if (Title.Length != 0) hash ^= Title.GetHashCode(); + if (Rating.Length != 0) hash ^= Rating.GetHashCode(); + if (Score.Length != 0) hash ^= Score.GetHashCode(); + if (Director.Length != 0) hash ^= Director.GetHashCode(); + if (releaseDate_ != null) hash ^= ReleaseDate.GetHashCode(); + if (TagLine.Length != 0) hash ^= TagLine.GetHashCode(); + hash ^= genres_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (ImdbId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ImdbId); + } + if (Title.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Title); + } + if (Rating.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Rating); + } + if (Score.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Score); + } + if (Director.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Director); + } + if (releaseDate_ != null) { + output.WriteRawTag(58); + output.WriteMessage(ReleaseDate); + } + if (TagLine.Length != 0) { + output.WriteRawTag(66); + output.WriteString(TagLine); + } + genres_.WriteTo(output, _repeated_genres_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (ImdbId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ImdbId); + } + if (Title.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Title); + } + if (Rating.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Rating); + } + if (Score.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Score); + } + if (Director.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Director); + } + if (releaseDate_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ReleaseDate); + } + if (TagLine.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(TagLine); + } + size += genres_.CalculateSize(_repeated_genres_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Movie other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.ImdbId.Length != 0) { + ImdbId = other.ImdbId; + } + if (other.Title.Length != 0) { + Title = other.Title; + } + if (other.Rating.Length != 0) { + Rating = other.Rating; + } + if (other.Score.Length != 0) { + Score = other.Score; + } + if (other.Director.Length != 0) { + Director = other.Director; + } + if (other.releaseDate_ != null) { + if (releaseDate_ == null) { + ReleaseDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + ReleaseDate.MergeFrom(other.ReleaseDate); + } + if (other.TagLine.Length != 0) { + TagLine = other.TagLine; + } + genres_.Add(other.genres_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + ImdbId = input.ReadString(); + break; + } + case 26: { + Title = input.ReadString(); + break; + } + case 34: { + Rating = input.ReadString(); + break; + } + case 42: { + Score = input.ReadString(); + break; + } + case 50: { + Director = input.ReadString(); + break; + } + case 58: { + if (releaseDate_ == null) { + ReleaseDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(ReleaseDate); + break; + } + case 66: { + TagLine = input.ReadString(); + break; + } + case 74: { + genres_.AddEntriesFrom(input, _repeated_genres_codec); + break; + } + } + } + } + + } + + public sealed partial class Multiply : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Multiply()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[75]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Multiply() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Multiply(Multiply other) : this() { + x_ = other.x_; + y_ = other.y_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Multiply Clone() { + return new Multiply(this); + } + + /// Field number for the "X" field. + public const int XFieldNumber = 1; + private int x_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int X { + get { return x_; } + set { + x_ = value; + } + } + + /// Field number for the "Y" field. + public const int YFieldNumber = 2; + private int y_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Y { + get { return y_; } + set { + y_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Multiply); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Multiply other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (X != other.X) return false; + if (Y != other.Y) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (X != 0) hash ^= X.GetHashCode(); + if (Y != 0) hash ^= Y.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (X != 0) { + output.WriteRawTag(8); + output.WriteInt32(X); + } + if (Y != 0) { + output.WriteRawTag(16); + output.WriteInt32(Y); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (X != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(X); + } + if (Y != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Y); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Multiply other) { + if (other == null) { + return; + } + if (other.X != 0) { + X = other.X; + } + if (other.Y != 0) { + Y = other.Y; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + X = input.ReadInt32(); + break; + } + case 16: { + Y = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class MultiplyResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MultiplyResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[76]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MultiplyResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MultiplyResponse(MultiplyResponse other) : this() { + result_ = other.result_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public MultiplyResponse Clone() { + return new MultiplyResponse(this); + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 1; + private int result_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Result { + get { return result_; } + set { + result_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as MultiplyResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(MultiplyResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Result != other.Result) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Result != 0) hash ^= Result.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Result != 0) { + output.WriteRawTag(8); + output.WriteInt32(Result); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Result != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Result); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(MultiplyResponse other) { + if (other == null) { + return; + } + if (other.Result != 0) { + Result = other.Result; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Result = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class NamedRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NamedRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[77]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NamedRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NamedRockstar(NamedRockstar other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NamedRockstar Clone() { + return new NamedRockstar(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as NamedRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(NamedRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(NamedRockstar other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class NoAbstractValidator : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NoAbstractValidator()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[78]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NoAbstractValidator() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NoAbstractValidator(NoAbstractValidator other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NoAbstractValidator Clone() { + return new NoAbstractValidator(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as NoAbstractValidator); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(NoAbstractValidator other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (LivingStatus != 0) { + output.WriteRawTag(40); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(NoAbstractValidator other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 40: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class OnlyValidatesRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OnlyValidatesRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[79]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OnlyValidatesRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OnlyValidatesRequest(OnlyValidatesRequest other) : this() { + test_ = other.test_; + notNull_ = other.notNull_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OnlyValidatesRequest Clone() { + return new OnlyValidatesRequest(this); + } + + /// Field number for the "Test" field. + public const int TestFieldNumber = 1; + private int test_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Test { + get { return test_; } + set { + test_ = value; + } + } + + /// Field number for the "NotNull" field. + public const int NotNullFieldNumber = 2; + private string notNull_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotNull { + get { return notNull_; } + set { + notNull_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as OnlyValidatesRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(OnlyValidatesRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Test != other.Test) return false; + if (NotNull != other.NotNull) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Test != 0) hash ^= Test.GetHashCode(); + if (NotNull.Length != 0) hash ^= NotNull.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Test != 0) { + output.WriteRawTag(8); + output.WriteInt32(Test); + } + if (NotNull.Length != 0) { + output.WriteRawTag(18); + output.WriteString(NotNull); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Test != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Test); + } + if (NotNull.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotNull); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(OnlyValidatesRequest other) { + if (other == null) { + return; + } + if (other.Test != 0) { + Test = other.Test; + } + if (other.NotNull.Length != 0) { + NotNull = other.NotNull; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Test = input.ReadInt32(); + break; + } + case 18: { + NotNull = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class PagingTest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PagingTest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[80]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PagingTest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PagingTest(PagingTest other) : this() { + id_ = other.id_; + name_ = other.name_; + value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PagingTest Clone() { + return new PagingTest(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 2; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Value" field. + public const int ValueFieldNumber = 3; + private int value_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PagingTest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PagingTest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Name != other.Name) return false; + if (Value != other.Value) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Value != 0) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (Name.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Name); + } + if (Value != 0) { + output.WriteRawTag(24); + output.WriteInt32(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Value != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Value); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PagingTest other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Value != 0) { + Value = other.Value; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + Name = input.ReadString(); + break; + } + case 24: { + Value = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[81]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse Clone() { + return new PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[82]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse Clone() { + return new PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class PatchRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PatchRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[83]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstar(PatchRockstar other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstar Clone() { + return new PatchRockstar(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 101; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PatchRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PatchRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (Id != 0) { + output.WriteRawTag(168, 6); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PatchRockstar other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 808: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class PatchRockstarAuditTenant : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PatchRockstarAuditTenant()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[84]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstarAuditTenant() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstarAuditTenant(PatchRockstarAuditTenant other) : this() { + bearerToken_ = other.bearerToken_; + id_ = other.id_; + firstName_ = other.firstName_; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstarAuditTenant Clone() { + return new PatchRockstarAuditTenant(this); + } + + /// Field number for the "BearerToken" field. + public const int BearerTokenFieldNumber = 201; + private string bearerToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BearerToken { + get { return bearerToken_; } + set { + bearerToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 202; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 203; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 204; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PatchRockstarAuditTenant); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PatchRockstarAuditTenant other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BearerToken != other.BearerToken) return false; + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BearerToken.Length != 0) hash ^= BearerToken.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (BearerToken.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(BearerToken); + } + if (Id != 0) { + output.WriteRawTag(208, 12); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(218, 12); + output.WriteString(FirstName); + } + if (LivingStatus != 0) { + output.WriteRawTag(224, 12); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BearerToken.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(BearerToken); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LivingStatus != 0) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PatchRockstarAuditTenant other) { + if (other == null) { + return; + } + if (other.BearerToken.Length != 0) { + BearerToken = other.BearerToken; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 1610: { + BearerToken = input.ReadString(); + break; + } + case 1616: { + Id = input.ReadInt32(); + break; + } + case 1626: { + FirstName = input.ReadString(); + break; + } + case 1632: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class PatchRockstarAuditTenantGateway : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PatchRockstarAuditTenantGateway()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[85]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstarAuditTenantGateway() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstarAuditTenantGateway(PatchRockstarAuditTenantGateway other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstarAuditTenantGateway Clone() { + return new PatchRockstarAuditTenantGateway(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PatchRockstarAuditTenantGateway); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PatchRockstarAuditTenantGateway other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LivingStatus != 0) { + output.WriteRawTag(24); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PatchRockstarAuditTenantGateway other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 24: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class PatchRockstarAuditTenantMq : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PatchRockstarAuditTenantMq()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[86]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstarAuditTenantMq() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstarAuditTenantMq(PatchRockstarAuditTenantMq other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PatchRockstarAuditTenantMq Clone() { + return new PatchRockstarAuditTenantMq(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PatchRockstarAuditTenantMq); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PatchRockstarAuditTenantMq other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LivingStatus != 0) { + output.WriteRawTag(24); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PatchRockstarAuditTenantMq other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 24: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class PostChatToChannel : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PostChatToChannel()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[87]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PostChatToChannel() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PostChatToChannel(PostChatToChannel other) : this() { + from_ = other.from_; + toUserId_ = other.toUserId_; + channel_ = other.channel_; + message_ = other.message_; + selector_ = other.selector_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PostChatToChannel Clone() { + return new PostChatToChannel(this); + } + + /// Field number for the "From" field. + public const int FromFieldNumber = 1; + private string from_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string From { + get { return from_; } + set { + from_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ToUserId" field. + public const int ToUserIdFieldNumber = 2; + private string toUserId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ToUserId { + get { return toUserId_; } + set { + toUserId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Channel" field. + public const int ChannelFieldNumber = 3; + private string channel_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Channel { + get { return channel_; } + set { + channel_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Message" field. + public const int MessageFieldNumber = 4; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Selector" field. + public const int SelectorFieldNumber = 5; + private string selector_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Selector { + get { return selector_; } + set { + selector_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PostChatToChannel); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PostChatToChannel other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (From != other.From) return false; + if (ToUserId != other.ToUserId) return false; + if (Channel != other.Channel) return false; + if (Message != other.Message) return false; + if (Selector != other.Selector) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (From.Length != 0) hash ^= From.GetHashCode(); + if (ToUserId.Length != 0) hash ^= ToUserId.GetHashCode(); + if (Channel.Length != 0) hash ^= Channel.GetHashCode(); + if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (Selector.Length != 0) hash ^= Selector.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (From.Length != 0) { + output.WriteRawTag(10); + output.WriteString(From); + } + if (ToUserId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ToUserId); + } + if (Channel.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Channel); + } + if (Message.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Message); + } + if (Selector.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Selector); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (From.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(From); + } + if (ToUserId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ToUserId); + } + if (Channel.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Channel); + } + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (Selector.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Selector); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PostChatToChannel other) { + if (other == null) { + return; + } + if (other.From.Length != 0) { + From = other.From; + } + if (other.ToUserId.Length != 0) { + ToUserId = other.ToUserId; + } + if (other.Channel.Length != 0) { + Channel = other.Channel; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + if (other.Selector.Length != 0) { + Selector = other.Selector; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + From = input.ReadString(); + break; + } + case 18: { + ToUserId = input.ReadString(); + break; + } + case 26: { + Channel = input.ReadString(); + break; + } + case 34: { + Message = input.ReadString(); + break; + } + case 42: { + Selector = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryAdhoc : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryAdhoc()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[88]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryAdhoc() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryAdhoc(QueryAdhoc other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryAdhoc Clone() { + return new QueryAdhoc(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryAdhoc); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryAdhoc other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryAdhoc other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryAdhocRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryAdhocRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[89]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryAdhocRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryAdhocRockstars(QueryAdhocRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + firstName_ = other.firstName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryAdhocRockstars Clone() { + return new QueryAdhocRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "first_name" field. + public const int FirstNameFieldNumber = 201; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryAdhocRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryAdhocRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (FirstName != other.FirstName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (FirstName.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(FirstName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (FirstName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryAdhocRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + FirstName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryAllFields : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryAllFields()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[90]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryAllFields() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryAllFields(QueryAllFields other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + guid_ = other.guid_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryAllFields Clone() { + return new QueryAllFields(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Guid" field. + public const int GuidFieldNumber = 201; + private string guid_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Guid { + get { return guid_; } + set { + guid_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryAllFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryAllFields other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Guid != other.Guid) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Guid.Length != 0) hash ^= Guid.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Guid.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(Guid); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Guid.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(Guid); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryAllFields other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Guid.Length != 0) { + Guid = other.Guid; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + Guid = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryBookmarks : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryBookmarks()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[91]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryBookmarks() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryBookmarks(QueryBookmarks other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryBookmarks Clone() { + return new QueryBookmarks(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryBookmarks); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryBookmarks other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryBookmarks other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryCaseInsensitiveOrderBy : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryCaseInsensitiveOrderBy()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[92]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCaseInsensitiveOrderBy() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCaseInsensitiveOrderBy(QueryCaseInsensitiveOrderBy other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCaseInsensitiveOrderBy Clone() { + return new QueryCaseInsensitiveOrderBy(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryCaseInsensitiveOrderBy); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryCaseInsensitiveOrderBy other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryCaseInsensitiveOrderBy other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryChangeConnectionInfo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryChangeConnectionInfo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[93]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryChangeConnectionInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryChangeConnectionInfo(QueryChangeConnectionInfo other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryChangeConnectionInfo Clone() { + return new QueryChangeConnectionInfo(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryChangeConnectionInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryChangeConnectionInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryChangeConnectionInfo other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryChangeDb : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryChangeDb()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[94]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryChangeDb() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryChangeDb(QueryChangeDb other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + namedConnection_ = other.namedConnection_; + connectionString_ = other.connectionString_; + providerName_ = other.providerName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryChangeDb Clone() { + return new QueryChangeDb(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "NamedConnection" field. + public const int NamedConnectionFieldNumber = 201; + private string namedConnection_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NamedConnection { + get { return namedConnection_; } + set { + namedConnection_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ConnectionString" field. + public const int ConnectionStringFieldNumber = 202; + private string connectionString_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ConnectionString { + get { return connectionString_; } + set { + connectionString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ProviderName" field. + public const int ProviderNameFieldNumber = 203; + private string providerName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ProviderName { + get { return providerName_; } + set { + providerName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryChangeDb); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryChangeDb other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (NamedConnection != other.NamedConnection) return false; + if (ConnectionString != other.ConnectionString) return false; + if (ProviderName != other.ProviderName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (NamedConnection.Length != 0) hash ^= NamedConnection.GetHashCode(); + if (ConnectionString.Length != 0) hash ^= ConnectionString.GetHashCode(); + if (ProviderName.Length != 0) hash ^= ProviderName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (NamedConnection.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(NamedConnection); + } + if (ConnectionString.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(ConnectionString); + } + if (ProviderName.Length != 0) { + output.WriteRawTag(218, 12); + output.WriteString(ProviderName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (NamedConnection.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(NamedConnection); + } + if (ConnectionString.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(ConnectionString); + } + if (ProviderName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(ProviderName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryChangeDb other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.NamedConnection.Length != 0) { + NamedConnection = other.NamedConnection; + } + if (other.ConnectionString.Length != 0) { + ConnectionString = other.ConnectionString; + } + if (other.ProviderName.Length != 0) { + ProviderName = other.ProviderName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + NamedConnection = input.ReadString(); + break; + } + case 1618: { + ConnectionString = input.ReadString(); + break; + } + case 1626: { + ProviderName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryCustomRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryCustomRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[95]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstars(QueryCustomRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstars Clone() { + return new QueryCustomRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryCustomRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryCustomRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryCustomRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryCustomRockstarsFilter : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryCustomRockstarsFilter()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[96]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstarsFilter() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstarsFilter(QueryCustomRockstarsFilter other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstarsFilter Clone() { + return new QueryCustomRockstarsFilter(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryCustomRockstarsFilter); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryCustomRockstarsFilter other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryCustomRockstarsFilter other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryCustomRockstarsReferences : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryCustomRockstarsReferences()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[97]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstarsReferences() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstarsReferences(QueryCustomRockstarsReferences other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstarsReferences Clone() { + return new QueryCustomRockstarsReferences(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryCustomRockstarsReferences); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryCustomRockstarsReferences other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryCustomRockstarsReferences other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryCustomRockstarsSchema : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryCustomRockstarsSchema()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[98]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstarsSchema() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstarsSchema(QueryCustomRockstarsSchema other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryCustomRockstarsSchema Clone() { + return new QueryCustomRockstarsSchema(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryCustomRockstarsSchema); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryCustomRockstarsSchema other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryCustomRockstarsSchema other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryDbTenant_RockstarAuditTenant_RockstarAuto : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryDbTenant_RockstarAuditTenant_RockstarAuto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[99]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryDbTenant_RockstarAuditTenant_RockstarAuto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryDbTenant_RockstarAuditTenant_RockstarAuto(QueryDbTenant_RockstarAuditTenant_RockstarAuto other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryDbTenant_RockstarAuditTenant_RockstarAuto Clone() { + return new QueryDbTenant_RockstarAuditTenant_RockstarAuto(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryDbTenant_RockstarAuditTenant_RockstarAuto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryDbTenant_RockstarAuditTenant_RockstarAuto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryDbTenant_RockstarAuditTenant_RockstarAuto other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class QueryFieldRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryFieldRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[100]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFieldRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFieldRockstars(QueryFieldRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + firstName_ = other.firstName_; + firstNames_ = other.firstNames_.Clone(); + age_ = other.age_; + firstNameCaseInsensitive_ = other.firstNameCaseInsensitive_; + firstNameStartsWith_ = other.firstNameStartsWith_; + lastNameEndsWith_ = other.lastNameEndsWith_; + firstNameBetween_ = other.firstNameBetween_.Clone(); + orLastName_ = other.orLastName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFieldRockstars Clone() { + return new QueryFieldRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 201; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "FirstNames" field. + public const int FirstNamesFieldNumber = 202; + private static readonly pb::FieldCodec _repeated_firstNames_codec + = pb::FieldCodec.ForString(1618); + private readonly pbc::RepeatedField firstNames_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField FirstNames { + get { return firstNames_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 203; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "FirstNameCaseInsensitive" field. + public const int FirstNameCaseInsensitiveFieldNumber = 204; + private string firstNameCaseInsensitive_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstNameCaseInsensitive { + get { return firstNameCaseInsensitive_; } + set { + firstNameCaseInsensitive_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "FirstNameStartsWith" field. + public const int FirstNameStartsWithFieldNumber = 205; + private string firstNameStartsWith_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstNameStartsWith { + get { return firstNameStartsWith_; } + set { + firstNameStartsWith_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastNameEndsWith" field. + public const int LastNameEndsWithFieldNumber = 206; + private string lastNameEndsWith_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastNameEndsWith { + get { return lastNameEndsWith_; } + set { + lastNameEndsWith_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "FirstNameBetween" field. + public const int FirstNameBetweenFieldNumber = 207; + private static readonly pb::FieldCodec _repeated_firstNameBetween_codec + = pb::FieldCodec.ForString(1658); + private readonly pbc::RepeatedField firstNameBetween_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField FirstNameBetween { + get { return firstNameBetween_; } + } + + /// Field number for the "OrLastName" field. + public const int OrLastNameFieldNumber = 208; + private string orLastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrLastName { + get { return orLastName_; } + set { + orLastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryFieldRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryFieldRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (FirstName != other.FirstName) return false; + if(!firstNames_.Equals(other.firstNames_)) return false; + if (Age != other.Age) return false; + if (FirstNameCaseInsensitive != other.FirstNameCaseInsensitive) return false; + if (FirstNameStartsWith != other.FirstNameStartsWith) return false; + if (LastNameEndsWith != other.LastNameEndsWith) return false; + if(!firstNameBetween_.Equals(other.firstNameBetween_)) return false; + if (OrLastName != other.OrLastName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + hash ^= firstNames_.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (FirstNameCaseInsensitive.Length != 0) hash ^= FirstNameCaseInsensitive.GetHashCode(); + if (FirstNameStartsWith.Length != 0) hash ^= FirstNameStartsWith.GetHashCode(); + if (LastNameEndsWith.Length != 0) hash ^= LastNameEndsWith.GetHashCode(); + hash ^= firstNameBetween_.GetHashCode(); + if (OrLastName.Length != 0) hash ^= OrLastName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (FirstName.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(FirstName); + } + firstNames_.WriteTo(output, _repeated_firstNames_codec); + if (Age != 0) { + output.WriteRawTag(216, 12); + output.WriteInt32(Age); + } + if (FirstNameCaseInsensitive.Length != 0) { + output.WriteRawTag(226, 12); + output.WriteString(FirstNameCaseInsensitive); + } + if (FirstNameStartsWith.Length != 0) { + output.WriteRawTag(234, 12); + output.WriteString(FirstNameStartsWith); + } + if (LastNameEndsWith.Length != 0) { + output.WriteRawTag(242, 12); + output.WriteString(LastNameEndsWith); + } + firstNameBetween_.WriteTo(output, _repeated_firstNameBetween_codec); + if (OrLastName.Length != 0) { + output.WriteRawTag(130, 13); + output.WriteString(OrLastName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (FirstName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + size += firstNames_.CalculateSize(_repeated_firstNames_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (FirstNameCaseInsensitive.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstNameCaseInsensitive); + } + if (FirstNameStartsWith.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstNameStartsWith); + } + if (LastNameEndsWith.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(LastNameEndsWith); + } + size += firstNameBetween_.CalculateSize(_repeated_firstNameBetween_codec); + if (OrLastName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(OrLastName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryFieldRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + firstNames_.Add(other.firstNames_); + if (other.Age != 0) { + Age = other.Age; + } + if (other.FirstNameCaseInsensitive.Length != 0) { + FirstNameCaseInsensitive = other.FirstNameCaseInsensitive; + } + if (other.FirstNameStartsWith.Length != 0) { + FirstNameStartsWith = other.FirstNameStartsWith; + } + if (other.LastNameEndsWith.Length != 0) { + LastNameEndsWith = other.LastNameEndsWith; + } + firstNameBetween_.Add(other.firstNameBetween_); + if (other.OrLastName.Length != 0) { + OrLastName = other.OrLastName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + FirstName = input.ReadString(); + break; + } + case 1618: { + firstNames_.AddEntriesFrom(input, _repeated_firstNames_codec); + break; + } + case 1624: { + Age = input.ReadInt32(); + break; + } + case 1634: { + FirstNameCaseInsensitive = input.ReadString(); + break; + } + case 1642: { + FirstNameStartsWith = input.ReadString(); + break; + } + case 1650: { + LastNameEndsWith = input.ReadString(); + break; + } + case 1658: { + firstNameBetween_.AddEntriesFrom(input, _repeated_firstNameBetween_codec); + break; + } + case 1666: { + OrLastName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryFieldRockstarsDynamic : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryFieldRockstarsDynamic()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[101]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFieldRockstarsDynamic() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFieldRockstarsDynamic(QueryFieldRockstarsDynamic other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFieldRockstarsDynamic Clone() { + return new QueryFieldRockstarsDynamic(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryFieldRockstarsDynamic); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryFieldRockstarsDynamic other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryFieldRockstarsDynamic other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryFieldsImplicitConventions : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryFieldsImplicitConventions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[102]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFieldsImplicitConventions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFieldsImplicitConventions(QueryFieldsImplicitConventions other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + firstNameContains_ = other.firstNameContains_; + lastNameEndsWith_ = other.lastNameEndsWith_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFieldsImplicitConventions Clone() { + return new QueryFieldsImplicitConventions(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "FirstNameContains" field. + public const int FirstNameContainsFieldNumber = 201; + private string firstNameContains_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstNameContains { + get { return firstNameContains_; } + set { + firstNameContains_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastNameEndsWith" field. + public const int LastNameEndsWithFieldNumber = 202; + private string lastNameEndsWith_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastNameEndsWith { + get { return lastNameEndsWith_; } + set { + lastNameEndsWith_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryFieldsImplicitConventions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryFieldsImplicitConventions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (FirstNameContains != other.FirstNameContains) return false; + if (LastNameEndsWith != other.LastNameEndsWith) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (FirstNameContains.Length != 0) hash ^= FirstNameContains.GetHashCode(); + if (LastNameEndsWith.Length != 0) hash ^= LastNameEndsWith.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (FirstNameContains.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(FirstNameContains); + } + if (LastNameEndsWith.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(LastNameEndsWith); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (FirstNameContains.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstNameContains); + } + if (LastNameEndsWith.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(LastNameEndsWith); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryFieldsImplicitConventions other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.FirstNameContains.Length != 0) { + FirstNameContains = other.FirstNameContains; + } + if (other.LastNameEndsWith.Length != 0) { + LastNameEndsWith = other.LastNameEndsWith; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + FirstNameContains = input.ReadString(); + break; + } + case 1618: { + LastNameEndsWith = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryFoos : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryFoos()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[103]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFoos() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFoos(QueryFoos other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + x_ = other.x_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryFoos Clone() { + return new QueryFoos(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "X" field. + public const int XFieldNumber = 201; + private string x_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string X { + get { return x_; } + set { + x_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryFoos); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryFoos other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (X != other.X) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (X.Length != 0) hash ^= X.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (X.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(X); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (X.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(X); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryFoos other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.X.Length != 0) { + X = other.X; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + X = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryGetRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryGetRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[104]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryGetRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryGetRockstars(QueryGetRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + ids_ = other.ids_.Clone(); + ages_ = other.ages_.Clone(); + firstNames_ = other.firstNames_.Clone(); + idsBetween_ = other.idsBetween_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryGetRockstars Clone() { + return new QueryGetRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Ids" field. + public const int IdsFieldNumber = 201; + private static readonly pb::FieldCodec _repeated_ids_codec + = pb::FieldCodec.ForInt32(1608); + private readonly pbc::RepeatedField ids_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ids { + get { return ids_; } + } + + /// Field number for the "Ages" field. + public const int AgesFieldNumber = 202; + private static readonly pb::FieldCodec _repeated_ages_codec + = pb::FieldCodec.ForInt32(1616); + private readonly pbc::RepeatedField ages_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ages { + get { return ages_; } + } + + /// Field number for the "FirstNames" field. + public const int FirstNamesFieldNumber = 203; + private static readonly pb::FieldCodec _repeated_firstNames_codec + = pb::FieldCodec.ForString(1626); + private readonly pbc::RepeatedField firstNames_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField FirstNames { + get { return firstNames_; } + } + + /// Field number for the "IdsBetween" field. + public const int IdsBetweenFieldNumber = 204; + private static readonly pb::FieldCodec _repeated_idsBetween_codec + = pb::FieldCodec.ForInt32(1632); + private readonly pbc::RepeatedField idsBetween_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField IdsBetween { + get { return idsBetween_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryGetRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryGetRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if(!ids_.Equals(other.ids_)) return false; + if(!ages_.Equals(other.ages_)) return false; + if(!firstNames_.Equals(other.firstNames_)) return false; + if(!idsBetween_.Equals(other.idsBetween_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + hash ^= ids_.GetHashCode(); + hash ^= ages_.GetHashCode(); + hash ^= firstNames_.GetHashCode(); + hash ^= idsBetween_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + ids_.WriteTo(output, _repeated_ids_codec); + ages_.WriteTo(output, _repeated_ages_codec); + firstNames_.WriteTo(output, _repeated_firstNames_codec); + idsBetween_.WriteTo(output, _repeated_idsBetween_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + size += ids_.CalculateSize(_repeated_ids_codec); + size += ages_.CalculateSize(_repeated_ages_codec); + size += firstNames_.CalculateSize(_repeated_firstNames_codec); + size += idsBetween_.CalculateSize(_repeated_idsBetween_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryGetRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + ids_.Add(other.ids_); + ages_.Add(other.ages_); + firstNames_.Add(other.firstNames_); + idsBetween_.Add(other.idsBetween_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: + case 1608: { + ids_.AddEntriesFrom(input, _repeated_ids_codec); + break; + } + case 1618: + case 1616: { + ages_.AddEntriesFrom(input, _repeated_ages_codec); + break; + } + case 1626: { + firstNames_.AddEntriesFrom(input, _repeated_firstNames_codec); + break; + } + case 1634: + case 1632: { + idsBetween_.AddEntriesFrom(input, _repeated_idsBetween_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryGetRockstarsDynamic : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryGetRockstarsDynamic()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[105]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryGetRockstarsDynamic() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryGetRockstarsDynamic(QueryGetRockstarsDynamic other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryGetRockstarsDynamic Clone() { + return new QueryGetRockstarsDynamic(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryGetRockstarsDynamic); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryGetRockstarsDynamic other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryGetRockstarsDynamic other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryJoinedRockstarAlbums : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryJoinedRockstarAlbums()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[106]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryJoinedRockstarAlbums() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryJoinedRockstarAlbums(QueryJoinedRockstarAlbums other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + rockstarAlbumName_ = other.rockstarAlbumName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryJoinedRockstarAlbums Clone() { + return new QueryJoinedRockstarAlbums(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "RockstarAlbumName" field. + public const int RockstarAlbumNameFieldNumber = 202; + private string rockstarAlbumName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarAlbumName { + get { return rockstarAlbumName_; } + set { + rockstarAlbumName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryJoinedRockstarAlbums); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryJoinedRockstarAlbums other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + if (RockstarAlbumName != other.RockstarAlbumName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (RockstarAlbumName.Length != 0) hash ^= RockstarAlbumName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (RockstarAlbumName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(RockstarAlbumName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (RockstarAlbumName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(RockstarAlbumName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryJoinedRockstarAlbums other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + if (other.RockstarAlbumName.Length != 0) { + RockstarAlbumName = other.RockstarAlbumName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + case 1618: { + RockstarAlbumName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryJoinedRockstarAlbumsCustomSelect : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryJoinedRockstarAlbumsCustomSelect()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[107]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryJoinedRockstarAlbumsCustomSelect() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryJoinedRockstarAlbumsCustomSelect(QueryJoinedRockstarAlbumsCustomSelect other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + rockstarAlbumName_ = other.rockstarAlbumName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryJoinedRockstarAlbumsCustomSelect Clone() { + return new QueryJoinedRockstarAlbumsCustomSelect(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "RockstarAlbumName" field. + public const int RockstarAlbumNameFieldNumber = 202; + private string rockstarAlbumName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarAlbumName { + get { return rockstarAlbumName_; } + set { + rockstarAlbumName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryJoinedRockstarAlbumsCustomSelect); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryJoinedRockstarAlbumsCustomSelect other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + if (RockstarAlbumName != other.RockstarAlbumName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (RockstarAlbumName.Length != 0) hash ^= RockstarAlbumName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (RockstarAlbumName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(RockstarAlbumName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (RockstarAlbumName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(RockstarAlbumName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryJoinedRockstarAlbumsCustomSelect other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + if (other.RockstarAlbumName.Length != 0) { + RockstarAlbumName = other.RockstarAlbumName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + case 1618: { + RockstarAlbumName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryJoinedRockstarAlbumsCustomSelectResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryJoinedRockstarAlbumsCustomSelectResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[108]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryJoinedRockstarAlbumsCustomSelectResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryJoinedRockstarAlbumsCustomSelectResponse(QueryJoinedRockstarAlbumsCustomSelectResponse other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + rockstarAlbumName_ = other.rockstarAlbumName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryJoinedRockstarAlbumsCustomSelectResponse Clone() { + return new QueryJoinedRockstarAlbumsCustomSelectResponse(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "RockstarAlbumName" field. + public const int RockstarAlbumNameFieldNumber = 202; + private string rockstarAlbumName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarAlbumName { + get { return rockstarAlbumName_; } + set { + rockstarAlbumName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryJoinedRockstarAlbumsCustomSelectResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryJoinedRockstarAlbumsCustomSelectResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + if (RockstarAlbumName != other.RockstarAlbumName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (RockstarAlbumName.Length != 0) hash ^= RockstarAlbumName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (RockstarAlbumName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(RockstarAlbumName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (RockstarAlbumName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(RockstarAlbumName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryJoinedRockstarAlbumsCustomSelectResponse other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + if (other.RockstarAlbumName.Length != 0) { + RockstarAlbumName = other.RockstarAlbumName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + case 1618: { + RockstarAlbumName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryMovies : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryMovies()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[109]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryMovies() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryMovies(QueryMovies other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + ids_ = other.ids_.Clone(); + imdbIds_ = other.imdbIds_.Clone(); + ratings_ = other.ratings_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryMovies Clone() { + return new QueryMovies(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Ids" field. + public const int IdsFieldNumber = 201; + private static readonly pb::FieldCodec _repeated_ids_codec + = pb::FieldCodec.ForInt32(1608); + private readonly pbc::RepeatedField ids_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ids { + get { return ids_; } + } + + /// Field number for the "ImdbIds" field. + public const int ImdbIdsFieldNumber = 202; + private static readonly pb::FieldCodec _repeated_imdbIds_codec + = pb::FieldCodec.ForString(1618); + private readonly pbc::RepeatedField imdbIds_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField ImdbIds { + get { return imdbIds_; } + } + + /// Field number for the "Ratings" field. + public const int RatingsFieldNumber = 203; + private static readonly pb::FieldCodec _repeated_ratings_codec + = pb::FieldCodec.ForString(1626); + private readonly pbc::RepeatedField ratings_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ratings { + get { return ratings_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryMovies); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryMovies other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if(!ids_.Equals(other.ids_)) return false; + if(!imdbIds_.Equals(other.imdbIds_)) return false; + if(!ratings_.Equals(other.ratings_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + hash ^= ids_.GetHashCode(); + hash ^= imdbIds_.GetHashCode(); + hash ^= ratings_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + ids_.WriteTo(output, _repeated_ids_codec); + imdbIds_.WriteTo(output, _repeated_imdbIds_codec); + ratings_.WriteTo(output, _repeated_ratings_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + size += ids_.CalculateSize(_repeated_ids_codec); + size += imdbIds_.CalculateSize(_repeated_imdbIds_codec); + size += ratings_.CalculateSize(_repeated_ratings_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryMovies other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + ids_.Add(other.ids_); + imdbIds_.Add(other.imdbIds_); + ratings_.Add(other.ratings_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: + case 1608: { + ids_.AddEntriesFrom(input, _repeated_ids_codec); + break; + } + case 1618: { + imdbIds_.AddEntriesFrom(input, _repeated_imdbIds_codec); + break; + } + case 1626: { + ratings_.AddEntriesFrom(input, _repeated_ratings_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryMultiJoinRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryMultiJoinRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[110]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryMultiJoinRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryMultiJoinRockstar(QueryMultiJoinRockstar other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + rockstarAlbumName_ = other.rockstarAlbumName_; + rockstarGenreName_ = other.rockstarGenreName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryMultiJoinRockstar Clone() { + return new QueryMultiJoinRockstar(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "RockstarAlbumName" field. + public const int RockstarAlbumNameFieldNumber = 202; + private string rockstarAlbumName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarAlbumName { + get { return rockstarAlbumName_; } + set { + rockstarAlbumName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RockstarGenreName" field. + public const int RockstarGenreNameFieldNumber = 203; + private string rockstarGenreName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarGenreName { + get { return rockstarGenreName_; } + set { + rockstarGenreName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryMultiJoinRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryMultiJoinRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + if (RockstarAlbumName != other.RockstarAlbumName) return false; + if (RockstarGenreName != other.RockstarGenreName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (RockstarAlbumName.Length != 0) hash ^= RockstarAlbumName.GetHashCode(); + if (RockstarGenreName.Length != 0) hash ^= RockstarGenreName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (RockstarAlbumName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(RockstarAlbumName); + } + if (RockstarGenreName.Length != 0) { + output.WriteRawTag(218, 12); + output.WriteString(RockstarGenreName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (RockstarAlbumName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(RockstarAlbumName); + } + if (RockstarGenreName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(RockstarGenreName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryMultiJoinRockstar other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + if (other.RockstarAlbumName.Length != 0) { + RockstarAlbumName = other.RockstarAlbumName; + } + if (other.RockstarGenreName.Length != 0) { + RockstarGenreName = other.RockstarGenreName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + case 1618: { + RockstarAlbumName = input.ReadString(); + break; + } + case 1626: { + RockstarGenreName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryNamedRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryNamedRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[111]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryNamedRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryNamedRockstars(QueryNamedRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryNamedRockstars Clone() { + return new QueryNamedRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryNamedRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryNamedRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryNamedRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryOrRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryOrRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[112]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOrRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOrRockstars(QueryOrRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + firstName_ = other.firstName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOrRockstars Clone() { + return new QueryOrRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 202; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryOrRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryOrRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + if (FirstName != other.FirstName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (FirstName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(FirstName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (FirstName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryOrRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + case 1618: { + FirstName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryOrRockstarsFields : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryOrRockstarsFields()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[113]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOrRockstarsFields() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOrRockstarsFields(QueryOrRockstarsFields other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + firstName_ = other.firstName_; + lastName_ = other.lastName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOrRockstarsFields Clone() { + return new QueryOrRockstarsFields(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 201; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 202; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryOrRockstarsFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryOrRockstarsFields other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (FirstName.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(LastName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (FirstName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryOrRockstarsFields other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + FirstName = input.ReadString(); + break; + } + case 1618: { + LastName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryOverridedCustomRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryOverridedCustomRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[114]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOverridedCustomRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOverridedCustomRockstars(QueryOverridedCustomRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOverridedCustomRockstars Clone() { + return new QueryOverridedCustomRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryOverridedCustomRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryOverridedCustomRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryOverridedCustomRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryOverridedRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryOverridedRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[115]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOverridedRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOverridedRockstars(QueryOverridedRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryOverridedRockstars Clone() { + return new QueryOverridedRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryOverridedRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryOverridedRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryOverridedRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryPagingTest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryPagingTest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[116]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryPagingTest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryPagingTest(QueryPagingTest other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + id_ = other.id_; + name_ = other.name_; + value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryPagingTest Clone() { + return new QueryPagingTest(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 201; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 202; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Value" field. + public const int ValueFieldNumber = 203; + private int value_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryPagingTest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryPagingTest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Id != other.Id) return false; + if (Name != other.Name) return false; + if (Value != other.Value) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Value != 0) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Id != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Id); + } + if (Name.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(Name); + } + if (Value != 0) { + output.WriteRawTag(216, 12); + output.WriteInt32(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (Name.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Value != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Value); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryPagingTest other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Id != 0) { + Id = other.Id; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Value != 0) { + Value = other.Value; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Id = input.ReadInt32(); + break; + } + case 1618: { + Name = input.ReadString(); + break; + } + case 1624: { + Value = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_Adhoc : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_Adhoc()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[117]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Adhoc() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Adhoc(QueryResponse_Adhoc other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Adhoc Clone() { + return new QueryResponse_Adhoc(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.Adhoc.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_Adhoc); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_Adhoc other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_Adhoc other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_AllFields : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_AllFields()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[118]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_AllFields() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_AllFields(QueryResponse_AllFields other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_AllFields Clone() { + return new QueryResponse_AllFields(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.AllFields.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_AllFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_AllFields other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_AllFields other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_Bookmark : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_Bookmark()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[119]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Bookmark() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Bookmark(QueryResponse_Bookmark other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Bookmark Clone() { + return new QueryResponse_Bookmark(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.DaoBase.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_Bookmark); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_Bookmark other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_Bookmark other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_CustomRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_CustomRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[120]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomRockstar(QueryResponse_CustomRockstar other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomRockstar Clone() { + return new QueryResponse_CustomRockstar(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.CustomRockstar.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_CustomRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_CustomRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_CustomRockstar other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_CustomRockstarSchema : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_CustomRockstarSchema()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[121]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomRockstarSchema() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomRockstarSchema(QueryResponse_CustomRockstarSchema other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomRockstarSchema Clone() { + return new QueryResponse_CustomRockstarSchema(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.CustomRockstarSchema.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_CustomRockstarSchema); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_CustomRockstarSchema other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_CustomRockstarSchema other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_CustomSelectRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_CustomSelectRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[122]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomSelectRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomSelectRockstar(QueryResponse_CustomSelectRockstar other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomSelectRockstar Clone() { + return new QueryResponse_CustomSelectRockstar(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.CustomSelectRockstar.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_CustomSelectRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_CustomSelectRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_CustomSelectRockstar other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_CustomSelectRockstarResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_CustomSelectRockstarResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[123]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomSelectRockstarResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomSelectRockstarResponse(QueryResponse_CustomSelectRockstarResponse other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_CustomSelectRockstarResponse Clone() { + return new QueryResponse_CustomSelectRockstarResponse(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.CustomSelectRockstarResponse.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_CustomSelectRockstarResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_CustomSelectRockstarResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_CustomSelectRockstarResponse other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_Foo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_Foo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[124]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Foo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Foo(QueryResponse_Foo other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Foo Clone() { + return new QueryResponse_Foo(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.Foo.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_Foo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_Foo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_Foo other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_Movie : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_Movie()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[125]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Movie() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Movie(QueryResponse_Movie other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Movie Clone() { + return new QueryResponse_Movie(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.Movie.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_Movie); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_Movie other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_Movie other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_NamedRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_NamedRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[126]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_NamedRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_NamedRockstar(QueryResponse_NamedRockstar other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_NamedRockstar Clone() { + return new QueryResponse_NamedRockstar(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.Rockstar.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_NamedRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_NamedRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_NamedRockstar other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_PagingTest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_PagingTest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[127]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_PagingTest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_PagingTest(QueryResponse_PagingTest other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_PagingTest Clone() { + return new QueryResponse_PagingTest(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.PagingTest.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_PagingTest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_PagingTest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_PagingTest other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_Rockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_Rockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[128]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Rockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Rockstar(QueryResponse_Rockstar other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_Rockstar Clone() { + return new QueryResponse_Rockstar(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.Rockstar.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_Rockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_Rockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_Rockstar other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_RockstarAlbum : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_RockstarAlbum()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[129]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarAlbum() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarAlbum(QueryResponse_RockstarAlbum other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarAlbum Clone() { + return new QueryResponse_RockstarAlbum(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.RockstarAlbum.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_RockstarAlbum); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_RockstarAlbum other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_RockstarAlbum other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_RockstarAlias : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_RockstarAlias()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[130]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarAlias() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarAlias(QueryResponse_RockstarAlias other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarAlias Clone() { + return new QueryResponse_RockstarAlias(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.RockstarAlias.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_RockstarAlias); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_RockstarAlias other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_RockstarAlias other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_RockstarAuto : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_RockstarAuto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[131]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarAuto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarAuto(QueryResponse_RockstarAuto other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarAuto Clone() { + return new QueryResponse_RockstarAuto(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.RockstarBase.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_RockstarAuto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_RockstarAuto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_RockstarAuto other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_RockstarReference : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_RockstarReference()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[132]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarReference() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarReference(QueryResponse_RockstarReference other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_RockstarReference Clone() { + return new QueryResponse_RockstarReference(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.RockstarReference.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_RockstarReference); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_RockstarReference other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_RockstarReference other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryResponse_TypeWithEnum : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryResponse_TypeWithEnum()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[133]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_TypeWithEnum() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_TypeWithEnum(QueryResponse_TypeWithEnum other) : this() { + offset_ = other.offset_; + total_ = other.total_; + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryResponse_TypeWithEnum Clone() { + return new QueryResponse_TypeWithEnum(this); + } + + /// Field number for the "Offset" field. + public const int OffsetFieldNumber = 1; + private int offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "Total" field. + public const int TotalFieldNumber = 2; + private int total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Total { + get { return total_; } + set { + total_ = value; + } + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(26, global::ServiceStack.Extensions.Tests.Protoc.TypeWithEnum.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryResponse_TypeWithEnum); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryResponse_TypeWithEnum other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Offset != other.Offset) return false; + if (Total != other.Total) return false; + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Offset != 0) hash ^= Offset.GetHashCode(); + if (Total != 0) hash ^= Total.GetHashCode(); + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Offset != 0) { + output.WriteRawTag(8); + output.WriteInt32(Offset); + } + if (Total != 0) { + output.WriteRawTag(16); + output.WriteInt32(Total); + } + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Offset != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Offset); + } + if (Total != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Total); + } + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryResponse_TypeWithEnum other) { + if (other == null) { + return; + } + if (other.Offset != 0) { + Offset = other.Offset; + } + if (other.Total != 0) { + Total = other.Total; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Offset = input.ReadInt32(); + break; + } + case 16: { + Total = input.ReadInt32(); + break; + } + case 26: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 42: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarAlbums : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarAlbums()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[134]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbums() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbums(QueryRockstarAlbums other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + id_ = other.id_; + rockstarId_ = other.rockstarId_; + name_ = other.name_; + genre_ = other.genre_; + idBetween_ = other.idBetween_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbums Clone() { + return new QueryRockstarAlbums(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 201; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "RockstarId" field. + public const int RockstarIdFieldNumber = 202; + private int rockstarId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int RockstarId { + get { return rockstarId_; } + set { + rockstarId_ = value; + } + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 203; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Genre" field. + public const int GenreFieldNumber = 204; + private string genre_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Genre { + get { return genre_; } + set { + genre_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "IdBetween" field. + public const int IdBetweenFieldNumber = 205; + private static readonly pb::FieldCodec _repeated_idBetween_codec + = pb::FieldCodec.ForInt32(1640); + private readonly pbc::RepeatedField idBetween_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField IdBetween { + get { return idBetween_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarAlbums); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarAlbums other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Id != other.Id) return false; + if (RockstarId != other.RockstarId) return false; + if (Name != other.Name) return false; + if (Genre != other.Genre) return false; + if(!idBetween_.Equals(other.idBetween_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (RockstarId != 0) hash ^= RockstarId.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Genre.Length != 0) hash ^= Genre.GetHashCode(); + hash ^= idBetween_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Id != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Id); + } + if (RockstarId != 0) { + output.WriteRawTag(208, 12); + output.WriteInt32(RockstarId); + } + if (Name.Length != 0) { + output.WriteRawTag(218, 12); + output.WriteString(Name); + } + if (Genre.Length != 0) { + output.WriteRawTag(226, 12); + output.WriteString(Genre); + } + idBetween_.WriteTo(output, _repeated_idBetween_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (RockstarId != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(RockstarId); + } + if (Name.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Genre.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(Genre); + } + size += idBetween_.CalculateSize(_repeated_idBetween_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarAlbums other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Id != 0) { + Id = other.Id; + } + if (other.RockstarId != 0) { + RockstarId = other.RockstarId; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Genre.Length != 0) { + Genre = other.Genre; + } + idBetween_.Add(other.idBetween_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Id = input.ReadInt32(); + break; + } + case 1616: { + RockstarId = input.ReadInt32(); + break; + } + case 1626: { + Name = input.ReadString(); + break; + } + case 1634: { + Genre = input.ReadString(); + break; + } + case 1642: + case 1640: { + idBetween_.AddEntriesFrom(input, _repeated_idBetween_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarAlbumsCustomLeftJoin : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarAlbumsCustomLeftJoin()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[135]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbumsCustomLeftJoin() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbumsCustomLeftJoin(QueryRockstarAlbumsCustomLeftJoin other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + albumName_ = other.albumName_; + idNotEqualTo_ = other.idNotEqualTo_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbumsCustomLeftJoin Clone() { + return new QueryRockstarAlbumsCustomLeftJoin(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "AlbumName" field. + public const int AlbumNameFieldNumber = 202; + private string albumName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string AlbumName { + get { return albumName_; } + set { + albumName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "IdNotEqualTo" field. + public const int IdNotEqualToFieldNumber = 203; + private int idNotEqualTo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int IdNotEqualTo { + get { return idNotEqualTo_; } + set { + idNotEqualTo_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarAlbumsCustomLeftJoin); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarAlbumsCustomLeftJoin other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + if (AlbumName != other.AlbumName) return false; + if (IdNotEqualTo != other.IdNotEqualTo) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (AlbumName.Length != 0) hash ^= AlbumName.GetHashCode(); + if (IdNotEqualTo != 0) hash ^= IdNotEqualTo.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (AlbumName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(AlbumName); + } + if (IdNotEqualTo != 0) { + output.WriteRawTag(216, 12); + output.WriteInt32(IdNotEqualTo); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (AlbumName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(AlbumName); + } + if (IdNotEqualTo != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(IdNotEqualTo); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarAlbumsCustomLeftJoin other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + if (other.AlbumName.Length != 0) { + AlbumName = other.AlbumName; + } + if (other.IdNotEqualTo != 0) { + IdNotEqualTo = other.IdNotEqualTo; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + case 1618: { + AlbumName = input.ReadString(); + break; + } + case 1624: { + IdNotEqualTo = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarAlbumsImplicit : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarAlbumsImplicit()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[136]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbumsImplicit() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbumsImplicit(QueryRockstarAlbumsImplicit other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbumsImplicit Clone() { + return new QueryRockstarAlbumsImplicit(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarAlbumsImplicit); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarAlbumsImplicit other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarAlbumsImplicit other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarAlbumsLeftJoin : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarAlbumsLeftJoin()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[137]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbumsLeftJoin() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbumsLeftJoin(QueryRockstarAlbumsLeftJoin other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + albumName_ = other.albumName_; + idNotEqualTo_ = other.idNotEqualTo_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlbumsLeftJoin Clone() { + return new QueryRockstarAlbumsLeftJoin(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "AlbumName" field. + public const int AlbumNameFieldNumber = 202; + private string albumName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string AlbumName { + get { return albumName_; } + set { + albumName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "IdNotEqualTo" field. + public const int IdNotEqualToFieldNumber = 203; + private int idNotEqualTo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int IdNotEqualTo { + get { return idNotEqualTo_; } + set { + idNotEqualTo_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarAlbumsLeftJoin); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarAlbumsLeftJoin other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + if (AlbumName != other.AlbumName) return false; + if (IdNotEqualTo != other.IdNotEqualTo) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (AlbumName.Length != 0) hash ^= AlbumName.GetHashCode(); + if (IdNotEqualTo != 0) hash ^= IdNotEqualTo.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (AlbumName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(AlbumName); + } + if (IdNotEqualTo != 0) { + output.WriteRawTag(216, 12); + output.WriteInt32(IdNotEqualTo); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (AlbumName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(AlbumName); + } + if (IdNotEqualTo != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(IdNotEqualTo); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarAlbumsLeftJoin other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + if (other.AlbumName.Length != 0) { + AlbumName = other.AlbumName; + } + if (other.IdNotEqualTo != 0) { + IdNotEqualTo = other.IdNotEqualTo; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + case 1618: { + AlbumName = input.ReadString(); + break; + } + case 1624: { + IdNotEqualTo = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarAlias : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarAlias()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[138]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlias() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlias(QueryRockstarAlias other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + rockstarAlbumName_ = other.rockstarAlbumName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAlias Clone() { + return new QueryRockstarAlias(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "RockstarAlbumName" field. + public const int RockstarAlbumNameFieldNumber = 202; + private string rockstarAlbumName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarAlbumName { + get { return rockstarAlbumName_; } + set { + rockstarAlbumName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarAlias); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarAlias other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + if (RockstarAlbumName != other.RockstarAlbumName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (RockstarAlbumName.Length != 0) hash ^= RockstarAlbumName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (RockstarAlbumName.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(RockstarAlbumName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (RockstarAlbumName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(RockstarAlbumName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarAlias other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + if (other.RockstarAlbumName.Length != 0) { + RockstarAlbumName = other.RockstarAlbumName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + case 1618: { + RockstarAlbumName = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarAudit : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarAudit()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[139]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAudit() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAudit(QueryRockstarAudit other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAudit Clone() { + return new QueryRockstarAudit(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 301; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarAudit); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarAudit other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Id != 0) { + output.WriteRawTag(232, 18); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarAudit other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 2408: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarAuditSubOr : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarAuditSubOr()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[140]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAuditSubOr() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAuditSubOr(QueryRockstarAuditSubOr other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + firstNameStartsWith_ = other.firstNameStartsWith_; + ageOlderThan_ = other.ageOlderThan_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarAuditSubOr Clone() { + return new QueryRockstarAuditSubOr(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "FirstNameStartsWith" field. + public const int FirstNameStartsWithFieldNumber = 201; + private string firstNameStartsWith_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstNameStartsWith { + get { return firstNameStartsWith_; } + set { + firstNameStartsWith_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "AgeOlderThan" field. + public const int AgeOlderThanFieldNumber = 202; + private int ageOlderThan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int AgeOlderThan { + get { return ageOlderThan_; } + set { + ageOlderThan_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarAuditSubOr); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarAuditSubOr other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (FirstNameStartsWith != other.FirstNameStartsWith) return false; + if (AgeOlderThan != other.AgeOlderThan) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (FirstNameStartsWith.Length != 0) hash ^= FirstNameStartsWith.GetHashCode(); + if (AgeOlderThan != 0) hash ^= AgeOlderThan.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (FirstNameStartsWith.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(FirstNameStartsWith); + } + if (AgeOlderThan != 0) { + output.WriteRawTag(208, 12); + output.WriteInt32(AgeOlderThan); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (FirstNameStartsWith.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstNameStartsWith); + } + if (AgeOlderThan != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(AgeOlderThan); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarAuditSubOr other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.FirstNameStartsWith.Length != 0) { + FirstNameStartsWith = other.FirstNameStartsWith; + } + if (other.AgeOlderThan != 0) { + AgeOlderThan = other.AgeOlderThan; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + FirstNameStartsWith = input.ReadString(); + break; + } + case 1616: { + AgeOlderThan = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarFilters : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarFilters()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[141]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarFilters() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarFilters(QueryRockstarFilters other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + ids_ = other.ids_.Clone(); + ages_ = other.ages_.Clone(); + firstNames_ = other.firstNames_.Clone(); + idsBetween_ = other.idsBetween_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarFilters Clone() { + return new QueryRockstarFilters(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Ids" field. + public const int IdsFieldNumber = 201; + private static readonly pb::FieldCodec _repeated_ids_codec + = pb::FieldCodec.ForInt32(1608); + private readonly pbc::RepeatedField ids_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ids { + get { return ids_; } + } + + /// Field number for the "Ages" field. + public const int AgesFieldNumber = 202; + private static readonly pb::FieldCodec _repeated_ages_codec + = pb::FieldCodec.ForInt32(1616); + private readonly pbc::RepeatedField ages_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ages { + get { return ages_; } + } + + /// Field number for the "FirstNames" field. + public const int FirstNamesFieldNumber = 203; + private static readonly pb::FieldCodec _repeated_firstNames_codec + = pb::FieldCodec.ForString(1626); + private readonly pbc::RepeatedField firstNames_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField FirstNames { + get { return firstNames_; } + } + + /// Field number for the "IdsBetween" field. + public const int IdsBetweenFieldNumber = 204; + private static readonly pb::FieldCodec _repeated_idsBetween_codec + = pb::FieldCodec.ForInt32(1632); + private readonly pbc::RepeatedField idsBetween_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField IdsBetween { + get { return idsBetween_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarFilters); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarFilters other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if(!ids_.Equals(other.ids_)) return false; + if(!ages_.Equals(other.ages_)) return false; + if(!firstNames_.Equals(other.firstNames_)) return false; + if(!idsBetween_.Equals(other.idsBetween_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + hash ^= ids_.GetHashCode(); + hash ^= ages_.GetHashCode(); + hash ^= firstNames_.GetHashCode(); + hash ^= idsBetween_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + ids_.WriteTo(output, _repeated_ids_codec); + ages_.WriteTo(output, _repeated_ages_codec); + firstNames_.WriteTo(output, _repeated_firstNames_codec); + idsBetween_.WriteTo(output, _repeated_idsBetween_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + size += ids_.CalculateSize(_repeated_ids_codec); + size += ages_.CalculateSize(_repeated_ages_codec); + size += firstNames_.CalculateSize(_repeated_firstNames_codec); + size += idsBetween_.CalculateSize(_repeated_idsBetween_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarFilters other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + ids_.Add(other.ids_); + ages_.Add(other.ages_); + firstNames_.Add(other.firstNames_); + idsBetween_.Add(other.idsBetween_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: + case 1608: { + ids_.AddEntriesFrom(input, _repeated_ids_codec); + break; + } + case 1618: + case 1616: { + ages_.AddEntriesFrom(input, _repeated_ages_codec); + break; + } + case 1626: { + firstNames_.AddEntriesFrom(input, _repeated_firstNames_codec); + break; + } + case 1634: + case 1632: { + idsBetween_.AddEntriesFrom(input, _repeated_idsBetween_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[142]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstars(QueryRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstars Clone() { + return new QueryRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarsConventions : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarsConventions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[143]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsConventions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsConventions(QueryRockstarsConventions other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + dateOfBirthGreaterThan_ = other.dateOfBirthGreaterThan_ != null ? other.dateOfBirthGreaterThan_.Clone() : null; + dateDiedLessThan_ = other.dateDiedLessThan_ != null ? other.dateDiedLessThan_.Clone() : null; + ids_ = other.ids_.Clone(); + ageOlderThan_ = other.ageOlderThan_; + ageGreaterThanOrEqualTo_ = other.ageGreaterThanOrEqualTo_; + ageGreaterThan_ = other.ageGreaterThan_; + greaterThanAge_ = other.greaterThanAge_; + firstNameStartsWith_ = other.firstNameStartsWith_; + lastNameEndsWith_ = other.lastNameEndsWith_; + lastNameContains_ = other.lastNameContains_; + rockstarAlbumNameContains_ = other.rockstarAlbumNameContains_; + rockstarIdAfter_ = other.rockstarIdAfter_; + rockstarIdOnOrAfter_ = other.rockstarIdOnOrAfter_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsConventions Clone() { + return new QueryRockstarsConventions(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "DateOfBirthGreaterThan" field. + public const int DateOfBirthGreaterThanFieldNumber = 201; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirthGreaterThan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirthGreaterThan { + get { return dateOfBirthGreaterThan_; } + set { + dateOfBirthGreaterThan_ = value; + } + } + + /// Field number for the "DateDiedLessThan" field. + public const int DateDiedLessThanFieldNumber = 202; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDiedLessThan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDiedLessThan { + get { return dateDiedLessThan_; } + set { + dateDiedLessThan_ = value; + } + } + + /// Field number for the "Ids" field. + public const int IdsFieldNumber = 203; + private static readonly pb::FieldCodec _repeated_ids_codec + = pb::FieldCodec.ForInt32(1624); + private readonly pbc::RepeatedField ids_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ids { + get { return ids_; } + } + + /// Field number for the "AgeOlderThan" field. + public const int AgeOlderThanFieldNumber = 204; + private int ageOlderThan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int AgeOlderThan { + get { return ageOlderThan_; } + set { + ageOlderThan_ = value; + } + } + + /// Field number for the "AgeGreaterThanOrEqualTo" field. + public const int AgeGreaterThanOrEqualToFieldNumber = 205; + private int ageGreaterThanOrEqualTo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int AgeGreaterThanOrEqualTo { + get { return ageGreaterThanOrEqualTo_; } + set { + ageGreaterThanOrEqualTo_ = value; + } + } + + /// Field number for the "AgeGreaterThan" field. + public const int AgeGreaterThanFieldNumber = 206; + private int ageGreaterThan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int AgeGreaterThan { + get { return ageGreaterThan_; } + set { + ageGreaterThan_ = value; + } + } + + /// Field number for the "GreaterThanAge" field. + public const int GreaterThanAgeFieldNumber = 207; + private int greaterThanAge_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int GreaterThanAge { + get { return greaterThanAge_; } + set { + greaterThanAge_ = value; + } + } + + /// Field number for the "FirstNameStartsWith" field. + public const int FirstNameStartsWithFieldNumber = 208; + private string firstNameStartsWith_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstNameStartsWith { + get { return firstNameStartsWith_; } + set { + firstNameStartsWith_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastNameEndsWith" field. + public const int LastNameEndsWithFieldNumber = 209; + private string lastNameEndsWith_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastNameEndsWith { + get { return lastNameEndsWith_; } + set { + lastNameEndsWith_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastNameContains" field. + public const int LastNameContainsFieldNumber = 210; + private string lastNameContains_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastNameContains { + get { return lastNameContains_; } + set { + lastNameContains_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RockstarAlbumNameContains" field. + public const int RockstarAlbumNameContainsFieldNumber = 211; + private string rockstarAlbumNameContains_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RockstarAlbumNameContains { + get { return rockstarAlbumNameContains_; } + set { + rockstarAlbumNameContains_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RockstarIdAfter" field. + public const int RockstarIdAfterFieldNumber = 212; + private int rockstarIdAfter_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int RockstarIdAfter { + get { return rockstarIdAfter_; } + set { + rockstarIdAfter_ = value; + } + } + + /// Field number for the "RockstarIdOnOrAfter" field. + public const int RockstarIdOnOrAfterFieldNumber = 213; + private int rockstarIdOnOrAfter_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int RockstarIdOnOrAfter { + get { return rockstarIdOnOrAfter_; } + set { + rockstarIdOnOrAfter_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarsConventions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarsConventions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(DateOfBirthGreaterThan, other.DateOfBirthGreaterThan)) return false; + if (!object.Equals(DateDiedLessThan, other.DateDiedLessThan)) return false; + if(!ids_.Equals(other.ids_)) return false; + if (AgeOlderThan != other.AgeOlderThan) return false; + if (AgeGreaterThanOrEqualTo != other.AgeGreaterThanOrEqualTo) return false; + if (AgeGreaterThan != other.AgeGreaterThan) return false; + if (GreaterThanAge != other.GreaterThanAge) return false; + if (FirstNameStartsWith != other.FirstNameStartsWith) return false; + if (LastNameEndsWith != other.LastNameEndsWith) return false; + if (LastNameContains != other.LastNameContains) return false; + if (RockstarAlbumNameContains != other.RockstarAlbumNameContains) return false; + if (RockstarIdAfter != other.RockstarIdAfter) return false; + if (RockstarIdOnOrAfter != other.RockstarIdOnOrAfter) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (dateOfBirthGreaterThan_ != null) hash ^= DateOfBirthGreaterThan.GetHashCode(); + if (dateDiedLessThan_ != null) hash ^= DateDiedLessThan.GetHashCode(); + hash ^= ids_.GetHashCode(); + if (AgeOlderThan != 0) hash ^= AgeOlderThan.GetHashCode(); + if (AgeGreaterThanOrEqualTo != 0) hash ^= AgeGreaterThanOrEqualTo.GetHashCode(); + if (AgeGreaterThan != 0) hash ^= AgeGreaterThan.GetHashCode(); + if (GreaterThanAge != 0) hash ^= GreaterThanAge.GetHashCode(); + if (FirstNameStartsWith.Length != 0) hash ^= FirstNameStartsWith.GetHashCode(); + if (LastNameEndsWith.Length != 0) hash ^= LastNameEndsWith.GetHashCode(); + if (LastNameContains.Length != 0) hash ^= LastNameContains.GetHashCode(); + if (RockstarAlbumNameContains.Length != 0) hash ^= RockstarAlbumNameContains.GetHashCode(); + if (RockstarIdAfter != 0) hash ^= RockstarIdAfter.GetHashCode(); + if (RockstarIdOnOrAfter != 0) hash ^= RockstarIdOnOrAfter.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (dateOfBirthGreaterThan_ != null) { + output.WriteRawTag(202, 12); + output.WriteMessage(DateOfBirthGreaterThan); + } + if (dateDiedLessThan_ != null) { + output.WriteRawTag(210, 12); + output.WriteMessage(DateDiedLessThan); + } + ids_.WriteTo(output, _repeated_ids_codec); + if (AgeOlderThan != 0) { + output.WriteRawTag(224, 12); + output.WriteInt32(AgeOlderThan); + } + if (AgeGreaterThanOrEqualTo != 0) { + output.WriteRawTag(232, 12); + output.WriteInt32(AgeGreaterThanOrEqualTo); + } + if (AgeGreaterThan != 0) { + output.WriteRawTag(240, 12); + output.WriteInt32(AgeGreaterThan); + } + if (GreaterThanAge != 0) { + output.WriteRawTag(248, 12); + output.WriteInt32(GreaterThanAge); + } + if (FirstNameStartsWith.Length != 0) { + output.WriteRawTag(130, 13); + output.WriteString(FirstNameStartsWith); + } + if (LastNameEndsWith.Length != 0) { + output.WriteRawTag(138, 13); + output.WriteString(LastNameEndsWith); + } + if (LastNameContains.Length != 0) { + output.WriteRawTag(146, 13); + output.WriteString(LastNameContains); + } + if (RockstarAlbumNameContains.Length != 0) { + output.WriteRawTag(154, 13); + output.WriteString(RockstarAlbumNameContains); + } + if (RockstarIdAfter != 0) { + output.WriteRawTag(160, 13); + output.WriteInt32(RockstarIdAfter); + } + if (RockstarIdOnOrAfter != 0) { + output.WriteRawTag(168, 13); + output.WriteInt32(RockstarIdOnOrAfter); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (dateOfBirthGreaterThan_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirthGreaterThan); + } + if (dateDiedLessThan_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(DateDiedLessThan); + } + size += ids_.CalculateSize(_repeated_ids_codec); + if (AgeOlderThan != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(AgeOlderThan); + } + if (AgeGreaterThanOrEqualTo != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(AgeGreaterThanOrEqualTo); + } + if (AgeGreaterThan != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(AgeGreaterThan); + } + if (GreaterThanAge != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(GreaterThanAge); + } + if (FirstNameStartsWith.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstNameStartsWith); + } + if (LastNameEndsWith.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(LastNameEndsWith); + } + if (LastNameContains.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(LastNameContains); + } + if (RockstarAlbumNameContains.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(RockstarAlbumNameContains); + } + if (RockstarIdAfter != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(RockstarIdAfter); + } + if (RockstarIdOnOrAfter != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(RockstarIdOnOrAfter); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarsConventions other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.dateOfBirthGreaterThan_ != null) { + if (dateOfBirthGreaterThan_ == null) { + DateOfBirthGreaterThan = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirthGreaterThan.MergeFrom(other.DateOfBirthGreaterThan); + } + if (other.dateDiedLessThan_ != null) { + if (dateDiedLessThan_ == null) { + DateDiedLessThan = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDiedLessThan.MergeFrom(other.DateDiedLessThan); + } + ids_.Add(other.ids_); + if (other.AgeOlderThan != 0) { + AgeOlderThan = other.AgeOlderThan; + } + if (other.AgeGreaterThanOrEqualTo != 0) { + AgeGreaterThanOrEqualTo = other.AgeGreaterThanOrEqualTo; + } + if (other.AgeGreaterThan != 0) { + AgeGreaterThan = other.AgeGreaterThan; + } + if (other.GreaterThanAge != 0) { + GreaterThanAge = other.GreaterThanAge; + } + if (other.FirstNameStartsWith.Length != 0) { + FirstNameStartsWith = other.FirstNameStartsWith; + } + if (other.LastNameEndsWith.Length != 0) { + LastNameEndsWith = other.LastNameEndsWith; + } + if (other.LastNameContains.Length != 0) { + LastNameContains = other.LastNameContains; + } + if (other.RockstarAlbumNameContains.Length != 0) { + RockstarAlbumNameContains = other.RockstarAlbumNameContains; + } + if (other.RockstarIdAfter != 0) { + RockstarIdAfter = other.RockstarIdAfter; + } + if (other.RockstarIdOnOrAfter != 0) { + RockstarIdOnOrAfter = other.RockstarIdOnOrAfter; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + if (dateOfBirthGreaterThan_ == null) { + DateOfBirthGreaterThan = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirthGreaterThan); + break; + } + case 1618: { + if (dateDiedLessThan_ == null) { + DateDiedLessThan = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDiedLessThan); + break; + } + case 1626: + case 1624: { + ids_.AddEntriesFrom(input, _repeated_ids_codec); + break; + } + case 1632: { + AgeOlderThan = input.ReadInt32(); + break; + } + case 1640: { + AgeGreaterThanOrEqualTo = input.ReadInt32(); + break; + } + case 1648: { + AgeGreaterThan = input.ReadInt32(); + break; + } + case 1656: { + GreaterThanAge = input.ReadInt32(); + break; + } + case 1666: { + FirstNameStartsWith = input.ReadString(); + break; + } + case 1674: { + LastNameEndsWith = input.ReadString(); + break; + } + case 1682: { + LastNameContains = input.ReadString(); + break; + } + case 1690: { + RockstarAlbumNameContains = input.ReadString(); + break; + } + case 1696: { + RockstarIdAfter = input.ReadInt32(); + break; + } + case 1704: { + RockstarIdOnOrAfter = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarsFilter : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarsFilter()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[144]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsFilter() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsFilter(QueryRockstarsFilter other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsFilter Clone() { + return new QueryRockstarsFilter(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarsFilter); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarsFilter other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarsFilter other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarsIFilter : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarsIFilter()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[145]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsIFilter() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsIFilter(QueryRockstarsIFilter other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsIFilter Clone() { + return new QueryRockstarsIFilter(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarsIFilter); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarsIFilter other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarsIFilter other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarsImplicit : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarsImplicit()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[146]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsImplicit() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsImplicit(QueryRockstarsImplicit other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsImplicit Clone() { + return new QueryRockstarsImplicit(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarsImplicit); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarsImplicit other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarsImplicit other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryRockstarsWithReferences : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRockstarsWithReferences()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[147]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsWithReferences() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsWithReferences(QueryRockstarsWithReferences other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryRockstarsWithReferences Clone() { + return new QueryRockstarsWithReferences(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 201; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryRockstarsWithReferences); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryRockstarsWithReferences other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (Age != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (Age != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryRockstarsWithReferences other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class QueryTypeWithEnums : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryTypeWithEnums()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[148]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryTypeWithEnums() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryTypeWithEnums(QueryTypeWithEnums other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryTypeWithEnums Clone() { + return new QueryTypeWithEnums(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryTypeWithEnums); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryTypeWithEnums other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryTypeWithEnums other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class QueryUnknownRockstars : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryUnknownRockstars()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[149]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryUnknownRockstars() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryUnknownRockstars(QueryUnknownRockstars other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + unknownInt_ = other.unknownInt_; + unknownProperty_ = other.unknownProperty_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public QueryUnknownRockstars Clone() { + return new QueryUnknownRockstars(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "UnknownInt" field. + public const int UnknownIntFieldNumber = 201; + private int unknownInt_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int UnknownInt { + get { return unknownInt_; } + set { + unknownInt_ = value; + } + } + + /// Field number for the "UnknownProperty" field. + public const int UnknownPropertyFieldNumber = 202; + private string unknownProperty_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UnknownProperty { + get { return unknownProperty_; } + set { + unknownProperty_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as QueryUnknownRockstars); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(QueryUnknownRockstars other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if (UnknownInt != other.UnknownInt) return false; + if (UnknownProperty != other.UnknownProperty) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (UnknownInt != 0) hash ^= UnknownInt.GetHashCode(); + if (UnknownProperty.Length != 0) hash ^= UnknownProperty.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (UnknownInt != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(UnknownInt); + } + if (UnknownProperty.Length != 0) { + output.WriteRawTag(210, 12); + output.WriteString(UnknownProperty); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (UnknownInt != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(UnknownInt); + } + if (UnknownProperty.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(UnknownProperty); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(QueryUnknownRockstars other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + if (other.UnknownInt != 0) { + UnknownInt = other.UnknownInt; + } + if (other.UnknownProperty.Length != 0) { + UnknownProperty = other.UnknownProperty; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1608: { + UnknownInt = input.ReadInt32(); + break; + } + case 1618: { + UnknownProperty = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class RealDeleteAuditTenant : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RealDeleteAuditTenant()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[150]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RealDeleteAuditTenant() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RealDeleteAuditTenant(RealDeleteAuditTenant other) : this() { + bearerToken_ = other.bearerToken_; + id_ = other.id_; + age_ = other.age_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RealDeleteAuditTenant Clone() { + return new RealDeleteAuditTenant(this); + } + + /// Field number for the "BearerToken" field. + public const int BearerTokenFieldNumber = 1; + private string bearerToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BearerToken { + get { return bearerToken_; } + set { + bearerToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 2; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RealDeleteAuditTenant); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RealDeleteAuditTenant other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BearerToken != other.BearerToken) return false; + if (Id != other.Id) return false; + if (Age != other.Age) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BearerToken.Length != 0) hash ^= BearerToken.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (BearerToken.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BearerToken); + } + if (Id != 0) { + output.WriteRawTag(16); + output.WriteInt32(Id); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BearerToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BearerToken); + } + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RealDeleteAuditTenant other) { + if (other == null) { + return; + } + if (other.BearerToken.Length != 0) { + BearerToken = other.BearerToken; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.Age != 0) { + Age = other.Age; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BearerToken = input.ReadString(); + break; + } + case 16: { + Id = input.ReadInt32(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class RealDeleteAuditTenantGateway : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RealDeleteAuditTenantGateway()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[151]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RealDeleteAuditTenantGateway() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RealDeleteAuditTenantGateway(RealDeleteAuditTenantGateway other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RealDeleteAuditTenantGateway Clone() { + return new RealDeleteAuditTenantGateway(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RealDeleteAuditTenantGateway); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RealDeleteAuditTenantGateway other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RealDeleteAuditTenantGateway other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class RealDeleteAuditTenantMq : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RealDeleteAuditTenantMq()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[152]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RealDeleteAuditTenantMq() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RealDeleteAuditTenantMq(RealDeleteAuditTenantMq other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RealDeleteAuditTenantMq Clone() { + return new RealDeleteAuditTenantMq(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RealDeleteAuditTenantMq); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RealDeleteAuditTenantMq other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RealDeleteAuditTenantMq other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class RegenerateApiKeys : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegenerateApiKeys()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[153]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegenerateApiKeys() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegenerateApiKeys(RegenerateApiKeys other) : this() { + environment_ = other.environment_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegenerateApiKeys Clone() { + return new RegenerateApiKeys(this); + } + + /// Field number for the "Environment" field. + public const int EnvironmentFieldNumber = 1; + private string environment_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Environment { + get { return environment_; } + set { + environment_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 2; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 18); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegenerateApiKeys); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegenerateApiKeys other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Environment != other.Environment) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Environment.Length != 0) hash ^= Environment.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Environment.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Environment); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Environment.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Environment); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegenerateApiKeys other) { + if (other == null) { + return; + } + if (other.Environment.Length != 0) { + Environment = other.Environment; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Environment = input.ReadString(); + break; + } + case 18: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class RegenerateApiKeysResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegenerateApiKeysResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[154]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegenerateApiKeysResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegenerateApiKeysResponse(RegenerateApiKeysResponse other) : this() { + results_ = other.results_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegenerateApiKeysResponse Clone() { + return new RegenerateApiKeysResponse(this); + } + + /// Field number for the "Results" field. + public const int ResultsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_results_codec + = pb::FieldCodec.ForMessage(10, global::ServiceStack.Extensions.Tests.Protoc.UserApiKey.Parser); + private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Results { + get { return results_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 2; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 18); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegenerateApiKeysResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegenerateApiKeysResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!results_.Equals(other.results_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= results_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + results_.WriteTo(output, _repeated_results_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += results_.CalculateSize(_repeated_results_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegenerateApiKeysResponse other) { + if (other == null) { + return; + } + results_.Add(other.results_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + results_.AddEntriesFrom(input, _repeated_results_codec); + break; + } + case 18: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 26: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class Register : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Register()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[155]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Register() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Register(Register other) : this() { + userName_ = other.userName_; + firstName_ = other.firstName_; + lastName_ = other.lastName_; + displayName_ = other.displayName_; + email_ = other.email_; + password_ = other.password_; + confirmPassword_ = other.confirmPassword_; + autoLogin_ = other.autoLogin_; + errorView_ = other.errorView_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Register Clone() { + return new Register(this); + } + + /// Field number for the "UserName" field. + public const int UserNameFieldNumber = 1; + private string userName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserName { + get { return userName_; } + set { + userName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 3; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "DisplayName" field. + public const int DisplayNameFieldNumber = 4; + private string displayName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string DisplayName { + get { return displayName_; } + set { + displayName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Email" field. + public const int EmailFieldNumber = 5; + private string email_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Email { + get { return email_; } + set { + email_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Password" field. + public const int PasswordFieldNumber = 6; + private string password_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Password { + get { return password_; } + set { + password_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ConfirmPassword" field. + public const int ConfirmPasswordFieldNumber = 7; + private string confirmPassword_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ConfirmPassword { + get { return confirmPassword_; } + set { + confirmPassword_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "AutoLogin" field. + public const int AutoLoginFieldNumber = 8; + private bool autoLogin_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool AutoLogin { + get { return autoLogin_; } + set { + autoLogin_ = value; + } + } + + /// Field number for the "ErrorView" field. + public const int ErrorViewFieldNumber = 10; + private string errorView_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ErrorView { + get { return errorView_; } + set { + errorView_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 11; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 90); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Register); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Register other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (UserName != other.UserName) return false; + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (DisplayName != other.DisplayName) return false; + if (Email != other.Email) return false; + if (Password != other.Password) return false; + if (ConfirmPassword != other.ConfirmPassword) return false; + if (AutoLogin != other.AutoLogin) return false; + if (ErrorView != other.ErrorView) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (UserName.Length != 0) hash ^= UserName.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); + if (Email.Length != 0) hash ^= Email.GetHashCode(); + if (Password.Length != 0) hash ^= Password.GetHashCode(); + if (ConfirmPassword.Length != 0) hash ^= ConfirmPassword.GetHashCode(); + if (AutoLogin != false) hash ^= AutoLogin.GetHashCode(); + if (ErrorView.Length != 0) hash ^= ErrorView.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (UserName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(UserName); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(LastName); + } + if (DisplayName.Length != 0) { + output.WriteRawTag(34); + output.WriteString(DisplayName); + } + if (Email.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Email); + } + if (Password.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Password); + } + if (ConfirmPassword.Length != 0) { + output.WriteRawTag(58); + output.WriteString(ConfirmPassword); + } + if (AutoLogin != false) { + output.WriteRawTag(64); + output.WriteBool(AutoLogin); + } + if (ErrorView.Length != 0) { + output.WriteRawTag(82); + output.WriteString(ErrorView); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (UserName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserName); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (DisplayName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DisplayName); + } + if (Email.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); + } + if (Password.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Password); + } + if (ConfirmPassword.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ConfirmPassword); + } + if (AutoLogin != false) { + size += 1 + 1; + } + if (ErrorView.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorView); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Register other) { + if (other == null) { + return; + } + if (other.UserName.Length != 0) { + UserName = other.UserName; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.DisplayName.Length != 0) { + DisplayName = other.DisplayName; + } + if (other.Email.Length != 0) { + Email = other.Email; + } + if (other.Password.Length != 0) { + Password = other.Password; + } + if (other.ConfirmPassword.Length != 0) { + ConfirmPassword = other.ConfirmPassword; + } + if (other.AutoLogin != false) { + AutoLogin = other.AutoLogin; + } + if (other.ErrorView.Length != 0) { + ErrorView = other.ErrorView; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + UserName = input.ReadString(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 26: { + LastName = input.ReadString(); + break; + } + case 34: { + DisplayName = input.ReadString(); + break; + } + case 42: { + Email = input.ReadString(); + break; + } + case 50: { + Password = input.ReadString(); + break; + } + case 58: { + ConfirmPassword = input.ReadString(); + break; + } + case 64: { + AutoLogin = input.ReadBool(); + break; + } + case 82: { + ErrorView = input.ReadString(); + break; + } + case 90: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class RegisterResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisterResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[156]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResponse(RegisterResponse other) : this() { + userId_ = other.userId_; + sessionId_ = other.sessionId_; + userName_ = other.userName_; + referrerUrl_ = other.referrerUrl_; + bearerToken_ = other.bearerToken_; + refreshToken_ = other.refreshToken_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResponse Clone() { + return new RegisterResponse(this); + } + + /// Field number for the "UserId" field. + public const int UserIdFieldNumber = 1; + private string userId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserId { + get { return userId_; } + set { + userId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "SessionId" field. + public const int SessionIdFieldNumber = 2; + private string sessionId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SessionId { + get { return sessionId_; } + set { + sessionId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "UserName" field. + public const int UserNameFieldNumber = 3; + private string userName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserName { + get { return userName_; } + set { + userName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ReferrerUrl" field. + public const int ReferrerUrlFieldNumber = 4; + private string referrerUrl_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ReferrerUrl { + get { return referrerUrl_; } + set { + referrerUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "BearerToken" field. + public const int BearerTokenFieldNumber = 5; + private string bearerToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BearerToken { + get { return bearerToken_; } + set { + bearerToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RefreshToken" field. + public const int RefreshTokenFieldNumber = 6; + private string refreshToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RefreshToken { + get { return refreshToken_; } + set { + refreshToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 7; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 8; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 66); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegisterResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegisterResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (UserId != other.UserId) return false; + if (SessionId != other.SessionId) return false; + if (UserName != other.UserName) return false; + if (ReferrerUrl != other.ReferrerUrl) return false; + if (BearerToken != other.BearerToken) return false; + if (RefreshToken != other.RefreshToken) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (UserId.Length != 0) hash ^= UserId.GetHashCode(); + if (SessionId.Length != 0) hash ^= SessionId.GetHashCode(); + if (UserName.Length != 0) hash ^= UserName.GetHashCode(); + if (ReferrerUrl.Length != 0) hash ^= ReferrerUrl.GetHashCode(); + if (BearerToken.Length != 0) hash ^= BearerToken.GetHashCode(); + if (RefreshToken.Length != 0) hash ^= RefreshToken.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (UserId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(UserId); + } + if (SessionId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SessionId); + } + if (UserName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(UserName); + } + if (ReferrerUrl.Length != 0) { + output.WriteRawTag(34); + output.WriteString(ReferrerUrl); + } + if (BearerToken.Length != 0) { + output.WriteRawTag(42); + output.WriteString(BearerToken); + } + if (RefreshToken.Length != 0) { + output.WriteRawTag(50); + output.WriteString(RefreshToken); + } + if (responseStatus_ != null) { + output.WriteRawTag(58); + output.WriteMessage(ResponseStatus); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (UserId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserId); + } + if (SessionId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SessionId); + } + if (UserName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserName); + } + if (ReferrerUrl.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ReferrerUrl); + } + if (BearerToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BearerToken); + } + if (RefreshToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RefreshToken); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegisterResponse other) { + if (other == null) { + return; + } + if (other.UserId.Length != 0) { + UserId = other.UserId; + } + if (other.SessionId.Length != 0) { + SessionId = other.SessionId; + } + if (other.UserName.Length != 0) { + UserName = other.UserName; + } + if (other.ReferrerUrl.Length != 0) { + ReferrerUrl = other.ReferrerUrl; + } + if (other.BearerToken.Length != 0) { + BearerToken = other.BearerToken; + } + if (other.RefreshToken.Length != 0) { + RefreshToken = other.RefreshToken; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + UserId = input.ReadString(); + break; + } + case 18: { + SessionId = input.ReadString(); + break; + } + case 26: { + UserName = input.ReadString(); + break; + } + case 34: { + ReferrerUrl = input.ReadString(); + break; + } + case 42: { + BearerToken = input.ReadString(); + break; + } + case 50: { + RefreshToken = input.ReadString(); + break; + } + case 58: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + case 66: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class RequiresAuth : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RequiresAuth()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[157]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RequiresAuth() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RequiresAuth(RequiresAuth other) : this() { + name_ = other.name_; + bearerToken_ = other.bearerToken_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RequiresAuth Clone() { + return new RequiresAuth(this); + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "BearerToken" field. + public const int BearerTokenFieldNumber = 2; + private string bearerToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BearerToken { + get { return bearerToken_; } + set { + bearerToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RequiresAuth); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RequiresAuth other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (BearerToken != other.BearerToken) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (BearerToken.Length != 0) hash ^= BearerToken.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (BearerToken.Length != 0) { + output.WriteRawTag(18); + output.WriteString(BearerToken); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (BearerToken.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BearerToken); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RequiresAuth other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.BearerToken.Length != 0) { + BearerToken = other.BearerToken; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + BearerToken = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class ResetTodos : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResetTodos()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[158]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResetTodos() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResetTodos(ResetTodos other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResetTodos Clone() { + return new ResetTodos(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ResetTodos); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ResetTodos other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ResetTodos other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class ResponseError : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResponseError()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[159]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseError() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseError(ResponseError other) : this() { + errorCode_ = other.errorCode_; + fieldName_ = other.fieldName_; + message_ = other.message_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseError Clone() { + return new ResponseError(this); + } + + /// Field number for the "ErrorCode" field. + public const int ErrorCodeFieldNumber = 1; + private string errorCode_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ErrorCode { + get { return errorCode_; } + set { + errorCode_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "FieldName" field. + public const int FieldNameFieldNumber = 2; + private string fieldName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FieldName { + get { return fieldName_; } + set { + fieldName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Message" field. + public const int MessageFieldNumber = 3; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ResponseError); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ResponseError other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ErrorCode != other.ErrorCode) return false; + if (FieldName != other.FieldName) return false; + if (Message != other.Message) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ErrorCode.Length != 0) hash ^= ErrorCode.GetHashCode(); + if (FieldName.Length != 0) hash ^= FieldName.GetHashCode(); + if (Message.Length != 0) hash ^= Message.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (ErrorCode.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ErrorCode); + } + if (FieldName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FieldName); + } + if (Message.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Message); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ErrorCode.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorCode); + } + if (FieldName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FieldName); + } + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ResponseError other) { + if (other == null) { + return; + } + if (other.ErrorCode.Length != 0) { + ErrorCode = other.ErrorCode; + } + if (other.FieldName.Length != 0) { + FieldName = other.FieldName; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ErrorCode = input.ReadString(); + break; + } + case 18: { + FieldName = input.ReadString(); + break; + } + case 26: { + Message = input.ReadString(); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class ResponseStatus : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResponseStatus()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[160]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseStatus() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseStatus(ResponseStatus other) : this() { + errorCode_ = other.errorCode_; + message_ = other.message_; + stackTrace_ = other.stackTrace_; + errors_ = other.errors_.Clone(); + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResponseStatus Clone() { + return new ResponseStatus(this); + } + + /// Field number for the "ErrorCode" field. + public const int ErrorCodeFieldNumber = 1; + private string errorCode_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ErrorCode { + get { return errorCode_; } + set { + errorCode_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Message" field. + public const int MessageFieldNumber = 2; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "StackTrace" field. + public const int StackTraceFieldNumber = 3; + private string stackTrace_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string StackTrace { + get { return stackTrace_; } + set { + stackTrace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Errors" field. + public const int ErrorsFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_errors_codec + = pb::FieldCodec.ForMessage(34, global::ServiceStack.Extensions.Tests.Protoc.ResponseError.Parser); + private readonly pbc::RepeatedField errors_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Errors { + get { return errors_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 5; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 42); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ResponseStatus); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ResponseStatus other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ErrorCode != other.ErrorCode) return false; + if (Message != other.Message) return false; + if (StackTrace != other.StackTrace) return false; + if(!errors_.Equals(other.errors_)) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ErrorCode.Length != 0) hash ^= ErrorCode.GetHashCode(); + if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (StackTrace.Length != 0) hash ^= StackTrace.GetHashCode(); + hash ^= errors_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (ErrorCode.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ErrorCode); + } + if (Message.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Message); + } + if (StackTrace.Length != 0) { + output.WriteRawTag(26); + output.WriteString(StackTrace); + } + errors_.WriteTo(output, _repeated_errors_codec); + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ErrorCode.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorCode); + } + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (StackTrace.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(StackTrace); + } + size += errors_.CalculateSize(_repeated_errors_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ResponseStatus other) { + if (other == null) { + return; + } + if (other.ErrorCode.Length != 0) { + ErrorCode = other.ErrorCode; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + if (other.StackTrace.Length != 0) { + StackTrace = other.StackTrace; + } + errors_.Add(other.errors_); + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ErrorCode = input.ReadString(); + break; + } + case 18: { + Message = input.ReadString(); + break; + } + case 26: { + StackTrace = input.ReadString(); + break; + } + case 34: { + errors_.AddEntriesFrom(input, _repeated_errors_codec); + break; + } + case 42: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class Rockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Rockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[161]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Rockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Rockstar(Rockstar other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + switch (other.SubtypeCase) { + case SubtypeOneofCase.NamedRockstar: + NamedRockstar = other.NamedRockstar.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Rockstar Clone() { + return new Rockstar(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 3; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 4; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 6; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 7; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "NamedRockstar" field. + public const int NamedRockstarFieldNumber = 345091624; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.NamedRockstar NamedRockstar { + get { return subtypeCase_ == SubtypeOneofCase.NamedRockstar ? (global::ServiceStack.Extensions.Tests.Protoc.NamedRockstar) subtype_ : null; } + set { + subtype_ = value; + subtypeCase_ = value == null ? SubtypeOneofCase.None : SubtypeOneofCase.NamedRockstar; + } + } + + private object subtype_; + /// Enum of possible cases for the "subtype" oneof. + public enum SubtypeOneofCase { + None = 0, + NamedRockstar = 345091624, + } + private SubtypeOneofCase subtypeCase_ = SubtypeOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SubtypeOneofCase SubtypeCase { + get { return subtypeCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSubtype() { + subtypeCase_ = SubtypeOneofCase.None; + subtype_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Rockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Rockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (!object.Equals(NamedRockstar, other.NamedRockstar)) return false; + if (SubtypeCase != other.SubtypeCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (subtypeCase_ == SubtypeOneofCase.NamedRockstar) hash ^= NamedRockstar.GetHashCode(); + hash ^= (int) subtypeCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(32); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(50); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(56); + output.WriteEnum((int) LivingStatus); + } + if (subtypeCase_ == SubtypeOneofCase.NamedRockstar) { + output.WriteRawTag(194, 226, 181, 164, 10); + output.WriteMessage(NamedRockstar); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (subtypeCase_ == SubtypeOneofCase.NamedRockstar) { + size += 5 + pb::CodedOutputStream.ComputeMessageSize(NamedRockstar); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Rockstar other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + switch (other.SubtypeCase) { + case SubtypeOneofCase.NamedRockstar: + if (NamedRockstar == null) { + NamedRockstar = new global::ServiceStack.Extensions.Tests.Protoc.NamedRockstar(); + } + NamedRockstar.MergeFrom(other.NamedRockstar); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 26: { + LastName = input.ReadString(); + break; + } + case 32: { + Age = input.ReadInt32(); + break; + } + case 42: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 50: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 56: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 2760732994: { + global::ServiceStack.Extensions.Tests.Protoc.NamedRockstar subBuilder = new global::ServiceStack.Extensions.Tests.Protoc.NamedRockstar(); + if (subtypeCase_ == SubtypeOneofCase.NamedRockstar) { + subBuilder.MergeFrom(NamedRockstar); + } + input.ReadMessage(subBuilder); + NamedRockstar = subBuilder; + break; + } + } + } + } + + } + + public sealed partial class RockstarAlbum : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarAlbum()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[162]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAlbum() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAlbum(RockstarAlbum other) : this() { + id_ = other.id_; + rockstarId_ = other.rockstarId_; + name_ = other.name_; + genre_ = other.genre_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAlbum Clone() { + return new RockstarAlbum(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "RockstarId" field. + public const int RockstarIdFieldNumber = 2; + private int rockstarId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int RockstarId { + get { return rockstarId_; } + set { + rockstarId_ = value; + } + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 3; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Genre" field. + public const int GenreFieldNumber = 4; + private string genre_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Genre { + get { return genre_; } + set { + genre_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarAlbum); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarAlbum other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (RockstarId != other.RockstarId) return false; + if (Name != other.Name) return false; + if (Genre != other.Genre) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (RockstarId != 0) hash ^= RockstarId.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Genre.Length != 0) hash ^= Genre.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (RockstarId != 0) { + output.WriteRawTag(16); + output.WriteInt32(RockstarId); + } + if (Name.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Name); + } + if (Genre.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Genre); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (RockstarId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(RockstarId); + } + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Genre.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Genre); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarAlbum other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.RockstarId != 0) { + RockstarId = other.RockstarId; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Genre.Length != 0) { + Genre = other.Genre; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 16: { + RockstarId = input.ReadInt32(); + break; + } + case 26: { + Name = input.ReadString(); + break; + } + case 34: { + Genre = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class RockstarAlias : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarAlias()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[163]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAlias() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAlias(RockstarAlias other) : this() { + rockstarId_ = other.rockstarId_; + firstName_ = other.firstName_; + surname_ = other.surname_; + album_ = other.album_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAlias Clone() { + return new RockstarAlias(this); + } + + /// Field number for the "RockstarId" field. + public const int RockstarIdFieldNumber = 1; + private int rockstarId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int RockstarId { + get { return rockstarId_; } + set { + rockstarId_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Surname" field. + public const int SurnameFieldNumber = 3; + private string surname_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Surname { + get { return surname_; } + set { + surname_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "album" field. + public const int AlbumFieldNumber = 4; + private string album_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Album { + get { return album_; } + set { + album_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarAlias); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarAlias other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (RockstarId != other.RockstarId) return false; + if (FirstName != other.FirstName) return false; + if (Surname != other.Surname) return false; + if (Album != other.Album) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (RockstarId != 0) hash ^= RockstarId.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (Surname.Length != 0) hash ^= Surname.GetHashCode(); + if (Album.Length != 0) hash ^= Album.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (RockstarId != 0) { + output.WriteRawTag(8); + output.WriteInt32(RockstarId); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (Surname.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Surname); + } + if (Album.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Album); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (RockstarId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(RockstarId); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (Surname.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Surname); + } + if (Album.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Album); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarAlias other) { + if (other == null) { + return; + } + if (other.RockstarId != 0) { + RockstarId = other.RockstarId; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.Surname.Length != 0) { + Surname = other.Surname; + } + if (other.Album.Length != 0) { + Album = other.Album; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + RockstarId = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 26: { + Surname = input.ReadString(); + break; + } + case 34: { + Album = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class RockstarAudit : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarAudit()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[164]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAudit() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAudit(RockstarAudit other) : this() { + id_ = other.id_; + createdDate_ = other.createdDate_ != null ? other.createdDate_.Clone() : null; + createdBy_ = other.createdBy_; + createdInfo_ = other.createdInfo_; + modifiedDate_ = other.modifiedDate_ != null ? other.modifiedDate_.Clone() : null; + modifiedBy_ = other.modifiedBy_; + modifiedInfo_ = other.modifiedInfo_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAudit Clone() { + return new RockstarAudit(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "CreatedDate" field. + public const int CreatedDateFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Timestamp createdDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp CreatedDate { + get { return createdDate_; } + set { + createdDate_ = value; + } + } + + /// Field number for the "CreatedBy" field. + public const int CreatedByFieldNumber = 3; + private string createdBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CreatedBy { + get { return createdBy_; } + set { + createdBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "CreatedInfo" field. + public const int CreatedInfoFieldNumber = 4; + private string createdInfo_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CreatedInfo { + get { return createdInfo_; } + set { + createdInfo_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ModifiedDate" field. + public const int ModifiedDateFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp modifiedDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp ModifiedDate { + get { return modifiedDate_; } + set { + modifiedDate_ = value; + } + } + + /// Field number for the "ModifiedBy" field. + public const int ModifiedByFieldNumber = 6; + private string modifiedBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ModifiedBy { + get { return modifiedBy_; } + set { + modifiedBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ModifiedInfo" field. + public const int ModifiedInfoFieldNumber = 7; + private string modifiedInfo_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ModifiedInfo { + get { return modifiedInfo_; } + set { + modifiedInfo_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarAudit); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarAudit other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(CreatedDate, other.CreatedDate)) return false; + if (CreatedBy != other.CreatedBy) return false; + if (CreatedInfo != other.CreatedInfo) return false; + if (!object.Equals(ModifiedDate, other.ModifiedDate)) return false; + if (ModifiedBy != other.ModifiedBy) return false; + if (ModifiedInfo != other.ModifiedInfo) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (createdDate_ != null) hash ^= CreatedDate.GetHashCode(); + if (CreatedBy.Length != 0) hash ^= CreatedBy.GetHashCode(); + if (CreatedInfo.Length != 0) hash ^= CreatedInfo.GetHashCode(); + if (modifiedDate_ != null) hash ^= ModifiedDate.GetHashCode(); + if (ModifiedBy.Length != 0) hash ^= ModifiedBy.GetHashCode(); + if (ModifiedInfo.Length != 0) hash ^= ModifiedInfo.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (createdDate_ != null) { + output.WriteRawTag(18); + output.WriteMessage(CreatedDate); + } + if (CreatedBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(CreatedBy); + } + if (CreatedInfo.Length != 0) { + output.WriteRawTag(34); + output.WriteString(CreatedInfo); + } + if (modifiedDate_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ModifiedDate); + } + if (ModifiedBy.Length != 0) { + output.WriteRawTag(50); + output.WriteString(ModifiedBy); + } + if (ModifiedInfo.Length != 0) { + output.WriteRawTag(58); + output.WriteString(ModifiedInfo); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (createdDate_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(CreatedDate); + } + if (CreatedBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CreatedBy); + } + if (CreatedInfo.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CreatedInfo); + } + if (modifiedDate_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ModifiedDate); + } + if (ModifiedBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ModifiedBy); + } + if (ModifiedInfo.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ModifiedInfo); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarAudit other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.createdDate_ != null) { + if (createdDate_ == null) { + CreatedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + CreatedDate.MergeFrom(other.CreatedDate); + } + if (other.CreatedBy.Length != 0) { + CreatedBy = other.CreatedBy; + } + if (other.CreatedInfo.Length != 0) { + CreatedInfo = other.CreatedInfo; + } + if (other.modifiedDate_ != null) { + if (modifiedDate_ == null) { + ModifiedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + ModifiedDate.MergeFrom(other.ModifiedDate); + } + if (other.ModifiedBy.Length != 0) { + ModifiedBy = other.ModifiedBy; + } + if (other.ModifiedInfo.Length != 0) { + ModifiedInfo = other.ModifiedInfo; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + if (createdDate_ == null) { + CreatedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(CreatedDate); + break; + } + case 26: { + CreatedBy = input.ReadString(); + break; + } + case 34: { + CreatedInfo = input.ReadString(); + break; + } + case 42: { + if (modifiedDate_ == null) { + ModifiedDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(ModifiedDate); + break; + } + case 50: { + ModifiedBy = input.ReadString(); + break; + } + case 58: { + ModifiedInfo = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class RockstarAuditTenant : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarAuditTenant()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[165]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAuditTenant() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAuditTenant(RockstarAuditTenant other) : this() { + tenantId_ = other.tenantId_; + id_ = other.id_; + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAuditTenant Clone() { + return new RockstarAuditTenant(this); + } + + /// Field number for the "TenantId" field. + public const int TenantIdFieldNumber = 1; + private int tenantId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int TenantId { + get { return tenantId_; } + set { + tenantId_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 2; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 3; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 4; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 5; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 6; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 7; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 8; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarAuditTenant); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarAuditTenant other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (TenantId != other.TenantId) return false; + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (TenantId != 0) hash ^= TenantId.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (TenantId != 0) { + output.WriteRawTag(8); + output.WriteInt32(TenantId); + } + if (Id != 0) { + output.WriteRawTag(16); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(34); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(40); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(50); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(58); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(64); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (TenantId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(TenantId); + } + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarAuditTenant other) { + if (other == null) { + return; + } + if (other.TenantId != 0) { + TenantId = other.TenantId; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + TenantId = input.ReadInt32(); + break; + } + case 16: { + Id = input.ReadInt32(); + break; + } + case 26: { + FirstName = input.ReadString(); + break; + } + case 34: { + LastName = input.ReadString(); + break; + } + case 40: { + Age = input.ReadInt32(); + break; + } + case 50: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 58: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 64: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class RockstarAuto : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarAuto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[166]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAuto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAuto(RockstarAuto other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAuto Clone() { + return new RockstarAuto(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarAuto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarAuto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarAuto other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class RockstarAutoGuid : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarAutoGuid()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[167]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAutoGuid() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAutoGuid(RockstarAutoGuid other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarAutoGuid Clone() { + return new RockstarAutoGuid(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// default value could not be applied: 00000000-0000-0000-0000-000000000000 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarAutoGuid); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarAutoGuid other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarAutoGuid other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class RockstarBase : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarBase()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[168]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarBase() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarBase(RockstarBase other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + switch (other.SubtypeCase) { + case SubtypeOneofCase.RockstarAutoGuid: + RockstarAutoGuid = other.RockstarAutoGuid.Clone(); + break; + case SubtypeOneofCase.RockstarAuto: + RockstarAuto = other.RockstarAuto.Clone(); + break; + case SubtypeOneofCase.RockstarAudit: + RockstarAudit = other.RockstarAudit.Clone(); + break; + case SubtypeOneofCase.RockstarVersion: + RockstarVersion = other.RockstarVersion.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarBase Clone() { + return new RockstarBase(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "RockstarAutoGuid" field. + public const int RockstarAutoGuidFieldNumber = 92000829; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.RockstarAutoGuid RockstarAutoGuid { + get { return subtypeCase_ == SubtypeOneofCase.RockstarAutoGuid ? (global::ServiceStack.Extensions.Tests.Protoc.RockstarAutoGuid) subtype_ : null; } + set { + subtype_ = value; + subtypeCase_ = value == null ? SubtypeOneofCase.None : SubtypeOneofCase.RockstarAutoGuid; + } + } + + /// Field number for the "RockstarAuto" field. + public const int RockstarAutoFieldNumber = 92257311; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.RockstarAuto RockstarAuto { + get { return subtypeCase_ == SubtypeOneofCase.RockstarAuto ? (global::ServiceStack.Extensions.Tests.Protoc.RockstarAuto) subtype_ : null; } + set { + subtype_ = value; + subtypeCase_ = value == null ? SubtypeOneofCase.None : SubtypeOneofCase.RockstarAuto; + } + } + + /// Field number for the "RockstarAudit" field. + public const int RockstarAuditFieldNumber = 119875064; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.RockstarAudit RockstarAudit { + get { return subtypeCase_ == SubtypeOneofCase.RockstarAudit ? (global::ServiceStack.Extensions.Tests.Protoc.RockstarAudit) subtype_ : null; } + set { + subtype_ = value; + subtypeCase_ = value == null ? SubtypeOneofCase.None : SubtypeOneofCase.RockstarAudit; + } + } + + /// Field number for the "RockstarVersion" field. + public const int RockstarVersionFieldNumber = 320656675; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.RockstarVersion RockstarVersion { + get { return subtypeCase_ == SubtypeOneofCase.RockstarVersion ? (global::ServiceStack.Extensions.Tests.Protoc.RockstarVersion) subtype_ : null; } + set { + subtype_ = value; + subtypeCase_ = value == null ? SubtypeOneofCase.None : SubtypeOneofCase.RockstarVersion; + } + } + + private object subtype_; + /// Enum of possible cases for the "subtype" oneof. + public enum SubtypeOneofCase { + None = 0, + RockstarAutoGuid = 92000829, + RockstarAuto = 92257311, + RockstarAudit = 119875064, + RockstarVersion = 320656675, + } + private SubtypeOneofCase subtypeCase_ = SubtypeOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SubtypeOneofCase SubtypeCase { + get { return subtypeCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSubtype() { + subtypeCase_ = SubtypeOneofCase.None; + subtype_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarBase); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarBase other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (!object.Equals(RockstarAutoGuid, other.RockstarAutoGuid)) return false; + if (!object.Equals(RockstarAuto, other.RockstarAuto)) return false; + if (!object.Equals(RockstarAudit, other.RockstarAudit)) return false; + if (!object.Equals(RockstarVersion, other.RockstarVersion)) return false; + if (SubtypeCase != other.SubtypeCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (subtypeCase_ == SubtypeOneofCase.RockstarAutoGuid) hash ^= RockstarAutoGuid.GetHashCode(); + if (subtypeCase_ == SubtypeOneofCase.RockstarAuto) hash ^= RockstarAuto.GetHashCode(); + if (subtypeCase_ == SubtypeOneofCase.RockstarAudit) hash ^= RockstarAudit.GetHashCode(); + if (subtypeCase_ == SubtypeOneofCase.RockstarVersion) hash ^= RockstarVersion.GetHashCode(); + hash ^= (int) subtypeCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarAutoGuid) { + output.WriteRawTag(234, 163, 250, 222, 2); + output.WriteMessage(RockstarAutoGuid); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarAuto) { + output.WriteRawTag(250, 193, 247, 223, 2); + output.WriteMessage(RockstarAuto); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarAudit) { + output.WriteRawTag(194, 223, 164, 201, 3); + output.WriteMessage(RockstarAudit); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarVersion) { + output.WriteRawTag(154, 210, 154, 199, 9); + output.WriteMessage(RockstarVersion); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarAutoGuid) { + size += 5 + pb::CodedOutputStream.ComputeMessageSize(RockstarAutoGuid); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarAuto) { + size += 5 + pb::CodedOutputStream.ComputeMessageSize(RockstarAuto); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarAudit) { + size += 5 + pb::CodedOutputStream.ComputeMessageSize(RockstarAudit); + } + if (subtypeCase_ == SubtypeOneofCase.RockstarVersion) { + size += 5 + pb::CodedOutputStream.ComputeMessageSize(RockstarVersion); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarBase other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + switch (other.SubtypeCase) { + case SubtypeOneofCase.RockstarAutoGuid: + if (RockstarAutoGuid == null) { + RockstarAutoGuid = new global::ServiceStack.Extensions.Tests.Protoc.RockstarAutoGuid(); + } + RockstarAutoGuid.MergeFrom(other.RockstarAutoGuid); + break; + case SubtypeOneofCase.RockstarAuto: + if (RockstarAuto == null) { + RockstarAuto = new global::ServiceStack.Extensions.Tests.Protoc.RockstarAuto(); + } + RockstarAuto.MergeFrom(other.RockstarAuto); + break; + case SubtypeOneofCase.RockstarAudit: + if (RockstarAudit == null) { + RockstarAudit = new global::ServiceStack.Extensions.Tests.Protoc.RockstarAudit(); + } + RockstarAudit.MergeFrom(other.RockstarAudit); + break; + case SubtypeOneofCase.RockstarVersion: + if (RockstarVersion == null) { + RockstarVersion = new global::ServiceStack.Extensions.Tests.Protoc.RockstarVersion(); + } + RockstarVersion.MergeFrom(other.RockstarVersion); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 736006634: { + global::ServiceStack.Extensions.Tests.Protoc.RockstarAutoGuid subBuilder = new global::ServiceStack.Extensions.Tests.Protoc.RockstarAutoGuid(); + if (subtypeCase_ == SubtypeOneofCase.RockstarAutoGuid) { + subBuilder.MergeFrom(RockstarAutoGuid); + } + input.ReadMessage(subBuilder); + RockstarAutoGuid = subBuilder; + break; + } + case 738058490: { + global::ServiceStack.Extensions.Tests.Protoc.RockstarAuto subBuilder = new global::ServiceStack.Extensions.Tests.Protoc.RockstarAuto(); + if (subtypeCase_ == SubtypeOneofCase.RockstarAuto) { + subBuilder.MergeFrom(RockstarAuto); + } + input.ReadMessage(subBuilder); + RockstarAuto = subBuilder; + break; + } + case 959000514: { + global::ServiceStack.Extensions.Tests.Protoc.RockstarAudit subBuilder = new global::ServiceStack.Extensions.Tests.Protoc.RockstarAudit(); + if (subtypeCase_ == SubtypeOneofCase.RockstarAudit) { + subBuilder.MergeFrom(RockstarAudit); + } + input.ReadMessage(subBuilder); + RockstarAudit = subBuilder; + break; + } + case 2565253402: { + global::ServiceStack.Extensions.Tests.Protoc.RockstarVersion subBuilder = new global::ServiceStack.Extensions.Tests.Protoc.RockstarVersion(); + if (subtypeCase_ == SubtypeOneofCase.RockstarVersion) { + subBuilder.MergeFrom(RockstarVersion); + } + input.ReadMessage(subBuilder); + RockstarVersion = subBuilder; + break; + } + } + } + } + + } + + public sealed partial class RockstarGenre : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarGenre()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[169]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarGenre() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarGenre(RockstarGenre other) : this() { + id_ = other.id_; + rockstarId_ = other.rockstarId_; + name_ = other.name_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarGenre Clone() { + return new RockstarGenre(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "RockstarId" field. + public const int RockstarIdFieldNumber = 2; + private int rockstarId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int RockstarId { + get { return rockstarId_; } + set { + rockstarId_ = value; + } + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 3; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarGenre); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarGenre other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (RockstarId != other.RockstarId) return false; + if (Name != other.Name) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (RockstarId != 0) hash ^= RockstarId.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (RockstarId != 0) { + output.WriteRawTag(16); + output.WriteInt32(RockstarId); + } + if (Name.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Name); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (RockstarId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(RockstarId); + } + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarGenre other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.RockstarId != 0) { + RockstarId = other.RockstarId; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 16: { + RockstarId = input.ReadInt32(); + break; + } + case 26: { + Name = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class RockstarReference : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarReference()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[170]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarReference() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarReference(RockstarReference other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + albums_ = other.albums_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarReference Clone() { + return new RockstarReference(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 3; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 4; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "Albums" field. + public const int AlbumsFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_albums_codec + = pb::FieldCodec.ForMessage(42, global::ServiceStack.Extensions.Tests.Protoc.RockstarAlbum.Parser); + private readonly pbc::RepeatedField albums_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Albums { + get { return albums_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarReference); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarReference other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if(!albums_.Equals(other.albums_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + hash ^= albums_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(32); + output.WriteInt32(Age); + } + albums_.WriteTo(output, _repeated_albums_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + size += albums_.CalculateSize(_repeated_albums_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarReference other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + albums_.Add(other.albums_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 26: { + LastName = input.ReadString(); + break; + } + case 32: { + Age = input.ReadInt32(); + break; + } + case 42: { + albums_.AddEntriesFrom(input, _repeated_albums_codec); + break; + } + } + } + } + + } + + public sealed partial class RockstarVersion : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarVersion()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[171]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarVersion() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarVersion(RockstarVersion other) : this() { + id_ = other.id_; + rowVersion_ = other.rowVersion_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarVersion Clone() { + return new RockstarVersion(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "RowVersion" field. + public const int RowVersionFieldNumber = 2; + private ulong rowVersion_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong RowVersion { + get { return rowVersion_; } + set { + rowVersion_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarVersion); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarVersion other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (RowVersion != other.RowVersion) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (RowVersion != 0UL) hash ^= RowVersion.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (RowVersion != 0UL) { + output.WriteRawTag(16); + output.WriteUInt64(RowVersion); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (RowVersion != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(RowVersion); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarVersion other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.RowVersion != 0UL) { + RowVersion = other.RowVersion; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 16: { + RowVersion = input.ReadUInt64(); + break; + } + } + } + } + + } + + public sealed partial class RockstarWithIdAndCountResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarWithIdAndCountResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[172]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdAndCountResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdAndCountResponse(RockstarWithIdAndCountResponse other) : this() { + id_ = other.id_; + count_ = other.count_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdAndCountResponse Clone() { + return new RockstarWithIdAndCountResponse(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Count" field. + public const int CountFieldNumber = 2; + private int count_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Count { + get { return count_; } + set { + count_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarWithIdAndCountResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarWithIdAndCountResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Count != other.Count) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (Count != 0) hash ^= Count.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (Count != 0) { + output.WriteRawTag(16); + output.WriteInt32(Count); + } + if (responseStatus_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (Count != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Count); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarWithIdAndCountResponse other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.Count != 0) { + Count = other.Count; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 16: { + Count = input.ReadInt32(); + break; + } + case 26: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class RockstarWithIdAndResultResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarWithIdAndResultResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[173]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdAndResultResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdAndResultResponse(RockstarWithIdAndResultResponse other) : this() { + id_ = other.id_; + result_ = other.result_ != null ? other.result_.Clone() : null; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdAndResultResponse Clone() { + return new RockstarWithIdAndResultResponse(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.RockstarBase result_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.RockstarBase Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarWithIdAndResultResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarWithIdAndResultResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(Result, other.Result)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (result_ != null) hash ^= Result.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (result_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Result); + } + if (responseStatus_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (result_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarWithIdAndResultResponse other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.result_ != null) { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.RockstarBase(); + } + Result.MergeFrom(other.Result); + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + if (result_ == null) { + Result = new global::ServiceStack.Extensions.Tests.Protoc.RockstarBase(); + } + input.ReadMessage(Result); + break; + } + case 26: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class RockstarWithIdAndRowVersionResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarWithIdAndRowVersionResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[174]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdAndRowVersionResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdAndRowVersionResponse(RockstarWithIdAndRowVersionResponse other) : this() { + id_ = other.id_; + rowVersion_ = other.rowVersion_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdAndRowVersionResponse Clone() { + return new RockstarWithIdAndRowVersionResponse(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "RowVersion" field. + public const int RowVersionFieldNumber = 2; + private uint rowVersion_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint RowVersion { + get { return rowVersion_; } + set { + rowVersion_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarWithIdAndRowVersionResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarWithIdAndRowVersionResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (RowVersion != other.RowVersion) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (RowVersion != 0) hash ^= RowVersion.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (RowVersion != 0) { + output.WriteRawTag(16); + output.WriteUInt32(RowVersion); + } + if (responseStatus_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (RowVersion != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(RowVersion); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarWithIdAndRowVersionResponse other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.RowVersion != 0) { + RowVersion = other.RowVersion; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 16: { + RowVersion = input.ReadUInt32(); + break; + } + case 26: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class RockstarWithIdResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RockstarWithIdResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[175]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdResponse(RockstarWithIdResponse other) : this() { + id_ = other.id_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RockstarWithIdResponse Clone() { + return new RockstarWithIdResponse(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RockstarWithIdResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RockstarWithIdResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (responseStatus_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RockstarWithIdResponse other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class SearchMovies : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SearchMovies()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[176]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SearchMovies() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SearchMovies(SearchMovies other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SearchMovies Clone() { + return new SearchMovies(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SearchMovies); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SearchMovies other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SearchMovies other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class SearchResult : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SearchResult()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[177]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SearchResult() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SearchResult(SearchResult other) : this() { + id_ = other.id_; + suffix_ = other.suffix_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SearchResult Clone() { + return new SearchResult(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Suffix" field. + public const int SuffixFieldNumber = 2; + private string suffix_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Suffix { + get { return suffix_; } + set { + suffix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SearchResult); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SearchResult other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Suffix != other.Suffix) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (Suffix.Length != 0) hash ^= Suffix.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (Suffix.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Suffix); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (Suffix.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Suffix); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SearchResult other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.Suffix.Length != 0) { + Suffix = other.Suffix; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + Suffix = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class Secured : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Secured()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[178]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Secured() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Secured(Secured other) : this() { + name_ = other.name_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Secured Clone() { + return new Secured(this); + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Secured); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Secured other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Secured other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class SecuredResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SecuredResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[179]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SecuredResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SecuredResponse(SecuredResponse other) : this() { + result_ = other.result_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SecuredResponse Clone() { + return new SecuredResponse(this); + } + + /// Field number for the "Result" field. + public const int ResultFieldNumber = 1; + private string result_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Result { + get { return result_; } + set { + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 2; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SecuredResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SecuredResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Result != other.Result) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Result.Length != 0) hash ^= Result.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Result.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Result); + } + if (responseStatus_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Result.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Result); + } + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SecuredResponse other) { + if (other == null) { + return; + } + if (other.Result.Length != 0) { + Result = other.Result; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Result = input.ReadString(); + break; + } + case 18: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[180]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse Clone() { + return new SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class SoftDeleteAuditTenant : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SoftDeleteAuditTenant()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[181]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SoftDeleteAuditTenant() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SoftDeleteAuditTenant(SoftDeleteAuditTenant other) : this() { + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SoftDeleteAuditTenant Clone() { + return new SoftDeleteAuditTenant(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 201; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SoftDeleteAuditTenant); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SoftDeleteAuditTenant other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(200, 12); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SoftDeleteAuditTenant other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 1608: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[182]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse Clone() { + return new SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class StreamFiles : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StreamFiles()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[183]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamFiles() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamFiles(StreamFiles other) : this() { + paths_ = other.paths_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamFiles Clone() { + return new StreamFiles(this); + } + + /// Field number for the "Paths" field. + public const int PathsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_paths_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField paths_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Paths { + get { return paths_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StreamFiles); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StreamFiles other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!paths_.Equals(other.paths_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= paths_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + paths_.WriteTo(output, _repeated_paths_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += paths_.CalculateSize(_repeated_paths_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StreamFiles other) { + if (other == null) { + return; + } + paths_.Add(other.paths_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + paths_.AddEntriesFrom(input, _repeated_paths_codec); + break; + } + } + } + } + + } + + public sealed partial class StreamMovies : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StreamMovies()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[184]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamMovies() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamMovies(StreamMovies other) : this() { + skip_ = other.skip_; + take_ = other.take_; + orderBy_ = other.orderBy_; + orderByDesc_ = other.orderByDesc_; + include_ = other.include_; + fields_ = other.fields_; + meta_ = other.meta_.Clone(); + ratings_ = other.ratings_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamMovies Clone() { + return new StreamMovies(this); + } + + /// Field number for the "Skip" field. + public const int SkipFieldNumber = 1; + private int skip_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Skip { + get { return skip_; } + set { + skip_ = value; + } + } + + /// Field number for the "Take" field. + public const int TakeFieldNumber = 2; + private int take_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Take { + get { return take_; } + set { + take_ = value; + } + } + + /// Field number for the "OrderBy" field. + public const int OrderByFieldNumber = 3; + private string orderBy_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderBy { + get { return orderBy_; } + set { + orderBy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "OrderByDesc" field. + public const int OrderByDescFieldNumber = 4; + private string orderByDesc_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OrderByDesc { + get { return orderByDesc_; } + set { + orderByDesc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Include" field. + public const int IncludeFieldNumber = 5; + private string include_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Include { + get { return include_; } + set { + include_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Fields" field. + public const int FieldsFieldNumber = 6; + private string fields_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Fields { + get { return fields_; } + set { + fields_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 7; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 58); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "Ratings" field. + public const int RatingsFieldNumber = 201; + private static readonly pb::FieldCodec _repeated_ratings_codec + = pb::FieldCodec.ForString(1610); + private readonly pbc::RepeatedField ratings_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ratings { + get { return ratings_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StreamMovies); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StreamMovies other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Skip != other.Skip) return false; + if (Take != other.Take) return false; + if (OrderBy != other.OrderBy) return false; + if (OrderByDesc != other.OrderByDesc) return false; + if (Include != other.Include) return false; + if (Fields != other.Fields) return false; + if (!Meta.Equals(other.Meta)) return false; + if(!ratings_.Equals(other.ratings_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Skip != 0) hash ^= Skip.GetHashCode(); + if (Take != 0) hash ^= Take.GetHashCode(); + if (OrderBy.Length != 0) hash ^= OrderBy.GetHashCode(); + if (OrderByDesc.Length != 0) hash ^= OrderByDesc.GetHashCode(); + if (Include.Length != 0) hash ^= Include.GetHashCode(); + if (Fields.Length != 0) hash ^= Fields.GetHashCode(); + hash ^= Meta.GetHashCode(); + hash ^= ratings_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Skip != 0) { + output.WriteRawTag(8); + output.WriteInt32(Skip); + } + if (Take != 0) { + output.WriteRawTag(16); + output.WriteInt32(Take); + } + if (OrderBy.Length != 0) { + output.WriteRawTag(26); + output.WriteString(OrderBy); + } + if (OrderByDesc.Length != 0) { + output.WriteRawTag(34); + output.WriteString(OrderByDesc); + } + if (Include.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Include); + } + if (Fields.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Fields); + } + meta_.WriteTo(output, _map_meta_codec); + ratings_.WriteTo(output, _repeated_ratings_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Skip != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Skip); + } + if (Take != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Take); + } + if (OrderBy.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderBy); + } + if (OrderByDesc.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OrderByDesc); + } + if (Include.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Include); + } + if (Fields.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Fields); + } + size += meta_.CalculateSize(_map_meta_codec); + size += ratings_.CalculateSize(_repeated_ratings_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StreamMovies other) { + if (other == null) { + return; + } + if (other.Skip != 0) { + Skip = other.Skip; + } + if (other.Take != 0) { + Take = other.Take; + } + if (other.OrderBy.Length != 0) { + OrderBy = other.OrderBy; + } + if (other.OrderByDesc.Length != 0) { + OrderByDesc = other.OrderByDesc; + } + if (other.Include.Length != 0) { + Include = other.Include; + } + if (other.Fields.Length != 0) { + Fields = other.Fields; + } + meta_.Add(other.meta_); + ratings_.Add(other.ratings_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Skip = input.ReadInt32(); + break; + } + case 16: { + Take = input.ReadInt32(); + break; + } + case 26: { + OrderBy = input.ReadString(); + break; + } + case 34: { + OrderByDesc = input.ReadString(); + break; + } + case 42: { + Include = input.ReadString(); + break; + } + case 50: { + Fields = input.ReadString(); + break; + } + case 58: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 1610: { + ratings_.AddEntriesFrom(input, _repeated_ratings_codec); + break; + } + } + } + } + + } + + public sealed partial class StreamServerEvents : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StreamServerEvents()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[185]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamServerEvents() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamServerEvents(StreamServerEvents other) : this() { + channels_ = other.channels_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamServerEvents Clone() { + return new StreamServerEvents(this); + } + + /// Field number for the "Channels" field. + public const int ChannelsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_channels_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField channels_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Channels { + get { return channels_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StreamServerEvents); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StreamServerEvents other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!channels_.Equals(other.channels_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= channels_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + channels_.WriteTo(output, _repeated_channels_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += channels_.CalculateSize(_repeated_channels_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StreamServerEvents other) { + if (other == null) { + return; + } + channels_.Add(other.channels_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + channels_.AddEntriesFrom(input, _repeated_channels_codec); + break; + } + } + } + } + + } + + public sealed partial class StreamServerEventsResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StreamServerEventsResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[186]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamServerEventsResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamServerEventsResponse(StreamServerEventsResponse other) : this() { + eventId_ = other.eventId_; + channel_ = other.channel_; + selector_ = other.selector_; + json_ = other.json_; + op_ = other.op_; + target_ = other.target_; + cssSelector_ = other.cssSelector_; + meta_ = other.meta_.Clone(); + userId_ = other.userId_; + displayName_ = other.displayName_; + profileUrl_ = other.profileUrl_; + isAuthenticated_ = other.isAuthenticated_; + channels_ = other.channels_.Clone(); + createdAt_ = other.createdAt_; + id_ = other.id_; + unRegisterUrl_ = other.unRegisterUrl_; + updateSubscriberUrl_ = other.updateSubscriberUrl_; + heartbeatUrl_ = other.heartbeatUrl_; + heartbeatIntervalMs_ = other.heartbeatIntervalMs_; + idleTimeoutMs_ = other.idleTimeoutMs_; + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StreamServerEventsResponse Clone() { + return new StreamServerEventsResponse(this); + } + + /// Field number for the "EventId" field. + public const int EventIdFieldNumber = 1; + private long eventId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long EventId { + get { return eventId_; } + set { + eventId_ = value; + } + } + + /// Field number for the "Channel" field. + public const int ChannelFieldNumber = 2; + private string channel_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Channel { + get { return channel_; } + set { + channel_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Selector" field. + public const int SelectorFieldNumber = 4; + private string selector_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Selector { + get { return selector_; } + set { + selector_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Json" field. + public const int JsonFieldNumber = 5; + private string json_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Json { + get { return json_; } + set { + json_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Op" field. + public const int OpFieldNumber = 6; + private string op_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Op { + get { return op_; } + set { + op_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Target" field. + public const int TargetFieldNumber = 7; + private string target_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Target { + get { return target_; } + set { + target_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "CssSelector" field. + public const int CssSelectorFieldNumber = 8; + private string cssSelector_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CssSelector { + get { return cssSelector_; } + set { + cssSelector_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 9; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 74); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "UserId" field. + public const int UserIdFieldNumber = 10; + private string userId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserId { + get { return userId_; } + set { + userId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "DisplayName" field. + public const int DisplayNameFieldNumber = 11; + private string displayName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string DisplayName { + get { return displayName_; } + set { + displayName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ProfileUrl" field. + public const int ProfileUrlFieldNumber = 12; + private string profileUrl_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ProfileUrl { + get { return profileUrl_; } + set { + profileUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "IsAuthenticated" field. + public const int IsAuthenticatedFieldNumber = 13; + private bool isAuthenticated_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool IsAuthenticated { + get { return isAuthenticated_; } + set { + isAuthenticated_ = value; + } + } + + /// Field number for the "Channels" field. + public const int ChannelsFieldNumber = 14; + private static readonly pb::FieldCodec _repeated_channels_codec + = pb::FieldCodec.ForString(114); + private readonly pbc::RepeatedField channels_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Channels { + get { return channels_; } + } + + /// Field number for the "CreatedAt" field. + public const int CreatedAtFieldNumber = 15; + private long createdAt_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long CreatedAt { + get { return createdAt_; } + set { + createdAt_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 21; + private string id_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "UnRegisterUrl" field. + public const int UnRegisterUrlFieldNumber = 22; + private string unRegisterUrl_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UnRegisterUrl { + get { return unRegisterUrl_; } + set { + unRegisterUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "UpdateSubscriberUrl" field. + public const int UpdateSubscriberUrlFieldNumber = 23; + private string updateSubscriberUrl_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UpdateSubscriberUrl { + get { return updateSubscriberUrl_; } + set { + updateSubscriberUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "HeartbeatUrl" field. + public const int HeartbeatUrlFieldNumber = 24; + private string heartbeatUrl_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string HeartbeatUrl { + get { return heartbeatUrl_; } + set { + heartbeatUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "HeartbeatIntervalMs" field. + public const int HeartbeatIntervalMsFieldNumber = 25; + private long heartbeatIntervalMs_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long HeartbeatIntervalMs { + get { return heartbeatIntervalMs_; } + set { + heartbeatIntervalMs_ = value; + } + } + + /// Field number for the "IdleTimeoutMs" field. + public const int IdleTimeoutMsFieldNumber = 26; + private long idleTimeoutMs_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long IdleTimeoutMs { + get { return idleTimeoutMs_; } + set { + idleTimeoutMs_ = value; + } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 30; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StreamServerEventsResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StreamServerEventsResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (EventId != other.EventId) return false; + if (Channel != other.Channel) return false; + if (Selector != other.Selector) return false; + if (Json != other.Json) return false; + if (Op != other.Op) return false; + if (Target != other.Target) return false; + if (CssSelector != other.CssSelector) return false; + if (!Meta.Equals(other.Meta)) return false; + if (UserId != other.UserId) return false; + if (DisplayName != other.DisplayName) return false; + if (ProfileUrl != other.ProfileUrl) return false; + if (IsAuthenticated != other.IsAuthenticated) return false; + if(!channels_.Equals(other.channels_)) return false; + if (CreatedAt != other.CreatedAt) return false; + if (Id != other.Id) return false; + if (UnRegisterUrl != other.UnRegisterUrl) return false; + if (UpdateSubscriberUrl != other.UpdateSubscriberUrl) return false; + if (HeartbeatUrl != other.HeartbeatUrl) return false; + if (HeartbeatIntervalMs != other.HeartbeatIntervalMs) return false; + if (IdleTimeoutMs != other.IdleTimeoutMs) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (EventId != 0L) hash ^= EventId.GetHashCode(); + if (Channel.Length != 0) hash ^= Channel.GetHashCode(); + if (Selector.Length != 0) hash ^= Selector.GetHashCode(); + if (Json.Length != 0) hash ^= Json.GetHashCode(); + if (Op.Length != 0) hash ^= Op.GetHashCode(); + if (Target.Length != 0) hash ^= Target.GetHashCode(); + if (CssSelector.Length != 0) hash ^= CssSelector.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (UserId.Length != 0) hash ^= UserId.GetHashCode(); + if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); + if (ProfileUrl.Length != 0) hash ^= ProfileUrl.GetHashCode(); + if (IsAuthenticated != false) hash ^= IsAuthenticated.GetHashCode(); + hash ^= channels_.GetHashCode(); + if (CreatedAt != 0L) hash ^= CreatedAt.GetHashCode(); + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (UnRegisterUrl.Length != 0) hash ^= UnRegisterUrl.GetHashCode(); + if (UpdateSubscriberUrl.Length != 0) hash ^= UpdateSubscriberUrl.GetHashCode(); + if (HeartbeatUrl.Length != 0) hash ^= HeartbeatUrl.GetHashCode(); + if (HeartbeatIntervalMs != 0L) hash ^= HeartbeatIntervalMs.GetHashCode(); + if (IdleTimeoutMs != 0L) hash ^= IdleTimeoutMs.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (EventId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(EventId); + } + if (Channel.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Channel); + } + if (Selector.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Selector); + } + if (Json.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Json); + } + if (Op.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Op); + } + if (Target.Length != 0) { + output.WriteRawTag(58); + output.WriteString(Target); + } + if (CssSelector.Length != 0) { + output.WriteRawTag(66); + output.WriteString(CssSelector); + } + meta_.WriteTo(output, _map_meta_codec); + if (UserId.Length != 0) { + output.WriteRawTag(82); + output.WriteString(UserId); + } + if (DisplayName.Length != 0) { + output.WriteRawTag(90); + output.WriteString(DisplayName); + } + if (ProfileUrl.Length != 0) { + output.WriteRawTag(98); + output.WriteString(ProfileUrl); + } + if (IsAuthenticated != false) { + output.WriteRawTag(104); + output.WriteBool(IsAuthenticated); + } + channels_.WriteTo(output, _repeated_channels_codec); + if (CreatedAt != 0L) { + output.WriteRawTag(120); + output.WriteInt64(CreatedAt); + } + if (Id.Length != 0) { + output.WriteRawTag(170, 1); + output.WriteString(Id); + } + if (UnRegisterUrl.Length != 0) { + output.WriteRawTag(178, 1); + output.WriteString(UnRegisterUrl); + } + if (UpdateSubscriberUrl.Length != 0) { + output.WriteRawTag(186, 1); + output.WriteString(UpdateSubscriberUrl); + } + if (HeartbeatUrl.Length != 0) { + output.WriteRawTag(194, 1); + output.WriteString(HeartbeatUrl); + } + if (HeartbeatIntervalMs != 0L) { + output.WriteRawTag(200, 1); + output.WriteInt64(HeartbeatIntervalMs); + } + if (IdleTimeoutMs != 0L) { + output.WriteRawTag(208, 1); + output.WriteInt64(IdleTimeoutMs); + } + if (responseStatus_ != null) { + output.WriteRawTag(242, 1); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (EventId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(EventId); + } + if (Channel.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Channel); + } + if (Selector.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Selector); + } + if (Json.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Json); + } + if (Op.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Op); + } + if (Target.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Target); + } + if (CssSelector.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CssSelector); + } + size += meta_.CalculateSize(_map_meta_codec); + if (UserId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserId); + } + if (DisplayName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DisplayName); + } + if (ProfileUrl.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ProfileUrl); + } + if (IsAuthenticated != false) { + size += 1 + 1; + } + size += channels_.CalculateSize(_repeated_channels_codec); + if (CreatedAt != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(CreatedAt); + } + if (Id.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (UnRegisterUrl.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(UnRegisterUrl); + } + if (UpdateSubscriberUrl.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(UpdateSubscriberUrl); + } + if (HeartbeatUrl.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(HeartbeatUrl); + } + if (HeartbeatIntervalMs != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(HeartbeatIntervalMs); + } + if (IdleTimeoutMs != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(IdleTimeoutMs); + } + if (responseStatus_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StreamServerEventsResponse other) { + if (other == null) { + return; + } + if (other.EventId != 0L) { + EventId = other.EventId; + } + if (other.Channel.Length != 0) { + Channel = other.Channel; + } + if (other.Selector.Length != 0) { + Selector = other.Selector; + } + if (other.Json.Length != 0) { + Json = other.Json; + } + if (other.Op.Length != 0) { + Op = other.Op; + } + if (other.Target.Length != 0) { + Target = other.Target; + } + if (other.CssSelector.Length != 0) { + CssSelector = other.CssSelector; + } + meta_.Add(other.meta_); + if (other.UserId.Length != 0) { + UserId = other.UserId; + } + if (other.DisplayName.Length != 0) { + DisplayName = other.DisplayName; + } + if (other.ProfileUrl.Length != 0) { + ProfileUrl = other.ProfileUrl; + } + if (other.IsAuthenticated != false) { + IsAuthenticated = other.IsAuthenticated; + } + channels_.Add(other.channels_); + if (other.CreatedAt != 0L) { + CreatedAt = other.CreatedAt; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + if (other.UnRegisterUrl.Length != 0) { + UnRegisterUrl = other.UnRegisterUrl; + } + if (other.UpdateSubscriberUrl.Length != 0) { + UpdateSubscriberUrl = other.UpdateSubscriberUrl; + } + if (other.HeartbeatUrl.Length != 0) { + HeartbeatUrl = other.HeartbeatUrl; + } + if (other.HeartbeatIntervalMs != 0L) { + HeartbeatIntervalMs = other.HeartbeatIntervalMs; + } + if (other.IdleTimeoutMs != 0L) { + IdleTimeoutMs = other.IdleTimeoutMs; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + EventId = input.ReadInt64(); + break; + } + case 18: { + Channel = input.ReadString(); + break; + } + case 34: { + Selector = input.ReadString(); + break; + } + case 42: { + Json = input.ReadString(); + break; + } + case 50: { + Op = input.ReadString(); + break; + } + case 58: { + Target = input.ReadString(); + break; + } + case 66: { + CssSelector = input.ReadString(); + break; + } + case 74: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 82: { + UserId = input.ReadString(); + break; + } + case 90: { + DisplayName = input.ReadString(); + break; + } + case 98: { + ProfileUrl = input.ReadString(); + break; + } + case 104: { + IsAuthenticated = input.ReadBool(); + break; + } + case 114: { + channels_.AddEntriesFrom(input, _repeated_channels_codec); + break; + } + case 120: { + CreatedAt = input.ReadInt64(); + break; + } + case 170: { + Id = input.ReadString(); + break; + } + case 178: { + UnRegisterUrl = input.ReadString(); + break; + } + case 186: { + UpdateSubscriberUrl = input.ReadString(); + break; + } + case 194: { + HeartbeatUrl = input.ReadString(); + break; + } + case 200: { + HeartbeatIntervalMs = input.ReadInt64(); + break; + } + case 208: { + IdleTimeoutMs = input.ReadInt64(); + break; + } + case 242: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class TestAuthValidators : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestAuthValidators()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[187]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestAuthValidators() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestAuthValidators(TestAuthValidators other) : this() { + notNull_ = other.notNull_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestAuthValidators Clone() { + return new TestAuthValidators(this); + } + + /// Field number for the "NotNull" field. + public const int NotNullFieldNumber = 1; + private string notNull_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotNull { + get { return notNull_; } + set { + notNull_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestAuthValidators); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestAuthValidators other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (NotNull != other.NotNull) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (NotNull.Length != 0) hash ^= NotNull.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (NotNull.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NotNull); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (NotNull.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotNull); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestAuthValidators other) { + if (other == null) { + return; + } + if (other.NotNull.Length != 0) { + NotNull = other.NotNull; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + NotNull = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class TestDbCondition : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestDbCondition()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[188]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestDbCondition() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestDbCondition(TestDbCondition other) : this() { + id_ = other.id_; + notNull_ = other.notNull_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestDbCondition Clone() { + return new TestDbCondition(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "NotNull" field. + public const int NotNullFieldNumber = 2; + private string notNull_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotNull { + get { return notNull_; } + set { + notNull_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestDbCondition); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestDbCondition other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (NotNull != other.NotNull) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (NotNull.Length != 0) hash ^= NotNull.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (NotNull.Length != 0) { + output.WriteRawTag(18); + output.WriteString(NotNull); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (NotNull.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotNull); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestDbCondition other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.NotNull.Length != 0) { + NotNull = other.NotNull; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + NotNull = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class TestDbValidator : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestDbValidator()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[189]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestDbValidator() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestDbValidator(TestDbValidator other) : this() { + id_ = other.id_; + notNull_ = other.notNull_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestDbValidator Clone() { + return new TestDbValidator(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "NotNull" field. + public const int NotNullFieldNumber = 2; + private string notNull_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotNull { + get { return notNull_; } + set { + notNull_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestDbValidator); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestDbValidator other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (NotNull != other.NotNull) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (NotNull.Length != 0) hash ^= NotNull.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (NotNull.Length != 0) { + output.WriteRawTag(18); + output.WriteString(NotNull); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (NotNull.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotNull); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestDbValidator other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.NotNull.Length != 0) { + NotNull = other.NotNull; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + NotNull = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class TestIsAdmin : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestIsAdmin()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[190]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestIsAdmin() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestIsAdmin(TestIsAdmin other) : this() { + notNull_ = other.notNull_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestIsAdmin Clone() { + return new TestIsAdmin(this); + } + + /// Field number for the "NotNull" field. + public const int NotNullFieldNumber = 1; + private string notNull_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotNull { + get { return notNull_; } + set { + notNull_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestIsAdmin); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestIsAdmin other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (NotNull != other.NotNull) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (NotNull.Length != 0) hash ^= NotNull.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (NotNull.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NotNull); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (NotNull.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotNull); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestIsAdmin other) { + if (other == null) { + return; + } + if (other.NotNull.Length != 0) { + NotNull = other.NotNull; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + NotNull = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class TestMultiAuthValidators : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMultiAuthValidators()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[191]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestMultiAuthValidators() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestMultiAuthValidators(TestMultiAuthValidators other) : this() { + notNull_ = other.notNull_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestMultiAuthValidators Clone() { + return new TestMultiAuthValidators(this); + } + + /// Field number for the "NotNull" field. + public const int NotNullFieldNumber = 1; + private string notNull_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotNull { + get { return notNull_; } + set { + notNull_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestMultiAuthValidators); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestMultiAuthValidators other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (NotNull != other.NotNull) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (NotNull.Length != 0) hash ^= NotNull.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (NotNull.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NotNull); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (NotNull.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotNull); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestMultiAuthValidators other) { + if (other == null) { + return; + } + if (other.NotNull.Length != 0) { + NotNull = other.NotNull; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + NotNull = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class Throw : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Throw()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[192]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Throw() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Throw(Throw other) : this() { + message_ = other.message_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Throw Clone() { + return new Throw(this); + } + + /// Field number for the "Message" field. + public const int MessageFieldNumber = 1; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Throw); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Throw other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Message != other.Message) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Message.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Message); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Throw other) { + if (other == null) { + return; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Message = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class ThrowCustom : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ThrowCustom()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[193]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ThrowCustom() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ThrowCustom(ThrowCustom other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ThrowCustom Clone() { + return new ThrowCustom(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ThrowCustom); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ThrowCustom other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ThrowCustom other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class ThrowCustomResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ThrowCustomResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[194]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ThrowCustomResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ThrowCustomResponse(ThrowCustomResponse other) : this() { + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ThrowCustomResponse Clone() { + return new ThrowCustomResponse(this); + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 1; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ThrowCustomResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ThrowCustomResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (responseStatus_ != null) { + output.WriteRawTag(10); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ThrowCustomResponse other) { + if (other == null) { + return; + } + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class ThrowVoid : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ThrowVoid()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[195]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ThrowVoid() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ThrowVoid(ThrowVoid other) : this() { + message_ = other.message_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ThrowVoid Clone() { + return new ThrowVoid(this); + } + + /// Field number for the "Message" field. + public const int MessageFieldNumber = 1; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ThrowVoid); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ThrowVoid other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Message != other.Message) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Message.Length != 0) hash ^= Message.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Message.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Message); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ThrowVoid other) { + if (other == null) { + return; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Message = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class Todo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Todo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[196]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Todo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Todo(Todo other) : this() { + id_ = other.id_; + title_ = other.title_; + order_ = other.order_; + completed_ = other.completed_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Todo Clone() { + return new Todo(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private long id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Title" field. + public const int TitleFieldNumber = 2; + private string title_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Title { + get { return title_; } + set { + title_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Order" field. + public const int OrderFieldNumber = 3; + private int order_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Order { + get { return order_; } + set { + order_ = value; + } + } + + /// Field number for the "Completed" field. + public const int CompletedFieldNumber = 4; + private bool completed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Completed { + get { return completed_; } + set { + completed_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Todo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Todo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Title != other.Title) return false; + if (Order != other.Order) return false; + if (Completed != other.Completed) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0L) hash ^= Id.GetHashCode(); + if (Title.Length != 0) hash ^= Title.GetHashCode(); + if (Order != 0) hash ^= Order.GetHashCode(); + if (Completed != false) hash ^= Completed.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Id); + } + if (Title.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Title); + } + if (Order != 0) { + output.WriteRawTag(24); + output.WriteInt32(Order); + } + if (Completed != false) { + output.WriteRawTag(32); + output.WriteBool(Completed); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); + } + if (Title.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Title); + } + if (Order != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Order); + } + if (Completed != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Todo other) { + if (other == null) { + return; + } + if (other.Id != 0L) { + Id = other.Id; + } + if (other.Title.Length != 0) { + Title = other.Title; + } + if (other.Order != 0) { + Order = other.Order; + } + if (other.Completed != false) { + Completed = other.Completed; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt64(); + break; + } + case 18: { + Title = input.ReadString(); + break; + } + case 24: { + Order = input.ReadInt32(); + break; + } + case 32: { + Completed = input.ReadBool(); + break; + } + } + } + } + + } + + public sealed partial class TriggerAllValidators : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TriggerAllValidators()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[197]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TriggerAllValidators() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TriggerAllValidators(TriggerAllValidators other) : this() { + creditCard_ = other.creditCard_; + email_ = other.email_; + empty_ = other.empty_; + equal_ = other.equal_; + exclusiveBetween_ = other.exclusiveBetween_; + greaterThanOrEqual_ = other.greaterThanOrEqual_; + greaterThan_ = other.greaterThan_; + inclusiveBetween_ = other.inclusiveBetween_; + length_ = other.length_; + lessThanOrEqual_ = other.lessThanOrEqual_; + lessThan_ = other.lessThan_; + notEmpty_ = other.notEmpty_; + notEqual_ = other.notEqual_; + null_ = other.null_; + regularExpression_ = other.regularExpression_; + scalePrecision_ = other.scalePrecision_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TriggerAllValidators Clone() { + return new TriggerAllValidators(this); + } + + /// Field number for the "CreditCard" field. + public const int CreditCardFieldNumber = 1; + private string creditCard_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CreditCard { + get { return creditCard_; } + set { + creditCard_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Email" field. + public const int EmailFieldNumber = 2; + private string email_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Email { + get { return email_; } + set { + email_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Empty" field. + public const int EmptyFieldNumber = 3; + private string empty_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Empty { + get { return empty_; } + set { + empty_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Equal" field. + public const int EqualFieldNumber = 4; + private string equal_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Equal { + get { return equal_; } + set { + equal_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ExclusiveBetween" field. + public const int ExclusiveBetweenFieldNumber = 5; + private int exclusiveBetween_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ExclusiveBetween { + get { return exclusiveBetween_; } + set { + exclusiveBetween_ = value; + } + } + + /// Field number for the "GreaterThanOrEqual" field. + public const int GreaterThanOrEqualFieldNumber = 6; + private int greaterThanOrEqual_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int GreaterThanOrEqual { + get { return greaterThanOrEqual_; } + set { + greaterThanOrEqual_ = value; + } + } + + /// Field number for the "GreaterThan" field. + public const int GreaterThanFieldNumber = 7; + private int greaterThan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int GreaterThan { + get { return greaterThan_; } + set { + greaterThan_ = value; + } + } + + /// Field number for the "InclusiveBetween" field. + public const int InclusiveBetweenFieldNumber = 8; + private int inclusiveBetween_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int InclusiveBetween { + get { return inclusiveBetween_; } + set { + inclusiveBetween_ = value; + } + } + + /// Field number for the "Length" field. + public const int LengthFieldNumber = 9; + private string length_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Length { + get { return length_; } + set { + length_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LessThanOrEqual" field. + public const int LessThanOrEqualFieldNumber = 10; + private int lessThanOrEqual_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int LessThanOrEqual { + get { return lessThanOrEqual_; } + set { + lessThanOrEqual_ = value; + } + } + + /// Field number for the "LessThan" field. + public const int LessThanFieldNumber = 11; + private int lessThan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int LessThan { + get { return lessThan_; } + set { + lessThan_ = value; + } + } + + /// Field number for the "NotEmpty" field. + public const int NotEmptyFieldNumber = 12; + private string notEmpty_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotEmpty { + get { return notEmpty_; } + set { + notEmpty_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "NotEqual" field. + public const int NotEqualFieldNumber = 13; + private string notEqual_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotEqual { + get { return notEqual_; } + set { + notEqual_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Null" field. + public const int NullFieldNumber = 14; + private string null_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Null { + get { return null_; } + set { + null_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RegularExpression" field. + public const int RegularExpressionFieldNumber = 15; + private string regularExpression_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RegularExpression { + get { return regularExpression_; } + set { + regularExpression_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ScalePrecision" field. + public const int ScalePrecisionFieldNumber = 16; + private string scalePrecision_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ScalePrecision { + get { return scalePrecision_; } + set { + scalePrecision_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TriggerAllValidators); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TriggerAllValidators other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (CreditCard != other.CreditCard) return false; + if (Email != other.Email) return false; + if (Empty != other.Empty) return false; + if (Equal != other.Equal) return false; + if (ExclusiveBetween != other.ExclusiveBetween) return false; + if (GreaterThanOrEqual != other.GreaterThanOrEqual) return false; + if (GreaterThan != other.GreaterThan) return false; + if (InclusiveBetween != other.InclusiveBetween) return false; + if (Length != other.Length) return false; + if (LessThanOrEqual != other.LessThanOrEqual) return false; + if (LessThan != other.LessThan) return false; + if (NotEmpty != other.NotEmpty) return false; + if (NotEqual != other.NotEqual) return false; + if (Null != other.Null) return false; + if (RegularExpression != other.RegularExpression) return false; + if (ScalePrecision != other.ScalePrecision) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (CreditCard.Length != 0) hash ^= CreditCard.GetHashCode(); + if (Email.Length != 0) hash ^= Email.GetHashCode(); + if (Empty.Length != 0) hash ^= Empty.GetHashCode(); + if (Equal.Length != 0) hash ^= Equal.GetHashCode(); + if (ExclusiveBetween != 0) hash ^= ExclusiveBetween.GetHashCode(); + if (GreaterThanOrEqual != 0) hash ^= GreaterThanOrEqual.GetHashCode(); + if (GreaterThan != 0) hash ^= GreaterThan.GetHashCode(); + if (InclusiveBetween != 0) hash ^= InclusiveBetween.GetHashCode(); + if (Length.Length != 0) hash ^= Length.GetHashCode(); + if (LessThanOrEqual != 0) hash ^= LessThanOrEqual.GetHashCode(); + if (LessThan != 0) hash ^= LessThan.GetHashCode(); + if (NotEmpty.Length != 0) hash ^= NotEmpty.GetHashCode(); + if (NotEqual.Length != 0) hash ^= NotEqual.GetHashCode(); + if (Null.Length != 0) hash ^= Null.GetHashCode(); + if (RegularExpression.Length != 0) hash ^= RegularExpression.GetHashCode(); + if (ScalePrecision.Length != 0) hash ^= ScalePrecision.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (CreditCard.Length != 0) { + output.WriteRawTag(10); + output.WriteString(CreditCard); + } + if (Email.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Email); + } + if (Empty.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Empty); + } + if (Equal.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Equal); + } + if (ExclusiveBetween != 0) { + output.WriteRawTag(40); + output.WriteInt32(ExclusiveBetween); + } + if (GreaterThanOrEqual != 0) { + output.WriteRawTag(48); + output.WriteInt32(GreaterThanOrEqual); + } + if (GreaterThan != 0) { + output.WriteRawTag(56); + output.WriteInt32(GreaterThan); + } + if (InclusiveBetween != 0) { + output.WriteRawTag(64); + output.WriteInt32(InclusiveBetween); + } + if (Length.Length != 0) { + output.WriteRawTag(74); + output.WriteString(Length); + } + if (LessThanOrEqual != 0) { + output.WriteRawTag(80); + output.WriteInt32(LessThanOrEqual); + } + if (LessThan != 0) { + output.WriteRawTag(88); + output.WriteInt32(LessThan); + } + if (NotEmpty.Length != 0) { + output.WriteRawTag(98); + output.WriteString(NotEmpty); + } + if (NotEqual.Length != 0) { + output.WriteRawTag(106); + output.WriteString(NotEqual); + } + if (Null.Length != 0) { + output.WriteRawTag(114); + output.WriteString(Null); + } + if (RegularExpression.Length != 0) { + output.WriteRawTag(122); + output.WriteString(RegularExpression); + } + if (ScalePrecision.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteString(ScalePrecision); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (CreditCard.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CreditCard); + } + if (Email.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); + } + if (Empty.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Empty); + } + if (Equal.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Equal); + } + if (ExclusiveBetween != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ExclusiveBetween); + } + if (GreaterThanOrEqual != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(GreaterThanOrEqual); + } + if (GreaterThan != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(GreaterThan); + } + if (InclusiveBetween != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(InclusiveBetween); + } + if (Length.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Length); + } + if (LessThanOrEqual != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LessThanOrEqual); + } + if (LessThan != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LessThan); + } + if (NotEmpty.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotEmpty); + } + if (NotEqual.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotEqual); + } + if (Null.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Null); + } + if (RegularExpression.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RegularExpression); + } + if (ScalePrecision.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(ScalePrecision); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TriggerAllValidators other) { + if (other == null) { + return; + } + if (other.CreditCard.Length != 0) { + CreditCard = other.CreditCard; + } + if (other.Email.Length != 0) { + Email = other.Email; + } + if (other.Empty.Length != 0) { + Empty = other.Empty; + } + if (other.Equal.Length != 0) { + Equal = other.Equal; + } + if (other.ExclusiveBetween != 0) { + ExclusiveBetween = other.ExclusiveBetween; + } + if (other.GreaterThanOrEqual != 0) { + GreaterThanOrEqual = other.GreaterThanOrEqual; + } + if (other.GreaterThan != 0) { + GreaterThan = other.GreaterThan; + } + if (other.InclusiveBetween != 0) { + InclusiveBetween = other.InclusiveBetween; + } + if (other.Length.Length != 0) { + Length = other.Length; + } + if (other.LessThanOrEqual != 0) { + LessThanOrEqual = other.LessThanOrEqual; + } + if (other.LessThan != 0) { + LessThan = other.LessThan; + } + if (other.NotEmpty.Length != 0) { + NotEmpty = other.NotEmpty; + } + if (other.NotEqual.Length != 0) { + NotEqual = other.NotEqual; + } + if (other.Null.Length != 0) { + Null = other.Null; + } + if (other.RegularExpression.Length != 0) { + RegularExpression = other.RegularExpression; + } + if (other.ScalePrecision.Length != 0) { + ScalePrecision = other.ScalePrecision; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + CreditCard = input.ReadString(); + break; + } + case 18: { + Email = input.ReadString(); + break; + } + case 26: { + Empty = input.ReadString(); + break; + } + case 34: { + Equal = input.ReadString(); + break; + } + case 40: { + ExclusiveBetween = input.ReadInt32(); + break; + } + case 48: { + GreaterThanOrEqual = input.ReadInt32(); + break; + } + case 56: { + GreaterThan = input.ReadInt32(); + break; + } + case 64: { + InclusiveBetween = input.ReadInt32(); + break; + } + case 74: { + Length = input.ReadString(); + break; + } + case 80: { + LessThanOrEqual = input.ReadInt32(); + break; + } + case 88: { + LessThan = input.ReadInt32(); + break; + } + case 98: { + NotEmpty = input.ReadString(); + break; + } + case 106: { + NotEqual = input.ReadString(); + break; + } + case 114: { + Null = input.ReadString(); + break; + } + case 122: { + RegularExpression = input.ReadString(); + break; + } + case 130: { + ScalePrecision = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class TriggerValidators : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TriggerValidators()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[198]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TriggerValidators() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TriggerValidators(TriggerValidators other) : this() { + creditCard_ = other.creditCard_; + email_ = other.email_; + empty_ = other.empty_; + equal_ = other.equal_; + exclusiveBetween_ = other.exclusiveBetween_; + greaterThanOrEqual_ = other.greaterThanOrEqual_; + greaterThan_ = other.greaterThan_; + inclusiveBetween_ = other.inclusiveBetween_; + length_ = other.length_; + lessThanOrEqual_ = other.lessThanOrEqual_; + lessThan_ = other.lessThan_; + notEmpty_ = other.notEmpty_; + notEqual_ = other.notEqual_; + null_ = other.null_; + regularExpression_ = other.regularExpression_; + scalePrecision_ = other.scalePrecision_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TriggerValidators Clone() { + return new TriggerValidators(this); + } + + /// Field number for the "CreditCard" field. + public const int CreditCardFieldNumber = 1; + private string creditCard_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CreditCard { + get { return creditCard_; } + set { + creditCard_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Email" field. + public const int EmailFieldNumber = 2; + private string email_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Email { + get { return email_; } + set { + email_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Empty" field. + public const int EmptyFieldNumber = 3; + private string empty_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Empty { + get { return empty_; } + set { + empty_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Equal" field. + public const int EqualFieldNumber = 4; + private string equal_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Equal { + get { return equal_; } + set { + equal_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ExclusiveBetween" field. + public const int ExclusiveBetweenFieldNumber = 5; + private int exclusiveBetween_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int ExclusiveBetween { + get { return exclusiveBetween_; } + set { + exclusiveBetween_ = value; + } + } + + /// Field number for the "GreaterThanOrEqual" field. + public const int GreaterThanOrEqualFieldNumber = 6; + private int greaterThanOrEqual_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int GreaterThanOrEqual { + get { return greaterThanOrEqual_; } + set { + greaterThanOrEqual_ = value; + } + } + + /// Field number for the "GreaterThan" field. + public const int GreaterThanFieldNumber = 7; + private int greaterThan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int GreaterThan { + get { return greaterThan_; } + set { + greaterThan_ = value; + } + } + + /// Field number for the "InclusiveBetween" field. + public const int InclusiveBetweenFieldNumber = 8; + private int inclusiveBetween_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int InclusiveBetween { + get { return inclusiveBetween_; } + set { + inclusiveBetween_ = value; + } + } + + /// Field number for the "Length" field. + public const int LengthFieldNumber = 9; + private string length_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Length { + get { return length_; } + set { + length_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LessThanOrEqual" field. + public const int LessThanOrEqualFieldNumber = 10; + private int lessThanOrEqual_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int LessThanOrEqual { + get { return lessThanOrEqual_; } + set { + lessThanOrEqual_ = value; + } + } + + /// Field number for the "LessThan" field. + public const int LessThanFieldNumber = 11; + private int lessThan_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int LessThan { + get { return lessThan_; } + set { + lessThan_ = value; + } + } + + /// Field number for the "NotEmpty" field. + public const int NotEmptyFieldNumber = 12; + private string notEmpty_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotEmpty { + get { return notEmpty_; } + set { + notEmpty_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "NotEqual" field. + public const int NotEqualFieldNumber = 13; + private string notEqual_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NotEqual { + get { return notEqual_; } + set { + notEqual_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Null" field. + public const int NullFieldNumber = 14; + private string null_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Null { + get { return null_; } + set { + null_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RegularExpression" field. + public const int RegularExpressionFieldNumber = 15; + private string regularExpression_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RegularExpression { + get { return regularExpression_; } + set { + regularExpression_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ScalePrecision" field. + public const int ScalePrecisionFieldNumber = 16; + private string scalePrecision_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ScalePrecision { + get { return scalePrecision_; } + set { + scalePrecision_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TriggerValidators); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TriggerValidators other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (CreditCard != other.CreditCard) return false; + if (Email != other.Email) return false; + if (Empty != other.Empty) return false; + if (Equal != other.Equal) return false; + if (ExclusiveBetween != other.ExclusiveBetween) return false; + if (GreaterThanOrEqual != other.GreaterThanOrEqual) return false; + if (GreaterThan != other.GreaterThan) return false; + if (InclusiveBetween != other.InclusiveBetween) return false; + if (Length != other.Length) return false; + if (LessThanOrEqual != other.LessThanOrEqual) return false; + if (LessThan != other.LessThan) return false; + if (NotEmpty != other.NotEmpty) return false; + if (NotEqual != other.NotEqual) return false; + if (Null != other.Null) return false; + if (RegularExpression != other.RegularExpression) return false; + if (ScalePrecision != other.ScalePrecision) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (CreditCard.Length != 0) hash ^= CreditCard.GetHashCode(); + if (Email.Length != 0) hash ^= Email.GetHashCode(); + if (Empty.Length != 0) hash ^= Empty.GetHashCode(); + if (Equal.Length != 0) hash ^= Equal.GetHashCode(); + if (ExclusiveBetween != 0) hash ^= ExclusiveBetween.GetHashCode(); + if (GreaterThanOrEqual != 0) hash ^= GreaterThanOrEqual.GetHashCode(); + if (GreaterThan != 0) hash ^= GreaterThan.GetHashCode(); + if (InclusiveBetween != 0) hash ^= InclusiveBetween.GetHashCode(); + if (Length.Length != 0) hash ^= Length.GetHashCode(); + if (LessThanOrEqual != 0) hash ^= LessThanOrEqual.GetHashCode(); + if (LessThan != 0) hash ^= LessThan.GetHashCode(); + if (NotEmpty.Length != 0) hash ^= NotEmpty.GetHashCode(); + if (NotEqual.Length != 0) hash ^= NotEqual.GetHashCode(); + if (Null.Length != 0) hash ^= Null.GetHashCode(); + if (RegularExpression.Length != 0) hash ^= RegularExpression.GetHashCode(); + if (ScalePrecision.Length != 0) hash ^= ScalePrecision.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (CreditCard.Length != 0) { + output.WriteRawTag(10); + output.WriteString(CreditCard); + } + if (Email.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Email); + } + if (Empty.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Empty); + } + if (Equal.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Equal); + } + if (ExclusiveBetween != 0) { + output.WriteRawTag(40); + output.WriteInt32(ExclusiveBetween); + } + if (GreaterThanOrEqual != 0) { + output.WriteRawTag(48); + output.WriteInt32(GreaterThanOrEqual); + } + if (GreaterThan != 0) { + output.WriteRawTag(56); + output.WriteInt32(GreaterThan); + } + if (InclusiveBetween != 0) { + output.WriteRawTag(64); + output.WriteInt32(InclusiveBetween); + } + if (Length.Length != 0) { + output.WriteRawTag(74); + output.WriteString(Length); + } + if (LessThanOrEqual != 0) { + output.WriteRawTag(80); + output.WriteInt32(LessThanOrEqual); + } + if (LessThan != 0) { + output.WriteRawTag(88); + output.WriteInt32(LessThan); + } + if (NotEmpty.Length != 0) { + output.WriteRawTag(98); + output.WriteString(NotEmpty); + } + if (NotEqual.Length != 0) { + output.WriteRawTag(106); + output.WriteString(NotEqual); + } + if (Null.Length != 0) { + output.WriteRawTag(114); + output.WriteString(Null); + } + if (RegularExpression.Length != 0) { + output.WriteRawTag(122); + output.WriteString(RegularExpression); + } + if (ScalePrecision.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteString(ScalePrecision); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (CreditCard.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CreditCard); + } + if (Email.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); + } + if (Empty.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Empty); + } + if (Equal.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Equal); + } + if (ExclusiveBetween != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ExclusiveBetween); + } + if (GreaterThanOrEqual != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(GreaterThanOrEqual); + } + if (GreaterThan != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(GreaterThan); + } + if (InclusiveBetween != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(InclusiveBetween); + } + if (Length.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Length); + } + if (LessThanOrEqual != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LessThanOrEqual); + } + if (LessThan != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LessThan); + } + if (NotEmpty.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotEmpty); + } + if (NotEqual.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NotEqual); + } + if (Null.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Null); + } + if (RegularExpression.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RegularExpression); + } + if (ScalePrecision.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(ScalePrecision); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TriggerValidators other) { + if (other == null) { + return; + } + if (other.CreditCard.Length != 0) { + CreditCard = other.CreditCard; + } + if (other.Email.Length != 0) { + Email = other.Email; + } + if (other.Empty.Length != 0) { + Empty = other.Empty; + } + if (other.Equal.Length != 0) { + Equal = other.Equal; + } + if (other.ExclusiveBetween != 0) { + ExclusiveBetween = other.ExclusiveBetween; + } + if (other.GreaterThanOrEqual != 0) { + GreaterThanOrEqual = other.GreaterThanOrEqual; + } + if (other.GreaterThan != 0) { + GreaterThan = other.GreaterThan; + } + if (other.InclusiveBetween != 0) { + InclusiveBetween = other.InclusiveBetween; + } + if (other.Length.Length != 0) { + Length = other.Length; + } + if (other.LessThanOrEqual != 0) { + LessThanOrEqual = other.LessThanOrEqual; + } + if (other.LessThan != 0) { + LessThan = other.LessThan; + } + if (other.NotEmpty.Length != 0) { + NotEmpty = other.NotEmpty; + } + if (other.NotEqual.Length != 0) { + NotEqual = other.NotEqual; + } + if (other.Null.Length != 0) { + Null = other.Null; + } + if (other.RegularExpression.Length != 0) { + RegularExpression = other.RegularExpression; + } + if (other.ScalePrecision.Length != 0) { + ScalePrecision = other.ScalePrecision; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + CreditCard = input.ReadString(); + break; + } + case 18: { + Email = input.ReadString(); + break; + } + case 26: { + Empty = input.ReadString(); + break; + } + case 34: { + Equal = input.ReadString(); + break; + } + case 40: { + ExclusiveBetween = input.ReadInt32(); + break; + } + case 48: { + GreaterThanOrEqual = input.ReadInt32(); + break; + } + case 56: { + GreaterThan = input.ReadInt32(); + break; + } + case 64: { + InclusiveBetween = input.ReadInt32(); + break; + } + case 74: { + Length = input.ReadString(); + break; + } + case 80: { + LessThanOrEqual = input.ReadInt32(); + break; + } + case 88: { + LessThan = input.ReadInt32(); + break; + } + case 98: { + NotEmpty = input.ReadString(); + break; + } + case 106: { + NotEqual = input.ReadString(); + break; + } + case 114: { + Null = input.ReadString(); + break; + } + case 122: { + RegularExpression = input.ReadString(); + break; + } + case 130: { + ScalePrecision = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class TypeWithEnum : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TypeWithEnum()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[199]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TypeWithEnum() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TypeWithEnum(TypeWithEnum other) : this() { + id_ = other.id_; + name_ = other.name_; + someEnum_ = other.someEnum_; + someEnumAsInt_ = other.someEnumAsInt_; + nSomeEnum_ = other.nSomeEnum_; + nSomeEnumAsInt_ = other.nSomeEnumAsInt_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TypeWithEnum Clone() { + return new TypeWithEnum(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 2; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "SomeEnum" field. + public const int SomeEnumFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.SomeEnum someEnum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.SomeEnum SomeEnum { + get { return someEnum_; } + set { + someEnum_ = value; + } + } + + /// Field number for the "SomeEnumAsInt" field. + public const int SomeEnumAsIntFieldNumber = 4; + private global::ServiceStack.Extensions.Tests.Protoc.SomeEnumAsInt someEnumAsInt_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.SomeEnumAsInt SomeEnumAsInt { + get { return someEnumAsInt_; } + set { + someEnumAsInt_ = value; + } + } + + /// Field number for the "NSomeEnum" field. + public const int NSomeEnumFieldNumber = 5; + private global::ServiceStack.Extensions.Tests.Protoc.SomeEnum nSomeEnum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.SomeEnum NSomeEnum { + get { return nSomeEnum_; } + set { + nSomeEnum_ = value; + } + } + + /// Field number for the "NSomeEnumAsInt" field. + public const int NSomeEnumAsIntFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.SomeEnumAsInt nSomeEnumAsInt_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.SomeEnumAsInt NSomeEnumAsInt { + get { return nSomeEnumAsInt_; } + set { + nSomeEnumAsInt_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TypeWithEnum); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TypeWithEnum other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Name != other.Name) return false; + if (SomeEnum != other.SomeEnum) return false; + if (SomeEnumAsInt != other.SomeEnumAsInt) return false; + if (NSomeEnum != other.NSomeEnum) return false; + if (NSomeEnumAsInt != other.NSomeEnumAsInt) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (SomeEnum != 0) hash ^= SomeEnum.GetHashCode(); + if (SomeEnumAsInt != 0) hash ^= SomeEnumAsInt.GetHashCode(); + if (NSomeEnum != 0) hash ^= NSomeEnum.GetHashCode(); + if (NSomeEnumAsInt != 0) hash ^= NSomeEnumAsInt.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (Name.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Name); + } + if (SomeEnum != 0) { + output.WriteRawTag(24); + output.WriteEnum((int) SomeEnum); + } + if (SomeEnumAsInt != 0) { + output.WriteRawTag(32); + output.WriteEnum((int) SomeEnumAsInt); + } + if (NSomeEnum != 0) { + output.WriteRawTag(40); + output.WriteEnum((int) NSomeEnum); + } + if (NSomeEnumAsInt != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) NSomeEnumAsInt); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (SomeEnum != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) SomeEnum); + } + if (SomeEnumAsInt != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) SomeEnumAsInt); + } + if (NSomeEnum != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) NSomeEnum); + } + if (NSomeEnumAsInt != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) NSomeEnumAsInt); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TypeWithEnum other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.SomeEnum != 0) { + SomeEnum = other.SomeEnum; + } + if (other.SomeEnumAsInt != 0) { + SomeEnumAsInt = other.SomeEnumAsInt; + } + if (other.NSomeEnum != 0) { + NSomeEnum = other.NSomeEnum; + } + if (other.NSomeEnumAsInt != 0) { + NSomeEnumAsInt = other.NSomeEnumAsInt; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + Name = input.ReadString(); + break; + } + case 24: { + SomeEnum = (global::ServiceStack.Extensions.Tests.Protoc.SomeEnum) input.ReadEnum(); + break; + } + case 32: { + SomeEnumAsInt = (global::ServiceStack.Extensions.Tests.Protoc.SomeEnumAsInt) input.ReadEnum(); + break; + } + case 40: { + NSomeEnum = (global::ServiceStack.Extensions.Tests.Protoc.SomeEnum) input.ReadEnum(); + break; + } + case 48: { + NSomeEnumAsInt = (global::ServiceStack.Extensions.Tests.Protoc.SomeEnumAsInt) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class UnAssignRoles : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UnAssignRoles()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[200]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UnAssignRoles() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UnAssignRoles(UnAssignRoles other) : this() { + userName_ = other.userName_; + permissions_ = other.permissions_.Clone(); + roles_ = other.roles_.Clone(); + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UnAssignRoles Clone() { + return new UnAssignRoles(this); + } + + /// Field number for the "UserName" field. + public const int UserNameFieldNumber = 1; + private string userName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserName { + get { return userName_; } + set { + userName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Permissions" field. + public const int PermissionsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_permissions_codec + = pb::FieldCodec.ForString(18); + private readonly pbc::RepeatedField permissions_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Permissions { + get { return permissions_; } + } + + /// Field number for the "Roles" field. + public const int RolesFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_roles_codec + = pb::FieldCodec.ForString(26); + private readonly pbc::RepeatedField roles_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Roles { + get { return roles_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UnAssignRoles); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UnAssignRoles other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (UserName != other.UserName) return false; + if(!permissions_.Equals(other.permissions_)) return false; + if(!roles_.Equals(other.roles_)) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (UserName.Length != 0) hash ^= UserName.GetHashCode(); + hash ^= permissions_.GetHashCode(); + hash ^= roles_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (UserName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(UserName); + } + permissions_.WriteTo(output, _repeated_permissions_codec); + roles_.WriteTo(output, _repeated_roles_codec); + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (UserName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserName); + } + size += permissions_.CalculateSize(_repeated_permissions_codec); + size += roles_.CalculateSize(_repeated_roles_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UnAssignRoles other) { + if (other == null) { + return; + } + if (other.UserName.Length != 0) { + UserName = other.UserName; + } + permissions_.Add(other.permissions_); + roles_.Add(other.roles_); + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + UserName = input.ReadString(); + break; + } + case 18: { + permissions_.AddEntriesFrom(input, _repeated_permissions_codec); + break; + } + case 26: { + roles_.AddEntriesFrom(input, _repeated_roles_codec); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class UnAssignRolesResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UnAssignRolesResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[201]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UnAssignRolesResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UnAssignRolesResponse(UnAssignRolesResponse other) : this() { + allRoles_ = other.allRoles_.Clone(); + allPermissions_ = other.allPermissions_.Clone(); + meta_ = other.meta_.Clone(); + responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UnAssignRolesResponse Clone() { + return new UnAssignRolesResponse(this); + } + + /// Field number for the "AllRoles" field. + public const int AllRolesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_allRoles_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField allRoles_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField AllRoles { + get { return allRoles_; } + } + + /// Field number for the "AllPermissions" field. + public const int AllPermissionsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_allPermissions_codec + = pb::FieldCodec.ForString(18); + private readonly pbc::RepeatedField allPermissions_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField AllPermissions { + get { return allPermissions_; } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 3; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 26); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + /// Field number for the "ResponseStatus" field. + public const int ResponseStatusFieldNumber = 4; + private global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus responseStatus_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus ResponseStatus { + get { return responseStatus_; } + set { + responseStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UnAssignRolesResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UnAssignRolesResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!allRoles_.Equals(other.allRoles_)) return false; + if(!allPermissions_.Equals(other.allPermissions_)) return false; + if (!Meta.Equals(other.Meta)) return false; + if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= allRoles_.GetHashCode(); + hash ^= allPermissions_.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + allRoles_.WriteTo(output, _repeated_allRoles_codec); + allPermissions_.WriteTo(output, _repeated_allPermissions_codec); + meta_.WriteTo(output, _map_meta_codec); + if (responseStatus_ != null) { + output.WriteRawTag(34); + output.WriteMessage(ResponseStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += allRoles_.CalculateSize(_repeated_allRoles_codec); + size += allPermissions_.CalculateSize(_repeated_allPermissions_codec); + size += meta_.CalculateSize(_map_meta_codec); + if (responseStatus_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UnAssignRolesResponse other) { + if (other == null) { + return; + } + allRoles_.Add(other.allRoles_); + allPermissions_.Add(other.allPermissions_); + meta_.Add(other.meta_); + if (other.responseStatus_ != null) { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + ResponseStatus.MergeFrom(other.ResponseStatus); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + allRoles_.AddEntriesFrom(input, _repeated_allRoles_codec); + break; + } + case 18: { + allPermissions_.AddEntriesFrom(input, _repeated_allPermissions_codec); + break; + } + case 26: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + case 34: { + if (responseStatus_ == null) { + ResponseStatus = new global::ServiceStack.Extensions.Tests.Protoc.ResponseStatus(); + } + input.ReadMessage(ResponseStatus); + break; + } + } + } + } + + } + + public sealed partial class UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[202]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse Clone() { + return new UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[203]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse Clone() { + return new UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class UpdateConnectionInfoRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateConnectionInfoRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[204]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateConnectionInfoRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateConnectionInfoRockstar(UpdateConnectionInfoRockstar other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateConnectionInfoRockstar Clone() { + return new UpdateConnectionInfoRockstar(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 101; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateConnectionInfoRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateConnectionInfoRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (Id != 0) { + output.WriteRawTag(168, 6); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateConnectionInfoRockstar other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 808: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class UpdateNamedRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateNamedRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[205]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateNamedRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateNamedRockstar(UpdateNamedRockstar other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateNamedRockstar Clone() { + return new UpdateNamedRockstar(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 101; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateNamedRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateNamedRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (Id != 0) { + output.WriteRawTag(168, 6); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateNamedRockstar other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 808: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class UpdateRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[206]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstar(UpdateRockstar other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstar Clone() { + return new UpdateRockstar(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 101; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (Id != 0) { + output.WriteRawTag(168, 6); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateRockstar other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 808: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class UpdateRockstarAdhocNonDefaults : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateRockstarAdhocNonDefaults()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[207]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAdhocNonDefaults() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAdhocNonDefaults(UpdateRockstarAdhocNonDefaults other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAdhocNonDefaults Clone() { + return new UpdateRockstarAdhocNonDefaults(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 3; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 4; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 6; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 7; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateRockstarAdhocNonDefaults); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateRockstarAdhocNonDefaults other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(32); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(50); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(56); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateRockstarAdhocNonDefaults other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 26: { + LastName = input.ReadString(); + break; + } + case 32: { + Age = input.ReadInt32(); + break; + } + case 42: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 50: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 56: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class UpdateRockstarAudit : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateRockstarAudit()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[208]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAudit() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAudit(UpdateRockstarAudit other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + id_ = other.id_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAudit Clone() { + return new UpdateRockstarAudit(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 101; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateRockstarAudit); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateRockstarAudit other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (Id != other.Id) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (Id != 0) { + output.WriteRawTag(168, 6); + output.WriteInt32(Id); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateRockstarAudit other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + if (other.Id != 0) { + Id = other.Id; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 808: { + Id = input.ReadInt32(); + break; + } + } + } + } + + } + + public sealed partial class UpdateRockstarAuditTenant : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateRockstarAuditTenant()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[209]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAuditTenant() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAuditTenant(UpdateRockstarAuditTenant other) : this() { + bearerToken_ = other.bearerToken_; + id_ = other.id_; + firstName_ = other.firstName_; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAuditTenant Clone() { + return new UpdateRockstarAuditTenant(this); + } + + /// Field number for the "BearerToken" field. + public const int BearerTokenFieldNumber = 201; + private string bearerToken_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string BearerToken { + get { return bearerToken_; } + set { + bearerToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 202; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 203; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 204; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateRockstarAuditTenant); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateRockstarAuditTenant other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BearerToken != other.BearerToken) return false; + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BearerToken.Length != 0) hash ^= BearerToken.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (BearerToken.Length != 0) { + output.WriteRawTag(202, 12); + output.WriteString(BearerToken); + } + if (Id != 0) { + output.WriteRawTag(208, 12); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(218, 12); + output.WriteString(FirstName); + } + if (LivingStatus != 0) { + output.WriteRawTag(224, 12); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BearerToken.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(BearerToken); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LivingStatus != 0) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateRockstarAuditTenant other) { + if (other == null) { + return; + } + if (other.BearerToken.Length != 0) { + BearerToken = other.BearerToken; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 1610: { + BearerToken = input.ReadString(); + break; + } + case 1616: { + Id = input.ReadInt32(); + break; + } + case 1626: { + FirstName = input.ReadString(); + break; + } + case 1632: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class UpdateRockstarAuditTenantGateway : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateRockstarAuditTenantGateway()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[210]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAuditTenantGateway() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAuditTenantGateway(UpdateRockstarAuditTenantGateway other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAuditTenantGateway Clone() { + return new UpdateRockstarAuditTenantGateway(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateRockstarAuditTenantGateway); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateRockstarAuditTenantGateway other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LivingStatus != 0) { + output.WriteRawTag(24); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateRockstarAuditTenantGateway other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 24: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class UpdateRockstarAuditTenantMq : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateRockstarAuditTenantMq()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[211]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAuditTenantMq() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAuditTenantMq(UpdateRockstarAuditTenantMq other) : this() { + id_ = other.id_; + firstName_ = other.firstName_; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarAuditTenantMq Clone() { + return new UpdateRockstarAuditTenantMq(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 2; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 3; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateRockstarAuditTenantMq); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateRockstarAuditTenantMq other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (FirstName != other.FirstName) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0) hash ^= Id.GetHashCode(); + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0) { + output.WriteRawTag(8); + output.WriteInt32(Id); + } + if (FirstName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FirstName); + } + if (LivingStatus != 0) { + output.WriteRawTag(24); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateRockstarAuditTenantMq other) { + if (other == null) { + return; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt32(); + break; + } + case 18: { + FirstName = input.ReadString(); + break; + } + case 24: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + public sealed partial class UpdateRockstarVersion : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateRockstarVersion()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[212]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarVersion() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarVersion(UpdateRockstarVersion other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + id_ = other.id_; + rowVersion_ = other.rowVersion_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRockstarVersion Clone() { + return new UpdateRockstarVersion(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 101; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "RowVersion" field. + public const int RowVersionFieldNumber = 102; + private ulong rowVersion_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong RowVersion { + get { return rowVersion_; } + set { + rowVersion_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateRockstarVersion); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateRockstarVersion other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + if (Id != other.Id) return false; + if (RowVersion != other.RowVersion) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (RowVersion != 0UL) hash ^= RowVersion.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (Id != 0) { + output.WriteRawTag(168, 6); + output.WriteInt32(Id); + } + if (RowVersion != 0UL) { + output.WriteRawTag(176, 6); + output.WriteUInt64(RowVersion); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (Id != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (RowVersion != 0UL) { + size += 2 + pb::CodedOutputStream.ComputeUInt64Size(RowVersion); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateRockstarVersion other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.RowVersion != 0UL) { + RowVersion = other.RowVersion; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + case 808: { + Id = input.ReadInt32(); + break; + } + case 816: { + RowVersion = input.ReadUInt64(); + break; + } + } + } + } + + } + + public sealed partial class UpdateTodo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateTodo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[213]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateTodo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateTodo(UpdateTodo other) : this() { + id_ = other.id_; + title_ = other.title_; + order_ = other.order_; + completed_ = other.completed_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateTodo Clone() { + return new UpdateTodo(this); + } + + /// Field number for the "Id" field. + public const int IdFieldNumber = 1; + private long id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "Title" field. + public const int TitleFieldNumber = 2; + private string title_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Title { + get { return title_; } + set { + title_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Order" field. + public const int OrderFieldNumber = 3; + private int order_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Order { + get { return order_; } + set { + order_ = value; + } + } + + /// Field number for the "Completed" field. + public const int CompletedFieldNumber = 4; + private bool completed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Completed { + get { return completed_; } + set { + completed_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateTodo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateTodo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Title != other.Title) return false; + if (Order != other.Order) return false; + if (Completed != other.Completed) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id != 0L) hash ^= Id.GetHashCode(); + if (Title.Length != 0) hash ^= Title.GetHashCode(); + if (Order != 0) hash ^= Order.GetHashCode(); + if (Completed != false) hash ^= Completed.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Id); + } + if (Title.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Title); + } + if (Order != 0) { + output.WriteRawTag(24); + output.WriteInt32(Order); + } + if (Completed != false) { + output.WriteRawTag(32); + output.WriteBool(Completed); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); + } + if (Title.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Title); + } + if (Order != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Order); + } + if (Completed != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateTodo other) { + if (other == null) { + return; + } + if (other.Id != 0L) { + Id = other.Id; + } + if (other.Title.Length != 0) { + Title = other.Title; + } + if (other.Order != 0) { + Order = other.Order; + } + if (other.Completed != false) { + Completed = other.Completed; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt64(); + break; + } + case 18: { + Title = input.ReadString(); + break; + } + case 24: { + Order = input.ReadInt32(); + break; + } + case 32: { + Completed = input.ReadBool(); + break; + } + } + } + } + + } + + public sealed partial class UserApiKey : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UserApiKey()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[214]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UserApiKey() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UserApiKey(UserApiKey other) : this() { + key_ = other.key_; + keyType_ = other.keyType_; + expiryDate_ = other.expiryDate_ != null ? other.expiryDate_.Clone() : null; + meta_ = other.meta_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UserApiKey Clone() { + return new UserApiKey(this); + } + + /// Field number for the "Key" field. + public const int KeyFieldNumber = 1; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "KeyType" field. + public const int KeyTypeFieldNumber = 2; + private string keyType_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string KeyType { + get { return keyType_; } + set { + keyType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ExpiryDate" field. + public const int ExpiryDateFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Timestamp expiryDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp ExpiryDate { + get { return expiryDate_; } + set { + expiryDate_ = value; + } + } + + /// Field number for the "Meta" field. + public const int MetaFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_meta_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 34); + private readonly pbc::MapField meta_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Meta { + get { return meta_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UserApiKey); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UserApiKey other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + if (KeyType != other.KeyType) return false; + if (!object.Equals(ExpiryDate, other.ExpiryDate)) return false; + if (!Meta.Equals(other.Meta)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (KeyType.Length != 0) hash ^= KeyType.GetHashCode(); + if (expiryDate_ != null) hash ^= ExpiryDate.GetHashCode(); + hash ^= Meta.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (KeyType.Length != 0) { + output.WriteRawTag(18); + output.WriteString(KeyType); + } + if (expiryDate_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ExpiryDate); + } + meta_.WriteTo(output, _map_meta_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (KeyType.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(KeyType); + } + if (expiryDate_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExpiryDate); + } + size += meta_.CalculateSize(_map_meta_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UserApiKey other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.KeyType.Length != 0) { + KeyType = other.KeyType; + } + if (other.expiryDate_ != null) { + if (expiryDate_ == null) { + ExpiryDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + ExpiryDate.MergeFrom(other.ExpiryDate); + } + meta_.Add(other.meta_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Key = input.ReadString(); + break; + } + case 18: { + KeyType = input.ReadString(); + break; + } + case 26: { + if (expiryDate_ == null) { + ExpiryDate = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(ExpiryDate); + break; + } + case 34: { + meta_.AddEntriesFrom(input, _map_meta_codec); + break; + } + } + } + } + + } + + public sealed partial class ValidateCreateRockstar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ValidateCreateRockstar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[215]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValidateCreateRockstar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValidateCreateRockstar(ValidateCreateRockstar other) : this() { + firstName_ = other.firstName_; + lastName_ = other.lastName_; + age_ = other.age_; + dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; + dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; + livingStatus_ = other.livingStatus_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValidateCreateRockstar Clone() { + return new ValidateCreateRockstar(this); + } + + /// Field number for the "FirstName" field. + public const int FirstNameFieldNumber = 1; + private string firstName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FirstName { + get { return firstName_; } + set { + firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastName" field. + public const int LastNameFieldNumber = 2; + private string lastName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastName { + get { return lastName_; } + set { + lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Age" field. + public const int AgeFieldNumber = 3; + private int age_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Age { + get { return age_; } + set { + age_ = value; + } + } + + /// Field number for the "DateOfBirth" field. + public const int DateOfBirthFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { + get { return dateOfBirth_; } + set { + dateOfBirth_ = value; + } + } + + /// Field number for the "DateDied" field. + public const int DateDiedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { + get { return dateDied_; } + set { + dateDied_ = value; + } + } + + /// Field number for the "LivingStatus" field. + public const int LivingStatusFieldNumber = 6; + private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { + get { return livingStatus_; } + set { + livingStatus_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ValidateCreateRockstar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ValidateCreateRockstar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FirstName != other.FirstName) return false; + if (LastName != other.LastName) return false; + if (Age != other.Age) return false; + if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; + if (!object.Equals(DateDied, other.DateDied)) return false; + if (LivingStatus != other.LivingStatus) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); + if (LastName.Length != 0) hash ^= LastName.GetHashCode(); + if (Age != 0) hash ^= Age.GetHashCode(); + if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); + if (dateDied_ != null) hash ^= DateDied.GetHashCode(); + if (LivingStatus != 0) hash ^= LivingStatus.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (FirstName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FirstName); + } + if (LastName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastName); + } + if (Age != 0) { + output.WriteRawTag(24); + output.WriteInt32(Age); + } + if (dateOfBirth_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DateOfBirth); + } + if (dateDied_ != null) { + output.WriteRawTag(42); + output.WriteMessage(DateDied); + } + if (LivingStatus != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) LivingStatus); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (FirstName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); + } + if (LastName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); + } + if (Age != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); + } + if (dateOfBirth_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); + } + if (dateDied_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); + } + if (LivingStatus != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ValidateCreateRockstar other) { + if (other == null) { + return; + } + if (other.FirstName.Length != 0) { + FirstName = other.FirstName; + } + if (other.LastName.Length != 0) { + LastName = other.LastName; + } + if (other.Age != 0) { + Age = other.Age; + } + if (other.dateOfBirth_ != null) { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateOfBirth.MergeFrom(other.DateOfBirth); + } + if (other.dateDied_ != null) { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + DateDied.MergeFrom(other.DateDied); + } + if (other.LivingStatus != 0) { + LivingStatus = other.LivingStatus; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + FirstName = input.ReadString(); + break; + } + case 18: { + LastName = input.ReadString(); + break; + } + case 24: { + Age = input.ReadInt32(); + break; + } + case 34: { + if (dateOfBirth_ == null) { + DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateOfBirth); + break; + } + case 42: { + if (dateDied_ == null) { + DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(DateDied); + break; + } + case 48: { + LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/tests/ServiceStack.Extensions.Tests/Protoc/ServicesGrpc.cs b/tests/ServiceStack.Extensions.Tests/Protoc/ServicesGrpc.cs new file mode 100644 index 00000000000..f4c44fe0f62 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Protoc/ServicesGrpc.cs @@ -0,0 +1,6094 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: services.proto +// +// Original file comments: +// Options: +// Date: 2020-06-03 21:41:31 +// Version: 5.81 +// Tip: To override a DTO option, remove "//" prefix before updating +// BaseUrl: http://localhost:20000 +// +// //GlobalNamespace: +// //AddDescriptionAsComments: True +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace ServiceStack.Extensions.Tests.Protoc { + public static partial class GrpcServices + { + static readonly string __ServiceName = "GrpcServices"; + + static readonly grpc::Marshaller __Marshaller_AddHeader = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.AddHeader.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_EmptyResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_AnyHello = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.AnyHello.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_HelloResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.HelloResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_AssignRoles = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.AssignRoles.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_AssignRolesResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.AssignRolesResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Authenticate = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.Authenticate.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_AuthenticateResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ChangeConnectionInfo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ChangeConnectionInfo.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ChangeDbResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ChangeDbResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ChangeDb = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ChangeDb.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ConvertSessionToToken = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToToken.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ConvertSessionToTokenResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToTokenResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateBookmark = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateBookmark.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateBookmarkResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateBookmarkResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateConnectionInfoRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateConnectionInfoRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RockstarWithIdAndResultResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateNamedRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateNamedRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarAdhocNonDefaults = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAdhocNonDefaults.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarAudit = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAudit.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RockstarWithIdResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarAuditMqToken = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditMqToken.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarAuditTenant = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenant.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarAuditTenantGateway = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantGateway.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarAuditTenantMq = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarAutoMap = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAutoMap.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarVersion = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarVersion.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RockstarWithIdAndRowVersionResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndRowVersionResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarWithAutoGuid = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithAutoGuid.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarWithReturnGuidResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturnGuidResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarWithReturn = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturn.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRockstarWithVoidReturn = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithVoidReturn.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateTodo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateTodo.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateTodoResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CreateTodoResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CustomValidationErrors = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.CustomValidationErrors.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DeleteRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DeleteRockstarAudit = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarAudit.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RockstarWithIdAndCountResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndCountResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DeleteRockstarFilters = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarFilters.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DeleteRockstarCountResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarCountResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DeleteTodo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.DeleteTodo.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DeleteTodos = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.DeleteTodos.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DynamicRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_Rockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_CustomRockstarSchema = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstarSchema.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_Movie = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_RockstarReference = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_AllFields = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_AllFields.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_TypeWithEnum = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_TypeWithEnum.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_Adhoc = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Adhoc.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_CustomSelectRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_CustomSelectRockstarResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstarResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_Foo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Foo.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_CustomRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_RockstarAuto = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_Bookmark = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Bookmark.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_NamedRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_NamedRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_RockstarAlbum = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlbum.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_PagingTest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_PagingTest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryResponse_RockstarAlias = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlias.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DynamicValidationRules = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.DynamicValidationRules.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_EmptyValidators = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.EmptyValidators.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_EndsWithSuffixRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_EndsWithSuffixResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetAccessToken = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetAccessToken.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetAccessTokenResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetAccessTokenResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetApiKeys = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetApiKeys.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetApiKeysResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetApiKeysResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetFile = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetFile.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_FileContent = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.FileContent.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetHello = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetHello.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetTodo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetTodo.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetTodoResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetTodoResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetTodos = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetTodos.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetTodosResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.GetTodosResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_HelloJwt = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.HelloJwt.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_HelloJwtResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Incr = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.Incr.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Multiply = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.Multiply.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_MultiplyResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.MultiplyResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_NoAbstractValidator = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.NoAbstractValidator.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_OnlyValidatesRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.OnlyValidatesRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_PatchRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.PatchRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_PatchRockstarAuditTenant = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenant.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_PatchRockstarAuditTenantGateway = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantGateway.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_PatchRockstarAuditTenantMq = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantMq.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_PostChatToChannel = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.PostChatToChannel.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ChatMessage = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ChatMessage.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryAdhoc = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryAdhoc.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryAdhocRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryAdhocRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryAllFields = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryAllFields.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryBookmarks = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryBookmarks.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryCaseInsensitiveOrderBy = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryCaseInsensitiveOrderBy.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryChangeConnectionInfo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryChangeConnectionInfo.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryChangeDb = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryChangeDb.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryCustomRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryCustomRockstarsFilter = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsFilter.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryCustomRockstarsReferences = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsReferences.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryCustomRockstarsSchema = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsSchema.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryFieldRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryFieldRockstarsDynamic = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstarsDynamic.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryFieldsImplicitConventions = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryFieldsImplicitConventions.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryFoos = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryFoos.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryGetRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryGetRockstarsDynamic = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstarsDynamic.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryJoinedRockstarAlbums = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbums.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryJoinedRockstarAlbumsCustomSelect = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelect.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryJoinedRockstarAlbumsCustomSelectResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelectResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryMovies = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryMovies.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryMultiJoinRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryMultiJoinRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryNamedRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryNamedRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryOrRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryOrRockstarsFields = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstarsFields.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryOverridedCustomRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedCustomRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryOverridedRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryPagingTest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryPagingTest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarAlbums = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbums.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarAlbumsCustomLeftJoin = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsCustomLeftJoin.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarAlbumsImplicit = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsImplicit.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarAlbumsLeftJoin = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsLeftJoin.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarAlias = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlias.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarAudit = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAudit.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarAuditSubOr = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAuditSubOr.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarFilters = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarFilters.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarsConventions = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsConventions.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarsFilter = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsFilter.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarsIFilter = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsIFilter.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarsImplicit = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsImplicit.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryRockstarsWithReferences = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsWithReferences.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryTypeWithEnums = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryTypeWithEnums.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_QueryUnknownRockstars = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.QueryUnknownRockstars.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RealDeleteAuditTenant = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenant.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RealDeleteAuditTenantGateway = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantGateway.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RealDeleteAuditTenantMq = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantMq.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RegenerateApiKeys = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeys.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RegenerateApiKeysResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeysResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Register = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.Register.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RegisterResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RegisterResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RequiresAuth = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ResetTodos = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ResetTodos.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_SearchMovies = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.SearchMovies.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Secured = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.Secured.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_SecuredResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.SecuredResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_SoftDeleteAuditTenant = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenant.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_StreamFiles = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.StreamFiles.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_StreamMovies = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.StreamMovies.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_StreamServerEvents = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.StreamServerEvents.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_StreamServerEventsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.StreamServerEventsResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_TestAuthValidators = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.TestAuthValidators.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_TestDbCondition = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.TestDbCondition.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_TestDbValidator = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.TestDbValidator.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_TestIsAdmin = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.TestIsAdmin.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_TestMultiAuthValidators = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.TestMultiAuthValidators.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Throw = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.Throw.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ThrowCustom = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ThrowCustom.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ThrowCustomResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ThrowCustomResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ThrowVoid = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ThrowVoid.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_TriggerAllValidators = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.TriggerAllValidators.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_TriggerValidators = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.TriggerValidators.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UnAssignRoles = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UnAssignRoles.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UnAssignRolesResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UnAssignRolesResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateConnectionInfoRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateConnectionInfoRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateNamedRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateNamedRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstar.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateRockstarAdhocNonDefaults = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAdhocNonDefaults.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateRockstarAudit = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAudit.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateRockstarAuditTenant = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenant.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateRockstarAuditTenantGateway = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantGateway.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateRockstarAuditTenantMq = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantMq.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateRockstarVersion = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarVersion.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateTodo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.UpdateTodo.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_ValidateCreateRockstar = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::ServiceStack.Extensions.Tests.Protoc.ValidateCreateRockstar.Parser.ParseFrom); + + static readonly grpc::Method __Method_GetAddHeader = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetAddHeader", + __Marshaller_AddHeader, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_GetAnyHello = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetAnyHello", + __Marshaller_AnyHello, + __Marshaller_HelloResponse); + + static readonly grpc::Method __Method_PostAnyHello = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostAnyHello", + __Marshaller_AnyHello, + __Marshaller_HelloResponse); + + static readonly grpc::Method __Method_PutAnyHello = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutAnyHello", + __Marshaller_AnyHello, + __Marshaller_HelloResponse); + + static readonly grpc::Method __Method_DeleteAnyHello = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteAnyHello", + __Marshaller_AnyHello, + __Marshaller_HelloResponse); + + static readonly grpc::Method __Method_PostAssignRoles = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostAssignRoles", + __Marshaller_AssignRoles, + __Marshaller_AssignRolesResponse); + + static readonly grpc::Method __Method_OptionsAuthenticate = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "OptionsAuthenticate", + __Marshaller_Authenticate, + __Marshaller_AuthenticateResponse); + + static readonly grpc::Method __Method_GetAuthenticate = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetAuthenticate", + __Marshaller_Authenticate, + __Marshaller_AuthenticateResponse); + + static readonly grpc::Method __Method_PostAuthenticate = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostAuthenticate", + __Marshaller_Authenticate, + __Marshaller_AuthenticateResponse); + + static readonly grpc::Method __Method_DeleteAuthenticate = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteAuthenticate", + __Marshaller_Authenticate, + __Marshaller_AuthenticateResponse); + + static readonly grpc::Method __Method_GetChangeConnectionInfo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetChangeConnectionInfo", + __Marshaller_ChangeConnectionInfo, + __Marshaller_ChangeDbResponse); + + static readonly grpc::Method __Method_GetChangeDb = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetChangeDb", + __Marshaller_ChangeDb, + __Marshaller_ChangeDbResponse); + + static readonly grpc::Method __Method_PostConvertSessionToToken = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostConvertSessionToToken", + __Marshaller_ConvertSessionToToken, + __Marshaller_ConvertSessionToTokenResponse); + + static readonly grpc::Method __Method_PostCreateBookmark = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateBookmark", + __Marshaller_CreateBookmark, + __Marshaller_CreateBookmarkResponse); + + static readonly grpc::Method __Method_PostCreateConnectionInfoRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateConnectionInfoRockstar", + __Marshaller_CreateConnectionInfoRockstar, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PostCreateNamedRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateNamedRockstar", + __Marshaller_CreateNamedRockstar, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PostCreateRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstar", + __Marshaller_CreateRockstar, + __Marshaller_CreateRockstarResponse); + + static readonly grpc::Method __Method_PostCreateRockstarAdhocNonDefaults = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarAdhocNonDefaults", + __Marshaller_CreateRockstarAdhocNonDefaults, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PostCreateRockstarAudit = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarAudit", + __Marshaller_CreateRockstarAudit, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_PostCreateRockstarAuditMqToken = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarAuditMqToken", + __Marshaller_CreateRockstarAuditMqToken, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_PostCreateRockstarAuditTenant = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarAuditTenant", + __Marshaller_CreateRockstarAuditTenant, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PostCreateRockstarAuditTenantGateway = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarAuditTenantGateway", + __Marshaller_CreateRockstarAuditTenantGateway, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_GetCreateRockstarAuditTenantMq = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetCreateRockstarAuditTenantMq", + __Marshaller_CreateRockstarAuditTenantMq, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PostCreateRockstarAuditTenantMq = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarAuditTenantMq", + __Marshaller_CreateRockstarAuditTenantMq, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PutCreateRockstarAuditTenantMq = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutCreateRockstarAuditTenantMq", + __Marshaller_CreateRockstarAuditTenantMq, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_DeleteCreateRockstarAuditTenantMq = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteCreateRockstarAuditTenantMq", + __Marshaller_CreateRockstarAuditTenantMq, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PostCreateRockstarAutoMap = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarAutoMap", + __Marshaller_CreateRockstarAutoMap, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PostCreateRockstarVersion = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarVersion", + __Marshaller_CreateRockstarVersion, + __Marshaller_RockstarWithIdAndRowVersionResponse); + + static readonly grpc::Method __Method_PostCreateRockstarWithAutoGuid = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarWithAutoGuid", + __Marshaller_CreateRockstarWithAutoGuid, + __Marshaller_CreateRockstarWithReturnGuidResponse); + + static readonly grpc::Method __Method_PostCreateRockstarWithReturn = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarWithReturn", + __Marshaller_CreateRockstarWithReturn, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PostCreateRockstarWithVoidReturn = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateRockstarWithVoidReturn", + __Marshaller_CreateRockstarWithVoidReturn, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PostCreateTodo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCreateTodo", + __Marshaller_CreateTodo, + __Marshaller_CreateTodoResponse); + + static readonly grpc::Method __Method_PostCustomValidationErrors = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostCustomValidationErrors", + __Marshaller_CustomValidationErrors, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_CallDeleteRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallDeleteRockstar", + __Marshaller_DeleteRockstar, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_CallDeleteRockstarAudit = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallDeleteRockstarAudit", + __Marshaller_DeleteRockstarAudit, + __Marshaller_RockstarWithIdAndCountResponse); + + static readonly grpc::Method __Method_CallDeleteRockstarFilters = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallDeleteRockstarFilters", + __Marshaller_DeleteRockstarFilters, + __Marshaller_DeleteRockstarCountResponse); + + static readonly grpc::Method __Method_CallDeleteTodo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallDeleteTodo", + __Marshaller_DeleteTodo, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_CallDeleteTodos = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallDeleteTodos", + __Marshaller_DeleteTodos, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_GetDynamicQueryGetRockstarsDynamic = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryGetRockstarsDynamic", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryCustomRockstarsSchema = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryCustomRockstarsSchema", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomRockstarSchema); + + static readonly grpc::Method __Method_GetDynamicSearchMovies = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicSearchMovies", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Movie); + + static readonly grpc::Method __Method_GetDynamicQueryMovies = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryMovies", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Movie); + + static readonly grpc::Method __Method_GetDynamicQueryUnknownRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryUnknownRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarsWithReferences = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarsWithReferences", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_RockstarReference); + + static readonly grpc::Method __Method_GetDynamicQueryAllFields = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryAllFields", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_AllFields); + + static readonly grpc::Method __Method_GetDynamicQueryTypeWithEnums = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryTypeWithEnums", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_TypeWithEnum); + + static readonly grpc::Method __Method_GetDynamicQueryAdhocRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryAdhocRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryAdhoc = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryAdhoc", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Adhoc); + + static readonly grpc::Method __Method_GetDynamicQueryChangeDb = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryChangeDb", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelect = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryJoinedRockstarAlbumsCustomSelect", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomSelectRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomSelectRockstarResponse); + + static readonly grpc::Method __Method_GetDynamicQueryFoos = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryFoos", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Foo); + + static readonly grpc::Method __Method_GetDynamicQueryOverridedRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryOverridedRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryOverridedCustomRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryOverridedCustomRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryCaseInsensitiveOrderBy = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryCaseInsensitiveOrderBy", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicStreamMovies = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicStreamMovies", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Movie); + + static readonly grpc::Method __Method_GetDynamicQueryCustomRockstarsReferences = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryCustomRockstarsReferences", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_RockstarReference); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarAlbumsCustomLeftJoin = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarAlbumsCustomLeftJoin", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryChangeConnectionInfo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryChangeConnectionInfo", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarAudit = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarAudit", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_RockstarAuto); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarAuditSubOr = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarAuditSubOr", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_RockstarAuto); + + static readonly grpc::Method __Method_GetDynamicQueryBookmarks = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryBookmarks", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Bookmark); + + static readonly grpc::Method __Method_GetDynamicQueryNamedRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryNamedRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_NamedRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarAlbums = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarAlbums", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_RockstarAlbum); + + static readonly grpc::Method __Method_GetDynamicQueryPagingTest = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryPagingTest", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_PagingTest); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarsConventions = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarsConventions", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryCustomRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryCustomRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryJoinedRockstarAlbums = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryJoinedRockstarAlbums", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarAlbumsImplicit = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarAlbumsImplicit", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarAlbumsLeftJoin = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarAlbumsLeftJoin", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryMultiJoinRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryMultiJoinRockstar", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryFieldRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryFieldRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarAlias = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarAlias", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_RockstarAlias); + + static readonly grpc::Method __Method_GetDynamicQueryFieldRockstarsDynamic = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryFieldRockstarsDynamic", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarsFilter = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarsFilter", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryCustomRockstarsFilter = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryCustomRockstarsFilter", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarsIFilter = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarsIFilter", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryOrRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryOrRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarsImplicit = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarsImplicit", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryOrRockstarsFields = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryOrRockstarsFields", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryFieldsImplicitConventions = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryFieldsImplicitConventions", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryGetRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryGetRockstars", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetDynamicQueryRockstarFilters = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetDynamicQueryRockstarFilters", + __Marshaller_DynamicRequest, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_PostDynamicValidationRules = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostDynamicValidationRules", + __Marshaller_DynamicValidationRules, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_PostEmptyValidators = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostEmptyValidators", + __Marshaller_EmptyValidators, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_GetEndsWithSuffixRequest = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetEndsWithSuffixRequest", + __Marshaller_EndsWithSuffixRequest, + __Marshaller_EndsWithSuffixResponse); + + static readonly grpc::Method __Method_PostEndsWithSuffixRequest = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostEndsWithSuffixRequest", + __Marshaller_EndsWithSuffixRequest, + __Marshaller_EndsWithSuffixResponse); + + static readonly grpc::Method __Method_PutEndsWithSuffixRequest = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutEndsWithSuffixRequest", + __Marshaller_EndsWithSuffixRequest, + __Marshaller_EndsWithSuffixResponse); + + static readonly grpc::Method __Method_DeleteEndsWithSuffixRequest = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteEndsWithSuffixRequest", + __Marshaller_EndsWithSuffixRequest, + __Marshaller_EndsWithSuffixResponse); + + static readonly grpc::Method __Method_PostGetAccessToken = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostGetAccessToken", + __Marshaller_GetAccessToken, + __Marshaller_GetAccessTokenResponse); + + static readonly grpc::Method __Method_CallGetApiKeys = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallGetApiKeys", + __Marshaller_GetApiKeys, + __Marshaller_GetApiKeysResponse); + + static readonly grpc::Method __Method_CallGetFile = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallGetFile", + __Marshaller_GetFile, + __Marshaller_FileContent); + + static readonly grpc::Method __Method_CallGetHello = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallGetHello", + __Marshaller_GetHello, + __Marshaller_HelloResponse); + + static readonly grpc::Method __Method_CallGetTodo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallGetTodo", + __Marshaller_GetTodo, + __Marshaller_GetTodoResponse); + + static readonly grpc::Method __Method_CallGetTodos = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallGetTodos", + __Marshaller_GetTodos, + __Marshaller_GetTodosResponse); + + static readonly grpc::Method __Method_GetHelloJwt = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetHelloJwt", + __Marshaller_HelloJwt, + __Marshaller_HelloJwtResponse); + + static readonly grpc::Method __Method_PostHelloJwt = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostHelloJwt", + __Marshaller_HelloJwt, + __Marshaller_HelloJwtResponse); + + static readonly grpc::Method __Method_PutHelloJwt = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutHelloJwt", + __Marshaller_HelloJwt, + __Marshaller_HelloJwtResponse); + + static readonly grpc::Method __Method_DeleteHelloJwt = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteHelloJwt", + __Marshaller_HelloJwt, + __Marshaller_HelloJwtResponse); + + static readonly grpc::Method __Method_GetIncr = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetIncr", + __Marshaller_Incr, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PostIncr = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostIncr", + __Marshaller_Incr, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PutIncr = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutIncr", + __Marshaller_Incr, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_DeleteIncr = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteIncr", + __Marshaller_Incr, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PostMultiply = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostMultiply", + __Marshaller_Multiply, + __Marshaller_MultiplyResponse); + + static readonly grpc::Method __Method_PostNoAbstractValidator = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostNoAbstractValidator", + __Marshaller_NoAbstractValidator, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_PostOnlyValidatesRequest = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostOnlyValidatesRequest", + __Marshaller_OnlyValidatesRequest, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_CallPatchRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallPatchRockstar", + __Marshaller_PatchRockstar, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_CallPatchRockstarAuditTenant = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallPatchRockstarAuditTenant", + __Marshaller_PatchRockstarAuditTenant, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_CallPatchRockstarAuditTenantGateway = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallPatchRockstarAuditTenantGateway", + __Marshaller_PatchRockstarAuditTenantGateway, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_CallPatchRockstarAuditTenantMq = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallPatchRockstarAuditTenantMq", + __Marshaller_PatchRockstarAuditTenantMq, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_CallPostChatToChannel = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "CallPostChatToChannel", + __Marshaller_PostChatToChannel, + __Marshaller_ChatMessage); + + static readonly grpc::Method __Method_GetQueryAdhoc = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryAdhoc", + __Marshaller_QueryAdhoc, + __Marshaller_QueryResponse_Adhoc); + + static readonly grpc::Method __Method_GetQueryAdhocRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryAdhocRockstars", + __Marshaller_QueryAdhocRockstars, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryAllFields = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryAllFields", + __Marshaller_QueryAllFields, + __Marshaller_QueryResponse_AllFields); + + static readonly grpc::Method __Method_GetQueryBookmarks = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryBookmarks", + __Marshaller_QueryBookmarks, + __Marshaller_QueryResponse_Bookmark); + + static readonly grpc::Method __Method_GetQueryCaseInsensitiveOrderBy = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryCaseInsensitiveOrderBy", + __Marshaller_QueryCaseInsensitiveOrderBy, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryChangeConnectionInfo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryChangeConnectionInfo", + __Marshaller_QueryChangeConnectionInfo, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryChangeDb = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryChangeDb", + __Marshaller_QueryChangeDb, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryCustomRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryCustomRockstars", + __Marshaller_QueryCustomRockstars, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetQueryCustomRockstarsFilter = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryCustomRockstarsFilter", + __Marshaller_QueryCustomRockstarsFilter, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetQueryCustomRockstarsReferences = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryCustomRockstarsReferences", + __Marshaller_QueryCustomRockstarsReferences, + __Marshaller_QueryResponse_RockstarReference); + + static readonly grpc::Method __Method_GetQueryCustomRockstarsSchema = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryCustomRockstarsSchema", + __Marshaller_QueryCustomRockstarsSchema, + __Marshaller_QueryResponse_CustomRockstarSchema); + + static readonly grpc::Method __Method_GetQueryFieldRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryFieldRockstars", + __Marshaller_QueryFieldRockstars, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryFieldRockstarsDynamic = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryFieldRockstarsDynamic", + __Marshaller_QueryFieldRockstarsDynamic, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryFieldsImplicitConventions = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryFieldsImplicitConventions", + __Marshaller_QueryFieldsImplicitConventions, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryFoos = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryFoos", + __Marshaller_QueryFoos, + __Marshaller_QueryResponse_Foo); + + static readonly grpc::Method __Method_GetQueryGetRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryGetRockstars", + __Marshaller_QueryGetRockstars, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryGetRockstarsDynamic = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryGetRockstarsDynamic", + __Marshaller_QueryGetRockstarsDynamic, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryJoinedRockstarAlbums = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryJoinedRockstarAlbums", + __Marshaller_QueryJoinedRockstarAlbums, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetQueryJoinedRockstarAlbumsCustomSelect = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryJoinedRockstarAlbumsCustomSelect", + __Marshaller_QueryJoinedRockstarAlbumsCustomSelect, + __Marshaller_QueryResponse_CustomSelectRockstar); + + static readonly grpc::Method __Method_GetQueryJoinedRockstarAlbumsCustomSelectResponse = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryJoinedRockstarAlbumsCustomSelectResponse", + __Marshaller_QueryJoinedRockstarAlbumsCustomSelectResponse, + __Marshaller_QueryResponse_CustomSelectRockstarResponse); + + static readonly grpc::Method __Method_GetQueryMovies = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryMovies", + __Marshaller_QueryMovies, + __Marshaller_QueryResponse_Movie); + + static readonly grpc::Method __Method_GetQueryMultiJoinRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryMultiJoinRockstar", + __Marshaller_QueryMultiJoinRockstar, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetQueryNamedRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryNamedRockstars", + __Marshaller_QueryNamedRockstars, + __Marshaller_QueryResponse_NamedRockstar); + + static readonly grpc::Method __Method_GetQueryOrRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryOrRockstars", + __Marshaller_QueryOrRockstars, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryOrRockstarsFields = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryOrRockstarsFields", + __Marshaller_QueryOrRockstarsFields, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryOverridedCustomRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryOverridedCustomRockstars", + __Marshaller_QueryOverridedCustomRockstars, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetQueryOverridedRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryOverridedRockstars", + __Marshaller_QueryOverridedRockstars, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryPagingTest = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryPagingTest", + __Marshaller_QueryPagingTest, + __Marshaller_QueryResponse_PagingTest); + + static readonly grpc::Method __Method_GetQueryRockstarAlbums = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarAlbums", + __Marshaller_QueryRockstarAlbums, + __Marshaller_QueryResponse_RockstarAlbum); + + static readonly grpc::Method __Method_GetQueryRockstarAlbumsCustomLeftJoin = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarAlbumsCustomLeftJoin", + __Marshaller_QueryRockstarAlbumsCustomLeftJoin, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetQueryRockstarAlbumsImplicit = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarAlbumsImplicit", + __Marshaller_QueryRockstarAlbumsImplicit, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetQueryRockstarAlbumsLeftJoin = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarAlbumsLeftJoin", + __Marshaller_QueryRockstarAlbumsLeftJoin, + __Marshaller_QueryResponse_CustomRockstar); + + static readonly grpc::Method __Method_GetQueryRockstarAlias = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarAlias", + __Marshaller_QueryRockstarAlias, + __Marshaller_QueryResponse_RockstarAlias); + + static readonly grpc::Method __Method_GetQueryRockstarAudit = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarAudit", + __Marshaller_QueryRockstarAudit, + __Marshaller_QueryResponse_RockstarAuto); + + static readonly grpc::Method __Method_GetQueryRockstarAuditSubOr = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarAuditSubOr", + __Marshaller_QueryRockstarAuditSubOr, + __Marshaller_QueryResponse_RockstarAuto); + + static readonly grpc::Method __Method_GetQueryRockstarFilters = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarFilters", + __Marshaller_QueryRockstarFilters, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstars", + __Marshaller_QueryRockstars, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryRockstarsConventions = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarsConventions", + __Marshaller_QueryRockstarsConventions, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryRockstarsFilter = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarsFilter", + __Marshaller_QueryRockstarsFilter, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryRockstarsIFilter = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarsIFilter", + __Marshaller_QueryRockstarsIFilter, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryRockstarsImplicit = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarsImplicit", + __Marshaller_QueryRockstarsImplicit, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_GetQueryRockstarsWithReferences = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryRockstarsWithReferences", + __Marshaller_QueryRockstarsWithReferences, + __Marshaller_QueryResponse_RockstarReference); + + static readonly grpc::Method __Method_GetQueryTypeWithEnums = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryTypeWithEnums", + __Marshaller_QueryTypeWithEnums, + __Marshaller_QueryResponse_TypeWithEnum); + + static readonly grpc::Method __Method_GetQueryUnknownRockstars = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetQueryUnknownRockstars", + __Marshaller_QueryUnknownRockstars, + __Marshaller_QueryResponse_Rockstar); + + static readonly grpc::Method __Method_DeleteRealDeleteAuditTenant = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteRealDeleteAuditTenant", + __Marshaller_RealDeleteAuditTenant, + __Marshaller_RockstarWithIdAndCountResponse); + + static readonly grpc::Method __Method_DeleteRealDeleteAuditTenantGateway = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteRealDeleteAuditTenantGateway", + __Marshaller_RealDeleteAuditTenantGateway, + __Marshaller_RockstarWithIdAndCountResponse); + + static readonly grpc::Method __Method_DeleteRealDeleteAuditTenantMq = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteRealDeleteAuditTenantMq", + __Marshaller_RealDeleteAuditTenantMq, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PostRegenerateApiKeys = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostRegenerateApiKeys", + __Marshaller_RegenerateApiKeys, + __Marshaller_RegenerateApiKeysResponse); + + static readonly grpc::Method __Method_PutRegister = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutRegister", + __Marshaller_Register, + __Marshaller_RegisterResponse); + + static readonly grpc::Method __Method_PostRegister = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostRegister", + __Marshaller_Register, + __Marshaller_RegisterResponse); + + static readonly grpc::Method __Method_GetRequiresAuth = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetRequiresAuth", + __Marshaller_RequiresAuth, + __Marshaller_RequiresAuth); + + static readonly grpc::Method __Method_PostRequiresAuth = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostRequiresAuth", + __Marshaller_RequiresAuth, + __Marshaller_RequiresAuth); + + static readonly grpc::Method __Method_PutRequiresAuth = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutRequiresAuth", + __Marshaller_RequiresAuth, + __Marshaller_RequiresAuth); + + static readonly grpc::Method __Method_DeleteRequiresAuth = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "DeleteRequiresAuth", + __Marshaller_RequiresAuth, + __Marshaller_RequiresAuth); + + static readonly grpc::Method __Method_PostResetTodos = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostResetTodos", + __Marshaller_ResetTodos, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_GetSearchMovies = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetSearchMovies", + __Marshaller_SearchMovies, + __Marshaller_QueryResponse_Movie); + + static readonly grpc::Method __Method_PostSecured = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostSecured", + __Marshaller_Secured, + __Marshaller_SecuredResponse); + + static readonly grpc::Method __Method_PutSoftDeleteAuditTenant = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutSoftDeleteAuditTenant", + __Marshaller_SoftDeleteAuditTenant, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_ServerStreamFiles = new grpc::Method( + grpc::MethodType.ServerStreaming, + __ServiceName, + "ServerStreamFiles", + __Marshaller_StreamFiles, + __Marshaller_FileContent); + + static readonly grpc::Method __Method_GetStreamMovies = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetStreamMovies", + __Marshaller_StreamMovies, + __Marshaller_QueryResponse_Movie); + + static readonly grpc::Method __Method_ServerStreamServerEvents = new grpc::Method( + grpc::MethodType.ServerStreaming, + __ServiceName, + "ServerStreamServerEvents", + __Marshaller_StreamServerEvents, + __Marshaller_StreamServerEventsResponse); + + static readonly grpc::Method __Method_PostTestAuthValidators = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostTestAuthValidators", + __Marshaller_TestAuthValidators, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_PostTestDbCondition = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostTestDbCondition", + __Marshaller_TestDbCondition, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_PostTestDbValidator = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostTestDbValidator", + __Marshaller_TestDbValidator, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_PostTestIsAdmin = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostTestIsAdmin", + __Marshaller_TestIsAdmin, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_PostTestMultiAuthValidators = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostTestMultiAuthValidators", + __Marshaller_TestMultiAuthValidators, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_GetThrow = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetThrow", + __Marshaller_Throw, + __Marshaller_HelloResponse); + + static readonly grpc::Method __Method_GetThrowCustom = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetThrowCustom", + __Marshaller_ThrowCustom, + __Marshaller_ThrowCustomResponse); + + static readonly grpc::Method __Method_GetThrowVoid = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetThrowVoid", + __Marshaller_ThrowVoid, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PostTriggerAllValidators = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostTriggerAllValidators", + __Marshaller_TriggerAllValidators, + __Marshaller_RockstarWithIdResponse); + + static readonly grpc::Method __Method_PostTriggerValidators = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostTriggerValidators", + __Marshaller_TriggerValidators, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PostUnAssignRoles = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostUnAssignRoles", + __Marshaller_UnAssignRoles, + __Marshaller_UnAssignRolesResponse); + + static readonly grpc::Method __Method_PutUpdateConnectionInfoRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutUpdateConnectionInfoRockstar", + __Marshaller_UpdateConnectionInfoRockstar, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PutUpdateNamedRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutUpdateNamedRockstar", + __Marshaller_UpdateNamedRockstar, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PutUpdateRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutUpdateRockstar", + __Marshaller_UpdateRockstar, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PutUpdateRockstarAdhocNonDefaults = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutUpdateRockstarAdhocNonDefaults", + __Marshaller_UpdateRockstarAdhocNonDefaults, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PatchUpdateRockstarAudit = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PatchUpdateRockstarAudit", + __Marshaller_UpdateRockstarAudit, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PutUpdateRockstarAuditTenant = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutUpdateRockstarAuditTenant", + __Marshaller_UpdateRockstarAuditTenant, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PutUpdateRockstarAuditTenantGateway = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutUpdateRockstarAuditTenantGateway", + __Marshaller_UpdateRockstarAuditTenantGateway, + __Marshaller_RockstarWithIdAndResultResponse); + + static readonly grpc::Method __Method_PutUpdateRockstarAuditTenantMq = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutUpdateRockstarAuditTenantMq", + __Marshaller_UpdateRockstarAuditTenantMq, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PatchUpdateRockstarVersion = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PatchUpdateRockstarVersion", + __Marshaller_UpdateRockstarVersion, + __Marshaller_RockstarWithIdAndRowVersionResponse); + + static readonly grpc::Method __Method_PutUpdateTodo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PutUpdateTodo", + __Marshaller_UpdateTodo, + __Marshaller_EmptyResponse); + + static readonly grpc::Method __Method_PostValidateCreateRockstar = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "PostValidateCreateRockstar", + __Marshaller_ValidateCreateRockstar, + __Marshaller_RockstarWithIdResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of GrpcServices + [grpc::BindServiceMethod(typeof(GrpcServices), "BindService")] + public abstract partial class GrpcServicesBase + { + public virtual global::System.Threading.Tasks.Task GetAddHeader(global::ServiceStack.Extensions.Tests.Protoc.AddHeader request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostAssignRoles(global::ServiceStack.Extensions.Tests.Protoc.AssignRoles request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task OptionsAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetChangeConnectionInfo(global::ServiceStack.Extensions.Tests.Protoc.ChangeConnectionInfo request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetChangeDb(global::ServiceStack.Extensions.Tests.Protoc.ChangeDb request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostConvertSessionToToken(global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToToken request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateBookmark(global::ServiceStack.Extensions.Tests.Protoc.CreateBookmark request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateConnectionInfoRockstar(global::ServiceStack.Extensions.Tests.Protoc.CreateConnectionInfoRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateNamedRockstar(global::ServiceStack.Extensions.Tests.Protoc.CreateNamedRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstar(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarAdhocNonDefaults(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAdhocNonDefaults request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAudit request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarAuditMqToken(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditMqToken request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenant request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantGateway request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarAutoMap(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAutoMap request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarVersion(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarVersion request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarWithAutoGuid(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithAutoGuid request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarWithReturn(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturn request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateRockstarWithVoidReturn(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithVoidReturn request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCreateTodo(global::ServiceStack.Extensions.Tests.Protoc.CreateTodo request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostCustomValidationErrors(global::ServiceStack.Extensions.Tests.Protoc.CustomValidationErrors request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallDeleteRockstar(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallDeleteRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarAudit request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallDeleteRockstarFilters(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarFilters request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallDeleteTodo(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodo request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallDeleteTodos(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodos request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryGetRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryCustomRockstarsSchema(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicSearchMovies(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryMovies(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryUnknownRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarsWithReferences(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryAllFields(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryTypeWithEnums(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryAdhocRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryAdhoc(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryChangeDb(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryJoinedRockstarAlbumsCustomSelect(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryFoos(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryOverridedRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryOverridedCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryCaseInsensitiveOrderBy(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicStreamMovies(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryCustomRockstarsReferences(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarAlbumsCustomLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryChangeConnectionInfo(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarAuditSubOr(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryBookmarks(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryNamedRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryPagingTest(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarsConventions(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryJoinedRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarAlbumsImplicit(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarAlbumsLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryMultiJoinRockstar(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryFieldRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarAlias(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryFieldRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryCustomRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarsIFilter(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryOrRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarsImplicit(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryOrRockstarsFields(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryFieldsImplicitConventions(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryGetRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetDynamicQueryRockstarFilters(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostDynamicValidationRules(global::ServiceStack.Extensions.Tests.Protoc.DynamicValidationRules request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostEmptyValidators(global::ServiceStack.Extensions.Tests.Protoc.EmptyValidators request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostGetAccessToken(global::ServiceStack.Extensions.Tests.Protoc.GetAccessToken request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallGetApiKeys(global::ServiceStack.Extensions.Tests.Protoc.GetApiKeys request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallGetFile(global::ServiceStack.Extensions.Tests.Protoc.GetFile request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallGetHello(global::ServiceStack.Extensions.Tests.Protoc.GetHello request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallGetTodo(global::ServiceStack.Extensions.Tests.Protoc.GetTodo request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallGetTodos(global::ServiceStack.Extensions.Tests.Protoc.GetTodos request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostMultiply(global::ServiceStack.Extensions.Tests.Protoc.Multiply request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostNoAbstractValidator(global::ServiceStack.Extensions.Tests.Protoc.NoAbstractValidator request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostOnlyValidatesRequest(global::ServiceStack.Extensions.Tests.Protoc.OnlyValidatesRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallPatchRockstar(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallPatchRockstarAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenant request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallPatchRockstarAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantGateway request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallPatchRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantMq request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task CallPostChatToChannel(global::ServiceStack.Extensions.Tests.Protoc.PostChatToChannel request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryAdhoc(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhoc request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryAdhocRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhocRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryAllFields(global::ServiceStack.Extensions.Tests.Protoc.QueryAllFields request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryBookmarks(global::ServiceStack.Extensions.Tests.Protoc.QueryBookmarks request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryCaseInsensitiveOrderBy(global::ServiceStack.Extensions.Tests.Protoc.QueryCaseInsensitiveOrderBy request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryChangeConnectionInfo(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeConnectionInfo request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryChangeDb(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeDb request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryCustomRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsFilter request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryCustomRockstarsReferences(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsReferences request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryCustomRockstarsSchema(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsSchema request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryFieldRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryFieldRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstarsDynamic request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryFieldsImplicitConventions(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldsImplicitConventions request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryFoos(global::ServiceStack.Extensions.Tests.Protoc.QueryFoos request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryGetRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryGetRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstarsDynamic request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryJoinedRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbums request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryJoinedRockstarAlbumsCustomSelect(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelect request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryJoinedRockstarAlbumsCustomSelectResponse(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelectResponse request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryMovies(global::ServiceStack.Extensions.Tests.Protoc.QueryMovies request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryMultiJoinRockstar(global::ServiceStack.Extensions.Tests.Protoc.QueryMultiJoinRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryNamedRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryNamedRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryOrRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryOrRockstarsFields(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstarsFields request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryOverridedCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedCustomRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryOverridedRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryPagingTest(global::ServiceStack.Extensions.Tests.Protoc.QueryPagingTest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbums request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarAlbumsCustomLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsCustomLeftJoin request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarAlbumsImplicit(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsImplicit request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarAlbumsLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsLeftJoin request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarAlias(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlias request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAudit request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarAuditSubOr(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAuditSubOr request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarFilters(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarFilters request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarsConventions(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsConventions request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsFilter request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarsIFilter(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsIFilter request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarsImplicit(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsImplicit request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryRockstarsWithReferences(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsWithReferences request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryTypeWithEnums(global::ServiceStack.Extensions.Tests.Protoc.QueryTypeWithEnums request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetQueryUnknownRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryUnknownRockstars request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteRealDeleteAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenant request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteRealDeleteAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantGateway request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteRealDeleteAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantMq request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostRegenerateApiKeys(global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeys request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutRegister(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostRegister(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task DeleteRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostResetTodos(global::ServiceStack.Extensions.Tests.Protoc.ResetTodos request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetSearchMovies(global::ServiceStack.Extensions.Tests.Protoc.SearchMovies request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostSecured(global::ServiceStack.Extensions.Tests.Protoc.Secured request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutSoftDeleteAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenant request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task ServerStreamFiles(global::ServiceStack.Extensions.Tests.Protoc.StreamFiles request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetStreamMovies(global::ServiceStack.Extensions.Tests.Protoc.StreamMovies request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task ServerStreamServerEvents(global::ServiceStack.Extensions.Tests.Protoc.StreamServerEvents request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostTestAuthValidators(global::ServiceStack.Extensions.Tests.Protoc.TestAuthValidators request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostTestDbCondition(global::ServiceStack.Extensions.Tests.Protoc.TestDbCondition request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostTestDbValidator(global::ServiceStack.Extensions.Tests.Protoc.TestDbValidator request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostTestIsAdmin(global::ServiceStack.Extensions.Tests.Protoc.TestIsAdmin request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostTestMultiAuthValidators(global::ServiceStack.Extensions.Tests.Protoc.TestMultiAuthValidators request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetThrow(global::ServiceStack.Extensions.Tests.Protoc.Throw request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetThrowCustom(global::ServiceStack.Extensions.Tests.Protoc.ThrowCustom request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task GetThrowVoid(global::ServiceStack.Extensions.Tests.Protoc.ThrowVoid request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostTriggerAllValidators(global::ServiceStack.Extensions.Tests.Protoc.TriggerAllValidators request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostTriggerValidators(global::ServiceStack.Extensions.Tests.Protoc.TriggerValidators request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostUnAssignRoles(global::ServiceStack.Extensions.Tests.Protoc.UnAssignRoles request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutUpdateConnectionInfoRockstar(global::ServiceStack.Extensions.Tests.Protoc.UpdateConnectionInfoRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutUpdateNamedRockstar(global::ServiceStack.Extensions.Tests.Protoc.UpdateNamedRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutUpdateRockstar(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutUpdateRockstarAdhocNonDefaults(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAdhocNonDefaults request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PatchUpdateRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAudit request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutUpdateRockstarAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenant request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutUpdateRockstarAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantGateway request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutUpdateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantMq request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PatchUpdateRockstarVersion(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarVersion request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PutUpdateTodo(global::ServiceStack.Extensions.Tests.Protoc.UpdateTodo request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task PostValidateCreateRockstar(global::ServiceStack.Extensions.Tests.Protoc.ValidateCreateRockstar request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for GrpcServices + public partial class GrpcServicesClient : grpc::ClientBase + { + /// Creates a new client for GrpcServices + /// The channel to use to make remote calls. + public GrpcServicesClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for GrpcServices that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public GrpcServicesClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected GrpcServicesClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected GrpcServicesClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse GetAddHeader(global::ServiceStack.Extensions.Tests.Protoc.AddHeader request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetAddHeader(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse GetAddHeader(global::ServiceStack.Extensions.Tests.Protoc.AddHeader request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetAddHeader, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetAddHeaderAsync(global::ServiceStack.Extensions.Tests.Protoc.AddHeader request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetAddHeaderAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetAddHeaderAsync(global::ServiceStack.Extensions.Tests.Protoc.AddHeader request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetAddHeader, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse GetAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetAnyHello(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse GetAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetAnyHello, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetAnyHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetAnyHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetAnyHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetAnyHello, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse PostAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostAnyHello(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse PostAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostAnyHello, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostAnyHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostAnyHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostAnyHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostAnyHello, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse PutAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutAnyHello(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse PutAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutAnyHello, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutAnyHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutAnyHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutAnyHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutAnyHello, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse DeleteAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteAnyHello(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse DeleteAnyHello(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteAnyHello, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteAnyHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteAnyHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteAnyHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.AnyHello request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteAnyHello, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AssignRolesResponse PostAssignRoles(global::ServiceStack.Extensions.Tests.Protoc.AssignRoles request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostAssignRoles(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AssignRolesResponse PostAssignRoles(global::ServiceStack.Extensions.Tests.Protoc.AssignRoles request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostAssignRoles, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostAssignRolesAsync(global::ServiceStack.Extensions.Tests.Protoc.AssignRoles request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostAssignRolesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostAssignRolesAsync(global::ServiceStack.Extensions.Tests.Protoc.AssignRoles request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostAssignRoles, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse OptionsAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return OptionsAuthenticate(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse OptionsAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_OptionsAuthenticate, null, options, request); + } + public virtual grpc::AsyncUnaryCall OptionsAuthenticateAsync(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return OptionsAuthenticateAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall OptionsAuthenticateAsync(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_OptionsAuthenticate, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse GetAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetAuthenticate(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse GetAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetAuthenticate, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetAuthenticateAsync(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetAuthenticateAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetAuthenticateAsync(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetAuthenticate, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse PostAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostAuthenticate(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse PostAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostAuthenticate, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostAuthenticateAsync(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostAuthenticateAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostAuthenticateAsync(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostAuthenticate, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse DeleteAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteAuthenticate(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.AuthenticateResponse DeleteAuthenticate(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteAuthenticate, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteAuthenticateAsync(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteAuthenticateAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteAuthenticateAsync(global::ServiceStack.Extensions.Tests.Protoc.Authenticate request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteAuthenticate, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ChangeDbResponse GetChangeConnectionInfo(global::ServiceStack.Extensions.Tests.Protoc.ChangeConnectionInfo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetChangeConnectionInfo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ChangeDbResponse GetChangeConnectionInfo(global::ServiceStack.Extensions.Tests.Protoc.ChangeConnectionInfo request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetChangeConnectionInfo, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetChangeConnectionInfoAsync(global::ServiceStack.Extensions.Tests.Protoc.ChangeConnectionInfo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetChangeConnectionInfoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetChangeConnectionInfoAsync(global::ServiceStack.Extensions.Tests.Protoc.ChangeConnectionInfo request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetChangeConnectionInfo, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ChangeDbResponse GetChangeDb(global::ServiceStack.Extensions.Tests.Protoc.ChangeDb request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetChangeDb(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ChangeDbResponse GetChangeDb(global::ServiceStack.Extensions.Tests.Protoc.ChangeDb request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetChangeDb, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetChangeDbAsync(global::ServiceStack.Extensions.Tests.Protoc.ChangeDb request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetChangeDbAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetChangeDbAsync(global::ServiceStack.Extensions.Tests.Protoc.ChangeDb request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetChangeDb, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToTokenResponse PostConvertSessionToToken(global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToToken request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostConvertSessionToToken(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToTokenResponse PostConvertSessionToToken(global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToToken request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostConvertSessionToToken, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostConvertSessionToTokenAsync(global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToToken request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostConvertSessionToTokenAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostConvertSessionToTokenAsync(global::ServiceStack.Extensions.Tests.Protoc.ConvertSessionToToken request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostConvertSessionToToken, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.CreateBookmarkResponse PostCreateBookmark(global::ServiceStack.Extensions.Tests.Protoc.CreateBookmark request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateBookmark(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.CreateBookmarkResponse PostCreateBookmark(global::ServiceStack.Extensions.Tests.Protoc.CreateBookmark request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateBookmark, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateBookmarkAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateBookmark request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateBookmarkAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateBookmarkAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateBookmark request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateBookmark, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateConnectionInfoRockstar(global::ServiceStack.Extensions.Tests.Protoc.CreateConnectionInfoRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateConnectionInfoRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateConnectionInfoRockstar(global::ServiceStack.Extensions.Tests.Protoc.CreateConnectionInfoRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateConnectionInfoRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateConnectionInfoRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateConnectionInfoRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateConnectionInfoRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateConnectionInfoRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateConnectionInfoRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateConnectionInfoRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateNamedRockstar(global::ServiceStack.Extensions.Tests.Protoc.CreateNamedRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateNamedRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateNamedRockstar(global::ServiceStack.Extensions.Tests.Protoc.CreateNamedRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateNamedRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateNamedRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateNamedRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateNamedRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateNamedRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateNamedRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateNamedRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarResponse PostCreateRockstar(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarResponse PostCreateRockstar(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarAdhocNonDefaults(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAdhocNonDefaults request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAdhocNonDefaults(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarAdhocNonDefaults(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAdhocNonDefaults request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarAdhocNonDefaults, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAdhocNonDefaultsAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAdhocNonDefaults request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAdhocNonDefaultsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAdhocNonDefaultsAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAdhocNonDefaults request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarAdhocNonDefaults, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostCreateRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAudit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAudit(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostCreateRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAudit request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarAudit, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAudit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAuditAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAudit request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarAudit, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostCreateRockstarAuditMqToken(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditMqToken request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAuditMqToken(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostCreateRockstarAuditMqToken(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditMqToken request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarAuditMqToken, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditMqTokenAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditMqToken request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAuditMqTokenAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditMqTokenAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditMqToken request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarAuditMqToken, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAuditTenant(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarAuditTenant, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAuditTenantAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarAuditTenant, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantGateway request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAuditTenantGateway(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantGateway request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarAuditTenantGateway, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditTenantGatewayAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantGateway request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAuditTenantGatewayAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditTenantGatewayAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantGateway request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarAuditTenantGateway, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse GetCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetCreateRockstarAuditTenantMq(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse GetCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetCreateRockstarAuditTenantMq, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetCreateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetCreateRockstarAuditTenantMqAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetCreateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetCreateRockstarAuditTenantMq, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAuditTenantMq(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarAuditTenantMq, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAuditTenantMqAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarAuditTenantMq, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutCreateRockstarAuditTenantMq(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutCreateRockstarAuditTenantMq, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutCreateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutCreateRockstarAuditTenantMqAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutCreateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutCreateRockstarAuditTenantMq, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse DeleteCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteCreateRockstarAuditTenantMq(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse DeleteCreateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteCreateRockstarAuditTenantMq, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteCreateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteCreateRockstarAuditTenantMqAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteCreateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteCreateRockstarAuditTenantMq, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarAutoMap(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAutoMap request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAutoMap(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarAutoMap(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAutoMap request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarAutoMap, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAutoMapAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAutoMap request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarAutoMapAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarAutoMapAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarAutoMap request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarAutoMap, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndRowVersionResponse PostCreateRockstarVersion(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarVersion request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarVersion(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndRowVersionResponse PostCreateRockstarVersion(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarVersion request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarVersion, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarVersionAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarVersion request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarVersionAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarVersionAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarVersion request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarVersion, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturnGuidResponse PostCreateRockstarWithAutoGuid(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithAutoGuid request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarWithAutoGuid(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturnGuidResponse PostCreateRockstarWithAutoGuid(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithAutoGuid request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarWithAutoGuid, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarWithAutoGuidAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithAutoGuid request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarWithAutoGuidAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarWithAutoGuidAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithAutoGuid request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarWithAutoGuid, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarWithReturn(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturn request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarWithReturn(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PostCreateRockstarWithReturn(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturn request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarWithReturn, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarWithReturnAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturn request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarWithReturnAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarWithReturnAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithReturn request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarWithReturn, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostCreateRockstarWithVoidReturn(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithVoidReturn request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarWithVoidReturn(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostCreateRockstarWithVoidReturn(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithVoidReturn request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateRockstarWithVoidReturn, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarWithVoidReturnAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithVoidReturn request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateRockstarWithVoidReturnAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateRockstarWithVoidReturnAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateRockstarWithVoidReturn request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateRockstarWithVoidReturn, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.CreateTodoResponse PostCreateTodo(global::ServiceStack.Extensions.Tests.Protoc.CreateTodo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateTodo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.CreateTodoResponse PostCreateTodo(global::ServiceStack.Extensions.Tests.Protoc.CreateTodo request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCreateTodo, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCreateTodoAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateTodo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCreateTodoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCreateTodoAsync(global::ServiceStack.Extensions.Tests.Protoc.CreateTodo request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCreateTodo, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostCustomValidationErrors(global::ServiceStack.Extensions.Tests.Protoc.CustomValidationErrors request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCustomValidationErrors(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostCustomValidationErrors(global::ServiceStack.Extensions.Tests.Protoc.CustomValidationErrors request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostCustomValidationErrors, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostCustomValidationErrorsAsync(global::ServiceStack.Extensions.Tests.Protoc.CustomValidationErrors request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostCustomValidationErrorsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostCustomValidationErrorsAsync(global::ServiceStack.Extensions.Tests.Protoc.CustomValidationErrors request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostCustomValidationErrors, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallDeleteRockstar(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallDeleteRockstar(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallDeleteRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallDeleteRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallDeleteRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallDeleteRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndCountResponse CallDeleteRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarAudit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteRockstarAudit(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndCountResponse CallDeleteRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarAudit request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallDeleteRockstarAudit, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallDeleteRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarAudit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteRockstarAuditAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallDeleteRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarAudit request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallDeleteRockstarAudit, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarCountResponse CallDeleteRockstarFilters(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarFilters request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteRockstarFilters(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarCountResponse CallDeleteRockstarFilters(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarFilters request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallDeleteRockstarFilters, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallDeleteRockstarFiltersAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarFilters request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteRockstarFiltersAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallDeleteRockstarFiltersAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteRockstarFilters request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallDeleteRockstarFilters, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallDeleteTodo(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteTodo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallDeleteTodo(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodo request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallDeleteTodo, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallDeleteTodoAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteTodoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallDeleteTodoAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodo request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallDeleteTodo, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallDeleteTodos(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodos request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteTodos(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallDeleteTodos(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodos request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallDeleteTodos, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallDeleteTodosAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodos request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallDeleteTodosAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallDeleteTodosAsync(global::ServiceStack.Extensions.Tests.Protoc.DeleteTodos request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallDeleteTodos, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryGetRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryGetRockstarsDynamic(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryGetRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryGetRockstarsDynamic, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryGetRockstarsDynamicAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryGetRockstarsDynamicAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryGetRockstarsDynamicAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryGetRockstarsDynamic, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstarSchema GetDynamicQueryCustomRockstarsSchema(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCustomRockstarsSchema(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstarSchema GetDynamicQueryCustomRockstarsSchema(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryCustomRockstarsSchema, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCustomRockstarsSchemaAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCustomRockstarsSchemaAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCustomRockstarsSchemaAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryCustomRockstarsSchema, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetDynamicSearchMovies(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicSearchMovies(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetDynamicSearchMovies(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicSearchMovies, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicSearchMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicSearchMoviesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicSearchMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicSearchMovies, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetDynamicQueryMovies(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryMovies(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetDynamicQueryMovies(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryMovies, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryMoviesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryMovies, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryUnknownRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryUnknownRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryUnknownRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryUnknownRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryUnknownRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryUnknownRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryUnknownRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryUnknownRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference GetDynamicQueryRockstarsWithReferences(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsWithReferences(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference GetDynamicQueryRockstarsWithReferences(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarsWithReferences, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsWithReferencesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsWithReferencesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsWithReferencesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarsWithReferences, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_AllFields GetDynamicQueryAllFields(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryAllFields(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_AllFields GetDynamicQueryAllFields(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryAllFields, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryAllFieldsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryAllFieldsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryAllFieldsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryAllFields, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_TypeWithEnum GetDynamicQueryTypeWithEnums(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryTypeWithEnums(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_TypeWithEnum GetDynamicQueryTypeWithEnums(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryTypeWithEnums, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryTypeWithEnumsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryTypeWithEnumsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryTypeWithEnumsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryTypeWithEnums, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryAdhocRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryAdhocRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryAdhocRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryAdhocRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryAdhocRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryAdhocRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryAdhocRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryAdhocRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Adhoc GetDynamicQueryAdhoc(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryAdhoc(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Adhoc GetDynamicQueryAdhoc(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryAdhoc, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryAdhocAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryAdhocAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryAdhocAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryAdhoc, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryChangeDb(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryChangeDb(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryChangeDb(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryChangeDb, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryChangeDbAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryChangeDbAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryChangeDbAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryChangeDb, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstar GetDynamicQueryJoinedRockstarAlbumsCustomSelect(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryJoinedRockstarAlbumsCustomSelect(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstar GetDynamicQueryJoinedRockstarAlbumsCustomSelect(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelect, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryJoinedRockstarAlbumsCustomSelectAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryJoinedRockstarAlbumsCustomSelectAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryJoinedRockstarAlbumsCustomSelectAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelect, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstarResponse GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstarResponse GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponseAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponseAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponseAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Foo GetDynamicQueryFoos(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryFoos(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Foo GetDynamicQueryFoos(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryFoos, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryFoosAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryFoosAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryFoosAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryFoos, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryOverridedRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryOverridedRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryOverridedRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryOverridedRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryOverridedRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryOverridedRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryOverridedRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryOverridedRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryOverridedCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryOverridedCustomRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryOverridedCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryOverridedCustomRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryOverridedCustomRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryOverridedCustomRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryOverridedCustomRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryOverridedCustomRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryCaseInsensitiveOrderBy(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCaseInsensitiveOrderBy(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryCaseInsensitiveOrderBy(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryCaseInsensitiveOrderBy, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCaseInsensitiveOrderByAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCaseInsensitiveOrderByAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCaseInsensitiveOrderByAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryCaseInsensitiveOrderBy, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetDynamicStreamMovies(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicStreamMovies(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetDynamicStreamMovies(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicStreamMovies, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicStreamMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicStreamMoviesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicStreamMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicStreamMovies, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference GetDynamicQueryCustomRockstarsReferences(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCustomRockstarsReferences(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference GetDynamicQueryCustomRockstarsReferences(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryCustomRockstarsReferences, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCustomRockstarsReferencesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCustomRockstarsReferencesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCustomRockstarsReferencesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryCustomRockstarsReferences, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryRockstarAlbumsCustomLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAlbumsCustomLeftJoin(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryRockstarAlbumsCustomLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarAlbumsCustomLeftJoin, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAlbumsCustomLeftJoinAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAlbumsCustomLeftJoinAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAlbumsCustomLeftJoinAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarAlbumsCustomLeftJoin, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryChangeConnectionInfo(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryChangeConnectionInfo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryChangeConnectionInfo(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryChangeConnectionInfo, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryChangeConnectionInfoAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryChangeConnectionInfoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryChangeConnectionInfoAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryChangeConnectionInfo, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto GetDynamicQueryRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAudit(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto GetDynamicQueryRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarAudit, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAuditAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarAudit, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto GetDynamicQueryRockstarAuditSubOr(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAuditSubOr(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto GetDynamicQueryRockstarAuditSubOr(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarAuditSubOr, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAuditSubOrAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAuditSubOrAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAuditSubOrAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarAuditSubOr, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Bookmark GetDynamicQueryBookmarks(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryBookmarks(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Bookmark GetDynamicQueryBookmarks(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryBookmarks, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryBookmarksAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryBookmarksAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryBookmarksAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryBookmarks, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_NamedRockstar GetDynamicQueryNamedRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryNamedRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_NamedRockstar GetDynamicQueryNamedRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryNamedRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryNamedRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryNamedRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryNamedRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryNamedRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlbum GetDynamicQueryRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAlbums(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlbum GetDynamicQueryRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarAlbums, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAlbumsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAlbumsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAlbumsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarAlbums, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_PagingTest GetDynamicQueryPagingTest(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryPagingTest(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_PagingTest GetDynamicQueryPagingTest(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryPagingTest, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryPagingTestAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryPagingTestAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryPagingTestAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryPagingTest, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarsConventions(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsConventions(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarsConventions(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarsConventions, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsConventionsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsConventionsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsConventionsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarsConventions, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCustomRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryCustomRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCustomRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCustomRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCustomRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryCustomRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryJoinedRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryJoinedRockstarAlbums(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryJoinedRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryJoinedRockstarAlbums, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryJoinedRockstarAlbumsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryJoinedRockstarAlbumsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryJoinedRockstarAlbumsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryJoinedRockstarAlbums, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryRockstarAlbumsImplicit(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAlbumsImplicit(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryRockstarAlbumsImplicit(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarAlbumsImplicit, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAlbumsImplicitAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAlbumsImplicitAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAlbumsImplicitAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarAlbumsImplicit, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryRockstarAlbumsLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAlbumsLeftJoin(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryRockstarAlbumsLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarAlbumsLeftJoin, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAlbumsLeftJoinAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAlbumsLeftJoinAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAlbumsLeftJoinAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarAlbumsLeftJoin, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryMultiJoinRockstar(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryMultiJoinRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryMultiJoinRockstar(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryMultiJoinRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryMultiJoinRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryMultiJoinRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryMultiJoinRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryMultiJoinRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryFieldRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryFieldRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryFieldRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryFieldRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryFieldRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryFieldRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryFieldRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryFieldRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlias GetDynamicQueryRockstarAlias(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAlias(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlias GetDynamicQueryRockstarAlias(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarAlias, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAliasAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarAliasAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarAliasAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarAlias, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryFieldRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryFieldRockstarsDynamic(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryFieldRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryFieldRockstarsDynamic, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryFieldRockstarsDynamicAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryFieldRockstarsDynamicAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryFieldRockstarsDynamicAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryFieldRockstarsDynamic, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsFilter(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarsFilter, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsFilterAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarsFilter, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryCustomRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCustomRockstarsFilter(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetDynamicQueryCustomRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryCustomRockstarsFilter, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCustomRockstarsFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryCustomRockstarsFilterAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryCustomRockstarsFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryCustomRockstarsFilter, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarsIFilter(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsIFilter(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarsIFilter(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarsIFilter, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsIFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsIFilterAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsIFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarsIFilter, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryOrRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryOrRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryOrRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryOrRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryOrRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryOrRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryOrRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryOrRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarsImplicit(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsImplicit(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarsImplicit(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarsImplicit, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsImplicitAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarsImplicitAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarsImplicitAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarsImplicit, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryOrRockstarsFields(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryOrRockstarsFields(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryOrRockstarsFields(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryOrRockstarsFields, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryOrRockstarsFieldsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryOrRockstarsFieldsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryOrRockstarsFieldsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryOrRockstarsFields, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryFieldsImplicitConventions(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryFieldsImplicitConventions(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryFieldsImplicitConventions(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryFieldsImplicitConventions, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryFieldsImplicitConventionsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryFieldsImplicitConventionsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryFieldsImplicitConventionsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryFieldsImplicitConventions, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryGetRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryGetRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryGetRockstars(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryGetRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryGetRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryGetRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryGetRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryGetRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarFilters(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarFilters(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetDynamicQueryRockstarFilters(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetDynamicQueryRockstarFilters, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarFiltersAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetDynamicQueryRockstarFiltersAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetDynamicQueryRockstarFiltersAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetDynamicQueryRockstarFilters, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostDynamicValidationRules(global::ServiceStack.Extensions.Tests.Protoc.DynamicValidationRules request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostDynamicValidationRules(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostDynamicValidationRules(global::ServiceStack.Extensions.Tests.Protoc.DynamicValidationRules request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostDynamicValidationRules, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostDynamicValidationRulesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicValidationRules request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostDynamicValidationRulesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostDynamicValidationRulesAsync(global::ServiceStack.Extensions.Tests.Protoc.DynamicValidationRules request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostDynamicValidationRules, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostEmptyValidators(global::ServiceStack.Extensions.Tests.Protoc.EmptyValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostEmptyValidators(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostEmptyValidators(global::ServiceStack.Extensions.Tests.Protoc.EmptyValidators request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostEmptyValidators, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostEmptyValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.EmptyValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostEmptyValidatorsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostEmptyValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.EmptyValidators request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostEmptyValidators, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse GetEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetEndsWithSuffixRequest(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse GetEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetEndsWithSuffixRequest, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetEndsWithSuffixRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetEndsWithSuffixRequestAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetEndsWithSuffixRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetEndsWithSuffixRequest, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse PostEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostEndsWithSuffixRequest(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse PostEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostEndsWithSuffixRequest, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostEndsWithSuffixRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostEndsWithSuffixRequestAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostEndsWithSuffixRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostEndsWithSuffixRequest, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse PutEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutEndsWithSuffixRequest(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse PutEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutEndsWithSuffixRequest, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutEndsWithSuffixRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutEndsWithSuffixRequestAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutEndsWithSuffixRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutEndsWithSuffixRequest, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse DeleteEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteEndsWithSuffixRequest(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixResponse DeleteEndsWithSuffixRequest(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteEndsWithSuffixRequest, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteEndsWithSuffixRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteEndsWithSuffixRequestAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteEndsWithSuffixRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.EndsWithSuffixRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteEndsWithSuffixRequest, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.GetAccessTokenResponse PostGetAccessToken(global::ServiceStack.Extensions.Tests.Protoc.GetAccessToken request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostGetAccessToken(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.GetAccessTokenResponse PostGetAccessToken(global::ServiceStack.Extensions.Tests.Protoc.GetAccessToken request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostGetAccessToken, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostGetAccessTokenAsync(global::ServiceStack.Extensions.Tests.Protoc.GetAccessToken request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostGetAccessTokenAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostGetAccessTokenAsync(global::ServiceStack.Extensions.Tests.Protoc.GetAccessToken request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostGetAccessToken, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.GetApiKeysResponse CallGetApiKeys(global::ServiceStack.Extensions.Tests.Protoc.GetApiKeys request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetApiKeys(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.GetApiKeysResponse CallGetApiKeys(global::ServiceStack.Extensions.Tests.Protoc.GetApiKeys request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallGetApiKeys, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallGetApiKeysAsync(global::ServiceStack.Extensions.Tests.Protoc.GetApiKeys request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetApiKeysAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallGetApiKeysAsync(global::ServiceStack.Extensions.Tests.Protoc.GetApiKeys request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallGetApiKeys, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.FileContent CallGetFile(global::ServiceStack.Extensions.Tests.Protoc.GetFile request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetFile(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.FileContent CallGetFile(global::ServiceStack.Extensions.Tests.Protoc.GetFile request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallGetFile, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallGetFileAsync(global::ServiceStack.Extensions.Tests.Protoc.GetFile request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetFileAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallGetFileAsync(global::ServiceStack.Extensions.Tests.Protoc.GetFile request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallGetFile, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse CallGetHello(global::ServiceStack.Extensions.Tests.Protoc.GetHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetHello(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse CallGetHello(global::ServiceStack.Extensions.Tests.Protoc.GetHello request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallGetHello, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallGetHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.GetHello request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallGetHelloAsync(global::ServiceStack.Extensions.Tests.Protoc.GetHello request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallGetHello, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.GetTodoResponse CallGetTodo(global::ServiceStack.Extensions.Tests.Protoc.GetTodo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetTodo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.GetTodoResponse CallGetTodo(global::ServiceStack.Extensions.Tests.Protoc.GetTodo request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallGetTodo, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallGetTodoAsync(global::ServiceStack.Extensions.Tests.Protoc.GetTodo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetTodoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallGetTodoAsync(global::ServiceStack.Extensions.Tests.Protoc.GetTodo request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallGetTodo, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.GetTodosResponse CallGetTodos(global::ServiceStack.Extensions.Tests.Protoc.GetTodos request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetTodos(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.GetTodosResponse CallGetTodos(global::ServiceStack.Extensions.Tests.Protoc.GetTodos request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallGetTodos, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallGetTodosAsync(global::ServiceStack.Extensions.Tests.Protoc.GetTodos request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallGetTodosAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallGetTodosAsync(global::ServiceStack.Extensions.Tests.Protoc.GetTodos request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallGetTodos, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse GetHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetHelloJwt(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse GetHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetHelloJwt, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetHelloJwtAsync(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetHelloJwtAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetHelloJwtAsync(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetHelloJwt, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse PostHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostHelloJwt(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse PostHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostHelloJwt, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostHelloJwtAsync(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostHelloJwtAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostHelloJwtAsync(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostHelloJwt, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse PutHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutHelloJwt(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse PutHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutHelloJwt, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutHelloJwtAsync(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutHelloJwtAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutHelloJwtAsync(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutHelloJwt, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse DeleteHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteHelloJwt(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloJwtResponse DeleteHelloJwt(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteHelloJwt, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteHelloJwtAsync(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteHelloJwtAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteHelloJwtAsync(global::ServiceStack.Extensions.Tests.Protoc.HelloJwt request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteHelloJwt, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse GetIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetIncr(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse GetIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetIncr, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetIncrAsync(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetIncrAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetIncrAsync(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetIncr, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostIncr(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostIncr, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostIncrAsync(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostIncrAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostIncrAsync(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostIncr, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutIncr(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutIncr, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutIncrAsync(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutIncrAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutIncrAsync(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutIncr, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse DeleteIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteIncr(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse DeleteIncr(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteIncr, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteIncrAsync(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteIncrAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteIncrAsync(global::ServiceStack.Extensions.Tests.Protoc.Incr request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteIncr, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.MultiplyResponse PostMultiply(global::ServiceStack.Extensions.Tests.Protoc.Multiply request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostMultiply(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.MultiplyResponse PostMultiply(global::ServiceStack.Extensions.Tests.Protoc.Multiply request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostMultiply, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostMultiplyAsync(global::ServiceStack.Extensions.Tests.Protoc.Multiply request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostMultiplyAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostMultiplyAsync(global::ServiceStack.Extensions.Tests.Protoc.Multiply request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostMultiply, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostNoAbstractValidator(global::ServiceStack.Extensions.Tests.Protoc.NoAbstractValidator request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostNoAbstractValidator(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostNoAbstractValidator(global::ServiceStack.Extensions.Tests.Protoc.NoAbstractValidator request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostNoAbstractValidator, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostNoAbstractValidatorAsync(global::ServiceStack.Extensions.Tests.Protoc.NoAbstractValidator request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostNoAbstractValidatorAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostNoAbstractValidatorAsync(global::ServiceStack.Extensions.Tests.Protoc.NoAbstractValidator request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostNoAbstractValidator, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostOnlyValidatesRequest(global::ServiceStack.Extensions.Tests.Protoc.OnlyValidatesRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostOnlyValidatesRequest(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostOnlyValidatesRequest(global::ServiceStack.Extensions.Tests.Protoc.OnlyValidatesRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostOnlyValidatesRequest, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostOnlyValidatesRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.OnlyValidatesRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostOnlyValidatesRequestAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostOnlyValidatesRequestAsync(global::ServiceStack.Extensions.Tests.Protoc.OnlyValidatesRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostOnlyValidatesRequest, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallPatchRockstar(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPatchRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallPatchRockstar(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallPatchRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallPatchRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPatchRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallPatchRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallPatchRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse CallPatchRockstarAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPatchRockstarAuditTenant(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse CallPatchRockstarAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallPatchRockstarAuditTenant, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallPatchRockstarAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPatchRockstarAuditTenantAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallPatchRockstarAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallPatchRockstarAuditTenant, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse CallPatchRockstarAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantGateway request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPatchRockstarAuditTenantGateway(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse CallPatchRockstarAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantGateway request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallPatchRockstarAuditTenantGateway, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallPatchRockstarAuditTenantGatewayAsync(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantGateway request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPatchRockstarAuditTenantGatewayAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallPatchRockstarAuditTenantGatewayAsync(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantGateway request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallPatchRockstarAuditTenantGateway, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallPatchRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPatchRockstarAuditTenantMq(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse CallPatchRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallPatchRockstarAuditTenantMq, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallPatchRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPatchRockstarAuditTenantMqAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallPatchRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.PatchRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallPatchRockstarAuditTenantMq, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ChatMessage CallPostChatToChannel(global::ServiceStack.Extensions.Tests.Protoc.PostChatToChannel request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPostChatToChannel(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ChatMessage CallPostChatToChannel(global::ServiceStack.Extensions.Tests.Protoc.PostChatToChannel request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CallPostChatToChannel, null, options, request); + } + public virtual grpc::AsyncUnaryCall CallPostChatToChannelAsync(global::ServiceStack.Extensions.Tests.Protoc.PostChatToChannel request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return CallPostChatToChannelAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall CallPostChatToChannelAsync(global::ServiceStack.Extensions.Tests.Protoc.PostChatToChannel request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CallPostChatToChannel, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Adhoc GetQueryAdhoc(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhoc request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryAdhoc(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Adhoc GetQueryAdhoc(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhoc request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryAdhoc, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryAdhocAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhoc request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryAdhocAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryAdhocAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhoc request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryAdhoc, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryAdhocRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhocRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryAdhocRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryAdhocRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhocRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryAdhocRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryAdhocRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhocRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryAdhocRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryAdhocRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryAdhocRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryAdhocRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_AllFields GetQueryAllFields(global::ServiceStack.Extensions.Tests.Protoc.QueryAllFields request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryAllFields(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_AllFields GetQueryAllFields(global::ServiceStack.Extensions.Tests.Protoc.QueryAllFields request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryAllFields, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryAllFieldsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryAllFields request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryAllFieldsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryAllFieldsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryAllFields request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryAllFields, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Bookmark GetQueryBookmarks(global::ServiceStack.Extensions.Tests.Protoc.QueryBookmarks request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryBookmarks(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Bookmark GetQueryBookmarks(global::ServiceStack.Extensions.Tests.Protoc.QueryBookmarks request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryBookmarks, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryBookmarksAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryBookmarks request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryBookmarksAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryBookmarksAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryBookmarks request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryBookmarks, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryCaseInsensitiveOrderBy(global::ServiceStack.Extensions.Tests.Protoc.QueryCaseInsensitiveOrderBy request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCaseInsensitiveOrderBy(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryCaseInsensitiveOrderBy(global::ServiceStack.Extensions.Tests.Protoc.QueryCaseInsensitiveOrderBy request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryCaseInsensitiveOrderBy, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryCaseInsensitiveOrderByAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCaseInsensitiveOrderBy request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCaseInsensitiveOrderByAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryCaseInsensitiveOrderByAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCaseInsensitiveOrderBy request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryCaseInsensitiveOrderBy, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryChangeConnectionInfo(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeConnectionInfo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryChangeConnectionInfo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryChangeConnectionInfo(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeConnectionInfo request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryChangeConnectionInfo, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryChangeConnectionInfoAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeConnectionInfo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryChangeConnectionInfoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryChangeConnectionInfoAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeConnectionInfo request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryChangeConnectionInfo, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryChangeDb(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeDb request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryChangeDb(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryChangeDb(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeDb request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryChangeDb, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryChangeDbAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeDb request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryChangeDbAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryChangeDbAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryChangeDb request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryChangeDb, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCustomRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryCustomRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryCustomRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCustomRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryCustomRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryCustomRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryCustomRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsFilter request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCustomRockstarsFilter(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryCustomRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsFilter request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryCustomRockstarsFilter, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryCustomRockstarsFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsFilter request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCustomRockstarsFilterAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryCustomRockstarsFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsFilter request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryCustomRockstarsFilter, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference GetQueryCustomRockstarsReferences(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsReferences request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCustomRockstarsReferences(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference GetQueryCustomRockstarsReferences(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsReferences request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryCustomRockstarsReferences, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryCustomRockstarsReferencesAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsReferences request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCustomRockstarsReferencesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryCustomRockstarsReferencesAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsReferences request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryCustomRockstarsReferences, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstarSchema GetQueryCustomRockstarsSchema(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsSchema request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCustomRockstarsSchema(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstarSchema GetQueryCustomRockstarsSchema(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsSchema request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryCustomRockstarsSchema, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryCustomRockstarsSchemaAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsSchema request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryCustomRockstarsSchemaAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryCustomRockstarsSchemaAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryCustomRockstarsSchema request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryCustomRockstarsSchema, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryFieldRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryFieldRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryFieldRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryFieldRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryFieldRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryFieldRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryFieldRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryFieldRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryFieldRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstarsDynamic request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryFieldRockstarsDynamic(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryFieldRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstarsDynamic request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryFieldRockstarsDynamic, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryFieldRockstarsDynamicAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstarsDynamic request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryFieldRockstarsDynamicAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryFieldRockstarsDynamicAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldRockstarsDynamic request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryFieldRockstarsDynamic, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryFieldsImplicitConventions(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldsImplicitConventions request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryFieldsImplicitConventions(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryFieldsImplicitConventions(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldsImplicitConventions request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryFieldsImplicitConventions, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryFieldsImplicitConventionsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldsImplicitConventions request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryFieldsImplicitConventionsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryFieldsImplicitConventionsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryFieldsImplicitConventions request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryFieldsImplicitConventions, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Foo GetQueryFoos(global::ServiceStack.Extensions.Tests.Protoc.QueryFoos request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryFoos(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Foo GetQueryFoos(global::ServiceStack.Extensions.Tests.Protoc.QueryFoos request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryFoos, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryFoosAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryFoos request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryFoosAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryFoosAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryFoos request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryFoos, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryGetRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryGetRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryGetRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryGetRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryGetRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryGetRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryGetRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryGetRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryGetRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstarsDynamic request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryGetRockstarsDynamic(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryGetRockstarsDynamic(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstarsDynamic request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryGetRockstarsDynamic, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryGetRockstarsDynamicAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstarsDynamic request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryGetRockstarsDynamicAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryGetRockstarsDynamicAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryGetRockstarsDynamic request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryGetRockstarsDynamic, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryJoinedRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbums request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryJoinedRockstarAlbums(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryJoinedRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbums request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryJoinedRockstarAlbums, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryJoinedRockstarAlbumsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbums request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryJoinedRockstarAlbumsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryJoinedRockstarAlbumsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbums request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryJoinedRockstarAlbums, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstar GetQueryJoinedRockstarAlbumsCustomSelect(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelect request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryJoinedRockstarAlbumsCustomSelect(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstar GetQueryJoinedRockstarAlbumsCustomSelect(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelect request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryJoinedRockstarAlbumsCustomSelect, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryJoinedRockstarAlbumsCustomSelectAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelect request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryJoinedRockstarAlbumsCustomSelectAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryJoinedRockstarAlbumsCustomSelectAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelect request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryJoinedRockstarAlbumsCustomSelect, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstarResponse GetQueryJoinedRockstarAlbumsCustomSelectResponse(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelectResponse request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryJoinedRockstarAlbumsCustomSelectResponse(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomSelectRockstarResponse GetQueryJoinedRockstarAlbumsCustomSelectResponse(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelectResponse request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryJoinedRockstarAlbumsCustomSelectResponse, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryJoinedRockstarAlbumsCustomSelectResponseAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelectResponse request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryJoinedRockstarAlbumsCustomSelectResponseAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryJoinedRockstarAlbumsCustomSelectResponseAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryJoinedRockstarAlbumsCustomSelectResponse request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryJoinedRockstarAlbumsCustomSelectResponse, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetQueryMovies(global::ServiceStack.Extensions.Tests.Protoc.QueryMovies request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryMovies(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetQueryMovies(global::ServiceStack.Extensions.Tests.Protoc.QueryMovies request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryMovies, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryMovies request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryMoviesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryMovies request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryMovies, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryMultiJoinRockstar(global::ServiceStack.Extensions.Tests.Protoc.QueryMultiJoinRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryMultiJoinRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryMultiJoinRockstar(global::ServiceStack.Extensions.Tests.Protoc.QueryMultiJoinRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryMultiJoinRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryMultiJoinRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryMultiJoinRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryMultiJoinRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryMultiJoinRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryMultiJoinRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryMultiJoinRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_NamedRockstar GetQueryNamedRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryNamedRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryNamedRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_NamedRockstar GetQueryNamedRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryNamedRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryNamedRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryNamedRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryNamedRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryNamedRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryNamedRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryNamedRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryNamedRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryOrRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryOrRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryOrRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryOrRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryOrRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryOrRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryOrRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryOrRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryOrRockstarsFields(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstarsFields request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryOrRockstarsFields(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryOrRockstarsFields(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstarsFields request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryOrRockstarsFields, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryOrRockstarsFieldsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstarsFields request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryOrRockstarsFieldsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryOrRockstarsFieldsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryOrRockstarsFields request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryOrRockstarsFields, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryOverridedCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedCustomRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryOverridedCustomRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryOverridedCustomRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedCustomRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryOverridedCustomRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryOverridedCustomRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedCustomRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryOverridedCustomRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryOverridedCustomRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedCustomRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryOverridedCustomRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryOverridedRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryOverridedRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryOverridedRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryOverridedRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryOverridedRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryOverridedRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryOverridedRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryOverridedRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryOverridedRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_PagingTest GetQueryPagingTest(global::ServiceStack.Extensions.Tests.Protoc.QueryPagingTest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryPagingTest(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_PagingTest GetQueryPagingTest(global::ServiceStack.Extensions.Tests.Protoc.QueryPagingTest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryPagingTest, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryPagingTestAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryPagingTest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryPagingTestAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryPagingTestAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryPagingTest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryPagingTest, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlbum GetQueryRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbums request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAlbums(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlbum GetQueryRockstarAlbums(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbums request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarAlbums, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAlbumsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbums request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAlbumsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAlbumsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbums request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarAlbums, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryRockstarAlbumsCustomLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsCustomLeftJoin request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAlbumsCustomLeftJoin(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryRockstarAlbumsCustomLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsCustomLeftJoin request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarAlbumsCustomLeftJoin, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAlbumsCustomLeftJoinAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsCustomLeftJoin request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAlbumsCustomLeftJoinAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAlbumsCustomLeftJoinAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsCustomLeftJoin request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarAlbumsCustomLeftJoin, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryRockstarAlbumsImplicit(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsImplicit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAlbumsImplicit(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryRockstarAlbumsImplicit(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsImplicit request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarAlbumsImplicit, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAlbumsImplicitAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsImplicit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAlbumsImplicitAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAlbumsImplicitAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsImplicit request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarAlbumsImplicit, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryRockstarAlbumsLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsLeftJoin request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAlbumsLeftJoin(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_CustomRockstar GetQueryRockstarAlbumsLeftJoin(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsLeftJoin request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarAlbumsLeftJoin, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAlbumsLeftJoinAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsLeftJoin request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAlbumsLeftJoinAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAlbumsLeftJoinAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlbumsLeftJoin request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarAlbumsLeftJoin, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlias GetQueryRockstarAlias(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlias request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAlias(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAlias GetQueryRockstarAlias(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlias request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarAlias, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAliasAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlias request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAliasAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAliasAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAlias request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarAlias, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto GetQueryRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAudit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAudit(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto GetQueryRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAudit request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarAudit, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAudit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAuditAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAudit request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarAudit, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto GetQueryRockstarAuditSubOr(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAuditSubOr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAuditSubOr(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarAuto GetQueryRockstarAuditSubOr(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAuditSubOr request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarAuditSubOr, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAuditSubOrAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAuditSubOr request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarAuditSubOrAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarAuditSubOrAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarAuditSubOr request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarAuditSubOr, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarFilters(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarFilters request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarFilters(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarFilters(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarFilters request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarFilters, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarFiltersAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarFilters request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarFiltersAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarFiltersAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarFilters request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarFilters, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarsConventions(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsConventions request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsConventions(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarsConventions(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsConventions request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarsConventions, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsConventionsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsConventions request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsConventionsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsConventionsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsConventions request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarsConventions, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsFilter request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsFilter(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarsFilter(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsFilter request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarsFilter, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsFilter request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsFilterAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsFilter request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarsFilter, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarsIFilter(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsIFilter request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsIFilter(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarsIFilter(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsIFilter request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarsIFilter, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsIFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsIFilter request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsIFilterAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsIFilterAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsIFilter request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarsIFilter, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarsImplicit(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsImplicit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsImplicit(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryRockstarsImplicit(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsImplicit request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarsImplicit, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsImplicitAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsImplicit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsImplicitAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsImplicitAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsImplicit request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarsImplicit, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference GetQueryRockstarsWithReferences(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsWithReferences request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsWithReferences(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_RockstarReference GetQueryRockstarsWithReferences(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsWithReferences request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryRockstarsWithReferences, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsWithReferencesAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsWithReferences request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryRockstarsWithReferencesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryRockstarsWithReferencesAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryRockstarsWithReferences request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryRockstarsWithReferences, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_TypeWithEnum GetQueryTypeWithEnums(global::ServiceStack.Extensions.Tests.Protoc.QueryTypeWithEnums request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryTypeWithEnums(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_TypeWithEnum GetQueryTypeWithEnums(global::ServiceStack.Extensions.Tests.Protoc.QueryTypeWithEnums request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryTypeWithEnums, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryTypeWithEnumsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryTypeWithEnums request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryTypeWithEnumsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryTypeWithEnumsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryTypeWithEnums request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryTypeWithEnums, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryUnknownRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryUnknownRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryUnknownRockstars(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Rockstar GetQueryUnknownRockstars(global::ServiceStack.Extensions.Tests.Protoc.QueryUnknownRockstars request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetQueryUnknownRockstars, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetQueryUnknownRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryUnknownRockstars request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetQueryUnknownRockstarsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetQueryUnknownRockstarsAsync(global::ServiceStack.Extensions.Tests.Protoc.QueryUnknownRockstars request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetQueryUnknownRockstars, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndCountResponse DeleteRealDeleteAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteRealDeleteAuditTenant(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndCountResponse DeleteRealDeleteAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteRealDeleteAuditTenant, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteRealDeleteAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteRealDeleteAuditTenantAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteRealDeleteAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteRealDeleteAuditTenant, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndCountResponse DeleteRealDeleteAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantGateway request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteRealDeleteAuditTenantGateway(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndCountResponse DeleteRealDeleteAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantGateway request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteRealDeleteAuditTenantGateway, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteRealDeleteAuditTenantGatewayAsync(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantGateway request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteRealDeleteAuditTenantGatewayAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteRealDeleteAuditTenantGatewayAsync(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantGateway request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteRealDeleteAuditTenantGateway, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse DeleteRealDeleteAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteRealDeleteAuditTenantMq(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse DeleteRealDeleteAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteRealDeleteAuditTenantMq, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteRealDeleteAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteRealDeleteAuditTenantMqAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteRealDeleteAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.RealDeleteAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteRealDeleteAuditTenantMq, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeysResponse PostRegenerateApiKeys(global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeys request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostRegenerateApiKeys(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeysResponse PostRegenerateApiKeys(global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeys request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostRegenerateApiKeys, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostRegenerateApiKeysAsync(global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeys request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostRegenerateApiKeysAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostRegenerateApiKeysAsync(global::ServiceStack.Extensions.Tests.Protoc.RegenerateApiKeys request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostRegenerateApiKeys, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RegisterResponse PutRegister(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutRegister(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RegisterResponse PutRegister(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutRegister, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutRegisterAsync(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutRegisterAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutRegisterAsync(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutRegister, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RegisterResponse PostRegister(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostRegister(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RegisterResponse PostRegister(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostRegister, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostRegisterAsync(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostRegisterAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostRegisterAsync(global::ServiceStack.Extensions.Tests.Protoc.Register request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostRegister, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth GetRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetRequiresAuth(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth GetRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetRequiresAuth, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetRequiresAuthAsync(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetRequiresAuthAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetRequiresAuthAsync(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetRequiresAuth, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth PostRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostRequiresAuth(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth PostRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostRequiresAuth, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostRequiresAuthAsync(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostRequiresAuthAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostRequiresAuthAsync(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostRequiresAuth, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth PutRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutRequiresAuth(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth PutRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutRequiresAuth, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutRequiresAuthAsync(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutRequiresAuthAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutRequiresAuthAsync(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutRequiresAuth, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth DeleteRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteRequiresAuth(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth DeleteRequiresAuth(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_DeleteRequiresAuth, null, options, request); + } + public virtual grpc::AsyncUnaryCall DeleteRequiresAuthAsync(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return DeleteRequiresAuthAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall DeleteRequiresAuthAsync(global::ServiceStack.Extensions.Tests.Protoc.RequiresAuth request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_DeleteRequiresAuth, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostResetTodos(global::ServiceStack.Extensions.Tests.Protoc.ResetTodos request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostResetTodos(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostResetTodos(global::ServiceStack.Extensions.Tests.Protoc.ResetTodos request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostResetTodos, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostResetTodosAsync(global::ServiceStack.Extensions.Tests.Protoc.ResetTodos request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostResetTodosAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostResetTodosAsync(global::ServiceStack.Extensions.Tests.Protoc.ResetTodos request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostResetTodos, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetSearchMovies(global::ServiceStack.Extensions.Tests.Protoc.SearchMovies request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetSearchMovies(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetSearchMovies(global::ServiceStack.Extensions.Tests.Protoc.SearchMovies request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetSearchMovies, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetSearchMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.SearchMovies request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetSearchMoviesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetSearchMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.SearchMovies request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetSearchMovies, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.SecuredResponse PostSecured(global::ServiceStack.Extensions.Tests.Protoc.Secured request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostSecured(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.SecuredResponse PostSecured(global::ServiceStack.Extensions.Tests.Protoc.Secured request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostSecured, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostSecuredAsync(global::ServiceStack.Extensions.Tests.Protoc.Secured request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostSecuredAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostSecuredAsync(global::ServiceStack.Extensions.Tests.Protoc.Secured request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostSecured, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutSoftDeleteAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutSoftDeleteAuditTenant(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutSoftDeleteAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutSoftDeleteAuditTenant, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutSoftDeleteAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutSoftDeleteAuditTenantAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutSoftDeleteAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.SoftDeleteAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutSoftDeleteAuditTenant, null, options, request); + } + public virtual grpc::AsyncServerStreamingCall ServerStreamFiles(global::ServiceStack.Extensions.Tests.Protoc.StreamFiles request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return ServerStreamFiles(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncServerStreamingCall ServerStreamFiles(global::ServiceStack.Extensions.Tests.Protoc.StreamFiles request, grpc::CallOptions options) + { + return CallInvoker.AsyncServerStreamingCall(__Method_ServerStreamFiles, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetStreamMovies(global::ServiceStack.Extensions.Tests.Protoc.StreamMovies request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetStreamMovies(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.QueryResponse_Movie GetStreamMovies(global::ServiceStack.Extensions.Tests.Protoc.StreamMovies request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetStreamMovies, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetStreamMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.StreamMovies request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetStreamMoviesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetStreamMoviesAsync(global::ServiceStack.Extensions.Tests.Protoc.StreamMovies request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetStreamMovies, null, options, request); + } + public virtual grpc::AsyncServerStreamingCall ServerStreamServerEvents(global::ServiceStack.Extensions.Tests.Protoc.StreamServerEvents request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return ServerStreamServerEvents(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncServerStreamingCall ServerStreamServerEvents(global::ServiceStack.Extensions.Tests.Protoc.StreamServerEvents request, grpc::CallOptions options) + { + return CallInvoker.AsyncServerStreamingCall(__Method_ServerStreamServerEvents, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestAuthValidators(global::ServiceStack.Extensions.Tests.Protoc.TestAuthValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestAuthValidators(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestAuthValidators(global::ServiceStack.Extensions.Tests.Protoc.TestAuthValidators request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostTestAuthValidators, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostTestAuthValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.TestAuthValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestAuthValidatorsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostTestAuthValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.TestAuthValidators request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostTestAuthValidators, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestDbCondition(global::ServiceStack.Extensions.Tests.Protoc.TestDbCondition request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestDbCondition(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestDbCondition(global::ServiceStack.Extensions.Tests.Protoc.TestDbCondition request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostTestDbCondition, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostTestDbConditionAsync(global::ServiceStack.Extensions.Tests.Protoc.TestDbCondition request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestDbConditionAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostTestDbConditionAsync(global::ServiceStack.Extensions.Tests.Protoc.TestDbCondition request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostTestDbCondition, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestDbValidator(global::ServiceStack.Extensions.Tests.Protoc.TestDbValidator request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestDbValidator(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestDbValidator(global::ServiceStack.Extensions.Tests.Protoc.TestDbValidator request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostTestDbValidator, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostTestDbValidatorAsync(global::ServiceStack.Extensions.Tests.Protoc.TestDbValidator request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestDbValidatorAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostTestDbValidatorAsync(global::ServiceStack.Extensions.Tests.Protoc.TestDbValidator request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostTestDbValidator, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestIsAdmin(global::ServiceStack.Extensions.Tests.Protoc.TestIsAdmin request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestIsAdmin(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestIsAdmin(global::ServiceStack.Extensions.Tests.Protoc.TestIsAdmin request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostTestIsAdmin, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostTestIsAdminAsync(global::ServiceStack.Extensions.Tests.Protoc.TestIsAdmin request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestIsAdminAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostTestIsAdminAsync(global::ServiceStack.Extensions.Tests.Protoc.TestIsAdmin request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostTestIsAdmin, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestMultiAuthValidators(global::ServiceStack.Extensions.Tests.Protoc.TestMultiAuthValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestMultiAuthValidators(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTestMultiAuthValidators(global::ServiceStack.Extensions.Tests.Protoc.TestMultiAuthValidators request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostTestMultiAuthValidators, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostTestMultiAuthValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.TestMultiAuthValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTestMultiAuthValidatorsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostTestMultiAuthValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.TestMultiAuthValidators request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostTestMultiAuthValidators, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse GetThrow(global::ServiceStack.Extensions.Tests.Protoc.Throw request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetThrow(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.HelloResponse GetThrow(global::ServiceStack.Extensions.Tests.Protoc.Throw request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetThrow, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetThrowAsync(global::ServiceStack.Extensions.Tests.Protoc.Throw request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetThrowAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetThrowAsync(global::ServiceStack.Extensions.Tests.Protoc.Throw request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetThrow, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ThrowCustomResponse GetThrowCustom(global::ServiceStack.Extensions.Tests.Protoc.ThrowCustom request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetThrowCustom(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.ThrowCustomResponse GetThrowCustom(global::ServiceStack.Extensions.Tests.Protoc.ThrowCustom request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetThrowCustom, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetThrowCustomAsync(global::ServiceStack.Extensions.Tests.Protoc.ThrowCustom request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetThrowCustomAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetThrowCustomAsync(global::ServiceStack.Extensions.Tests.Protoc.ThrowCustom request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetThrowCustom, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse GetThrowVoid(global::ServiceStack.Extensions.Tests.Protoc.ThrowVoid request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetThrowVoid(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse GetThrowVoid(global::ServiceStack.Extensions.Tests.Protoc.ThrowVoid request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetThrowVoid, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetThrowVoidAsync(global::ServiceStack.Extensions.Tests.Protoc.ThrowVoid request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetThrowVoidAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetThrowVoidAsync(global::ServiceStack.Extensions.Tests.Protoc.ThrowVoid request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetThrowVoid, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTriggerAllValidators(global::ServiceStack.Extensions.Tests.Protoc.TriggerAllValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTriggerAllValidators(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostTriggerAllValidators(global::ServiceStack.Extensions.Tests.Protoc.TriggerAllValidators request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostTriggerAllValidators, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostTriggerAllValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.TriggerAllValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTriggerAllValidatorsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostTriggerAllValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.TriggerAllValidators request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostTriggerAllValidators, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostTriggerValidators(global::ServiceStack.Extensions.Tests.Protoc.TriggerValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTriggerValidators(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PostTriggerValidators(global::ServiceStack.Extensions.Tests.Protoc.TriggerValidators request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostTriggerValidators, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostTriggerValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.TriggerValidators request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostTriggerValidatorsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostTriggerValidatorsAsync(global::ServiceStack.Extensions.Tests.Protoc.TriggerValidators request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostTriggerValidators, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.UnAssignRolesResponse PostUnAssignRoles(global::ServiceStack.Extensions.Tests.Protoc.UnAssignRoles request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostUnAssignRoles(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.UnAssignRolesResponse PostUnAssignRoles(global::ServiceStack.Extensions.Tests.Protoc.UnAssignRoles request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostUnAssignRoles, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostUnAssignRolesAsync(global::ServiceStack.Extensions.Tests.Protoc.UnAssignRoles request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostUnAssignRolesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostUnAssignRolesAsync(global::ServiceStack.Extensions.Tests.Protoc.UnAssignRoles request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostUnAssignRoles, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutUpdateConnectionInfoRockstar(global::ServiceStack.Extensions.Tests.Protoc.UpdateConnectionInfoRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateConnectionInfoRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutUpdateConnectionInfoRockstar(global::ServiceStack.Extensions.Tests.Protoc.UpdateConnectionInfoRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutUpdateConnectionInfoRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutUpdateConnectionInfoRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateConnectionInfoRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateConnectionInfoRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutUpdateConnectionInfoRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateConnectionInfoRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutUpdateConnectionInfoRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutUpdateNamedRockstar(global::ServiceStack.Extensions.Tests.Protoc.UpdateNamedRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateNamedRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutUpdateNamedRockstar(global::ServiceStack.Extensions.Tests.Protoc.UpdateNamedRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutUpdateNamedRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutUpdateNamedRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateNamedRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateNamedRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutUpdateNamedRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateNamedRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutUpdateNamedRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutUpdateRockstar(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutUpdateRockstar(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutUpdateRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutUpdateRockstar, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutUpdateRockstarAdhocNonDefaults(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAdhocNonDefaults request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstarAdhocNonDefaults(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutUpdateRockstarAdhocNonDefaults(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAdhocNonDefaults request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutUpdateRockstarAdhocNonDefaults, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAdhocNonDefaultsAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAdhocNonDefaults request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstarAdhocNonDefaultsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAdhocNonDefaultsAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAdhocNonDefaults request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutUpdateRockstarAdhocNonDefaults, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PatchUpdateRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAudit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PatchUpdateRockstarAudit(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PatchUpdateRockstarAudit(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAudit request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PatchUpdateRockstarAudit, null, options, request); + } + public virtual grpc::AsyncUnaryCall PatchUpdateRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAudit request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PatchUpdateRockstarAuditAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PatchUpdateRockstarAuditAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAudit request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PatchUpdateRockstarAudit, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutUpdateRockstarAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstarAuditTenant(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutUpdateRockstarAuditTenant(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutUpdateRockstarAuditTenant, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenant request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstarAuditTenantAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAuditTenantAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenant request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutUpdateRockstarAuditTenant, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutUpdateRockstarAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantGateway request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstarAuditTenantGateway(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndResultResponse PutUpdateRockstarAuditTenantGateway(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantGateway request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutUpdateRockstarAuditTenantGateway, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAuditTenantGatewayAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantGateway request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstarAuditTenantGatewayAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAuditTenantGatewayAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantGateway request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutUpdateRockstarAuditTenantGateway, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutUpdateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstarAuditTenantMq(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutUpdateRockstarAuditTenantMq(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutUpdateRockstarAuditTenantMq, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantMq request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateRockstarAuditTenantMqAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutUpdateRockstarAuditTenantMqAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarAuditTenantMq request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutUpdateRockstarAuditTenantMq, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndRowVersionResponse PatchUpdateRockstarVersion(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarVersion request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PatchUpdateRockstarVersion(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdAndRowVersionResponse PatchUpdateRockstarVersion(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarVersion request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PatchUpdateRockstarVersion, null, options, request); + } + public virtual grpc::AsyncUnaryCall PatchUpdateRockstarVersionAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarVersion request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PatchUpdateRockstarVersionAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PatchUpdateRockstarVersionAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateRockstarVersion request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PatchUpdateRockstarVersion, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutUpdateTodo(global::ServiceStack.Extensions.Tests.Protoc.UpdateTodo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateTodo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.EmptyResponse PutUpdateTodo(global::ServiceStack.Extensions.Tests.Protoc.UpdateTodo request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PutUpdateTodo, null, options, request); + } + public virtual grpc::AsyncUnaryCall PutUpdateTodoAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateTodo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PutUpdateTodoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PutUpdateTodoAsync(global::ServiceStack.Extensions.Tests.Protoc.UpdateTodo request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PutUpdateTodo, null, options, request); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostValidateCreateRockstar(global::ServiceStack.Extensions.Tests.Protoc.ValidateCreateRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostValidateCreateRockstar(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::ServiceStack.Extensions.Tests.Protoc.RockstarWithIdResponse PostValidateCreateRockstar(global::ServiceStack.Extensions.Tests.Protoc.ValidateCreateRockstar request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_PostValidateCreateRockstar, null, options, request); + } + public virtual grpc::AsyncUnaryCall PostValidateCreateRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.ValidateCreateRockstar request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return PostValidateCreateRockstarAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall PostValidateCreateRockstarAsync(global::ServiceStack.Extensions.Tests.Protoc.ValidateCreateRockstar request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_PostValidateCreateRockstar, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override GrpcServicesClient NewInstance(ClientBaseConfiguration configuration) + { + return new GrpcServicesClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(GrpcServicesBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_GetAddHeader, serviceImpl.GetAddHeader) + .AddMethod(__Method_GetAnyHello, serviceImpl.GetAnyHello) + .AddMethod(__Method_PostAnyHello, serviceImpl.PostAnyHello) + .AddMethod(__Method_PutAnyHello, serviceImpl.PutAnyHello) + .AddMethod(__Method_DeleteAnyHello, serviceImpl.DeleteAnyHello) + .AddMethod(__Method_PostAssignRoles, serviceImpl.PostAssignRoles) + .AddMethod(__Method_OptionsAuthenticate, serviceImpl.OptionsAuthenticate) + .AddMethod(__Method_GetAuthenticate, serviceImpl.GetAuthenticate) + .AddMethod(__Method_PostAuthenticate, serviceImpl.PostAuthenticate) + .AddMethod(__Method_DeleteAuthenticate, serviceImpl.DeleteAuthenticate) + .AddMethod(__Method_GetChangeConnectionInfo, serviceImpl.GetChangeConnectionInfo) + .AddMethod(__Method_GetChangeDb, serviceImpl.GetChangeDb) + .AddMethod(__Method_PostConvertSessionToToken, serviceImpl.PostConvertSessionToToken) + .AddMethod(__Method_PostCreateBookmark, serviceImpl.PostCreateBookmark) + .AddMethod(__Method_PostCreateConnectionInfoRockstar, serviceImpl.PostCreateConnectionInfoRockstar) + .AddMethod(__Method_PostCreateNamedRockstar, serviceImpl.PostCreateNamedRockstar) + .AddMethod(__Method_PostCreateRockstar, serviceImpl.PostCreateRockstar) + .AddMethod(__Method_PostCreateRockstarAdhocNonDefaults, serviceImpl.PostCreateRockstarAdhocNonDefaults) + .AddMethod(__Method_PostCreateRockstarAudit, serviceImpl.PostCreateRockstarAudit) + .AddMethod(__Method_PostCreateRockstarAuditMqToken, serviceImpl.PostCreateRockstarAuditMqToken) + .AddMethod(__Method_PostCreateRockstarAuditTenant, serviceImpl.PostCreateRockstarAuditTenant) + .AddMethod(__Method_PostCreateRockstarAuditTenantGateway, serviceImpl.PostCreateRockstarAuditTenantGateway) + .AddMethod(__Method_GetCreateRockstarAuditTenantMq, serviceImpl.GetCreateRockstarAuditTenantMq) + .AddMethod(__Method_PostCreateRockstarAuditTenantMq, serviceImpl.PostCreateRockstarAuditTenantMq) + .AddMethod(__Method_PutCreateRockstarAuditTenantMq, serviceImpl.PutCreateRockstarAuditTenantMq) + .AddMethod(__Method_DeleteCreateRockstarAuditTenantMq, serviceImpl.DeleteCreateRockstarAuditTenantMq) + .AddMethod(__Method_PostCreateRockstarAutoMap, serviceImpl.PostCreateRockstarAutoMap) + .AddMethod(__Method_PostCreateRockstarVersion, serviceImpl.PostCreateRockstarVersion) + .AddMethod(__Method_PostCreateRockstarWithAutoGuid, serviceImpl.PostCreateRockstarWithAutoGuid) + .AddMethod(__Method_PostCreateRockstarWithReturn, serviceImpl.PostCreateRockstarWithReturn) + .AddMethod(__Method_PostCreateRockstarWithVoidReturn, serviceImpl.PostCreateRockstarWithVoidReturn) + .AddMethod(__Method_PostCreateTodo, serviceImpl.PostCreateTodo) + .AddMethod(__Method_PostCustomValidationErrors, serviceImpl.PostCustomValidationErrors) + .AddMethod(__Method_CallDeleteRockstar, serviceImpl.CallDeleteRockstar) + .AddMethod(__Method_CallDeleteRockstarAudit, serviceImpl.CallDeleteRockstarAudit) + .AddMethod(__Method_CallDeleteRockstarFilters, serviceImpl.CallDeleteRockstarFilters) + .AddMethod(__Method_CallDeleteTodo, serviceImpl.CallDeleteTodo) + .AddMethod(__Method_CallDeleteTodos, serviceImpl.CallDeleteTodos) + .AddMethod(__Method_GetDynamicQueryGetRockstarsDynamic, serviceImpl.GetDynamicQueryGetRockstarsDynamic) + .AddMethod(__Method_GetDynamicQueryCustomRockstarsSchema, serviceImpl.GetDynamicQueryCustomRockstarsSchema) + .AddMethod(__Method_GetDynamicSearchMovies, serviceImpl.GetDynamicSearchMovies) + .AddMethod(__Method_GetDynamicQueryMovies, serviceImpl.GetDynamicQueryMovies) + .AddMethod(__Method_GetDynamicQueryUnknownRockstars, serviceImpl.GetDynamicQueryUnknownRockstars) + .AddMethod(__Method_GetDynamicQueryRockstarsWithReferences, serviceImpl.GetDynamicQueryRockstarsWithReferences) + .AddMethod(__Method_GetDynamicQueryAllFields, serviceImpl.GetDynamicQueryAllFields) + .AddMethod(__Method_GetDynamicQueryTypeWithEnums, serviceImpl.GetDynamicQueryTypeWithEnums) + .AddMethod(__Method_GetDynamicQueryAdhocRockstars, serviceImpl.GetDynamicQueryAdhocRockstars) + .AddMethod(__Method_GetDynamicQueryAdhoc, serviceImpl.GetDynamicQueryAdhoc) + .AddMethod(__Method_GetDynamicQueryChangeDb, serviceImpl.GetDynamicQueryChangeDb) + .AddMethod(__Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelect, serviceImpl.GetDynamicQueryJoinedRockstarAlbumsCustomSelect) + .AddMethod(__Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse, serviceImpl.GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse) + .AddMethod(__Method_GetDynamicQueryFoos, serviceImpl.GetDynamicQueryFoos) + .AddMethod(__Method_GetDynamicQueryOverridedRockstars, serviceImpl.GetDynamicQueryOverridedRockstars) + .AddMethod(__Method_GetDynamicQueryOverridedCustomRockstars, serviceImpl.GetDynamicQueryOverridedCustomRockstars) + .AddMethod(__Method_GetDynamicQueryCaseInsensitiveOrderBy, serviceImpl.GetDynamicQueryCaseInsensitiveOrderBy) + .AddMethod(__Method_GetDynamicStreamMovies, serviceImpl.GetDynamicStreamMovies) + .AddMethod(__Method_GetDynamicQueryCustomRockstarsReferences, serviceImpl.GetDynamicQueryCustomRockstarsReferences) + .AddMethod(__Method_GetDynamicQueryRockstarAlbumsCustomLeftJoin, serviceImpl.GetDynamicQueryRockstarAlbumsCustomLeftJoin) + .AddMethod(__Method_GetDynamicQueryChangeConnectionInfo, serviceImpl.GetDynamicQueryChangeConnectionInfo) + .AddMethod(__Method_GetDynamicQueryRockstarAudit, serviceImpl.GetDynamicQueryRockstarAudit) + .AddMethod(__Method_GetDynamicQueryRockstarAuditSubOr, serviceImpl.GetDynamicQueryRockstarAuditSubOr) + .AddMethod(__Method_GetDynamicQueryBookmarks, serviceImpl.GetDynamicQueryBookmarks) + .AddMethod(__Method_GetDynamicQueryNamedRockstars, serviceImpl.GetDynamicQueryNamedRockstars) + .AddMethod(__Method_GetDynamicQueryRockstars, serviceImpl.GetDynamicQueryRockstars) + .AddMethod(__Method_GetDynamicQueryRockstarAlbums, serviceImpl.GetDynamicQueryRockstarAlbums) + .AddMethod(__Method_GetDynamicQueryPagingTest, serviceImpl.GetDynamicQueryPagingTest) + .AddMethod(__Method_GetDynamicQueryRockstarsConventions, serviceImpl.GetDynamicQueryRockstarsConventions) + .AddMethod(__Method_GetDynamicQueryCustomRockstars, serviceImpl.GetDynamicQueryCustomRockstars) + .AddMethod(__Method_GetDynamicQueryJoinedRockstarAlbums, serviceImpl.GetDynamicQueryJoinedRockstarAlbums) + .AddMethod(__Method_GetDynamicQueryRockstarAlbumsImplicit, serviceImpl.GetDynamicQueryRockstarAlbumsImplicit) + .AddMethod(__Method_GetDynamicQueryRockstarAlbumsLeftJoin, serviceImpl.GetDynamicQueryRockstarAlbumsLeftJoin) + .AddMethod(__Method_GetDynamicQueryMultiJoinRockstar, serviceImpl.GetDynamicQueryMultiJoinRockstar) + .AddMethod(__Method_GetDynamicQueryFieldRockstars, serviceImpl.GetDynamicQueryFieldRockstars) + .AddMethod(__Method_GetDynamicQueryRockstarAlias, serviceImpl.GetDynamicQueryRockstarAlias) + .AddMethod(__Method_GetDynamicQueryFieldRockstarsDynamic, serviceImpl.GetDynamicQueryFieldRockstarsDynamic) + .AddMethod(__Method_GetDynamicQueryRockstarsFilter, serviceImpl.GetDynamicQueryRockstarsFilter) + .AddMethod(__Method_GetDynamicQueryCustomRockstarsFilter, serviceImpl.GetDynamicQueryCustomRockstarsFilter) + .AddMethod(__Method_GetDynamicQueryRockstarsIFilter, serviceImpl.GetDynamicQueryRockstarsIFilter) + .AddMethod(__Method_GetDynamicQueryOrRockstars, serviceImpl.GetDynamicQueryOrRockstars) + .AddMethod(__Method_GetDynamicQueryRockstarsImplicit, serviceImpl.GetDynamicQueryRockstarsImplicit) + .AddMethod(__Method_GetDynamicQueryOrRockstarsFields, serviceImpl.GetDynamicQueryOrRockstarsFields) + .AddMethod(__Method_GetDynamicQueryFieldsImplicitConventions, serviceImpl.GetDynamicQueryFieldsImplicitConventions) + .AddMethod(__Method_GetDynamicQueryGetRockstars, serviceImpl.GetDynamicQueryGetRockstars) + .AddMethod(__Method_GetDynamicQueryRockstarFilters, serviceImpl.GetDynamicQueryRockstarFilters) + .AddMethod(__Method_PostDynamicValidationRules, serviceImpl.PostDynamicValidationRules) + .AddMethod(__Method_PostEmptyValidators, serviceImpl.PostEmptyValidators) + .AddMethod(__Method_GetEndsWithSuffixRequest, serviceImpl.GetEndsWithSuffixRequest) + .AddMethod(__Method_PostEndsWithSuffixRequest, serviceImpl.PostEndsWithSuffixRequest) + .AddMethod(__Method_PutEndsWithSuffixRequest, serviceImpl.PutEndsWithSuffixRequest) + .AddMethod(__Method_DeleteEndsWithSuffixRequest, serviceImpl.DeleteEndsWithSuffixRequest) + .AddMethod(__Method_PostGetAccessToken, serviceImpl.PostGetAccessToken) + .AddMethod(__Method_CallGetApiKeys, serviceImpl.CallGetApiKeys) + .AddMethod(__Method_CallGetFile, serviceImpl.CallGetFile) + .AddMethod(__Method_CallGetHello, serviceImpl.CallGetHello) + .AddMethod(__Method_CallGetTodo, serviceImpl.CallGetTodo) + .AddMethod(__Method_CallGetTodos, serviceImpl.CallGetTodos) + .AddMethod(__Method_GetHelloJwt, serviceImpl.GetHelloJwt) + .AddMethod(__Method_PostHelloJwt, serviceImpl.PostHelloJwt) + .AddMethod(__Method_PutHelloJwt, serviceImpl.PutHelloJwt) + .AddMethod(__Method_DeleteHelloJwt, serviceImpl.DeleteHelloJwt) + .AddMethod(__Method_GetIncr, serviceImpl.GetIncr) + .AddMethod(__Method_PostIncr, serviceImpl.PostIncr) + .AddMethod(__Method_PutIncr, serviceImpl.PutIncr) + .AddMethod(__Method_DeleteIncr, serviceImpl.DeleteIncr) + .AddMethod(__Method_PostMultiply, serviceImpl.PostMultiply) + .AddMethod(__Method_PostNoAbstractValidator, serviceImpl.PostNoAbstractValidator) + .AddMethod(__Method_PostOnlyValidatesRequest, serviceImpl.PostOnlyValidatesRequest) + .AddMethod(__Method_CallPatchRockstar, serviceImpl.CallPatchRockstar) + .AddMethod(__Method_CallPatchRockstarAuditTenant, serviceImpl.CallPatchRockstarAuditTenant) + .AddMethod(__Method_CallPatchRockstarAuditTenantGateway, serviceImpl.CallPatchRockstarAuditTenantGateway) + .AddMethod(__Method_CallPatchRockstarAuditTenantMq, serviceImpl.CallPatchRockstarAuditTenantMq) + .AddMethod(__Method_CallPostChatToChannel, serviceImpl.CallPostChatToChannel) + .AddMethod(__Method_GetQueryAdhoc, serviceImpl.GetQueryAdhoc) + .AddMethod(__Method_GetQueryAdhocRockstars, serviceImpl.GetQueryAdhocRockstars) + .AddMethod(__Method_GetQueryAllFields, serviceImpl.GetQueryAllFields) + .AddMethod(__Method_GetQueryBookmarks, serviceImpl.GetQueryBookmarks) + .AddMethod(__Method_GetQueryCaseInsensitiveOrderBy, serviceImpl.GetQueryCaseInsensitiveOrderBy) + .AddMethod(__Method_GetQueryChangeConnectionInfo, serviceImpl.GetQueryChangeConnectionInfo) + .AddMethod(__Method_GetQueryChangeDb, serviceImpl.GetQueryChangeDb) + .AddMethod(__Method_GetQueryCustomRockstars, serviceImpl.GetQueryCustomRockstars) + .AddMethod(__Method_GetQueryCustomRockstarsFilter, serviceImpl.GetQueryCustomRockstarsFilter) + .AddMethod(__Method_GetQueryCustomRockstarsReferences, serviceImpl.GetQueryCustomRockstarsReferences) + .AddMethod(__Method_GetQueryCustomRockstarsSchema, serviceImpl.GetQueryCustomRockstarsSchema) + .AddMethod(__Method_GetQueryFieldRockstars, serviceImpl.GetQueryFieldRockstars) + .AddMethod(__Method_GetQueryFieldRockstarsDynamic, serviceImpl.GetQueryFieldRockstarsDynamic) + .AddMethod(__Method_GetQueryFieldsImplicitConventions, serviceImpl.GetQueryFieldsImplicitConventions) + .AddMethod(__Method_GetQueryFoos, serviceImpl.GetQueryFoos) + .AddMethod(__Method_GetQueryGetRockstars, serviceImpl.GetQueryGetRockstars) + .AddMethod(__Method_GetQueryGetRockstarsDynamic, serviceImpl.GetQueryGetRockstarsDynamic) + .AddMethod(__Method_GetQueryJoinedRockstarAlbums, serviceImpl.GetQueryJoinedRockstarAlbums) + .AddMethod(__Method_GetQueryJoinedRockstarAlbumsCustomSelect, serviceImpl.GetQueryJoinedRockstarAlbumsCustomSelect) + .AddMethod(__Method_GetQueryJoinedRockstarAlbumsCustomSelectResponse, serviceImpl.GetQueryJoinedRockstarAlbumsCustomSelectResponse) + .AddMethod(__Method_GetQueryMovies, serviceImpl.GetQueryMovies) + .AddMethod(__Method_GetQueryMultiJoinRockstar, serviceImpl.GetQueryMultiJoinRockstar) + .AddMethod(__Method_GetQueryNamedRockstars, serviceImpl.GetQueryNamedRockstars) + .AddMethod(__Method_GetQueryOrRockstars, serviceImpl.GetQueryOrRockstars) + .AddMethod(__Method_GetQueryOrRockstarsFields, serviceImpl.GetQueryOrRockstarsFields) + .AddMethod(__Method_GetQueryOverridedCustomRockstars, serviceImpl.GetQueryOverridedCustomRockstars) + .AddMethod(__Method_GetQueryOverridedRockstars, serviceImpl.GetQueryOverridedRockstars) + .AddMethod(__Method_GetQueryPagingTest, serviceImpl.GetQueryPagingTest) + .AddMethod(__Method_GetQueryRockstarAlbums, serviceImpl.GetQueryRockstarAlbums) + .AddMethod(__Method_GetQueryRockstarAlbumsCustomLeftJoin, serviceImpl.GetQueryRockstarAlbumsCustomLeftJoin) + .AddMethod(__Method_GetQueryRockstarAlbumsImplicit, serviceImpl.GetQueryRockstarAlbumsImplicit) + .AddMethod(__Method_GetQueryRockstarAlbumsLeftJoin, serviceImpl.GetQueryRockstarAlbumsLeftJoin) + .AddMethod(__Method_GetQueryRockstarAlias, serviceImpl.GetQueryRockstarAlias) + .AddMethod(__Method_GetQueryRockstarAudit, serviceImpl.GetQueryRockstarAudit) + .AddMethod(__Method_GetQueryRockstarAuditSubOr, serviceImpl.GetQueryRockstarAuditSubOr) + .AddMethod(__Method_GetQueryRockstarFilters, serviceImpl.GetQueryRockstarFilters) + .AddMethod(__Method_GetQueryRockstars, serviceImpl.GetQueryRockstars) + .AddMethod(__Method_GetQueryRockstarsConventions, serviceImpl.GetQueryRockstarsConventions) + .AddMethod(__Method_GetQueryRockstarsFilter, serviceImpl.GetQueryRockstarsFilter) + .AddMethod(__Method_GetQueryRockstarsIFilter, serviceImpl.GetQueryRockstarsIFilter) + .AddMethod(__Method_GetQueryRockstarsImplicit, serviceImpl.GetQueryRockstarsImplicit) + .AddMethod(__Method_GetQueryRockstarsWithReferences, serviceImpl.GetQueryRockstarsWithReferences) + .AddMethod(__Method_GetQueryTypeWithEnums, serviceImpl.GetQueryTypeWithEnums) + .AddMethod(__Method_GetQueryUnknownRockstars, serviceImpl.GetQueryUnknownRockstars) + .AddMethod(__Method_DeleteRealDeleteAuditTenant, serviceImpl.DeleteRealDeleteAuditTenant) + .AddMethod(__Method_DeleteRealDeleteAuditTenantGateway, serviceImpl.DeleteRealDeleteAuditTenantGateway) + .AddMethod(__Method_DeleteRealDeleteAuditTenantMq, serviceImpl.DeleteRealDeleteAuditTenantMq) + .AddMethod(__Method_PostRegenerateApiKeys, serviceImpl.PostRegenerateApiKeys) + .AddMethod(__Method_PutRegister, serviceImpl.PutRegister) + .AddMethod(__Method_PostRegister, serviceImpl.PostRegister) + .AddMethod(__Method_GetRequiresAuth, serviceImpl.GetRequiresAuth) + .AddMethod(__Method_PostRequiresAuth, serviceImpl.PostRequiresAuth) + .AddMethod(__Method_PutRequiresAuth, serviceImpl.PutRequiresAuth) + .AddMethod(__Method_DeleteRequiresAuth, serviceImpl.DeleteRequiresAuth) + .AddMethod(__Method_PostResetTodos, serviceImpl.PostResetTodos) + .AddMethod(__Method_GetSearchMovies, serviceImpl.GetSearchMovies) + .AddMethod(__Method_PostSecured, serviceImpl.PostSecured) + .AddMethod(__Method_PutSoftDeleteAuditTenant, serviceImpl.PutSoftDeleteAuditTenant) + .AddMethod(__Method_ServerStreamFiles, serviceImpl.ServerStreamFiles) + .AddMethod(__Method_GetStreamMovies, serviceImpl.GetStreamMovies) + .AddMethod(__Method_ServerStreamServerEvents, serviceImpl.ServerStreamServerEvents) + .AddMethod(__Method_PostTestAuthValidators, serviceImpl.PostTestAuthValidators) + .AddMethod(__Method_PostTestDbCondition, serviceImpl.PostTestDbCondition) + .AddMethod(__Method_PostTestDbValidator, serviceImpl.PostTestDbValidator) + .AddMethod(__Method_PostTestIsAdmin, serviceImpl.PostTestIsAdmin) + .AddMethod(__Method_PostTestMultiAuthValidators, serviceImpl.PostTestMultiAuthValidators) + .AddMethod(__Method_GetThrow, serviceImpl.GetThrow) + .AddMethod(__Method_GetThrowCustom, serviceImpl.GetThrowCustom) + .AddMethod(__Method_GetThrowVoid, serviceImpl.GetThrowVoid) + .AddMethod(__Method_PostTriggerAllValidators, serviceImpl.PostTriggerAllValidators) + .AddMethod(__Method_PostTriggerValidators, serviceImpl.PostTriggerValidators) + .AddMethod(__Method_PostUnAssignRoles, serviceImpl.PostUnAssignRoles) + .AddMethod(__Method_PutUpdateConnectionInfoRockstar, serviceImpl.PutUpdateConnectionInfoRockstar) + .AddMethod(__Method_PutUpdateNamedRockstar, serviceImpl.PutUpdateNamedRockstar) + .AddMethod(__Method_PutUpdateRockstar, serviceImpl.PutUpdateRockstar) + .AddMethod(__Method_PutUpdateRockstarAdhocNonDefaults, serviceImpl.PutUpdateRockstarAdhocNonDefaults) + .AddMethod(__Method_PatchUpdateRockstarAudit, serviceImpl.PatchUpdateRockstarAudit) + .AddMethod(__Method_PutUpdateRockstarAuditTenant, serviceImpl.PutUpdateRockstarAuditTenant) + .AddMethod(__Method_PutUpdateRockstarAuditTenantGateway, serviceImpl.PutUpdateRockstarAuditTenantGateway) + .AddMethod(__Method_PutUpdateRockstarAuditTenantMq, serviceImpl.PutUpdateRockstarAuditTenantMq) + .AddMethod(__Method_PatchUpdateRockstarVersion, serviceImpl.PatchUpdateRockstarVersion) + .AddMethod(__Method_PutUpdateTodo, serviceImpl.PutUpdateTodo) + .AddMethod(__Method_PostValidateCreateRockstar, serviceImpl.PostValidateCreateRockstar).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + public static void BindService(grpc::ServiceBinderBase serviceBinder, GrpcServicesBase serviceImpl) + { + serviceBinder.AddMethod(__Method_GetAddHeader, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetAddHeader)); + serviceBinder.AddMethod(__Method_GetAnyHello, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetAnyHello)); + serviceBinder.AddMethod(__Method_PostAnyHello, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostAnyHello)); + serviceBinder.AddMethod(__Method_PutAnyHello, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutAnyHello)); + serviceBinder.AddMethod(__Method_DeleteAnyHello, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteAnyHello)); + serviceBinder.AddMethod(__Method_PostAssignRoles, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostAssignRoles)); + serviceBinder.AddMethod(__Method_OptionsAuthenticate, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.OptionsAuthenticate)); + serviceBinder.AddMethod(__Method_GetAuthenticate, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetAuthenticate)); + serviceBinder.AddMethod(__Method_PostAuthenticate, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostAuthenticate)); + serviceBinder.AddMethod(__Method_DeleteAuthenticate, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteAuthenticate)); + serviceBinder.AddMethod(__Method_GetChangeConnectionInfo, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetChangeConnectionInfo)); + serviceBinder.AddMethod(__Method_GetChangeDb, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetChangeDb)); + serviceBinder.AddMethod(__Method_PostConvertSessionToToken, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostConvertSessionToToken)); + serviceBinder.AddMethod(__Method_PostCreateBookmark, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateBookmark)); + serviceBinder.AddMethod(__Method_PostCreateConnectionInfoRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateConnectionInfoRockstar)); + serviceBinder.AddMethod(__Method_PostCreateNamedRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateNamedRockstar)); + serviceBinder.AddMethod(__Method_PostCreateRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstar)); + serviceBinder.AddMethod(__Method_PostCreateRockstarAdhocNonDefaults, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarAdhocNonDefaults)); + serviceBinder.AddMethod(__Method_PostCreateRockstarAudit, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarAudit)); + serviceBinder.AddMethod(__Method_PostCreateRockstarAuditMqToken, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarAuditMqToken)); + serviceBinder.AddMethod(__Method_PostCreateRockstarAuditTenant, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarAuditTenant)); + serviceBinder.AddMethod(__Method_PostCreateRockstarAuditTenantGateway, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarAuditTenantGateway)); + serviceBinder.AddMethod(__Method_GetCreateRockstarAuditTenantMq, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetCreateRockstarAuditTenantMq)); + serviceBinder.AddMethod(__Method_PostCreateRockstarAuditTenantMq, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarAuditTenantMq)); + serviceBinder.AddMethod(__Method_PutCreateRockstarAuditTenantMq, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutCreateRockstarAuditTenantMq)); + serviceBinder.AddMethod(__Method_DeleteCreateRockstarAuditTenantMq, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteCreateRockstarAuditTenantMq)); + serviceBinder.AddMethod(__Method_PostCreateRockstarAutoMap, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarAutoMap)); + serviceBinder.AddMethod(__Method_PostCreateRockstarVersion, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarVersion)); + serviceBinder.AddMethod(__Method_PostCreateRockstarWithAutoGuid, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarWithAutoGuid)); + serviceBinder.AddMethod(__Method_PostCreateRockstarWithReturn, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarWithReturn)); + serviceBinder.AddMethod(__Method_PostCreateRockstarWithVoidReturn, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateRockstarWithVoidReturn)); + serviceBinder.AddMethod(__Method_PostCreateTodo, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCreateTodo)); + serviceBinder.AddMethod(__Method_PostCustomValidationErrors, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostCustomValidationErrors)); + serviceBinder.AddMethod(__Method_CallDeleteRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallDeleteRockstar)); + serviceBinder.AddMethod(__Method_CallDeleteRockstarAudit, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallDeleteRockstarAudit)); + serviceBinder.AddMethod(__Method_CallDeleteRockstarFilters, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallDeleteRockstarFilters)); + serviceBinder.AddMethod(__Method_CallDeleteTodo, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallDeleteTodo)); + serviceBinder.AddMethod(__Method_CallDeleteTodos, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallDeleteTodos)); + serviceBinder.AddMethod(__Method_GetDynamicQueryGetRockstarsDynamic, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryGetRockstarsDynamic)); + serviceBinder.AddMethod(__Method_GetDynamicQueryCustomRockstarsSchema, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryCustomRockstarsSchema)); + serviceBinder.AddMethod(__Method_GetDynamicSearchMovies, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicSearchMovies)); + serviceBinder.AddMethod(__Method_GetDynamicQueryMovies, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryMovies)); + serviceBinder.AddMethod(__Method_GetDynamicQueryUnknownRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryUnknownRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarsWithReferences, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarsWithReferences)); + serviceBinder.AddMethod(__Method_GetDynamicQueryAllFields, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryAllFields)); + serviceBinder.AddMethod(__Method_GetDynamicQueryTypeWithEnums, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryTypeWithEnums)); + serviceBinder.AddMethod(__Method_GetDynamicQueryAdhocRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryAdhocRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryAdhoc, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryAdhoc)); + serviceBinder.AddMethod(__Method_GetDynamicQueryChangeDb, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryChangeDb)); + serviceBinder.AddMethod(__Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelect, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryJoinedRockstarAlbumsCustomSelect)); + serviceBinder.AddMethod(__Method_GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse)); + serviceBinder.AddMethod(__Method_GetDynamicQueryFoos, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryFoos)); + serviceBinder.AddMethod(__Method_GetDynamicQueryOverridedRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryOverridedRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryOverridedCustomRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryOverridedCustomRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryCaseInsensitiveOrderBy, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryCaseInsensitiveOrderBy)); + serviceBinder.AddMethod(__Method_GetDynamicStreamMovies, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicStreamMovies)); + serviceBinder.AddMethod(__Method_GetDynamicQueryCustomRockstarsReferences, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryCustomRockstarsReferences)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarAlbumsCustomLeftJoin, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarAlbumsCustomLeftJoin)); + serviceBinder.AddMethod(__Method_GetDynamicQueryChangeConnectionInfo, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryChangeConnectionInfo)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarAudit, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarAudit)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarAuditSubOr, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarAuditSubOr)); + serviceBinder.AddMethod(__Method_GetDynamicQueryBookmarks, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryBookmarks)); + serviceBinder.AddMethod(__Method_GetDynamicQueryNamedRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryNamedRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarAlbums, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarAlbums)); + serviceBinder.AddMethod(__Method_GetDynamicQueryPagingTest, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryPagingTest)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarsConventions, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarsConventions)); + serviceBinder.AddMethod(__Method_GetDynamicQueryCustomRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryCustomRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryJoinedRockstarAlbums, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryJoinedRockstarAlbums)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarAlbumsImplicit, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarAlbumsImplicit)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarAlbumsLeftJoin, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarAlbumsLeftJoin)); + serviceBinder.AddMethod(__Method_GetDynamicQueryMultiJoinRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryMultiJoinRockstar)); + serviceBinder.AddMethod(__Method_GetDynamicQueryFieldRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryFieldRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarAlias, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarAlias)); + serviceBinder.AddMethod(__Method_GetDynamicQueryFieldRockstarsDynamic, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryFieldRockstarsDynamic)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarsFilter, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarsFilter)); + serviceBinder.AddMethod(__Method_GetDynamicQueryCustomRockstarsFilter, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryCustomRockstarsFilter)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarsIFilter, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarsIFilter)); + serviceBinder.AddMethod(__Method_GetDynamicQueryOrRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryOrRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarsImplicit, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarsImplicit)); + serviceBinder.AddMethod(__Method_GetDynamicQueryOrRockstarsFields, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryOrRockstarsFields)); + serviceBinder.AddMethod(__Method_GetDynamicQueryFieldsImplicitConventions, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryFieldsImplicitConventions)); + serviceBinder.AddMethod(__Method_GetDynamicQueryGetRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryGetRockstars)); + serviceBinder.AddMethod(__Method_GetDynamicQueryRockstarFilters, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetDynamicQueryRockstarFilters)); + serviceBinder.AddMethod(__Method_PostDynamicValidationRules, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostDynamicValidationRules)); + serviceBinder.AddMethod(__Method_PostEmptyValidators, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostEmptyValidators)); + serviceBinder.AddMethod(__Method_GetEndsWithSuffixRequest, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetEndsWithSuffixRequest)); + serviceBinder.AddMethod(__Method_PostEndsWithSuffixRequest, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostEndsWithSuffixRequest)); + serviceBinder.AddMethod(__Method_PutEndsWithSuffixRequest, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutEndsWithSuffixRequest)); + serviceBinder.AddMethod(__Method_DeleteEndsWithSuffixRequest, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteEndsWithSuffixRequest)); + serviceBinder.AddMethod(__Method_PostGetAccessToken, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostGetAccessToken)); + serviceBinder.AddMethod(__Method_CallGetApiKeys, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallGetApiKeys)); + serviceBinder.AddMethod(__Method_CallGetFile, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallGetFile)); + serviceBinder.AddMethod(__Method_CallGetHello, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallGetHello)); + serviceBinder.AddMethod(__Method_CallGetTodo, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallGetTodo)); + serviceBinder.AddMethod(__Method_CallGetTodos, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallGetTodos)); + serviceBinder.AddMethod(__Method_GetHelloJwt, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetHelloJwt)); + serviceBinder.AddMethod(__Method_PostHelloJwt, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostHelloJwt)); + serviceBinder.AddMethod(__Method_PutHelloJwt, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutHelloJwt)); + serviceBinder.AddMethod(__Method_DeleteHelloJwt, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteHelloJwt)); + serviceBinder.AddMethod(__Method_GetIncr, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetIncr)); + serviceBinder.AddMethod(__Method_PostIncr, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostIncr)); + serviceBinder.AddMethod(__Method_PutIncr, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutIncr)); + serviceBinder.AddMethod(__Method_DeleteIncr, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteIncr)); + serviceBinder.AddMethod(__Method_PostMultiply, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostMultiply)); + serviceBinder.AddMethod(__Method_PostNoAbstractValidator, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostNoAbstractValidator)); + serviceBinder.AddMethod(__Method_PostOnlyValidatesRequest, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostOnlyValidatesRequest)); + serviceBinder.AddMethod(__Method_CallPatchRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallPatchRockstar)); + serviceBinder.AddMethod(__Method_CallPatchRockstarAuditTenant, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallPatchRockstarAuditTenant)); + serviceBinder.AddMethod(__Method_CallPatchRockstarAuditTenantGateway, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallPatchRockstarAuditTenantGateway)); + serviceBinder.AddMethod(__Method_CallPatchRockstarAuditTenantMq, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallPatchRockstarAuditTenantMq)); + serviceBinder.AddMethod(__Method_CallPostChatToChannel, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.CallPostChatToChannel)); + serviceBinder.AddMethod(__Method_GetQueryAdhoc, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryAdhoc)); + serviceBinder.AddMethod(__Method_GetQueryAdhocRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryAdhocRockstars)); + serviceBinder.AddMethod(__Method_GetQueryAllFields, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryAllFields)); + serviceBinder.AddMethod(__Method_GetQueryBookmarks, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryBookmarks)); + serviceBinder.AddMethod(__Method_GetQueryCaseInsensitiveOrderBy, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryCaseInsensitiveOrderBy)); + serviceBinder.AddMethod(__Method_GetQueryChangeConnectionInfo, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryChangeConnectionInfo)); + serviceBinder.AddMethod(__Method_GetQueryChangeDb, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryChangeDb)); + serviceBinder.AddMethod(__Method_GetQueryCustomRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryCustomRockstars)); + serviceBinder.AddMethod(__Method_GetQueryCustomRockstarsFilter, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryCustomRockstarsFilter)); + serviceBinder.AddMethod(__Method_GetQueryCustomRockstarsReferences, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryCustomRockstarsReferences)); + serviceBinder.AddMethod(__Method_GetQueryCustomRockstarsSchema, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryCustomRockstarsSchema)); + serviceBinder.AddMethod(__Method_GetQueryFieldRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryFieldRockstars)); + serviceBinder.AddMethod(__Method_GetQueryFieldRockstarsDynamic, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryFieldRockstarsDynamic)); + serviceBinder.AddMethod(__Method_GetQueryFieldsImplicitConventions, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryFieldsImplicitConventions)); + serviceBinder.AddMethod(__Method_GetQueryFoos, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryFoos)); + serviceBinder.AddMethod(__Method_GetQueryGetRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryGetRockstars)); + serviceBinder.AddMethod(__Method_GetQueryGetRockstarsDynamic, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryGetRockstarsDynamic)); + serviceBinder.AddMethod(__Method_GetQueryJoinedRockstarAlbums, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryJoinedRockstarAlbums)); + serviceBinder.AddMethod(__Method_GetQueryJoinedRockstarAlbumsCustomSelect, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryJoinedRockstarAlbumsCustomSelect)); + serviceBinder.AddMethod(__Method_GetQueryJoinedRockstarAlbumsCustomSelectResponse, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryJoinedRockstarAlbumsCustomSelectResponse)); + serviceBinder.AddMethod(__Method_GetQueryMovies, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryMovies)); + serviceBinder.AddMethod(__Method_GetQueryMultiJoinRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryMultiJoinRockstar)); + serviceBinder.AddMethod(__Method_GetQueryNamedRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryNamedRockstars)); + serviceBinder.AddMethod(__Method_GetQueryOrRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryOrRockstars)); + serviceBinder.AddMethod(__Method_GetQueryOrRockstarsFields, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryOrRockstarsFields)); + serviceBinder.AddMethod(__Method_GetQueryOverridedCustomRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryOverridedCustomRockstars)); + serviceBinder.AddMethod(__Method_GetQueryOverridedRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryOverridedRockstars)); + serviceBinder.AddMethod(__Method_GetQueryPagingTest, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryPagingTest)); + serviceBinder.AddMethod(__Method_GetQueryRockstarAlbums, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarAlbums)); + serviceBinder.AddMethod(__Method_GetQueryRockstarAlbumsCustomLeftJoin, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarAlbumsCustomLeftJoin)); + serviceBinder.AddMethod(__Method_GetQueryRockstarAlbumsImplicit, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarAlbumsImplicit)); + serviceBinder.AddMethod(__Method_GetQueryRockstarAlbumsLeftJoin, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarAlbumsLeftJoin)); + serviceBinder.AddMethod(__Method_GetQueryRockstarAlias, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarAlias)); + serviceBinder.AddMethod(__Method_GetQueryRockstarAudit, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarAudit)); + serviceBinder.AddMethod(__Method_GetQueryRockstarAuditSubOr, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarAuditSubOr)); + serviceBinder.AddMethod(__Method_GetQueryRockstarFilters, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarFilters)); + serviceBinder.AddMethod(__Method_GetQueryRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstars)); + serviceBinder.AddMethod(__Method_GetQueryRockstarsConventions, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarsConventions)); + serviceBinder.AddMethod(__Method_GetQueryRockstarsFilter, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarsFilter)); + serviceBinder.AddMethod(__Method_GetQueryRockstarsIFilter, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarsIFilter)); + serviceBinder.AddMethod(__Method_GetQueryRockstarsImplicit, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarsImplicit)); + serviceBinder.AddMethod(__Method_GetQueryRockstarsWithReferences, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryRockstarsWithReferences)); + serviceBinder.AddMethod(__Method_GetQueryTypeWithEnums, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryTypeWithEnums)); + serviceBinder.AddMethod(__Method_GetQueryUnknownRockstars, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetQueryUnknownRockstars)); + serviceBinder.AddMethod(__Method_DeleteRealDeleteAuditTenant, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteRealDeleteAuditTenant)); + serviceBinder.AddMethod(__Method_DeleteRealDeleteAuditTenantGateway, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteRealDeleteAuditTenantGateway)); + serviceBinder.AddMethod(__Method_DeleteRealDeleteAuditTenantMq, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteRealDeleteAuditTenantMq)); + serviceBinder.AddMethod(__Method_PostRegenerateApiKeys, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostRegenerateApiKeys)); + serviceBinder.AddMethod(__Method_PutRegister, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutRegister)); + serviceBinder.AddMethod(__Method_PostRegister, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostRegister)); + serviceBinder.AddMethod(__Method_GetRequiresAuth, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetRequiresAuth)); + serviceBinder.AddMethod(__Method_PostRequiresAuth, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostRequiresAuth)); + serviceBinder.AddMethod(__Method_PutRequiresAuth, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutRequiresAuth)); + serviceBinder.AddMethod(__Method_DeleteRequiresAuth, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.DeleteRequiresAuth)); + serviceBinder.AddMethod(__Method_PostResetTodos, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostResetTodos)); + serviceBinder.AddMethod(__Method_GetSearchMovies, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetSearchMovies)); + serviceBinder.AddMethod(__Method_PostSecured, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostSecured)); + serviceBinder.AddMethod(__Method_PutSoftDeleteAuditTenant, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutSoftDeleteAuditTenant)); + serviceBinder.AddMethod(__Method_ServerStreamFiles, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.ServerStreamFiles)); + serviceBinder.AddMethod(__Method_GetStreamMovies, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetStreamMovies)); + serviceBinder.AddMethod(__Method_ServerStreamServerEvents, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.ServerStreamServerEvents)); + serviceBinder.AddMethod(__Method_PostTestAuthValidators, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostTestAuthValidators)); + serviceBinder.AddMethod(__Method_PostTestDbCondition, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostTestDbCondition)); + serviceBinder.AddMethod(__Method_PostTestDbValidator, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostTestDbValidator)); + serviceBinder.AddMethod(__Method_PostTestIsAdmin, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostTestIsAdmin)); + serviceBinder.AddMethod(__Method_PostTestMultiAuthValidators, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostTestMultiAuthValidators)); + serviceBinder.AddMethod(__Method_GetThrow, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetThrow)); + serviceBinder.AddMethod(__Method_GetThrowCustom, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetThrowCustom)); + serviceBinder.AddMethod(__Method_GetThrowVoid, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetThrowVoid)); + serviceBinder.AddMethod(__Method_PostTriggerAllValidators, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostTriggerAllValidators)); + serviceBinder.AddMethod(__Method_PostTriggerValidators, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostTriggerValidators)); + serviceBinder.AddMethod(__Method_PostUnAssignRoles, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostUnAssignRoles)); + serviceBinder.AddMethod(__Method_PutUpdateConnectionInfoRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutUpdateConnectionInfoRockstar)); + serviceBinder.AddMethod(__Method_PutUpdateNamedRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutUpdateNamedRockstar)); + serviceBinder.AddMethod(__Method_PutUpdateRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutUpdateRockstar)); + serviceBinder.AddMethod(__Method_PutUpdateRockstarAdhocNonDefaults, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutUpdateRockstarAdhocNonDefaults)); + serviceBinder.AddMethod(__Method_PatchUpdateRockstarAudit, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PatchUpdateRockstarAudit)); + serviceBinder.AddMethod(__Method_PutUpdateRockstarAuditTenant, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutUpdateRockstarAuditTenant)); + serviceBinder.AddMethod(__Method_PutUpdateRockstarAuditTenantGateway, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutUpdateRockstarAuditTenantGateway)); + serviceBinder.AddMethod(__Method_PutUpdateRockstarAuditTenantMq, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutUpdateRockstarAuditTenantMq)); + serviceBinder.AddMethod(__Method_PatchUpdateRockstarVersion, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PatchUpdateRockstarVersion)); + serviceBinder.AddMethod(__Method_PutUpdateTodo, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PutUpdateTodo)); + serviceBinder.AddMethod(__Method_PostValidateCreateRockstar, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.PostValidateCreateRockstar)); + } + + } +} +#endregion diff --git a/tests/ServiceStack.Extensions.Tests/Protoc/services.proto b/tests/ServiceStack.Extensions.Tests/Protoc/services.proto new file mode 100644 index 00000000000..e4c0a990053 --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/Protoc/services.proto @@ -0,0 +1,2026 @@ +/* Options: +Date: 2020-06-03 21:41:31 +Version: 5.81 +Tip: To override a DTO option, remove "//" prefix before updating +BaseUrl: http://localhost:20000 + +//GlobalNamespace: +//AddDescriptionAsComments: True +*/ + +syntax = "proto3"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; + +option csharp_namespace = "ServiceStack.Extensions.Tests.Protoc"; +option php_namespace = "ServiceStack.Extensions.Tests.Protoc"; + +service GrpcServices { + + rpc GetAddHeader(AddHeader) returns (EmptyResponse) {} + + rpc GetAnyHello(AnyHello) returns (HelloResponse) {} + + rpc PostAnyHello(AnyHello) returns (HelloResponse) {} + + rpc PutAnyHello(AnyHello) returns (HelloResponse) {} + + rpc DeleteAnyHello(AnyHello) returns (HelloResponse) {} + + rpc PostAssignRoles(AssignRoles) returns (AssignRolesResponse) {} + + rpc OptionsAuthenticate(Authenticate) returns (AuthenticateResponse) {} + + rpc GetAuthenticate(Authenticate) returns (AuthenticateResponse) {} + + rpc PostAuthenticate(Authenticate) returns (AuthenticateResponse) {} + + rpc DeleteAuthenticate(Authenticate) returns (AuthenticateResponse) {} + + rpc GetChangeConnectionInfo(ChangeConnectionInfo) returns (ChangeDbResponse) {} + + rpc GetChangeDb(ChangeDb) returns (ChangeDbResponse) {} + + rpc PostConvertSessionToToken(ConvertSessionToToken) returns (ConvertSessionToTokenResponse) {} + + rpc PostCreateBookmark(CreateBookmark) returns (CreateBookmarkResponse) {} + + rpc PostCreateConnectionInfoRockstar(CreateConnectionInfoRockstar) returns (RockstarWithIdAndResultResponse) {} + + rpc PostCreateNamedRockstar(CreateNamedRockstar) returns (RockstarWithIdAndResultResponse) {} + + rpc PostCreateRockstar(CreateRockstar) returns (CreateRockstarResponse) {} + + rpc PostCreateRockstarAdhocNonDefaults(CreateRockstarAdhocNonDefaults) returns (RockstarWithIdAndResultResponse) {} + + rpc PostCreateRockstarAudit(CreateRockstarAudit) returns (RockstarWithIdResponse) {} + + rpc PostCreateRockstarAuditMqToken(CreateRockstarAuditMqToken) returns (RockstarWithIdResponse) {} + + rpc PostCreateRockstarAuditTenant(CreateRockstarAuditTenant) returns (RockstarWithIdAndResultResponse) {} + + rpc PostCreateRockstarAuditTenantGateway(CreateRockstarAuditTenantGateway) returns (RockstarWithIdAndResultResponse) {} + + rpc GetCreateRockstarAuditTenantMq(CreateRockstarAuditTenantMq) returns (EmptyResponse) {} + + rpc PostCreateRockstarAuditTenantMq(CreateRockstarAuditTenantMq) returns (EmptyResponse) {} + + rpc PutCreateRockstarAuditTenantMq(CreateRockstarAuditTenantMq) returns (EmptyResponse) {} + + rpc DeleteCreateRockstarAuditTenantMq(CreateRockstarAuditTenantMq) returns (EmptyResponse) {} + + rpc PostCreateRockstarAutoMap(CreateRockstarAutoMap) returns (RockstarWithIdAndResultResponse) {} + + rpc PostCreateRockstarVersion(CreateRockstarVersion) returns (RockstarWithIdAndRowVersionResponse) {} + + rpc PostCreateRockstarWithAutoGuid(CreateRockstarWithAutoGuid) returns (CreateRockstarWithReturnGuidResponse) {} + + rpc PostCreateRockstarWithReturn(CreateRockstarWithReturn) returns (RockstarWithIdAndResultResponse) {} + + rpc PostCreateRockstarWithVoidReturn(CreateRockstarWithVoidReturn) returns (EmptyResponse) {} + + rpc PostCreateTodo(CreateTodo) returns (CreateTodoResponse) {} + + rpc PostCustomValidationErrors(CustomValidationErrors) returns (RockstarWithIdResponse) {} + + rpc CallDeleteRockstar(DeleteRockstar) returns (EmptyResponse) {} + + rpc CallDeleteRockstarAudit(DeleteRockstarAudit) returns (RockstarWithIdAndCountResponse) {} + + rpc CallDeleteRockstarFilters(DeleteRockstarFilters) returns (DeleteRockstarCountResponse) {} + + rpc CallDeleteTodo(DeleteTodo) returns (EmptyResponse) {} + + rpc CallDeleteTodos(DeleteTodos) returns (EmptyResponse) {} + + rpc GetDynamicQueryGetRockstarsDynamic(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryCustomRockstarsSchema(DynamicRequest) returns (QueryResponse_CustomRockstarSchema) {} + + rpc GetDynamicSearchMovies(DynamicRequest) returns (QueryResponse_Movie) {} + + rpc GetDynamicQueryMovies(DynamicRequest) returns (QueryResponse_Movie) {} + + rpc GetDynamicQueryUnknownRockstars(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryRockstarsWithReferences(DynamicRequest) returns (QueryResponse_RockstarReference) {} + + rpc GetDynamicQueryAllFields(DynamicRequest) returns (QueryResponse_AllFields) {} + + rpc GetDynamicQueryTypeWithEnums(DynamicRequest) returns (QueryResponse_TypeWithEnum) {} + + rpc GetDynamicQueryAdhocRockstars(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryAdhoc(DynamicRequest) returns (QueryResponse_Adhoc) {} + + rpc GetDynamicQueryChangeDb(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryJoinedRockstarAlbumsCustomSelect(DynamicRequest) returns (QueryResponse_CustomSelectRockstar) {} + + rpc GetDynamicQueryJoinedRockstarAlbumsCustomSelectResponse(DynamicRequest) returns (QueryResponse_CustomSelectRockstarResponse) {} + + rpc GetDynamicQueryFoos(DynamicRequest) returns (QueryResponse_Foo) {} + + rpc GetDynamicQueryOverridedRockstars(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryOverridedCustomRockstars(DynamicRequest) returns (QueryResponse_CustomRockstar) {} + + rpc GetDynamicQueryCaseInsensitiveOrderBy(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicStreamMovies(DynamicRequest) returns (QueryResponse_Movie) {} + + rpc GetDynamicQueryCustomRockstarsReferences(DynamicRequest) returns (QueryResponse_RockstarReference) {} + + rpc GetDynamicQueryRockstarAlbumsCustomLeftJoin(DynamicRequest) returns (QueryResponse_CustomRockstar) {} + + rpc GetDynamicQueryChangeConnectionInfo(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryRockstarAudit(DynamicRequest) returns (QueryResponse_RockstarAuto) {} + + rpc GetDynamicQueryRockstarAuditSubOr(DynamicRequest) returns (QueryResponse_RockstarAuto) {} + + rpc GetDynamicQueryBookmarks(DynamicRequest) returns (QueryResponse_Bookmark) {} + + rpc GetDynamicQueryNamedRockstars(DynamicRequest) returns (QueryResponse_NamedRockstar) {} + + rpc GetDynamicQueryRockstars(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryRockstarAlbums(DynamicRequest) returns (QueryResponse_RockstarAlbum) {} + + rpc GetDynamicQueryPagingTest(DynamicRequest) returns (QueryResponse_PagingTest) {} + + rpc GetDynamicQueryRockstarsConventions(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryCustomRockstars(DynamicRequest) returns (QueryResponse_CustomRockstar) {} + + rpc GetDynamicQueryJoinedRockstarAlbums(DynamicRequest) returns (QueryResponse_CustomRockstar) {} + + rpc GetDynamicQueryRockstarAlbumsImplicit(DynamicRequest) returns (QueryResponse_CustomRockstar) {} + + rpc GetDynamicQueryRockstarAlbumsLeftJoin(DynamicRequest) returns (QueryResponse_CustomRockstar) {} + + rpc GetDynamicQueryMultiJoinRockstar(DynamicRequest) returns (QueryResponse_CustomRockstar) {} + + rpc GetDynamicQueryFieldRockstars(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryRockstarAlias(DynamicRequest) returns (QueryResponse_RockstarAlias) {} + + rpc GetDynamicQueryFieldRockstarsDynamic(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryRockstarsFilter(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryCustomRockstarsFilter(DynamicRequest) returns (QueryResponse_CustomRockstar) {} + + rpc GetDynamicQueryRockstarsIFilter(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryOrRockstars(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryRockstarsImplicit(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryOrRockstarsFields(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryFieldsImplicitConventions(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryGetRockstars(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc GetDynamicQueryRockstarFilters(DynamicRequest) returns (QueryResponse_Rockstar) {} + + rpc PostDynamicValidationRules(DynamicValidationRules) returns (RockstarWithIdResponse) {} + + rpc PostEmptyValidators(EmptyValidators) returns (RockstarWithIdResponse) {} + + rpc GetEndsWithSuffixRequest(EndsWithSuffixRequest) returns (EndsWithSuffixResponse) {} + + rpc PostEndsWithSuffixRequest(EndsWithSuffixRequest) returns (EndsWithSuffixResponse) {} + + rpc PutEndsWithSuffixRequest(EndsWithSuffixRequest) returns (EndsWithSuffixResponse) {} + + rpc DeleteEndsWithSuffixRequest(EndsWithSuffixRequest) returns (EndsWithSuffixResponse) {} + + rpc PostGetAccessToken(GetAccessToken) returns (GetAccessTokenResponse) {} + + rpc CallGetApiKeys(GetApiKeys) returns (GetApiKeysResponse) {} + + rpc CallGetFile(GetFile) returns (FileContent) {} + + rpc CallGetHello(GetHello) returns (HelloResponse) {} + + rpc CallGetTodo(GetTodo) returns (GetTodoResponse) {} + + rpc CallGetTodos(GetTodos) returns (GetTodosResponse) {} + + rpc GetHelloJwt(HelloJwt) returns (HelloJwtResponse) {} + + rpc PostHelloJwt(HelloJwt) returns (HelloJwtResponse) {} + + rpc PutHelloJwt(HelloJwt) returns (HelloJwtResponse) {} + + rpc DeleteHelloJwt(HelloJwt) returns (HelloJwtResponse) {} + + rpc GetIncr(Incr) returns (EmptyResponse) {} + + rpc PostIncr(Incr) returns (EmptyResponse) {} + + rpc PutIncr(Incr) returns (EmptyResponse) {} + + rpc DeleteIncr(Incr) returns (EmptyResponse) {} + + rpc PostMultiply(Multiply) returns (MultiplyResponse) {} + + rpc PostNoAbstractValidator(NoAbstractValidator) returns (RockstarWithIdResponse) {} + + rpc PostOnlyValidatesRequest(OnlyValidatesRequest) returns (RockstarWithIdResponse) {} + + rpc CallPatchRockstar(PatchRockstar) returns (EmptyResponse) {} + + rpc CallPatchRockstarAuditTenant(PatchRockstarAuditTenant) returns (RockstarWithIdAndResultResponse) {} + + rpc CallPatchRockstarAuditTenantGateway(PatchRockstarAuditTenantGateway) returns (RockstarWithIdAndResultResponse) {} + + rpc CallPatchRockstarAuditTenantMq(PatchRockstarAuditTenantMq) returns (EmptyResponse) {} + + rpc CallPostChatToChannel(PostChatToChannel) returns (ChatMessage) {} + + rpc GetQueryAdhoc(QueryAdhoc) returns (QueryResponse_Adhoc) {} + + rpc GetQueryAdhocRockstars(QueryAdhocRockstars) returns (QueryResponse_Rockstar) {} + + rpc GetQueryAllFields(QueryAllFields) returns (QueryResponse_AllFields) {} + + rpc GetQueryBookmarks(QueryBookmarks) returns (QueryResponse_Bookmark) {} + + rpc GetQueryCaseInsensitiveOrderBy(QueryCaseInsensitiveOrderBy) returns (QueryResponse_Rockstar) {} + + rpc GetQueryChangeConnectionInfo(QueryChangeConnectionInfo) returns (QueryResponse_Rockstar) {} + + rpc GetQueryChangeDb(QueryChangeDb) returns (QueryResponse_Rockstar) {} + + rpc GetQueryCustomRockstars(QueryCustomRockstars) returns (QueryResponse_CustomRockstar) {} + + rpc GetQueryCustomRockstarsFilter(QueryCustomRockstarsFilter) returns (QueryResponse_CustomRockstar) {} + + rpc GetQueryCustomRockstarsReferences(QueryCustomRockstarsReferences) returns (QueryResponse_RockstarReference) {} + + rpc GetQueryCustomRockstarsSchema(QueryCustomRockstarsSchema) returns (QueryResponse_CustomRockstarSchema) {} + + rpc GetQueryFieldRockstars(QueryFieldRockstars) returns (QueryResponse_Rockstar) {} + + rpc GetQueryFieldRockstarsDynamic(QueryFieldRockstarsDynamic) returns (QueryResponse_Rockstar) {} + + rpc GetQueryFieldsImplicitConventions(QueryFieldsImplicitConventions) returns (QueryResponse_Rockstar) {} + + rpc GetQueryFoos(QueryFoos) returns (QueryResponse_Foo) {} + + rpc GetQueryGetRockstars(QueryGetRockstars) returns (QueryResponse_Rockstar) {} + + rpc GetQueryGetRockstarsDynamic(QueryGetRockstarsDynamic) returns (QueryResponse_Rockstar) {} + + rpc GetQueryJoinedRockstarAlbums(QueryJoinedRockstarAlbums) returns (QueryResponse_CustomRockstar) {} + + rpc GetQueryJoinedRockstarAlbumsCustomSelect(QueryJoinedRockstarAlbumsCustomSelect) returns (QueryResponse_CustomSelectRockstar) {} + + rpc GetQueryJoinedRockstarAlbumsCustomSelectResponse(QueryJoinedRockstarAlbumsCustomSelectResponse) returns (QueryResponse_CustomSelectRockstarResponse) {} + + rpc GetQueryMovies(QueryMovies) returns (QueryResponse_Movie) {} + + rpc GetQueryMultiJoinRockstar(QueryMultiJoinRockstar) returns (QueryResponse_CustomRockstar) {} + + rpc GetQueryNamedRockstars(QueryNamedRockstars) returns (QueryResponse_NamedRockstar) {} + + rpc GetQueryOrRockstars(QueryOrRockstars) returns (QueryResponse_Rockstar) {} + + rpc GetQueryOrRockstarsFields(QueryOrRockstarsFields) returns (QueryResponse_Rockstar) {} + + rpc GetQueryOverridedCustomRockstars(QueryOverridedCustomRockstars) returns (QueryResponse_CustomRockstar) {} + + rpc GetQueryOverridedRockstars(QueryOverridedRockstars) returns (QueryResponse_Rockstar) {} + + rpc GetQueryPagingTest(QueryPagingTest) returns (QueryResponse_PagingTest) {} + + rpc GetQueryRockstarAlbums(QueryRockstarAlbums) returns (QueryResponse_RockstarAlbum) {} + + rpc GetQueryRockstarAlbumsCustomLeftJoin(QueryRockstarAlbumsCustomLeftJoin) returns (QueryResponse_CustomRockstar) {} + + rpc GetQueryRockstarAlbumsImplicit(QueryRockstarAlbumsImplicit) returns (QueryResponse_CustomRockstar) {} + + rpc GetQueryRockstarAlbumsLeftJoin(QueryRockstarAlbumsLeftJoin) returns (QueryResponse_CustomRockstar) {} + + rpc GetQueryRockstarAlias(QueryRockstarAlias) returns (QueryResponse_RockstarAlias) {} + + rpc GetQueryRockstarAudit(QueryRockstarAudit) returns (QueryResponse_RockstarAuto) {} + + rpc GetQueryRockstarAuditSubOr(QueryRockstarAuditSubOr) returns (QueryResponse_RockstarAuto) {} + + rpc GetQueryRockstarFilters(QueryRockstarFilters) returns (QueryResponse_Rockstar) {} + + rpc GetQueryRockstars(QueryRockstars) returns (QueryResponse_Rockstar) {} + + rpc GetQueryRockstarsConventions(QueryRockstarsConventions) returns (QueryResponse_Rockstar) {} + + rpc GetQueryRockstarsFilter(QueryRockstarsFilter) returns (QueryResponse_Rockstar) {} + + rpc GetQueryRockstarsIFilter(QueryRockstarsIFilter) returns (QueryResponse_Rockstar) {} + + rpc GetQueryRockstarsImplicit(QueryRockstarsImplicit) returns (QueryResponse_Rockstar) {} + + rpc GetQueryRockstarsWithReferences(QueryRockstarsWithReferences) returns (QueryResponse_RockstarReference) {} + + rpc GetQueryTypeWithEnums(QueryTypeWithEnums) returns (QueryResponse_TypeWithEnum) {} + + rpc GetQueryUnknownRockstars(QueryUnknownRockstars) returns (QueryResponse_Rockstar) {} + + rpc DeleteRealDeleteAuditTenant(RealDeleteAuditTenant) returns (RockstarWithIdAndCountResponse) {} + + rpc DeleteRealDeleteAuditTenantGateway(RealDeleteAuditTenantGateway) returns (RockstarWithIdAndCountResponse) {} + + rpc DeleteRealDeleteAuditTenantMq(RealDeleteAuditTenantMq) returns (EmptyResponse) {} + + rpc PostRegenerateApiKeys(RegenerateApiKeys) returns (RegenerateApiKeysResponse) {} + + rpc PutRegister(Register) returns (RegisterResponse) {} + + rpc PostRegister(Register) returns (RegisterResponse) {} + + rpc GetRequiresAuth(RequiresAuth) returns (RequiresAuth) {} + + rpc PostRequiresAuth(RequiresAuth) returns (RequiresAuth) {} + + rpc PutRequiresAuth(RequiresAuth) returns (RequiresAuth) {} + + rpc DeleteRequiresAuth(RequiresAuth) returns (RequiresAuth) {} + + rpc PostResetTodos(ResetTodos) returns (EmptyResponse) {} + + rpc GetSearchMovies(SearchMovies) returns (QueryResponse_Movie) {} + + rpc PostSecured(Secured) returns (SecuredResponse) {} + + rpc PutSoftDeleteAuditTenant(SoftDeleteAuditTenant) returns (RockstarWithIdAndResultResponse) {} + + rpc ServerStreamFiles(StreamFiles) returns (stream FileContent) {} + + rpc GetStreamMovies(StreamMovies) returns (QueryResponse_Movie) {} + + rpc ServerStreamServerEvents(StreamServerEvents) returns (stream StreamServerEventsResponse) {} + + rpc PostTestAuthValidators(TestAuthValidators) returns (RockstarWithIdResponse) {} + + rpc PostTestDbCondition(TestDbCondition) returns (RockstarWithIdResponse) {} + + rpc PostTestDbValidator(TestDbValidator) returns (RockstarWithIdResponse) {} + + rpc PostTestIsAdmin(TestIsAdmin) returns (RockstarWithIdResponse) {} + + rpc PostTestMultiAuthValidators(TestMultiAuthValidators) returns (RockstarWithIdResponse) {} + + rpc GetThrow(Throw) returns (HelloResponse) {} + + rpc GetThrowCustom(ThrowCustom) returns (ThrowCustomResponse) {} + + rpc GetThrowVoid(ThrowVoid) returns (EmptyResponse) {} + + rpc PostTriggerAllValidators(TriggerAllValidators) returns (RockstarWithIdResponse) {} + + rpc PostTriggerValidators(TriggerValidators) returns (EmptyResponse) {} + + rpc PostUnAssignRoles(UnAssignRoles) returns (UnAssignRolesResponse) {} + + rpc PutUpdateConnectionInfoRockstar(UpdateConnectionInfoRockstar) returns (RockstarWithIdAndResultResponse) {} + + rpc PutUpdateNamedRockstar(UpdateNamedRockstar) returns (RockstarWithIdAndResultResponse) {} + + rpc PutUpdateRockstar(UpdateRockstar) returns (EmptyResponse) {} + + rpc PutUpdateRockstarAdhocNonDefaults(UpdateRockstarAdhocNonDefaults) returns (EmptyResponse) {} + + rpc PatchUpdateRockstarAudit(UpdateRockstarAudit) returns (EmptyResponse) {} + + rpc PutUpdateRockstarAuditTenant(UpdateRockstarAuditTenant) returns (RockstarWithIdAndResultResponse) {} + + rpc PutUpdateRockstarAuditTenantGateway(UpdateRockstarAuditTenantGateway) returns (RockstarWithIdAndResultResponse) {} + + rpc PutUpdateRockstarAuditTenantMq(UpdateRockstarAuditTenantMq) returns (EmptyResponse) {} + + rpc PatchUpdateRockstarVersion(UpdateRockstarVersion) returns (RockstarWithIdAndRowVersionResponse) {} + + rpc PutUpdateTodo(UpdateTodo) returns (EmptyResponse) {} + + rpc PostValidateCreateRockstar(ValidateCreateRockstar) returns (RockstarWithIdResponse) {} +} + +message AddHeader { + string Name = 1; + string Value = 2; +} +message Adhoc { + int32 Id = 1; + string first_name = 2; + string LastName = 3; +} +message AllFields { + int32 Id = 1; + int32 NullableId = 2; + uint32 Byte = 3; + int32 Short = 4; + int32 Int = 5; + int64 Long = 6; + uint32 UShort = 7; + uint32 UInt = 8; + uint64 ULong = 9; + float Float = 10; + double Double = 11; + string Decimal = 12; + string String = 13; + .google.protobuf.Timestamp DateTime = 14; + .google.protobuf.Duration TimeSpan = 15; + string Guid = 16; // default value could not be applied: 00000000-0000-0000-0000-000000000000 + .google.protobuf.Timestamp NullableDateTime = 17; + .google.protobuf.Duration NullableTimeSpan = 18; + string NullableGuid = 19; + HttpStatusCode Enum = 20; + HttpStatusCode NullableEnum = 21; +} +message AnyHello { + string Name = 1; +} +message AssignRoles { + string UserName = 1; + repeated string Permissions = 2; + repeated string Roles = 3; + map Meta = 4; +} +message AssignRolesResponse { + repeated string AllRoles = 1; + repeated string AllPermissions = 2; + map Meta = 3; + ResponseStatus ResponseStatus = 4; +} +message AuditBase { + .google.protobuf.Timestamp CreatedDate = 1; + string CreatedBy = 2; + string CreatedInfo = 3; + .google.protobuf.Timestamp ModifiedDate = 4; + string ModifiedBy = 5; + string ModifiedInfo = 6; + .google.protobuf.Timestamp SoftDeletedDate = 7; + string SoftDeletedBy = 8; + string SoftDeletedInfo = 9; + oneof subtype { + RockstarAuditTenant RockstarAuditTenant = 252248706; + } +} +message Authenticate { + string provider = 1; + string State = 2; + string oauth_token = 3; + string oauth_verifier = 4; + string UserName = 5; + string Password = 6; + bool RememberMe = 7; + string ErrorView = 9; + string nonce = 10; + string uri = 11; + string response = 12; + string qop = 13; + string nc = 14; + string cnonce = 15; + bool UseTokenCookie = 16; + string AccessToken = 17; + string AccessTokenSecret = 18; + string scope = 19; + map Meta = 20; +} +message AuthenticateResponse { + string UserId = 1; + string SessionId = 2; + string UserName = 3; + string DisplayName = 4; + string ReferrerUrl = 5; + string BearerToken = 6; + string RefreshToken = 7; + string ProfileUrl = 8; + repeated string Roles = 9; + repeated string Permissions = 10; + ResponseStatus ResponseStatus = 11; + map Meta = 12; +} +message Bar { + string Y = 2; +} +message Bookmark { + string Slug = 1; + string Title = 2; + string Description = 3; + string Url = 4; +} +message ChangeConnectionInfo { +} +message ChangeDb { + string NamedConnection = 1; + string ConnectionString = 2; + string ProviderName = 3; +} +message ChangeDbResponse { + repeated Rockstar Results = 1; +} +message ChatMessage { + int64 Id = 1; + string Channel = 2; + string FromUserId = 3; + string FromName = 4; + string DisplayName = 5; + string Message = 6; + string UserAuthId = 7; + bool Private = 8; +} +message ConvertSessionToToken { + bool PreserveSession = 1; + map Meta = 2; +} +message ConvertSessionToTokenResponse { + map Meta = 1; + string AccessToken = 2; + string RefreshToken = 3; + ResponseStatus ResponseStatus = 4; +} +message CreateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse { +} +message CreateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse { +} +message CreateBookmark { + string Slug = 1; + string Title = 2; + string Description = 3; + string Url = 4; +} +message CreateBookmarkResponse { + string Id = 1; // default value could not be applied: 00000000-0000-0000-0000-000000000000 + DaoBase Result = 2; + ResponseStatus ResponseStatus = 3; +} +message CreateConnectionInfoRockstar { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + int32 Id = 101; +} +message CreateNamedRockstar { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + int32 Id = 101; +} +message CreateRockstar { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} +message CreateRockstarAdhocNonDefaults { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} +message CreateRockstarAudit { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} +message CreateRockstarAuditMqToken { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + string BearerToken = 101; +} +message CreateRockstarAuditTenant { + string BearerToken = 201; + string FirstName = 202; + string LastName = 203; + int32 Age = 204; + .google.protobuf.Timestamp DateOfBirth = 205; + .google.protobuf.Timestamp DateDied = 206; + LivingStatus LivingStatus = 207; +} +message CreateRockstarAuditTenantGateway { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} +message CreateRockstarAuditTenantMq { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} +message CreateRockstarAutoMap { + string MapFirstName = 1; + string MapLastName = 2; + int32 MapAge = 3; + .google.protobuf.Timestamp MapDateOfBirth = 4; + .google.protobuf.Timestamp MapDateDied = 5; + LivingStatus MapLivingStatus = 6; +} +message CreateRockstarResponse { + ResponseStatus ResponseStatus = 1; +} +message CreateRockstarVersion { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} +message CreateRockstarWithAutoGuid { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} +message CreateRockstarWithReturn { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} +message CreateRockstarWithReturnGuidResponse { + string Id = 1; // default value could not be applied: 00000000-0000-0000-0000-000000000000 + RockstarBase Result = 2; + ResponseStatus ResponseStatus = 3; +} +message CreateRockstarWithVoidReturn { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} +message CreateTodo { + string Title = 1; + int32 Order = 2; +} +message CreateTodoResponse { + Todo Result = 1; + ResponseStatus ResponseStatus = 2; +} +message CustomRockstar { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + string RockstarAlbumName = 4; + string RockstarGenreName = 5; +} +message CustomRockstarSchema { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + string RockstarAlbumName = 4; + string RockstarGenreName = 5; +} +message CustomSelectRockstar { + int32 Id = 1; + string FirstName = 2; + string LastName = 3; + int32 Age = 4; +} +message CustomSelectRockstarResponse { + int32 Id = 1; + string FirstName = 2; + int32 Age = 3; +} +message CustomValidationErrors { + string CustomErrorCode = 1; + int32 CustomErrorCodeAndMessage = 2; + string ErrorCodeRule = 3; + int32 IsOddCondition = 4; + int32 IsOddAndOverTwoDigitsCondition = 5; + int32 IsOddOrOverTwoDigitsCondition = 6; +} +message DaoBase { + string Id = 1; // default value could not be applied: 00000000-0000-0000-0000-000000000000 + .google.protobuf.Timestamp CreateDate = 2; + string CreatedBy = 3; + .google.protobuf.Timestamp ModifiedDate = 4; + string ModifiedBy = 5; + oneof subtype { + Bookmark Bookmark = 439450339; + } +} +message DeleteRockstar { + int32 Id = 1; +} +message DeleteRockstarAudit { + int32 Id = 1; +} +message DeleteRockstarCountResponse { + int32 Count = 1; + ResponseStatus ResponseStatus = 2; +} +message DeleteRockstarFilters { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; +} +message DeleteTodo { + int64 Id = 1; +} +message DeleteTodos { + repeated int64 Ids = 1 [packed = false]; +} +message DynamicRequest { + map Params = 1; +} +message DynamicValidationRules { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + LivingStatus LivingStatus = 5; +} +message EmptyResponse { + ResponseStatus ResponseStatus = 1; +} +message EmptyValidators { + int32 Int = 1; + int32 NInt = 2; + .google.protobuf.Duration TimeSpan = 3; + .google.protobuf.Duration NTimeSpan = 4; + string String = 5; + repeated int32 IntArray = 6 [packed = false]; + repeated string StringList = 7; +} +message EndsWithSuffixRequest { + string Suffix = 1; +} +message EndsWithSuffixResponse { + SearchResult Result = 1; + int32 Count = 2; + repeated string Words = 3; +} +message Entry { +} +message FileContent { + string Name = 1; + string Type = 2; + int32 Length = 3; + bytes Body = 4; + ResponseStatus ResponseStatus = 5; +} +message Foo { + string X = 1; + oneof subtype { + Bar Bar = 210304982; + } +} +message GetAccessToken { + string RefreshToken = 1; + bool UseTokenCookie = 2; + map Meta = 3; +} +message GetAccessTokenResponse { + string AccessToken = 1; + map Meta = 2; + ResponseStatus ResponseStatus = 3; +} +message GetApiKeys { + string Environment = 1; + map Meta = 2; +} +message GetApiKeysResponse { + repeated UserApiKey Results = 1; + map Meta = 2; + ResponseStatus ResponseStatus = 3; +} +message GetFile { + string Path = 1; +} +message GetHello { + string Name = 1; +} +message GetTodo { + int64 Id = 1; +} +message GetTodoResponse { + Todo Result = 1; + ResponseStatus ResponseStatus = 2; +} +message GetTodos { +} +message GetTodosResponse { + repeated Todo Results = 1; + ResponseStatus ResponseStatus = 2; +} +message HelloJwt { + string Name = 1; + string BearerToken = 2; +} +message HelloJwtResponse { + string Result = 1; + ResponseStatus ResponseStatus = 2; +} +message HelloResponse { + string Result = 1; + ResponseStatus ResponseStatus = 2; +} +enum HttpStatusCode { + option allow_alias = true; + ZERO = 0; // proto3 requires a zero value as the first item (it can be named anything) + Continue = 100; + SwitchingProtocols = 101; + Processing = 102; + EarlyHints = 103; + OK = 200; + Created = 201; + Accepted = 202; + NonAuthoritativeInformation = 203; + NoContent = 204; + ResetContent = 205; + PartialContent = 206; + MultiStatus = 207; + AlreadyReported = 208; + IMUsed = 226; + MultipleChoices = 300; + Ambiguous = 300; + MovedPermanently = 301; + Moved = 301; + Found = 302; + Redirect = 302; + SeeOther = 303; + RedirectMethod = 303; + NotModified = 304; + UseProxy = 305; + Unused = 306; + TemporaryRedirect = 307; + RedirectKeepVerb = 307; + PermanentRedirect = 308; + BadRequest = 400; + Unauthorized = 401; + PaymentRequired = 402; + Forbidden = 403; + NotFound = 404; + MethodNotAllowed = 405; + NotAcceptable = 406; + ProxyAuthenticationRequired = 407; + RequestTimeout = 408; + Conflict = 409; + Gone = 410; + LengthRequired = 411; + PreconditionFailed = 412; + RequestEntityTooLarge = 413; + RequestUriTooLong = 414; + UnsupportedMediaType = 415; + RequestedRangeNotSatisfiable = 416; + ExpectationFailed = 417; + MisdirectedRequest = 421; + UnprocessableEntity = 422; + Locked = 423; + FailedDependency = 424; + UpgradeRequired = 426; + PreconditionRequired = 428; + TooManyRequests = 429; + RequestHeaderFieldsTooLarge = 431; + UnavailableForLegalReasons = 451; + InternalServerError = 500; + NotImplemented = 501; + BadGateway = 502; + ServiceUnavailable = 503; + GatewayTimeout = 504; + HttpVersionNotSupported = 505; + VariantAlsoNegotiates = 506; + InsufficientStorage = 507; + LoopDetected = 508; + NotExtended = 510; + NetworkAuthenticationRequired = 511; +} +message Incr { + int32 Amount = 1; +} +enum LivingStatus { + Alive = 0; + Dead = 1; +} +message Movie { + int32 Id = 1; + string ImdbId = 2; + string Title = 3; + string Rating = 4; + string Score = 5; + string Director = 6; + .google.protobuf.Timestamp ReleaseDate = 7; + string TagLine = 8; + repeated string Genres = 9; +} +message Multiply { + int32 X = 1; + int32 Y = 2; +} +message MultiplyResponse { + int32 Result = 1; +} +message NamedRockstar { +} +message NoAbstractValidator { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + LivingStatus LivingStatus = 5; +} +message OnlyValidatesRequest { + int32 Test = 1; + string NotNull = 2; +} +message PagingTest { + int32 Id = 1; + string Name = 2; + int32 Value = 3; +} +message PatchAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse { +} +message PatchAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse { +} +message PatchRockstar { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + int32 Id = 101; +} +message PatchRockstarAuditTenant { + string BearerToken = 201; + int32 Id = 202; + string FirstName = 203; + LivingStatus LivingStatus = 204; +} +message PatchRockstarAuditTenantGateway { + int32 Id = 1; + string FirstName = 2; + LivingStatus LivingStatus = 3; +} +message PatchRockstarAuditTenantMq { + int32 Id = 1; + string FirstName = 2; + LivingStatus LivingStatus = 3; +} +message PostChatToChannel { + string From = 1; + string ToUserId = 2; + string Channel = 3; + string Message = 4; + string Selector = 5; +} +message QueryAdhoc { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; +} +message QueryAdhocRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + string first_name = 201; +} +message QueryAllFields { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + string Guid = 201; +} +message QueryBookmarks { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; +} +message QueryCaseInsensitiveOrderBy { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryChangeConnectionInfo { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; +} +message QueryChangeDb { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + string NamedConnection = 201; + string ConnectionString = 202; + string ProviderName = 203; +} +message QueryCustomRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryCustomRockstarsFilter { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryCustomRockstarsReferences { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryCustomRockstarsSchema { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryDbTenant_RockstarAuditTenant_RockstarAuto { +} +message QueryFieldRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + string FirstName = 201; + repeated string FirstNames = 202; + int32 Age = 203; + string FirstNameCaseInsensitive = 204; + string FirstNameStartsWith = 205; + string LastNameEndsWith = 206; + repeated string FirstNameBetween = 207; + string OrLastName = 208; +} +message QueryFieldRockstarsDynamic { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryFieldsImplicitConventions { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + string FirstNameContains = 201; + string LastNameEndsWith = 202; +} +message QueryFoos { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + string X = 201; +} +message QueryGetRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + repeated int32 Ids = 201 [packed = false]; + repeated int32 Ages = 202 [packed = false]; + repeated string FirstNames = 203; + repeated int32 IdsBetween = 204 [packed = false]; +} +message QueryGetRockstarsDynamic { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; +} +message QueryJoinedRockstarAlbums { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; + string RockstarAlbumName = 202; +} +message QueryJoinedRockstarAlbumsCustomSelect { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; + string RockstarAlbumName = 202; +} +message QueryJoinedRockstarAlbumsCustomSelectResponse { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; + string RockstarAlbumName = 202; +} +message QueryMovies { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + repeated int32 Ids = 201 [packed = false]; + repeated string ImdbIds = 202; + repeated string Ratings = 203; +} +message QueryMultiJoinRockstar { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; + string RockstarAlbumName = 202; + string RockstarGenreName = 203; +} +message QueryNamedRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryOrRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; + string FirstName = 202; +} +message QueryOrRockstarsFields { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + string FirstName = 201; + string LastName = 202; +} +message QueryOverridedCustomRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryOverridedRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryPagingTest { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Id = 201; + string Name = 202; + int32 Value = 203; +} +message QueryResponse_Adhoc { + int32 Offset = 1; + int32 Total = 2; + repeated Adhoc Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_AllFields { + int32 Offset = 1; + int32 Total = 2; + repeated AllFields Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_Bookmark { + int32 Offset = 1; + int32 Total = 2; + repeated DaoBase Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_CustomRockstar { + int32 Offset = 1; + int32 Total = 2; + repeated CustomRockstar Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_CustomRockstarSchema { + int32 Offset = 1; + int32 Total = 2; + repeated CustomRockstarSchema Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_CustomSelectRockstar { + int32 Offset = 1; + int32 Total = 2; + repeated CustomSelectRockstar Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_CustomSelectRockstarResponse { + int32 Offset = 1; + int32 Total = 2; + repeated CustomSelectRockstarResponse Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_Foo { + int32 Offset = 1; + int32 Total = 2; + repeated Foo Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_Movie { + int32 Offset = 1; + int32 Total = 2; + repeated Movie Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_NamedRockstar { + int32 Offset = 1; + int32 Total = 2; + repeated Rockstar Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_PagingTest { + int32 Offset = 1; + int32 Total = 2; + repeated PagingTest Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_Rockstar { + int32 Offset = 1; + int32 Total = 2; + repeated Rockstar Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_RockstarAlbum { + int32 Offset = 1; + int32 Total = 2; + repeated RockstarAlbum Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_RockstarAlias { + int32 Offset = 1; + int32 Total = 2; + repeated RockstarAlias Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_RockstarAuto { + int32 Offset = 1; + int32 Total = 2; + repeated RockstarBase Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_RockstarReference { + int32 Offset = 1; + int32 Total = 2; + repeated RockstarReference Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryResponse_TypeWithEnum { + int32 Offset = 1; + int32 Total = 2; + repeated TypeWithEnum Results = 3; + map Meta = 4; + ResponseStatus ResponseStatus = 5; +} +message QueryRockstarAlbums { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Id = 201; + int32 RockstarId = 202; + string Name = 203; + string Genre = 204; + repeated int32 IdBetween = 205 [packed = false]; +} +message QueryRockstarAlbumsCustomLeftJoin { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; + string AlbumName = 202; + int32 IdNotEqualTo = 203; +} +message QueryRockstarAlbumsImplicit { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; +} +message QueryRockstarAlbumsLeftJoin { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; + string AlbumName = 202; + int32 IdNotEqualTo = 203; +} +message QueryRockstarAlias { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; + string RockstarAlbumName = 202; +} +message QueryRockstarAudit { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Id = 301; +} +message QueryRockstarAuditSubOr { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + string FirstNameStartsWith = 201; + int32 AgeOlderThan = 202; +} +message QueryRockstarFilters { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + repeated int32 Ids = 201 [packed = false]; + repeated int32 Ages = 202 [packed = false]; + repeated string FirstNames = 203; + repeated int32 IdsBetween = 204 [packed = false]; +} +message QueryRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryRockstarsConventions { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + .google.protobuf.Timestamp DateOfBirthGreaterThan = 201; + .google.protobuf.Timestamp DateDiedLessThan = 202; + repeated int32 Ids = 203 [packed = false]; + int32 AgeOlderThan = 204; + int32 AgeGreaterThanOrEqualTo = 205; + int32 AgeGreaterThan = 206; + int32 GreaterThanAge = 207; + string FirstNameStartsWith = 208; + string LastNameEndsWith = 209; + string LastNameContains = 210; + string RockstarAlbumNameContains = 211; + int32 RockstarIdAfter = 212; + int32 RockstarIdOnOrAfter = 213; +} +message QueryRockstarsFilter { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryRockstarsIFilter { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryRockstarsImplicit { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; +} +message QueryRockstarsWithReferences { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 Age = 201; +} +message QueryTypeWithEnums { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; +} +message QueryUnknownRockstars { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + int32 UnknownInt = 201; + string UnknownProperty = 202; +} +message RealDeleteAuditTenant { + string BearerToken = 1; + int32 Id = 2; + int32 Age = 3; +} +message RealDeleteAuditTenantGateway { + int32 Id = 1; +} +message RealDeleteAuditTenantMq { + int32 Id = 1; +} +message RegenerateApiKeys { + string Environment = 1; + map Meta = 2; +} +message RegenerateApiKeysResponse { + repeated UserApiKey Results = 1; + map Meta = 2; + ResponseStatus ResponseStatus = 3; +} +message Register { + string UserName = 1; + string FirstName = 2; + string LastName = 3; + string DisplayName = 4; + string Email = 5; + string Password = 6; + string ConfirmPassword = 7; + bool AutoLogin = 8; + string ErrorView = 10; + map Meta = 11; +} +message RegisterResponse { + string UserId = 1; + string SessionId = 2; + string UserName = 3; + string ReferrerUrl = 4; + string BearerToken = 5; + string RefreshToken = 6; + ResponseStatus ResponseStatus = 7; + map Meta = 8; +} +message RequiresAuth { + string Name = 1; + string BearerToken = 2; +} +message ResetTodos { +} +message ResponseError { + string ErrorCode = 1; + string FieldName = 2; + string Message = 3; + map Meta = 4; +} +message ResponseStatus { + string ErrorCode = 1; + string Message = 2; + string StackTrace = 3; + repeated ResponseError Errors = 4; + map Meta = 5; +} +message Rockstar { + int32 Id = 1; + string FirstName = 2; + string LastName = 3; + int32 Age = 4; + .google.protobuf.Timestamp DateOfBirth = 5; + .google.protobuf.Timestamp DateDied = 6; + LivingStatus LivingStatus = 7; + oneof subtype { + NamedRockstar NamedRockstar = 345091624; + } +} +message RockstarAlbum { + int32 Id = 1; + int32 RockstarId = 2; + string Name = 3; + string Genre = 4; +} +message RockstarAlias { + int32 RockstarId = 1; + string FirstName = 2; + string Surname = 3; + string album = 4; +} +message RockstarAudit { + int32 Id = 1; + .google.protobuf.Timestamp CreatedDate = 2; + string CreatedBy = 3; + string CreatedInfo = 4; + .google.protobuf.Timestamp ModifiedDate = 5; + string ModifiedBy = 6; + string ModifiedInfo = 7; +} +message RockstarAuditTenant { + int32 TenantId = 1; + int32 Id = 2; + string FirstName = 3; + string LastName = 4; + int32 Age = 5; + .google.protobuf.Timestamp DateOfBirth = 6; + .google.protobuf.Timestamp DateDied = 7; + LivingStatus LivingStatus = 8; +} +message RockstarAuto { + int32 Id = 1; +} +message RockstarAutoGuid { + string Id = 1; // default value could not be applied: 00000000-0000-0000-0000-000000000000 +} +message RockstarBase { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + oneof subtype { + RockstarAutoGuid RockstarAutoGuid = 92000829; + RockstarAuto RockstarAuto = 92257311; + RockstarAudit RockstarAudit = 119875064; + RockstarVersion RockstarVersion = 320656675; + } +} +message RockstarGenre { + int32 Id = 1; + int32 RockstarId = 2; + string Name = 3; +} +message RockstarReference { + int32 Id = 1; + string FirstName = 2; + string LastName = 3; + int32 Age = 4; + repeated RockstarAlbum Albums = 5; +} +message RockstarVersion { + int32 Id = 1; + uint64 RowVersion = 2; +} +message RockstarWithIdAndCountResponse { + int32 Id = 1; + int32 Count = 2; + ResponseStatus ResponseStatus = 3; +} +message RockstarWithIdAndResultResponse { + int32 Id = 1; + RockstarBase Result = 2; + ResponseStatus ResponseStatus = 3; +} +message RockstarWithIdAndRowVersionResponse { + int32 Id = 1; + uint32 RowVersion = 2; + ResponseStatus ResponseStatus = 3; +} +message RockstarWithIdResponse { + int32 Id = 1; + ResponseStatus ResponseStatus = 2; +} +message SearchMovies { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; +} +message SearchResult { + int32 Id = 1; + string Suffix = 2; +} +message Secured { + string Name = 1; +} +message SecuredResponse { + string Result = 1; + ResponseStatus ResponseStatus = 2; +} +message SoftDeleteAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse { +} +message SoftDeleteAuditTenant { + int32 Id = 201; +} +message SoftDeleteAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse { +} +enum SomeEnum { + SomeEnum_Value0 = 0; + SomeEnum_Value1 = 1; + SomeEnum_Value2 = 2; + SomeEnum_Value3 = 3; +} +enum SomeEnumAsInt { + Value0 = 0; + Value1 = 1; + Value2 = 2; + Value3 = 3; +} +message StreamFiles { + repeated string Paths = 1; +} +message StreamMovies { + int32 Skip = 1; + int32 Take = 2; + string OrderBy = 3; + string OrderByDesc = 4; + string Include = 5; + string Fields = 6; + map Meta = 7; + repeated string Ratings = 201; +} +message StreamServerEvents { + repeated string Channels = 1; +} +message StreamServerEventsResponse { + int64 EventId = 1; + string Channel = 2; + string Selector = 4; + string Json = 5; + string Op = 6; + string Target = 7; + string CssSelector = 8; + map Meta = 9; + string UserId = 10; + string DisplayName = 11; + string ProfileUrl = 12; + bool IsAuthenticated = 13; + repeated string Channels = 14; + int64 CreatedAt = 15; + string Id = 21; + string UnRegisterUrl = 22; + string UpdateSubscriberUrl = 23; + string HeartbeatUrl = 24; + int64 HeartbeatIntervalMs = 25; + int64 IdleTimeoutMs = 26; + ResponseStatus ResponseStatus = 30; +} +message TestAuthValidators { + string NotNull = 1; +} +message TestDbCondition { + int32 Id = 1; + string NotNull = 2; +} +message TestDbValidator { + int32 Id = 1; + string NotNull = 2; +} +message TestIsAdmin { + string NotNull = 1; +} +message TestMultiAuthValidators { + string NotNull = 1; +} +message Throw { + string Message = 1; +} +message ThrowCustom { +} +message ThrowCustomResponse { + ResponseStatus ResponseStatus = 1; +} +message ThrowVoid { + string Message = 1; +} +message Todo { + int64 Id = 1; + string Title = 2; + int32 Order = 3; + bool Completed = 4; +} +message TriggerAllValidators { + string CreditCard = 1; + string Email = 2; + string Empty = 3; + string Equal = 4; + int32 ExclusiveBetween = 5; + int32 GreaterThanOrEqual = 6; + int32 GreaterThan = 7; + int32 InclusiveBetween = 8; + string Length = 9; + int32 LessThanOrEqual = 10; + int32 LessThan = 11; + string NotEmpty = 12; + string NotEqual = 13; + string Null = 14; + string RegularExpression = 15; + string ScalePrecision = 16; +} +message TriggerValidators { + string CreditCard = 1; + string Email = 2; + string Empty = 3; + string Equal = 4; + int32 ExclusiveBetween = 5; + int32 GreaterThanOrEqual = 6; + int32 GreaterThan = 7; + int32 InclusiveBetween = 8; + string Length = 9; + int32 LessThanOrEqual = 10; + int32 LessThan = 11; + string NotEmpty = 12; + string NotEqual = 13; + string Null = 14; + string RegularExpression = 15; + string ScalePrecision = 16; +} +message TypeWithEnum { + int32 Id = 1; + string Name = 2; + SomeEnum SomeEnum = 3; + SomeEnumAsInt SomeEnumAsInt = 4; + SomeEnum NSomeEnum = 5; + SomeEnumAsInt NSomeEnumAsInt = 6; +} +message UnAssignRoles { + string UserName = 1; + repeated string Permissions = 2; + repeated string Roles = 3; + map Meta = 4; +} +message UnAssignRolesResponse { + repeated string AllRoles = 1; + repeated string AllPermissions = 2; + map Meta = 3; + ResponseStatus ResponseStatus = 4; +} +message UpdateAuditBase_RockstarAuditTenant_RockstarWithIdAndResultResponse { +} +message UpdateAuditTenantBase_RockstarAuditTenant_RockstarWithIdAndResultResponse { +} +message UpdateConnectionInfoRockstar { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + int32 Id = 101; +} +message UpdateNamedRockstar { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + int32 Id = 101; +} +message UpdateRockstar { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + int32 Id = 101; +} +message UpdateRockstarAdhocNonDefaults { + int32 Id = 1; + string FirstName = 2; + string LastName = 3; + int32 Age = 4; + .google.protobuf.Timestamp DateOfBirth = 5; + .google.protobuf.Timestamp DateDied = 6; + LivingStatus LivingStatus = 7; +} +message UpdateRockstarAudit { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + int32 Id = 101; +} +message UpdateRockstarAuditTenant { + string BearerToken = 201; + int32 Id = 202; + string FirstName = 203; + LivingStatus LivingStatus = 204; +} +message UpdateRockstarAuditTenantGateway { + int32 Id = 1; + string FirstName = 2; + LivingStatus LivingStatus = 3; +} +message UpdateRockstarAuditTenantMq { + int32 Id = 1; + string FirstName = 2; + LivingStatus LivingStatus = 3; +} +message UpdateRockstarVersion { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; + int32 Id = 101; + uint64 RowVersion = 102; +} +message UpdateTodo { + int64 Id = 1; + string Title = 2; + int32 Order = 3; + bool Completed = 4; +} +message UserApiKey { + string Key = 1; + string KeyType = 2; + .google.protobuf.Timestamp ExpiryDate = 3; + map Meta = 4; +} +message ValidateCreateRockstar { + string FirstName = 1; + string LastName = 2; + int32 Age = 3; + .google.protobuf.Timestamp DateOfBirth = 4; + .google.protobuf.Timestamp DateDied = 5; + LivingStatus LivingStatus = 6; +} diff --git a/tests/ServiceStack.Extensions.Tests/ServiceStack.Extensions.Tests.csproj b/tests/ServiceStack.Extensions.Tests/ServiceStack.Extensions.Tests.csproj new file mode 100644 index 00000000000..494103916ac --- /dev/null +++ b/tests/ServiceStack.Extensions.Tests/ServiceStack.Extensions.Tests.csproj @@ -0,0 +1,37 @@ + + + + netcoreapp3.1 + 8 + + + + + $(DefineConstants);AUTOQUERY_CRUD + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/ServiceStack.Logging.Tests/ServiceStack.Logging.Tests.csproj b/tests/ServiceStack.Logging.Tests/ServiceStack.Logging.Tests.csproj index cea7b51729a..440d9db224a 100644 --- a/tests/ServiceStack.Logging.Tests/ServiceStack.Logging.Tests.csproj +++ b/tests/ServiceStack.Logging.Tests/ServiceStack.Logging.Tests.csproj @@ -1,210 +1,61 @@ - - + - Debug - AnyCPU - 9.0.30729 - 2.0 - {DDDA27EC-5855-4E89-9971-C117EC08BDE3} - Library - Properties - ServiceStack.Logging.Tests + net46 + portable ServiceStack.Logging.Tests - - - - - - - - - - - 3.5 - - - false - v4.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - ..\..\src\ - true + ServiceStack.Logging.Tests + false + false + false + false + false + false + false + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - ..\..\src\packages\log4net.2.0.3\lib\net40-full\log4net.dll - - - False - ..\..\src\packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35\Microsoft.Practices.EnterpriseLibrary.Common.dll - - - False - ..\..\src\packages\EnterpriseLibrary.Logging.5.0.505.1\lib\NET35\Microsoft.Practices.EnterpriseLibrary.Logging.dll - - - ..\..\src\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll - - - ..\..\src\packages\Unity.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.dll - - - ..\..\src\packages\Unity.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.Configuration.dll - - - ..\..\src\packages\Unity.Interception.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.Interception.dll - - - ..\..\src\packages\Unity.Interception.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.Interception.Configuration.dll - - - ..\..\src\packages\NLog.2.1.0\lib\net40\NLog.dll - - - ..\..\src\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - ..\..\src\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll - - - False - ..\..\lib\ServiceStack.Text.dll - - - - - - - - - - - - - - - - - - - - - - - - + + PreserveNewest + - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - false - + + + + + + + + + + + + + + + + + - - - {982416db-c143-4028-a0c3-cf41892d18d3} - ServiceStack.Common - - - {42e1c8c0-a163-44cc-92b1-8f416f2c0b01} - ServiceStack.Interfaces - - - {EE43BF1E-CF97-4215-A5A3-46D1C363F928} - ServiceStack.Logging.Elmah - - - {edd72adc-327c-4152-b84b-b48552311534} - ServiceStack.Logging.EntLib5 - - - {D920BA88-E394-4C75-94E3-78D7298A8457} - ServiceStack.Logging.EventLog - - - {C44A6E80-326E-4036-8906-62E881F4727D} - ServiceStack.Logging.Log4Net - - - {6b31f200-073c-46d4-b389-05646e035939} - ServiceStack.Logging.NLog - + + $(DefineConstants);NET45 + + + + + + + + + + - - - Always - - - Always - Designer - - - Designer - - - + + $(DefineConstants);NETCORE_SUPPORT;NETCORE + + + + + - - - \ No newline at end of file diff --git a/tests/ServiceStack.Logging.Tests/UnitTests/ElmahInterceptingLoggerTests.cs b/tests/ServiceStack.Logging.Tests/UnitTests/ElmahInterceptingLoggerTests.cs index 59977d5d324..0a2772e4801 100644 --- a/tests/ServiceStack.Logging.Tests/UnitTests/ElmahInterceptingLoggerTests.cs +++ b/tests/ServiceStack.Logging.Tests/UnitTests/ElmahInterceptingLoggerTests.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using Rhino.Mocks; using ServiceStack.Logging.Elmah; +using ServiceStack.Logging.Log4Net; namespace ServiceStack.Logging.Tests.UnitTests { @@ -48,5 +49,17 @@ public void ElmahInterceptingLogger_LoggingTest() log.Warn(message, ex); log.WarnFormat(messageFormat, message, ex.Message); } + + [Test] + public void Does_log_Log4Net_errors_to_Elmah() + { + var log4NetFactory = new Log4NetFactory(true); + LogManager.LogFactory = new ElmahLogFactory(log4NetFactory, new HttpApplication()); + + var log = LogManager.GetLogger(typeof(ElmahLogFactoryTests)); + log.Error("Error log test"); + + LogManager.LogFactory = null; + } } } diff --git a/tests/ServiceStack.Logging.Tests/UnitTests/EntLib5FactoryTests.cs b/tests/ServiceStack.Logging.Tests/UnitTests/EntLib5FactoryTests.cs index 6e1a4201a4b..45088c6d7fa 100644 --- a/tests/ServiceStack.Logging.Tests/UnitTests/EntLib5FactoryTests.cs +++ b/tests/ServiceStack.Logging.Tests/UnitTests/EntLib5FactoryTests.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using Microsoft.Practices.EnterpriseLibrary.Logging; using NUnit.Framework; @@ -24,6 +25,14 @@ public void EntLib5FactoryTestWithExistingConfigFile() { // set up a Configuration file and ensure it exists const string configFile = "EntLib5.Test.config"; + + // R# Tests stopped copying required files + if (!File.Exists(configFile)) + { + Console.WriteLine($"{configFile} was not copied to {Environment.CurrentDirectory}"); + return; + } + Assert.IsTrue(File.Exists(configFile), "Test setup failure. Required Enterprise Library config file is missing."); // initialize the EntLib5 Logger factory with configuration file diff --git a/tests/ServiceStack.Logging.Tests/UnitTests/EventLoggerTests.cs b/tests/ServiceStack.Logging.Tests/UnitTests/EventLoggerTests.cs index c6f809fea25..f8d1938b1ad 100644 --- a/tests/ServiceStack.Logging.Tests/UnitTests/EventLoggerTests.cs +++ b/tests/ServiceStack.Logging.Tests/UnitTests/EventLoggerTests.cs @@ -16,17 +16,19 @@ public void EventLoggerTest() } [Test] - [ExpectedException(typeof(ArgumentNullException))] public void EventLogger_NullLogNameTest() { - ILog log = new EventLogger(null, "Application"); + Assert.Throws(() => { + ILog log = new EventLogger(null, "Application"); + }); } [Test] - [ExpectedException(typeof(ArgumentNullException))] public void EventLogger_NullSourceNameTest() { - ILog log = new EventLogger("ServiceStack.Logging.Tests", null); + Assert.Throws(() => { + ILog log = new EventLogger("ServiceStack.Logging.Tests", null); + }); } [Test] diff --git a/tests/ServiceStack.Logging.Tests/UnitTests/Log4NetFactoryTests.cs b/tests/ServiceStack.Logging.Tests/UnitTests/Log4NetFactoryTests.cs index 70816341d00..ada235ea8bc 100644 --- a/tests/ServiceStack.Logging.Tests/UnitTests/Log4NetFactoryTests.cs +++ b/tests/ServiceStack.Logging.Tests/UnitTests/Log4NetFactoryTests.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using NUnit.Framework; using ServiceStack.Logging.Log4Net; @@ -25,6 +26,14 @@ public void Log4NetFactoryTest() public void Log4NetFactoryTestWithExistingConfigFile() { const string configFile = "log4net.Test.config"; + + // R# Tests stopped copying required files + if (!File.Exists(configFile)) + { + Console.WriteLine($"{configFile} was not copied to {Environment.CurrentDirectory}"); + return; + } + Assert.IsTrue(File.Exists(configFile), "Test setup failure. Required log4net config file is missing."); Log4NetFactory factory = new Log4NetFactory(configFile); diff --git a/tests/ServiceStack.Logging.Tests/UnitTests/LogManagerTests.cs b/tests/ServiceStack.Logging.Tests/UnitTests/LogManagerTests.cs index 718f6d9bf0d..736c5356c56 100644 --- a/tests/ServiceStack.Logging.Tests/UnitTests/LogManagerTests.cs +++ b/tests/ServiceStack.Logging.Tests/UnitTests/LogManagerTests.cs @@ -11,13 +11,13 @@ public void LogManager_DefaultTest() { ILog log = LogManager.GetLogger(GetType()); Assert.IsNotNull(log); - Assert.IsNotNull(LogManager.LogFactory as DebugLogFactory); - Assert.IsNotNull(log as DebugLogger); + Assert.IsNotNull(LogManager.LogFactory as NullLogFactory); + Assert.IsNotNull(log as NullDebugLogger); log = LogManager.GetLogger(GetType().Name); Assert.IsNotNull(log); - Assert.IsNotNull(LogManager.LogFactory as DebugLogFactory); - Assert.IsNotNull(log as DebugLogger); + Assert.IsNotNull(LogManager.LogFactory as NullLogFactory); + Assert.IsNotNull(log as NullDebugLogger); } [Test] diff --git a/tests/ServiceStack.Logging.Tests/UnitTests/NLogTests.cs b/tests/ServiceStack.Logging.Tests/UnitTests/NLogTests.cs new file mode 100644 index 00000000000..b9fafb6f5a3 --- /dev/null +++ b/tests/ServiceStack.Logging.Tests/UnitTests/NLogTests.cs @@ -0,0 +1,102 @@ +using System; +using NLog; +using NUnit.Framework; + +namespace ServiceStack.Logging.Tests.UnitTests +{ + [TestFixture] + public class NLogTests + { + [Test] + public void Does_maintain_callsite() + { + try + { + NLog.LogManager.ThrowExceptions = true; // Only use this for unit-tests + var target = new NLog.Targets.MemoryTarget(); + NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target); + Logging.LogManager.LogFactory = new NLogger.NLogFactory(); + var log = ServiceStack.Logging.LogManager.LogFactory.GetLogger(GetType()); + log.InfoFormat("Message"); + log.InfoFormat("Message with Args {0}", "Foo"); + log.Info("Message with Exception", new Exception("Foo Exception")); + Assert.AreEqual(3, target.Logs.Count); + } + finally + { + NLog.Common.InternalLogger.Reset(); + NLog.LogManager.Configuration = null; + } + } + + [Test] + public void PushPropertyTest() + { + try + { + NLog.LogManager.ThrowExceptions = true; // Only use this for unit-tests + var target = new NLog.Targets.MemoryTarget(); + NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target); + Logging.LogManager.LogFactory = new NLogger.NLogFactory(); + var log = Logging.LogManager.LogFactory.GetLogger(GetType()); + using (log.PushProperty("Hello", "World")) + { + log.InfoFormat("Message"); + } + Assert.AreEqual(1, target.Logs.Count); + } + finally + { + NLog.Common.InternalLogger.Reset(); + NLog.LogManager.Configuration = null; + } + } + + [Test] + public void CaptureSingleParameterExceptionTest() + { + try + { + NLog.LogManager.ThrowExceptions = true; // Only use this for unit-tests + var target = new NLog.Targets.DebugTarget() { Layout = "${exception:format=message}" }; + NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Trace); + Logging.LogManager.LogFactory = new NLogger.NLogFactory(); + var log = Logging.LogManager.LogFactory.GetLogger(GetType()); + log.Debug(new ApplicationException("Debug")); + Assert.AreEqual("Debug", target.LastMessage); + log.Info(new ApplicationException("Info")); + Assert.AreEqual("Info", target.LastMessage); + log.Warn(new ApplicationException("Warn")); + Assert.AreEqual("Warn", target.LastMessage); + log.Error(new ApplicationException("Error")); + Assert.AreEqual("Error", target.LastMessage); + log.Fatal(new ApplicationException("Fatal")); + Assert.AreEqual("Fatal", target.LastMessage); + } + finally + { + NLog.Common.InternalLogger.Reset(); + NLog.LogManager.Configuration = null; + } + } + + [Test] + public void Can_call_method_using_NLog_concrete_providers() + { + Logging.LogManager.LogFactory = new NLogger.NLogFactory(); + + var instance = new NLogExample(); + instance.Method(); + } + } + + public class NLogExample + { + public static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + + public void Method() + { + logger.Log(LogLevel.Debug, "Method called"); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Logging.Tests/UnitTests/SerilogFactoryTests.cs b/tests/ServiceStack.Logging.Tests/UnitTests/SerilogFactoryTests.cs new file mode 100644 index 00000000000..345c74dbcdf --- /dev/null +++ b/tests/ServiceStack.Logging.Tests/UnitTests/SerilogFactoryTests.cs @@ -0,0 +1,18 @@ +using NUnit.Framework; +using ServiceStack.Logging.Serilog; + +namespace ServiceStack.Logging.Tests.UnitTests +{ + [TestFixture] + public class SerilogFactoryTests + { + [Test] + public void Instantiation() + { + var factory = new SerilogFactory(); + var log = factory.GetLogger(GetType()); + Assert.IsNotNull(log); + Assert.IsNotNull(log as SerilogLogger); + } + } +} diff --git a/tests/ServiceStack.Logging.Tests/UnitTests/SerilogLoggerTests.cs b/tests/ServiceStack.Logging.Tests/UnitTests/SerilogLoggerTests.cs new file mode 100644 index 00000000000..9c14033e49c --- /dev/null +++ b/tests/ServiceStack.Logging.Tests/UnitTests/SerilogLoggerTests.cs @@ -0,0 +1,115 @@ +using System; +using NUnit.Framework; +using ServiceStack.Logging.Serilog; +using global::Serilog; +using ServiceStack.Logging.Tests.UseCases; +using ServiceStack.Text; + +namespace ServiceStack.Logging.Tests.UnitTests +{ + using System.Collections.Generic; + using System.Linq; + using global::Serilog.Core; + using global::Serilog.Events; + + [TestFixture] + public class SerilogLoggerTests + { + [Test] + public void Instantiation() + { + var log = new SerilogLogger(GetType()); + Assert.IsNotNull(log); + } + + [Test] + public void Logging() + { + const string message = "Error Message"; + const string messageFormat = "Message Format: message: {0}, exception: {1}"; + var ex = new Exception(); + + var log = new SerilogLogger(GetType()); + Assert.IsNotNull(log); + + log.Debug(message); + log.Debug(message, ex); + log.DebugFormat(messageFormat, message, ex.Message); + log.Debug(ex, messageFormat, messageFormat, ex); + + log.Error(message); + log.Error(message, ex); + log.ErrorFormat(messageFormat, message, ex.Message); + log.Error(ex, messageFormat, messageFormat, ex); + + log.Fatal(message); + log.Fatal(message, ex); + log.FatalFormat(messageFormat, message, ex.Message); + log.Fatal(ex, messageFormat, messageFormat, ex); + + log.Info(message); + log.Info(message, ex); + log.InfoFormat(messageFormat, message, ex.Message); + log.Info(ex, messageFormat, messageFormat, ex); + + log.Warn(message); + log.Warn(message, ex); + log.WarnFormat(messageFormat, message, ex.Message); + log.Warn(ex, messageFormat, messageFormat, ex); + } + + [Test] + public void ForContextAddingPropertiesTests() + { + var dummySink = new DummySink(); + var log = new SerilogLogger(new LoggerConfiguration().WriteTo.Sink(dummySink).CreateLogger()); + + var messageTemplate = "Testing adding {prop2} props"; + log.ForContext("prop", "value").InfoFormat(messageTemplate, "awesome"); + Log.CloseAndFlush(); + + var result = dummySink.Events.SingleOrDefault(); + + Assert.NotNull(result); + Assert.AreEqual(LogEventLevel.Information, result.Level); + Assert.AreEqual(messageTemplate, result.MessageTemplate.Text); + Assert.True(result.Properties.ContainsKey("prop")); + Assert.AreEqual("\"value\"", result.Properties["prop"].ToString()); + Assert.True(result.Properties.ContainsKey("prop2")); + Assert.AreEqual("\"awesome\"", result.Properties["prop2"].ToString()); + } + + [Test] + public void PushPropertyTests() + { + var dummySink = new DummySink(); + LogManager.LogFactory = new SerilogFactory(new LoggerConfiguration() + .Enrich.FromLogContext() + .WriteTo.Sink(dummySink) + .CreateLogger()); + + var log = LogManager.GetLogger(typeof(SerilogLoggerTests)); + + using (log.PushProperty("A", "1")) + using (log.PushProperty("B", "2")) + { + log.Info("log entry"); + } + + var result = dummySink.Events[0]; + Assert.That(result.Properties.Any(x => x.Key == "A")); + Assert.That(result.Properties.Any(x => x.Key == "B")); + } + + } + + internal class DummySink : ILogEventSink + { + public void Emit(LogEvent logEvent) + { + Events.Add(logEvent); + } + + public List Events { get; } = new List(); + } +} diff --git a/tests/ServiceStack.Logging.Tests/UnitTests/SlackLogFactoryTests.cs b/tests/ServiceStack.Logging.Tests/UnitTests/SlackLogFactoryTests.cs new file mode 100644 index 00000000000..05e8204c12c --- /dev/null +++ b/tests/ServiceStack.Logging.Tests/UnitTests/SlackLogFactoryTests.cs @@ -0,0 +1,237 @@ +//Requires ServiceStack deps +#if FALSE +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using Funq; +using NUnit.Framework; +using ServiceStack.Configuration; +using ServiceStack.Logging.Slack; + +namespace ServiceStack.Logging.Tests.UnitTests +{ + public class TestAppHost : AppSelfHostBase + { + public static Action AssertCallback = (req) => { }; + + public TestAppHost() + : base("TestSlackHost", typeof(TestAppHost).Assembly) + { + + } + + public class SlackLoggingData + { + public string Channel { get; set; } + public string Text { get; set; } + public string Username { get; set; } + public string IconEmoji { get; set; } + } + + public override void Configure(Container container) + { + + } + + [Route("/testing")] + public class SlackMessage : SlackLoggingData { } + + public class SlackTestService : Service + { + public void Any(SlackMessage request) + { + TestAppHost.AssertCallback(request); + } + } + } + + [TestFixture] + public class SlackLogFactoryTests + { + readonly AppSelfHostBase testAppHost = new TestAppHost(); + + [OneTimeSetUp] + public void SetUp() + { + testAppHost.Init().Start("http://localhost:22334/"); + } + + [Test] + public void CanLogWithoutChannel() + { + LogManager.LogFactory = new SlackLogFactory("http://localhost:22334/testing"); + TestAppHost.AssertCallback = message => + { + Assert.That(message.Channel, Is.EqualTo(null)); + Assert.That(message.Text, Is.EqualTo("This is a test")); + }; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Error("This is a test"); + // Log is async HTTP request + Thread.Sleep(10); + } + + [Test] + public void CanLogWithDefaultChannel() + { + LogManager.LogFactory = new SlackLogFactory("http://localhost:22334/testing") + { + DefaultChannel = "Testing" + }; + TestAppHost.AssertCallback = message => + { + Assert.That(message.Channel, Is.EqualTo("Testing")); + Assert.That(message.Text, Is.EqualTo("This is a test")); + }; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Error("This is a test"); + // Log is async HTTP request + Thread.Sleep(10); + } + + [Test] + public void CanLogWithTypeSpecificChannels() + { + LogManager.LogFactory = new SlackLogFactory("http://localhost:22334/testing", true) + { + DefaultChannel = "Testing", + ErrorChannel = "ERROR", + InfoChannel = "INFO", + WarnChannel = "WARN", + DebugChannel = "DEBUG", + FatalChannel = "FATAL" + }; + //ERROR + TestAppHost.AssertCallback = message => + { + Assert.That(message.Channel, Is.EqualTo("ERROR")); + Assert.That(message.Text, Is.EqualTo("This is a test")); + }; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Error("This is a test"); + + //FATAL + TestAppHost.AssertCallback = message => + { + Assert.That(message.Channel, Is.EqualTo("FATAL")); + Assert.That(message.Text, Is.EqualTo("This is a test")); + }; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Fatal("This is a test"); + + //WARN + TestAppHost.AssertCallback = message => + { + Assert.That(message.Channel, Is.EqualTo("WARN")); + Assert.That(message.Text, Is.EqualTo("This is a test")); + }; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Warn("This is a test"); + + //INFO + TestAppHost.AssertCallback = message => + { + Assert.That(message.Channel, Is.EqualTo("INFO")); + Assert.That(message.Text, Is.EqualTo("This is a test")); + }; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Info("This is a test"); + + //DEBUG + TestAppHost.AssertCallback = message => + { + Assert.That(message.Channel, Is.EqualTo("DEBUG")); + Assert.That(message.Text, Is.EqualTo("This is a test")); + }; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Debug("This is a test"); + // Log is async HTTP request + Thread.Sleep(10); + } + + [Test] + public void DebugNotUsedByDefault() + { + LogManager.LogFactory = new SlackLogFactory("http://localhost:22334/testing"); + bool assertNeverFired = true; + TestAppHost.AssertCallback = message => assertNeverFired = false; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Debug("This is a test."); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).DebugFormat("This is a test. {0}", 1); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Debug("This is a test.", new ArgumentException()); + Thread.Sleep(200); + Assert.That(assertNeverFired, Is.EqualTo(true)); + Assert.That(LogManager.LogFactory.GetLogger(typeof(TestAppHost)).IsDebugEnabled, Is.EqualTo(false)); + } + + [Test] + public void ExceptionsAreLoggedWhenThrown() + { + LogManager.LogFactory = new SlackLogFactory("http://localhost:22334/testing", true) + { + DefaultChannel = "Testing", + ErrorChannel = "ERROR", + InfoChannel = "INFO", + WarnChannel = "WARN", + DebugChannel = "DEBUG" + }; + //ERROR + TestAppHost.AssertCallback = message => + { + Assert.That(message.Text, Is.EqualTo( + "This is a test\nMessage: Foo is null\r\nParameter name: Foo\nSource: \nTarget site: \nStack trace: \n")); + }; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Error("This is a test", new ArgumentNullException("Foo", "Foo is null")); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Warn("This is a test", new ArgumentNullException("Foo", "Foo is null")); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Info("This is a test", new ArgumentNullException("Foo", "Foo is null")); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Fatal("This is a test", new ArgumentNullException("Foo", "Foo is null")); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)).Debug("This is a test", new ArgumentNullException("Foo", "Foo is null")); + Thread.Sleep(10); + } + + [Test] + public void FormatLoggingCorrectlyLogs() + { + LogManager.LogFactory = new SlackLogFactory("http://localhost:22334/testing", true) + { + DefaultChannel = "Testing", + ErrorChannel = "ERROR", + InfoChannel = "INFO", + WarnChannel = "WARN", + DebugChannel = "DEBUG" + }; + //ERROR + TestAppHost.AssertCallback = message => + { + Assert.That(message.Text, Is.EqualTo( + "Hello one, two, three, four")); + }; + LogManager.LogFactory.GetLogger(typeof(TestAppHost)) + .ErrorFormat("Hello {0}, {1}, {2}, {3}", "one", "two", "three", "four"); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)) + .FatalFormat("Hello {0}, {1}, {2}, {3}", "one", "two", "three", "four"); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)) + .WarnFormat("Hello {0}, {1}, {2}, {3}", "one", "two", "three", "four"); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)) + .InfoFormat("Hello {0}, {1}, {2}, {3}", "one", "two", "three", "four"); + LogManager.LogFactory.GetLogger(typeof(TestAppHost)) + .DebugFormat("Hello {0}, {1}, {2}, {3}", "one", "two", "three", "four"); + Thread.Sleep(10); + } + + [Ignore("Call live slack team")] + [Test] + public void LogToSlackTest() + { + var url = new AppSettings().GetString("SlackUrl"); + LogManager.LogFactory = new SlackLogFactory(url, true); + var logger = LogManager.LogFactory.GetLogger(typeof(TestAppHost)); + logger.Debug("Hello slack\nThis is a message from NUint tests."); + + LogManager.LogFactory = new SlackLogFactory(url, true) + { + BotUsername = "Log'O'Bot", + IconEmoji = ":ghost:", + FatalChannel = "logs-other", + }; + + var logger2 = LogManager.LogFactory.GetLogger(typeof(TestAppHost)); + logger2.Fatal("Hello slack\nThis is a message from NUint tests. 111"); + } + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.Logging.Tests/UseCases/UseCaseSlack.cs b/tests/ServiceStack.Logging.Tests/UseCases/UseCaseSlack.cs new file mode 100644 index 00000000000..ca45c0026f4 --- /dev/null +++ b/tests/ServiceStack.Logging.Tests/UseCases/UseCaseSlack.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NUnit.Framework; +using ServiceStack.Configuration; +using ServiceStack.Logging.Slack; + +namespace ServiceStack.Logging.Tests.UseCases +{ + [TestFixture] + public class UseCaseSlack : UseCaseBase + { + public void SlackLogUseCase() + { + LogManager.LogFactory = new SlackLogFactory("{GeneratedSlackUrlFromCreatingIncomingWebhook}", debugEnabled:true) + { + //Alternate default channel than one specified when creating Incoming Webhook. + DefaultChannel = "other-default-channel", + //Custom channel for Fatal logs. Warn, Info etc will fallback to DefaultChannel or + //channel specified when Incoming Webhook was created. + FatalChannel = "more-grog-logs", + //Custom bot username other than default + BotUsername = "Guybrush Threepwood", + //Custom channel prefix can be provided to help filter logs from different users or environments. + ChannelPrefix = System.Security.Principal.WindowsIdentity.GetCurrent().Name + }; + ILog log = LogManager.GetLogger(GetType()); + + log.Debug("Start Logging..."); + } + + public void SlackFromAppConfig() + { + IAppSettings appSettings = null; // Get from ServiceStack core library. + // AppSettings is loaded from App/Web.config files and can populate all of the settings for the SlackLogFactory + // Keys prefix from app.config and web.config appSettings is "ServiceStack.Logging.Slack.{0}". + LogManager.LogFactory = new SlackLogFactory(appSettings); + ILog log = LogManager.GetLogger(GetType()); + + log.Debug("Start Logging..."); + } + } +} diff --git a/tests/ServiceStack.Logging.Tests/UseCases/UsingLog4Net.cs b/tests/ServiceStack.Logging.Tests/UseCases/UsingLog4Net.cs index 0bfcf5dc42f..ca220998dca 100644 --- a/tests/ServiceStack.Logging.Tests/UseCases/UsingLog4Net.cs +++ b/tests/ServiceStack.Logging.Tests/UseCases/UsingLog4Net.cs @@ -15,5 +15,17 @@ public void Log4NetUseCase() log.Debug("Debug Event Log Entry."); log.Warn("Warning Event Log Entry."); } + + [Test] + public void Log4NetUseCasePushProperty() + { + LogManager.LogFactory = new Log4NetFactory(); + ILog log = LogManager.GetLogger(GetType()); + + using (log.PushProperty("Hello", "World")) + { + log.Warn("Warning Event Log Entry."); + } + } } } \ No newline at end of file diff --git a/tests/ServiceStack.Logging.Tests/UseCases/UsingSerilog.cs b/tests/ServiceStack.Logging.Tests/UseCases/UsingSerilog.cs new file mode 100644 index 00000000000..70adf885669 --- /dev/null +++ b/tests/ServiceStack.Logging.Tests/UseCases/UsingSerilog.cs @@ -0,0 +1,70 @@ +using System; +using NUnit.Framework; +using Serilog; +using Serilog.Configuration; +using Serilog.Core; +using Serilog.Events; +using ServiceStack.Logging.Serilog; + +namespace ServiceStack.Logging.Tests.UseCases +{ + [TestFixture] + public class UsingSerilog + { + private void TestLog() + { + var log = LogManager.GetLogger(GetType()); + + log.Debug("Debug Event Log Entry."); + log.Info("Info Event Log Entry."); + log.Warn("Warning Event Log Entry."); + log.Error("Error Event Log Entry."); + log.Fatal("Fatal Event Log Entry."); + } + + [Test] + public void Use_default_SerilogFactory() + { + LogManager.LogFactory = new SerilogFactory(); + TestLog(); + } + + + + [Test] + public void Use_Serilog_with_custom_configuration_and_sink() + { + LogManager.LogFactory = new SerilogFactory(new LoggerConfiguration() + .WriteTo.MySink() + .CreateLogger()); + + TestLog(); + } + } + + public class MySink : ILogEventSink + { + private readonly IFormatProvider formatProvider; + + public MySink(IFormatProvider formatProvider) + { + this.formatProvider = formatProvider; + } + + public void Emit(LogEvent logEvent) + { + var message = logEvent.RenderMessage(formatProvider); + Console.WriteLine(DateTimeOffset.Now + " " + message); + } + } + + public static class MySinkExtensions + { + public static LoggerConfiguration MySink( + this LoggerSinkConfiguration loggerConfiguration, + IFormatProvider formatProvider = null) + { + return loggerConfiguration.Sink(new MySink(formatProvider)); + } + } +} diff --git a/tests/ServiceStack.Logging.Tests/app.config b/tests/ServiceStack.Logging.Tests/app.config index 2fd1507831b..4911ea931f1 100644 --- a/tests/ServiceStack.Logging.Tests/app.config +++ b/tests/ServiceStack.Logging.Tests/app.config @@ -1,90 +1,65 @@ - + - -
      -
      - - + +
      +
      +
      + + - - - - - - - - - - - - - - - - - + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/ServiceStack.Logging.Tests/packages.config b/tests/ServiceStack.Logging.Tests/packages.config index 6fdf0b2b5b0..c17b4645f40 100644 --- a/tests/ServiceStack.Logging.Tests/packages.config +++ b/tests/ServiceStack.Logging.Tests/packages.config @@ -1,12 +1,17 @@  - - - - - - + + + + + + - - + + + + + + + \ No newline at end of file diff --git a/tests/ServiceStack.Mvc.Stubs.Tests/ExternalController.cs b/tests/ServiceStack.Mvc.Stubs.Tests/ExternalController.cs deleted file mode 100644 index 72cd3babdbb..00000000000 --- a/tests/ServiceStack.Mvc.Stubs.Tests/ExternalController.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Web.Mvc; - -namespace ServiceStack.Mvc.Stubs.Tests -{ - public class ExternalController : Controller - { - // consumed by ServiceStack.Mvc.Tests to test discovery of IController types in external assemblies - // see https://github.com/ServiceStack/ServiceStack/issues/599 - } -} diff --git a/tests/ServiceStack.Mvc.Stubs.Tests/Properties/AssemblyInfo.cs b/tests/ServiceStack.Mvc.Stubs.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 6d51bc62df8..00000000000 --- a/tests/ServiceStack.Mvc.Stubs.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ServiceStack.Mvc.Stubs.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ServiceStack.Mvc.Stubs.Tests")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1363aecf-4bd5-4935-8976-0094c27f1e09")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tests/ServiceStack.Mvc.Stubs.Tests/ServiceStack.Mvc.Stubs.Tests.csproj b/tests/ServiceStack.Mvc.Stubs.Tests/ServiceStack.Mvc.Stubs.Tests.csproj deleted file mode 100644 index bb0584fd6d5..00000000000 --- a/tests/ServiceStack.Mvc.Stubs.Tests/ServiceStack.Mvc.Stubs.Tests.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Debug - AnyCPU - {60E9BDF4-38C8-4EEC-AB69-7128C6A35601} - Library - Properties - ServiceStack.Mvc.Stubs.Tests - ServiceStack.Mvc.Stubs.Tests - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - False - ..\..\lib\System.Web.Mvc.dll - - - - - - - - - - - - - - {680a1709-25eb-4d52-a87f-ee03ffd94baa} - ServiceStack - - - - - \ No newline at end of file diff --git a/tests/ServiceStack.Mvc.Tests/FunqControllerFactoryTests.cs b/tests/ServiceStack.Mvc.Tests/FunqControllerFactoryTests.cs deleted file mode 100644 index 6cad214d5ea..00000000000 --- a/tests/ServiceStack.Mvc.Tests/FunqControllerFactoryTests.cs +++ /dev/null @@ -1,35 +0,0 @@ -using NUnit.Framework; -using Funq; -using ServiceStack.Mvc.Stubs.Tests; -using ServiceStack.Mvc.Tests.Stubs; - -namespace ServiceStack.Mvc.Tests -{ - [TestFixture] - public class FunqControllerFactoryTests - { - [Test] - public void ConstructFactoryPopulatesLocalControllerByDefault() - { - var container = new Container(); - var factory = new FunqControllerFactory(container); - var testController = container.Resolve(); - Assert.That(testController, Is.Not.Null); - } - - [Test] - public void ConstructFactoryPopulatesLocalControllerAndExternalControllerByDefault() - { - var container = new Container(); - var factory = new FunqControllerFactory(container, typeof(ExternalController).Assembly); - - // test we can still resolve the local one (by default) - var testController = container.Resolve(); - Assert.That(testController, Is.Not.Null); - - // test we can resolve the external controller (via params assembly) - var externalController = container.Resolve(); - Assert.That(externalController, Is.Not.Null); - } - } -} diff --git a/tests/ServiceStack.Mvc.Tests/Properties/AssemblyInfo.cs b/tests/ServiceStack.Mvc.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 0956bb84c58..00000000000 --- a/tests/ServiceStack.Mvc.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ServiceStack.Mvc.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ServiceStack.Mvc.Tests")] -[assembly: AssemblyCopyright("Copyright (c) 2013")] -[assembly: AssemblyTrademark("Service Stack")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("3c84c5a1-e573-4c12-b8f6-a3512b25bab4")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] diff --git a/tests/ServiceStack.Mvc.Tests/ServiceStack.Mvc.Tests.csproj b/tests/ServiceStack.Mvc.Tests/ServiceStack.Mvc.Tests.csproj deleted file mode 100644 index 48957e1cf2e..00000000000 --- a/tests/ServiceStack.Mvc.Tests/ServiceStack.Mvc.Tests.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - - Debug - AnyCPU - {F89B1845-5B1E-4EF2-873F-5FFDBF56E365} - Library - Properties - ServiceStack.Mvc.Tests - ServiceStack.Mvc.Tests - v4.0 - 512 - - ..\..\src\ - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - bin\Signed\ - TRACE - true - pdbonly - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - - False - ..\..\src\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - False - ..\..\lib\ServiceStack.Interfaces.dll - - - ..\..\lib\tests\ServiceStack.Mvc.Stubs.Tests.dll - - - - - - False - ..\..\lib\System.Web.Mvc.dll - - - - - - - - - - - - - - - {672f2dfe-4ee8-498b-b449-23e9e7f6961c} - ServiceStack.Mvc - - - {680a1709-25eb-4d52-a87f-ee03ffd94baa} - ServiceStack - - - - - - - - - \ No newline at end of file diff --git a/tests/ServiceStack.Mvc.Tests/Stubs/LocalController.cs b/tests/ServiceStack.Mvc.Tests/Stubs/LocalController.cs deleted file mode 100644 index 3e842dfb775..00000000000 --- a/tests/ServiceStack.Mvc.Tests/Stubs/LocalController.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Web.Mvc; - -namespace ServiceStack.Mvc.Tests.Stubs -{ - public class LocalController : Controller - { - } -} \ No newline at end of file diff --git a/tests/ServiceStack.Mvc.Tests/packages.config b/tests/ServiceStack.Mvc.Tests/packages.config deleted file mode 100644 index 967502dc812..00000000000 --- a/tests/ServiceStack.Mvc.Tests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/tests/ServiceStack.OpenApi.Tests/AllTypesTests.cs b/tests/ServiceStack.OpenApi.Tests/AllTypesTests.cs new file mode 100644 index 00000000000..abe265ad26e --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/AllTypesTests.cs @@ -0,0 +1,94 @@ +using AutorestClient; +using AutorestClient.Models; +using NUnit.Framework; +using ServiceStack.OpenApi.Tests.Host; +using System; +using System.Threading; + +namespace ServiceStack.OpenApi.Tests +{ + [TestFixture] + class AllTypesTests : GeneratedClientTestBase + { + [Ignore("Debug Test"), Test] + public void Sleep() + { + Thread.Sleep(1000000); + } + + + [Test] + public void Can_post_all_types() + { + var dto = new HelloAllTypes + { + Name = "Hello", + AllTypes = DtoHelper.GetAllTypes(), + AllCollectionTypes = DtoHelper.GetAllCollectionTypes() + }; + + using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri))) + { + var result = client.HelloAllTypes.Post("123", null, null, dto); + } + } + + [Test] + public void Can_get_all_types() + { + var dto = new HelloAllTypes + { + Name = "Hello", + AllTypes = DtoHelper.GetAllTypes(), + AllCollectionTypes = DtoHelper.GetAllCollectionTypes() + }; + + using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri))) + { + var result = client.HelloAllTypes.Get("123", dto.AllTypes.ToJsv(), null); + } + } + + [Test] + public void Can_get_all_types_with_result() + { + var dto = new HelloAllTypesWithResult + { + Name = "Hello", + AllTypes = DtoHelper.GetAllTypes(), + AllCollectionTypes = DtoHelper.GetAllCollectionTypes() + }; + + using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri))) + { + var at = dto.AllTypes.ToJsv(); + + var result = client.HelloAllTypesWithResult.Get(dto.Name, dto.AllTypes.ToJsv(), dto.AllCollectionTypes.ToJsv()); + + Assert.That(result.Result, Is.EqualTo(dto.Name)); + DtoHelper.AssertAllTypes(result.AllTypes, dto.AllTypes); + DtoHelper.AssertAllCollectionTypes(result.AllCollectionTypes, dto.AllCollectionTypes); + } + } + + [Test] + public void Can_post_all_types_with_result() + { + var dto = new HelloAllTypesWithResult + { + Name = "Hello", + AllTypes = DtoHelper.GetAllTypes(), + AllCollectionTypes = DtoHelper.GetAllCollectionTypes() + }; + + using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri))) + { + var result = client.HelloAllTypesWithResult.Post(body: dto); + + Assert.That(result.Result, Is.EqualTo(dto.Name)); + DtoHelper.AssertAllTypes(result.AllTypes, dto.AllTypes); + DtoHelper.AssertAllCollectionTypes(result.AllCollectionTypes, dto.AllCollectionTypes); + } + } + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/AnnotatedPropertiesTests.cs b/tests/ServiceStack.OpenApi.Tests/AnnotatedPropertiesTests.cs new file mode 100644 index 00000000000..2d0ffb7dabc --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/AnnotatedPropertiesTests.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Remoting; +using System.Text; +using System.Threading.Tasks; +using AutorestClient; +using NUnit.Framework; +using ServiceStack.OpenApi.Tests.Host; +using ServiceStack.OpenApi.Tests.Services; + +namespace ServiceStack.OpenApi.Tests +{ + [TestFixture] + class AnnotatedPropertiesTests : GeneratedClientTestBase + { + [Test] + public void Can_get_annotated_service_with_array_enum() + { + var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri)); + + var dto = new GetMovie(){Id = 1, Includes = new[] {"Genres", "Releases" } }; + + var result = client.GetMovieId.Post(dto.Id, dto.Includes); + + Assert.That(result.Includes, Is.EquivalentTo(dto.Includes)); + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/App.config b/tests/ServiceStack.OpenApi.Tests/App.config new file mode 100644 index 00000000000..8f5920aa3e9 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/App.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/ServiceStack.OpenApi.Tests/DtoHelper.cs b/tests/ServiceStack.OpenApi.Tests/DtoHelper.cs new file mode 100644 index 00000000000..04c41351949 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/DtoHelper.cs @@ -0,0 +1,159 @@ +using AutorestClient.Models; +using NUnit.Framework; +using System; +using System.Collections.Generic; + +namespace ServiceStack.OpenApi.Tests +{ + class DtoHelper + { + public static AllTypes GetAllTypes() + { + return new AllTypes + { + ByteProperty = byte.MaxValue, + CharProperty = "n", + DateTimeProperty = DateTime.UtcNow, + DecimalProperty = 100.123456789, + DateTimeOffsetProperty = new DateTimeOffset(DateTime.UtcNow.AddDays(1)).ToString(), + DoubleProperty = 123.45678901, + FloatProperty = 456.312f, + GuidProperty = Guid.NewGuid().ToString(), + Id = 1, + IntProperty = int.MaxValue, + IntStringMap = new Dictionary { { "1", "abc" }, { "2", "bcd" }, { "3", "cde" } }, + KeyValuePairProperty = new KeyValuePairStringString("key1", "value1"), + LongProperty = long.MaxValue, + NullableDateTime = DateTime.UtcNow, + NullableId = 2, + NullableTimeSpan = new TimeSpan(1, 0, 0).ToString(), + TimeSpanProperty = new TimeSpan(2, 1, 3).ToString(), + ShortProperty = short.MaxValue, + StringProperty = "test string", + StringArray = new string[] { "string1", "string2", "string3" }, + StringList = new List() { "string4", "string5", "string6" }, + StringMap = new Dictionary() { { "ab", "abc" }, { "bc", "bcd" }, { "cd", "cde" } }, + SubType = new SubType() { Id = 10, Name = "SubType name" }, + UIntProperty = 123456, + ULongProperty = 1234567, + UShortProperty = UInt16.MaxValue, + }; + } + + public static AllCollectionTypes GetAllCollectionTypes() + { + return new AllCollectionTypes + { + IntArray = new[] { 1, 2, 3, 4 }, + IntList = new List{ 1, 2, 3, 4 }, + PocoArray = new[] { new Poco{ Name = "poco1" }, new Poco{ Name = "poco2" } }, + PocoList = new List{ new Poco{ Name = "poco1" }, new Poco{ Name = "poco2" } }, + PocoLookup = new Dictionary> + { + { "p1", new List{ new Poco{ Name = "poco1" }, new Poco{ Name = "poco2" } }}, + { "p2", new List{ new Poco{ Name = "poco3" }, new Poco{ Name = "poco4" } }} + }, + PocoLookupMap = new Dictionary>>() + { + { "pp1", new List> + { + new Dictionary{ + { "p11", new Poco{ Name = "poco1" } }, + { "p12", new Poco{ Name = "poco2" } } + }, + new Dictionary{ + { "p13", new Poco{ Name = "poco3" } }, + { "p14", new Poco{ Name = "poco4" } } + } + } + }, + { "pp2", new List>() + { + new Dictionary{ + { "p21", new Poco{ Name = "poco1" } }, + { "p22", new Poco{ Name = "poco2" } } + }, + new Dictionary{ + { "p23", new Poco{ Name = "poco3" } }, + { "p24", new Poco{ Name = "poco4" } } + } + } + } + }, + StringArray = new string[] { "string1", "string2" }, + StringList = new List{ "string1", "string2" } + }; + } + + public static void AssertAllTypes(AllTypes actual, AllTypes expected) + { + Assert.That(actual.ByteProperty, Is.EqualTo(expected.ByteProperty)); + Assert.That(actual.CharProperty, Is.EqualTo(expected.CharProperty)); + Assert.That(actual.DateTimeProperty, Is.EqualTo(expected.DateTimeProperty).Within(TimeSpan.FromSeconds(1))); + //Assert.That(actual.DateTimeOffset, Is.EqualTo(expected.DateTimeOffset)); + Assert.That(actual.DecimalProperty, Is.EqualTo(expected.DecimalProperty)); + Assert.That(actual.DoubleProperty, Is.EqualTo(expected.DoubleProperty)); + Assert.That(actual.FloatProperty, Is.EqualTo(expected.FloatProperty).Within(0.0001)); + Assert.That(actual.GuidProperty, Is.EqualTo(expected.GuidProperty.Replace("-", String.Empty))); + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.IntProperty, Is.EqualTo(expected.IntProperty)); + Assert.That(actual.IntStringMap, Is.EquivalentTo(expected.IntStringMap)); + Assert.That(actual.KeyValuePairProperty.Key, Is.EquivalentTo(expected.KeyValuePairProperty.Key)); + Assert.That(actual.KeyValuePairProperty.Value, Is.EquivalentTo(expected.KeyValuePairProperty.Value)); + Assert.That(actual.LongProperty, Is.EqualTo(expected.LongProperty)); + Assert.That(actual.NullableDateTime, Is.EqualTo(expected.NullableDateTime).Within(TimeSpan.FromSeconds(1))); + Assert.That(actual.NullableId, Is.EqualTo(expected.NullableId)); + //Assert.That(actual.NullableTimeSpan, Is.EqualTo(expected.NullableTimeSpan)); + Assert.That(actual.ShortProperty, Is.EqualTo(expected.ShortProperty)); + Assert.That(actual.StringArray, Is.EquivalentTo(expected.StringArray)); + Assert.That(actual.StringList, Is.EquivalentTo(expected.StringList)); + Assert.That(actual.StringMap, Is.EquivalentTo(expected.StringMap)); + Assert.That(actual.StringProperty, Is.EqualTo(expected.StringProperty)); + Assert.That(actual.SubType.Id, Is.EqualTo(expected.SubType.Id)); + Assert.That(actual.SubType.Name, Is.EqualTo(expected.SubType.Name)); + //Assert.That(actual.TimeSpan, Is.EqualTo(expected.TimeSpan)); + Assert.That(actual.UIntProperty, Is.EqualTo(expected.UIntProperty)); + Assert.That(actual.ULongProperty, Is.EqualTo(expected.ULongProperty)); + Assert.That(actual.UShortProperty, Is.EqualTo(expected.UShortProperty)); + } + + public static void AssertAllCollectionTypes(AllCollectionTypes actual, AllCollectionTypes expected) + { + Assert.That(actual.IntArray, Is.EqualTo(expected.IntArray)); + Assert.That(actual.IntList, Is.EqualTo(expected.IntList)); + AssertListPoco(actual.PocoArray, expected.PocoArray); + AssertListPoco(actual.PocoList, expected.PocoList); + + Assert.That(actual.PocoLookup.Count, Is.EqualTo(expected.PocoLookup.Count)); + foreach (var key in actual.PocoLookup.Keys) + AssertListPoco(actual.PocoLookup[key], expected.PocoLookup[key]); + + Assert.That(actual.PocoLookupMap.Count, Is.EqualTo(expected.PocoLookupMap.Count)); + + foreach(var key in actual.PocoLookupMap.Keys) + { + var actualList = actual.PocoLookupMap[key]; + var expectedList = expected.PocoLookupMap[key]; + + Assert.That(actualList.Count, Is.EqualTo(expectedList.Count)); + for(int i = 0; i < actualList.Count; i++) + { + Assert.That(actualList[i].Count, Is.EqualTo(expectedList[i].Count)); + + foreach (var key2 in actualList[i].Keys) + { + Assert.That(actualList[i][key2].Name, Is.EqualTo(expectedList[i][key2].Name)); + } + } + } + } + + public static void AssertListPoco(IList actual, IList expected) + { + Assert.That(actual.Count, Is.EqualTo(expected.Count)); + + for (int i = 0; i < actual.Count; i++) + Assert.That(actual[i].Name, Is.EqualTo(expected[i].Name)); + } + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AllowedAttributesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AllowedAttributesOperations.cs new file mode 100644 index 00000000000..19d8f171af4 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AllowedAttributesOperations.cs @@ -0,0 +1,173 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AllowedAttributesOperations operations. + /// + public partial class AllowedAttributesOperations : IServiceOperations, IAllowedAttributesOperations + { + /// + /// Initializes a new instance of the AllowedAttributesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public AllowedAttributesOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// AllowedAttributes Description + /// + /// + /// AllowedAttributes Description + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task GetWithHttpMessagesAsync(int aliased, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("aliased", aliased); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "allowed-attributes").ToString(); + List _queryParameters = new List(); + _queryParameters.Add(string.Format("Aliased={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(aliased, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 400) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AllowedAttributesOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AllowedAttributesOperationsExtensions.cs new file mode 100644 index 00000000000..9fe1cc331e4 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AllowedAttributesOperationsExtensions.cs @@ -0,0 +1,52 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AllowedAttributesOperations. + /// + public static partial class AllowedAttributesOperationsExtensions + { + /// + /// AllowedAttributes Description + /// + /// + /// AllowedAttributes Description + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static void Get(this IAllowedAttributesOperations operations, int aliased) + { + operations.GetAsync(aliased).GetAwaiter().GetResult(); + } + + /// + /// AllowedAttributes Description + /// + /// + /// AllowedAttributes Description + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAllowedAttributesOperations operations, int aliased, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.GetWithHttpMessagesAsync(aliased, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AssignRolesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AssignRolesOperations.cs new file mode 100644 index 00000000000..d43c5839ff4 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AssignRolesOperations.cs @@ -0,0 +1,635 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AssignRolesOperations operations. + /// + public partial class AssignRolesOperations : IServiceOperations, IAssignRolesOperations + { + /// + /// Initializes a new instance of the AssignRolesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public AssignRolesOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("userName", userName); + tracingParameters.Add("permissions", permissions); + tracingParameters.Add("roles", roles); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "assignroles").ToString(); + List _queryParameters = new List(); + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (permissions != null) + { + _queryParameters.Add(string.Format("Permissions={0}", System.Uri.EscapeDataString(permissions))); + } + if (roles != null) + { + _queryParameters.Add(string.Format("Roles={0}", System.Uri.EscapeDataString(roles))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AssignRolesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AssignRolesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), AssignRoles body = default(AssignRoles), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("userName", userName); + tracingParameters.Add("permissions", permissions); + tracingParameters.Add("roles", roles); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "assignroles").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AssignRolesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AssignRolesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), AssignRoles body = default(AssignRoles), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("userName", userName); + tracingParameters.Add("permissions", permissions); + tracingParameters.Add("roles", roles); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "assignroles").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AssignRolesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AssignRolesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("userName", userName); + tracingParameters.Add("permissions", permissions); + tracingParameters.Add("roles", roles); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "assignroles").ToString(); + List _queryParameters = new List(); + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (permissions != null) + { + _queryParameters.Add(string.Format("Permissions={0}", System.Uri.EscapeDataString(permissions))); + } + if (roles != null) + { + _queryParameters.Add(string.Format("Roles={0}", System.Uri.EscapeDataString(roles))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AssignRolesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AssignRolesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AssignRolesOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AssignRolesOperationsExtensions.cs new file mode 100644 index 00000000000..adfece8ce1d --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AssignRolesOperationsExtensions.cs @@ -0,0 +1,161 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AssignRolesOperations. + /// + public static partial class AssignRolesOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static AssignRolesResponse Get(this IAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string)) + { + return operations.GetAsync(userName, permissions, roles).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(userName, permissions, roles, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AssignRolesResponse Create(this IAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), AssignRoles body = default(AssignRoles)) + { + return operations.CreateAsync(userName, permissions, roles, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), AssignRoles body = default(AssignRoles), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(userName, permissions, roles, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AssignRolesResponse Post(this IAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), AssignRoles body = default(AssignRoles)) + { + return operations.PostAsync(userName, permissions, roles, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), AssignRoles body = default(AssignRoles), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(userName, permissions, roles, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static AssignRolesResponse Delete(this IAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string)) + { + return operations.DeleteAsync(userName, permissions, roles).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(userName, permissions, roles, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticate2.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticate2.cs new file mode 100644 index 00000000000..91a7f64b581 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticate2.cs @@ -0,0 +1,935 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Authenticate2 operations. + /// + public partial class Authenticate2 : IServiceOperations, IAuthenticate2 + { + /// + /// Initializes a new instance of the Authenticate2 class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Authenticate2(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "authenticate").ToString(); + List _queryParameters = new List(); + if (provider != null) + { + _queryParameters.Add(string.Format("provider={0}", System.Uri.EscapeDataString(provider))); + } + if (state != null) + { + _queryParameters.Add(string.Format("State={0}", System.Uri.EscapeDataString(state))); + } + if (oauthToken != null) + { + _queryParameters.Add(string.Format("oauth_token={0}", System.Uri.EscapeDataString(oauthToken))); + } + if (oauthVerifier != null) + { + _queryParameters.Add(string.Format("oauth_verifier={0}", System.Uri.EscapeDataString(oauthVerifier))); + } + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (password != null) + { + _queryParameters.Add(string.Format("Password={0}", System.Uri.EscapeDataString(password))); + } + if (rememberMe != null) + { + _queryParameters.Add(string.Format("RememberMe={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(rememberMe, Client.SerializationSettings).Trim('"')))); + } + if (continueParameter != null) + { + _queryParameters.Add(string.Format("Continue={0}", System.Uri.EscapeDataString(continueParameter))); + } + if (nonce != null) + { + _queryParameters.Add(string.Format("nonce={0}", System.Uri.EscapeDataString(nonce))); + } + if (uri != null) + { + _queryParameters.Add(string.Format("uri={0}", System.Uri.EscapeDataString(uri))); + } + if (response != null) + { + _queryParameters.Add(string.Format("response={0}", System.Uri.EscapeDataString(response))); + } + if (qop != null) + { + _queryParameters.Add(string.Format("qop={0}", System.Uri.EscapeDataString(qop))); + } + if (nc != null) + { + _queryParameters.Add(string.Format("nc={0}", System.Uri.EscapeDataString(nc))); + } + if (cnonce != null) + { + _queryParameters.Add(string.Format("cnonce={0}", System.Uri.EscapeDataString(cnonce))); + } + if (useTokenCookie != null) + { + _queryParameters.Add(string.Format("UseTokenCookie={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(useTokenCookie, Client.SerializationSettings).Trim('"')))); + } + if (accessToken != null) + { + _queryParameters.Add(string.Format("AccessToken={0}", System.Uri.EscapeDataString(accessToken))); + } + if (accessTokenSecret != null) + { + _queryParameters.Add(string.Format("AccessTokenSecret={0}", System.Uri.EscapeDataString(accessTokenSecret))); + } + if (meta != null) + { + _queryParameters.Add(string.Format("Meta={0}", System.Uri.EscapeDataString(meta))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "authenticate").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "authenticate").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "authenticate").ToString(); + List _queryParameters = new List(); + if (provider != null) + { + _queryParameters.Add(string.Format("provider={0}", System.Uri.EscapeDataString(provider))); + } + if (state != null) + { + _queryParameters.Add(string.Format("State={0}", System.Uri.EscapeDataString(state))); + } + if (oauthToken != null) + { + _queryParameters.Add(string.Format("oauth_token={0}", System.Uri.EscapeDataString(oauthToken))); + } + if (oauthVerifier != null) + { + _queryParameters.Add(string.Format("oauth_verifier={0}", System.Uri.EscapeDataString(oauthVerifier))); + } + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (password != null) + { + _queryParameters.Add(string.Format("Password={0}", System.Uri.EscapeDataString(password))); + } + if (rememberMe != null) + { + _queryParameters.Add(string.Format("RememberMe={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(rememberMe, Client.SerializationSettings).Trim('"')))); + } + if (continueParameter != null) + { + _queryParameters.Add(string.Format("Continue={0}", System.Uri.EscapeDataString(continueParameter))); + } + if (nonce != null) + { + _queryParameters.Add(string.Format("nonce={0}", System.Uri.EscapeDataString(nonce))); + } + if (uri != null) + { + _queryParameters.Add(string.Format("uri={0}", System.Uri.EscapeDataString(uri))); + } + if (response != null) + { + _queryParameters.Add(string.Format("response={0}", System.Uri.EscapeDataString(response))); + } + if (qop != null) + { + _queryParameters.Add(string.Format("qop={0}", System.Uri.EscapeDataString(qop))); + } + if (nc != null) + { + _queryParameters.Add(string.Format("nc={0}", System.Uri.EscapeDataString(nc))); + } + if (cnonce != null) + { + _queryParameters.Add(string.Format("cnonce={0}", System.Uri.EscapeDataString(cnonce))); + } + if (useTokenCookie != null) + { + _queryParameters.Add(string.Format("UseTokenCookie={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(useTokenCookie, Client.SerializationSettings).Trim('"')))); + } + if (accessToken != null) + { + _queryParameters.Add(string.Format("AccessToken={0}", System.Uri.EscapeDataString(accessToken))); + } + if (accessTokenSecret != null) + { + _queryParameters.Add(string.Format("AccessTokenSecret={0}", System.Uri.EscapeDataString(accessTokenSecret))); + } + if (meta != null) + { + _queryParameters.Add(string.Format("Meta={0}", System.Uri.EscapeDataString(meta))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticate2Extensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticate2Extensions.cs new file mode 100644 index 00000000000..3fb06baa85e --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticate2Extensions.cs @@ -0,0 +1,401 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Authenticate2. + /// + public static partial class Authenticate2Extensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Get(this IAuthenticate2 operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string)) + { + return operations.GetAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAuthenticate2 operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Create(this IAuthenticate2 operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate)) + { + return operations.CreateAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAuthenticate2 operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Post(this IAuthenticate2 operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate)) + { + return operations.PostAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IAuthenticate2 operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Delete(this IAuthenticate2 operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string)) + { + return operations.DeleteAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAuthenticate2 operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AuthenticateOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AuthenticateOperations.cs new file mode 100644 index 00000000000..2b1ec3d08c0 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AuthenticateOperations.cs @@ -0,0 +1,935 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AuthenticateOperations operations. + /// + public partial class AuthenticateOperations : IServiceOperations, IAuthenticateOperations + { + /// + /// Initializes a new instance of the AuthenticateOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public AuthenticateOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "auth").ToString(); + List _queryParameters = new List(); + if (provider != null) + { + _queryParameters.Add(string.Format("provider={0}", System.Uri.EscapeDataString(provider))); + } + if (state != null) + { + _queryParameters.Add(string.Format("State={0}", System.Uri.EscapeDataString(state))); + } + if (oauthToken != null) + { + _queryParameters.Add(string.Format("oauth_token={0}", System.Uri.EscapeDataString(oauthToken))); + } + if (oauthVerifier != null) + { + _queryParameters.Add(string.Format("oauth_verifier={0}", System.Uri.EscapeDataString(oauthVerifier))); + } + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (password != null) + { + _queryParameters.Add(string.Format("Password={0}", System.Uri.EscapeDataString(password))); + } + if (rememberMe != null) + { + _queryParameters.Add(string.Format("RememberMe={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(rememberMe, Client.SerializationSettings).Trim('"')))); + } + if (continueParameter != null) + { + _queryParameters.Add(string.Format("Continue={0}", System.Uri.EscapeDataString(continueParameter))); + } + if (nonce != null) + { + _queryParameters.Add(string.Format("nonce={0}", System.Uri.EscapeDataString(nonce))); + } + if (uri != null) + { + _queryParameters.Add(string.Format("uri={0}", System.Uri.EscapeDataString(uri))); + } + if (response != null) + { + _queryParameters.Add(string.Format("response={0}", System.Uri.EscapeDataString(response))); + } + if (qop != null) + { + _queryParameters.Add(string.Format("qop={0}", System.Uri.EscapeDataString(qop))); + } + if (nc != null) + { + _queryParameters.Add(string.Format("nc={0}", System.Uri.EscapeDataString(nc))); + } + if (cnonce != null) + { + _queryParameters.Add(string.Format("cnonce={0}", System.Uri.EscapeDataString(cnonce))); + } + if (useTokenCookie != null) + { + _queryParameters.Add(string.Format("UseTokenCookie={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(useTokenCookie, Client.SerializationSettings).Trim('"')))); + } + if (accessToken != null) + { + _queryParameters.Add(string.Format("AccessToken={0}", System.Uri.EscapeDataString(accessToken))); + } + if (accessTokenSecret != null) + { + _queryParameters.Add(string.Format("AccessTokenSecret={0}", System.Uri.EscapeDataString(accessTokenSecret))); + } + if (meta != null) + { + _queryParameters.Add(string.Format("Meta={0}", System.Uri.EscapeDataString(meta))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "auth").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "auth").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "auth").ToString(); + List _queryParameters = new List(); + if (provider != null) + { + _queryParameters.Add(string.Format("provider={0}", System.Uri.EscapeDataString(provider))); + } + if (state != null) + { + _queryParameters.Add(string.Format("State={0}", System.Uri.EscapeDataString(state))); + } + if (oauthToken != null) + { + _queryParameters.Add(string.Format("oauth_token={0}", System.Uri.EscapeDataString(oauthToken))); + } + if (oauthVerifier != null) + { + _queryParameters.Add(string.Format("oauth_verifier={0}", System.Uri.EscapeDataString(oauthVerifier))); + } + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (password != null) + { + _queryParameters.Add(string.Format("Password={0}", System.Uri.EscapeDataString(password))); + } + if (rememberMe != null) + { + _queryParameters.Add(string.Format("RememberMe={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(rememberMe, Client.SerializationSettings).Trim('"')))); + } + if (continueParameter != null) + { + _queryParameters.Add(string.Format("Continue={0}", System.Uri.EscapeDataString(continueParameter))); + } + if (nonce != null) + { + _queryParameters.Add(string.Format("nonce={0}", System.Uri.EscapeDataString(nonce))); + } + if (uri != null) + { + _queryParameters.Add(string.Format("uri={0}", System.Uri.EscapeDataString(uri))); + } + if (response != null) + { + _queryParameters.Add(string.Format("response={0}", System.Uri.EscapeDataString(response))); + } + if (qop != null) + { + _queryParameters.Add(string.Format("qop={0}", System.Uri.EscapeDataString(qop))); + } + if (nc != null) + { + _queryParameters.Add(string.Format("nc={0}", System.Uri.EscapeDataString(nc))); + } + if (cnonce != null) + { + _queryParameters.Add(string.Format("cnonce={0}", System.Uri.EscapeDataString(cnonce))); + } + if (useTokenCookie != null) + { + _queryParameters.Add(string.Format("UseTokenCookie={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(useTokenCookie, Client.SerializationSettings).Trim('"')))); + } + if (accessToken != null) + { + _queryParameters.Add(string.Format("AccessToken={0}", System.Uri.EscapeDataString(accessToken))); + } + if (accessTokenSecret != null) + { + _queryParameters.Add(string.Format("AccessTokenSecret={0}", System.Uri.EscapeDataString(accessTokenSecret))); + } + if (meta != null) + { + _queryParameters.Add(string.Format("Meta={0}", System.Uri.EscapeDataString(meta))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AuthenticateOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AuthenticateOperationsExtensions.cs new file mode 100644 index 00000000000..2a9c648b044 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AuthenticateOperationsExtensions.cs @@ -0,0 +1,401 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AuthenticateOperations. + /// + public static partial class AuthenticateOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Get(this IAuthenticateOperations operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string)) + { + return operations.GetAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAuthenticateOperations operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Create(this IAuthenticateOperations operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate)) + { + return operations.CreateAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAuthenticateOperations operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Post(this IAuthenticateOperations operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate)) + { + return operations.PostAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IAuthenticateOperations operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Delete(this IAuthenticateOperations operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string)) + { + return operations.DeleteAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAuthenticateOperations operations, string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticateprovider.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticateprovider.cs new file mode 100644 index 00000000000..daa7526331f --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticateprovider.cs @@ -0,0 +1,971 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Authenticateprovider operations. + /// + public partial class Authenticateprovider : IServiceOperations, IAuthenticateprovider + { + /// + /// Initializes a new instance of the Authenticateprovider class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Authenticateprovider(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provider"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "auth/{provider}").ToString(); + _url = _url.Replace("{provider}", System.Uri.EscapeDataString(provider)); + List _queryParameters = new List(); + if (state != null) + { + _queryParameters.Add(string.Format("State={0}", System.Uri.EscapeDataString(state))); + } + if (oauthToken != null) + { + _queryParameters.Add(string.Format("oauth_token={0}", System.Uri.EscapeDataString(oauthToken))); + } + if (oauthVerifier != null) + { + _queryParameters.Add(string.Format("oauth_verifier={0}", System.Uri.EscapeDataString(oauthVerifier))); + } + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (password != null) + { + _queryParameters.Add(string.Format("Password={0}", System.Uri.EscapeDataString(password))); + } + if (rememberMe != null) + { + _queryParameters.Add(string.Format("RememberMe={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(rememberMe, Client.SerializationSettings).Trim('"')))); + } + if (continueParameter != null) + { + _queryParameters.Add(string.Format("Continue={0}", System.Uri.EscapeDataString(continueParameter))); + } + if (nonce != null) + { + _queryParameters.Add(string.Format("nonce={0}", System.Uri.EscapeDataString(nonce))); + } + if (uri != null) + { + _queryParameters.Add(string.Format("uri={0}", System.Uri.EscapeDataString(uri))); + } + if (response != null) + { + _queryParameters.Add(string.Format("response={0}", System.Uri.EscapeDataString(response))); + } + if (qop != null) + { + _queryParameters.Add(string.Format("qop={0}", System.Uri.EscapeDataString(qop))); + } + if (nc != null) + { + _queryParameters.Add(string.Format("nc={0}", System.Uri.EscapeDataString(nc))); + } + if (cnonce != null) + { + _queryParameters.Add(string.Format("cnonce={0}", System.Uri.EscapeDataString(cnonce))); + } + if (useTokenCookie != null) + { + _queryParameters.Add(string.Format("UseTokenCookie={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(useTokenCookie, Client.SerializationSettings).Trim('"')))); + } + if (accessToken != null) + { + _queryParameters.Add(string.Format("AccessToken={0}", System.Uri.EscapeDataString(accessToken))); + } + if (accessTokenSecret != null) + { + _queryParameters.Add(string.Format("AccessTokenSecret={0}", System.Uri.EscapeDataString(accessTokenSecret))); + } + if (meta != null) + { + _queryParameters.Add(string.Format("Meta={0}", System.Uri.EscapeDataString(meta))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provider"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "auth/{provider}").ToString(); + _url = _url.Replace("{provider}", System.Uri.EscapeDataString(provider)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provider"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "auth/{provider}").ToString(); + _url = _url.Replace("{provider}", System.Uri.EscapeDataString(provider)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provider"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "auth/{provider}").ToString(); + _url = _url.Replace("{provider}", System.Uri.EscapeDataString(provider)); + List _queryParameters = new List(); + if (state != null) + { + _queryParameters.Add(string.Format("State={0}", System.Uri.EscapeDataString(state))); + } + if (oauthToken != null) + { + _queryParameters.Add(string.Format("oauth_token={0}", System.Uri.EscapeDataString(oauthToken))); + } + if (oauthVerifier != null) + { + _queryParameters.Add(string.Format("oauth_verifier={0}", System.Uri.EscapeDataString(oauthVerifier))); + } + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (password != null) + { + _queryParameters.Add(string.Format("Password={0}", System.Uri.EscapeDataString(password))); + } + if (rememberMe != null) + { + _queryParameters.Add(string.Format("RememberMe={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(rememberMe, Client.SerializationSettings).Trim('"')))); + } + if (continueParameter != null) + { + _queryParameters.Add(string.Format("Continue={0}", System.Uri.EscapeDataString(continueParameter))); + } + if (nonce != null) + { + _queryParameters.Add(string.Format("nonce={0}", System.Uri.EscapeDataString(nonce))); + } + if (uri != null) + { + _queryParameters.Add(string.Format("uri={0}", System.Uri.EscapeDataString(uri))); + } + if (response != null) + { + _queryParameters.Add(string.Format("response={0}", System.Uri.EscapeDataString(response))); + } + if (qop != null) + { + _queryParameters.Add(string.Format("qop={0}", System.Uri.EscapeDataString(qop))); + } + if (nc != null) + { + _queryParameters.Add(string.Format("nc={0}", System.Uri.EscapeDataString(nc))); + } + if (cnonce != null) + { + _queryParameters.Add(string.Format("cnonce={0}", System.Uri.EscapeDataString(cnonce))); + } + if (useTokenCookie != null) + { + _queryParameters.Add(string.Format("UseTokenCookie={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(useTokenCookie, Client.SerializationSettings).Trim('"')))); + } + if (accessToken != null) + { + _queryParameters.Add(string.Format("AccessToken={0}", System.Uri.EscapeDataString(accessToken))); + } + if (accessTokenSecret != null) + { + _queryParameters.Add(string.Format("AccessTokenSecret={0}", System.Uri.EscapeDataString(accessTokenSecret))); + } + if (meta != null) + { + _queryParameters.Add(string.Format("Meta={0}", System.Uri.EscapeDataString(meta))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticateprovider2.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticateprovider2.cs new file mode 100644 index 00000000000..6a204960d46 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticateprovider2.cs @@ -0,0 +1,971 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Authenticateprovider2 operations. + /// + public partial class Authenticateprovider2 : IServiceOperations, IAuthenticateprovider2 + { + /// + /// Initializes a new instance of the Authenticateprovider2 class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Authenticateprovider2(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provider"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "authenticate/{provider}").ToString(); + _url = _url.Replace("{provider}", System.Uri.EscapeDataString(provider)); + List _queryParameters = new List(); + if (state != null) + { + _queryParameters.Add(string.Format("State={0}", System.Uri.EscapeDataString(state))); + } + if (oauthToken != null) + { + _queryParameters.Add(string.Format("oauth_token={0}", System.Uri.EscapeDataString(oauthToken))); + } + if (oauthVerifier != null) + { + _queryParameters.Add(string.Format("oauth_verifier={0}", System.Uri.EscapeDataString(oauthVerifier))); + } + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (password != null) + { + _queryParameters.Add(string.Format("Password={0}", System.Uri.EscapeDataString(password))); + } + if (rememberMe != null) + { + _queryParameters.Add(string.Format("RememberMe={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(rememberMe, Client.SerializationSettings).Trim('"')))); + } + if (continueParameter != null) + { + _queryParameters.Add(string.Format("Continue={0}", System.Uri.EscapeDataString(continueParameter))); + } + if (nonce != null) + { + _queryParameters.Add(string.Format("nonce={0}", System.Uri.EscapeDataString(nonce))); + } + if (uri != null) + { + _queryParameters.Add(string.Format("uri={0}", System.Uri.EscapeDataString(uri))); + } + if (response != null) + { + _queryParameters.Add(string.Format("response={0}", System.Uri.EscapeDataString(response))); + } + if (qop != null) + { + _queryParameters.Add(string.Format("qop={0}", System.Uri.EscapeDataString(qop))); + } + if (nc != null) + { + _queryParameters.Add(string.Format("nc={0}", System.Uri.EscapeDataString(nc))); + } + if (cnonce != null) + { + _queryParameters.Add(string.Format("cnonce={0}", System.Uri.EscapeDataString(cnonce))); + } + if (useTokenCookie != null) + { + _queryParameters.Add(string.Format("UseTokenCookie={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(useTokenCookie, Client.SerializationSettings).Trim('"')))); + } + if (accessToken != null) + { + _queryParameters.Add(string.Format("AccessToken={0}", System.Uri.EscapeDataString(accessToken))); + } + if (accessTokenSecret != null) + { + _queryParameters.Add(string.Format("AccessTokenSecret={0}", System.Uri.EscapeDataString(accessTokenSecret))); + } + if (meta != null) + { + _queryParameters.Add(string.Format("Meta={0}", System.Uri.EscapeDataString(meta))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provider"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "authenticate/{provider}").ToString(); + _url = _url.Replace("{provider}", System.Uri.EscapeDataString(provider)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provider"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "authenticate/{provider}").ToString(); + _url = _url.Replace("{provider}", System.Uri.EscapeDataString(provider)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provider"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provider", provider); + tracingParameters.Add("state", state); + tracingParameters.Add("oauthToken", oauthToken); + tracingParameters.Add("oauthVerifier", oauthVerifier); + tracingParameters.Add("userName", userName); + tracingParameters.Add("password", password); + tracingParameters.Add("rememberMe", rememberMe); + tracingParameters.Add("continueParameter", continueParameter); + tracingParameters.Add("nonce", nonce); + tracingParameters.Add("uri", uri); + tracingParameters.Add("response", response); + tracingParameters.Add("qop", qop); + tracingParameters.Add("nc", nc); + tracingParameters.Add("cnonce", cnonce); + tracingParameters.Add("useTokenCookie", useTokenCookie); + tracingParameters.Add("accessToken", accessToken); + tracingParameters.Add("accessTokenSecret", accessTokenSecret); + tracingParameters.Add("meta", meta); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "authenticate/{provider}").ToString(); + _url = _url.Replace("{provider}", System.Uri.EscapeDataString(provider)); + List _queryParameters = new List(); + if (state != null) + { + _queryParameters.Add(string.Format("State={0}", System.Uri.EscapeDataString(state))); + } + if (oauthToken != null) + { + _queryParameters.Add(string.Format("oauth_token={0}", System.Uri.EscapeDataString(oauthToken))); + } + if (oauthVerifier != null) + { + _queryParameters.Add(string.Format("oauth_verifier={0}", System.Uri.EscapeDataString(oauthVerifier))); + } + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (password != null) + { + _queryParameters.Add(string.Format("Password={0}", System.Uri.EscapeDataString(password))); + } + if (rememberMe != null) + { + _queryParameters.Add(string.Format("RememberMe={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(rememberMe, Client.SerializationSettings).Trim('"')))); + } + if (continueParameter != null) + { + _queryParameters.Add(string.Format("Continue={0}", System.Uri.EscapeDataString(continueParameter))); + } + if (nonce != null) + { + _queryParameters.Add(string.Format("nonce={0}", System.Uri.EscapeDataString(nonce))); + } + if (uri != null) + { + _queryParameters.Add(string.Format("uri={0}", System.Uri.EscapeDataString(uri))); + } + if (response != null) + { + _queryParameters.Add(string.Format("response={0}", System.Uri.EscapeDataString(response))); + } + if (qop != null) + { + _queryParameters.Add(string.Format("qop={0}", System.Uri.EscapeDataString(qop))); + } + if (nc != null) + { + _queryParameters.Add(string.Format("nc={0}", System.Uri.EscapeDataString(nc))); + } + if (cnonce != null) + { + _queryParameters.Add(string.Format("cnonce={0}", System.Uri.EscapeDataString(cnonce))); + } + if (useTokenCookie != null) + { + _queryParameters.Add(string.Format("UseTokenCookie={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(useTokenCookie, Client.SerializationSettings).Trim('"')))); + } + if (accessToken != null) + { + _queryParameters.Add(string.Format("AccessToken={0}", System.Uri.EscapeDataString(accessToken))); + } + if (accessTokenSecret != null) + { + _queryParameters.Add(string.Format("AccessTokenSecret={0}", System.Uri.EscapeDataString(accessTokenSecret))); + } + if (meta != null) + { + _queryParameters.Add(string.Format("Meta={0}", System.Uri.EscapeDataString(meta))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new AuthenticateResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AuthenticateResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticateprovider2Extensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticateprovider2Extensions.cs new file mode 100644 index 00000000000..a1eea4f7f02 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Authenticateprovider2Extensions.cs @@ -0,0 +1,401 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Authenticateprovider2. + /// + public static partial class Authenticateprovider2Extensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Get(this IAuthenticateprovider2 operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string)) + { + return operations.GetAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAuthenticateprovider2 operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Create(this IAuthenticateprovider2 operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate)) + { + return operations.CreateAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAuthenticateprovider2 operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Post(this IAuthenticateprovider2 operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate)) + { + return operations.PostAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IAuthenticateprovider2 operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Delete(this IAuthenticateprovider2 operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string)) + { + return operations.DeleteAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAuthenticateprovider2 operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AuthenticateproviderExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AuthenticateproviderExtensions.cs new file mode 100644 index 00000000000..eb77929bc01 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/AuthenticateproviderExtensions.cs @@ -0,0 +1,401 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Authenticateprovider. + /// + public static partial class AuthenticateproviderExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Get(this IAuthenticateprovider operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string)) + { + return operations.GetAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAuthenticateprovider operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Create(this IAuthenticateprovider operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate)) + { + return operations.CreateAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAuthenticateprovider operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Post(this IAuthenticateprovider operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate)) + { + return operations.PostAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IAuthenticateprovider operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static AuthenticateResponse Delete(this IAuthenticateprovider operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string)) + { + return operations.DeleteAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAuthenticateprovider operations, string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(provider, state, oauthToken, oauthVerifier, userName, password, rememberMe, continueParameter, nonce, uri, response, qop, nc, cnonce, useTokenCookie, accessToken, accessTokenSecret, meta, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetMovieId.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetMovieId.cs new file mode 100644 index 00000000000..d95598207af --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetMovieId.cs @@ -0,0 +1,669 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GetMovieId operations. + /// + public partial class GetMovieId : IServiceOperations, IGetMovieId + { + /// + /// Initializes a new instance of the GetMovieId class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public GetMovieId(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(long id, IList includes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("includes", includes); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "movie/{Id}").ToString(); + _url = _url.Replace("{Id}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(id, Client.SerializationSettings).Trim('"'))); + List _queryParameters = new List(); + if (includes != null) + { + if (includes.Count == 0) + { + _queryParameters.Add(string.Format("Includes={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in includes) + { + _queryParameters.Add(string.Format("Includes={0}", System.Uri.EscapeDataString(_item ?? string.Empty))); + } + } + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new MovieResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + MovieResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(long id, IList includes = default(IList), GetMovie body = default(GetMovie), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("includes", includes); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "movie/{Id}").ToString(); + _url = _url.Replace("{Id}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(id, Client.SerializationSettings).Trim('"'))); + List _queryParameters = new List(); + if (includes != null) + { + if (includes.Count == 0) + { + _queryParameters.Add(string.Format("Includes={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in includes) + { + _queryParameters.Add(string.Format("Includes={0}", System.Uri.EscapeDataString(_item ?? string.Empty))); + } + } + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new MovieResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + MovieResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(long id, IList includes = default(IList), GetMovie body = default(GetMovie), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("includes", includes); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "movie/{Id}").ToString(); + _url = _url.Replace("{Id}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(id, Client.SerializationSettings).Trim('"'))); + List _queryParameters = new List(); + if (includes != null) + { + if (includes.Count == 0) + { + _queryParameters.Add(string.Format("Includes={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in includes) + { + _queryParameters.Add(string.Format("Includes={0}", System.Uri.EscapeDataString(_item ?? string.Empty))); + } + } + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new MovieResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + MovieResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(long id, IList includes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("includes", includes); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "movie/{Id}").ToString(); + _url = _url.Replace("{Id}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(id, Client.SerializationSettings).Trim('"'))); + List _queryParameters = new List(); + if (includes != null) + { + if (includes.Count == 0) + { + _queryParameters.Add(string.Format("Includes={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in includes) + { + _queryParameters.Add(string.Format("Includes={0}", System.Uri.EscapeDataString(_item ?? string.Empty))); + } + } + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new MovieResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + MovieResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetMovieIdExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetMovieIdExtensions.cs new file mode 100644 index 00000000000..c48bfe1e8f3 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetMovieIdExtensions.cs @@ -0,0 +1,147 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GetMovieId. + /// + public static partial class GetMovieIdExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static MovieResponse Get(this IGetMovieId operations, long id, IList includes = default(IList)) + { + return operations.GetAsync(id, includes).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGetMovieId operations, long id, IList includes = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(id, includes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static MovieResponse Create(this IGetMovieId operations, long id, IList includes = default(IList), GetMovie body = default(GetMovie)) + { + return operations.CreateAsync(id, includes, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IGetMovieId operations, long id, IList includes = default(IList), GetMovie body = default(GetMovie), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(id, includes, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static MovieResponse Post(this IGetMovieId operations, long id, IList includes = default(IList), GetMovie body = default(GetMovie)) + { + return operations.PostAsync(id, includes, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IGetMovieId operations, long id, IList includes = default(IList), GetMovie body = default(GetMovie), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(id, includes, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static MovieResponse Delete(this IGetMovieId operations, long id, IList includes = default(IList)) + { + return operations.DeleteAsync(id, includes).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGetMovieId operations, long id, IList includes = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(id, includes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetSession.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetSession.cs new file mode 100644 index 00000000000..46af20fce51 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetSession.cs @@ -0,0 +1,565 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GetSession operations. + /// + public partial class GetSession : IServiceOperations, IGetSession + { + /// + /// Initializes a new instance of the GetSession class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public GetSession(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "session").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new GetSessionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GetSessionResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "session").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new GetSessionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GetSessionResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "session").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new GetSessionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GetSessionResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "session").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new GetSessionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GetSessionResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetSessionExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetSessionExtensions.cs new file mode 100644 index 00000000000..976f58249ef --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/GetSessionExtensions.cs @@ -0,0 +1,113 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GetSession. + /// + public static partial class GetSessionExtensions + { + /// + /// The operations group for this extension method. + /// + public static GetSessionResponse Get(this IGetSession operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGetSession operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static GetSessionResponse Create(this IGetSession operations, object body = default(object)) + { + return operations.CreateAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IGetSession operations, object body = default(object), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static GetSessionResponse Post(this IGetSession operations, object body = default(object)) + { + return operations.PostAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IGetSession operations, object body = default(object), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + public static GetSessionResponse Delete(this IGetSession operations) + { + return operations.DeleteAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGetSession operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesOperations.cs new file mode 100644 index 00000000000..447c9389b94 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesOperations.cs @@ -0,0 +1,635 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloAllTypesOperations operations. + /// + public partial class HelloAllTypesOperations : IServiceOperations, IHelloAllTypesOperations + { + /// + /// Initializes a new instance of the HelloAllTypesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloAllTypesOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("allTypes", allTypes); + tracingParameters.Add("allCollectionTypes", allCollectionTypes); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "all-types").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (allTypes != null) + { + _queryParameters.Add(string.Format("AllTypes={0}", System.Uri.EscapeDataString(allTypes))); + } + if (allCollectionTypes != null) + { + _queryParameters.Add(string.Format("AllCollectionTypes={0}", System.Uri.EscapeDataString(allCollectionTypes))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypes body = default(HelloAllTypes), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("allTypes", allTypes); + tracingParameters.Add("allCollectionTypes", allCollectionTypes); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "all-types").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypes body = default(HelloAllTypes), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("allTypes", allTypes); + tracingParameters.Add("allCollectionTypes", allCollectionTypes); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "all-types").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("allTypes", allTypes); + tracingParameters.Add("allCollectionTypes", allCollectionTypes); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "all-types").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (allTypes != null) + { + _queryParameters.Add(string.Format("AllTypes={0}", System.Uri.EscapeDataString(allTypes))); + } + if (allCollectionTypes != null) + { + _queryParameters.Add(string.Format("AllCollectionTypes={0}", System.Uri.EscapeDataString(allCollectionTypes))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesOperationsExtensions.cs new file mode 100644 index 00000000000..a10e32824f4 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesOperationsExtensions.cs @@ -0,0 +1,161 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloAllTypesOperations. + /// + public static partial class HelloAllTypesOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static object Get(this IHelloAllTypesOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string)) + { + return operations.GetAsync(name, allTypes, allCollectionTypes).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloAllTypesOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, allTypes, allCollectionTypes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static object Create(this IHelloAllTypesOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypes body = default(HelloAllTypes)) + { + return operations.CreateAsync(name, allTypes, allCollectionTypes, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloAllTypesOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypes body = default(HelloAllTypes), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(name, allTypes, allCollectionTypes, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static object Post(this IHelloAllTypesOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypes body = default(HelloAllTypes)) + { + return operations.PostAsync(name, allTypes, allCollectionTypes, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloAllTypesOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypes body = default(HelloAllTypes), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(name, allTypes, allCollectionTypes, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static object Delete(this IHelloAllTypesOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string)) + { + return operations.DeleteAsync(name, allTypes, allCollectionTypes).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloAllTypesOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(name, allTypes, allCollectionTypes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesWithResultOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesWithResultOperations.cs new file mode 100644 index 00000000000..f18ca28d3fa --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesWithResultOperations.cs @@ -0,0 +1,635 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloAllTypesWithResultOperations operations. + /// + public partial class HelloAllTypesWithResultOperations : IServiceOperations, IHelloAllTypesWithResultOperations + { + /// + /// Initializes a new instance of the HelloAllTypesWithResultOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloAllTypesWithResultOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("allTypes", allTypes); + tracingParameters.Add("allCollectionTypes", allCollectionTypes); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "all-types-result").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (allTypes != null) + { + _queryParameters.Add(string.Format("AllTypes={0}", System.Uri.EscapeDataString(allTypes))); + } + if (allCollectionTypes != null) + { + _queryParameters.Add(string.Format("AllCollectionTypes={0}", System.Uri.EscapeDataString(allCollectionTypes))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloAllTypesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloAllTypesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypesWithResult body = default(HelloAllTypesWithResult), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("allTypes", allTypes); + tracingParameters.Add("allCollectionTypes", allCollectionTypes); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "all-types-result").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloAllTypesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloAllTypesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypesWithResult body = default(HelloAllTypesWithResult), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("allTypes", allTypes); + tracingParameters.Add("allCollectionTypes", allCollectionTypes); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "all-types-result").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloAllTypesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloAllTypesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("allTypes", allTypes); + tracingParameters.Add("allCollectionTypes", allCollectionTypes); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "all-types-result").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (allTypes != null) + { + _queryParameters.Add(string.Format("AllTypes={0}", System.Uri.EscapeDataString(allTypes))); + } + if (allCollectionTypes != null) + { + _queryParameters.Add(string.Format("AllCollectionTypes={0}", System.Uri.EscapeDataString(allCollectionTypes))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloAllTypesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloAllTypesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesWithResultOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesWithResultOperationsExtensions.cs new file mode 100644 index 00000000000..9db16017647 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloAllTypesWithResultOperationsExtensions.cs @@ -0,0 +1,161 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloAllTypesWithResultOperations. + /// + public static partial class HelloAllTypesWithResultOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloAllTypesResponse Get(this IHelloAllTypesWithResultOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string)) + { + return operations.GetAsync(name, allTypes, allCollectionTypes).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloAllTypesWithResultOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, allTypes, allCollectionTypes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static HelloAllTypesResponse Create(this IHelloAllTypesWithResultOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypesWithResult body = default(HelloAllTypesWithResult)) + { + return operations.CreateAsync(name, allTypes, allCollectionTypes, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloAllTypesWithResultOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypesWithResult body = default(HelloAllTypesWithResult), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(name, allTypes, allCollectionTypes, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static HelloAllTypesResponse Post(this IHelloAllTypesWithResultOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypesWithResult body = default(HelloAllTypesWithResult)) + { + return operations.PostAsync(name, allTypes, allCollectionTypes, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloAllTypesWithResultOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypesWithResult body = default(HelloAllTypesWithResult), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(name, allTypes, allCollectionTypes, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloAllTypesResponse Delete(this IHelloAllTypesWithResultOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string)) + { + return operations.DeleteAsync(name, allTypes, allCollectionTypes).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloAllTypesWithResultOperations operations, string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(name, allTypes, allCollectionTypes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloArrayOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloArrayOperations.cs new file mode 100644 index 00000000000..501982cd502 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloArrayOperations.cs @@ -0,0 +1,595 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloArrayOperations operations. + /// + public partial class HelloArrayOperations : IServiceOperations, IHelloArrayOperations + { + /// + /// Initializes a new instance of the HelloArrayOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloArrayOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetWithHttpMessagesAsync(string names = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("names", names); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-array").ToString(); + List _queryParameters = new List(); + if (names != null) + { + _queryParameters.Add(string.Format("Names={0}", System.Uri.EscapeDataString(names))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> CreateWithHttpMessagesAsync(string names = default(string), HelloArray body = default(HelloArray), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("names", names); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-array").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> PostWithHttpMessagesAsync(string names = default(string), HelloArray body = default(HelloArray), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("names", names); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-array").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> DeleteWithHttpMessagesAsync(string names = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("names", names); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-array").ToString(); + List _queryParameters = new List(); + if (names != null) + { + _queryParameters.Add(string.Format("Names={0}", System.Uri.EscapeDataString(names))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloArrayOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloArrayOperationsExtensions.cs new file mode 100644 index 00000000000..6b190aaaaf4 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloArrayOperationsExtensions.cs @@ -0,0 +1,131 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloArrayOperations. + /// + public static partial class HelloArrayOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + public static IList Get(this IHelloArrayOperations operations, string names = default(string)) + { + return operations.GetAsync(names).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> GetAsync(this IHelloArrayOperations operations, string names = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(names, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static IList Create(this IHelloArrayOperations operations, string names = default(string), HelloArray body = default(HelloArray)) + { + return operations.CreateAsync(names, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> CreateAsync(this IHelloArrayOperations operations, string names = default(string), HelloArray body = default(HelloArray), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(names, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static IList Post(this IHelloArrayOperations operations, string names = default(string), HelloArray body = default(HelloArray)) + { + return operations.PostAsync(names, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> PostAsync(this IHelloArrayOperations operations, string names = default(string), HelloArray body = default(HelloArray), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(names, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static IList Delete(this IHelloArrayOperations operations, string names = default(string)) + { + return operations.DeleteAsync(names).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> DeleteAsync(this IHelloArrayOperations operations, string names = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(names, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloDateTimeOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloDateTimeOperations.cs new file mode 100644 index 00000000000..bc7c58ac9c9 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloDateTimeOperations.cs @@ -0,0 +1,589 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloDateTimeOperations operations. + /// + public partial class HelloDateTimeOperations : IServiceOperations, IHelloDateTimeOperations + { + /// + /// Initializes a new instance of the HelloDateTimeOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloDateTimeOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(System.DateTime dateTime = default(System.DateTime), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("dateTime", dateTime); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-datetime").ToString(); + List _queryParameters = new List(); + _queryParameters.Add(string.Format("DateTime={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(dateTime, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloDateTimeException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloDateTime _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(System.DateTime dateTime = default(System.DateTime), HelloDateTime body = default(HelloDateTime), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("dateTime", dateTime); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-datetime").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloDateTimeException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloDateTime _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(System.DateTime dateTime = default(System.DateTime), HelloDateTime body = default(HelloDateTime), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("dateTime", dateTime); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-datetime").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloDateTimeException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloDateTime _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(System.DateTime dateTime = default(System.DateTime), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("dateTime", dateTime); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-datetime").ToString(); + List _queryParameters = new List(); + _queryParameters.Add(string.Format("DateTime={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(dateTime, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloDateTimeException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloDateTime _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloDateTimeOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloDateTimeOperationsExtensions.cs new file mode 100644 index 00000000000..8607007a2d5 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloDateTimeOperationsExtensions.cs @@ -0,0 +1,129 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloDateTimeOperations. + /// + public static partial class HelloDateTimeOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + public static HelloDateTime Get(this IHelloDateTimeOperations operations, System.DateTime dateTime = default(System.DateTime)) + { + return operations.GetAsync(dateTime).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloDateTimeOperations operations, System.DateTime dateTime = default(System.DateTime), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(dateTime, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static HelloDateTime Create(this IHelloDateTimeOperations operations, System.DateTime dateTime = default(System.DateTime), HelloDateTime body = default(HelloDateTime)) + { + return operations.CreateAsync(dateTime, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloDateTimeOperations operations, System.DateTime dateTime = default(System.DateTime), HelloDateTime body = default(HelloDateTime), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(dateTime, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static HelloDateTime Post(this IHelloDateTimeOperations operations, System.DateTime dateTime = default(System.DateTime), HelloDateTime body = default(HelloDateTime)) + { + return operations.PostAsync(dateTime, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloDateTimeOperations operations, System.DateTime dateTime = default(System.DateTime), HelloDateTime body = default(HelloDateTime), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(dateTime, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static HelloDateTime Delete(this IHelloDateTimeOperations operations, System.DateTime dateTime = default(System.DateTime)) + { + return operations.DeleteAsync(dateTime).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloDateTimeOperations operations, System.DateTime dateTime = default(System.DateTime), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(dateTime, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloListOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloListOperations.cs new file mode 100644 index 00000000000..40fc4fab85b --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloListOperations.cs @@ -0,0 +1,595 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloListOperations operations. + /// + public partial class HelloListOperations : IServiceOperations, IHelloListOperations + { + /// + /// Initializes a new instance of the HelloListOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloListOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetWithHttpMessagesAsync(string names = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("names", names); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-list").ToString(); + List _queryParameters = new List(); + if (names != null) + { + _queryParameters.Add(string.Format("Names={0}", System.Uri.EscapeDataString(names))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> CreateWithHttpMessagesAsync(string names = default(string), HelloList body = default(HelloList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("names", names); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-list").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> PostWithHttpMessagesAsync(string names = default(string), HelloList body = default(HelloList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("names", names); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-list").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> DeleteWithHttpMessagesAsync(string names = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("names", names); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-list").ToString(); + List _queryParameters = new List(); + if (names != null) + { + _queryParameters.Add(string.Format("Names={0}", System.Uri.EscapeDataString(names))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloListOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloListOperationsExtensions.cs new file mode 100644 index 00000000000..977fcdf1bd8 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloListOperationsExtensions.cs @@ -0,0 +1,131 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloListOperations. + /// + public static partial class HelloListOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + public static IList Get(this IHelloListOperations operations, string names = default(string)) + { + return operations.GetAsync(names).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> GetAsync(this IHelloListOperations operations, string names = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(names, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static IList Create(this IHelloListOperations operations, string names = default(string), HelloList body = default(HelloList)) + { + return operations.CreateAsync(names, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> CreateAsync(this IHelloListOperations operations, string names = default(string), HelloList body = default(HelloList), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(names, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static IList Post(this IHelloListOperations operations, string names = default(string), HelloList body = default(HelloList)) + { + return operations.PostAsync(names, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> PostAsync(this IHelloListOperations operations, string names = default(string), HelloList body = default(HelloList), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(names, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static IList Delete(this IHelloListOperations operations, string names = default(string)) + { + return operations.DeleteAsync(names).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> DeleteAsync(this IHelloListOperations operations, string names = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(names, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloName.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloName.cs new file mode 100644 index 00000000000..c31204b6935 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloName.cs @@ -0,0 +1,651 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloName operations. + /// + public partial class HelloName : IServiceOperations, IHelloName + { + /// + /// Initializes a new instance of the HelloName class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloName(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string name, string title = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("title", title); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello/{Name}").ToString(); + _url = _url.Replace("{Name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (title != null) + { + _queryParameters.Add(string.Format("Title={0}", System.Uri.EscapeDataString(title))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string name, string title = default(string), Hello body = default(Hello), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("title", title); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello/{Name}").ToString(); + _url = _url.Replace("{Name}", System.Uri.EscapeDataString(name)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string name, string title = default(string), Hello body = default(Hello), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("title", title); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello/{Name}").ToString(); + _url = _url.Replace("{Name}", System.Uri.EscapeDataString(name)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string name, string title = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("title", title); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello/{Name}").ToString(); + _url = _url.Replace("{Name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (title != null) + { + _queryParameters.Add(string.Format("Title={0}", System.Uri.EscapeDataString(title))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloNameExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloNameExtensions.cs new file mode 100644 index 00000000000..e6d4720044a --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloNameExtensions.cs @@ -0,0 +1,145 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloName. + /// + public static partial class HelloNameExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static HelloResponse Get(this IHelloName operations, string name, string title = default(string)) + { + return operations.GetAsync(name, title).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloName operations, string name, string title = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, title, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloResponse Create(this IHelloName operations, string name, string title = default(string), Hello body = default(Hello)) + { + return operations.CreateAsync(name, title, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloName operations, string name, string title = default(string), Hello body = default(Hello), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(name, title, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloResponse Post(this IHelloName operations, string name, string title = default(string), Hello body = default(Hello)) + { + return operations.PostAsync(name, title, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloName operations, string name, string title = default(string), Hello body = default(Hello), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(name, title, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static HelloResponse Delete(this IHelloName operations, string name, string title = default(string)) + { + return operations.DeleteAsync(name, title).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloName operations, string name, string title = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(name, title, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloOperations.cs new file mode 100644 index 00000000000..b613c4a0100 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloOperations.cs @@ -0,0 +1,615 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloOperations operations. + /// + public partial class HelloOperations : IServiceOperations, IHelloOperations + { + /// + /// Initializes a new instance of the HelloOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string name = default(string), string title = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("title", title); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (title != null) + { + _queryParameters.Add(string.Format("Title={0}", System.Uri.EscapeDataString(title))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string name = default(string), string title = default(string), Hello body = default(Hello), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("title", title); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string name = default(string), string title = default(string), Hello body = default(Hello), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("title", title); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string name = default(string), string title = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("title", title); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (title != null) + { + _queryParameters.Add(string.Format("Title={0}", System.Uri.EscapeDataString(title))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloOperationsExtensions.cs new file mode 100644 index 00000000000..3814380de54 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloOperationsExtensions.cs @@ -0,0 +1,145 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloOperations. + /// + public static partial class HelloOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static HelloResponse Get(this IHelloOperations operations, string name = default(string), string title = default(string)) + { + return operations.GetAsync(name, title).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloOperations operations, string name = default(string), string title = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, title, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloResponse Create(this IHelloOperations operations, string name = default(string), string title = default(string), Hello body = default(Hello)) + { + return operations.CreateAsync(name, title, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloOperations operations, string name = default(string), string title = default(string), Hello body = default(Hello), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(name, title, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloResponse Post(this IHelloOperations operations, string name = default(string), string title = default(string), Hello body = default(Hello)) + { + return operations.PostAsync(name, title, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloOperations operations, string name = default(string), string title = default(string), Hello body = default(Hello), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(name, title, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static HelloResponse Delete(this IHelloOperations operations, string name = default(string), string title = default(string)) + { + return operations.DeleteAsync(name, title).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloOperations operations, string name = default(string), string title = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(name, title, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloStringOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloStringOperations.cs new file mode 100644 index 00000000000..8df2fcb8a4b --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloStringOperations.cs @@ -0,0 +1,595 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloStringOperations operations. + /// + public partial class HelloStringOperations : IServiceOperations, IHelloStringOperations + { + /// + /// Initializes a new instance of the HelloStringOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloStringOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-string").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string name = default(string), HelloString body = default(HelloString), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-string").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string name = default(string), HelloString body = default(HelloString), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-string").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-string").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloStringOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloStringOperationsExtensions.cs new file mode 100644 index 00000000000..8b19d525905 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloStringOperationsExtensions.cs @@ -0,0 +1,129 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloStringOperations. + /// + public static partial class HelloStringOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + public static string Get(this IHelloStringOperations operations, string name = default(string)) + { + return operations.GetAsync(name).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloStringOperations operations, string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static string Create(this IHelloStringOperations operations, string name = default(string), HelloString body = default(HelloString)) + { + return operations.CreateAsync(name, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloStringOperations operations, string name = default(string), HelloString body = default(HelloString), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(name, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static string Post(this IHelloStringOperations operations, string name = default(string), HelloString body = default(HelloString)) + { + return operations.PostAsync(name, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloStringOperations operations, string name = default(string), HelloString body = default(HelloString), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(name, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static string Delete(this IHelloStringOperations operations, string name = default(string)) + { + return operations.DeleteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloStringOperations operations, string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloTypesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloTypesOperations.cs new file mode 100644 index 00000000000..470ae4ae9b2 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloTypesOperations.cs @@ -0,0 +1,623 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloTypesOperations operations. + /// + public partial class HelloTypesOperations : IServiceOperations, IHelloTypesOperations + { + /// + /// Initializes a new instance of the HelloTypesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloTypesOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("stringParameter", stringParameter); + tracingParameters.Add("boolParameter", boolParameter); + tracingParameters.Add("intParameter", intParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hellotypes").ToString(); + List _queryParameters = new List(); + if (stringParameter != null) + { + _queryParameters.Add(string.Format("String={0}", System.Uri.EscapeDataString(stringParameter))); + } + _queryParameters.Add(string.Format("Bool={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(boolParameter, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("Int={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(intParameter, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloTypesException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloTypes _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), HelloTypes body = default(HelloTypes), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("stringParameter", stringParameter); + tracingParameters.Add("boolParameter", boolParameter); + tracingParameters.Add("intParameter", intParameter); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hellotypes").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloTypesException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloTypes _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), HelloTypes body = default(HelloTypes), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("stringParameter", stringParameter); + tracingParameters.Add("boolParameter", boolParameter); + tracingParameters.Add("intParameter", intParameter); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hellotypes").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloTypesException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloTypes _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("stringParameter", stringParameter); + tracingParameters.Add("boolParameter", boolParameter); + tracingParameters.Add("intParameter", intParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hellotypes").ToString(); + List _queryParameters = new List(); + if (stringParameter != null) + { + _queryParameters.Add(string.Format("String={0}", System.Uri.EscapeDataString(stringParameter))); + } + _queryParameters.Add(string.Format("Bool={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(boolParameter, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("Int={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(intParameter, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloTypesException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloTypes _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloTypesOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloTypesOperationsExtensions.cs new file mode 100644 index 00000000000..b7aa7542388 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloTypesOperationsExtensions.cs @@ -0,0 +1,161 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloTypesOperations. + /// + public static partial class HelloTypesOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloTypes Get(this IHelloTypesOperations operations, string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int)) + { + return operations.GetAsync(stringParameter, boolParameter, intParameter).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloTypesOperations operations, string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(stringParameter, boolParameter, intParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static HelloTypes Create(this IHelloTypesOperations operations, string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), HelloTypes body = default(HelloTypes)) + { + return operations.CreateAsync(stringParameter, boolParameter, intParameter, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloTypesOperations operations, string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), HelloTypes body = default(HelloTypes), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(stringParameter, boolParameter, intParameter, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static HelloTypes Post(this IHelloTypesOperations operations, string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), HelloTypes body = default(HelloTypes)) + { + return operations.PostAsync(stringParameter, boolParameter, intParameter, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloTypesOperations operations, string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), HelloTypes body = default(HelloTypes), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(stringParameter, boolParameter, intParameter, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloTypes Delete(this IHelloTypesOperations operations, string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int)) + { + return operations.DeleteAsync(stringParameter, boolParameter, intParameter).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloTypesOperations operations, string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(stringParameter, boolParameter, intParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloVoidOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloVoidOperations.cs new file mode 100644 index 00000000000..077206fd2fe --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloVoidOperations.cs @@ -0,0 +1,595 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloVoidOperations operations. + /// + public partial class HelloVoidOperations : IServiceOperations, IHelloVoidOperations + { + /// + /// Initializes a new instance of the HelloVoidOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloVoidOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-void").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string name = default(string), HelloVoid body = default(HelloVoid), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-void").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string name = default(string), HelloVoid body = default(HelloVoid), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-void").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hello-void").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloVoidOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloVoidOperationsExtensions.cs new file mode 100644 index 00000000000..5376595a9a8 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloVoidOperationsExtensions.cs @@ -0,0 +1,129 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloVoidOperations. + /// + public static partial class HelloVoidOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + public static object Get(this IHelloVoidOperations operations, string name = default(string)) + { + return operations.GetAsync(name).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloVoidOperations operations, string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static object Create(this IHelloVoidOperations operations, string name = default(string), HelloVoid body = default(HelloVoid)) + { + return operations.CreateAsync(name, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloVoidOperations operations, string name = default(string), HelloVoid body = default(HelloVoid), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(name, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static object Post(this IHelloVoidOperations operations, string name = default(string), HelloVoid body = default(HelloVoid)) + { + return operations.PostAsync(name, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloVoidOperations operations, string name = default(string), HelloVoid body = default(HelloVoid), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(name, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static object Delete(this IHelloVoidOperations operations, string name = default(string)) + { + return operations.DeleteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloVoidOperations operations, string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloWithRouteOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloWithRouteOperations.cs new file mode 100644 index 00000000000..8bb7552f7b0 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloWithRouteOperations.cs @@ -0,0 +1,595 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloWithRouteOperations operations. + /// + public partial class HelloWithRouteOperations : IServiceOperations, IHelloWithRouteOperations + { + /// + /// Initializes a new instance of the HelloWithRouteOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloWithRouteOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "helloroute").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string name = default(string), HelloWithRoute body = default(HelloWithRoute), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "helloroute").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string name = default(string), HelloWithRoute body = default(HelloWithRoute), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "helloroute").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "helloroute").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + object _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloWithRouteOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloWithRouteOperationsExtensions.cs new file mode 100644 index 00000000000..39241a30a05 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloWithRouteOperationsExtensions.cs @@ -0,0 +1,129 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloWithRouteOperations. + /// + public static partial class HelloWithRouteOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + public static object Get(this IHelloWithRouteOperations operations, string name = default(string)) + { + return operations.GetAsync(name).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloWithRouteOperations operations, string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static object Create(this IHelloWithRouteOperations operations, string name = default(string), HelloWithRoute body = default(HelloWithRoute)) + { + return operations.CreateAsync(name, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloWithRouteOperations operations, string name = default(string), HelloWithRoute body = default(HelloWithRoute), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(name, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static object Post(this IHelloWithRouteOperations operations, string name = default(string), HelloWithRoute body = default(HelloWithRoute)) + { + return operations.PostAsync(name, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloWithRouteOperations operations, string name = default(string), HelloWithRoute body = default(HelloWithRoute), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(name, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static object Delete(this IHelloWithRouteOperations operations, string name = default(string)) + { + return operations.DeleteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloWithRouteOperations operations, string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloZipOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloZipOperations.cs new file mode 100644 index 00000000000..7be55eaf910 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloZipOperations.cs @@ -0,0 +1,615 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloZipOperations operations. + /// + public partial class HelloZipOperations : IServiceOperations, IHelloZipOperations + { + /// + /// Initializes a new instance of the HelloZipOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public HelloZipOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string name = default(string), string test = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("test", test); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hellozip").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (test != null) + { + _queryParameters.Add(string.Format("Test={0}", System.Uri.EscapeDataString(test))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloZipResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloZipResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string name = default(string), string test = default(string), HelloZip body = default(HelloZip), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("test", test); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hellozip").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloZipResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloZipResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string name = default(string), string test = default(string), HelloZip body = default(HelloZip), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("test", test); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hellozip").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloZipResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloZipResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string name = default(string), string test = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("test", test); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "hellozip").ToString(); + List _queryParameters = new List(); + if (name != null) + { + _queryParameters.Add(string.Format("Name={0}", System.Uri.EscapeDataString(name))); + } + if (test != null) + { + _queryParameters.Add(string.Format("Test={0}", System.Uri.EscapeDataString(test))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HelloZipResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HelloZipResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloZipOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloZipOperationsExtensions.cs new file mode 100644 index 00000000000..120b96ca84f --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/HelloZipOperationsExtensions.cs @@ -0,0 +1,145 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HelloZipOperations. + /// + public static partial class HelloZipOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static HelloZipResponse Get(this IHelloZipOperations operations, string name = default(string), string test = default(string)) + { + return operations.GetAsync(name, test).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHelloZipOperations operations, string name = default(string), string test = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, test, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloZipResponse Create(this IHelloZipOperations operations, string name = default(string), string test = default(string), HelloZip body = default(HelloZip)) + { + return operations.CreateAsync(name, test, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHelloZipOperations operations, string name = default(string), string test = default(string), HelloZip body = default(HelloZip), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(name, test, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static HelloZipResponse Post(this IHelloZipOperations operations, string name = default(string), string test = default(string), HelloZip body = default(HelloZip)) + { + return operations.PostAsync(name, test, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IHelloZipOperations operations, string name = default(string), string test = default(string), HelloZip body = default(HelloZip), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(name, test, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static HelloZipResponse Delete(this IHelloZipOperations operations, string name = default(string), string test = default(string)) + { + return operations.DeleteAsync(name, test).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHelloZipOperations operations, string name = default(string), string test = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(name, test, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAllowedAttributesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAllowedAttributesOperations.cs new file mode 100644 index 00000000000..b76fc6ab5d9 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAllowedAttributesOperations.cs @@ -0,0 +1,41 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AllowedAttributesOperations operations. + /// + public partial interface IAllowedAttributesOperations + { + /// + /// AllowedAttributes Description + /// + /// + /// AllowedAttributes Description + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task GetWithHttpMessagesAsync(int aliased, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAssignRolesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAssignRolesOperations.cs new file mode 100644 index 00000000000..23f3cf262a0 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAssignRolesOperations.cs @@ -0,0 +1,100 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AssignRolesOperations operations. + /// + public partial interface IAssignRolesOperations + { + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), AssignRoles body = default(AssignRoles), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), AssignRoles body = default(AssignRoles), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticate2.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticate2.cs new file mode 100644 index 00000000000..ca55d63e371 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticate2.cs @@ -0,0 +1,220 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Authenticate2 operations. + /// + public partial interface IAuthenticate2 + { + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticateOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticateOperations.cs new file mode 100644 index 00000000000..29b3058b35f --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticateOperations.cs @@ -0,0 +1,220 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AuthenticateOperations operations. + /// + public partial interface IAuthenticateOperations + { + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticateprovider.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticateprovider.cs new file mode 100644 index 00000000000..f9a19e275c6 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticateprovider.cs @@ -0,0 +1,220 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Authenticateprovider operations. + /// + public partial interface IAuthenticateprovider + { + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticateprovider2.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticateprovider2.cs new file mode 100644 index 00000000000..a1f163f9361 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IAuthenticateprovider2.cs @@ -0,0 +1,220 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Authenticateprovider2 operations. + /// + public partial interface IAuthenticateprovider2 + { + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Authenticate body = default(Authenticate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string provider, string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueParameter = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), string meta = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IGetMovieId.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IGetMovieId.cs new file mode 100644 index 00000000000..2c1fa7a19b4 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IGetMovieId.cs @@ -0,0 +1,92 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GetMovieId operations. + /// + public partial interface IGetMovieId + { + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(long id, IList includes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(long id, IList includes = default(IList), GetMovie body = default(GetMovie), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(long id, IList includes = default(IList), GetMovie body = default(GetMovie), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(long id, IList includes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IGetSession.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IGetSession.cs new file mode 100644 index 00000000000..f4285ba65f2 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IGetSession.cs @@ -0,0 +1,76 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GetSession operations. + /// + public partial interface IGetSession + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloAllTypesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloAllTypesOperations.cs new file mode 100644 index 00000000000..3b7f7c1f5c7 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloAllTypesOperations.cs @@ -0,0 +1,100 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloAllTypesOperations operations. + /// + public partial interface IHelloAllTypesOperations + { + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypes body = default(HelloAllTypes), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypes body = default(HelloAllTypes), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloAllTypesWithResultOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloAllTypesWithResultOperations.cs new file mode 100644 index 00000000000..dddb99161f9 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloAllTypesWithResultOperations.cs @@ -0,0 +1,100 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloAllTypesWithResultOperations operations. + /// + public partial interface IHelloAllTypesWithResultOperations + { + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypesWithResult body = default(HelloAllTypesWithResult), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), HelloAllTypesWithResult body = default(HelloAllTypesWithResult), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string name = default(string), string allTypes = default(string), string allCollectionTypes = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloArrayOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloArrayOperations.cs new file mode 100644 index 00000000000..8bfd2543915 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloArrayOperations.cs @@ -0,0 +1,84 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloArrayOperations operations. + /// + public partial interface IHelloArrayOperations + { + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetWithHttpMessagesAsync(string names = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> CreateWithHttpMessagesAsync(string names = default(string), HelloArray body = default(HelloArray), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> PostWithHttpMessagesAsync(string names = default(string), HelloArray body = default(HelloArray), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> DeleteWithHttpMessagesAsync(string names = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloDateTimeOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloDateTimeOperations.cs new file mode 100644 index 00000000000..16b0141d78c --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloDateTimeOperations.cs @@ -0,0 +1,84 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloDateTimeOperations operations. + /// + public partial interface IHelloDateTimeOperations + { + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(System.DateTime dateTime = default(System.DateTime), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(System.DateTime dateTime = default(System.DateTime), HelloDateTime body = default(HelloDateTime), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(System.DateTime dateTime = default(System.DateTime), HelloDateTime body = default(HelloDateTime), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(System.DateTime dateTime = default(System.DateTime), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloListOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloListOperations.cs new file mode 100644 index 00000000000..15a1e1d845a --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloListOperations.cs @@ -0,0 +1,84 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloListOperations operations. + /// + public partial interface IHelloListOperations + { + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetWithHttpMessagesAsync(string names = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> CreateWithHttpMessagesAsync(string names = default(string), HelloList body = default(HelloList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> PostWithHttpMessagesAsync(string names = default(string), HelloList body = default(HelloList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> DeleteWithHttpMessagesAsync(string names = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloName.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloName.cs new file mode 100644 index 00000000000..3a0f040389b --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloName.cs @@ -0,0 +1,92 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloName operations. + /// + public partial interface IHelloName + { + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string name, string title = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string name, string title = default(string), Hello body = default(Hello), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string name, string title = default(string), Hello body = default(Hello), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string name, string title = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloOperations.cs new file mode 100644 index 00000000000..bd1fd1298cc --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloOperations.cs @@ -0,0 +1,92 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloOperations operations. + /// + public partial interface IHelloOperations + { + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string name = default(string), string title = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string name = default(string), string title = default(string), Hello body = default(Hello), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string name = default(string), string title = default(string), Hello body = default(Hello), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string name = default(string), string title = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloStringOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloStringOperations.cs new file mode 100644 index 00000000000..874cb405b0b --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloStringOperations.cs @@ -0,0 +1,84 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloStringOperations operations. + /// + public partial interface IHelloStringOperations + { + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string name = default(string), HelloString body = default(HelloString), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string name = default(string), HelloString body = default(HelloString), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloTypesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloTypesOperations.cs new file mode 100644 index 00000000000..4bee0f1e95c --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloTypesOperations.cs @@ -0,0 +1,100 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloTypesOperations operations. + /// + public partial interface IHelloTypesOperations + { + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), HelloTypes body = default(HelloTypes), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), HelloTypes body = default(HelloTypes), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string stringParameter = default(string), bool boolParameter = default(bool), int intParameter = default(int), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloVoidOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloVoidOperations.cs new file mode 100644 index 00000000000..1bac7ad4512 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloVoidOperations.cs @@ -0,0 +1,84 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloVoidOperations operations. + /// + public partial interface IHelloVoidOperations + { + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string name = default(string), HelloVoid body = default(HelloVoid), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string name = default(string), HelloVoid body = default(HelloVoid), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloWithRouteOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloWithRouteOperations.cs new file mode 100644 index 00000000000..94a60eeb95e --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloWithRouteOperations.cs @@ -0,0 +1,84 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloWithRouteOperations operations. + /// + public partial interface IHelloWithRouteOperations + { + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string name = default(string), HelloWithRoute body = default(HelloWithRoute), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string name = default(string), HelloWithRoute body = default(HelloWithRoute), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloZipOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloZipOperations.cs new file mode 100644 index 00000000000..76dd4fbb690 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IHelloZipOperations.cs @@ -0,0 +1,92 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HelloZipOperations operations. + /// + public partial interface IHelloZipOperations + { + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string name = default(string), string test = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string name = default(string), string test = default(string), HelloZip body = default(HelloZip), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string name = default(string), string test = default(string), HelloZip body = default(HelloZip), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string name = default(string), string test = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnArrayRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnArrayRequest.cs new file mode 100644 index 00000000000..745512b6601 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnArrayRequest.cs @@ -0,0 +1,33 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnArrayRequest operations. + /// + public partial interface IReturnArrayRequest + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnDictionaryDtoRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnDictionaryDtoRequest.cs new file mode 100644 index 00000000000..b7a6a2809ef --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnDictionaryDtoRequest.cs @@ -0,0 +1,33 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnDictionaryDtoRequest operations. + /// + public partial interface IReturnDictionaryDtoRequest + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnDictionaryStringRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnDictionaryStringRequest.cs new file mode 100644 index 00000000000..8ad72523900 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnDictionaryStringRequest.cs @@ -0,0 +1,33 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnDictionaryStringRequest operations. + /// + public partial interface IReturnDictionaryStringRequest + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnKeyValuePairRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnKeyValuePairRequest.cs new file mode 100644 index 00000000000..ba5986227e9 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnKeyValuePairRequest.cs @@ -0,0 +1,33 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnKeyValuePairRequest operations. + /// + public partial interface IReturnKeyValuePairRequest + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnListRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnListRequest.cs new file mode 100644 index 00000000000..50de3c3c6fb --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IReturnListRequest.cs @@ -0,0 +1,33 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnListRequest operations. + /// + public partial interface IReturnListRequest + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ISecuredDtoRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ISecuredDtoRequest.cs new file mode 100644 index 00000000000..d1f4ffc543f --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ISecuredDtoRequest.cs @@ -0,0 +1,76 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecuredDtoRequest operations. + /// + public partial interface ISecuredDtoRequest + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ISecuredOpsRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ISecuredOpsRequest.cs new file mode 100644 index 00000000000..29b6a78c37d --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ISecuredOpsRequest.cs @@ -0,0 +1,76 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecuredOpsRequest operations. + /// + public partial interface ISecuredOpsRequest + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ISecuredRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ISecuredRequest.cs new file mode 100644 index 00000000000..d2e169728ad --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ISecuredRequest.cs @@ -0,0 +1,76 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecuredRequest operations. + /// + public partial interface ISecuredRequest + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IServiceStackAutorestClient.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IServiceStackAutorestClient.cs new file mode 100644 index 00000000000..995b3007d6c --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IServiceStackAutorestClient.cs @@ -0,0 +1,186 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using Newtonsoft.Json; + + /// + /// + public partial interface IServiceStackAutorestClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Accept Header + /// + string Accept { get; } + + + /// + /// Gets the IReturnListRequest. + /// + IReturnListRequest ReturnListRequest { get; } + + /// + /// Gets the IReturnArrayRequest. + /// + IReturnArrayRequest ReturnArrayRequest { get; } + + /// + /// Gets the IReturnKeyValuePairRequest. + /// + IReturnKeyValuePairRequest ReturnKeyValuePairRequest { get; } + + /// + /// Gets the IReturnDictionaryStringRequest. + /// + IReturnDictionaryStringRequest ReturnDictionaryStringRequest { get; } + + /// + /// Gets the IReturnDictionaryDtoRequest. + /// + IReturnDictionaryDtoRequest ReturnDictionaryDtoRequest { get; } + + /// + /// Gets the IGetMovieId. + /// + IGetMovieId GetMovieId { get; } + + /// + /// Gets the IHelloOperations. + /// + IHelloOperations Hello { get; } + + /// + /// Gets the IHelloName. + /// + IHelloName HelloName { get; } + + /// + /// Gets the IHelloListOperations. + /// + IHelloListOperations HelloList { get; } + + /// + /// Gets the IHelloArrayOperations. + /// + IHelloArrayOperations HelloArray { get; } + + /// + /// Gets the IAllowedAttributesOperations. + /// + IAllowedAttributesOperations AllowedAttributes { get; } + + /// + /// Gets the IHelloAllTypesOperations. + /// + IHelloAllTypesOperations HelloAllTypes { get; } + + /// + /// Gets the IHelloAllTypesWithResultOperations. + /// + IHelloAllTypesWithResultOperations HelloAllTypesWithResult { get; } + + /// + /// Gets the IHelloStringOperations. + /// + IHelloStringOperations HelloString { get; } + + /// + /// Gets the IHelloDateTimeOperations. + /// + IHelloDateTimeOperations HelloDateTime { get; } + + /// + /// Gets the IHelloVoidOperations. + /// + IHelloVoidOperations HelloVoid { get; } + + /// + /// Gets the IHelloWithRouteOperations. + /// + IHelloWithRouteOperations HelloWithRoute { get; } + + /// + /// Gets the IHelloTypesOperations. + /// + IHelloTypesOperations HelloTypes { get; } + + /// + /// Gets the IHelloZipOperations. + /// + IHelloZipOperations HelloZip { get; } + + /// + /// Gets the ISecuredRequest. + /// + ISecuredRequest SecuredRequest { get; } + + /// + /// Gets the ISecuredDtoRequest. + /// + ISecuredDtoRequest SecuredDtoRequest { get; } + + /// + /// Gets the ISecuredOpsRequest. + /// + ISecuredOpsRequest SecuredOpsRequest { get; } + + /// + /// Gets the IGetSession. + /// + IGetSession GetSession { get; } + + /// + /// Gets the IUpdateSessioneditCustomName. + /// + IUpdateSessioneditCustomName UpdateSessioneditCustomName { get; } + + /// + /// Gets the IAuthenticateOperations. + /// + IAuthenticateOperations Authenticate { get; } + + /// + /// Gets the IAuthenticateprovider. + /// + IAuthenticateprovider Authenticateprovider { get; } + + /// + /// Gets the IAuthenticate2. + /// + IAuthenticate2 Authenticate2 { get; } + + /// + /// Gets the IAuthenticateprovider2. + /// + IAuthenticateprovider2 Authenticateprovider2 { get; } + + /// + /// Gets the IAssignRolesOperations. + /// + IAssignRolesOperations AssignRoles { get; } + + /// + /// Gets the IUnAssignRolesOperations. + /// + IUnAssignRolesOperations UnAssignRoles { get; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IUnAssignRolesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IUnAssignRolesOperations.cs new file mode 100644 index 00000000000..a7e119dc823 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IUnAssignRolesOperations.cs @@ -0,0 +1,100 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UnAssignRolesOperations operations. + /// + public partial interface IUnAssignRolesOperations + { + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), UnAssignRoles body = default(UnAssignRoles), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), UnAssignRoles body = default(UnAssignRoles), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IUpdateSessioneditCustomName.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IUpdateSessioneditCustomName.cs new file mode 100644 index 00000000000..7ca95b0c630 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/IUpdateSessioneditCustomName.cs @@ -0,0 +1,84 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UpdateSessioneditCustomName operations. + /// + public partial interface IUpdateSessioneditCustomName + { + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string customName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string customName, UpdateSession body = default(UpdateSession), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostWithHttpMessagesAsync(string customName, UpdateSession body = default(UpdateSession), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string customName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AllCollectionTypes.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AllCollectionTypes.cs new file mode 100644 index 00000000000..70ef29abd0a --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AllCollectionTypes.cs @@ -0,0 +1,90 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AllCollectionTypes + /// + /// + /// AllCollectionTypes + /// + public partial class AllCollectionTypes + { + /// + /// Initializes a new instance of the AllCollectionTypes class. + /// + public AllCollectionTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AllCollectionTypes class. + /// + public AllCollectionTypes(IList intArray = default(IList), IList intList = default(IList), IList stringArray = default(IList), IList stringList = default(IList), IList pocoArray = default(IList), IList pocoList = default(IList), IDictionary> pocoLookup = default(IDictionary>), IDictionary>> pocoLookupMap = default(IDictionary>>)) + { + IntArray = intArray; + IntList = intList; + StringArray = stringArray; + StringList = stringList; + PocoArray = pocoArray; + PocoList = pocoList; + PocoLookup = pocoLookup; + PocoLookupMap = pocoLookupMap; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "IntArray")] + public IList IntArray { get; set; } + + /// + /// + [JsonProperty(PropertyName = "IntList")] + public IList IntList { get; set; } + + /// + /// + [JsonProperty(PropertyName = "StringArray")] + public IList StringArray { get; set; } + + /// + /// + [JsonProperty(PropertyName = "StringList")] + public IList StringList { get; set; } + + /// + /// + [JsonProperty(PropertyName = "PocoArray")] + public IList PocoArray { get; set; } + + /// + /// + [JsonProperty(PropertyName = "PocoList")] + public IList PocoList { get; set; } + + /// + /// + [JsonProperty(PropertyName = "PocoLookup")] + public IDictionary> PocoLookup { get; set; } + + /// + /// + [JsonProperty(PropertyName = "PocoLookupMap")] + public IDictionary>> PocoLookupMap { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AllTypes.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AllTypes.cs new file mode 100644 index 00000000000..79467771172 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AllTypes.cs @@ -0,0 +1,198 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AllTypes + /// + /// + /// AllTypes + /// + public partial class AllTypes + { + /// + /// Initializes a new instance of the AllTypes class. + /// + public AllTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AllTypes class. + /// + public AllTypes(int id = default(int), int? nullableId = default(int?), int byteProperty = default(int), int shortProperty = default(int), int intProperty = default(int), long longProperty = default(long), int uShortProperty = default(int), int uIntProperty = default(int), long uLongProperty = default(long), double floatProperty = default(double), double doubleProperty = default(double), double decimalProperty = default(double), string stringProperty = default(string), System.DateTime dateTimeProperty = default(System.DateTime), string timeSpanProperty = default(string), string dateTimeOffsetProperty = default(string), string guidProperty = default(string), string charProperty = default(string), KeyValuePairStringString keyValuePairProperty = default(KeyValuePairStringString), System.DateTime? nullableDateTime = default(System.DateTime?), string nullableTimeSpan = default(string), IList stringList = default(IList), IList stringArray = default(IList), IDictionary stringMap = default(IDictionary), IDictionary intStringMap = default(IDictionary), SubType subType = default(SubType)) + { + Id = id; + NullableId = nullableId; + ByteProperty = byteProperty; + ShortProperty = shortProperty; + IntProperty = intProperty; + LongProperty = longProperty; + UShortProperty = uShortProperty; + UIntProperty = uIntProperty; + ULongProperty = uLongProperty; + FloatProperty = floatProperty; + DoubleProperty = doubleProperty; + DecimalProperty = decimalProperty; + StringProperty = stringProperty; + DateTimeProperty = dateTimeProperty; + TimeSpanProperty = timeSpanProperty; + DateTimeOffsetProperty = dateTimeOffsetProperty; + GuidProperty = guidProperty; + CharProperty = charProperty; + KeyValuePairProperty = keyValuePairProperty; + NullableDateTime = nullableDateTime; + NullableTimeSpan = nullableTimeSpan; + StringList = stringList; + StringArray = stringArray; + StringMap = stringMap; + IntStringMap = intStringMap; + SubType = subType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Id")] + public int Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "NullableId")] + public int? NullableId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ByteProperty")] + public int ByteProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ShortProperty")] + public int ShortProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "IntProperty")] + public int IntProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "LongProperty")] + public long LongProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UShortProperty")] + public int UShortProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UIntProperty")] + public int UIntProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ULongProperty")] + public long ULongProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "FloatProperty")] + public double FloatProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "DoubleProperty")] + public double DoubleProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "DecimalProperty")] + public double DecimalProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "StringProperty")] + public string StringProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "DateTimeProperty")] + public System.DateTime DateTimeProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "TimeSpanProperty")] + public string TimeSpanProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "DateTimeOffsetProperty")] + public string DateTimeOffsetProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "GuidProperty")] + public string GuidProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "CharProperty")] + public string CharProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "KeyValuePairProperty")] + public KeyValuePairStringString KeyValuePairProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "NullableDateTime")] + public System.DateTime? NullableDateTime { get; set; } + + /// + /// + [JsonProperty(PropertyName = "NullableTimeSpan")] + public string NullableTimeSpan { get; set; } + + /// + /// + [JsonProperty(PropertyName = "StringList")] + public IList StringList { get; set; } + + /// + /// + [JsonProperty(PropertyName = "StringArray")] + public IList StringArray { get; set; } + + /// + /// + [JsonProperty(PropertyName = "StringMap")] + public IDictionary StringMap { get; set; } + + /// + /// + [JsonProperty(PropertyName = "IntStringMap")] + public IDictionary IntStringMap { get; set; } + + /// + /// + [JsonProperty(PropertyName = "SubType")] + public SubType SubType { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AllowedAttributes.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AllowedAttributes.cs new file mode 100644 index 00000000000..ac7f139e7bb --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AllowedAttributes.cs @@ -0,0 +1,48 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AllowedAttributes + /// + /// + /// AllowedAttributes Description + /// + public partial class AllowedAttributes + { + /// + /// Initializes a new instance of the AllowedAttributes class. + /// + public AllowedAttributes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AllowedAttributes class. + /// + /// Range Description + public AllowedAttributes(int aliased = default(int)) + { + Aliased = aliased; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets range Description + /// + [JsonProperty(PropertyName = "Aliased")] + public int Aliased { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ArrayResult.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ArrayResult.cs new file mode 100644 index 00000000000..3c446253d97 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ArrayResult.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ArrayResult + /// + /// + /// ArrayResult + /// + public partial class ArrayResult + { + /// + /// Initializes a new instance of the ArrayResult class. + /// + public ArrayResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArrayResult class. + /// + public ArrayResult(string result = default(string)) + { + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Result")] + public string Result { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AssignRoles.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AssignRoles.cs new file mode 100644 index 00000000000..079d4380fbe --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AssignRoles.cs @@ -0,0 +1,60 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AssignRoles + /// + /// + /// AssignRoles + /// + public partial class AssignRoles + { + /// + /// Initializes a new instance of the AssignRoles class. + /// + public AssignRoles() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignRoles class. + /// + public AssignRoles(string userName = default(string), IList permissions = default(IList), IList roles = default(IList)) + { + UserName = userName; + Permissions = permissions; + Roles = roles; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "UserName")] + public string UserName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Permissions")] + public IList Permissions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Roles")] + public IList Roles { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AssignRolesResponse.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AssignRolesResponse.cs new file mode 100644 index 00000000000..5da06f2f775 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AssignRolesResponse.cs @@ -0,0 +1,60 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AssignRolesResponse + /// + /// + /// AssignRolesResponse + /// + public partial class AssignRolesResponse + { + /// + /// Initializes a new instance of the AssignRolesResponse class. + /// + public AssignRolesResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignRolesResponse class. + /// + public AssignRolesResponse(IList allRoles = default(IList), IList allPermissions = default(IList), ResponseStatus responseStatus = default(ResponseStatus)) + { + AllRoles = allRoles; + AllPermissions = allPermissions; + ResponseStatus = responseStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "AllRoles")] + public IList AllRoles { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AllPermissions")] + public IList AllPermissions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ResponseStatus")] + public ResponseStatus ResponseStatus { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AssignRolesResponseException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AssignRolesResponseException.cs new file mode 100644 index 00000000000..64153de2baf --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AssignRolesResponseException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with AssignRolesResponse + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class AssignRolesResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public AssignRolesResponse Body { get; set; } + + /// + /// Initializes a new instance of the AssignRolesResponseException class. + /// + public AssignRolesResponseException() + { + } + + /// + /// Initializes a new instance of the AssignRolesResponseException class. + /// + /// The exception message. + public AssignRolesResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the AssignRolesResponseException class. + /// + /// The exception message. + /// Inner exception. + public AssignRolesResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the AssignRolesResponseException class. + /// + /// Serialization info. + /// Streaming context. + protected AssignRolesResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/Authenticate.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/Authenticate.cs new file mode 100644 index 00000000000..3ae1361a2a5 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/Authenticate.cs @@ -0,0 +1,150 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Authenticate + /// + /// + /// Authenticate + /// + public partial class Authenticate + { + /// + /// Initializes a new instance of the Authenticate class. + /// + public Authenticate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Authenticate class. + /// + public Authenticate(string provider = default(string), string state = default(string), string oauthToken = default(string), string oauthVerifier = default(string), string userName = default(string), string password = default(string), bool? rememberMe = default(bool?), string continueProperty = default(string), string nonce = default(string), string uri = default(string), string response = default(string), string qop = default(string), string nc = default(string), string cnonce = default(string), bool? useTokenCookie = default(bool?), string accessToken = default(string), string accessTokenSecret = default(string), IDictionary meta = default(IDictionary)) + { + Provider = provider; + State = state; + OauthToken = oauthToken; + OauthVerifier = oauthVerifier; + UserName = userName; + Password = password; + RememberMe = rememberMe; + ContinueProperty = continueProperty; + Nonce = nonce; + Uri = uri; + Response = response; + Qop = qop; + Nc = nc; + Cnonce = cnonce; + UseTokenCookie = useTokenCookie; + AccessToken = accessToken; + AccessTokenSecret = accessTokenSecret; + Meta = meta; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// + [JsonProperty(PropertyName = "State")] + public string State { get; set; } + + /// + /// + [JsonProperty(PropertyName = "oauth_token")] + public string OauthToken { get; set; } + + /// + /// + [JsonProperty(PropertyName = "oauth_verifier")] + public string OauthVerifier { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UserName")] + public string UserName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Password")] + public string Password { get; set; } + + /// + /// + [JsonProperty(PropertyName = "RememberMe")] + public bool? RememberMe { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Continue")] + public string ContinueProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "nonce")] + public string Nonce { get; set; } + + /// + /// + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + + /// + /// + [JsonProperty(PropertyName = "response")] + public string Response { get; set; } + + /// + /// + [JsonProperty(PropertyName = "qop")] + public string Qop { get; set; } + + /// + /// + [JsonProperty(PropertyName = "nc")] + public string Nc { get; set; } + + /// + /// + [JsonProperty(PropertyName = "cnonce")] + public string Cnonce { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UseTokenCookie")] + public bool? UseTokenCookie { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AccessToken")] + public string AccessToken { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AccessTokenSecret")] + public string AccessTokenSecret { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Meta")] + public IDictionary Meta { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AuthenticateResponse.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AuthenticateResponse.cs new file mode 100644 index 00000000000..903a1505fd3 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AuthenticateResponse.cs @@ -0,0 +1,96 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AuthenticateResponse + /// + /// + /// AuthenticateResponse + /// + public partial class AuthenticateResponse + { + /// + /// Initializes a new instance of the AuthenticateResponse class. + /// + public AuthenticateResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AuthenticateResponse class. + /// + public AuthenticateResponse(string userId = default(string), string sessionId = default(string), string userName = default(string), string displayName = default(string), string referrerUrl = default(string), string bearerToken = default(string), string refreshToken = default(string), ResponseStatus responseStatus = default(ResponseStatus), IDictionary meta = default(IDictionary)) + { + UserId = userId; + SessionId = sessionId; + UserName = userName; + DisplayName = displayName; + ReferrerUrl = referrerUrl; + BearerToken = bearerToken; + RefreshToken = refreshToken; + ResponseStatus = responseStatus; + Meta = meta; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "UserId")] + public string UserId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "SessionId")] + public string SessionId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UserName")] + public string UserName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "DisplayName")] + public string DisplayName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ReferrerUrl")] + public string ReferrerUrl { get; set; } + + /// + /// + [JsonProperty(PropertyName = "BearerToken")] + public string BearerToken { get; set; } + + /// + /// + [JsonProperty(PropertyName = "RefreshToken")] + public string RefreshToken { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ResponseStatus")] + public ResponseStatus ResponseStatus { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Meta")] + public IDictionary Meta { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AuthenticateResponseException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AuthenticateResponseException.cs new file mode 100644 index 00000000000..a28aafb8ddb --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/AuthenticateResponseException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with AuthenticateResponse + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class AuthenticateResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public AuthenticateResponse Body { get; set; } + + /// + /// Initializes a new instance of the AuthenticateResponseException class. + /// + public AuthenticateResponseException() + { + } + + /// + /// Initializes a new instance of the AuthenticateResponseException class. + /// + /// The exception message. + public AuthenticateResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the AuthenticateResponseException class. + /// + /// The exception message. + /// Inner exception. + public AuthenticateResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the AuthenticateResponseException class. + /// + /// Serialization info. + /// Streaming context. + protected AuthenticateResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/CustomUserSession.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/CustomUserSession.cs new file mode 100644 index 00000000000..7fad6995403 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/CustomUserSession.cs @@ -0,0 +1,312 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// CustomUserSession + /// + /// + /// CustomUserSession + /// + public partial class CustomUserSession + { + /// + /// Initializes a new instance of the CustomUserSession class. + /// + public CustomUserSession() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomUserSession class. + /// + public CustomUserSession(string customName = default(string), string customInfo = default(string), string referrerUrl = default(string), string id = default(string), string userAuthId = default(string), string userAuthName = default(string), string userName = default(string), string twitterUserId = default(string), string twitterScreenName = default(string), string facebookUserId = default(string), string facebookUserName = default(string), string firstName = default(string), string lastName = default(string), string displayName = default(string), string company = default(string), string email = default(string), string primaryEmail = default(string), string phoneNumber = default(string), System.DateTime? birthDate = default(System.DateTime?), string birthDateRaw = default(string), string address = default(string), string address2 = default(string), string city = default(string), string state = default(string), string country = default(string), string culture = default(string), string fullName = default(string), string gender = default(string), string language = default(string), string mailAddress = default(string), string nickname = default(string), string postalCode = default(string), string timeZone = default(string), string requestTokenSecret = default(string), System.DateTime createdAt = default(System.DateTime), System.DateTime lastModified = default(System.DateTime), IList roles = default(IList), IList permissions = default(IList), bool isAuthenticated = default(bool), bool fromToken = default(bool), string profileUrl = default(string), string sequence = default(string), long tag = default(long), string authProvider = default(string), IList providerOAuthAccess = default(IList)) + { + CustomName = customName; + CustomInfo = customInfo; + ReferrerUrl = referrerUrl; + Id = id; + UserAuthId = userAuthId; + UserAuthName = userAuthName; + UserName = userName; + TwitterUserId = twitterUserId; + TwitterScreenName = twitterScreenName; + FacebookUserId = facebookUserId; + FacebookUserName = facebookUserName; + FirstName = firstName; + LastName = lastName; + DisplayName = displayName; + Company = company; + Email = email; + PrimaryEmail = primaryEmail; + PhoneNumber = phoneNumber; + BirthDate = birthDate; + BirthDateRaw = birthDateRaw; + Address = address; + Address2 = address2; + City = city; + State = state; + Country = country; + Culture = culture; + FullName = fullName; + Gender = gender; + Language = language; + MailAddress = mailAddress; + Nickname = nickname; + PostalCode = postalCode; + TimeZone = timeZone; + RequestTokenSecret = requestTokenSecret; + CreatedAt = createdAt; + LastModified = lastModified; + Roles = roles; + Permissions = permissions; + IsAuthenticated = isAuthenticated; + FromToken = fromToken; + ProfileUrl = profileUrl; + Sequence = sequence; + Tag = tag; + AuthProvider = authProvider; + ProviderOAuthAccess = providerOAuthAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "CustomName")] + public string CustomName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "CustomInfo")] + public string CustomInfo { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ReferrerUrl")] + public string ReferrerUrl { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Id")] + public string Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UserAuthId")] + public string UserAuthId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UserAuthName")] + public string UserAuthName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UserName")] + public string UserName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "TwitterUserId")] + public string TwitterUserId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "TwitterScreenName")] + public string TwitterScreenName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "FacebookUserId")] + public string FacebookUserId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "FacebookUserName")] + public string FacebookUserName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "FirstName")] + public string FirstName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "LastName")] + public string LastName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "DisplayName")] + public string DisplayName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Company")] + public string Company { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Email")] + public string Email { get; set; } + + /// + /// + [JsonProperty(PropertyName = "PrimaryEmail")] + public string PrimaryEmail { get; set; } + + /// + /// + [JsonProperty(PropertyName = "PhoneNumber")] + public string PhoneNumber { get; set; } + + /// + /// + [JsonProperty(PropertyName = "BirthDate")] + public System.DateTime? BirthDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "BirthDateRaw")] + public string BirthDateRaw { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Address")] + public string Address { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Address2")] + public string Address2 { get; set; } + + /// + /// + [JsonProperty(PropertyName = "City")] + public string City { get; set; } + + /// + /// + [JsonProperty(PropertyName = "State")] + public string State { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Country")] + public string Country { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Culture")] + public string Culture { get; set; } + + /// + /// + [JsonProperty(PropertyName = "FullName")] + public string FullName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Gender")] + public string Gender { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Language")] + public string Language { get; set; } + + /// + /// + [JsonProperty(PropertyName = "MailAddress")] + public string MailAddress { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Nickname")] + public string Nickname { get; set; } + + /// + /// + [JsonProperty(PropertyName = "PostalCode")] + public string PostalCode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "TimeZone")] + public string TimeZone { get; set; } + + /// + /// + [JsonProperty(PropertyName = "RequestTokenSecret")] + public string RequestTokenSecret { get; set; } + + /// + /// + [JsonProperty(PropertyName = "CreatedAt")] + public System.DateTime CreatedAt { get; set; } + + /// + /// + [JsonProperty(PropertyName = "LastModified")] + public System.DateTime LastModified { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Roles")] + public IList Roles { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Permissions")] + public IList Permissions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "IsAuthenticated")] + public bool IsAuthenticated { get; set; } + + /// + /// + [JsonProperty(PropertyName = "FromToken")] + public bool FromToken { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ProfileUrl")] + public string ProfileUrl { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Sequence")] + public string Sequence { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Tag")] + public long Tag { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AuthProvider")] + public string AuthProvider { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ProviderOAuthAccess")] + public IList ProviderOAuthAccess { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetErrorModel.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetErrorModel.cs new file mode 100644 index 00000000000..cd01559c160 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetErrorModel.cs @@ -0,0 +1,52 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// KeyValuePair<String,String> + /// + /// + /// KeyValuePair<String,String> + /// + public partial class GetErrorModel + { + /// + /// Initializes a new instance of the GetErrorModel class. + /// + public GetErrorModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GetErrorModel class. + /// + public GetErrorModel(string key = default(string), string value = default(string)) + { + Key = key; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Key")] + public string Key { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Value")] + public string Value { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetErrorModelException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetErrorModelException.cs new file mode 100644 index 00000000000..f22ae689078 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetErrorModelException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with GetErrorModel + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class GetErrorModelException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public GetErrorModel Body { get; set; } + + /// + /// Initializes a new instance of the GetErrorModelException class. + /// + public GetErrorModelException() + { + } + + /// + /// Initializes a new instance of the GetErrorModelException class. + /// + /// The exception message. + public GetErrorModelException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the GetErrorModelException class. + /// + /// The exception message. + /// Inner exception. + public GetErrorModelException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the GetErrorModelException class. + /// + /// Serialization info. + /// Streaming context. + protected GetErrorModelException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetMovie.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetMovie.cs new file mode 100644 index 00000000000..a36c1da439d --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetMovie.cs @@ -0,0 +1,60 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// GetMovie + /// + /// + /// GetMovie + /// + public partial class GetMovie + { + /// + /// Initializes a new instance of the GetMovie class. + /// + public GetMovie() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GetMovie class. + /// + /// Required ID of Movie. + /// List of additional objects to include in the + /// movie response. + public GetMovie(long id = default(long), IList includes = default(IList)) + { + Id = id; + Includes = includes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets required ID of Movie. + /// + [JsonProperty(PropertyName = "Id")] + public long Id { get; set; } + + /// + /// Gets or sets list of additional objects to include in the movie + /// response. + /// + [JsonProperty(PropertyName = "Includes")] + public IList Includes { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetSessionResponse.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetSessionResponse.cs new file mode 100644 index 00000000000..a3faf8c0039 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetSessionResponse.cs @@ -0,0 +1,58 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// GetSessionResponse + /// + /// + /// GetSessionResponse + /// + public partial class GetSessionResponse + { + /// + /// Initializes a new instance of the GetSessionResponse class. + /// + public GetSessionResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GetSessionResponse class. + /// + public GetSessionResponse(CustomUserSession result = default(CustomUserSession), UnAuthInfo unAuthInfo = default(UnAuthInfo), ResponseStatus responseStatus = default(ResponseStatus)) + { + Result = result; + UnAuthInfo = unAuthInfo; + ResponseStatus = responseStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Result")] + public CustomUserSession Result { get; set; } + + /// + /// + [JsonProperty(PropertyName = "UnAuthInfo")] + public UnAuthInfo UnAuthInfo { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ResponseStatus")] + public ResponseStatus ResponseStatus { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetSessionResponseException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetSessionResponseException.cs new file mode 100644 index 00000000000..8f7054af4c9 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/GetSessionResponseException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with GetSessionResponse + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class GetSessionResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public GetSessionResponse Body { get; set; } + + /// + /// Initializes a new instance of the GetSessionResponseException class. + /// + public GetSessionResponseException() + { + } + + /// + /// Initializes a new instance of the GetSessionResponseException class. + /// + /// The exception message. + public GetSessionResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the GetSessionResponseException class. + /// + /// The exception message. + /// Inner exception. + public GetSessionResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the GetSessionResponseException class. + /// + /// Serialization info. + /// Streaming context. + protected GetSessionResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/Hello.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/Hello.cs new file mode 100644 index 00000000000..9f7731ec5c7 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/Hello.cs @@ -0,0 +1,52 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Hello + /// + /// + /// Hello + /// + public partial class Hello + { + /// + /// Initializes a new instance of the Hello class. + /// + public Hello() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Hello class. + /// + public Hello(string name = default(string), string title = default(string)) + { + Name = name; + Title = title; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Title")] + public string Title { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypes.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypes.cs new file mode 100644 index 00000000000..a08d0d3e5dc --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypes.cs @@ -0,0 +1,58 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloAllTypes + /// + /// + /// HelloAllTypes + /// + public partial class HelloAllTypes + { + /// + /// Initializes a new instance of the HelloAllTypes class. + /// + public HelloAllTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloAllTypes class. + /// + public HelloAllTypes(string name = default(string), AllTypes allTypes = default(AllTypes), AllCollectionTypes allCollectionTypes = default(AllCollectionTypes)) + { + Name = name; + AllTypes = allTypes; + AllCollectionTypes = allCollectionTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AllTypes")] + public AllTypes AllTypes { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AllCollectionTypes")] + public AllCollectionTypes AllCollectionTypes { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypesResponse.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypesResponse.cs new file mode 100644 index 00000000000..ad7bf3566c0 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypesResponse.cs @@ -0,0 +1,58 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloAllTypesResponse + /// + /// + /// HelloAllTypesResponse + /// + public partial class HelloAllTypesResponse + { + /// + /// Initializes a new instance of the HelloAllTypesResponse class. + /// + public HelloAllTypesResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloAllTypesResponse class. + /// + public HelloAllTypesResponse(string result = default(string), AllTypes allTypes = default(AllTypes), AllCollectionTypes allCollectionTypes = default(AllCollectionTypes)) + { + Result = result; + AllTypes = allTypes; + AllCollectionTypes = allCollectionTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Result")] + public string Result { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AllTypes")] + public AllTypes AllTypes { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AllCollectionTypes")] + public AllCollectionTypes AllCollectionTypes { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypesResponseException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypesResponseException.cs new file mode 100644 index 00000000000..28cc3a909ec --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypesResponseException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with HelloAllTypesResponse + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class HelloAllTypesResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public HelloAllTypesResponse Body { get; set; } + + /// + /// Initializes a new instance of the HelloAllTypesResponseException class. + /// + public HelloAllTypesResponseException() + { + } + + /// + /// Initializes a new instance of the HelloAllTypesResponseException class. + /// + /// The exception message. + public HelloAllTypesResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the HelloAllTypesResponseException class. + /// + /// The exception message. + /// Inner exception. + public HelloAllTypesResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the HelloAllTypesResponseException class. + /// + /// Serialization info. + /// Streaming context. + protected HelloAllTypesResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypesWithResult.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypesWithResult.cs new file mode 100644 index 00000000000..bce0544abfe --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloAllTypesWithResult.cs @@ -0,0 +1,58 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloAllTypesWithResult + /// + /// + /// HelloAllTypesWithResult + /// + public partial class HelloAllTypesWithResult + { + /// + /// Initializes a new instance of the HelloAllTypesWithResult class. + /// + public HelloAllTypesWithResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloAllTypesWithResult class. + /// + public HelloAllTypesWithResult(string name = default(string), AllTypes allTypes = default(AllTypes), AllCollectionTypes allCollectionTypes = default(AllCollectionTypes)) + { + Name = name; + AllTypes = allTypes; + AllCollectionTypes = allCollectionTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AllTypes")] + public AllTypes AllTypes { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AllCollectionTypes")] + public AllCollectionTypes AllCollectionTypes { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloArray.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloArray.cs new file mode 100644 index 00000000000..f4a2451bdcf --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloArray.cs @@ -0,0 +1,48 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// HelloArray + /// + /// + /// HelloArray + /// + public partial class HelloArray + { + /// + /// Initializes a new instance of the HelloArray class. + /// + public HelloArray() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloArray class. + /// + public HelloArray(IList names = default(IList)) + { + Names = names; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Names")] + public IList Names { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloDateTime.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloDateTime.cs new file mode 100644 index 00000000000..24a8d5058a0 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloDateTime.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloDateTime + /// + /// + /// HelloDateTime + /// + public partial class HelloDateTime + { + /// + /// Initializes a new instance of the HelloDateTime class. + /// + public HelloDateTime() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloDateTime class. + /// + public HelloDateTime(System.DateTime dateTime = default(System.DateTime)) + { + DateTime = dateTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "DateTime")] + public System.DateTime DateTime { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloDateTimeException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloDateTimeException.cs new file mode 100644 index 00000000000..894f7c39471 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloDateTimeException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with HelloDateTime + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class HelloDateTimeException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public HelloDateTime Body { get; set; } + + /// + /// Initializes a new instance of the HelloDateTimeException class. + /// + public HelloDateTimeException() + { + } + + /// + /// Initializes a new instance of the HelloDateTimeException class. + /// + /// The exception message. + public HelloDateTimeException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the HelloDateTimeException class. + /// + /// The exception message. + /// Inner exception. + public HelloDateTimeException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the HelloDateTimeException class. + /// + /// Serialization info. + /// Streaming context. + protected HelloDateTimeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloList.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloList.cs new file mode 100644 index 00000000000..1b783161f8f --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloList.cs @@ -0,0 +1,48 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// HelloList + /// + /// + /// HelloList + /// + public partial class HelloList + { + /// + /// Initializes a new instance of the HelloList class. + /// + public HelloList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloList class. + /// + public HelloList(IList names = default(IList)) + { + Names = names; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Names")] + public IList Names { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloResponse.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloResponse.cs new file mode 100644 index 00000000000..d56e8b3e92e --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloResponse.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloResponse + /// + /// + /// HelloResponse + /// + public partial class HelloResponse + { + /// + /// Initializes a new instance of the HelloResponse class. + /// + public HelloResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloResponse class. + /// + public HelloResponse(string result = default(string)) + { + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Result")] + public string Result { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloResponseException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloResponseException.cs new file mode 100644 index 00000000000..de8000c78e1 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloResponseException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with HelloResponse + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class HelloResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public HelloResponse Body { get; set; } + + /// + /// Initializes a new instance of the HelloResponseException class. + /// + public HelloResponseException() + { + } + + /// + /// Initializes a new instance of the HelloResponseException class. + /// + /// The exception message. + public HelloResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the HelloResponseException class. + /// + /// The exception message. + /// Inner exception. + public HelloResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the HelloResponseException class. + /// + /// Serialization info. + /// Streaming context. + protected HelloResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloString.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloString.cs new file mode 100644 index 00000000000..c8aa3038b5d --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloString.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloString + /// + /// + /// HelloString + /// + public partial class HelloString + { + /// + /// Initializes a new instance of the HelloString class. + /// + public HelloString() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloString class. + /// + public HelloString(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloTypes.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloTypes.cs new file mode 100644 index 00000000000..1cc6d54b055 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloTypes.cs @@ -0,0 +1,58 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloTypes + /// + /// + /// HelloTypes + /// + public partial class HelloTypes + { + /// + /// Initializes a new instance of the HelloTypes class. + /// + public HelloTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloTypes class. + /// + public HelloTypes(string stringProperty = default(string), bool boolProperty = default(bool), int intProperty = default(int)) + { + StringProperty = stringProperty; + BoolProperty = boolProperty; + IntProperty = intProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "String")] + public string StringProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Bool")] + public bool BoolProperty { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Int")] + public int IntProperty { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloTypesException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloTypesException.cs new file mode 100644 index 00000000000..403bc3f9ea1 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloTypesException.cs @@ -0,0 +1,92 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with HelloTypes information. + /// +#if LEGACY + [System.Serializable] +#endif + public class HelloTypesException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public HelloTypes Body { get; set; } + + /// + /// Initializes a new instance of the HelloTypesException class. + /// + public HelloTypesException() + { + } + + /// + /// Initializes a new instance of the HelloTypesException class. + /// + /// The exception message. + public HelloTypesException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the HelloTypesException class. + /// + /// The exception message. + /// Inner exception. + public HelloTypesException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the HelloTypesException class. + /// + /// Serialization info. + /// Streaming context. + protected HelloTypesException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloVoid.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloVoid.cs new file mode 100644 index 00000000000..46ae22a87bb --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloVoid.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloVoid + /// + /// + /// HelloVoid + /// + public partial class HelloVoid + { + /// + /// Initializes a new instance of the HelloVoid class. + /// + public HelloVoid() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloVoid class. + /// + public HelloVoid(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloWithRoute.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloWithRoute.cs new file mode 100644 index 00000000000..9ed066d65bd --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloWithRoute.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloWithRoute + /// + /// + /// HelloWithRoute + /// + public partial class HelloWithRoute + { + /// + /// Initializes a new instance of the HelloWithRoute class. + /// + public HelloWithRoute() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloWithRoute class. + /// + public HelloWithRoute(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloZip.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloZip.cs new file mode 100644 index 00000000000..6c55ff70a74 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloZip.cs @@ -0,0 +1,54 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// HelloZip + /// + /// + /// HelloZip + /// + public partial class HelloZip + { + /// + /// Initializes a new instance of the HelloZip class. + /// + public HelloZip() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloZip class. + /// + public HelloZip(string name = default(string), IList test = default(IList)) + { + Name = name; + Test = test; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Test")] + public IList Test { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloZipResponse.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloZipResponse.cs new file mode 100644 index 00000000000..5ca648a5634 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloZipResponse.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// HelloZipResponse + /// + /// + /// HelloZipResponse + /// + public partial class HelloZipResponse + { + /// + /// Initializes a new instance of the HelloZipResponse class. + /// + public HelloZipResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelloZipResponse class. + /// + public HelloZipResponse(string result = default(string)) + { + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Result")] + public string Result { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloZipResponseException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloZipResponseException.cs new file mode 100644 index 00000000000..306d687a8e6 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/HelloZipResponseException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with HelloZipResponse + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class HelloZipResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public HelloZipResponse Body { get; set; } + + /// + /// Initializes a new instance of the HelloZipResponseException class. + /// + public HelloZipResponseException() + { + } + + /// + /// Initializes a new instance of the HelloZipResponseException class. + /// + /// The exception message. + public HelloZipResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the HelloZipResponseException class. + /// + /// The exception message. + /// Inner exception. + public HelloZipResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the HelloZipResponseException class. + /// + /// Serialization info. + /// Streaming context. + protected HelloZipResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/KeyValuePairStringString.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/KeyValuePairStringString.cs new file mode 100644 index 00000000000..da928d7b377 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/KeyValuePairStringString.cs @@ -0,0 +1,52 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// KeyValuePair<String,String> + /// + /// + /// KeyValuePair<String,String> + /// + public partial class KeyValuePairStringString + { + /// + /// Initializes a new instance of the KeyValuePairStringString class. + /// + public KeyValuePairStringString() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyValuePairStringString class. + /// + public KeyValuePairStringString(string key = default(string), string value = default(string)) + { + Key = key; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Key")] + public string Key { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Value")] + public string Value { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ListResult.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ListResult.cs new file mode 100644 index 00000000000..f422e2c439e --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ListResult.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ListResult + /// + /// + /// ListResult + /// + public partial class ListResult + { + /// + /// Initializes a new instance of the ListResult class. + /// + public ListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ListResult class. + /// + public ListResult(string result = default(string)) + { + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Result")] + public string Result { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/MovieResponse.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/MovieResponse.cs new file mode 100644 index 00000000000..9ed0cd9257e --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/MovieResponse.cs @@ -0,0 +1,48 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// MovieResponse + /// + /// + /// MovieResponse + /// + public partial class MovieResponse + { + /// + /// Initializes a new instance of the MovieResponse class. + /// + public MovieResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MovieResponse class. + /// + public MovieResponse(IList includes = default(IList)) + { + Includes = includes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Includes")] + public IList Includes { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/MovieResponseException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/MovieResponseException.cs new file mode 100644 index 00000000000..3941e42801f --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/MovieResponseException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with MovieResponse + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class MovieResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public MovieResponse Body { get; set; } + + /// + /// Initializes a new instance of the MovieResponseException class. + /// + public MovieResponseException() + { + } + + /// + /// Initializes a new instance of the MovieResponseException class. + /// + /// The exception message. + public MovieResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the MovieResponseException class. + /// + /// The exception message. + /// Inner exception. + public MovieResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the MovieResponseException class. + /// + /// Serialization info. + /// Streaming context. + protected MovieResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/Poco.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/Poco.cs new file mode 100644 index 00000000000..d18b3b77940 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/Poco.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Poco + /// + /// + /// Poco + /// + public partial class Poco + { + /// + /// Initializes a new instance of the Poco class. + /// + public Poco() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Poco class. + /// + public Poco(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ResponseError.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ResponseError.cs new file mode 100644 index 00000000000..4966a5f11de --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ResponseError.cs @@ -0,0 +1,66 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ResponseError + /// + /// + /// ResponseError + /// + public partial class ResponseError + { + /// + /// Initializes a new instance of the ResponseError class. + /// + public ResponseError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResponseError class. + /// + public ResponseError(string errorCode = default(string), string fieldName = default(string), string message = default(string), IDictionary meta = default(IDictionary)) + { + ErrorCode = errorCode; + FieldName = fieldName; + Message = message; + Meta = meta; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "ErrorCode")] + public string ErrorCode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "FieldName")] + public string FieldName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Message")] + public string Message { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Meta")] + public IDictionary Meta { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ResponseStatus.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ResponseStatus.cs new file mode 100644 index 00000000000..ff3a7528624 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ResponseStatus.cs @@ -0,0 +1,72 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ResponseStatus + /// + /// + /// ResponseStatus + /// + public partial class ResponseStatus + { + /// + /// Initializes a new instance of the ResponseStatus class. + /// + public ResponseStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResponseStatus class. + /// + public ResponseStatus(string errorCode = default(string), string message = default(string), string stackTrace = default(string), IList errors = default(IList), IDictionary meta = default(IDictionary)) + { + ErrorCode = errorCode; + Message = message; + StackTrace = stackTrace; + Errors = errors; + Meta = meta; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "ErrorCode")] + public string ErrorCode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Message")] + public string Message { get; set; } + + /// + /// + [JsonProperty(PropertyName = "StackTrace")] + public string StackTrace { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Errors")] + public IList Errors { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Meta")] + public IDictionary Meta { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ReturnedDto.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ReturnedDto.cs new file mode 100644 index 00000000000..55f1e625200 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/ReturnedDto.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ReturnedDto + /// + /// + /// ReturnedDto + /// + public partial class ReturnedDto + { + /// + /// Initializes a new instance of the ReturnedDto class. + /// + public ReturnedDto() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReturnedDto class. + /// + public ReturnedDto(int id = default(int)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Id")] + public int Id { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/SubType.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/SubType.cs new file mode 100644 index 00000000000..b66e398d646 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/SubType.cs @@ -0,0 +1,52 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// SubType + /// + /// + /// SubType + /// + public partial class SubType + { + /// + /// Initializes a new instance of the SubType class. + /// + public SubType() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubType class. + /// + public SubType(int id = default(int), string name = default(string)) + { + Id = id; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Id")] + public int Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAssignRoles.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAssignRoles.cs new file mode 100644 index 00000000000..cf08a8c3ed6 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAssignRoles.cs @@ -0,0 +1,60 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// UnAssignRoles + /// + /// + /// UnAssignRoles + /// + public partial class UnAssignRoles + { + /// + /// Initializes a new instance of the UnAssignRoles class. + /// + public UnAssignRoles() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UnAssignRoles class. + /// + public UnAssignRoles(string userName = default(string), IList permissions = default(IList), IList roles = default(IList)) + { + UserName = userName; + Permissions = permissions; + Roles = roles; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "UserName")] + public string UserName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Permissions")] + public IList Permissions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Roles")] + public IList Roles { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAssignRolesResponse.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAssignRolesResponse.cs new file mode 100644 index 00000000000..4c5cb485285 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAssignRolesResponse.cs @@ -0,0 +1,60 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// UnAssignRolesResponse + /// + /// + /// UnAssignRolesResponse + /// + public partial class UnAssignRolesResponse + { + /// + /// Initializes a new instance of the UnAssignRolesResponse class. + /// + public UnAssignRolesResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UnAssignRolesResponse class. + /// + public UnAssignRolesResponse(IList allRoles = default(IList), IList allPermissions = default(IList), ResponseStatus responseStatus = default(ResponseStatus)) + { + AllRoles = allRoles; + AllPermissions = allPermissions; + ResponseStatus = responseStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "AllRoles")] + public IList AllRoles { get; set; } + + /// + /// + [JsonProperty(PropertyName = "AllPermissions")] + public IList AllPermissions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ResponseStatus")] + public ResponseStatus ResponseStatus { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAssignRolesResponseException.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAssignRolesResponseException.cs new file mode 100644 index 00000000000..80b1975fe78 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAssignRolesResponseException.cs @@ -0,0 +1,93 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with UnAssignRolesResponse + /// information. + /// +#if LEGACY + [System.Serializable] +#endif + public class UnAssignRolesResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public UnAssignRolesResponse Body { get; set; } + + /// + /// Initializes a new instance of the UnAssignRolesResponseException class. + /// + public UnAssignRolesResponseException() + { + } + + /// + /// Initializes a new instance of the UnAssignRolesResponseException class. + /// + /// The exception message. + public UnAssignRolesResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the UnAssignRolesResponseException class. + /// + /// The exception message. + /// Inner exception. + public UnAssignRolesResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + +#if LEGACY + /// + /// Initializes a new instance of the UnAssignRolesResponseException class. + /// + /// Serialization info. + /// Streaming context. + protected UnAssignRolesResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + /// + /// Serializes content of the exception. + /// + /// Serialization info. + /// Streaming context. + /// + /// Thrown when a required parameter is null + /// + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + base.GetObjectData(info, context); + if (info == null) + { + throw new System.ArgumentNullException("info"); + } + + info.AddValue("Request", Request); + info.AddValue("Response", Response); + info.AddValue("Body", Body); + } +#endif + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAuthInfo.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAuthInfo.cs new file mode 100644 index 00000000000..950274262fb --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UnAuthInfo.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// UnAuthInfo + /// + /// + /// UnAuthInfo + /// + public partial class UnAuthInfo + { + /// + /// Initializes a new instance of the UnAuthInfo class. + /// + public UnAuthInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UnAuthInfo class. + /// + public UnAuthInfo(string customInfo = default(string)) + { + CustomInfo = customInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "CustomInfo")] + public string CustomInfo { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UpdateSession.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UpdateSession.cs new file mode 100644 index 00000000000..925a6b67df8 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/Models/UpdateSession.cs @@ -0,0 +1,46 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// UpdateSession + /// + /// + /// UpdateSession + /// + public partial class UpdateSession + { + /// + /// Initializes a new instance of the UpdateSession class. + /// + public UpdateSession() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateSession class. + /// + public UpdateSession(string customName = default(string)) + { + CustomName = customName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "CustomName")] + public string CustomName { get; set; } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnArrayRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnArrayRequest.cs new file mode 100644 index 00000000000..3a6bab856c3 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnArrayRequest.cs @@ -0,0 +1,172 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnArrayRequest operations. + /// + public partial class ReturnArrayRequest : IServiceOperations, IReturnArrayRequest + { + /// + /// Initializes a new instance of the ReturnArrayRequest class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public ReturnArrayRequest(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "return-array").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnArrayRequestExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnArrayRequestExtensions.cs new file mode 100644 index 00000000000..f3fcc6aca8b --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnArrayRequestExtensions.cs @@ -0,0 +1,41 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReturnArrayRequest. + /// + public static partial class ReturnArrayRequestExtensions + { + /// + /// The operations group for this extension method. + /// + public static IList Get(this IReturnArrayRequest operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetAsync(this IReturnArrayRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryDtoRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryDtoRequest.cs new file mode 100644 index 00000000000..5f30509950e --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryDtoRequest.cs @@ -0,0 +1,172 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnDictionaryDtoRequest operations. + /// + public partial class ReturnDictionaryDtoRequest : IServiceOperations, IReturnDictionaryDtoRequest + { + /// + /// Initializes a new instance of the ReturnDictionaryDtoRequest class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public ReturnDictionaryDtoRequest(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "return-dictionarydto").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IDictionary _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryDtoRequestExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryDtoRequestExtensions.cs new file mode 100644 index 00000000000..d5414d84f3c --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryDtoRequestExtensions.cs @@ -0,0 +1,41 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReturnDictionaryDtoRequest. + /// + public static partial class ReturnDictionaryDtoRequestExtensions + { + /// + /// The operations group for this extension method. + /// + public static IDictionary Get(this IReturnDictionaryDtoRequest operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetAsync(this IReturnDictionaryDtoRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryStringRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryStringRequest.cs new file mode 100644 index 00000000000..2d0777d21df --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryStringRequest.cs @@ -0,0 +1,172 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnDictionaryStringRequest operations. + /// + public partial class ReturnDictionaryStringRequest : IServiceOperations, IReturnDictionaryStringRequest + { + /// + /// Initializes a new instance of the ReturnDictionaryStringRequest class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public ReturnDictionaryStringRequest(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "return-dictionarystring").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IDictionary _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryStringRequestExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryStringRequestExtensions.cs new file mode 100644 index 00000000000..180bf0f40ab --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnDictionaryStringRequestExtensions.cs @@ -0,0 +1,41 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReturnDictionaryStringRequest. + /// + public static partial class ReturnDictionaryStringRequestExtensions + { + /// + /// The operations group for this extension method. + /// + public static IDictionary Get(this IReturnDictionaryStringRequest operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetAsync(this IReturnDictionaryStringRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnKeyValuePairRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnKeyValuePairRequest.cs new file mode 100644 index 00000000000..35c52bafdf1 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnKeyValuePairRequest.cs @@ -0,0 +1,172 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnKeyValuePairRequest operations. + /// + public partial class ReturnKeyValuePairRequest : IServiceOperations, IReturnKeyValuePairRequest + { + /// + /// Initializes a new instance of the ReturnKeyValuePairRequest class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public ReturnKeyValuePairRequest(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "return-keyvaluepair").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new GetErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GetErrorModel _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnKeyValuePairRequestExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnKeyValuePairRequestExtensions.cs new file mode 100644 index 00000000000..dbdbf5cdae1 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnKeyValuePairRequestExtensions.cs @@ -0,0 +1,39 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReturnKeyValuePairRequest. + /// + public static partial class ReturnKeyValuePairRequestExtensions + { + /// + /// The operations group for this extension method. + /// + public static GetErrorModel Get(this IReturnKeyValuePairRequest operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IReturnKeyValuePairRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnListRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnListRequest.cs new file mode 100644 index 00000000000..59cc44eeab7 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnListRequest.cs @@ -0,0 +1,172 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReturnListRequest operations. + /// + public partial class ReturnListRequest : IServiceOperations, IReturnListRequest + { + /// + /// Initializes a new instance of the ReturnListRequest class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public ReturnListRequest(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "return-list").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + IList _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnListRequestExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnListRequestExtensions.cs new file mode 100644 index 00000000000..690033ea09b --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ReturnListRequestExtensions.cs @@ -0,0 +1,41 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReturnListRequest. + /// + public static partial class ReturnListRequestExtensions + { + /// + /// The operations group for this extension method. + /// + public static IList Get(this IReturnListRequest operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetAsync(this IReturnListRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredDtoRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredDtoRequest.cs new file mode 100644 index 00000000000..695b8e879ad --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredDtoRequest.cs @@ -0,0 +1,565 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecuredDtoRequest operations. + /// + public partial class SecuredDtoRequest : IServiceOperations, ISecuredDtoRequest + { + /// + /// Initializes a new instance of the SecuredDtoRequest class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SecuredDtoRequest(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-dto-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-dto-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-dto-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-dto-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredDtoRequestExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredDtoRequestExtensions.cs new file mode 100644 index 00000000000..b696cab49ff --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredDtoRequestExtensions.cs @@ -0,0 +1,113 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SecuredDtoRequest. + /// + public static partial class SecuredDtoRequestExtensions + { + /// + /// The operations group for this extension method. + /// + public static string Get(this ISecuredDtoRequest operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISecuredDtoRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static string Create(this ISecuredDtoRequest operations, object body = default(object)) + { + return operations.CreateAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISecuredDtoRequest operations, object body = default(object), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static string Post(this ISecuredDtoRequest operations, object body = default(object)) + { + return operations.PostAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this ISecuredDtoRequest operations, object body = default(object), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + public static string Delete(this ISecuredDtoRequest operations) + { + return operations.DeleteAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISecuredDtoRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredOpsRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredOpsRequest.cs new file mode 100644 index 00000000000..2c0f81c4a60 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredOpsRequest.cs @@ -0,0 +1,565 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecuredOpsRequest operations. + /// + public partial class SecuredOpsRequest : IServiceOperations, ISecuredOpsRequest + { + /// + /// Initializes a new instance of the SecuredOpsRequest class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SecuredOpsRequest(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-ops-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-ops-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-ops-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-ops-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredOpsRequestExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredOpsRequestExtensions.cs new file mode 100644 index 00000000000..194e6e7ce05 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredOpsRequestExtensions.cs @@ -0,0 +1,113 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SecuredOpsRequest. + /// + public static partial class SecuredOpsRequestExtensions + { + /// + /// The operations group for this extension method. + /// + public static string Get(this ISecuredOpsRequest operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISecuredOpsRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static string Create(this ISecuredOpsRequest operations, object body = default(object)) + { + return operations.CreateAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISecuredOpsRequest operations, object body = default(object), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static string Post(this ISecuredOpsRequest operations, object body = default(object)) + { + return operations.PostAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this ISecuredOpsRequest operations, object body = default(object), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + public static string Delete(this ISecuredOpsRequest operations) + { + return operations.DeleteAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISecuredOpsRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredRequest.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredRequest.cs new file mode 100644 index 00000000000..3b0e0742220 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredRequest.cs @@ -0,0 +1,565 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecuredRequest operations. + /// + public partial class SecuredRequest : IServiceOperations, ISecuredRequest + { + /// + /// Initializes a new instance of the SecuredRequest class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SecuredRequest(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(object body = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "secured-service").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + string _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredRequestExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredRequestExtensions.cs new file mode 100644 index 00000000000..2038b5c5ffc --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/SecuredRequestExtensions.cs @@ -0,0 +1,113 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SecuredRequest. + /// + public static partial class SecuredRequestExtensions + { + /// + /// The operations group for this extension method. + /// + public static string Get(this ISecuredRequest operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISecuredRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static string Create(this ISecuredRequest operations, object body = default(object)) + { + return operations.CreateAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISecuredRequest operations, object body = default(object), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static string Post(this ISecuredRequest operations, object body = default(object)) + { + return operations.PostAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this ISecuredRequest operations, object body = default(object), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + public static string Delete(this ISecuredRequest operations) + { + return operations.DeleteAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISecuredRequest operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ServiceStackAutorestClient.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ServiceStackAutorestClient.cs new file mode 100644 index 00000000000..89a7d3978e7 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/ServiceStackAutorestClient.cs @@ -0,0 +1,327 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + + public partial class ServiceStackAutorestClient : ServiceClient, IServiceStackAutorestClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Accept Header + /// + public string Accept { get; private set; } + + /// + /// Gets the IReturnListRequest. + /// + public virtual IReturnListRequest ReturnListRequest { get; private set; } + + /// + /// Gets the IReturnArrayRequest. + /// + public virtual IReturnArrayRequest ReturnArrayRequest { get; private set; } + + /// + /// Gets the IReturnKeyValuePairRequest. + /// + public virtual IReturnKeyValuePairRequest ReturnKeyValuePairRequest { get; private set; } + + /// + /// Gets the IReturnDictionaryStringRequest. + /// + public virtual IReturnDictionaryStringRequest ReturnDictionaryStringRequest { get; private set; } + + /// + /// Gets the IReturnDictionaryDtoRequest. + /// + public virtual IReturnDictionaryDtoRequest ReturnDictionaryDtoRequest { get; private set; } + + /// + /// Gets the IGetMovieId. + /// + public virtual IGetMovieId GetMovieId { get; private set; } + + /// + /// Gets the IHelloOperations. + /// + public virtual IHelloOperations Hello { get; private set; } + + /// + /// Gets the IHelloName. + /// + public virtual IHelloName HelloName { get; private set; } + + /// + /// Gets the IHelloListOperations. + /// + public virtual IHelloListOperations HelloList { get; private set; } + + /// + /// Gets the IHelloArrayOperations. + /// + public virtual IHelloArrayOperations HelloArray { get; private set; } + + /// + /// Gets the IAllowedAttributesOperations. + /// + public virtual IAllowedAttributesOperations AllowedAttributes { get; private set; } + + /// + /// Gets the IHelloAllTypesOperations. + /// + public virtual IHelloAllTypesOperations HelloAllTypes { get; private set; } + + /// + /// Gets the IHelloAllTypesWithResultOperations. + /// + public virtual IHelloAllTypesWithResultOperations HelloAllTypesWithResult { get; private set; } + + /// + /// Gets the IHelloStringOperations. + /// + public virtual IHelloStringOperations HelloString { get; private set; } + + /// + /// Gets the IHelloDateTimeOperations. + /// + public virtual IHelloDateTimeOperations HelloDateTime { get; private set; } + + /// + /// Gets the IHelloVoidOperations. + /// + public virtual IHelloVoidOperations HelloVoid { get; private set; } + + /// + /// Gets the IHelloWithRouteOperations. + /// + public virtual IHelloWithRouteOperations HelloWithRoute { get; private set; } + + /// + /// Gets the IHelloTypesOperations. + /// + public virtual IHelloTypesOperations HelloTypes { get; private set; } + + /// + /// Gets the IHelloZipOperations. + /// + public virtual IHelloZipOperations HelloZip { get; private set; } + + /// + /// Gets the ISecuredRequest. + /// + public virtual ISecuredRequest SecuredRequest { get; private set; } + + /// + /// Gets the ISecuredDtoRequest. + /// + public virtual ISecuredDtoRequest SecuredDtoRequest { get; private set; } + + /// + /// Gets the ISecuredOpsRequest. + /// + public virtual ISecuredOpsRequest SecuredOpsRequest { get; private set; } + + /// + /// Gets the IGetSession. + /// + public virtual IGetSession GetSession { get; private set; } + + /// + /// Gets the IUpdateSessioneditCustomName. + /// + public virtual IUpdateSessioneditCustomName UpdateSessioneditCustomName { get; private set; } + + /// + /// Gets the IAuthenticateOperations. + /// + public virtual IAuthenticateOperations Authenticate { get; private set; } + + /// + /// Gets the IAuthenticateprovider. + /// + public virtual IAuthenticateprovider Authenticateprovider { get; private set; } + + /// + /// Gets the IAuthenticate2. + /// + public virtual IAuthenticate2 Authenticate2 { get; private set; } + + /// + /// Gets the IAuthenticateprovider2. + /// + public virtual IAuthenticateprovider2 Authenticateprovider2 { get; private set; } + + /// + /// Gets the IAssignRolesOperations. + /// + public virtual IAssignRolesOperations AssignRoles { get; private set; } + + /// + /// Gets the IUnAssignRolesOperations. + /// + public virtual IUnAssignRolesOperations UnAssignRoles { get; private set; } + + /// + /// Initializes a new instance of the ServiceStackAutorestClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + public ServiceStackAutorestClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ServiceStackAutorestClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + public ServiceStackAutorestClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ServiceStackAutorestClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ServiceStackAutorestClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ServiceStackAutorestClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ServiceStackAutorestClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + ReturnListRequest = new ReturnListRequest(this); + ReturnArrayRequest = new ReturnArrayRequest(this); + ReturnKeyValuePairRequest = new ReturnKeyValuePairRequest(this); + ReturnDictionaryStringRequest = new ReturnDictionaryStringRequest(this); + ReturnDictionaryDtoRequest = new ReturnDictionaryDtoRequest(this); + GetMovieId = new GetMovieId(this); + Hello = new HelloOperations(this); + HelloName = new HelloName(this); + HelloList = new HelloListOperations(this); + HelloArray = new HelloArrayOperations(this); + AllowedAttributes = new AllowedAttributesOperations(this); + HelloAllTypes = new HelloAllTypesOperations(this); + HelloAllTypesWithResult = new HelloAllTypesWithResultOperations(this); + HelloString = new HelloStringOperations(this); + HelloDateTime = new HelloDateTimeOperations(this); + HelloVoid = new HelloVoidOperations(this); + HelloWithRoute = new HelloWithRouteOperations(this); + HelloTypes = new HelloTypesOperations(this); + HelloZip = new HelloZipOperations(this); + SecuredRequest = new SecuredRequest(this); + SecuredDtoRequest = new SecuredDtoRequest(this); + SecuredOpsRequest = new SecuredOpsRequest(this); + GetSession = new GetSession(this); + UpdateSessioneditCustomName = new UpdateSessioneditCustomName(this); + Authenticate = new AuthenticateOperations(this); + Authenticateprovider = new Authenticateprovider(this); + Authenticate2 = new Authenticate2(this); + Authenticateprovider2 = new Authenticateprovider2(this); + AssignRoles = new AssignRolesOperations(this); + UnAssignRoles = new UnAssignRolesOperations(this); + BaseUri = new System.Uri("http://localhost:20000/"); + Accept = "application/json"; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + } + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UnAssignRolesOperations.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UnAssignRolesOperations.cs new file mode 100644 index 00000000000..e950258959d --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UnAssignRolesOperations.cs @@ -0,0 +1,635 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UnAssignRolesOperations operations. + /// + public partial class UnAssignRolesOperations : IServiceOperations, IUnAssignRolesOperations + { + /// + /// Initializes a new instance of the UnAssignRolesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public UnAssignRolesOperations(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("userName", userName); + tracingParameters.Add("permissions", permissions); + tracingParameters.Add("roles", roles); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "unassignroles").ToString(); + List _queryParameters = new List(); + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (permissions != null) + { + _queryParameters.Add(string.Format("Permissions={0}", System.Uri.EscapeDataString(permissions))); + } + if (roles != null) + { + _queryParameters.Add(string.Format("Roles={0}", System.Uri.EscapeDataString(roles))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new UnAssignRolesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + UnAssignRolesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), UnAssignRoles body = default(UnAssignRoles), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("userName", userName); + tracingParameters.Add("permissions", permissions); + tracingParameters.Add("roles", roles); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "unassignroles").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new UnAssignRolesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + UnAssignRolesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), UnAssignRoles body = default(UnAssignRoles), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("userName", userName); + tracingParameters.Add("permissions", permissions); + tracingParameters.Add("roles", roles); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "unassignroles").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new UnAssignRolesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + UnAssignRolesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string userName = default(string), string permissions = default(string), string roles = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("userName", userName); + tracingParameters.Add("permissions", permissions); + tracingParameters.Add("roles", roles); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "unassignroles").ToString(); + List _queryParameters = new List(); + if (userName != null) + { + _queryParameters.Add(string.Format("UserName={0}", System.Uri.EscapeDataString(userName))); + } + if (permissions != null) + { + _queryParameters.Add(string.Format("Permissions={0}", System.Uri.EscapeDataString(permissions))); + } + if (roles != null) + { + _queryParameters.Add(string.Format("Roles={0}", System.Uri.EscapeDataString(roles))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new UnAssignRolesResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + UnAssignRolesResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UnAssignRolesOperationsExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UnAssignRolesOperationsExtensions.cs new file mode 100644 index 00000000000..f3ac294bdff --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UnAssignRolesOperationsExtensions.cs @@ -0,0 +1,161 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for UnAssignRolesOperations. + /// + public static partial class UnAssignRolesOperationsExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static UnAssignRolesResponse Get(this IUnAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string)) + { + return operations.GetAsync(userName, permissions, roles).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IUnAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(userName, permissions, roles, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static UnAssignRolesResponse Create(this IUnAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), UnAssignRoles body = default(UnAssignRoles)) + { + return operations.CreateAsync(userName, permissions, roles, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IUnAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), UnAssignRoles body = default(UnAssignRoles), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(userName, permissions, roles, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static UnAssignRolesResponse Post(this IUnAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), UnAssignRoles body = default(UnAssignRoles)) + { + return operations.PostAsync(userName, permissions, roles, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IUnAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), UnAssignRoles body = default(UnAssignRoles), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(userName, permissions, roles, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + public static UnAssignRolesResponse Delete(this IUnAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string)) + { + return operations.DeleteAsync(userName, permissions, roles).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IUnAssignRolesOperations operations, string userName = default(string), string permissions = default(string), string roles = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(userName, permissions, roles, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UpdateSessioneditCustomName.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UpdateSessioneditCustomName.cs new file mode 100644 index 00000000000..c0bf2379dab --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UpdateSessioneditCustomName.cs @@ -0,0 +1,621 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UpdateSessioneditCustomName operations. + /// + public partial class UpdateSessioneditCustomName : IServiceOperations, IUpdateSessioneditCustomName + { + /// + /// Initializes a new instance of the UpdateSessioneditCustomName class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public UpdateSessioneditCustomName(ServiceStackAutorestClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceStackAutorestClient + /// + public ServiceStackAutorestClient Client { get; private set; } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string customName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (customName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("customName", customName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "session/edit/{CustomName}").ToString(); + _url = _url.Replace("{CustomName}", System.Uri.EscapeDataString(customName)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new GetSessionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GetSessionResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string customName, UpdateSession body = default(UpdateSession), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (customName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("customName", customName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "session/edit/{CustomName}").ToString(); + _url = _url.Replace("{CustomName}", System.Uri.EscapeDataString(customName)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new GetSessionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GetSessionResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostWithHttpMessagesAsync(string customName, UpdateSession body = default(UpdateSession), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (customName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("customName", customName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "session/edit/{CustomName}").ToString(); + _url = _url.Replace("{CustomName}", System.Uri.EscapeDataString(customName)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new GetSessionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GetSessionResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string customName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (customName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("customName", customName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "session/edit/{CustomName}").ToString(); + _url = _url.Replace("{CustomName}", System.Uri.EscapeDataString(customName)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.Accept != null) + { + if (_httpRequest.Headers.Contains("Accept")) + { + _httpRequest.Headers.Remove("Accept"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept", Client.Accept); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if (!_httpResponse.IsSuccessStatusCode) + { + var ex = new GetSessionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GetSessionResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + string _defaultResponseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_defaultResponseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _defaultResponseContent, ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UpdateSessioneditCustomNameExtensions.cs b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UpdateSessioneditCustomNameExtensions.cs new file mode 100644 index 00000000000..6542f751aa9 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/GeneratedClient/UpdateSessioneditCustomNameExtensions.cs @@ -0,0 +1,129 @@ +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace AutorestClient +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for UpdateSessioneditCustomName. + /// + public static partial class UpdateSessioneditCustomNameExtensions + { + /// + /// The operations group for this extension method. + /// + /// + /// + public static GetSessionResponse Get(this IUpdateSessioneditCustomName operations, string customName) + { + return operations.GetAsync(customName).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IUpdateSessioneditCustomName operations, string customName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(customName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static GetSessionResponse Create(this IUpdateSessioneditCustomName operations, string customName, UpdateSession body = default(UpdateSession)) + { + return operations.CreateAsync(customName, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IUpdateSessioneditCustomName operations, string customName, UpdateSession body = default(UpdateSession), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(customName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static GetSessionResponse Post(this IUpdateSessioneditCustomName operations, string customName, UpdateSession body = default(UpdateSession)) + { + return operations.PostAsync(customName, body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IUpdateSessioneditCustomName operations, string customName, UpdateSession body = default(UpdateSession), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(customName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static GetSessionResponse Delete(this IUpdateSessioneditCustomName operations, string customName) + { + return operations.DeleteAsync(customName).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IUpdateSessioneditCustomName operations, string customName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(customName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/Host/Config.cs b/tests/ServiceStack.OpenApi.Tests/Host/Config.cs new file mode 100644 index 00000000000..55e5fd55b79 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Host/Config.cs @@ -0,0 +1,11 @@ +using System; + +namespace ServiceStack.OpenApi.Tests.Host +{ + public class Config + { + public static readonly string ServiceStackBaseUri = Environment.GetEnvironmentVariable("CI_BASEURI") ?? "http://localhost:20000"; + public static readonly string AbsoluteBaseUri = ServiceStackBaseUri + "/"; + public static readonly string ListeningOn = ServiceStackBaseUri + "/"; + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/Host/GeneratedClientTestBase.cs b/tests/ServiceStack.OpenApi.Tests/Host/GeneratedClientTestBase.cs new file mode 100644 index 00000000000..8bde42a67d8 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Host/GeneratedClientTestBase.cs @@ -0,0 +1,139 @@ +using Funq; +using NUnit.Framework; +using ServiceStack.Api.OpenApi; +using ServiceStack.Auth; +using ServiceStack.Data; +using ServiceStack.Logging; +using ServiceStack.OpenApi.Tests.Services; +using ServiceStack.OrmLite; +using ServiceStack.Redis; +using ServiceStack.Text; +using System.Collections.Generic; + +namespace ServiceStack.OpenApi.Tests.Host +{ + [TestFixture] + public class GeneratedClientTestBase + { + TestAppHost appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new TestAppHost(); + appHost.Init(); + appHost.Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + } + + public class TestAppHost + : AppSelfHostBase + { + //private static ILog log; + + public TestAppHost() + : base("ServiceStack Autorest Client", typeof(NativeTypesTestService).Assembly) + { + //LogManager.LogFactory = new DebugLogFactory(); + //log = LogManager.GetLogger(typeof(ExampleAppHostHttpListener)); + } + + public override void Configure(Container container) + { + JsConfig.Init(new Text.Config { TextCase = TextCase.CamelCase }); + + SetConfig(new HostConfig + { + DebugMode = true, + Return204NoContentForEmptyResponse = true, + }); + + container.Register(c => new OrmLiteConnectionFactory( + ":memory:", SqliteDialect.Provider)); + + container.Register(c => + new OrmLiteAuthRepository(c.Resolve()) + { + UseDistinctRoleTables = AppSettings.Get("UseDistinctRoleTables", true), + }); + + var authRepo = (OrmLiteAuthRepository)container.Resolve(); + authRepo.DropAndReCreateTables(); + + CreateUser(authRepo, 1, "test", "test", new List { "TheRole" }, new List { "ThePermission" }); + CreateUser(authRepo, 2, "test2", "test2"); + + Plugins.Add(new CorsFeature( + allowOriginWhitelist: new[] { "http://localhost", "http://localhost:8080", "http://localhost:56500", "http://test.servicestack.net", "http://null.jsbin.com" }, + allowCredentials: true, + allowedHeaders: "Content-Type, Allow, Authorization")); + + Plugins.Add(new AuthFeature(() => new CustomUserSession(), + new IAuthProvider[] + { + new BasicAuthProvider(AppSettings), + new CredentialsAuthProvider(AppSettings), + })); + + Plugins.Add(new OpenApiFeature()); + + /*Plugins.Add(new AutoQueryFeature + { + MaxLimit = 100, + }); + + container.RegisterValidators(typeof(ThrowValidationValidator).Assembly); + + JavaGenerator.AddGsonImport = true; + var nativeTypes = this.GetPlugin(); + nativeTypes.MetadataTypesConfig.ExportTypes.Add(typeof(DayOfWeek)); + + + + this.RegisterRequestBinder( + httpReq => new CustomRequestBinder { IsFromBinder = true }); + + Routes + .Add("/custom-movies", "GET") + .Add("/custom-movies/genres/{Genre}") + .Add("/custom-movies", "POST,PUT") + .Add("/custom-movies/{Id}") + .Add("/fact/{ForNumber}") + .Add("/all-movies.zip") + .Add("/gethttpresult") + ; + */ + } + + private void CreateUser(OrmLiteAuthRepository authRepo, + int id, string username, string password, List roles = null, List permissions = null) + { + string hash; + string salt; + new SaltedHash().GetHashAndSaltString(password, out hash, out salt); + + authRepo.CreateUserAuth(new UserAuth + { + Id = id, + DisplayName = username + " DisplayName", + Email = username + "@gmail.com", + UserName = username, + FirstName = "First " + username, + LastName = "Last " + username, + PasswordHash = hash, + Salt = salt, + Roles = roles, + Permissions = permissions + }, password); + + authRepo.AssignRoles(id.ToString(), roles, permissions); + } + + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/NetCoreTestsRunner.cs b/tests/ServiceStack.OpenApi.Tests/NetCoreTestsRunner.cs new file mode 100644 index 00000000000..5221c4884ba --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/NetCoreTestsRunner.cs @@ -0,0 +1,34 @@ +using NUnitLite; +using NUnit.Common; +using System.Reflection; +using ServiceStack.Text; +using System; +using System.Globalization; + +namespace ServiceStack.OpenApi.Tests +{ + public class NetCoreTestsRunner + { + /// + /// The main program executes the tests. Output may be routed to + /// various locations, depending on the arguments passed. + /// + /// Run with --help for a full list of arguments supported + /// + public static int Main(string[] args) + { + var licenseKey = Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE"); + if (licenseKey.IsNullOrEmpty()) + throw new ArgumentNullException("SERVICESTACK_LICENSE", "Add Environment variable for SERVICESTACK_LICENSE"); + + Licensing.RegisterLicense(licenseKey); + //"ActivatedLicenseFeatures: ".Print(LicenseUtils.ActivatedLicenseFeatures()); + + CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); + JsConfig.InitStatics(); + //JsonServiceClient client = new JsonServiceClient(); + var writer = new ExtendedTextWrapper(Console.Out); + return new AutoRun(((IReflectableType)typeof(NetCoreTestsRunner)).GetTypeInfo().Assembly).Execute(args, writer, Console.In); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.OpenApi.Tests/Properties/AssemblyInfo.cs b/tests/ServiceStack.OpenApi.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..f7846bac392 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ServiceStack.OpenApi.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ServiceStack.OpenApi.Tests")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("cfd618dd-5de8-42fe-8d83-cc5ab7a40fc1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tests/ServiceStack.OpenApi.Tests/ReturnTypeTests.cs b/tests/ServiceStack.OpenApi.Tests/ReturnTypeTests.cs new file mode 100644 index 00000000000..62bb8390ecc --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/ReturnTypeTests.cs @@ -0,0 +1,87 @@ +using AutorestClient; +using NUnit.Framework; +using ServiceStack.OpenApi.Tests.Host; +using System; + +namespace ServiceStack.OpenApi.Tests +{ + [TestFixture] + public class ReturnTypeTests : GeneratedClientTestBase + { + [Test] + public void Can_get_generic_list() + { + var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri)); + + var result = client.ReturnListRequest.Get(); + + Assert.That(result.Count, Is.EqualTo(3)); + Assert.That(result[0].Id, Is.EqualTo(1)); + Assert.That(result[1].Id, Is.EqualTo(2)); + Assert.That(result[2].Id, Is.EqualTo(3)); + } + + [Test] + public void Can_get_array() + { + var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri)); + + var result = client.ReturnArrayRequest.Get(); + + Assert.That(result.Count, Is.EqualTo(3)); + Assert.That(result[0].Id, Is.EqualTo(1)); + Assert.That(result[1].Id, Is.EqualTo(2)); + Assert.That(result[2].Id, Is.EqualTo(3)); + } + + [Test] + public void Can_get_keyvaluepair() + { + var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri)); + + var result = client.ReturnKeyValuePairRequest.Get(); + + Assert.That(result.Key, Is.EqualTo("key1")); + Assert.That(result.Value, Is.EqualTo("value1")); + } + + [Test] + public void Can_get_returned_dto_dictionary() + { + using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri))) + { + var result = client.ReturnDictionaryDtoRequest.Get(); + + Assert.That(result.Count, Is.EqualTo(2)); + Assert.That(result["key1"].Id, Is.EqualTo(1)); + Assert.That(result["key2"].Id, Is.EqualTo(2)); + } + } + + [Test] + public void Can_get_returned_string_dictionary() + { + using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri))) + { + var result = client.ReturnDictionaryStringRequest.Get(); + + Assert.That(result.Count, Is.EqualTo(2)); + Assert.That(result["key1"], Is.EqualTo("value1")); + Assert.That(result["key2"], Is.EqualTo("value2")); + + } + } + + [Test] + public void Can_Get_Returned_KeyPair() + { + using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri))) + { + var result = client.ReturnKeyValuePairRequest.Get(); + + Assert.That(result.Key, Is.EqualTo("key1")); + Assert.That(result.Value, Is.EqualTo("value1")); + } + } + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/ServiceStack.OpenApi.Tests.csproj b/tests/ServiceStack.OpenApi.Tests/ServiceStack.OpenApi.Tests.csproj new file mode 100644 index 00000000000..a88ad670b50 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/ServiceStack.OpenApi.Tests.csproj @@ -0,0 +1,323 @@ + + + + + + Debug + AnyCPU + {CFD618DD-5DE8-42FE-8D83-CC5AB7A40FC1} + Library + Properties + ServiceStack.OpenApi.Tests + ServiceStack.OpenApi.Tests + v4.6 + 512 + true + true + + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + ..\..\src\packages\Microsoft.Rest.ClientRuntime.2.3.19\lib\net452\Microsoft.Rest.ClientRuntime.dll + + + + ..\..\src\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + + + ..\..\src\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll + True + + + ..\..\src\packages\ServiceStack.Common.5.9.0\lib\net45\ServiceStack.Common.dll + True + + + ..\..\src\packages\ServiceStack.Interfaces.5.9.0\lib\net45\ServiceStack.Interfaces.dll + True + + + ..\..\src\packages\ServiceStack.OrmLite.5.9.0\lib\net45\ServiceStack.OrmLite.dll + True + + + ..\..\src\packages\ServiceStack.OrmLite.Sqlite.5.9.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll + True + + + ..\..\src\packages\ServiceStack.Text.5.9.0\lib\net45\ServiceStack.Text.dll + True + + + + ..\..\src\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll + True + + + + + + ..\..\src\packages\System.Data.SQLite.Core.1.0.113.1\lib\net46\System.Data.SQLite.dll + True + + + ..\..\src\packages\System.Memory.4.5.4\lib\netstandard1.1\System.Memory.dll + True + + + + + + ..\..\src\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll + True + + + + + + ..\..\src\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {5E258282-86A6-4780-AB25-5E458F2E6F70} + ServiceStack.Api.OpenApi + + + {c43f583f-abde-4dd4-bbe3-66322817a6ad} + ServiceStack.Client + + + {982416db-c143-4028-a0c3-cf41892d18d3} + ServiceStack.Common + + + {55942102-033a-4da8-a6af-1db7b2f34a2d} + ServiceStack.Interfaces + + + {5a315f92-80d2-4c60-a5a4-22e027ac7e7e} + ServiceStack.Server + + + {680a1709-25eb-4d52-a87f-ee03ffd94baa} + ServiceStack + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + \ No newline at end of file diff --git a/tests/ServiceStack.OpenApi.Tests/Services/AllTypes.cs b/tests/ServiceStack.OpenApi.Tests/Services/AllTypes.cs new file mode 100644 index 00000000000..fd324b600d4 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Services/AllTypes.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; + +namespace ServiceStack.OpenApi.Tests.Services +{ + public class AllTypes + { + public int Id { get; set; } + public int? NullableId { get; set; } + public byte ByteProperty { get; set; } + public short ShortProperty { get; set; } + public int IntProperty { get; set; } + public long LongProperty { get; set; } + public UInt16 UShortProperty { get; set; } + public uint UIntProperty { get; set; } + public ulong ULongProperty { get; set; } + public float FloatProperty { get; set; } + public double DoubleProperty { get; set; } + public decimal DecimalProperty { get; set; } + public string StringProperty { get; set; } + public DateTime DateTimeProperty { get; set; } + public TimeSpan TimeSpanProperty { get; set; } + public DateTimeOffset DateTimeOffsetProperty { get; set; } + public Guid GuidProperty { get; set; } + public Char CharProperty { get; set; } + public KeyValuePair KeyValuePairProperty { get; set; } + public DateTime? NullableDateTime { get; set; } + public TimeSpan? NullableTimeSpan { get; set; } + public List StringList { get; set; } + public string[] StringArray { get; set; } + public Dictionary StringMap { get; set; } + public Dictionary IntStringMap { get; set; } + public SubType SubType { get; set; } + } + + public class AllCollectionTypes + { + public int[] IntArray { get; set; } + public List IntList { get; set; } + + public string[] StringArray { get; set; } + public List StringList { get; set; } + + public Poco[] PocoArray { get; set; } + public List PocoList { get; set; } + + public Dictionary> PocoLookup { get; set; } + public Dictionary>> PocoLookupMap { get; set; } + } + + public class Poco + { + public string Name { get; set; } + } + + public abstract class HelloBase + { + public int Id { get; set; } + } + + public abstract class HelloResponseBase + { + public int RefId { get; set; } + } + + public class HelloType + { + public string Result { get; set; } + } + + public abstract class HelloWithReturnResponse + { + public string Result { get; set; } + } + + public class SubType + { + public int Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.OpenApi.Tests/Services/AnnotatedService.cs b/tests/ServiceStack.OpenApi.Tests/Services/AnnotatedService.cs new file mode 100644 index 00000000000..44b64894728 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Services/AnnotatedService.cs @@ -0,0 +1,92 @@ +using System.Net; +using System.Runtime.Serialization; + +namespace ServiceStack.OpenApi.Tests.Services +{ + + public class HelloDto + { + [ApiMember(IsRequired = true)] + public string Name { get; set; } + } + + [Api(Description = "Create new hello", BodyParameter = GenerateBodyParameter.Always, IsRequired = true)] + [Route("/annotated-hello", "POST", Summary = "Creates a new hello.")] + public class CreateHelloReq : IReturn + { + [ApiMember(IsRequired = true, ParameterType = "model")] + public HelloDto Hello { get; set; } + } + + [Api("Description of the response")] + public class GatewayCredentialResponse + { + public string Result { get; set; } + } + + [Route("/gatewaycredential/{MID}", "POST, OPTIONS")] + [DataContract] + public class GatewayCredentialRequest : IReturn + { + [ApiMember(IsRequired = true, ExcludeInSchema = true, ParameterType = "path")] + [DataMember] + public string MID { get; set; } + + [ApiMember(IsRequired = true, ParameterType = "model")] + [DataMember] + public string UserName { get; set; } + + [ApiMember(IsRequired = true, ParameterType = "model")] + [ApiAllowableValues("Type", Values = new string[] { "Merchant", "API" })] + [DataMember] + public string Type { get; set; } + } + + + + [Api("Gets the movie")] + [Route("/movie/{Id}")] + public class GetMovie : IReturn + { + [ApiMember(IsRequired = true, Description = "Required ID of Movie.", DataType = "integer", ParameterType = "path")] + public long Id { get; set; } + + [ApiMember(IsRequired = false, AllowMultiple = true, Description = "List of additional objects to include in the movie response.")] + [ApiAllowableValues("Includes", Values = new string[] { "Genres", "Releases", "Contributors", "AlternateTitles", "Descriptions", "Companies", "Tags", "Images", "Videos" })] // This breaks the swagger UI + public string[] Includes { get; set; } + } + + [Api("Movie response with includes")] + public class MovieResponse + { + public string[] Includes { get; set; } + } + + [Api("CRUD for ServiceProviders")] + [Route("/ServiceProvider/{Id}", "Delete", Summary = "Delete a ServiceProvider by Id")] + [ApiResponse(HttpStatusCode.InternalServerError, "Something went wrong. Please contact the support team")] + public class DeleteServiceProviderRequestDto : IReturn + { + [ApiMember(ParameterType = "path", IsRequired = true)] + public int Id { get; set; } + [ApiMember(DataType = "boolean")] + public bool ForceDelete { get; set; } + } + + public class DeleteServiceProviderReponseDto : IHasResponseStatus + { + public ResponseStatus ResponseStatus { get; set; } + } + + + public class AnnotatedService : Service + { + public object Any(GetMovie request) => new MovieResponse {Includes = request.Includes}; + + public object Any(GatewayCredentialRequest request) => new GatewayCredentialResponse {Result = "hello"}; + + public object Any(CreateHelloReq request) => new Hello { Name = request.Hello.Name }; + + public object Any(DeleteServiceProviderRequestDto request) => new DeleteServiceProviderReponseDto { ResponseStatus = new ResponseStatus() {ErrorCode = "200"}}; + } +} \ No newline at end of file diff --git a/tests/ServiceStack.OpenApi.Tests/Services/AsyncService.cs b/tests/ServiceStack.OpenApi.Tests/Services/AsyncService.cs new file mode 100644 index 00000000000..9ec92a992cd --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Services/AsyncService.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceStack.OpenApi.Tests.Services +{ + public class InfoUpdateResponseDto + { + public string Result { get; set; } + } + + [Route("/UpdateInfo/{Id}", "PUT", Summary = "Updates info.")] + public class UpdateInfoReq : IReturn + { + [ApiMember(IsRequired = true)] + public Guid Id { get; set; } + } + + + public class AsyncService : Service + { + public async Task Update(UpdateInfoReq query) + { + return new InfoUpdateResponseDto {Result = "Hello"}; + } + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/Services/CodeGenTestTypes.cs b/tests/ServiceStack.OpenApi.Tests/Services/CodeGenTestTypes.cs new file mode 100644 index 00000000000..ca7e673cd40 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Services/CodeGenTestTypes.cs @@ -0,0 +1,408 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Runtime.Serialization; +using ServiceStack.DataAnnotations; + +namespace ServiceStack.OpenApi.Tests.Services +{ + [Route("/hello")] + [Route("/hello/{Name}")] + public class Hello : IReturn + { + [Required] + public string Name { get; set; } + public string Title { get; set; } + } + + public class HelloResponse + { + public string Result { get; set; } + } + + public class HelloWithNestedClass : IReturn + { + public string Name { get; set; } + public NestedClass NestedClassProp { get; set; } + + // This will generate a class definition "public partial class Hello.NestedClass" + public class NestedClass + { + public string Value { get; set; } + } + } + + public class ListResult + { + public string Result { get; set; } + } + + public class ArrayResult + { + public string Result { get; set; } + } + + [Route("/hello-list")] + public class HelloList : IReturn> + { + public List Names { get; set; } + } + + [Route("/hello-array")] + public class HelloArray : IReturn + { + public List Names { get; set; } + } + + public class HelloWithEnum + { + public EnumType EnumProp { get; set; } + public EnumType? NullableEnumProp { get; set; } + + public EnumFlags EnumFlags { get; set; } + } + + public enum EnumType + { + Value1, + Value2 + } + + [Flags] + public enum EnumFlags + { + Value1 = 1, + Value2 = 2, + Value3 = 4, + } + + [Restrict(InternalOnly = true)] + [System.ComponentModel.Description("Description on HelloAll type")] + [DataContract] + public class HelloAnnotated + : IReturn + { + [DataMember] + public string Name { get; set; } + } + + [Restrict(ExternalOnly = true)] + public class HelloExternal + { + public string Name { get; set; } + } + + [Restrict(InternalOnly = true)] + [Alias("Alias")] + public class RestrictedAttributes + { + [PrimaryKey] + [AutoIncrement] + public int Id { get; set; } + + [Index] + [ApiAllowableValues("DateKind", typeof(DateTimeKind))] + public string Name { get; set; } + + public Hello Hello { get; set; } + } + + [DataContract] + [Route("/allowed-attributes", "GET")] + [Api("AllowedAttributes Description")] + [ApiResponse(HttpStatusCode.BadRequest, "Your request was not understood")] + [Description("Description on AllowedAttributes")] + public class AllowedAttributes + { + [Required] + [Range(1, 10)] + [Default(5)] + public int Id { get; set; } + + [Range(1.0, 10.0)] + [DataMember(Name = "Aliased")] + [ApiMember(Description = "Range Description", + ParameterType = "query", DataType = "integer", IsRequired = true)] + public double Range { get; set; } + + [StringLength(20)] + [References(typeof(Hello))] + [Meta("Foo", "Bar")] + public string Name { get; set; } + } + + [System.ComponentModel.Description("Description on HelloAllResponse type")] + [DataContract] + public class HelloAnnotatedResponse + { + [DataMember] + public string Result { get; set; } + } + + [Route("/all-types")] + public class HelloAllTypes + { + public string Name { get; set; } + public AllTypes AllTypes { get; set; } + public AllCollectionTypes AllCollectionTypes { get; set; } + } + + [Route("/all-types-result")] + public class HelloAllTypesWithResult : IReturn + { + public string Name { get; set; } + public AllTypes AllTypes { get; set; } + public AllCollectionTypes AllCollectionTypes { get; set; } + } + + + public class HelloAllTypesResponse + { + public string Result { get; set; } + public AllTypes AllTypes { get; set; } + public AllCollectionTypes AllCollectionTypes { get; set; } + } + + [Route("/hello-string")] + public class HelloString : IReturn + { + public string Name { get; set; } + } + + [Route("/hello-datetime")] + public class HelloDateTime : IReturn + { + public DateTime DateTime { get; set; } + } + + [Route("/hello-void")] + public class HelloVoid + { + public string Name { get; set; } + } + + [DataContract] + public class HelloWithDataContract + { + [DataMember(Name = "name", Order = 1, IsRequired = true, EmitDefaultValue = false)] + public string Name { get; set; } + + [DataMember(Name = "id", Order = 2, EmitDefaultValue = false)] + public int Id { get; set; } + } + + [DataContract] + public class HelloWithDataContractResponse + { + [DataMember(Name = "result", Order = 1, IsRequired = true, EmitDefaultValue = false)] + public string Result { get; set; } + } + + [System.ComponentModel.Description("Description on HelloWithDescription type")] + public class HelloWithDescription + { + public string Name { get; set; } + } + + [System.ComponentModel.Description("Description on HelloWithDescriptionResponse type")] + public class HelloWithDescriptionResponse + { + public string Result { get; set; } + } + + public class HelloWithInheritance + : HelloBase + { + public string Name { get; set; } + } + + public class HelloWithInheritanceResponse + : HelloResponseBase + { + public string Result { get; set; } + } + + public class HelloWithGenericInheritance : HelloBase + { + public string Result { get; set; } + } + + public class HelloWithGenericInheritance2 : HelloBase + { + public string Result { get; set; } + } + + public class HelloWithNestedInheritance : HelloBase + { + public class Item + { + public string Value { get; set; } + } + } + + public class HelloWithListInheritance : List { } + + public class InheritedItem + { + public string Name { get; set; } + } + + public abstract class HelloBase + { + public List Items { get; set; } + public virtual List Counts { get; set; } + } + + public class HelloWithReturn + : IReturn + { + public string Name { get; set; } + } + + public class HelloWithAlternateReturnResponse + : HelloWithReturnResponse + { + public string AltResult { get; set; } + } + + [Route("/helloroute")] + public class HelloWithRoute + { + public string Name { get; set; } + } + + public class HelloWithRouteResponse + { + public string Result { get; set; } + } + + public class HelloWithType + { + public string Name { get; set; } + } + + public class HelloWithTypeResponse + { + public HelloType Result { get; set; } + } + + public class HelloInterface + { + public IPoco Poco { get; set; } + public IEmptyInterface EmptyInterface { get; set; } + public EmptyClass EmptyClass { get; set; } + } + + public interface IPoco + { + string Name { get; set; } + } + + public interface IEmptyInterface { } + public class EmptyClass { } + + public class TypesGroup + { + public class InnerType + { + public long Id { get; set; } + public string Name { get; set; } + } + + public enum InnerEnum + { + Foo, + Bar, + Baz + } + } + + public class HelloInnerTypes : IReturn { } + + public class HelloInnerTypesResponse + { + public TypesGroup.InnerType InnerType { get; set; } + + public TypesGroup.InnerEnum InnerEnum { get; set; } + } + + public class HelloBuiltin + { + public DayOfWeek DayOfWeek { get; set; } + } + + public class HelloVerbResponse + { + public string Result { get; set; } + } + + public class HelloGet : IReturn, IGet + { + public int Id { get; set; } + } + public class HelloPost : HelloBase, IReturn, IPost + { + } + public class HelloPut : IReturn, IPut + { + public int Id { get; set; } + } + public class HelloDelete : IReturn, IDelete + { + public int Id { get; set; } + } + public class HelloPatch : IReturn, IPatch + { + public int Id { get; set; } + } + + public class HelloReturnVoid : IReturnVoid + { + public int Id { get; set; } + } + + public class EnumRequest : IReturn, IPut + { + public ScopeType Operator { get; set; } + } + + public class EnumResponse + { + public ScopeType Operator { get; set; } + } + + [DataContract] + public enum ScopeType + { + [EnumMember] + Global = 1, + [EnumMember] + Sale = 2, + } + + [Route("/hellotypes")] + public class HelloTypes : IReturn + { + public string String { get; set; } + public bool Bool { get; set; } + public int Int { get; set; } + } + + [DataContract] + [Route("/hellozip")] + public class HelloZip : IReturn + { + [DataMember] + public string Name { get; set; } + + [DataMember] + public List Test { get; set; } + } + + [DataContract] + public class HelloZipResponse + { + [DataMember] + public string Result { get; set; } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.OpenApi.Tests/Services/InheritedDtoService.cs b/tests/ServiceStack.OpenApi.Tests/Services/InheritedDtoService.cs new file mode 100644 index 00000000000..8f464fa9706 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Services/InheritedDtoService.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceStack.OpenApi.Tests.Services +{ + + public class Pet + { + virtual public int? PetId { get; set; } + virtual public string Name { get; set; } + } + + [Route("/Pets", "POST")] + public class PetsPOSTRequest : Pet, IReturn + { + [System.Runtime.Serialization.IgnoreDataMember] + public override int? PetId { get; set; } + } + + + public class InheritedDtoService : Service + { + public Pet POST(PetsPOSTRequest request) + { + return request; + } + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/Services/NativeTypesTestService.cs b/tests/ServiceStack.OpenApi.Tests/Services/NativeTypesTestService.cs new file mode 100644 index 00000000000..407862ed3bc --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Services/NativeTypesTestService.cs @@ -0,0 +1,215 @@ +namespace ServiceStack.OpenApi.Tests.Services +{ + public class NativeTypesTestService : Service + { + public object Any(Hello request) + { + return new HelloResponse + { + Result = "Hello, {0}{1}!".Fmt( + request.Title != null ? request.Title + ". " : "", + request.Name) + }; + } + + public object Any(HelloAnnotated request) + { + return new HelloAnnotatedResponse { Result = request.Name }; + } + + public object Any(HelloWithNestedClass request) + { + return new HelloResponse { Result = request.Name }; + } + + public object Any(HelloList request) + { + return request.Names.Map(name => new ListResult { Result = name }); + } + + public object Any(HelloArray request) + { + return request.Names.Map(name => new ArrayResult { Result = name }); + } + + public object Any(HelloWithEnum request) + { + return request; + } + + public object Any(HelloExternal request) + { + return request; + } + + public object Any(RestrictedAttributes request) + { + return request; + } + + public object Any(AllowedAttributes request) + { + return request; + } + + public object Any(HelloAllTypes request) + { + return new HelloAllTypesResponse + { + AllTypes = request.AllTypes, + AllCollectionTypes = request.AllCollectionTypes, + Result = request.Name + }; + } + + public object Any(HelloAllTypesWithResult request) + { + return new HelloAllTypesResponse + { + AllTypes = request.AllTypes, + AllCollectionTypes = request.AllCollectionTypes, + Result = request.Name + }; + } + + + public object Any(AllTypes request) + { + return request; + } + + public object Any(HelloString request) + { + return request.Name; + } + + public object Any(HelloDateTime request) + { + return request; + } + + public void Any(HelloVoid request) + { + } + + public object Any(HelloWithDataContract request) + { + return new HelloWithDataContractResponse { Result = request.Name }; + } + + public object Any(HelloWithDescription request) + { + return new HelloWithDescriptionResponse { Result = request.Name }; + } + + public object Any(HelloWithInheritance request) + { + return new HelloWithInheritanceResponse { Result = request.Name }; + } + + public object Any(HelloWithGenericInheritance request) + { + return request; + } + + public object Any(HelloWithGenericInheritance2 request) + { + return request; + } + + public object Any(HelloWithNestedInheritance request) + { + return request; + } + + //public object Any(HelloWithListInheritance request) + //{ + // return request; + //} + + public object Any(HelloWithReturn request) + { + return new HelloWithAlternateReturnResponse { Result = request.Name }; + } + + public object Any(HelloWithRoute request) + { + return new HelloWithRouteResponse { Result = request.Name }; + } + + public object Any(HelloWithType request) + { + return new HelloWithTypeResponse + { + Result = new HelloType { Result = request.Name } + }; + } + + public object Any(HelloInterface request) + { + return request; + } + + public object Any(HelloInnerTypes request) + { + return new HelloInnerTypesResponse(); + } + + //Uncomment to generate SS.Client built-in types + //public object Any(GenerateBuiltInTypes request) + //{ + // return request; + //} + + public object Any(HelloBuiltin request) + { + return request; + } + + public object Any(HelloGet request) + { + return new HelloVerbResponse { Result = HttpMethods.Get }; + } + + public object Any(HelloPost request) + { + return new HelloVerbResponse { Result = HttpMethods.Post }; + } + + public object Any(HelloPut request) + { + return new HelloVerbResponse { Result = HttpMethods.Put }; + } + + public object Any(HelloDelete request) + { + return new HelloVerbResponse { Result = HttpMethods.Delete }; + } + + public object Any(HelloPatch request) + { + return new HelloVerbResponse { Result = HttpMethods.Patch }; + } + + public void Any(HelloReturnVoid request) + { + } + + public object Any(EnumRequest request) + { + return new EnumResponse { Operator = request.Operator }; + } + + public object Any(HelloTypes request) + { + return request; + } + + public object Any(HelloZip request) + { + return request.Test == null + ? new HelloZipResponse { Result = $"Hello, {request.Name} {base.Request.ContentLength}" } + : new HelloZipResponse { Result = $"Hello, {request.Name} ({request.Test?.Count}) {base.Request.ContentLength}" }; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.OpenApi.Tests/Services/ReturnTypeServices.cs b/tests/ServiceStack.OpenApi.Tests/Services/ReturnTypeServices.cs new file mode 100644 index 00000000000..0668800b09c --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Services/ReturnTypeServices.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using ServiceStack; +using System.Linq; +using System.Net; + +namespace ServiceStack.OpenApi.Test.Services +{ + public class ReturnedDto + { + public virtual int Id { get; set; } + } + + [Route("/return-list", "GET")] + public class ReturnListRequest : IReturn>, IGet + { + } + + [Route("/return-array", "GET")] + public class ReturnArrayRequest : IReturn, IGet + { + } + + [Route("/return-keyvaluepair", "GET")] + public class ReturnKeyValuePairRequest : IReturn>, IGet + { + } + + [Route("/return-dictionarystring", "GET")] + public class ReturnDictionaryStringRequest : IReturn>, IGet + { + } + + [Route("/return-dictionarydto", "GET")] + public class ReturnDictionaryDtoRequest : IReturn>, IGet + { + } + + [Route("/return-ireturnvoid", "GET")] + public class ReturnIReturnVoidDtoRequest : IReturn, IGet + { + } + + + [Route("/return-void", "GET")] + public class ReturnVoidDtoRequest : IReturnVoid + { + } + + public class Return200Response + { + public string SuccessMessage { get; set; } + } + + public class Return403Response + { + public string ForbiddenMessage { get; set; } + } + + [Route("/return-annotated", "GET")] + [ApiResponse(StatusCode = (int) HttpStatusCode.OK, Description = "All OK")] + [ApiResponse(StatusCode = (int) HttpStatusCode.Forbidden, Description = "Forbidden Service", + ResponseType = typeof(Return403Response))] + [ApiResponse(Description = "Default Response", ResponseType = typeof(Return200Response), IsDefaultResponse = true)] + public class ReturnAnnotatedDtoRequest : IReturn, IGet + { + public int Code { get; set; } + } + + [Route("/dhcp/servers/{ServerName}/scopes/{ScopeId}", "DELETE", Summary = "Deletes a DHCP scope.")] + public class DeleteDhcpScope : IReturnVoid + { + [ApiMember(ParameterType = "path", IsRequired = true, Description = "The FQDN of the DHCP server")] + public string ServerName { get; set; } + + [ApiMember(ParameterType = "path", Description = "The Scope Id of the DHCP scope")] + public string ScopeId { get; set; } + } + + public class ReturnGenericListServices : Service + { + public static readonly ReturnedDto[] returnedDtos = new ReturnedDto[] + { + new ReturnedDto() {Id = 1}, + new ReturnedDto() {Id = 2}, + new ReturnedDto() {Id = 3}, + }; + + public object Any(ReturnListRequest request) => returnedDtos.ToList(); + public object Any(ReturnArrayRequest request) => returnedDtos; + + public object Any(ReturnKeyValuePairRequest request) => new KeyValuePair("key1", "value1"); + + public object Any(ReturnDictionaryStringRequest request) => new Dictionary + { + {"key1", "value1"}, + {"key2", "value2"} + }; + + public object Any(ReturnDictionaryDtoRequest request) => new Dictionary + { + {"key1", new ReturnedDto {Id = 1}}, + {"key2", new ReturnedDto {Id = 2}} + }; + + public void Any(ReturnVoidDtoRequest request) + { + } + + public void Any(ReturnIReturnVoidDtoRequest request) + { + } + + public void Any(DeleteDhcpScope request) + { + } + + public object Any(ReturnAnnotatedDtoRequest request) + { + switch (request.Code) + { + case 403: + return new Return403Response(); + default: + return new Return200Response(); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.OpenApi.Tests/Services/SecuredService.cs b/tests/ServiceStack.OpenApi.Tests/Services/SecuredService.cs new file mode 100644 index 00000000000..b8fcbec0209 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Services/SecuredService.cs @@ -0,0 +1,31 @@ +namespace ServiceStack.OpenApi.Tests.Services +{ + [Route("/secured-service")] + public class SecuredRequest : IReturn { } + + [Route("/secured-dto-service")] + [Authenticate] + public class SecuredDtoRequest : IReturn { } + + [Route("/secured-ops-service")] + public class SecuredOpsRequest : IReturn { } + + [Authenticate] + public class SecuredService : Service + { + public object Any(SecuredRequest request) => "Secured"; + } + + public class SecuredDtoService : Service + { + public string Any(SecuredDtoRequest request) => "Secured"; + } + + public class SecuredOpsService : Service + { + [Authenticate] + public string Get(SecuredOpsRequest request) => "Secured"; + + public string Post(SecuredOpsRequest request) => "Not Secured"; + } +} diff --git a/tests/ServiceStack.OpenApi.Tests/Services/SessionService.cs b/tests/ServiceStack.OpenApi.Tests/Services/SessionService.cs new file mode 100644 index 00000000000..4f826e49b99 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/Services/SessionService.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; +using ServiceStack; +using ServiceStack.Auth; + +namespace ServiceStack.OpenApi.Tests.Services +{ + public class CustomUserSession : AuthUserSession + { + [DataMember] + public string CustomName { get; set; } + + [DataMember] + public string CustomInfo { get; set; } + + public override void OnAuthenticated(IServiceBase authService, IAuthSession session, + IAuthTokens tokens, Dictionary authInfo) + { + var unAuthInfo = authService.GetSessionBag().Get(); + + if (unAuthInfo != null) + this.CustomInfo = unAuthInfo.CustomInfo; + } + } + + public class UnAuthInfo + { + public string CustomInfo { get; set; } + } + + [Route("/session")] + public class GetSession : IReturn + { + } + + [Route("/session/edit/{CustomName}")] + public class UpdateSession : IReturn + { + public string CustomName { get; set; } + } + + public class GetSessionResponse + { + public CustomUserSession Result { get; set; } + + public UnAuthInfo UnAuthInfo { get; set; } + + public ResponseStatus ResponseStatus { get; set; } + } + + public class SessionService : Service + { + public object Any(GetSession request) + { + return new GetSessionResponse + { + Result = SessionAs(), + UnAuthInfo = SessionBag.Get(typeof(UnAuthInfo).Name), + }; + } + + public object Any(UpdateSession request) + { + var session = SessionAs(); + session.CustomName = request.CustomName; + + var unAuthInfo = SessionBag.Get() ?? new UnAuthInfo(); + unAuthInfo.CustomInfo = request.CustomName + " - CustomInfo"; + SessionBag.Set(unAuthInfo); + + this.SaveSession(session); + + return new GetSessionResponse + { + Result = SessionAs(), + UnAuthInfo = unAuthInfo, + }; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.OpenApi.Tests/packages.config b/tests/ServiceStack.OpenApi.Tests/packages.config new file mode 100644 index 00000000000..7eadad87c94 --- /dev/null +++ b/tests/ServiceStack.OpenApi.Tests/packages.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/ServiceStack.Razor.BuildTask.IntegrationTests/ServiceStack.Razor.BuildTask.IntegrationTests.csproj b/tests/ServiceStack.Razor.BuildTask.IntegrationTests/ServiceStack.Razor.BuildTask.IntegrationTests.csproj index 1f78e150dd8..268279ea1c1 100644 --- a/tests/ServiceStack.Razor.BuildTask.IntegrationTests/ServiceStack.Razor.BuildTask.IntegrationTests.csproj +++ b/tests/ServiceStack.Razor.BuildTask.IntegrationTests/ServiceStack.Razor.BuildTask.IntegrationTests.csproj @@ -55,27 +55,27 @@ False - ..\..\lib\ServiceStack.Interfaces.dll + ..\..\lib\net45\ServiceStack.Interfaces.dll False - ..\..\lib\ServiceStack.OrmLite.dll + ..\..\lib\net45\ServiceStack.OrmLite.dll False - ..\..\lib\ServiceStack.OrmLite.Sqlite.dll + ..\..\lib\net45\ServiceStack.OrmLite.Sqlite.dll False - ..\..\lib\ServiceStack.OrmLite.SqlServer.dll + ..\..\lib\net45\ServiceStack.OrmLite.SqlServer.dll False - ..\..\lib\ServiceStack.Redis.dll + ..\..\lib\net45\ServiceStack.Redis.dll False - ..\..\lib\ServiceStack.Text.dll + ..\..\lib\net45\ServiceStack.Text.dll @@ -91,10 +91,6 @@ - - sqlite3.dll - PreserveNewest - @@ -119,7 +115,6 @@ - diff --git a/tests/ServiceStack.Razor.Tests/HelloAppHost.cs b/tests/ServiceStack.Razor.Tests/HelloAppHost.cs index a7208e353c7..0c7fc643120 100644 --- a/tests/ServiceStack.Razor.Tests/HelloAppHost.cs +++ b/tests/ServiceStack.Razor.Tests/HelloAppHost.cs @@ -14,11 +14,16 @@ public override void Configure(Funq.Container container) { //http://stackoverflow.com/questions/13206038/servicestack-razor-default-page/13206221 + this.SetConfig(new HostConfig + { + DebugMode = true, + }); + var razor3 = new RazorFormat(); this.Plugins.Add(razor3); - this.Plugins.Add(new RequestLogsFeature() - { + this.Plugins.Add(new RequestLogsFeature + { EnableErrorTracking = true, EnableResponseTracking = true, EnableSessionTracking = true, @@ -30,13 +35,6 @@ public override void Configure(Funq.Container container) this.GlobalRequestFilters.Add(SimpleRequestFilter); - //this.SetConfig( new EndpointHostConfig() - // { - // DebugMode = false, - - // } ); - - this.Routes.Add("/hello"); this.Routes.Add("/hello/{Name}"); this.Routes.Add("/Foo/{WhatToSay}"); diff --git a/tests/ServiceStack.Razor.Tests/Properties/AssemblyInfo.cs b/tests/ServiceStack.Razor.Tests/Properties/AssemblyInfo.cs index 92e5b1daaf2..8dabd63105a 100644 --- a/tests/ServiceStack.Razor.Tests/Properties/AssemblyInfo.cs +++ b/tests/ServiceStack.Razor.Tests/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "" )] [assembly: AssemblyProduct( "ServiceStack.Razor.Tests" )] -[assembly: AssemblyCopyright( "Copyright (c) 2013" )] +[assembly: AssemblyCopyright("Copyright (c) ServiceStack 2016")] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] diff --git a/tests/ServiceStack.Razor.Tests/ServiceStack.Razor.Tests.csproj b/tests/ServiceStack.Razor.Tests/ServiceStack.Razor.Tests.csproj index 934ea9ec3ed..80b8e0ce01e 100644 --- a/tests/ServiceStack.Razor.Tests/ServiceStack.Razor.Tests.csproj +++ b/tests/ServiceStack.Razor.Tests/ServiceStack.Razor.Tests.csproj @@ -15,7 +15,7 @@ ServiceStack.Razor.Tests v4.5 false - true + false @@ -23,6 +23,13 @@ ..\..\src\ true + true + + + + + 4.0 + true @@ -49,12 +56,12 @@ lib\NLog.dll - - ..\..\src\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\..\src\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll + True - - False - ..\..\lib\ServiceStack.Interfaces.dll + + ..\..\lib\net45\ServiceStack.Interfaces.dll @@ -66,9 +73,9 @@ - + False - ..\lib\System.Web.Razor.dll + ..\lib\thirdparty\System.Web.Razor.dll @@ -158,11 +165,11 @@ - False + True False 8181 / - http://localhost:33011/ + http://localhost/ServiceStack.Razor.Tests False False @@ -180,4 +187,4 @@ --> - + \ No newline at end of file diff --git a/tests/ServiceStack.Razor.Tests/Web.config b/tests/ServiceStack.Razor.Tests/Web.config index 1f44c66d92c..b3cc6eabd90 100644 --- a/tests/ServiceStack.Razor.Tests/Web.config +++ b/tests/ServiceStack.Razor.Tests/Web.config @@ -45,7 +45,6 @@ - @@ -62,7 +61,6 @@ - @@ -73,6 +71,7 @@ + diff --git a/tests/ServiceStack.Razor.Tests/default.cshtml b/tests/ServiceStack.Razor.Tests/default.cshtml index 5442fd224af..c473e27d423 100644 --- a/tests/ServiceStack.Razor.Tests/default.cshtml +++ b/tests/ServiceStack.Razor.Tests/default.cshtml @@ -3,8 +3,6 @@ @using ServiceStack @using ServiceStack.Razor.Tests @using ServiceStack.Common -@using ServiceStack.ServiceHost -@using ServiceStack.WebHost.Endpoints

      /default.cshtml

      diff --git a/tests/ServiceStack.Razor.Tests/packages.config b/tests/ServiceStack.Razor.Tests/packages.config index 967502dc812..c108d442f39 100644 --- a/tests/ServiceStack.Razor.Tests/packages.config +++ b/tests/ServiceStack.Razor.Tests/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/tests/ServiceStack.RazorHostTests/CatchAll.cshtml b/tests/ServiceStack.RazorHostTests/CatchAll.cshtml index 783a531bc8b..521db0fabb4 100644 --- a/tests/ServiceStack.RazorHostTests/CatchAll.cshtml +++ b/tests/ServiceStack.RazorHostTests/CatchAll.cshtml @@ -20,3 +20,5 @@
    • @person.FirstName - @person.LastName (@person.Age)
    • } + +@Html.Partial("_CatchAllPartial") diff --git a/tests/ServiceStack.RazorHostTests/Properties/AssemblyInfo.cs b/tests/ServiceStack.RazorHostTests/Properties/AssemblyInfo.cs index 61e46e35195..9fc18953117 100644 --- a/tests/ServiceStack.RazorHostTests/Properties/AssemblyInfo.cs +++ b/tests/ServiceStack.RazorHostTests/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ServiceStack.RazorHostTests")] -[assembly: AssemblyCopyright("Copyright (c) ServiceStack 2014")] +[assembly: AssemblyCopyright("Copyright (c) ServiceStack 2018")] [assembly: AssemblyTrademark("Service Stack")] [assembly: AssemblyCulture("")] @@ -32,4 +32,4 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] +[assembly: AssemblyFileVersion("5.0.0.0")] diff --git a/tests/ServiceStack.RazorHostTests/ServiceStack.RazorHostTests.csproj b/tests/ServiceStack.RazorHostTests/ServiceStack.RazorHostTests.csproj index 35852c76b5b..a05586d5fe0 100644 --- a/tests/ServiceStack.RazorHostTests/ServiceStack.RazorHostTests.csproj +++ b/tests/ServiceStack.RazorHostTests/ServiceStack.RazorHostTests.csproj @@ -1,5 +1,6 @@  - + + Debug @@ -14,7 +15,7 @@ ServiceStack.RazorHostTests ServiceStack.RazorHostTests false - v4.5 + v4.6 4.0 @@ -26,6 +27,10 @@ ..\..\src\ true + + + + True @@ -48,47 +53,70 @@ - - ..\..\lib\tests\Mono.Data.Sqlite.dll + + + ..\..\src\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll + True - - ..\..\src\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\..\src\packages\ServiceStack.Common.5.9.0\lib\net45\ServiceStack.Common.dll + True - - False - ..\..\lib\ServiceStack.Interfaces.dll + + ..\..\src\packages\ServiceStack.Interfaces.5.9.0\lib\net45\ServiceStack.Interfaces.dll + True - - ..\..\lib\ServiceStack.OrmLite.dll + + ..\..\src\packages\ServiceStack.OrmLite.5.9.0\lib\net45\ServiceStack.OrmLite.dll + True - - ..\..\lib\ServiceStack.OrmLite.Sqlite.dll + + ..\..\src\packages\ServiceStack.OrmLite.Sqlite.5.9.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll + True - - False - ..\..\lib\ServiceStack.Text.dll + + ..\..\src\packages\ServiceStack.Text.5.9.0\lib\net45\ServiceStack.Text.dll + True + + ..\..\src\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll + True + + + + ..\..\src\packages\System.Data.SQLite.Core.1.0.113.1\lib\net46\System.Data.SQLite.dll + True + + + ..\..\src\packages\System.Memory.4.5.4\lib\netstandard1.1\System.Memory.dll + True + + + + ..\..\src\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll + True + + + + + ..\..\src\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll + + - - - - sqlite3.dll - PreserveNewest - Designer @@ -121,6 +149,10 @@ {982416DB-C143-4028-A0C3-CF41892D18D3} ServiceStack.Common + + {55942102-033a-4da8-a6af-1db7b2f34a2d} + ServiceStack.Interfaces + {d73274ae-006b-4cee-ba60-0ecf5873048d} ServiceStack.Razor @@ -187,7 +219,10 @@ - + + + + 10.0 @@ -206,15 +241,13 @@ - - False - True - 59115 + False + 58772 / @@ -233,6 +266,14 @@ + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + ")); + + Assert.That(ListeningOn.CombineWith("/SecuredPage").GetStringFromUrl(), + Does.Contain("")); + + Assert.That(ListeningOn.CombineWith("/TestSessionPage").GetStringFromUrl(), + Does.Contain("IsAuthenticated:False")); + + Assert.That(ListeningOn.CombineWith("/test/session/view").GetStringFromUrl(), + Does.Contain("IsAuthenticated:False")); + } + + [Test] + public void Can_access_Secured_Pages_with_BasicAuth() + { + Assert.That(ListeningOn.CombineWith("/secured").GetStringFromUrl( + requestFilter: req => req.AddBasicAuth(Username, Password)), + Does.Contain("")); + + Assert.That(ListeningOn.CombineWith("/SecuredPage").GetStringFromUrl( + requestFilter: req => req.AddBasicAuth(Username, Password)), + Does.Contain("")); + + Assert.That(ListeningOn.CombineWith("/test/session").GetJsonFromUrl( + requestFilter: req => req.AddBasicAuth(Username, Password)), + Does.Contain("\"IsAuthenticated\":true")); + + Assert.That(ListeningOn.CombineWith("/TestSessionPage").GetStringFromUrl( + requestFilter: req => req.AddBasicAuth(Username, Password)), + Does.Contain("IsAuthenticated:True")); + + Assert.That(ListeningOn.CombineWith("/test/session/view").GetStringFromUrl( + requestFilter: req => req.AddBasicAuth(Username, Password)), + Does.Contain("IsAuthenticated:True")); + } + + [Test] + public void Can_access_Secured_Pages_with_JWT() + { + var client = GetClientWithUserPassword(alwaysSend: true); + var authResponse = client.Send(new Authenticate()); + + Assert.That(ListeningOn.CombineWith("/secured").GetStringFromUrl( + requestFilter: req => req.AddBearerToken(authResponse.BearerToken)), + Does.Contain("")); + + Assert.That(ListeningOn.CombineWith("/SecuredPage").GetStringFromUrl( + requestFilter: req => req.AddBearerToken(authResponse.BearerToken)), + Does.Contain("")); + + Assert.That(ListeningOn.CombineWith("/test/session").GetJsonFromUrl( + requestFilter: req => req.AddBearerToken(authResponse.BearerToken)), + Does.Contain("\"IsAuthenticated\":true")); + + Assert.That(ListeningOn.CombineWith("/TestSessionPage").GetStringFromUrl( + requestFilter: req => req.AddBearerToken(authResponse.BearerToken)), + Does.Contain("IsAuthenticated:True")); + + Assert.That(ListeningOn.CombineWith("/test/session/view").GetStringFromUrl( + requestFilter: req => req.AddBearerToken(authResponse.BearerToken)), + Does.Contain("IsAuthenticated:True")); + } + + [Test] + public void Can_access_Secured_Pages_with_ApiKeyAuth() + { + Assert.That(ListeningOn.CombineWith("/secured").GetStringFromUrl( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("")); + + Assert.That(ListeningOn.CombineWith("/SecuredPage").GetStringFromUrl( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("")); + + Assert.That(ListeningOn.CombineWith("/test/session").GetJsonFromUrl( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("\"IsAuthenticated\":true")); + + Assert.That(ListeningOn.CombineWith("/TestSessionPage").GetStringFromUrl( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("IsAuthenticated:True")); + + Assert.That(ListeningOn.CombineWith("/test/session/view").GetStringFromUrl( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("IsAuthenticated:True")); + } + + [Test] + public async Task Can_access_Secured_Pages_with_ApiKeyAuth_async() + { + Assert.That(await ListeningOn.CombineWith("/secured").GetStringFromUrlAsync( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("")); + + Assert.That(await ListeningOn.CombineWith("/SecuredPage").GetStringFromUrlAsync( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("")); + + Assert.That(await ListeningOn.CombineWith("/test/session").GetJsonFromUrlAsync( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("\"IsAuthenticated\":true")); + + Assert.That(await ListeningOn.CombineWith("/TestSessionPage").GetStringFromUrlAsync( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("IsAuthenticated:True")); + + Assert.That(await ListeningOn.CombineWith("/test/session/view").GetStringFromUrlAsync( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("IsAuthenticated:True")); + } + + [Test] + public void Can_access_Secured_Pages_with_ApiKeyAuth_BearerToken() + { + Assert.That(ListeningOn.CombineWith("/secured").GetStringFromUrl( + requestFilter: req => req.AddBearerToken(ApiKey)), + Does.Contain("")); + + Assert.That(ListeningOn.CombineWith("/SecuredPage").GetStringFromUrl( + requestFilter: req => req.AddBearerToken(ApiKey)), + Does.Contain("")); + + Assert.That(ListeningOn.CombineWith("/test/session").GetJsonFromUrl( + requestFilter: req => req.AddApiKeyAuth(ApiKey)), + Does.Contain("\"IsAuthenticated\":true")); + + Assert.That(ListeningOn.CombineWith("/TestSessionPage").GetStringFromUrl( + requestFilter: req => req.AddBearerToken(ApiKey)), + Does.Contain("IsAuthenticated:True")); + + Assert.That(ListeningOn.CombineWith("/test/session/view").GetStringFromUrl( + requestFilter: req => req.AddBearerToken(ApiKey)), + Does.Contain("IsAuthenticated:True")); + } + + [Test] + public async Task Can_access_Secured_Pages_with_ApiKeyAuth_BearerToken_Async() + { + Assert.That(await ListeningOn.CombineWith("/secured").GetStringFromUrlAsync( + requestFilter: req => req.AddBearerToken(ApiKey)), + Does.Contain("")); + + Assert.That(await ListeningOn.CombineWith("/SecuredPage").GetStringFromUrlAsync( + requestFilter: req => req.AddBearerToken(ApiKey)), + Does.Contain("")); + + Assert.That(await ListeningOn.CombineWith("/test/session").GetJsonFromUrlAsync( + requestFilter: req => req.AddBearerToken(ApiKey)), + Does.Contain("\"IsAuthenticated\":true")); + + Assert.That(await ListeningOn.CombineWith("/TestSessionPage").GetStringFromUrlAsync( + requestFilter: req => req.AddBearerToken(ApiKey)), + Does.Contain("IsAuthenticated:True")); + + Assert.That(await ListeningOn.CombineWith("/test/session/view").GetStringFromUrlAsync( + requestFilter: req => req.AddBearerToken(ApiKey)), + Does.Contain("IsAuthenticated:True")); + } + + [Test] + public void Can_access_Secured_Pages_with_CredentialsAuth() + { + var client = GetClient(); + client.Post(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + }); + + Assert.That(client.Get("/secured?format=html"), + Does.Contain("")); + + Assert.That(client.Get("/SecuredPage?format=html"), + Does.Contain("")); + + Assert.That(client.Get(new TestSession()).IsAuthenticated); + + Assert.That(client.Get("/test/session"), + Does.Contain("\"IsAuthenticated\":true")); + + Assert.That(client.Get("/TestSessionPage"), + Does.Contain("IsAuthenticated:True")); + } + } +} diff --git a/tests/ServiceStack.Server.Tests/Auth/StatelessAuthTests.cs b/tests/ServiceStack.Server.Tests/Auth/StatelessAuthTests.cs new file mode 100644 index 00000000000..5dce97f599d --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Auth/StatelessAuthTests.cs @@ -0,0 +1,1475 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Net; +using System.Security.Cryptography; +using System.Threading; +using System.Threading.Tasks; +using Amazon.DynamoDBv2; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +#if !NETCORE_SUPPORT +using MongoDB.Driver; +using ServiceStack.Authentication.MongoDb; +#endif +using ServiceStack.Aws.DynamoDb; +using ServiceStack.Configuration; +using ServiceStack.Data; +using ServiceStack.Redis; +using ServiceStack.Text; + +namespace ServiceStack.Server.Tests.Auth +{ + public class CustomUserSession : AuthUserSession + { + public int Counter { get; set; } + } + + [Route("/secured")] + public class Secured : IReturn + { + public string Name { get; set; } + } + + public class SecuredResponse + { + public string Result { get; set; } + + public ResponseStatus ResponseStatus { get; set; } + } + + [Route("/secured-by-role")] + public class SecuredByRole : IReturn + { + public string Name { get; set; } + } + + [Route("/secured-by-permission")] + public class SecuredByPermission : IReturn + { + public string Name { get; set; } + } + + public class GetAuthUserSession : IReturn { } + + [Authenticate] + public class SecureService : Service + { + public object Any(Secured request) + { + return new SecuredResponse { Result = request.Name }; + } + + public object Any(GetAuthUserSession request) + { + return Request.GetSession() as AuthUserSession; + } + + [RequiredRole("TheRole")] + public object Any(SecuredByRole request) + { + return new SecuredResponse { Result = request.Name }; + } + + [RequiredPermission("ThePermission")] + public object Any(SecuredByPermission request) + { + return new SecuredResponse { Result = request.Name }; + } + } + + public class JsonHttpClientStatelessAuthTests : StatelessAuthTests + { + protected override IServiceClient GetClientWithUserPassword(bool alwaysSend = false, string userName = null) + { + return new JsonHttpClient(ListeningOn) + { + UserName = userName ?? Username, + Password = Password, + AlwaysSendBasicAuthHeader = alwaysSend, + }; + } + + protected override IServiceClient GetClientWithApiKey(string apiKey = null) + { + return new JsonHttpClient(ListeningOn) + { + Credentials = new NetworkCredential(apiKey ?? ApiKey, ""), + }; + } + + protected override IServiceClient GetClientWithBearerToken(string bearerToken) + { + return new JsonHttpClient(ListeningOn) + { + BearerToken = bearerToken, + }; + } + + protected override IServiceClient GetClient() + { + return new JsonHttpClient(ListeningOn); + } + } + + public class DynamoDbAuthRepoStatelessAuthTests : StatelessAuthTests + { + public static AmazonDynamoDBClient CreateDynamoDBClient() + { + var dynamoClient = new AmazonDynamoDBClient("keyId", "key", new AmazonDynamoDBConfig + { + ServiceURL = Environment.GetEnvironmentVariable("CI_DYNAMODB") ?? "http://localhost:8000", + }); + + return dynamoClient; + } + protected override ServiceStackHost CreateAppHost() + { + var pocoDynamo = new PocoDynamo(CreateDynamoDBClient()); + pocoDynamo.DeleteAllTables(TimeSpan.FromMinutes(1)); + + return new AppHost + { + Use = container => container.Register(c => new DynamoDbAuthRepository(pocoDynamo)) + }; + } + } + + public class MemoryAuthRepoStatelessAuthTests : StatelessAuthTests + { + protected override ServiceStackHost CreateAppHost() + { + return new AppHost + { + Use = container => container.Register(c => new InMemoryAuthRepository()) + }; + } + } + + public class RedisAuthRepoStatelessAuthTests : StatelessAuthTests + { + protected override ServiceStackHost CreateAppHost() + { + var redisManager = new RedisManagerPool(); + using (var redis = redisManager.GetClient()) + { + redis.FlushAll(); + } + + return new AppHost + { + Use = container => container.Register(c => new RedisAuthRepository(redisManager)) + }; + } + } + +#if !NETCORE_SUPPORT + [Ignore("Requires MongoDB Dependency")] + public class MongoDbAuthRepoStatelessAuthTests : StatelessAuthTests + { + protected override ServiceStackHost CreateAppHost() + { + var mongoClient = new MongoClient(); + mongoClient.DropDatabase("testmongodbauth"); + IMongoDatabase mongoDatabase = mongoClient.GetDatabase("testmongodbauth"); + + return new AppHost + { + Use = container => container.Register(c => + new MongoDbAuthRepository(mongoDatabase, true)) + }; + } + } +#endif + + public class OrmLiteStatelessAuthTests : StatelessAuthTests + { + [Test] + public void Does_use_different_database_depending_on_ApiKey() + { + var apiKeys = apiRepo.GetUserApiKeys(userId); + var testKey = apiKeys.First(x => x.Environment == "test"); + var liveKey = apiKeys.First(x => x.Environment == "live"); + + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = testKey.Id, + }; + + var response = client.Get(new GetAllRockstars()); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Test")); + + client = new JsonServiceClient(ListeningOn) + { + BearerToken = liveKey.Id, + }; + + response = client.Get(new GetAllRockstars()); + Assert.That(response.Results.Count, Is.EqualTo(Rockstar.SeedData.Length)); + } + } + + [Ignore("Dirty")] + public class OrmLiteMultitenancyStatelessAuthTests : StatelessAuthTests + { + protected override ServiceStackHost CreateAppHost() + { + return new AppHost + { + Use = container => container.Register(c => + new OrmLiteAuthRepositoryMultitenancy(c.TryResolve(), + new[] { + ":memory:", + "~/App_Data/test.sqlite".MapAbsolutePath() + })), + + GetAuthRepositoryFn = req => + req != null + ? new OrmLiteAuthRepositoryMultitenancy(HostContext.AppHost.GetDbConnection(req)) + : HostContext.Resolve() + }; + } + + [Test] + public void Does_use_different_database_depending_on_ApiKey() + { + var testKey = GetClientWithUserPassword().Get(new GetApiKeys { Environment = "test" }).Results[0].Key; + var liveKey = GetClientWithUserPassword().Get(new GetApiKeys { Environment = "live" }).Results[0].Key; + + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = testKey + }; + + var response = client.Get(new GetAllRockstars()); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Test")); + + client = new JsonServiceClient(ListeningOn) + { + BearerToken = liveKey, + }; + + response = client.Get(new GetAllRockstars()); + Assert.That(response.Results.Count, Is.EqualTo(Rockstar.SeedData.Length)); + } + } + + public class FallbackAuthKeyTests + { + public const string ListeningOn = "http://localhost:2337/"; + + protected readonly ServiceStackHost appHost; + + private readonly byte[] authKey; + private readonly byte[] fallbackAuthKey; + + class JwtAuthProviderReaderAppHost : AppHostHttpListenerBase + { + public JwtAuthProviderReaderAppHost() : base(typeof(FallbackAuthKeyTests).Name, typeof(AppHost).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] { + new JwtAuthProviderReader(AppSettings), + })); + } + } + + public FallbackAuthKeyTests() + { + authKey = AesUtils.CreateKey(); + fallbackAuthKey = AesUtils.CreateKey(); + + appHost = new JwtAuthProviderReaderAppHost + { + AppSettings = new DictionarySettings(new Dictionary { + { "jwt.AuthKeyBase64", Convert.ToBase64String(authKey) }, + { "jwt.AuthKeyBase64.1", Convert.ToBase64String(fallbackAuthKey) }, + { "jwt.RequireSecureConnection", "False" }, + }) + } + .Init() + .Start("http://*:2337/"); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Can_authenticate_with_HM256_token_created_from_fallback_AuthKey() + { + var jwtProvider = (JwtAuthProviderReader)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + + var header = JwtAuthProvider.CreateJwtHeader(jwtProvider.HashAlgorithm); + var payload = JwtAuthProvider.CreateJwtPayload(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }, "external-jwt", TimeSpan.FromDays(14)); + + var token = JwtAuthProvider.CreateJwt(header, payload, + data => JwtAuthProviderReader.HmacAlgorithms["HS256"](fallbackAuthKey, data)); + + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = token + }; + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + } + + public class RsaJwtStatelessAuthTests : StatelessAuthTests + { + protected override ServiceStackHost CreateAppHost() + { + return new AppHost + { + JwtRsaPrivateKey = RsaUtils.CreatePrivateKeyParams(), + Use = container => container.Register(c => + new OrmLiteAuthRepository(c.Resolve())) + }; + } + } + + public class RsaJwtWithEncryptedPayloadsStatelessAuthTests : StatelessAuthTests + { + private RSAParameters privateKey; + private RSAParameters publicKey; + + protected override ServiceStackHost CreateAppHost() + { + privateKey = RsaUtils.CreatePrivateKeyParams(); + publicKey = privateKey.ToPublicRsaParameters(); + + return new AppHost + { + JwtRsaPrivateKey = privateKey, + JwtEncryptPayload = true, + Use = container => container.Register(c => + new OrmLiteAuthRepository(c.Resolve())) + }; + } + + [Test] + public void Can_populate_entire_session_using_JWE_Token() + { + var jwtProvider = (JwtAuthProviderReader)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + + var payload = JwtAuthProvider.CreateJwtPayload(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com", + Roles = new List { "TheRole", "Role 2" }, + Permissions = new List { "ThePermission", "Perm 2" }, + ProfileUrl = "http://example.org/profile.jpg" + }, "external-jwt", TimeSpan.FromDays(14)); + + JwtAuthProviderReaderTests.PopulateWithAdditionalMetadata(payload); + + var jweToken = JwtAuthProvider.CreateEncryptedJweToken(payload, privateKey); + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = jweToken + }; + + var session = client.Get(new GetAuthUserSession()); + + JwtAuthProviderReaderTests.AssertAdditionalMetadataWasPopulated(session); + } + } + + public class JwtAuthProviderReaderTests + { + public const string ListeningOn = "http://localhost:2337/"; + + protected readonly ServiceStackHost appHost; + + private readonly RSAParameters privateKey; + private readonly RSAParameters fallbackPrivakeKey; + + class JwtAuthProviderReaderAppHost : AppHostHttpListenerBase + { + public JwtAuthProviderReaderAppHost() : base("Test Razor", typeof(AppHost).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] { + new JwtAuthProviderReader(AppSettings), + })); + } + } + + public JwtAuthProviderReaderTests() + { + privateKey = RsaUtils.CreatePrivateKeyParams(RsaKeyLengths.Bit2048); + fallbackPrivakeKey = RsaUtils.CreatePrivateKeyParams(RsaKeyLengths.Bit2048); + + appHost = new JwtAuthProviderReaderAppHost + { + AppSettings = new DictionarySettings(new Dictionary { + { "jwt.HashAlgorithm", "RS256" }, + { "jwt.PublicKeyXml", privateKey.ToPublicKeyXml() }, + { "jwt.PublicKeyXml.1", fallbackPrivakeKey.ToPublicKeyXml() }, + { "jwt.RequireSecureConnection", "False" }, + }) + } + .Init() + .Start("http://*:2337/"); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Can_authenticate_with_RSA_token_created_from_external_source() + { + var jwtProvider = (JwtAuthProviderReader)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + + var header = JwtAuthProvider.CreateJwtHeader(jwtProvider.HashAlgorithm); + var payload = JwtAuthProvider.CreateJwtPayload(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }, "external-jwt", TimeSpan.FromDays(14)); + + var token = JwtAuthProvider.CreateJwt(header, payload, + data => RsaUtils.Authenticate(data, privateKey, "SHA256", RsaKeyLengths.Bit2048)); + + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = token + }; + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Can_authenticate_with_RSA_token_created_from_fallback_PrivateKey() + { + var jwtProvider = (JwtAuthProviderReader)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + + var header = JwtAuthProvider.CreateJwtHeader(jwtProvider.HashAlgorithm); + var payload = JwtAuthProvider.CreateJwtPayload(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }, "external-jwt", TimeSpan.FromDays(14)); + + var token = JwtAuthProvider.CreateJwt(header, payload, + data => RsaUtils.Authenticate(data, fallbackPrivakeKey, "SHA256", RsaKeyLengths.Bit2048)); + + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = token + }; + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Token_without_roles_or_permssions_cannot_access_SecuredBy_Role_or_Permission() + { + var jwtProvider = (JwtAuthProviderReader)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + + var header = JwtAuthProvider.CreateJwtHeader(jwtProvider.HashAlgorithm); + var payload = JwtAuthProvider.CreateJwtPayload(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com", + }, "external-jwt", TimeSpan.FromDays(14)); + + var token = JwtAuthProvider.CreateJwt(header, payload, + data => RsaUtils.Authenticate(data, privateKey, "SHA256", RsaKeyLengths.Bit2048)); + + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = token + }; + + StatelessAuthTests.AssertNoAccessToSecuredByRoleAndPermission(client); + } + + [Test] + public void Token_with_roles_and_permssions_can_access_SecuredBy_Role_or_Permission() + { + var jwtProvider = (JwtAuthProviderReader)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + + var header = JwtAuthProvider.CreateJwtHeader(jwtProvider.HashAlgorithm); + var payload = JwtAuthProvider.CreateJwtPayload(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com", + Roles = new List { "TheRole", "Role 2" }, + Permissions = new List { "ThePermission", "Perm 2" }, + }, "external-jwt", TimeSpan.FromDays(14)); + + var token = JwtAuthProvider.CreateJwt(header, payload, + data => RsaUtils.Authenticate(data, privateKey, "SHA256", RsaKeyLengths.Bit2048)); + + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = token + }; + + StatelessAuthTests.AssertAccessToSecuredByRoleAndPermission(client); + } + + [Test] + public void Can_populate_entire_session_using_JWT_Token() + { + var jwtProvider = (JwtAuthProviderReader)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + + var header = JwtAuthProvider.CreateJwtHeader(jwtProvider.HashAlgorithm); + var payload = JwtAuthProvider.CreateJwtPayload(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com", + Roles = new List { "TheRole" }, + Permissions = new List { "ThePermission" }, + ProfileUrl = "http://example.org/profile.jpg" + }, "external-jwt", TimeSpan.FromDays(14)); + + PopulateWithAdditionalMetadata(payload); + + var token = JwtAuthProvider.CreateJwt(header, payload, + data => RsaUtils.Authenticate(data, privateKey, "SHA256", RsaKeyLengths.Bit2048)); + + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = token + }; + + var session = client.Get(new GetAuthUserSession()); + + AssertAdditionalMetadataWasPopulated(session); + } + + public static void AssertAdditionalMetadataWasPopulated(AuthUserSession session) + { + Assert.That(session.Id, Is.EqualTo("SESSIONID")); + Assert.That(session.ReferrerUrl, Is.EqualTo("http://example.org/ReferrerUrl")); + Assert.That(session.UserAuthName, Is.EqualTo("UserAuthName")); + Assert.That(session.TwitterUserId, Is.EqualTo("TwitterUserId")); + Assert.That(session.TwitterScreenName, Is.EqualTo("TwitterScreenName")); + Assert.That(session.FacebookUserId, Is.EqualTo("FacebookUserId")); + Assert.That(session.FirstName, Is.EqualTo("FirstName")); + Assert.That(session.LastName, Is.EqualTo("LastName")); + Assert.That(session.Company, Is.EqualTo("Company")); + Assert.That(session.PrimaryEmail, Is.EqualTo("PrimaryEmail")); + Assert.That(session.PhoneNumber, Is.EqualTo("PhoneNumber")); + Assert.That(session.BirthDate, Is.EqualTo(new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc))); + Assert.That(session.Address, Is.EqualTo("Address")); + Assert.That(session.Address2, Is.EqualTo("Address2")); + Assert.That(session.City, Is.EqualTo("City")); + Assert.That(session.State, Is.EqualTo("State")); + Assert.That(session.Country, Is.EqualTo("Country")); + Assert.That(session.Culture, Is.EqualTo("Culture")); + Assert.That(session.FullName, Is.EqualTo("FullName")); + Assert.That(session.Gender, Is.EqualTo("Gender")); + Assert.That(session.Language, Is.EqualTo("Language")); + Assert.That(session.MailAddress, Is.EqualTo("MailAddress")); + Assert.That(session.Nickname, Is.EqualTo("Nickname")); + Assert.That(session.PostalCode, Is.EqualTo("PostalCode")); + Assert.That(session.TimeZone, Is.EqualTo("TimeZone")); + Assert.That(session.RequestTokenSecret, Is.EqualTo("RequestTokenSecret")); + Assert.That(session.CreatedAt, Is.EqualTo(new DateTime(2010, 1, 1, 0, 0, 0, DateTimeKind.Utc))); + Assert.That(session.LastModified, Is.EqualTo(new DateTime(2016, 1, 1, 0, 0, 0, DateTimeKind.Utc))); + Assert.That(session.Sequence, Is.EqualTo("Sequence")); + Assert.That(session.Tag, Is.EqualTo(1)); + } + + public static void PopulateWithAdditionalMetadata(Dictionary payload) + { + payload["Id"] = "SESSIONID"; + payload["ReferrerUrl"] = "http://example.org/ReferrerUrl"; + payload["UserAuthName"] = "UserAuthName"; + payload["TwitterUserId"] = "TwitterUserId"; + payload["TwitterScreenName"] = "TwitterScreenName"; + payload["FacebookUserId"] = "FacebookUserId"; + payload["FacebookUserName"] = "FacebookUserName"; + payload["FirstName"] = "FirstName"; + payload["LastName"] = "LastName"; + payload["Company"] = "Company"; + payload["PrimaryEmail"] = "PrimaryEmail"; + payload["PhoneNumber"] = "PhoneNumber"; + payload["BirthDate"] = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToUnixTime().ToString(); + payload["Address"] = "Address"; + payload["Address2"] = "Address2"; + payload["City"] = "City"; + payload["State"] = "State"; + payload["Country"] = "Country"; + payload["Culture"] = "Culture"; + payload["FullName"] = "FullName"; + payload["Gender"] = "Gender"; + payload["Language"] = "Language"; + payload["MailAddress"] = "MailAddress"; + payload["Nickname"] = "Nickname"; + payload["PostalCode"] = "PostalCode"; + payload["TimeZone"] = "TimeZone"; + payload["RequestTokenSecret"] = "RequestTokenSecret"; + payload["CreatedAt"] = new DateTime(2010, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToUnixTime().ToString(); + payload["LastModified"] = new DateTime(2016, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToUnixTime().ToString(); + payload["Sequence"] = "Sequence"; + payload["Tag"] = 1.ToString(); + } + } + + public abstract class StatelessAuthTests + { + public const string ListeningOn = "http://localhost:2337/"; + + protected readonly ServiceStackHost appHost; + protected string ApiKey; + protected string ApiKeyTest; + protected string ApiKeyWithRole; + protected IManageApiKeys apiRepo; + protected ApiKeyAuthProvider apiProvider; + protected string userId; + protected string userIdWithRoles; + + protected virtual ServiceStackHost CreateAppHost() + { + return new AppHost + { + Use = container => container.Register(c => + new OrmLiteAuthRepository(c.Resolve())) + }; + } + + public StatelessAuthTests() + { + //LogManager.LogFactory = new ConsoleLogFactory(); + appHost = CreateAppHost() + .Init() + .Start("http://*:2337/"); + + var client = GetClient(); + var response = client.Post(new Register + { + UserName = "user", + Password = "p@55word", + Email = "as@if{0}.com", + DisplayName = "DisplayName", + FirstName = "FirstName", + LastName = "LastName", + }); + + userId = response.UserId; + apiRepo = (IManageApiKeys)appHost.Resolve(); + var user1Client = GetClientWithUserPassword(alwaysSend:true); + ApiKey = user1Client.Get(new GetApiKeys { Environment = "live" }).Results[0].Key; + + apiProvider = (ApiKeyAuthProvider)AuthenticateService.GetAuthProvider(ApiKeyAuthProvider.Name); + + response = client.Post(new Register + { + UserName = "user2", + Password = "p@55word", + Email = "as2@if{0}.com", + DisplayName = "DisplayName2", + FirstName = "FirstName2", + LastName = "LastName2", + }); + userIdWithRoles = response.UserId; + var user2Client = GetClientWithUserPassword(alwaysSend: true, userName: "user2"); + ApiKeyWithRole = user2Client.Get(new GetApiKeys { Environment = "live" }).Results[0].Key; + + ListeningOn.CombineWith("/assignroles").AddQueryParam("authsecret", "secret") + .PostJsonToUrl(new AssignRoles + { + UserName = "user2", + Roles = new List { "TheRole" }, + Permissions = new List { "ThePermission" } + }.ToJson()); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Ignore("Debug Run")] + [Test] + public void RunFor10Mins() + { + Process.Start(ListeningOn); + Thread.Sleep(TimeSpan.FromMinutes(10)); + } + + public const string Username = "user"; + public const string Password = "p@55word"; + + protected virtual IServiceClient GetClientWithUserPassword(bool alwaysSend = false, string userName = null) + { + return new JsonServiceClient(ListeningOn) + { + UserName = userName ?? Username, + Password = Password, + AlwaysSendBasicAuthHeader = alwaysSend, + }; + } + + protected virtual IServiceClient GetClientWithApiKey(string apiKey = null) + { + return new JsonServiceClient(ListeningOn) + { + Credentials = new NetworkCredential(apiKey ?? ApiKey, ""), + }; + } + + protected virtual IServiceClient GetClientWithBearerToken(string bearerToken) + { + return new JsonServiceClient(ListeningOn) + { + BearerToken = bearerToken, + }; + } + + protected virtual IServiceClient GetClient() => new JsonServiceClient(ListeningOn); + + [Test] + public void Does_create_multiple_ApiKeys() + { + if (GetType() == typeof(OrmLiteMultitenancyStatelessAuthTests)) + return; + + var apiKeys = apiRepo.GetUserApiKeys(userId); + Assert.That(apiKeys.Count, Is.EqualTo( + apiProvider.Environments.Length * apiProvider.KeyTypes.Length)); + + Assert.That(apiKeys.All(x => x.UserAuthId != null)); + Assert.That(apiKeys.All(x => x.Environment != null)); + Assert.That(apiKeys.All(x => x.KeyType != null)); + Assert.That(apiKeys.All(x => x.CreatedDate != default(DateTime))); + Assert.That(apiKeys.All(x => x.CancelledDate == null)); + Assert.That(apiKeys.All(x => x.ExpiryDate == null)); + + foreach (var apiKey in apiKeys) + { + var byId = apiRepo.GetApiKey(ApiKey); + Assert.That(byId.Id, Is.EqualTo(ApiKey)); + } + } + + [Test] + public void Does_return_multiple_ApiKeys() + { + var apiKeys = GetClientWithUserPassword(alwaysSend: true).Get(new GetApiKeys { Environment = "test" }).Results; + Assert.That(apiKeys.Count, Is.EqualTo(apiProvider.KeyTypes.Length)); + apiKeys = GetClientWithUserPassword(alwaysSend: true).Get(new GetApiKeys { Environment = "live" }).Results; + Assert.That(apiKeys.Count, Is.EqualTo(apiProvider.KeyTypes.Length)); + } + + [Test] + public void Regenerating_AuthKeys_invalidates_existing_Keys_and_enables_new_keys() + { + var client = new JsonServiceClient(ListeningOn) + { + Credentials = new NetworkCredential(ApiKey, ""), + }; + + var apiKeyResponse = client.Get(new GetApiKeys { Environment = "live" }); + + var oldApiKey = apiKeyResponse.Results[0].Key; + client = new JsonServiceClient(ListeningOn) + { + BearerToken = oldApiKey, + }; + + //Key IsValid + var request = new Secured { Name = "regenerate" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var regenResponse = client.Send(new RegenerateApiKeys { Environment = "live" }); + + try + { + //Key is no longer valid + apiKeyResponse = client.Get(new GetApiKeys { Environment = "live" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + } + + //Change to new Valid Key + client.BearerToken = regenResponse.Results[0].Key; + apiKeyResponse = client.Get(new GetApiKeys { Environment = "live" }); + + Assert.That(regenResponse.Results.Map(x => x.Key), Is.EquivalentTo( + apiKeyResponse.Results.Map(x => x.Key))); + } + + [Test] + public void Doesnt_allow_using_expired_keys() + { + if (GetType() == typeof(OrmLiteMultitenancyStatelessAuthTests)) + return; + + var client = new JsonServiceClient(ListeningOn) + { + Credentials = new NetworkCredential(ApiKey, ""), + }; + + var authResponse = client.Get(new Authenticate()); + + var apiKeys = apiRepo.GetUserApiKeys(authResponse.UserId) + .Where(x => x.Environment == "test") + .ToList(); + + var oldApiKey = apiKeys[0].Id; + client = new JsonServiceClient(ListeningOn) + { + BearerToken = oldApiKey, + }; + + //Key IsValid + var request = new Secured { Name = "live" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + apiKeys[0].ExpiryDate = DateTime.UtcNow.AddMinutes(-1); + apiRepo.StoreAll(new[] { apiKeys[0] }); + + try + { + //Key is no longer valid + client.Get(new GetApiKeys { Environment = "test" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + } + + client = new JsonServiceClient(ListeningOn) + { + Credentials = new NetworkCredential(ApiKey, ""), + }; + var regenResponse = client.Send(new RegenerateApiKeys { Environment = "test" }); + + //Change to new Valid Key + client.BearerToken = regenResponse.Results[0].Key; + var apiKeyResponse = client.Get(new GetApiKeys { Environment = "test" }); + + Assert.That(regenResponse.Results.Map(x => x.Key), Is.EquivalentTo( + apiKeyResponse.Results.Map(x => x.Key))); + } + + [Test] + public void Doesnt_allow_sending_invalid_APIKeys() + { + var client = new JsonServiceClient(ListeningOn) + { + Credentials = new NetworkCredential("InvalidKey", ""), + }; + + var request = new Secured { Name = "live" }; + try + { + var response = client.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo("NotFound")); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("ApiKey does not exist")); + Assert.That(ex.ResponseStatus.StackTrace, Is.Not.Null); + } + } + + [Test] + public void Authenticating_once_with_BasicAuth_does_not_establish_auth_session() + { + var client = GetClientWithUserPassword(alwaysSend: true); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var newClient = GetClient(); + newClient.SetSessionId(client.GetSessionId()); + try + { + response = newClient.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + } + + [Test] + public void Authenticating_once_with_JWT_does_not_establish_auth_session() + { + var client = GetClientWithUserPassword(alwaysSend: true); + + var authResponse = client.Send(new Authenticate()); + Assert.That(authResponse.BearerToken, Is.Not.Null); + + var jwtClient = GetClientWithBearerToken(authResponse.BearerToken); + var request = new Secured { Name = "test" }; + var response = jwtClient.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + response = jwtClient.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var newClient = GetClient(); + newClient.SetSessionId(jwtClient.GetSessionId()); + + try + { + response = newClient.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + } + + [Test] + public void Authenticating_with_JWT_cookie_does_allow_multiple_authenticated_requests() + { + var client = GetClientWithUserPassword(alwaysSend: true); + + var authResponse = client.Send(new Authenticate()); + Assert.That(authResponse.BearerToken, Is.Not.Null); + + var jwtClient = GetClient(); + jwtClient.SetTokenCookie(authResponse.BearerToken); + + var request = new Secured { Name = "test" }; + var response = jwtClient.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var newClient = GetClient(); + var cookieValue = jwtClient.GetTokenCookie(); + newClient.SetTokenCookie(cookieValue); + response = newClient.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Authenticating_once_with_ApiKeyAuth_does_not_establish_auth_session() + { + var client = GetClientWithApiKey(); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var newClient = GetClient(); + newClient.SetSessionId(client.GetSessionId()); + try + { + response = newClient.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + } + + [Test] + public async Task Authenticating_once_with_ApiKeyAuth_does_not_establish_auth_session_Async() + { + var client = GetClientWithApiKey(); + + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var newClient = GetClient(); + newClient.SetSessionId(client.GetSessionId()); + try + { + response = await newClient.SendAsync(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + } + + [Test] + public void Authenticating_once_with_ApiKeyAuth_BearerToken_does_not_establish_auth_session() + { + var client = GetClientWithBearerToken(ApiKey); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var newClient = GetClient(); + newClient.SetSessionId(client.GetSessionId()); + try + { + response = newClient.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + } + + [Test] + public async Task Authenticating_once_with_ApiKeyAuth_BearerToken_does_not_establish_auth_session_Async() + { + var client = GetClientWithBearerToken(ApiKey); + + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var newClient = GetClient(); + newClient.SetSessionId(client.GetSessionId()); + try + { + response = await newClient.SendAsync(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + } + + [Test] + public void Authenticating_once_with_CredentialsAuth_does_establish_auth_session() + { + var client = GetClient(); + + try + { + client.Send(new Authenticate()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + + client.Post(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + }); + + client.Send(new Authenticate()); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var newClient = GetClient(); + newClient.SetSessionId(client.GetSessionId()); + response = newClient.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Can_Authenticate_with_ApiKeyAuth_SessionCacheDuration() + { + apiProvider.SessionCacheDuration = TimeSpan.FromSeconds(60); + + var client = GetClientWithBearerToken(ApiKey); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + //Does not preserve UserSession + var newClient = GetClient(); + newClient.SetSessionId(client.GetSessionId()); + try + { + response = newClient.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + + var cachedSession = appHost.GetCacheClient(null).Get(ApiKeyAuthProvider.GetSessionKey(ApiKey)); + Assert.That(cachedSession.IsAuthenticated); + + //Can call multiple times using cached UserSession + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + apiProvider.SessionCacheDuration = null; + } + + public static void AssertNoAccessToSecuredByRoleAndPermission(IServiceClient client) + { + try + { + client.Send(new SecuredByRole { Name = "test" }); + Assert.Fail("Should Throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + } + + try + { + client.Send(new SecuredByPermission { Name = "test" }); + Assert.Fail("Should Throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + } + } + + [Test] + public void Can_not_access_SecuredBy_Role_or_Permission_without_TheRole_or_ThePermission() + { + var client = GetClientWithUserPassword(alwaysSend: true); + AssertNoAccessToSecuredByRoleAndPermission(client); + + client = GetClientWithApiKey(); + AssertNoAccessToSecuredByRoleAndPermission(client); + + var bearerToken = client.Get(new Authenticate()).BearerToken; + client = GetClientWithBearerToken(bearerToken); + AssertNoAccessToSecuredByRoleAndPermission(client); + + client = GetClient(); + client.Post(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + }); + AssertNoAccessToSecuredByRoleAndPermission(client); + } + + public static void AssertAccessToSecuredByRoleAndPermission(IServiceClient client) + { + var roleResponse = client.Send(new SecuredByRole { Name = "test" }); + Assert.That(roleResponse.Result, Is.EqualTo("test")); + + var permResponse = client.Send(new SecuredByPermission { Name = "test" }); + Assert.That(permResponse.Result, Is.EqualTo("test")); + } + + [Test] + public void Can_access_SecuredBy_Role_or_Permission_with_TheRole_and_ThePermission() + { + var client = GetClientWithUserPassword(alwaysSend: true, userName: "user2"); + AssertAccessToSecuredByRoleAndPermission(client); + + client = GetClientWithApiKey(ApiKeyWithRole); + AssertAccessToSecuredByRoleAndPermission(client); + + var bearerToken = client.Get(new Authenticate()).BearerToken; + client = GetClientWithBearerToken(bearerToken); + AssertAccessToSecuredByRoleAndPermission(client); + + client = GetClient(); + client.Post(new Authenticate + { + provider = "credentials", + UserName = "user2", + Password = Password, + }); + AssertAccessToSecuredByRoleAndPermission(client); + } + + [Test] + public void Can_not_access_Secure_service_with_invalidated_token() + { + var jwtProvider = (JwtAuthProvider)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + + var token = jwtProvider.CreateJwtBearerToken(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }); + + var client = GetClientWithBearerToken(token); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + jwtProvider.InvalidateTokensIssuedBefore = DateTime.UtcNow.AddSeconds(1); + + try + { + response = client.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(TokenException).Name)); + } + finally + { + jwtProvider.InvalidateTokensIssuedBefore = null; + } + } + + [Test] + public void Can_not_access_Secure_service_with_expired_token() + { + var jwtProvider = (JwtAuthProvider)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + jwtProvider.CreatePayloadFilter = (jwtPayload,session) => + jwtPayload["exp"] = DateTime.UtcNow.AddSeconds(-1).ToUnixTime().ToString(); + + var token = jwtProvider.CreateJwtBearerToken(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }); + + jwtProvider.CreatePayloadFilter = null; + + var client = GetClientWithBearerToken(token); + + try + { + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(TokenException).Name)); + } + } + + [Test] + public void Can_Auto_reconnect_with_BasicAuth_after_expired_token() + { + var authClient = GetClientWithUserPassword(alwaysSend: true); + + var called = 0; + var client = new JsonServiceClient(ListeningOn) + { + BearerToken = CreateExpiredToken(), + }; + client.OnAuthenticationRequired = () => + { + called++; + client.BearerToken = authClient.Send(new Authenticate()).BearerToken; + }; + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + Assert.That(called, Is.EqualTo(1)); + } + + [Test] + public async Task Can_Auto_reconnect_with_BasicAuth_after_expired_token_Async() + { + var authClient = GetClientWithUserPassword(alwaysSend: true); + + var called = 0; + var client = new JsonServiceClient(ListeningOn) { + BearerToken = CreateExpiredToken(), + }; + client.OnAuthenticationRequired = () => + { + called++; + client.BearerToken = authClient.Send(new Authenticate()).BearerToken; + }; + + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + Assert.That(called, Is.EqualTo(1)); + } + + [Test] + public void Can_not_access_Secure_service_on_unsecured_connection_when_RequireSecureConnection() + { + var jwtProvider = (JwtAuthProvider)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + jwtProvider.RequireSecureConnection = true; + + var token = jwtProvider.CreateJwtBearerToken(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }); + + var client = GetClientWithBearerToken(token); + + try + { + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + Assert.That(ex.ErrorCode, Is.EqualTo("Forbidden")); + } + finally + { + jwtProvider.RequireSecureConnection = false; + } + } + + [Test] + public void Can_ConvertSessionToToken() + { + var client = GetClient(); + + client.Send(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + }); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var newClient = GetClient(); + newClient.SetSessionId(client.GetSessionId()); + + var tokenResponse = newClient.Send(new ConvertSessionToToken()); + var tokenCookie = newClient.GetTokenCookie(); + response = newClient.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + try + { + response = client.Send(request); + Assert.Fail("should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + + response = newClient.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Can_ConvertSessionToToken_when_authenticating() + { + var client = GetClient(); + + var authResponse = client.Send(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + UseTokenCookie = true + }); + + var token = client.GetTokenCookie(); + Assert.That(token, Is.Not.Null); + Assert.That(token, Is.EqualTo(authResponse.BearerToken)); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var clientWithToken = GetClient(); + clientWithToken.SetTokenCookie(client.GetTokenCookie()); + + response = clientWithToken.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var clientWithSession = GetClient(); + clientWithSession.SetSessionId(client.GetSessionId()); + + try + { + response = clientWithSession.Send(request); + Assert.Fail("should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + } + + private static string CreateExpiredToken() + { + var jwtProvider = (JwtAuthProvider)AuthenticateService.GetAuthProvider(JwtAuthProvider.Name); + jwtProvider.CreatePayloadFilter = (jwtPayload, session) => + jwtPayload["exp"] = DateTime.UtcNow.AddSeconds(-1).ToUnixTime().ToString(); + + var token = jwtProvider.CreateJwtBearerToken(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }); + + jwtProvider.CreatePayloadFilter = null; + return token; + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Benchmarks/RedisMqServerBenchmarks.cs b/tests/ServiceStack.Server.Tests/Benchmarks/RedisMqServerBenchmarks.cs index a3b697dfbd3..8ff2c5dbe5b 100644 --- a/tests/ServiceStack.Server.Tests/Benchmarks/RedisMqServerBenchmarks.cs +++ b/tests/ServiceStack.Server.Tests/Benchmarks/RedisMqServerBenchmarks.cs @@ -6,7 +6,7 @@ namespace ServiceStack.Server.Tests.Benchmarks { - [TestFixture, Category("Benchmarks"), Explicit] + [TestFixture, Category("Benchmarks"), Ignore("Benchmarks")] public class RedisMqServerBenchmarks { public class Incr diff --git a/tests/ServiceStack.Server.Tests/Benchmarks/RedisMqServerServerBenchmarks.cs b/tests/ServiceStack.Server.Tests/Benchmarks/RedisMqServerServerBenchmarks.cs index 825f0c54ee1..f647094168f 100644 --- a/tests/ServiceStack.Server.Tests/Benchmarks/RedisMqServerServerBenchmarks.cs +++ b/tests/ServiceStack.Server.Tests/Benchmarks/RedisMqServerServerBenchmarks.cs @@ -8,8 +8,7 @@ namespace ServiceStack.Server.Tests.Benchmarks { - [Ignore] - [Explicit] + [Ignore("Benchmarks")] [TestFixture, Category("Benchmarks")] public class RedisMqServerServerBenchmarks { diff --git a/tests/ServiceStack.Server.Tests/Caching/CacheClientTests.cs b/tests/ServiceStack.Server.Tests/Caching/CacheClientTests.cs new file mode 100644 index 00000000000..980e98f64bb --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Caching/CacheClientTests.cs @@ -0,0 +1,162 @@ +using System; +using System.Threading; +using NUnit.Framework; +using ServiceStack.Caching; +using ServiceStack.DataAnnotations; +using ServiceStack.OrmLite; +using ServiceStack.Redis; +using ServiceStack.Server.Tests.Shared; + +namespace ServiceStack.Server.Tests.Caching +{ + public class SqlServerOrmLiteCacheClientTests : CacheClientTestsBase + { + public override ICacheClient CreateClient() + { + var cache = new OrmLiteCacheClient + { + DbFactory = new OrmLiteConnectionFactory( + Config.SqlServerConnString, SqlServerDialect.Provider) + }; + + using (var db = cache.DbFactory.Open()) + { + db.DropTable(); + } + + cache.InitSchema(); + + return cache; + } + } + + public class SqliteOrmLiteCacheClientTests : CacheClientTestsBase + { + public override ICacheClient CreateClient() + { + var cache = new OrmLiteCacheClient + { + DbFactory = new OrmLiteConnectionFactory( + ":memory:", SqliteDialect.Provider) + }; + cache.InitSchema(); + + return cache; + } + } + + public class MemoryCacheClientTests : CacheClientTestsBase + { + public override ICacheClient CreateClient() + { + return new MemoryCacheClient(); + } + + [Test] + public void Increments_are_Atomic() + { + var CacheClient = CreateClient(); + + var numThreads = 20; + var numIncr = 10000; + var resetEvent = new ManualResetEvent(false); + var threadsLeft = numThreads; + + for (var i = 0; i < numThreads; i++) + { + new Thread(() => + { + for (var j = 0; j < numIncr; j++) + { + CacheClient.Increment("test", 1); + } + if (Interlocked.Decrement(ref threadsLeft) == 0) + resetEvent.Set(); + }).Start(); + } + + resetEvent.WaitOne(); + + Assert.That(CacheClient.Increment("test", 0), Is.EqualTo(numThreads * numIncr)); + } + } + + public class RedisCacheClientTests : CacheClientTestsBase + { + public override ICacheClient CreateClient() + { + return new RedisManagerPool("127.0.0.1").GetCacheClient(); + } + } + + public class SqlServer2014MemoryOptimizedOrmLiteCacheClientTests : CacheClientTestsBase + { + public override ICacheClient CreateClient() + { + var cache = new OrmLiteCacheClient + { + DbFactory = new OrmLiteConnectionFactory( + Config.SqlServerConnString, SqlServer2014Dialect.Provider) + }; + + using (var db = cache.DbFactory.Open()) + { + db.DropTable(); + } + + cache.InitSchema(); + + return cache; + } + } + + [SqlServerMemoryOptimized(SqlServerDurability.SchemaOnly)] + public class SqlServer2014MemoryOptimizedCacheEntry : ICacheEntry + { + [PrimaryKey] + [SqlServerCollate("Latin1_General_100_BIN2")] + [StringLength(512)] + [SqlServerBucketCount(10000000)] + public string Id { get; set; } + [StringLength(4000)] + public string Data { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime? ExpiryDate { get; set; } + public DateTime ModifiedDate { get; set; } + } + + public class SqlServer2016MemoryOptimizedOrmLiteCacheClientTests : CacheClientTestsBase + { + public override ICacheClient CreateClient() + { + var cache = new OrmLiteCacheClient + { + DbFactory = new OrmLiteConnectionFactory( + Config.SqlServerConnString, SqlServer2016Dialect.Provider) + }; + + using (var db = cache.DbFactory.Open()) + { + db.DropTable(); + } + + cache.InitSchema(); + + return cache; + } + } + + [SqlServerMemoryOptimized(SqlServerDurability.SchemaOnly)] + public class SqlServer2016MemoryOptimizedCacheEntry : ICacheEntry + { + [PrimaryKey] + [StringLength(StringLengthAttribute.MaxText)] + [SqlServerBucketCount(10000000)] + public string Id { get; set; } + [StringLength(StringLengthAttribute.MaxText)] + public string Data { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime? ExpiryDate { get; set; } + public DateTime ModifiedDate { get; set; } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Config.cs b/tests/ServiceStack.Server.Tests/Config.cs new file mode 100644 index 00000000000..0e9e6025090 --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Config.cs @@ -0,0 +1,15 @@ +using System; + +namespace ServiceStack.Server.Tests +{ + public class Config + { + public const string ServiceStackBaseUri = "http://localhost:20000"; + public const string AbsoluteBaseUri = ServiceStackBaseUri + "/"; + public const string ListeningOn = ServiceStackBaseUri + "/"; + + public static readonly string RabbitMQConnString = Environment.GetEnvironmentVariable("CI_RABBITMQ") ?? "localhost"; + public static readonly string SqlServerConnString = Environment.GetEnvironmentVariable("MSSQL_CONNECTION") + ?? "Server=localhost;Database=test;User Id=test;Password=test;"; + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Login.cshtml b/tests/ServiceStack.Server.Tests/Login.cshtml new file mode 100644 index 00000000000..f2dd56a9645 --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Login.cshtml @@ -0,0 +1,3 @@ +

      Login Page

      + + \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Messaging/InspectingMqTests.cs b/tests/ServiceStack.Server.Tests/Messaging/InspectingMqTests.cs index 391a0839eea..698a24e74e8 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/InspectingMqTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/InspectingMqTests.cs @@ -36,7 +36,7 @@ public class InspectingMqTests IMessageService mqService; IRedisClientsManager redisManager; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { redisManager = new BasicRedisClientManager(); @@ -56,7 +56,7 @@ public void TestFixtureSetUp() } } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { mqService.Dispose(); @@ -83,7 +83,6 @@ public void Can_get_RedisMq_stats() } } - redisMqStats.PrintDump(); } } } diff --git a/tests/ServiceStack.Server.Tests/Messaging/MessageSerializationTests.cs b/tests/ServiceStack.Server.Tests/Messaging/MessageSerializationTests.cs index f757f9d9727..a2077f001e4 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/MessageSerializationTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/MessageSerializationTests.cs @@ -1,4 +1,5 @@ using System; +using System.Reflection; using NUnit.Framework; using ServiceStack.Messaging; using ServiceStack.Model; diff --git a/tests/ServiceStack.Server.Tests/Messaging/MqAppHostTests.cs b/tests/ServiceStack.Server.Tests/Messaging/MqAppHostTests.cs new file mode 100644 index 00000000000..00a7a7c523a --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Messaging/MqAppHostTests.cs @@ -0,0 +1,178 @@ +using System; +using System.Threading; +using Funq; +using NUnit.Framework; +using ServiceStack.Messaging; +using ServiceStack.RabbitMq; +using ServiceStack.Server.Tests.Caching; +using TestsConfig = ServiceStack.Server.Tests.Config; + +namespace ServiceStack.Server.Tests.Messaging +{ + public interface IScopedDep + { + } + public class ScopedDep : IScopedDep + { + private static int timesCalled; + public static int TimesCalled + { + get => timesCalled; + set => timesCalled = value; + } + + public ScopedDep() + { + Interlocked.Increment(ref timesCalled); + } + } + + public class MqAppHost : AppSelfHostBase + { + public MqAppHost() + : base(typeof(MqAppHost).Name, typeof(MqAppHostServices).Assembly) {} + + +#if NETCORE + public override void Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection services) + { + Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions + .AddScoped(services); + } +#endif + + + public override void Configure(Container container) + { + var mqServer = new RabbitMqServer(connectionString: TestsConfig.RabbitMQConnString); + + mqServer.RegisterHandler( + ExecuteMessage, + HandleMqCustomException); + + mqServer.RegisterHandler(ExecuteMessage); + + container.Register(c => mqServer); + mqServer.Start(); + } + + protected override void Dispose(bool disposing) + { + Resolve().Dispose(); + base.Dispose(disposing); + } + + public CustomException LastCustomException; + + public void HandleMqCustomException(IMessageHandler mqHandler, IMessage message, Exception ex) + { + LastCustomException = ex.InnerException as CustomException; + + bool requeue = !(ex is UnRetryableMessagingException) + && message.RetryAttempts < 1; + + if (requeue) + { + message.RetryAttempts++; + } + + message.Error = ex.ToResponseStatus(); + mqHandler.MqClient.Nak(message, requeue: requeue, exception: ex); + } + } + + public class CustomException : Exception + { + public CustomException() {} + public CustomException(string message) : base(message) {} + public CustomException(string message, Exception innerException) : base(message, innerException) {} + } + + public class MqCustomException + { + public string Message { get; set; } + } + + public class MqScopeDep : IReturnVoid {} + + public class MqAppHostServices : Service + { + public static int TimesCalled = 0; + + public object Any(MqCustomException request) + { + TimesCalled++; + throw new CustomException("ERROR: " + request.Message); + } + +#if NETCORE + public void Any(MqScopeDep request) + { + var instance1 = Request.TryResolve(); + var instance2 = Request.ResolveScoped(); + if (instance1 != instance2) + throw new Exception("instance1 != instance2"); + } +#endif + + } + + public class MqAppHostTests + { + private readonly MqAppHost appHost; + + public MqAppHostTests() + { + this.appHost = new MqAppHost(); + appHost + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Can_handle_custom_exception() + { + MqAppHostServices.TimesCalled = 0; + + using (var mqClient = appHost.TryResolve().CreateMessageQueueClient()) + { + mqClient.Publish(new MqCustomException { Message = "foo" }); + + Thread.Sleep(1000); + + Assert.That(MqAppHostServices.TimesCalled, Is.EqualTo(2)); + Assert.That(appHost.LastCustomException.Message, Is.EqualTo("ERROR: foo")); + } + } + +#if NETCORE + [Test] + public void Can_resolve_scoped_deps() + { + ScopedDep.TimesCalled = 0; + + using (var mqClient = appHost.TryResolve().CreateMessageQueueClient()) + { + mqClient.Publish(new MqScopeDep()); + + Thread.Sleep(1000); + + Assert.That(ScopedDep.TimesCalled, Is.EqualTo(1)); + + mqClient.Publish(new MqScopeDep()); + + Thread.Sleep(1000); + + Assert.That(ScopedDep.TimesCalled, Is.EqualTo(2)); + } + } +#endif + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Messaging/MqNameTests.cs b/tests/ServiceStack.Server.Tests/Messaging/MqNameTests.cs index 1a9f4f32597..519fb5b4781 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/MqNameTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/MqNameTests.cs @@ -9,8 +9,8 @@ public class MqQueueNamesTests [Test] public void Does_resolve_the_same_default_QueueNames() { - Assert.That(new QueueNames(typeof(HelloIntro)).In, Is.EqualTo("mq:Hello.inq")); - Assert.That(QueueNames.In, Is.EqualTo("mq:Hello.inq")); + Assert.That(new QueueNames(typeof(HelloIntro)).In, Is.EqualTo("mq:HelloIntro.inq")); + Assert.That(QueueNames.In, Is.EqualTo("mq:HelloIntro.inq")); } public class TestPrefix { } @@ -39,5 +39,35 @@ public void Does_resolve_QueueNames_using_Custom_Filter() QueueNames.ResolveQueueNameFn = QueueNames.ResolveQueueName; } + + [Test] + public void Can_determine_TempQueue() + { + var tmpName = QueueNames.GetTempQueueName(); + Assert.That(QueueNames.IsTempQueue(tmpName), Is.True); + } + + [Test] + public void Can_determine_TempQueue_with_Custom_QueuePrefix() + { + QueueNames.SetQueuePrefix("site1."); + + var tmpName = QueueNames.GetTempQueueName(); + Assert.That(QueueNames.IsTempQueue(tmpName), Is.True); + + QueueNames.SetQueuePrefix(""); + } + + [Test] + public void Can_determine_TempQueue_with_Custom_QueueNameFm() + { + QueueNames.ResolveQueueNameFn = (typeName, suffix) => + "SITE.{0}{1}".Fmt(typeName, suffix.ToUpper()); + + var tmpName = QueueNames.GetTempQueueName(); + Assert.That(QueueNames.IsTempQueue(tmpName), Is.True); + + QueueNames.ResolveQueueNameFn = QueueNames.ResolveQueueName; + } } } \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Messaging/MqRequestReplyTests.cs b/tests/ServiceStack.Server.Tests/Messaging/MqRequestReplyTests.cs index f8f4b62beda..b5bde43f76f 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/MqRequestReplyTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/MqRequestReplyTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Concurrent; +using System.Collections.Generic; using System.Diagnostics; using System.Threading; using Funq; @@ -12,14 +13,16 @@ namespace ServiceStack.Server.Tests.Messaging { + [Ignore("Integration Tests")] public class RabbitMqRequestReplyTests : MqRequestReplyTests { public override IMessageService CreateMqServer(int retryCount = 1) { - return new RabbitMqServer { RetryCount = retryCount }; + return new RabbitMqServer(connectionString: Config.RabbitMQConnString) { RetryCount = retryCount }; } } + [Ignore("Integration Tests")] public class RedisMqRequestReplyTests : MqRequestReplyTests { public override IMessageService CreateMqServer(int retryCount = 1) @@ -57,7 +60,14 @@ public override IMessageService CreateMqServer(int retryCount = 1) } } - [Explicit("Integration Tests")] + public class BackgroundMqRequestReplyTests : MqRequestReplyTests + { + public override IMessageService CreateMqServer(int retryCount = 1) + { + return new BackgroundMqService { RetryCount = retryCount }; + } + } + [TestFixture] public abstract class MqRequestReplyTests { @@ -87,6 +97,61 @@ public void Can_publish_messages_to_the_ReplyTo_temporary_queue() } } + [Test] + public void Can_send_message_with_custom_Header() + { + using (var mqServer = CreateMqServer()) + { + mqServer.RegisterHandler(m => + new Message(new HelloIntroResponse { Result = "Hello, {0}!".Fmt(m.GetBody().Name) }) { Meta = m.Meta }); + mqServer.Start(); + + using (var mqClient = mqServer.CreateMessageQueueClient()) + { + var replyToMq = mqClient.GetTempQueueName(); + mqClient.Publish(new Message(new HelloIntro { Name = "World" }) + { + ReplyTo = replyToMq, + Meta = new Dictionary { { "Custom", "Header" } } + }); + + IMessage responseMsg = mqClient.Get(replyToMq); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); + Assert.That(responseMsg.Meta["Custom"], Is.EqualTo("Header")); + } + } + } + + [Test] + public void Can_send_message_with_custom_Tag() + { + using (var mqServer = CreateMqServer()) + { + if (mqServer is RabbitMqServer) + return; //Uses DeliveryTag for Tag + + mqServer.RegisterHandler(m => + new Message(new HelloIntroResponse { Result = "Hello, {0}!".Fmt(m.GetBody().Name) }) { Tag = m.Tag }); + mqServer.Start(); + + using (var mqClient = mqServer.CreateMessageQueueClient()) + { + var replyToMq = mqClient.GetTempQueueName(); + mqClient.Publish(new Message(new HelloIntro { Name = "World" }) + { + ReplyTo = replyToMq, + Tag = "Custom" + }); + + IMessage responseMsg = mqClient.Get(replyToMq); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); + Assert.That(responseMsg.Tag, Is.EqualTo("Custom")); + } + } + } + public class Incr { public long Value { get; set; } @@ -97,6 +162,7 @@ public class IncrResponse public long Result { get; set; } } + [Ignore("Takes too long")] [Test] public void Can_handle_multiple_rpc_clients() { @@ -165,7 +231,6 @@ public void Can_handle_multiple_rpc_clients() "Stopping Server...".Print(); "Requests: {0}".Print(counter); - errors.PrintDump(); } Assert.That(errors.Count, Is.EqualTo(0)); diff --git a/tests/ServiceStack.Server.Tests/Messaging/MqServerIntroTests.cs b/tests/ServiceStack.Server.Tests/Messaging/MqServerIntroTests.cs index 8659b62ddf9..6caf483c862 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/MqServerIntroTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/MqServerIntroTests.cs @@ -1,6 +1,9 @@ using System; +using System.Threading; using Funq; using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Host; using ServiceStack.Messaging; using ServiceStack.Messaging.Redis; using ServiceStack.RabbitMq; @@ -14,7 +17,13 @@ public class RabbitMqServerIntroTests : MqServerIntroTests { public override IMessageService CreateMqServer(int retryCount = 1) { - return new RabbitMqServer { RetryCount = retryCount }; + var mqServer = new RabbitMqServer(connectionString: Config.RabbitMQConnString) { RetryCount = retryCount }; + + using var conn = mqServer.ConnectionFactory.CreateConnection(); + using var channel = conn.CreateModel(); + channel.PurgeQueue(); + channel.PurgeQueue(); + return mqServer; } } @@ -22,7 +31,12 @@ public class RedisMqServerIntroTests : MqServerIntroTests { public override IMessageService CreateMqServer(int retryCount = 1) { - return new RedisMqServer(new BasicRedisClientManager()) { RetryCount = retryCount }; + var redisManager = new BasicRedisClientManager(); + using (var redis = redisManager.GetClient()) + { + redis.FlushAll(); + } + return new RedisMqServer(redisManager) { RetryCount = retryCount }; } } @@ -34,7 +48,15 @@ public override IMessageService CreateMqServer(int retryCount = 1) } } - public class HelloIntro + public class BackgroundMqServerIntroTests : MqServerIntroTests + { + public override IMessageService CreateMqServer(int retryCount = 1) + { + return new BackgroundMqService { RetryCount = retryCount }; + } + } + + public class HelloIntro : IReturn { public string Name { get; set; } } @@ -52,25 +74,130 @@ public object Any(HelloIntro request) } } + public class MqAuthOnly : IReturn + { + public string Name { get; set; } + public string SessionId { get; set; } + } + + public class MqAuthOnlyResponse + { + public string Result { get; set; } + } + + public class MqAuthOnlyToken : IHasBearerToken, IReturn + { + public string Name { get; set; } + public string BearerToken { get; set; } + } + + public class MqAuthOnlyService : Service + { + [Authenticate] + public object Any(MqAuthOnly request) + { + var session = base.SessionAs(); + return new MqAuthOnlyResponse + { + Result = $"Hello, {request.Name}! Your UserName is {session.UserAuthName}" + }; + } + + [Authenticate] + public object Any(MqAuthOnlyToken request) + { + var session = base.SessionAs(); + return new MqAuthOnlyResponse + { + Result = $"Hello, {request.Name}! Your UserName is {session.UserName}" + }; + } + } + + [Restrict(RequestAttributes.MessageQueue)] + public class MqRestriction : IReturn + { + public string Name { get; set; } + } + + public class MqRestrictionResponse + { + public string Result { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class MqRestrictionService : Service + { + public object Any(MqRestriction request) => + new MqRestrictionResponse { Result = request.Name }; + } + public class AppHost : AppSelfHostBase { private readonly Func createMqServerFn; public AppHost(Func createMqServerFn) - : base("Rabbit MQ Test Host", typeof (HelloService).Assembly) + : base("Rabbit MQ Test Host", typeof(HelloService).Assembly) { this.createMqServerFn = createMqServerFn; } public override void Configure(Container container) { + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] { + new CredentialsAuthProvider(AppSettings), + new JwtAuthProvider(AppSettings) { + AuthKey = AesUtils.CreateKey(), + RequireSecureConnection = false, + }, + })); + + container.Register(c => new InMemoryAuthRepository()); + var authRepo = container.Resolve(); + + try + { + ((IClearable)authRepo).Clear(); + } + catch { /*ignore*/ } + + authRepo.CreateUserAuth(new UserAuth + { + Id = 1, + UserName = "mythz", + FirstName = "First", + LastName = "Last", + DisplayName = "Display", + }, "p@55word"); + container.Register(c => createMqServerFn()); var mqServer = container.Resolve(); - mqServer.RegisterHandler(ServiceController.ExecuteMessage); + mqServer.RegisterHandler(ExecuteMessage); + mqServer.RegisterHandler(ExecuteMessage); + mqServer.RegisterHandler(m => + { + var req = new BasicRequest + { + Verb = HttpMethods.Post, + Headers = { ["X-ss-id"] = m.GetBody().SessionId } + }; + var response = ExecuteMessage(m, req); + return response; + }); + mqServer.RegisterHandler(ExecuteMessage); mqServer.Start(); } + + protected override void Dispose(bool disposable) + { + var mqServer = TryResolve(); + mqServer?.Dispose(); + + base.Dispose(disposable); + } } [TestFixture] @@ -81,117 +208,225 @@ public abstract class MqServerIntroTests [Test] public void Messages_with_no_responses_are_published_to_Request_outq_topic() { - using (var mqServer = CreateMqServer()) + using var mqServer = CreateMqServer(); + mqServer.RegisterHandler(m => { - mqServer.RegisterHandler(m => - { - "Hello, {0}!".Print(m.GetBody().Name); - return null; - }); - mqServer.Start(); + "Hello, {0}!".Print(m.GetBody().Name); + return null; + }); + mqServer.Start(); - using (var mqClient = mqServer.CreateMessageQueueClient()) - { - mqClient.Publish(new HelloIntro { Name = "World" }); + using var mqClient = mqServer.CreateMessageQueueClient(); + mqClient.Publish(new HelloIntro { Name = "World" }); - IMessage msgCopy = mqClient.Get(QueueNames.Out); - mqClient.Ack(msgCopy); - Assert.That(msgCopy.GetBody().Name, Is.EqualTo("World")); - } - } + IMessage msgCopy = mqClient.Get(QueueNames.Out); + mqClient.Ack(msgCopy); + Assert.That(msgCopy.GetBody().Name, Is.EqualTo("World")); } [Test] public void Message_with_response_are_published_to_Response_inq() { - using (var mqServer = CreateMqServer()) - { - mqServer.RegisterHandler(m => - new HelloIntroResponse { Result = "Hello, {0}!".Fmt(m.GetBody().Name) }); - mqServer.Start(); + using var mqServer = CreateMqServer(); + mqServer.RegisterHandler(m => + new HelloIntroResponse { Result = "Hello, {0}!".Fmt(m.GetBody().Name) }); + mqServer.Start(); - using (var mqClient = mqServer.CreateMessageQueueClient()) - { - mqClient.Publish(new HelloIntro { Name = "World" }); + using var mqClient = mqServer.CreateMessageQueueClient(); + mqClient.Publish(new HelloIntro { Name = "World" }); - IMessage responseMsg = mqClient.Get(QueueNames.In); - mqClient.Ack(responseMsg); - Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); - } - } + IMessage responseMsg = mqClient.Get(QueueNames.In); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); } [Test] public void Message_with_exceptions_are_retried_then_published_to_Request_dlq() { - using (var mqServer = CreateMqServer(retryCount:1)) + using var mqServer = CreateMqServer(retryCount: 1); + var called = 0; + mqServer.RegisterHandler(m => { - var called = 0; - mqServer.RegisterHandler(m => - { - called++; - throw new ArgumentException("Name"); - }); - mqServer.Start(); + Interlocked.Increment(ref called); + throw new ArgumentException("Name"); + }); + mqServer.Start(); - using (var mqClient = mqServer.CreateMessageQueueClient()) - { - mqClient.Publish(new HelloIntro { Name = "World" }); + using var mqClient = mqServer.CreateMessageQueueClient(); + mqClient.Publish(new HelloIntro { Name = "World" }); - IMessage dlqMsg = mqClient.Get(QueueNames.Dlq); - mqClient.Ack(dlqMsg); + IMessage dlqMsg = mqClient.Get(QueueNames.Dlq); + mqClient.Ack(dlqMsg); + + Assert.That(called, Is.EqualTo(2)); + Assert.That(dlqMsg.GetBody().Name, Is.EqualTo("World")); + Assert.That(dlqMsg.Error.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + Assert.That(dlqMsg.Error.Message, Is.EqualTo("Name")); + } - Assert.That(called, Is.EqualTo(2)); - Assert.That(dlqMsg.GetBody().Name, Is.EqualTo("World")); - Assert.That(dlqMsg.Error.ErrorCode, Is.EqualTo(typeof(ArgumentException).Name)); - Assert.That(dlqMsg.Error.Message, Is.EqualTo("Name")); - } - } + [Test] + public void Message_with_ReplyTo_that_throw_exceptions_are_retried_then_published_to_Request_dlq() + { + using var mqServer = CreateMqServer(retryCount: 1); + var called = 0; + mqServer.RegisterHandler(m => + { + Interlocked.Increment(ref called); + throw new ArgumentException("Name"); + }); + mqServer.Start(); + + using var mqClient = mqServer.CreateMessageQueueClient(); + const string replyToMq = "mq:Hello.replyto"; + mqClient.Publish(new Message(new HelloIntro { Name = "World" }) + { + ReplyTo = replyToMq + }); + + IMessage dlqMsg = mqClient.Get(QueueNames.Dlq); + mqClient.Ack(dlqMsg); + + Assert.That(called, Is.EqualTo(2)); + Assert.That(dlqMsg.GetBody().Name, Is.EqualTo("World")); + Assert.That(dlqMsg.Error.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + Assert.That(dlqMsg.Error.Message, Is.EqualTo("Name")); } [Test] public void Message_with_ReplyTo_are_published_to_the_ReplyTo_queue() { - using (var mqServer = CreateMqServer()) - { - mqServer.RegisterHandler(m => - new HelloIntroResponse { Result = "Hello, {0}!".Fmt(m.GetBody().Name) }); - mqServer.Start(); + using var mqServer = CreateMqServer(); + mqServer.RegisterHandler(m => + new HelloIntroResponse { Result = "Hello, {0}!".Fmt(m.GetBody().Name) }); + mqServer.Start(); - using (var mqClient = mqServer.CreateMessageQueueClient()) + using (var mqClient = mqServer.CreateMessageQueueClient()) + { + const string replyToMq = "mq:Hello.replyto"; + mqClient.Publish(new Message(new HelloIntro { Name = "World" }) { - const string replyToMq = "mq:Hello.replyto"; - mqClient.Publish(new Message(new HelloIntro { Name = "World" }) { - ReplyTo = replyToMq - }); - - IMessage responseMsg = mqClient.Get(replyToMq); - mqClient.Ack(responseMsg); - Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); - } + ReplyTo = replyToMq + }); + + IMessage responseMsg = mqClient.Get(replyToMq); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); } } [Test] public void Does_process_messages_in_HttpListener_AppHost() { - using (var appHost = new AppHost(() => CreateMqServer()).Init()) + using var appHost = new AppHost(() => CreateMqServer()).Init().Start(Config.ListeningOn); + using var mqClient = appHost.Resolve().CreateMessageQueueClient(); + mqClient.Publish(new HelloIntro { Name = "World" }); + + IMessage responseMsg = mqClient.Get(QueueNames.In); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); + } + + [Test] + public void Does_process_multi_messages_in_HttpListener_AppHost() + { + using var appHost = new AppHost(() => CreateMqServer()).Init().Start(Config.ListeningOn); + using var mqClient = appHost.Resolve().CreateMessageQueueClient(); + var requests = new[] { - using (var mqClient = appHost.Resolve().CreateMessageQueueClient()) - { - mqClient.Publish(new HelloIntro { Name = "World" }); + new HelloIntro { Name = "Foo" }, + new HelloIntro { Name = "Bar" }, + }; - IMessage responseMsg = mqClient.Get(QueueNames.In); - mqClient.Ack(responseMsg); - Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); - } - } + var client = (IOneWayClient)mqClient; + client.SendAllOneWay(requests); + + var responseMsg = mqClient.Get(QueueNames.In); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, Foo!")); + + responseMsg = mqClient.Get(QueueNames.In); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, Bar!")); + } + + [Test] + public void Does_allow_MessageQueue_restricted_Services() + { + using var appHost = new AppHost(() => CreateMqServer()).Init().Start(Config.ListeningOn); + using var mqClient = appHost.Resolve().CreateMessageQueueClient(); + mqClient.Publish(new MqRestriction + { + Name = "MQ Restriction", + }); + + var responseMsg = mqClient.Get(QueueNames.In); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, + Is.EqualTo("MQ Restriction")); + } + + [Test] + public void Can_make_authenticated_requests_with_MQ() + { + using var appHost = new AppHost(() => CreateMqServer()).Init(); + appHost.Start(Config.ListeningOn); + + var client = new JsonServiceClient(Config.ListeningOn); + + var response = client.Post(new Authenticate + { + provider = "credentials", + UserName = "mythz", + Password = "p@55word" + }); + + var sessionId = response.SessionId; + + using var mqClient = appHost.Resolve().CreateMessageQueueClient(); + mqClient.Publish(new MqAuthOnly + { + Name = "MQ Auth", + SessionId = sessionId, + }); + + var responseMsg = mqClient.Get(QueueNames.In); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, + Is.EqualTo("Hello, MQ Auth! Your UserName is mythz")); + } + + [Test] + public void Can_make_authenticated_requests_with_MQ_BearerToken() + { + using var appHost = new AppHost(() => CreateMqServer()).Init(); + appHost.Start(Config.ListeningOn); + + var client = new JsonServiceClient(Config.ListeningOn); + + var response = client.Post(new Authenticate + { + provider = "credentials", + UserName = "mythz", + Password = "p@55word" + }); + + using var mqClient = appHost.Resolve().CreateMessageQueueClient(); + mqClient.Publish(new MqAuthOnlyToken + { + Name = "MQ AuthToken", + BearerToken = response.BearerToken, + }); + + var responseMsg = mqClient.Get(QueueNames.In); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, + Is.EqualTo("Hello, MQ AuthToken! Your UserName is mythz")); } [Test] public void Does_process_messages_in_BasicAppHost() { - using (var appHost = new BasicAppHost(typeof(HelloService).Assembly) + using var appHost = new BasicAppHost(typeof(HelloService).Assembly) { ConfigureAppHost = host => { @@ -199,20 +434,17 @@ public void Does_process_messages_in_BasicAppHost() var mqServer = host.Container.Resolve(); - mqServer.RegisterHandler(host.ServiceController.ExecuteMessage); + mqServer.RegisterHandler(host.ExecuteMessage); mqServer.Start(); } - }.Init()) - { - using (var mqClient = appHost.Resolve().CreateMessageQueueClient()) - { - mqClient.Publish(new HelloIntro { Name = "World" }); - - IMessage responseMsg = mqClient.Get(QueueNames.In); - mqClient.Ack(responseMsg); - Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); - } - } + }.Init(); + using var mqClient = appHost.Resolve().CreateMessageQueueClient(); + mqClient.Publish(new HelloIntro { Name = "World" }); + + IMessage responseMsg = mqClient.Get(QueueNames.In); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); + appHost.Resolve().Dispose(); } } @@ -220,10 +452,10 @@ public class RabbitMqServerPostMessageTests : MqServerPostMessageTests { public override IMessageService CreateMqServer(IAppHost host, int retryCount = 1) { - return new RabbitMqServer + return new RabbitMqServer(connectionString: Config.RabbitMQConnString) { RetryCount = retryCount, - ResponseFilter = r => { host.OnEndRequest(); return r; } + ResponseFilter = r => { host.OnEndRequest(null); return r; } }; } } @@ -235,7 +467,7 @@ public override IMessageService CreateMqServer(IAppHost host, int retryCount = 1 return new RedisMqServer(new BasicRedisClientManager()) { RetryCount = retryCount, - ResponseFilter = r => { host.OnEndRequest(); return r; } + ResponseFilter = r => { host.OnEndRequest(null); return r; } }; } } @@ -271,8 +503,7 @@ public DisposableDependency(Action onDispose) public void Dispose() { - if (this.onDispose != null) - this.onDispose(); + onDispose?.Invoke(); } } @@ -285,35 +516,35 @@ public abstract class MqServerPostMessageTests public void Does_dispose_request_scope_dependency_in_PostMessageHandler() { var disposeCount = 0; - using (var appHost = new BasicAppHost(typeof(HelloWithDepService).Assembly) + using var appHost = new BasicAppHost(typeof(HelloWithDepService).Assembly) { ConfigureAppHost = host => { +#if !NETCORE_SUPPORT RequestContext.UseThreadStatic = true; +#endif host.Container.Register(c => new DisposableDependency(() => - { - disposeCount++; - })) + { + Interlocked.Increment(ref disposeCount); + })) .ReusedWithin(ReuseScope.Request); host.Container.Register(c => CreateMqServer(host)); var mqServer = host.Container.Resolve(); - mqServer.RegisterHandler(host.ServiceController.ExecuteMessage); + mqServer.RegisterHandler(host.ExecuteMessage); mqServer.Start(); } - }.Init()) - { - using (var mqClient = appHost.Resolve().CreateMessageQueueClient()) - { - mqClient.Publish(new HelloIntroWithDep { Name = "World" }); + }.Init(); - IMessage responseMsg = mqClient.Get(QueueNames.In); - mqClient.Ack(responseMsg); + using var mqClient = appHost.Resolve().CreateMessageQueueClient(); + mqClient.Publish(new HelloIntroWithDep { Name = "World" }); - Assert.That(disposeCount, Is.EqualTo(1)); - } - } + IMessage responseMsg = mqClient.Get(QueueNames.In); + mqClient.Ack(responseMsg); + + Assert.That(disposeCount, Is.EqualTo(1)); + appHost.Resolve().Dispose(); } } } \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Messaging/MqServerQueueNameTests.cs b/tests/ServiceStack.Server.Tests/Messaging/MqServerQueueNameTests.cs new file mode 100644 index 00000000000..4e8fd7c37fb --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Messaging/MqServerQueueNameTests.cs @@ -0,0 +1,68 @@ +using NUnit.Framework; +using ServiceStack.Messaging; +using ServiceStack.Messaging.Redis; +using ServiceStack.RabbitMq; +using ServiceStack.Redis; + +namespace ServiceStack.Server.Tests.Messaging +{ + public abstract class MqServerQueueNameTests + { + public abstract IMessageService CreateMqServer(int retryCount = 1); + + [Test] + public void Can_Send_and_Receive_messages_using_QueueNamePrefix() + { + QueueNames.SetQueuePrefix("site1."); + + Assert.That(QueueNames.TopicIn, Is.EqualTo("site1.mq:topic:in")); + Assert.That(QueueNames.TopicOut, Is.EqualTo("site1.mq:topic:out")); + + using (var mqServer = CreateMqServer()) + { + mqServer.RegisterHandler(m => + new HelloIntroResponse { Result = $"Hello, {m.GetBody().Name}!" }); + mqServer.Start(); + + using (var mqClient = mqServer.CreateMessageQueueClient()) + { + var request = new HelloIntro { Name = "World" }; + var requestInq = MessageFactory.Create(request).ToInQueueName(); + Assert.That(requestInq, Is.EqualTo("site1.mq:HelloIntro.inq")); + + mqClient.Publish(request); + + var responseInq = QueueNames.In; + Assert.That(responseInq, Is.EqualTo("site1.mq:HelloIntroResponse.inq")); + + IMessage responseMsg = mqClient.Get(responseInq); + mqClient.Ack(responseMsg); + Assert.That(responseMsg.GetBody().Result, Is.EqualTo("Hello, World!")); + } + } + + QueueNames.SetQueuePrefix(""); + } + } + + class RedisMqServerQueueNameTests : MqServerQueueNameTests + { + public override IMessageService CreateMqServer(int retryCount = 1) + { + var redisManager = new BasicRedisClientManager(); + using (var redis = redisManager.GetClient()) + { + redis.FlushAll(); + } + return new RedisMqServer(redisManager) { RetryCount = retryCount }; + } + } + + class RabbitMqServerQueueNameTests : MqServerQueueNameTests + { + public override IMessageService CreateMqServer(int retryCount = 1) + { + return new RabbitMqServer(connectionString: Config.RabbitMQConnString) { RetryCount = retryCount }; + } + } +} diff --git a/tests/ServiceStack.Server.Tests/Messaging/RabbitMqServerTests.cs b/tests/ServiceStack.Server.Tests/Messaging/RabbitMqServerTests.cs index b9dbe96a439..fc4afd306a4 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/RabbitMqServerTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/RabbitMqServerTests.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; @@ -7,50 +6,53 @@ using RabbitMQ.Client; using ServiceStack.Logging; using ServiceStack.Messaging; -using ServiceStack.Messaging.Redis; using ServiceStack.RabbitMq; -using ServiceStack.Redis; using ServiceStack.Text; namespace ServiceStack.Server.Tests.Messaging { - [TestFixture, Category("Integration")] - public class RabbitMqServerTests + public class Reverse { - private const string ConnectionString = "localhost"; + public string Value { get; set; } + } - public class Reverse - { - public string Value { get; set; } - } + public class Rot13 + { + public string Value { get; set; } + } - public class Rot13 - { - public string Value { get; set; } - } + public class AlwaysThrows + { + public string Value { get; set; } + } + + [TestFixture, Category("Integration")] + public class RabbitMqServerTests + { + static readonly string ConnectionString = Config.RabbitMQConnString; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { LogManager.LogFactory = new ConsoleLogFactory(); } - private static RabbitMqServer CreateMqServer(int noOfRetries = 2) + internal static RabbitMqServer CreateMqServer(int noOfRetries = 2) { - var redisFactory = TestConfig.BasicClientManger; - try - { - redisFactory.Exec(redis => redis.FlushAll()); - } - catch (RedisException rex) - { - Debug.WriteLine("WARNING: Redis not started? \n" + rex.Message); - } - var mqHost = new RabbitMqServer(ConnectionString); - return mqHost; + var mqServer = new RabbitMqServer(ConnectionString); + using var conn = mqServer.ConnectionFactory.CreateConnection(); + using var channel = conn.CreateModel(); + channel.PurgeQueue(); + channel.PurgeQueue(); + channel.PurgeQueue(); + channel.PurgeQueue(); + channel.PurgeQueue(); + channel.PurgeQueue(); + channel.PurgeQueue(); + return mqServer; } - private static void Publish_4_messages(IMessageQueueClient mqClient) + internal static void Publish_4_messages(IMessageQueueClient mqClient) { mqClient.Publish(new Reverse { Value = "Hello" }); mqClient.Publish(new Reverse { Value = "World" }); @@ -69,124 +71,59 @@ private static void Publish_4_Rot13_messages(IMessageQueueClient mqClient) [Test] public void Utils_publish_Reverse_messages() { - var mqHost = new RabbitMqServer(ConnectionString); - var mqClient = mqHost.CreateMessageQueueClient(); - Publish_4_messages(mqClient); - mqHost.Stop(); + using (var mqHost = new RabbitMqServer(ConnectionString)) + using (var mqClient = mqHost.CreateMessageQueueClient()) + { + Publish_4_messages(mqClient); + } } [Test] public void Utils_publish_Rot13_messages() { - var mqHost = new RabbitMqServer(ConnectionString); - var mqClient = mqHost.CreateMessageQueueClient(); - Publish_4_Rot13_messages(mqClient); - mqHost.Stop(); - } - - [Test] - public void Does_process_messages_sent_before_it_was_started() - { - var reverseCalled = 0; - - var mqHost = CreateMqServer(); - mqHost.RegisterHandler(x => { reverseCalled++; return x.GetBody().Value.Reverse(); }); - - var mqClient = mqHost.CreateMessageQueueClient(); - Publish_4_messages(mqClient); - - mqHost.Start(); - Thread.Sleep(3000); - - Assert.That(mqHost.GetStats().TotalMessagesProcessed, Is.EqualTo(4)); - Assert.That(reverseCalled, Is.EqualTo(4)); - - mqHost.Dispose(); - } - - [Test] - public void Does_process_all_messages_and_Starts_Stops_correctly_with_multiple_threads_racing() - { - var mqHost = CreateMqServer(); - - using (var conn = mqHost.ConnectionFactory.CreateConnection()) - using (var channel = conn.CreateModel()) + using (var mqHost = new RabbitMqServer(ConnectionString)) + using (var mqClient = mqHost.CreateMessageQueueClient()) { - channel.PurgeQueue(); - channel.PurgeQueue(); + Publish_4_Rot13_messages(mqClient); } - - var reverseCalled = 0; - var rot13Called = 0; - - mqHost.RegisterHandler(x => { - "Processing Reverse {0}...".Print(++reverseCalled); - return x.GetBody().Value.Reverse(); - }); - mqHost.RegisterHandler(x => { - "Processing Rot13 {0}...".Print(++rot13Called); - return x.GetBody().Value.ToRot13(); - }); - - var mqClient = mqHost.CreateMessageQueueClient(); - mqClient.Publish(new Reverse { Value = "Hello" }); - mqClient.Publish(new Reverse { Value = "World" }); - mqClient.Publish(new Rot13 { Value = "ServiceStack" }); - - mqHost.Start(); - Thread.Sleep(4000); - Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); - Assert.That(mqHost.GetStats().TotalMessagesProcessed, Is.EqualTo(3)); - - mqClient.Publish(new Reverse { Value = "Foo" }); - mqClient.Publish(new Rot13 { Value = "Bar" }); - - 10.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Start())); - Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); - - 5.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Stop())); - Thread.Sleep(2000); - Assert.That(mqHost.GetStatus(), Is.EqualTo("Stopped")); - - 10.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Start())); - Thread.Sleep(4000); - Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); - - Debug.WriteLine("\n" + mqHost.GetStats()); - - Assert.That(mqHost.GetStats().TotalMessagesProcessed, Is.EqualTo(5)); - Assert.That(reverseCalled, Is.EqualTo(3)); - Assert.That(rot13Called, Is.EqualTo(2)); - - mqHost.Dispose(); } [Test] public void Only_allows_1_BgThread_to_run_at_a_time() { - var mqHost = CreateMqServer(); - - mqHost.RegisterHandler(x => x.GetBody().Value.Reverse()); - mqHost.RegisterHandler(x => x.GetBody().Value.ToRot13()); - - 5.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Start())); - Thread.Sleep(1000); - Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); - Assert.That(mqHost.BgThreadCount, Is.EqualTo(1)); - - 10.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Stop())); - Thread.Sleep(1000); - Assert.That(mqHost.GetStatus(), Is.EqualTo("Stopped")); - - ThreadPool.QueueUserWorkItem(y => mqHost.Start()); - Thread.Sleep(1000); - Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); - - Assert.That(mqHost.BgThreadCount, Is.EqualTo(2)); - - Debug.WriteLine(mqHost.GetStats()); - - mqHost.Dispose(); + using (var mqHost = CreateMqServer()) + { + mqHost.RegisterHandler(x => x.GetBody().Value.Reverse()); + mqHost.RegisterHandler(x => x.GetBody().Value.ToRot13()); + + 5.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Start())); + ExecUtils.RetryOnException(() => + { + Thread.Sleep(100); + Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); + Assert.That(mqHost.BgThreadCount, Is.EqualTo(1)); + Thread.Sleep(100); + }, TimeSpan.FromSeconds(5)); + + 10.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Stop())); + ExecUtils.RetryOnException(() => + { + Thread.Sleep(100); + Assert.That(mqHost.GetStatus(), Is.EqualTo("Stopped")); + Thread.Sleep(100); + }, TimeSpan.FromSeconds(5)); + + ThreadPool.QueueUserWorkItem(y => mqHost.Start()); + ExecUtils.RetryOnException(() => + { + Thread.Sleep(100); + Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); + Assert.That(mqHost.BgThreadCount, Is.EqualTo(2)); + Thread.Sleep(100); + }, TimeSpan.FromSeconds(5)); + + //Debug.WriteLine(mqHost.GetStats()); + } } [Test] @@ -212,7 +149,7 @@ public void Cannot_Stop_a_Disposed_MqHost() mqHost.RegisterHandler(x => x.GetBody().Value.Reverse()); mqHost.Start(); - Thread.Sleep(1000); + Thread.Sleep(100); mqHost.Dispose(); @@ -224,62 +161,6 @@ public void Cannot_Stop_a_Disposed_MqHost() catch (ObjectDisposedException) { } } - public class AlwaysThrows - { - public string Value { get; set; } - } - - [Test] - public void Does_retry_messages_with_errors_by_RetryCount() - { - var retryCount = 1; - var totalRetries = 1 + retryCount; //in total, inc. first try - - var mqHost = CreateMqServer(retryCount); - - using (var conn = mqHost.ConnectionFactory.CreateConnection()) - using (var channel = conn.CreateModel()) - { - channel.PurgeQueue(); - channel.PurgeQueue(); - channel.PurgeQueue(); - } - - var reverseCalled = 0; - var rot13Called = 0; - - mqHost.RegisterHandler(x => { reverseCalled++; return x.GetBody().Value.Reverse(); }); - mqHost.RegisterHandler(x => { rot13Called++; return x.GetBody().Value.ToRot13(); }); - mqHost.RegisterHandler(x => { throw new Exception("Always Throwing! " + x.GetBody().Value); }); - mqHost.Start(); - - var mqClient = mqHost.CreateMessageQueueClient(); - mqClient.Publish(new AlwaysThrows { Value = "1st" }); - mqClient.Publish(new Reverse { Value = "Hello" }); - mqClient.Publish(new Reverse { Value = "World" }); - mqClient.Publish(new Rot13 { Value = "ServiceStack" }); - - Thread.Sleep(8000); - Assert.That(mqHost.GetStats().TotalMessagesFailed, Is.EqualTo(1 * totalRetries)); - Assert.That(mqHost.GetStats().TotalMessagesProcessed, Is.EqualTo(2 + 1)); - - 5.Times(x => mqClient.Publish(new AlwaysThrows { Value = "#" + x })); - - mqClient.Publish(new Reverse { Value = "Hello" }); - mqClient.Publish(new Reverse { Value = "World" }); - mqClient.Publish(new Rot13 { Value = "ServiceStack" }); - - Thread.Sleep(5000); - - Debug.WriteLine(mqHost.GetStatsDescription()); - - Assert.That(mqHost.GetStats().TotalMessagesFailed, Is.EqualTo((1 + 5) * totalRetries)); - Assert.That(mqHost.GetStats().TotalMessagesProcessed, Is.EqualTo(6)); - - Assert.That(reverseCalled, Is.EqualTo(2 + 2)); - Assert.That(rot13Called, Is.EqualTo(1 + 1)); - } - public class Incr { public int Value { get; set; } @@ -289,66 +170,87 @@ public class Incr public void Can_receive_and_process_same_reply_responses() { var called = 0; - var mqHost = CreateMqServer(); - - using (var conn = mqHost.ConnectionFactory.CreateConnection()) - using (var channel = conn.CreateModel()) + using (var mqHost = CreateMqServer()) { - channel.PurgeQueue(); - } - - mqHost.RegisterHandler(m => { - Debug.WriteLine("In Incr #" + m.GetBody().Value); - called++; - return m.GetBody().Value > 0 ? new Incr { Value = m.GetBody().Value - 1 } : null; - }); - - mqHost.Start(); - var mqClient = mqHost.CreateMessageQueueClient(); + using (var conn = mqHost.ConnectionFactory.CreateConnection()) + using (var channel = conn.CreateModel()) + { + channel.PurgeQueue(); + } - var incr = new Incr { Value = 5 }; - mqClient.Publish(incr); + mqHost.RegisterHandler(m => + { + Debug.WriteLine("In Incr #" + m.GetBody().Value); + Interlocked.Increment(ref called); + return m.GetBody().Value > 0 ? new Incr { Value = m.GetBody().Value - 1 } : null; + }); - Thread.Sleep(10000); + mqHost.Start(); - Assert.That(called, Is.EqualTo(1 + incr.Value)); + var incr = new Incr { Value = 5 }; + using (var mqClient = mqHost.CreateMessageQueueClient()) + { + mqClient.Publish(incr); + } + + ExecUtils.RetryOnException(() => + { + Thread.Sleep(300); + Assert.That(called, Is.EqualTo(1 + incr.Value)); + }, TimeSpan.FromSeconds(5)); + } } - public class Hello { public string Name { get; set; } } - public class HelloResponse { public string Result { get; set; } } + public class Hello : IReturn + { + public string Name { get; set; } + } + public class HelloNull : IReturn + { + public string Name { get; set; } + } + public class HelloResponse + { + public string Result { get; set; } + } [Test] public void Can_receive_and_process_standard_request_reply_combo() { - var mqHost = CreateMqServer(); - - using (var conn = mqHost.ConnectionFactory.CreateConnection()) - using (var channel = conn.CreateModel()) + using (var mqHost = CreateMqServer()) { - channel.PurgeQueue(); - channel.PurgeQueue(); - } - - string messageReceived = null; + using (var conn = mqHost.ConnectionFactory.CreateConnection()) + using (var channel = conn.CreateModel()) + { + channel.PurgeQueue(); + channel.PurgeQueue(); + } - mqHost.RegisterHandler(m => - new HelloResponse { Result = "Hello, " + m.GetBody().Name }); + string messageReceived = null; - mqHost.RegisterHandler(m => { - messageReceived = m.GetBody().Result; return null; - }); + mqHost.RegisterHandler(m => + new HelloResponse { Result = "Hello, " + m.GetBody().Name }); - mqHost.Start(); + mqHost.RegisterHandler(m => + { + messageReceived = m.GetBody().Result; return null; + }); - var mqClient = mqHost.CreateMessageQueueClient(); - - var dto = new Hello { Name = "ServiceStack" }; - mqClient.Publish(dto); - - Thread.Sleep(12000); + mqHost.Start(); - Assert.That(messageReceived, Is.EqualTo("Hello, ServiceStack")); + using (var mqClient = mqHost.CreateMessageQueueClient()) + { + var dto = new Hello { Name = "ServiceStack" }; + mqClient.Publish(dto); + + ExecUtils.RetryOnException(() => + { + Thread.Sleep(300); + Assert.That(messageReceived, Is.EqualTo("Hello, ServiceStack")); + }, TimeSpan.FromSeconds(5)); + } + } } public class Wait @@ -356,18 +258,6 @@ public class Wait public int ForMs { get; set; } } - [Test] - public void Can_handle_requests_concurrently_in_2_threads() - { - RunHandlerOnMultipleThreads(noOfThreads: 2, msgs: 10); - } - - [Test] - public void Can_handle_requests_concurrently_in_3_threads() - { - RunHandlerOnMultipleThreads(noOfThreads: 3, msgs: 10); - } - [Test] public void Can_handle_requests_concurrently_in_4_threads() { @@ -376,43 +266,32 @@ public void Can_handle_requests_concurrently_in_4_threads() private static void RunHandlerOnMultipleThreads(int noOfThreads, int msgs) { + using var mqHost = CreateMqServer(); var timesCalled = 0; - var mqHost = CreateMqServer(); - - using (var conn = mqHost.ConnectionFactory.CreateConnection()) - using (var channel = conn.CreateModel()) - { - channel.PurgeQueue(); - } mqHost.RegisterHandler(m => { - timesCalled++; + Interlocked.Increment(ref timesCalled); Thread.Sleep(m.GetBody().ForMs); return null; }, noOfThreads); mqHost.Start(); - var mqClient = mqHost.CreateMessageQueueClient(); - + using var mqClient = mqHost.CreateMessageQueueClient(); var dto = new Wait { ForMs = 100 }; msgs.Times(i => mqClient.Publish(dto)); - const double buffer = 2.2; - - var sleepForMs = (int)((msgs * 1000 / (double)noOfThreads) * buffer); - "Sleeping for {0}ms...".Print(sleepForMs); - Thread.Sleep(sleepForMs); - - mqHost.Dispose(); - - Assert.That(timesCalled, Is.EqualTo(msgs)); + ExecUtils.RetryOnException(() => + { + Thread.Sleep(300); + Assert.That(timesCalled, Is.EqualTo(msgs)); + }, TimeSpan.FromSeconds(5)); } [Test] public void Can_publish_and_receive_messages_with_MessageFactory() { - using (var mqFactory = new RabbitMqMessageFactory("localhost")) + using (var mqFactory = new RabbitMqMessageFactory(Config.RabbitMQConnString)) using (var mqClient = mqFactory.CreateMessageQueueClient()) { mqClient.Publish(new Hello { Name = "Foo" }); @@ -428,52 +307,307 @@ public void Can_filter_published_and_received_messages() string receivedMsgApp = null; string receivedMsgType = null; - var mqServer = CreateMqServer(); - mqServer.PublishMessageFilter = (queueName, properties, msg) => + using (var mqServer = CreateMqServer()) { - properties.AppId = "app:{0}".Fmt(queueName); - }; - mqServer.GetMessageFilter = (queueName, basicMsg) => - { - var props = basicMsg.BasicProperties; - receivedMsgType = props.Type; //automatically added by RabbitMqProducer + mqServer.PublishMessageFilter = (queueName, properties, msg) => + { + properties.AppId = "app:{0}".Fmt(queueName); + }; + mqServer.GetMessageFilter = (queueName, basicMsg) => + { + var props = basicMsg.BasicProperties; + receivedMsgType = props.Type; //automatically added by RabbitMqProducer receivedMsgApp = props.AppId; - }; + }; + + mqServer.RegisterHandler(m => { + return new HelloResponse { Result = "Hello, {0}!".Fmt(m.GetBody().Name) }; + }); + + mqServer.Start(); - mqServer.RegisterHandler(m => { - return new HelloResponse { Result = "Hello, {0}!".Fmt(m.GetBody().Name) }; - }); + using (var mqClient = mqServer.CreateMessageQueueClient()) + { + mqClient.Publish(new Hello { Name = "Bugs Bunny" }); + } - mqServer.Start(); + Thread.Sleep(100); - using (var mqClient = mqServer.CreateMessageQueueClient()) + Assert.That(receivedMsgApp, Is.EqualTo("app:{0}".Fmt(QueueNames.In))); + Assert.That(receivedMsgType, Is.EqualTo(typeof(Hello).Name)); + + using (IConnection connection = mqServer.ConnectionFactory.CreateConnection()) + using (IModel channel = connection.CreateModel()) + { + var queueName = QueueNames.In; + channel.RegisterQueue(queueName); + + var basicMsg = channel.BasicGet(queueName, autoAck: true); + var props = basicMsg.BasicProperties; + + Assert.That(props.Type, Is.EqualTo(typeof(HelloResponse).Name)); + Assert.That(props.AppId, Is.EqualTo("app:{0}".Fmt(queueName))); + + var msg = basicMsg.ToMessage(); + Assert.That(msg.GetBody().Result, Is.EqualTo("Hello, Bugs Bunny!")); + } + } + } + + [Test] + public void Messages_with_null_Response_is_published_to_OutMQ() + { + int msgsReceived = 0; + using (var mqServer = CreateMqServer()) { - mqClient.Publish(new Hello { Name = "Bugs Bunny" }); + mqServer.RegisterHandler(m => + { + Interlocked.Increment(ref msgsReceived); + return null; + }); + + mqServer.Start(); + + using (var mqClient = mqServer.CreateMessageQueueClient()) + { + mqClient.Publish(new HelloNull { Name = "Into the Void" }); + + var msg = mqClient.Get(QueueNames.Out, TimeSpan.FromSeconds(5)); + Assert.That(msg, Is.Not.Null); + + HelloNull response = msg.GetBody(); + + Thread.Sleep(100); + + Assert.That(response.Name, Is.EqualTo("Into the Void")); + Assert.That(msgsReceived, Is.EqualTo(1)); + } } + } - Thread.Sleep(100); + [Test] + public void Messages_with_null_responses_are_not_published_when_DisablePublishingToOutq() + { + int msgsReceived = 0; + using (var mqServer = CreateMqServer()) + { + mqServer.DisablePublishingToOutq = true; + mqServer.RegisterHandler(m => + { + Interlocked.Increment(ref msgsReceived); + return null; + }); + + mqServer.Start(); + + using (var mqClient = mqServer.CreateMessageQueueClient()) + { + mqClient.Publish(new HelloNull { Name = "Into the Void" }); + + var msg = mqClient.Get(QueueNames.Out, TimeSpan.FromSeconds(2)); + Assert.That(msg, Is.Null); + } + } + } + + [Test] + public void Messages_with_null_Response_is_published_to_ReplyMQ() + { + int msgsReceived = 0; + using (var mqServer = CreateMqServer()) + { + mqServer.RegisterHandler(m => + { + Interlocked.Increment(ref msgsReceived); + return null; + }); + + mqServer.Start(); + + using (var mqClient = mqServer.CreateMessageQueueClient()) + { + var replyMq = mqClient.GetTempQueueName(); + mqClient.Publish(new Message(new HelloNull { Name = "Into the Void" }) + { + ReplyTo = replyMq + }); - mqServer.Dispose(); + var msg = mqClient.Get(replyMq); - Assert.That(receivedMsgApp, Is.EqualTo("app:{0}".Fmt(QueueNames.In))); - Assert.That(receivedMsgType, Is.EqualTo(typeof(Hello).Name)); + HelloNull response = msg.GetBody(); + + Thread.Sleep(100); + + Assert.That(response.Name, Is.EqualTo("Into the Void")); + Assert.That(msgsReceived, Is.EqualTo(1)); + } + } + } + } - using (IConnection connection = mqServer.ConnectionFactory.CreateConnection()) - using (IModel channel = connection.CreateModel()) + [Ignore("These Flaky tests pass when run manually")] + [TestFixture, Category("Integration")] + public class RabbitMqServerFragileTests + { + [Test] + public void Does_process_all_messages_and_Starts_Stops_correctly_with_multiple_threads_racing() + { + using (var mqHost = RabbitMqServerTests.CreateMqServer()) { - var queueName = QueueNames.In; - channel.RegisterQueue(queueName); + using (var conn = mqHost.ConnectionFactory.CreateConnection()) + using (var channel = conn.CreateModel()) + { + channel.PurgeQueue(); + channel.PurgeQueue(); + } + + var reverseCalled = 0; + var rot13Called = 0; + + mqHost.RegisterHandler(x => + { + "Processing Reverse {0}...".Print(Interlocked.Increment(ref reverseCalled)); + return x.GetBody().Value.Reverse(); + }); + mqHost.RegisterHandler(x => + { + "Processing Rot13 {0}...".Print(Interlocked.Increment(ref rot13Called)); + return x.GetBody().Value.ToRot13(); + }); + + using (var mqClient = mqHost.CreateMessageQueueClient()) + { + mqClient.Publish(new Reverse { Value = "Hello" }); + mqClient.Publish(new Reverse { Value = "World" }); + mqClient.Publish(new Rot13 { Value = "ServiceStack" }); + + mqHost.Start(); + + ExecUtils.RetryOnException(() => + { + Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); + Assert.That(mqHost.GetStats().TotalMessagesProcessed, Is.EqualTo(3)); + Thread.Sleep(100); + }, TimeSpan.FromSeconds(5)); + + mqClient.Publish(new Reverse { Value = "Foo" }); + mqClient.Publish(new Rot13 { Value = "Bar" }); + + 10.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Start())); + Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); + + 5.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Stop())); + ExecUtils.RetryOnException(() => + { + Assert.That(mqHost.GetStatus(), Is.EqualTo("Stopped")); + Thread.Sleep(100); + }, TimeSpan.FromSeconds(5)); + + 10.Times(x => ThreadPool.QueueUserWorkItem(y => mqHost.Start())); + ExecUtils.RetryOnException(() => + { + Assert.That(mqHost.GetStatus(), Is.EqualTo("Started")); + Thread.Sleep(100); + }, TimeSpan.FromSeconds(5)); + + Debug.WriteLine("\n" + mqHost.GetStats()); + + Assert.That(mqHost.GetStats().TotalMessagesProcessed, Is.GreaterThanOrEqualTo(5)); + Assert.That(reverseCalled, Is.EqualTo(3)); + Assert.That(rot13Called, Is.EqualTo(2)); + } + } + } - var basicMsg = channel.BasicGet(queueName, noAck: true); - var props = basicMsg.BasicProperties; - Assert.That(props.Type, Is.EqualTo(typeof(HelloResponse).Name)); - Assert.That(props.AppId, Is.EqualTo("app:{0}".Fmt(queueName))); + [Test] + public void Does_retry_messages_with_errors_by_RetryCount() + { + var retryCount = 1; + var totalRetries = 1 + retryCount; //in total, inc. first try + + using (var mqHost = RabbitMqServerTests.CreateMqServer(retryCount)) + { + using (var conn = mqHost.ConnectionFactory.CreateConnection()) + using (var channel = conn.CreateModel()) + { + channel.PurgeQueue(); + channel.PurgeQueue(); + channel.PurgeQueue(); + } + + var reverseCalled = 0; + var rot13Called = 0; + + mqHost.RegisterHandler(x => { Interlocked.Increment(ref reverseCalled); return x.GetBody().Value.Reverse(); }); + mqHost.RegisterHandler(x => { Interlocked.Increment(ref rot13Called); return x.GetBody().Value.ToRot13(); }); + mqHost.RegisterHandler(x => { throw new Exception("Always Throwing! " + x.GetBody().Value); }); + mqHost.Start(); - var msg = basicMsg.ToMessage(); - Assert.That(msg.GetBody().Result, Is.EqualTo("Hello, Bugs Bunny!")); + using (var mqClient = mqHost.CreateMessageQueueClient()) + { + mqClient.Publish(new AlwaysThrows { Value = "1st" }); + mqClient.Publish(new Reverse { Value = "Hello" }); + mqClient.Publish(new Reverse { Value = "World" }); + mqClient.Publish(new Rot13 { Value = "ServiceStack" }); + + ExecUtils.RetryOnException(() => + { + Assert.That(mqHost.GetStats().TotalMessagesFailed, Is.EqualTo(1 * totalRetries)); + Assert.That(mqHost.GetStats().TotalMessagesProcessed, Is.EqualTo(2 + 1)); + Thread.Sleep(100); + }, TimeSpan.FromSeconds(5)); + + 5.Times(x => mqClient.Publish(new AlwaysThrows { Value = "#" + x })); + + mqClient.Publish(new Reverse { Value = "Hello" }); + mqClient.Publish(new Reverse { Value = "World" }); + mqClient.Publish(new Rot13 { Value = "ServiceStack" }); + } + //Debug.WriteLine(mqHost.GetStatsDescription()); + + ExecUtils.RetryOnException(() => + { + Assert.That(mqHost.GetStats().TotalMessagesFailed, Is.EqualTo((1 + 5) * totalRetries)); + Assert.That(mqHost.GetStats().TotalMessagesProcessed, Is.EqualTo(6)); + + Assert.That(reverseCalled, Is.EqualTo(2 + 2)); + Assert.That(rot13Called, Is.EqualTo(1 + 1)); + + Thread.Sleep(100); + }, TimeSpan.FromSeconds(5)); } + } + + [Test] + public void Does_process_messages_sent_before_it_was_started() + { + var reverseCalled = 0; + using (var mqServer = RabbitMqServerTests.CreateMqServer()) + { + using (var conn = mqServer.ConnectionFactory.CreateConnection()) + using (var channel = conn.CreateModel()) + { + channel.PurgeQueue(); + } + + mqServer.RegisterHandler(x => { Interlocked.Increment(ref reverseCalled); return x.GetBody().Value.Reverse(); }); + + using (var mqClient = mqServer.CreateMessageQueueClient()) + { + RabbitMqServerTests.Publish_4_messages(mqClient); + + mqServer.Start(); + + ExecUtils.RetryOnException(() => + { + Assert.That(mqServer.GetStats().TotalMessagesProcessed, Is.EqualTo(4)); + Assert.That(reverseCalled, Is.EqualTo(4)); + Thread.Sleep(100); + }, TimeSpan.FromSeconds(5)); + } + } } } } \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Messaging/RedisFailoverTests.cs b/tests/ServiceStack.Server.Tests/Messaging/RedisFailoverTests.cs index c85469509aa..f3242d96fce 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/RedisFailoverTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/RedisFailoverTests.cs @@ -11,7 +11,7 @@ namespace ServiceStack.Server.Tests.Messaging { - [Explicit("Simulating error conditions")] + [Ignore("Simulating error conditions")] [TestFixture] public class RedisFailoverTests { @@ -67,7 +67,6 @@ public void Can_recover_from_server_terminated_client_connection() "Elapsed time: {0}ms".Print(stopwatch.ElapsedMilliseconds); var managerStats = clientManager.GetStats(); - managerStats.PrintDump(); } public class Incr @@ -115,7 +114,7 @@ public void Can_MqServer_recover_from_server_terminated_client_connections() using (var client = (RedisClient)clientManager.GetClient()) { client.SetConfig("timeout", "1"); - var clientAddrs = client.GetClientList().ConvertAll(x => x["addr"]); + var clientAddrs = client.GetClientsInfo().ConvertAll(x => x["addr"]); "Killing clients: {0}...".Print(clientAddrs.Dump()); try { @@ -195,7 +194,7 @@ public static bool RunInLoop(PooledRedisClientManager clientManager, int iterati lock (clientManager) Console.WriteLine("count: {0}, errors: {1}", count, errors); } - catch (Exception ex) + catch (Exception) { Interlocked.Increment(ref errors); } @@ -239,7 +238,7 @@ public void Can_failover_MqServer_at_runtime() mqHost.RegisterHandler(c => { var dto = c.GetBody(); - received++; + Interlocked.Increment(ref received); int count; map.TryGetValue(dto.Host, out count); map[dto.Host] = count + 1; @@ -269,7 +268,6 @@ public void Can_failover_MqServer_at_runtime() lock (clientManager) Monitor.Wait(clientManager); - map.PrintDump(); "localclient inq: {0}, outq: {1}".Print( localClient.GetListCount("mq:Msg.inq"), localClient.GetListCount("mq:Msg.outq")); @@ -311,7 +309,7 @@ public static bool RunMqInLoop(RedisMqServer mqServer, int iterations = 100, int lock (mqServer) "count: {0}, errors: {1}".Print(count, errors); } - catch (Exception ex) + catch (Exception) { Interlocked.Increment(ref errors); } diff --git a/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerSleepServerTests.cs b/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerSleepServerTests.cs index 262599c12e1..08bf32e902b 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerSleepServerTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerSleepServerTests.cs @@ -13,10 +13,10 @@ public class RedisMqServerSleepServerTests { public class Counters { - public int Sleep0 { get; set; } - public int Sleep10 { get; set; } - public int Sleep100 { get; set; } - public int Sleep1000 { get; set; } + public int Sleep0; + public int Sleep10; + public int Sleep100; + public int Sleep1000; } class Sleep0 @@ -44,19 +44,19 @@ RedisMqServer CreateServer() redis.FlushAll(); var mqServer = new RedisMqServer(TestConfig.BasicClientManger); - mqServer.RegisterHandler(m => new Sleep0 { Id = counter.Sleep0++ }); + mqServer.RegisterHandler(m => new Sleep0 { Id = Interlocked.Increment(ref counter.Sleep0) }); mqServer.RegisterHandler(m => { Thread.Sleep(10); - return new Sleep10 { Id = counter.Sleep10++ }; + return new Sleep10 { Id = Interlocked.Increment(ref counter.Sleep10) }; }); mqServer.RegisterHandler(m => { Thread.Sleep(100); - return new Sleep100 { Id = counter.Sleep100++ }; + return new Sleep100 { Id = Interlocked.Increment(ref counter.Sleep100) }; }); mqServer.RegisterHandler(m => { Thread.Sleep(1000); - return new Sleep1000 { Id = counter.Sleep1000++ }; + return new Sleep1000 { Id = Interlocked.Increment(ref counter.Sleep1000) }; }); @@ -69,21 +69,21 @@ public void Run_for_1_seconds() RunFor(TimeSpan.FromSeconds(1)); } - [Explicit] + [Ignore("Debug Test")] [Test] public void Run_for_5_seconds() { RunFor(TimeSpan.FromSeconds(5)); } - [Explicit] + [Ignore("Debug Test")] [Test] public void Run_for_10_seconds() { RunFor(TimeSpan.FromSeconds(10)); } - [Explicit] + [Ignore("Debug Test")] [Test] public void Run_for_30_seconds() { diff --git a/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerSpinServerTests.cs b/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerSpinServerTests.cs index 1dbe096b3c4..9b7c765471b 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerSpinServerTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerSpinServerTests.cs @@ -13,10 +13,10 @@ public class RedisMqServerSpinServerTests { public class Counters { - public int Spin0 { get; set; } - public int Spin10 { get; set; } - public int Spin100 { get; set; } - public int Spin1000 { get; set; } + public int Spin0; + public int Spin10; + public int Spin100; + public int Spin1000; } class Spin0 @@ -44,22 +44,22 @@ RedisMqServer CreateServer() redis.FlushAll(); var mqServer = new RedisMqServer(TestConfig.BasicClientManger); - mqServer.RegisterHandler(m => new Spin0 { Id = counter.Spin0++ }); + mqServer.RegisterHandler(m => new Spin0 { Id = Interlocked.Increment(ref counter.Spin0) }); mqServer.RegisterHandler(m => { var sw = Stopwatch.StartNew(); - while (sw.ElapsedMilliseconds < 10) Thread.SpinWait(100000); - return new Spin10 { Id = counter.Spin10++ }; + SpinWait.SpinUntil(() => sw.ElapsedMilliseconds < 10); + return new Spin10 { Id = Interlocked.Increment(ref counter.Spin10) }; }); mqServer.RegisterHandler(m => { var sw = Stopwatch.StartNew(); - while (sw.ElapsedMilliseconds < 100) Thread.SpinWait(100000); - return new Spin100 { Id = counter.Spin100++ }; + SpinWait.SpinUntil(() => sw.ElapsedMilliseconds < 100); + return new Spin100 { Id = Interlocked.Increment(ref counter.Spin100) }; }); mqServer.RegisterHandler(m => { var sw = Stopwatch.StartNew(); - while (sw.ElapsedMilliseconds < 1000) Thread.SpinWait(100000); - return new Spin1000 { Id = counter.Spin1000++ }; + SpinWait.SpinUntil(() => sw.ElapsedMilliseconds < 1000); + return new Spin1000 { Id = Interlocked.Increment(ref counter.Spin1000) }; }); @@ -72,21 +72,21 @@ public void Run_for_1_seconds() RunFor(TimeSpan.FromSeconds(1)); } - [Explicit] + [Ignore("Debug Test")] [Test] public void Run_for_5_seconds() { RunFor(TimeSpan.FromSeconds(5)); } - [Explicit] + [Ignore("Debug Test")] [Test] public void Run_for_10_seconds() { RunFor(TimeSpan.FromSeconds(10)); } - [Explicit] + [Ignore("Debug Test")] [Test] public void Run_for_30_seconds() { diff --git a/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerTests.cs b/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerTests.cs index 5214bcd7081..085f6fbd3ad 100644 --- a/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerTests.cs +++ b/tests/ServiceStack.Server.Tests/Messaging/RedisMqServerTests.cs @@ -24,11 +24,11 @@ public class Rot13 public string Value { get; set; } } - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { RedisClient.NewFactoryFn = () => new RedisClient(TestConfig.SingleHost); - LogManager.LogFactory = new ConsoleLogFactory(); + //LogManager.LogFactory = new ConsoleLogFactory(); } private static RedisMqServer CreateMqServer(int noOfRetries = 2) @@ -86,7 +86,7 @@ public void Does_process_messages_sent_before_it_was_started() var reverseCalled = 0; var mqHost = CreateMqServer(); - mqHost.RegisterHandler(x => { reverseCalled++; return x.GetBody().Value.Reverse(); }); + mqHost.RegisterHandler(x => { Interlocked.Increment(ref reverseCalled); return x.GetBody().Value.Reverse(); }); var mqClient = mqHost.CreateMessageQueueClient(); Publish_4_messages(mqClient); @@ -108,8 +108,8 @@ public void Does_process_all_messages_and_Starts_Stops_correctly_with_multiple_t var reverseCalled = 0; var rot13Called = 0; - mqHost.RegisterHandler(x => { reverseCalled++; return x.GetBody().Value.Reverse(); }); - mqHost.RegisterHandler(x => { rot13Called++; return x.GetBody().Value.ToRot13(); }); + mqHost.RegisterHandler(x => { Interlocked.Increment(ref reverseCalled); return x.GetBody().Value.Reverse(); }); + mqHost.RegisterHandler(x => { Interlocked.Increment(ref rot13Called); return x.GetBody().Value.ToRot13(); }); var mqClient = mqHost.CreateMessageQueueClient(); mqClient.Publish(new Reverse { Value = "Hello" }); @@ -224,8 +224,8 @@ public void Does_retry_messages_with_errors_by_RetryCount() var reverseCalled = 0; var rot13Called = 0; - mqHost.RegisterHandler(x => { reverseCalled++; return x.GetBody().Value.Reverse(); }); - mqHost.RegisterHandler(x => { rot13Called++; return x.GetBody().Value.ToRot13(); }); + mqHost.RegisterHandler(x => { Interlocked.Increment(ref reverseCalled); return x.GetBody().Value.Reverse(); }); + mqHost.RegisterHandler(x => { Interlocked.Increment(ref rot13Called); return x.GetBody().Value.ToRot13(); }); mqHost.RegisterHandler(x => { throw new Exception("Always Throwing! " + x.GetBody().Value); }); mqHost.Start(); @@ -269,7 +269,7 @@ public void Can_receive_and_process_same_reply_responses() mqHost.RegisterHandler(m => { Debug.WriteLine("In Incr #" + m.GetBody().Value); - called++; + Interlocked.Increment(ref called); return m.GetBody().Value > 0 ? new Incr { Value = m.GetBody().Value - 1 } : null; }); @@ -326,7 +326,7 @@ public void Can_BlockingPop_from_multiple_queues() var client = RedisClient.New(); foreach (var queueName in queueNames) { - var msgName = "msg:" + i++; + var msgName = "msg:" + Interlocked.Increment(ref i); Debug.WriteLine("SEND " + msgName); client.PrependItemToList(queueName, msgName); } @@ -368,7 +368,7 @@ private static void RunHandlerOnMultipleThreads(int noOfThreads, int msgs) var timesCalled = 0; var mqHost = CreateMqServer(); mqHost.RegisterHandler(m => { - timesCalled++; + Interlocked.Increment(ref timesCalled); Thread.Sleep(m.GetBody().ForMs); return null; }, noOfThreads); diff --git a/tests/ServiceStack.Server.Tests/Properties/AssemblyInfo.cs b/tests/ServiceStack.Server.Tests/Properties/AssemblyInfo.cs index 0efb72ad758..96391cbf328 100644 --- a/tests/ServiceStack.Server.Tests/Properties/AssemblyInfo.cs +++ b/tests/ServiceStack.Server.Tests/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ServiceStack.Server.Tests")] -[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyCopyright("Copyright (c) ServiceStack 2018")] [assembly: AssemblyTrademark("Service Stack")] [assembly: AssemblyCulture("")] @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] +[assembly: AssemblyFileVersion("5.0.0.0")] diff --git a/tests/ServiceStack.Server.Tests/Properties/CacheClientTests.cs b/tests/ServiceStack.Server.Tests/Properties/CacheClientTests.cs deleted file mode 100644 index 74eb40505ee..00000000000 --- a/tests/ServiceStack.Server.Tests/Properties/CacheClientTests.cs +++ /dev/null @@ -1,287 +0,0 @@ -using System; -using System.Linq; -using System.Runtime.Serialization; -using System.Threading; -using NUnit.Framework; -using ServiceStack.Auth; -using ServiceStack.Caching; -using ServiceStack.OrmLite; -using ServiceStack.Redis; -using ServiceStack.Text; - -namespace ServiceStack.Server.Tests.Properties -{ - public class Config - { - public static string SqlServerBuildDb = "Server={0};Database=test;User Id=test;Password=test;".Fmt(Environment.GetEnvironmentVariable("CI_HOST")); - } - - public class Item - { - public int Id { get; set; } - - public string Name { get; set; } - - protected bool Equals(Item other) - { - return Id == other.Id && string.Equals(Name, other.Name); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != this.GetType()) return false; - return Equals((Item) obj); - } - - public override int GetHashCode() - { - unchecked - { - return (Id*397) ^ (Name != null ? Name.GetHashCode() : 0); - } - } - } - - public class CustomAuthSession : AuthUserSession - { - [DataMember] - public string Custom { get; set; } - } - - public class SqlServerOrmLiteCacheClientTests : CacheClientTestsBase - { - public override ICacheClient CreateClient() - { - var cache = new OrmLiteCacheClient - { - DbFactory = new OrmLiteConnectionFactory( - Config.SqlServerBuildDb, SqlServerDialect.Provider) - }; - - using (var db = cache.DbFactory.Open()) - { - db.DropTable(); - } - - cache.InitSchema(); - - return cache; - } - } - - public class SqliteOrmLiteCacheClientTests : CacheClientTestsBase - { - public override ICacheClient CreateClient() - { - var cache = new OrmLiteCacheClient - { - DbFactory = new OrmLiteConnectionFactory( - ":memory:", SqliteDialect.Provider) - }; - cache.InitSchema(); - - return cache; - } - } - - public class MemoryCacheClientTests : CacheClientTestsBase - { - public override ICacheClient CreateClient() - { - return new MemoryCacheClient(); - } - } - - public class RedisCacheClientTests : CacheClientTestsBase - { - public override ICacheClient CreateClient() - { - return new RedisClient(Environment.GetEnvironmentVariable("CI_HOST")); - } - } - - [TestFixture] - public abstract class CacheClientTestsBase - { - private readonly ICacheClient Cache; - - public abstract ICacheClient CreateClient(); - - protected CacheClientTestsBase() - { - Cache = CreateClient(); - } - - [TestFixtureTearDown] - public void TestFixtureTearDown() - { - Cache.Dispose(); - } - - [SetUp] - public void SetUp() - { - Cache.FlushAll(); - } - - [Test] - public void Does_flush_all() - { - 3.Times(i => - Cache.Set(i.ToUrn(), new Item { Id = i, Name = "Name" + i })); - - Assert.That(Cache.Get(1.ToUrn()), Is.Not.Null); - - Cache.FlushAll(); - - Assert.That(Cache.Get(1.ToUrn()), Is.Null); - } - - [Test] - public void Can_set_and_remove_entry() - { - var key = 1.ToUrn(); - - var item = Cache.Get(key); - Assert.That(item, Is.Null); - - var whenNotExists = Cache.Set(key, new Item { Id = 1, Name = "Foo" }); - Assert.That(whenNotExists, Is.True); - var whenExists = Cache.Set(key, new Item { Id = 1, Name = "Foo" }); - Assert.That(whenExists, Is.True); - - item = Cache.Get(key); - Assert.That(item, Is.Not.Null); - Assert.That(item.Name, Is.EqualTo("Foo")); - - whenExists = Cache.Remove(key); - Assert.That(whenExists, Is.True); - - whenNotExists = Cache.Remove(key); - Assert.That(whenNotExists, Is.False); - } - - [Test] - public void Can_update_existing_entry() - { - var key = 1.ToUrn(); - - Cache.Set(key, new Item { Id = 1, Name = "Foo" }); - Cache.Set(key, new Item { Id = 2, Name = "Updated" }); - - var item = Cache.Get(key); - - Assert.That(item.Id, Is.EqualTo(2)); - Assert.That(item.Name, Is.EqualTo("Updated")); - } - - [Test] - public void Does_SetAll_and_GetAll() - { - var map = 3.Times(i => new Item { Id = i, Name = "Name" + i }) - .ToSafeDictionary(x => x.ToUrn()); - - Cache.SetAll(map); - - var cacheMap = Cache.GetAll(map.Keys); - - Assert.That(cacheMap, Is.EquivalentTo(map)); - } - - [Test] - public void Does_not_return_expired_items() - { - var key = 1.ToUrn(); - - Cache.Set(key, new Item { Id = 1, Name = "Foo" }, DateTime.UtcNow.AddSeconds(-1)); - - Assert.That(Cache.Get(key), Is.Null); - - Cache.Set(key, new Item { Id = 1, Name = "Foo" }, TimeSpan.FromMilliseconds(100)); - Assert.That(Cache.Get(key), Is.Not.Null); - Thread.Sleep(200); - - Assert.That(Cache.Get(key), Is.Null); - - Cache.Set(key, new Item { Id = 1, Name = "Foo" }, DateTime.UtcNow.AddMilliseconds(200)); - Assert.That(Cache.Get(key), Is.Not.Null); - Thread.Sleep(200); - - Assert.That(Cache.Get(key), Is.Null); - } - - [Test] - public void Can_increment_and_decrement_values() - { - Assert.That(Cache.Increment("incr:a", 2), Is.EqualTo(2)); - Assert.That(Cache.Increment("incr:a", 3), Is.EqualTo(5)); - - Assert.That(Cache.Decrement("decr:a", 2), Is.EqualTo(-2)); - Assert.That(Cache.Decrement("decr:a", 3), Is.EqualTo(-5)); - } - - [Test] - public void Can_remove_multiple_items() - { - var map = 5.Times(i => new Item { Id = i, Name = "Name" + i }) - .ToSafeDictionary(x => x.ToUrn()); - - Cache.SetAll(map); - - Cache.RemoveAll(map.Keys); - - var cacheMap = Cache.GetAll(map.Keys); - - Assert.That(cacheMap.Count, Is.EqualTo(5)); - Assert.That(cacheMap.Values.All(x => x == null)); - } - - [Test] - public void Can_retrieve_IAuthSession() - { - IAuthSession session = new CustomAuthSession - { - Id = "sess-1", - UserAuthId = "1", - Custom = "custom" - }; - - var sessionKey = SessionFeature.GetSessionKey(session.Id); - Cache.Set(sessionKey, session, HostContext.GetDefaultSessionExpiry()); - - var sessionCache = Cache.Get(sessionKey); - Assert.That(sessionCache, Is.Not.Null); - - var typedSession = sessionCache as CustomAuthSession; - Assert.That(typedSession, Is.Not.Null); - Assert.That(typedSession.Custom, Is.EqualTo("custom")); - } - - [Test] - public void Can_retrieve_IAuthSession_with_global_ExcludeTypeInfo_set() - { - JsConfig.ExcludeTypeInfo = true; - - IAuthSession session = new CustomAuthSession - { - Id = "sess-1", - UserAuthId = "1", - Custom = "custom" - }; - - var sessionKey = SessionFeature.GetSessionKey(session.Id); - Cache.Set(sessionKey, session, HostContext.GetDefaultSessionExpiry()); - - var sessionCache = Cache.Get(sessionKey); - Assert.That(sessionCache, Is.Not.Null); - - var typedSession = sessionCache as CustomAuthSession; - Assert.That(typedSession, Is.Not.Null); - Assert.That(typedSession.Custom, Is.EqualTo("custom")); - - JsConfig.ExcludeTypeInfo = false; - } - } -} \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/ProxyFeatureTests.cs b/tests/ServiceStack.Server.Tests/ProxyFeatureTests.cs new file mode 100644 index 00000000000..c3db8692830 --- /dev/null +++ b/tests/ServiceStack.Server.Tests/ProxyFeatureTests.cs @@ -0,0 +1,410 @@ +using System; +using System.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.Server.Tests +{ + [TestFixture] + public class ProxyFeatureTests + { + private static string ListeningOn = "http://localhost:20000/"; + //private static string ListeningOn = Config.ListeningOn; + //private static string ListeningOn = "http://localhost:55799/"; + + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ProxyFeatureTests), typeof(ProxyFeatureTests).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new ProxyFeature( + matchingRequests: req => req.PathInfo.StartsWith("/test"), + resolveUrl: req => "http://test.servicestack.net" + req.RawUrl.Replace("/test", "/")) + { + TransformRequest = TransformRequest, + TransformResponse = TransformResponse, + }); + + Plugins.Add(new ProxyFeature( + matchingRequests: req => req.PathInfo.StartsWith("/techstacks"), + resolveUrl: req => "https://www.techstacks.io" + req.RawUrl.Replace("/techstacks", "/")) + { + TransformRequest = TransformRequest, + TransformResponse = TransformResponse, + }); + + Plugins.Add(new ProxyFeature( + matchingRequests: req => req.PathInfo.StartsWith("/imgur-netcore"), + resolveUrl: req => "http://imgur.netcore.io" + req.RawUrl.Replace("/imgur-netcore", "/")) + ); + + Plugins.Add(new ProxyFeature( + matchingRequests: req => req.PathInfo.StartsWith("/chat"), + resolveUrl: req => "http://chat.servicestack.net" + req.RawUrl.Replace("/chat", "/")) + ); + + Plugins.Add(new ProxyFeature( + matchingRequests: req => req.PathInfo.StartsWith("/proxy"), + resolveUrl: req => req.RawUrl.Replace("/proxy/", "")) + { + IgnoreResponseHeaders = { "X-Frame-Options" }, + TransformResponse = async (res, responseStream) => { + var enc = res.GetHeader(HttpHeaders.ContentEncoding); + var useStream = responseStream; + if (enc != null) + useStream = responseStream.Decompress(enc); + + using (var reader = new StreamReader(useStream,Encoding.UTF8)) + { + var responseBody = await reader.ReadToEndAsync(); + var replacedBody = responseBody.Replace("http://","/proxy/http://"); + replacedBody = replacedBody.Replace("https://", "/proxy/https://"); + + var bytes = replacedBody.ToUtf8Bytes(); + return MemoryStreamFactory.GetStream(enc != null ? bytes.CompressBytes(enc) : bytes); + } + } + }); + + //Allow this proxy server to issue ss-id/ss-pid Session Cookies + //Plugins.Add(new SessionFeature()); + } + + private async Task TransformRequest(IHttpRequest req, Stream reqStream) + { + var reqReplace = req.QueryString["reqReplace"]; + if (reqReplace != null) + { + var reqBody = await reqStream.ReadToEndAsync(); + var parts = reqReplace.SplitOnFirst(','); + var replacedBody = reqBody.Replace(parts[0], parts[1]); + return MemoryStreamFactory.GetStream(replacedBody.ToUtf8Bytes()); + } + return reqStream; + } + + private async Task TransformResponse(IHttpResponse res, Stream resStream) + { + var req = res.Request; + var resReplace = req.QueryString["resReplace"]; + if (resReplace != null) + { + var resBody = await resStream.ReadToEndAsync(); + var parts = resReplace.SplitOnFirst(','); + var replacedBody = resBody.Replace(parts[0], parts[1]); + return MemoryStreamFactory.GetStream(replacedBody.ToUtf8Bytes()); + } + return resStream; + } + } + + private readonly ServiceStackHost appHost; + + public ProxyFeatureTests() + { + appHost = new AppHost() + .Init() + .Start(ListeningOn); + } + + [OneTimeTearDown] public void OneTimeTearDown() => appHost.Dispose(); + + [Route("/echo/types")] + public partial class EchoTypes + : IReturn + { + public virtual byte Byte { get; set; } + public virtual short Short { get; set; } + public virtual int Int { get; set; } + public virtual long Long { get; set; } + public virtual ushort UShort { get; set; } + public virtual uint UInt { get; set; } + public virtual ulong ULong { get; set; } + public virtual float Float { get; set; } + public virtual double Double { get; set; } + public virtual decimal Decimal { get; set; } + public virtual string String { get; set; } + public virtual DateTime DateTime { get; set; } + public virtual TimeSpan TimeSpan { get; set; } + public virtual DateTimeOffset DateTimeOffset { get; set; } + public virtual Guid Guid { get; set; } + public virtual Char Char { get; set; } + } + + [Test] + public void Can_proxy_to_test_servicestack() + { + var client = new JsonServiceClient(ListeningOn.CombineWith("test")); + + var request = new EchoTypes + { + Byte = 1, + Short = 2, + Int = 3, + Long = 4, + Float = 1.1f, + String = "foo" + }; + var response = client.Post(request); + + Assert.That(response.Byte, Is.EqualTo(1)); + Assert.That(response.Short, Is.EqualTo(2)); + Assert.That(response.Int, Is.EqualTo(3)); + Assert.That(response.Long, Is.EqualTo(4)); + Assert.That(response.Float, Is.EqualTo(1.1f)); + Assert.That(response.String, Is.EqualTo("foo")); + } + + [Test] + public async Task Can_proxy_to_test_servicestack_Async() + { + var client = new JsonHttpClient(ListeningOn.CombineWith("test")); + + var request = new EchoTypes + { + Byte = 1, + Short = 2, + Int = 3, + Long = 4, + Float = 1.1f, + String = "foo" + }; + var response = await client.PostAsync(request); + + Assert.That(response.Byte, Is.EqualTo(1)); + Assert.That(response.Short, Is.EqualTo(2)); + Assert.That(response.Int, Is.EqualTo(3)); + Assert.That(response.Long, Is.EqualTo(4)); + Assert.That(response.Float, Is.EqualTo(1.1f)); + Assert.That(response.String, Is.EqualTo("foo")); + } + + [Test] + public void Can_TransformRequest_when_proxying_to_test() + { + var request = new EchoTypes + { + Byte = 1, + Short = 2, + Int = 3, + Long = 4, + Float = 1.1f, + String = "foo" + }; + + var url = ListeningOn.CombineWith("test") + .CombineWith("/echo/types") + .AddQueryParam("reqReplace", "foo,bar"); + + var response = url.PostJsonToUrl(request) + .FromJson(); + + Assert.That(response.Byte, Is.EqualTo(1)); + Assert.That(response.Short, Is.EqualTo(2)); + Assert.That(response.Int, Is.EqualTo(3)); + Assert.That(response.Long, Is.EqualTo(4)); + Assert.That(response.Float, Is.EqualTo(1.1f)); + Assert.That(response.String, Is.EqualTo("bar")); + } + + [Test] + public void Can_TransformResponse_when_proxying_to_test() + { + var request = new EchoTypes + { + Byte = 1, + Short = 2, + Int = 3, + Long = 4, + Float = 1.1f, + String = "foo" + }; + + var url = ListeningOn.CombineWith("test") + .CombineWith("/echo/types") + .AddQueryParam("resReplace", "foo,bar"); + + var response = url.PostJsonToUrl(request) + .FromJson(); + + Assert.That(response.Byte, Is.EqualTo(1)); + Assert.That(response.Short, Is.EqualTo(2)); + Assert.That(response.Int, Is.EqualTo(3)); + Assert.That(response.Long, Is.EqualTo(4)); + Assert.That(response.Float, Is.EqualTo(1.1f)); + Assert.That(response.String, Is.EqualTo("bar")); + } + + [Route("/technology/{Slug}")] + public partial class GetTechnology + : IReturn + { + public virtual string Slug { get; set; } + } + + public partial class GetTechnologyResponse + { + public virtual DateTime Created { get; set; } + public virtual Technology Technology { get; set; } + public virtual ResponseStatus ResponseStatus { get; set; } + } + public partial class Technology + : TechnologyBase + { + } + + public partial class TechnologyBase + { + public virtual long Id { get; set; } + public virtual string Name { get; set; } + public virtual string VendorName { get; set; } + public virtual string VendorUrl { get; set; } + public virtual string ProductUrl { get; set; } + public virtual string LogoUrl { get; set; } + public virtual string Description { get; set; } + public virtual DateTime Created { get; set; } + public virtual string CreatedBy { get; set; } + public virtual DateTime LastModified { get; set; } + public virtual string LastModifiedBy { get; set; } + public virtual string OwnerId { get; set; } + public virtual string Slug { get; set; } + public virtual bool LogoApproved { get; set; } + public virtual bool IsLocked { get; set; } + public virtual DateTime? LastStatusUpdate { get; set; } + } + + [Test] + public void Can_proxy_to_techstacks() + { + var client = new JsonServiceClient(ListeningOn.CombineWith("techstacks")); + + var request = new GetTechnology + { + Slug = "ServiceStack" + }; + var response = client.Get(request); + + Assert.That(response.Technology.VendorUrl, Is.EqualTo("https://servicestack.net")); + } + + [Test] + public async Task Can_proxy_to_techstacks_Async() + { + var client = new JsonServiceClient(ListeningOn.CombineWith("techstacks")); + + var request = new GetTechnology + { + Slug = "ServiceStack" + }; + var response = await client.GetAsync(request); + + Assert.That(response.Technology.VendorUrl, Is.EqualTo("https://servicestack.net")); + } + + [Test] + public void Can_authenticate_with_downstream_server() + { + var client = new JsonServiceClient(ListeningOn.CombineWith("test")) + { + ResponseFilter = res => + { + var ssId = res.Cookies["ss-id"]; + Assert.That(ssId.Value, Is.Not.Null); + } + }; + + var response = client.Post(new Authenticate + { + provider = "credentials", + UserName = "test", + Password = "test", + }); + + Assert.That(response.UserId, Is.Not.EqualTo(0)); + Assert.That(response.SessionId, Is.Not.Null); + Assert.That(response.UserName, Is.Not.Null); + } + + [Test] + public void Does_proxy_test_Exceptions() + { + var client = new JsonServiceClient(ListeningOn.CombineWith("test")); + + try + { + var response = client.Post(new Authenticate + { + provider = "credentials", + UserName = "invalid", + Password = "password", + }); + } + catch (WebServiceException webEx) + { + var status = webEx.ResponseStatus; + Assert.That(webEx.StatusCode, Is.EqualTo(401)); + Assert.That(webEx.StatusDescription, Is.EqualTo("Unauthorized")); + Assert.That(status.ErrorCode, Is.EqualTo("Unauthorized")); + Assert.That(status.Message, Is.EqualTo("Invalid UserName or Password")); + } + } + +// [Ignore("Adhoc Integration Test"), Test] + public async Task Try_connect_to_ServerEvents_over_proxy() + { + ServerEventsClient client = null; + var proxyBaseUrl = ListeningOn.CombineWith("chat"); + client = new ServerEventsClient(proxyBaseUrl) + { + OnConnect = async c => + { + var proxyUrl = ListeningOn + c.HeartbeatUrl.Replace("http://chat.servicestack.net", "chat"); + client.ConnectionInfo.HeartbeatIntervalMs = 1000; + client.ConnectionInfo.HeartbeatUrl = proxyUrl; + var response = await proxyUrl.GetStringFromUrlAsync(); + Assert.That(response, Is.Empty); + }, + OnHeartbeat = () => + { + "Received Heartbeat".Print(); + }, + OnException = ex => + { + ex.Message.Print(); + } + }; + + client.Start(); + await client.Connect(); + + Thread.Sleep(TimeSpan.FromSeconds(120)); + } + +// [Ignore("Ephemeral external host + state dependency"), Test] + public void Can_proxy_chunked_encoding_responses() + { + var html = ListeningOn.CombineWith("imgur-netcore").GetStringFromUrl(accept:MimeTypes.Html); + + html.Length.Print(); + + Assert.That(html.Length, Is.GreaterThan(1000)); + } + +// [Ignore("Ephemeral external host + state dependency"), Test] + public void Can_rewrite_compressed_proxy_responses() + { + var url = ListeningOn.CombineWith("proxy/https://www.theverge.com"); + var response = url.GetStringFromUrl(); + response.Print(); + + Assert.That(response, Does.Contain("/proxy/https://")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/SecuredPage.cshtml b/tests/ServiceStack.Server.Tests/SecuredPage.cshtml new file mode 100644 index 00000000000..96208d5fb04 --- /dev/null +++ b/tests/ServiceStack.Server.Tests/SecuredPage.cshtml @@ -0,0 +1,7 @@ +@{ + base.RedirectIfNotAuthenticated(); +} + +

      Secured Page

      + + \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/ServiceStack.Server.Tests.csproj b/tests/ServiceStack.Server.Tests/ServiceStack.Server.Tests.csproj index 37c6aced968..0d4268b69d7 100644 --- a/tests/ServiceStack.Server.Tests/ServiceStack.Server.Tests.csproj +++ b/tests/ServiceStack.Server.Tests/ServiceStack.Server.Tests.csproj @@ -1,146 +1,66 @@ - - - + - Debug - AnyCPU - {BB47EC88-D61D-4B67-9491-78C7155A7798} - Library - Properties - ServiceStack.Server.Tests - ServiceStack.Server.Tests - v4.0 - 512 - ..\..\src\ - true - - - true + net46;netcoreapp3.1 full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - x86 - - - bin\Signed\ - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset + ServiceStack.Server.Tests + Library + ServiceStack.Server.Tests + false + false + false + false + false + false + false + false - - False - ..\..\src\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - ..\..\src\packages\RabbitMQ.Client.3.2.4\lib\net30\RabbitMQ.Client.dll - - - ..\..\lib\ServiceStack.Interfaces.dll - - - ..\..\lib\ServiceStack.OrmLite.dll - - - ..\..\lib\ServiceStack.OrmLite.Sqlite.dll - - - ..\..\lib\ServiceStack.OrmLite.SqlServer.dll - - - ..\..\lib\ServiceStack.Redis.dll - - - ..\..\lib\ServiceStack.Text.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - {c43f583f-abde-4dd4-bbe3-66322817a6ad} - ServiceStack.Client - - - {982416db-c143-4028-a0c3-cf41892d18d3} - ServiceStack.Common - - - {E940929C-9E76-41CD-BD09-08029FE9B440} - ServiceStack.RabbitMq - - - {5a315f92-80d2-4c60-a5a4-22e027ac7e7e} - ServiceStack.Server - - - {680a1709-25eb-4d52-a87f-ee03ffd94baa} - ServiceStack - + + + + + + + + + + + + + + + + + + + - - - sqlite3.dll - PreserveNewest - + + + + + + + + + + + + - - - - + + $(DefineConstants);NETCORE_SUPPORT;NETCORE + + + + + + + - - - \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Shared/CacheClientTestsBase.cs b/tests/ServiceStack.Server.Tests/Shared/CacheClientTestsBase.cs new file mode 100644 index 00000000000..8793dde87e5 --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Shared/CacheClientTestsBase.cs @@ -0,0 +1,522 @@ +using System; +using System.Linq; +using System.Runtime.Serialization; +using System.Threading; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Caching; +using ServiceStack.OrmLite; +using ServiceStack.Text; + +namespace ServiceStack.Server.Tests.Shared +{ + public class Item + { + public int Id { get; set; } + + public string Name { get; set; } + + protected bool Equals(Item other) + { + return Id == other.Id && string.Equals(Name, other.Name); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != this.GetType()) return false; + return Equals((Item)obj); + } + + public override int GetHashCode() + { + unchecked + { + return (Id * 397) ^ (Name != null ? Name.GetHashCode() : 0); + } + } + } + + public class AllFields + { + public int Id { get; set; } + public int? NullableId { get; set; } + public byte Byte { get; set; } + public short Short { get; set; } + public int Int { get; set; } + public long Long { get; set; } + public ushort UShort { get; set; } + public uint UInt { get; set; } + public ulong ULong { get; set; } + public float Float { get; set; } + public double Double { get; set; } + public decimal Decimal { get; set; } + public string String { get; set; } + public DateTime DateTime { get; set; } + public TimeSpan TimeSpan { get; set; } + public Guid Guid { get; set; } + public DateTime? NullableDateTime { get; set; } + public TimeSpan? NullableTimeSpan { get; set; } + public Guid? NullableGuid { get; set; } + + protected bool Equals(AllFields other) + { + return Id == other.Id && + NullableId == other.NullableId && + Byte == other.Byte && + Short == other.Short && + Int == other.Int && + Long == other.Long && + UShort == other.UShort && + UInt == other.UInt && + ULong == other.ULong && + Float.Equals(other.Float) && + Double.Equals(other.Double) && + Decimal == other.Decimal && + string.Equals(String, other.String) && + DateTime.Equals(other.DateTime) && + TimeSpan.Equals(other.TimeSpan) && + Guid.Equals(other.Guid) && + NullableDateTime.Equals(other.NullableDateTime) && + NullableTimeSpan.Equals(other.NullableTimeSpan) && + NullableGuid.Equals(other.NullableGuid); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != this.GetType()) return false; + return Equals((AllFields)obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = Id; + hashCode = (hashCode * 397) ^ NullableId.GetHashCode(); + hashCode = (hashCode * 397) ^ Byte.GetHashCode(); + hashCode = (hashCode * 397) ^ Short.GetHashCode(); + hashCode = (hashCode * 397) ^ Int; + hashCode = (hashCode * 397) ^ Long.GetHashCode(); + hashCode = (hashCode * 397) ^ UShort.GetHashCode(); + hashCode = (hashCode * 397) ^ (int)UInt; + hashCode = (hashCode * 397) ^ ULong.GetHashCode(); + hashCode = (hashCode * 397) ^ Float.GetHashCode(); + hashCode = (hashCode * 397) ^ Double.GetHashCode(); + hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); + hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ DateTime.GetHashCode(); + hashCode = (hashCode * 397) ^ TimeSpan.GetHashCode(); + hashCode = (hashCode * 397) ^ Guid.GetHashCode(); + hashCode = (hashCode * 397) ^ NullableDateTime.GetHashCode(); + hashCode = (hashCode * 397) ^ NullableTimeSpan.GetHashCode(); + hashCode = (hashCode * 397) ^ NullableGuid.GetHashCode(); + return hashCode; + } + } + } + + + public class CustomAuthSession : AuthUserSession + { + [DataMember] + public string Custom { get; set; } + } + + [TestFixture] + public abstract class CacheClientTestsBase + { + private readonly ICacheClient Cache; + + public abstract ICacheClient CreateClient(); + + protected CacheClientTestsBase() + { + Cache = CreateClient(); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + Cache.Dispose(); + } + + [SetUp] + public void SetUp() + { + Cache.FlushAll(); + } + + [Test] + public void Does_flush_all() + { + 3.Times(i => + Cache.Set(i.ToUrn(), new Item { Id = i, Name = "Name" + i })); + + Assert.That(Cache.Get(1.ToUrn()), Is.Not.Null); + + Cache.FlushAll(); + + Assert.That(Cache.Get(1.ToUrn()), Is.Null); + } + + [Test] + public void Can_set_and_remove_entry() + { + var key = 1.ToUrn(); + + var item = Cache.Get(key); + Assert.That(item, Is.Null); + + var whenNotExists = Cache.Set(key, new Item { Id = 1, Name = "Foo" }); + Assert.That(whenNotExists, Is.True); + var whenExists = Cache.Set(key, new Item { Id = 1, Name = "Foo" }); + Assert.That(whenExists, Is.True); + + item = Cache.Get(key); + Assert.That(item, Is.Not.Null); + Assert.That(item.Name, Is.EqualTo("Foo")); + + whenExists = Cache.Remove(key); + Assert.That(whenExists, Is.True); + + whenNotExists = Cache.Remove(key); + Assert.That(whenNotExists, Is.False); + } + + [Test] + public void Can_update_existing_entry() + { + var key = 1.ToUrn(); + + Cache.Set(key, new Item { Id = 1, Name = "Foo" }); + Cache.Set(key, new Item { Id = 2, Name = "Updated" }); + + var item = Cache.Get(key); + + Assert.That(item.Id, Is.EqualTo(2)); + Assert.That(item.Name, Is.EqualTo("Updated")); + } + + [Test] + public void Does_SetAll_and_GetAll() + { + var map = 3.Times(i => new Item { Id = i, Name = "Name" + i }) + .ToSafeDictionary(x => x.ToUrn()); + + Cache.SetAll(map); + + var cacheMap = Cache.GetAll(map.Keys); + + Assert.That(cacheMap, Is.EquivalentTo(map)); + } + + [Test] + public void Does_not_return_expired_items() + { + var key = 1.ToUrn(); + + Cache.Set(key, new Item { Id = 1, Name = "Foo" }, DateTime.UtcNow.AddSeconds(-1)); + Assert.That(Cache.Get(key), Is.Null); + + Cache.Remove(key); + + Cache.Set(key, new Item { Id = 1, Name = "Foo" }, TimeSpan.FromMilliseconds(100)); + var entry = Cache.Get(key); + Assert.That(entry, Is.Not.Null); + Thread.Sleep(200); + + Assert.That(Cache.Get(key), Is.Null); + + Cache.Remove(key); + + Cache.Set(key, new Item { Id = 1, Name = "Foo" }, DateTime.UtcNow.AddMilliseconds(200)); + entry = Cache.Get(key); + Assert.That(entry, Is.Not.Null); + Thread.Sleep(300); + + Assert.That(Cache.Get(key), Is.Null); + } + + [Test] + public void Expired_item_returns_correct_GetTimeToLive() + { + var ormliteCache = Cache as OrmLiteCacheClient; + var key = "int:key"; + + var value = Cache.GetOrCreate(key, TimeSpan.FromMilliseconds(100), () => 1); + var ttl = Cache.GetTimeToLive(key); + + if (ormliteCache != null) + { + using (var db = ormliteCache.DbFactory.OpenDbConnection()) + { + var row = db.SingleById(key); + Assert.That(row, Is.Not.Null); + Assert.That(row.ExpiryDate, Is.Not.Null); + } + } + + Assert.That(value, Is.EqualTo(1)); + Assert.That(ttl.Value.TotalMilliseconds, Is.GreaterThan(0)); + + Thread.Sleep(200); + value = Cache.Get(key); + ttl = Cache.GetTimeToLive(key); + + Assert.That(value, Is.EqualTo(0)); + Assert.That(ttl, Is.Null); + + if (ormliteCache != null) + { + using (var db = ormliteCache.DbFactory.OpenDbConnection()) + { + var row = db.SingleById(key); + Assert.That(row, Is.Null); + } + } + } + + [Test] + public void Can_increment_and_decrement_values() + { + Assert.That(Cache.Increment("incr:a", 2), Is.EqualTo(2)); + Assert.That(Cache.Increment("incr:a", 3), Is.EqualTo(5)); + + Assert.That(Cache.Decrement("decr:a", 2), Is.EqualTo(-2)); + Assert.That(Cache.Decrement("decr:a", 3), Is.EqualTo(-5)); + } + + [Test] + public void Can_increment_and_reset_values() + { + Assert.That(Cache.Increment("incr:counter", 10), Is.EqualTo(10)); + Cache.Set("incr:counter", 0); + Assert.That(Cache.Increment("incr:counter", 10), Is.EqualTo(10)); + } + + [Test] + public void Can_remove_multiple_items() + { + var map = 5.Times(i => new Item { Id = i, Name = "Name" + i }) + .ToSafeDictionary(x => x.ToUrn()); + + Cache.SetAll(map); + + Cache.RemoveAll(map.Keys); + + var cacheMap = Cache.GetAll(map.Keys); + + Assert.That(cacheMap.Count, Is.EqualTo(5)); + Assert.That(cacheMap.Values.All(x => x == null)); + } + + [Test] + public void Can_retrieve_IAuthSession() + { + IAuthSession session = new CustomAuthSession + { + Id = "sess-1", + UserAuthId = "1", + Custom = "custom" + }; + + var sessionKey = SessionFeature.GetSessionKey(session.Id); + Cache.Set(sessionKey, session, SessionFeature.DefaultSessionExpiry); + + var sessionCache = Cache.Get(sessionKey); + Assert.That(sessionCache, Is.Not.Null); + + var typedSession = sessionCache as CustomAuthSession; + Assert.That(typedSession, Is.Not.Null); + Assert.That(typedSession.Custom, Is.EqualTo("custom")); + } + + [Test] + public void Can_retrieve_TimeToLive_on_IAuthSession() + { + IAuthSession session = new CustomAuthSession + { + Id = "sess-1", + UserAuthId = "1", + Custom = "custom" + }; + + var sessionKey = SessionFeature.GetSessionKey(session.Id); + Cache.Remove(sessionKey); + + var ttl = Cache.GetTimeToLive(sessionKey); + Assert.That(ttl, Is.Null); + + Cache.Set(sessionKey, session); + ttl = Cache.GetTimeToLive(sessionKey); + Assert.That(ttl.Value, Is.EqualTo(TimeSpan.MaxValue)); + + var sessionExpiry = SessionFeature.DefaultSessionExpiry; + Cache.Set(sessionKey, session, sessionExpiry); + ttl = Cache.GetTimeToLive(sessionKey); + Assert.That(ttl.Value, Is.GreaterThan(TimeSpan.FromSeconds(0))); + Assert.That(ttl.Value, Is.LessThan(sessionExpiry). + Or.EqualTo(sessionExpiry).Within(TimeSpan.FromSeconds(1))); + } + + [Test] + public void Can_retrieve_IAuthSession_with_global_ExcludeTypeInfo_set() + { + JsConfig.ExcludeTypeInfo = true; + + IAuthSession session = new CustomAuthSession + { + Id = "sess-1", + UserAuthId = "1", + Custom = "custom" + }; + + var sessionKey = SessionFeature.GetSessionKey(session.Id); + Cache.Set(sessionKey, session, SessionFeature.DefaultSessionExpiry); + + var sessionCache = Cache.Get(sessionKey); + Assert.That(sessionCache, Is.Not.Null); + + var typedSession = sessionCache as CustomAuthSession; + Assert.That(typedSession, Is.Not.Null); + Assert.That(typedSession.Custom, Is.EqualTo("custom")); + + JsConfig.Reset(); + } + + [Test] + public void Can_cache_multiple_items_in_parallel() + { + var cache = CreateClient(); + var fns = 10.Times(i => (Action)(() => + { + cache.Set("concurrent-test", "Data: {0}".Fmt(i)); + })); + + Parallel.Invoke(fns.ToArray()); + + var entry = cache.Get("concurrent-test"); + Assert.That(entry, Does.StartWith("Data: ")); + } + + [Test] + public void Can_set_get_and_remove_ISession() + { + var sessionA = new SessionFactory(CreateClient()).CreateSession("a"); + var sessionB = new SessionFactory(CreateClient()).CreateSession("b"); + + 3.Times(i => + { + sessionA.Set("key" + i, "value" + i); + sessionB.Set("key" + i, "value" + i); + }); + + var value1 = sessionA.Get("key1"); + Assert.That(value1, Is.EqualTo("value1")); + + sessionA.RemoveAll(); + value1 = sessionA.Get("key1"); + Assert.That(value1, Is.Null); + + value1 = sessionB.Get("key1"); + Assert.That(value1, Is.EqualTo("value1")); + } + + [Test] + public void Can_GetKeysByPattern() + { + if (!(Cache is ICacheClientExtended)) + return; + + JsConfig.ExcludeTypeInfo = true; + + 5.Times(i => + { + IAuthSession session = new CustomAuthSession + { + Id = "sess-" + i, + UserAuthId = i.ToString(), + Custom = "custom" + i + }; + + var sessionKey = SessionFeature.GetSessionKey(session.Id); + Cache.Set(sessionKey, session, SessionFeature.DefaultSessionExpiry); + Cache.Set("otherkey" + i, i); + }); + + var sessionPattern = IdUtils.CreateUrn(""); + Assert.That(sessionPattern, Is.EqualTo("urn:iauthsession:")); + var sessionKeys = Cache.GetKeysStartingWith(sessionPattern).ToList(); + + Assert.That(sessionKeys.Count, Is.EqualTo(5)); + Assert.That(sessionKeys.All(x => x.StartsWith("urn:iauthsession:"))); + + var allSessions = Cache.GetAll(sessionKeys); + Assert.That(allSessions.Values.Count(x => x != null), Is.EqualTo(sessionKeys.Count)); + + var allKeys = Cache.GetAllKeys().ToList(); + Assert.That(allKeys.Count, Is.EqualTo(10)); + + JsConfig.Reset(); + } + + [Test] + public void Can_Cache_AllFields() + { + JsConfig.DateHandler = DateHandler.ISO8601; + + var dto = new AllFields + { + Id = 1, + NullableId = 2, + Byte = 3, + Short = 4, + Int = 5, + Long = 6, + UShort = 7, + UInt = 8, + Float = 1.1f, + Double = 2.2d, + Decimal = 3.3m, + String = "String", + DateTime = DateTime.Now, + TimeSpan = new TimeSpan(1, 1, 1, 1, 1), + Guid = Guid.NewGuid(), + NullableTimeSpan = new TimeSpan(2, 2, 2), + NullableGuid = new Guid("4B6BB8AE-57B5-4B5B-8632-0C35AF0B3168"), + }; + + Cache.Set("allfields", dto); + var fromCache = Cache.Get("allfields"); + + Assert.That(fromCache.DateTime, Is.EqualTo(dto.DateTime)); + + Assert.That(fromCache.Equals(dto)); + + JsConfig.Reset(); + } + + [Test] + public void Can_RemoveAll_and_GetKeysStartingWith_with_prefix() + { + var cache = Cache.WithPrefix("prefix."); + + cache.Set("test_QUERY_Deposit__Query_Deposit_10_1", "A"); + cache.Set("test_QUERY_Deposit__0_1___CUSTOM", "B"); + + var keys = cache.GetKeysStartingWith("test_QUERY_Deposit"); + Assert.That(keys.Count, Is.EqualTo(2)); + + cache.RemoveAll(keys); + + var newKeys = cache.GetKeysStartingWith("test_QUERY_Deposit"); + Assert.That(newKeys.Count, Is.EqualTo(0)); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/TestConfig.cs b/tests/ServiceStack.Server.Tests/TestConfig.cs index b0898bc2b7e..45c3bd69384 100644 --- a/tests/ServiceStack.Server.Tests/TestConfig.cs +++ b/tests/ServiceStack.Server.Tests/TestConfig.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt diff --git a/tests/ServiceStack.Server.Tests/TestSessionPage.cshtml b/tests/ServiceStack.Server.Tests/TestSessionPage.cshtml new file mode 100644 index 00000000000..d668a6834eb --- /dev/null +++ b/tests/ServiceStack.Server.Tests/TestSessionPage.cshtml @@ -0,0 +1,7 @@ +@{ + var session = base.GetSession(); +} + +IsAuthenticated:@session.IsAuthenticated + + \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/TransientServiceMessagingTests.cs b/tests/ServiceStack.Server.Tests/TransientServiceMessagingTests.cs index e6da5f99b12..63bc2b6348d 100644 --- a/tests/ServiceStack.Server.Tests/TransientServiceMessagingTests.cs +++ b/tests/ServiceStack.Server.Tests/TransientServiceMessagingTests.cs @@ -12,18 +12,9 @@ public override void OnBeforeEachTest() { base.OnBeforeEachTest(); - Container.Register(c => new GreetService - { - MessageFactory = c.Resolve() - }); - Container.Register(c => new AlwaysFailService - { - MessageFactory = c.Resolve() - }); - Container.Register(c => new UnRetryableFailService - { - MessageFactory = c.Resolve() - }); + Container.Register(c => new GreetService()); + Container.Register(c => new AlwaysFailService()); + Container.Register(c => new UnRetryableFailService()); } [Test] diff --git a/tests/ServiceStack.Server.Tests/Views/Secured.cshtml b/tests/ServiceStack.Server.Tests/Views/Secured.cshtml new file mode 100644 index 00000000000..3f06c4e9165 --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Views/Secured.cshtml @@ -0,0 +1,11 @@ +@inherits ViewPage + +@{ + base.RedirectIfNotAuthenticated(); +} + +

      Secure View

      + +

      @Model.Result

      + + \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/Views/Shared/_Layout.cshtml b/tests/ServiceStack.Server.Tests/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000000..4ce1767f6b9 --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Views/Shared/_Layout.cshtml @@ -0,0 +1,14 @@ + + + + Global _Layout + + +

      Global _Layout

      +
      + @RenderBody() +
      + + + + diff --git a/tests/ServiceStack.Server.Tests/Views/TestSessionView.cshtml b/tests/ServiceStack.Server.Tests/Views/TestSessionView.cshtml new file mode 100644 index 00000000000..ee2c7e84e05 --- /dev/null +++ b/tests/ServiceStack.Server.Tests/Views/TestSessionView.cshtml @@ -0,0 +1,8 @@ +@inherits ViewPage +@{ + var session = base.GetSession(); +} + +IsAuthenticated:@session.IsAuthenticated + + \ No newline at end of file diff --git a/tests/ServiceStack.Server.Tests/packages.config b/tests/ServiceStack.Server.Tests/packages.config deleted file mode 100644 index 0e3f4f2816b..00000000000 --- a/tests/ServiceStack.Server.Tests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/App.config b/tests/ServiceStack.ServiceHost.Tests/App.config index 196ae8f60ba..30c4ac4fa4e 100644 --- a/tests/ServiceStack.ServiceHost.Tests/App.config +++ b/tests/ServiceStack.ServiceHost.Tests/App.config @@ -1,7 +1,7 @@ - + - + @@ -13,18 +13,35 @@ compilerOptions="" warningLevel="1" />--> - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/ServiceStack.ServiceHost.Tests/AppData/FormatHelpers.cs b/tests/ServiceStack.ServiceHost.Tests/AppData/FormatHelpers.cs index 13600b5d6f2..1ace56648ec 100644 --- a/tests/ServiceStack.ServiceHost.Tests/AppData/FormatHelpers.cs +++ b/tests/ServiceStack.ServiceHost.Tests/AppData/FormatHelpers.cs @@ -2,19 +2,19 @@ namespace ServiceStack.ServiceHost.Tests.AppData { - public class FormatHelpers - { - public static FormatHelpers Instance = new FormatHelpers(); + public class FormatHelpers + { + public static FormatHelpers Instance = new FormatHelpers(); - public string Money(decimal value) - { - return value.ToString("C"); - } + public string Money(decimal value) + { + return value.ToString("C"); + } - public string ShortDate(DateTime? dateTime) - { - if (dateTime == null) return ""; - return String.Format("{0:dd/MM/yyyy}", dateTime); - } - } + public string ShortDate(DateTime? dateTime) + { + if (dateTime == null) return ""; + return String.Format("{0:dd/MM/yyyy}", dateTime); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindCustomers.cs b/tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindCustomers.cs index de5696cbf07..76f8e03fd93 100644 --- a/tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindCustomers.cs +++ b/tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindCustomers.cs @@ -3,205 +3,205 @@ namespace ServiceStack.ServiceHost.Tests.AppData { - public class Customers { } - - public class CustomersResponse : IHasResponseStatus - { - public CustomersResponse() - { - this.ResponseStatus = new ResponseStatus(); - this.Customers = new List(); - } - public List Customers { get; set; } - public ResponseStatus ResponseStatus { get; set; } - } - - public class CustomerDetails - { - public string Id { get; set; } - } - - public class CustomerDetailsResponse : IHasResponseStatus - { - public CustomerDetailsResponse() - { - this.ResponseStatus = new ResponseStatus(); - this.CustomerOrders = new List(); - } - public Customer Customer { get; set; } - public List CustomerOrders { get; set; } - public ResponseStatus ResponseStatus { get; set; } - } - - public class Orders - { - public int? Page { get; set; } - public string CustomerId { get; set; } - } - - public class OrdersResponse : IHasResponseStatus - { - public OrdersResponse() - { - this.ResponseStatus = new ResponseStatus(); - this.Results = new List(); - } - public List Results { get; set; } - public ResponseStatus ResponseStatus { get; set; } - } - - public class Category - { - public int Id { get; set; } - public string CategoryName { get; set; } - public string Description { get; set; } - } - - public class Customer - { - public string Id { get; set; } - public string CompanyName { get; set; } - public string ContactName { get; set; } - public string ContactTitle { get; set; } - public string Address { get; set; } - public string City { get; set; } - public string Region { get; set; } - public string PostalCode { get; set; } - public string Country { get; set; } - public string Phone { get; set; } - public string Fax { get; set; } - public string Email - { - get { return this.ContactName.Replace(" ", ".").ToLower() + "@gmail.com"; } - } - } - - public class CustomerCustomerDemo - { - public string Id { get; set; } - public string CustomerTypeId { get; set; } - } - - public class CustomerDemographic - { - public string Id { get; set; } - public string CustomerDesc { get; set; } - } - - public class CustomerOrder - { - public CustomerOrder() - { - this.OrderDetails = new List(); - } - public Order Order { get; set; } - public List OrderDetails { get; set; } - } - - public class Employee - { - public int Id { get; set; } - public string LastName { get; set; } - public string FirstName { get; set; } - public string Title { get; set; } - public string TitleOfCourtesy { get; set; } - public DateTime? BirthDate { get; set; } - public DateTime? HireDate { get; set; } - public string Address { get; set; } - public string City { get; set; } - public string Region { get; set; } - public string PostalCode { get; set; } - public string Country { get; set; } - public string HomePhone { get; set; } - public string Extension { get; set; } - public byte[] Photo { get; set; } - public string Notes { get; set; } - public int? ReportsTo { get; set; } - public string PhotoPath { get; set; } - } - - public class EmployeeTerritory - { - public string Id { get { return this.EmployeeId + "/" + this.TerritoryId; } } - public int EmployeeId { get; set; } - public string TerritoryId { get; set; } - } - - public class Order - { - public int Id { get; set; } - public string CustomerId { get; set; } - public int EmployeeId { get; set; } - public DateTime? OrderDate { get; set; } - public DateTime? RequiredDate { get; set; } - public DateTime? ShippedDate { get; set; } - public int? ShipVia { get; set; } - public decimal Freight { get; set; } - public string ShipName { get; set; } - public string ShipAddress { get; set; } - public string ShipCity { get; set; } - public string ShipRegion { get; set; } - public string ShipPostalCode { get; set; } - public string ShipCountry { get; set; } - } - - public class OrderDetail - { - public string Id { get { return this.OrderId + "/" + this.ProductId; } } - public int OrderId { get; set; } - public int ProductId { get; set; } - public decimal UnitPrice { get; set; } - public short Quantity { get; set; } - public double Discount { get; set; } - } - - public class Product - { - public int Id { get; set; } - public string ProductName { get; set; } - public int SupplierId { get; set; } - public int CategoryId { get; set; } - public string QuantityPerUnit { get; set; } - public decimal UnitPrice { get; set; } - public short UnitsInStock { get; set; } - public short UnitsOnOrder { get; set; } - public short ReorderLevel { get; set; } - public bool Discontinued { get; set; } - } - - public class Region - { - public int Id { get; set; } - public string RegionDescription { get; set; } - } - - public class Shipper - { - public int Id { get; set; } - public string CompanyName { get; set; } - public string Phone { get; set; } - } - - public class Supplier - { - public int Id { get; set; } - public string CompanyName { get; set; } - public string ContactName { get; set; } - public string ContactTitle { get; set; } - public string Address { get; set; } - public string City { get; set; } - public string Region { get; set; } - public string PostalCode { get; set; } - public string Country { get; set; } - public string Phone { get; set; } - public string Fax { get; set; } - public string HomePage { get; set; } - } - - public class Territory - { - public string Id { get; set; } - public string TerritoryDescription { get; set; } - public int RegionId { get; set; } - } + public class Customers { } + + public class CustomersResponse : IHasResponseStatus + { + public CustomersResponse() + { + this.ResponseStatus = new ResponseStatus(); + this.Customers = new List(); + } + public List Customers { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class CustomerDetails + { + public string Id { get; set; } + } + + public class CustomerDetailsResponse : IHasResponseStatus + { + public CustomerDetailsResponse() + { + this.ResponseStatus = new ResponseStatus(); + this.CustomerOrders = new List(); + } + public Customer Customer { get; set; } + public List CustomerOrders { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class Orders + { + public int? Page { get; set; } + public string CustomerId { get; set; } + } + + public class OrdersResponse : IHasResponseStatus + { + public OrdersResponse() + { + this.ResponseStatus = new ResponseStatus(); + this.Results = new List(); + } + public List Results { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class Category + { + public int Id { get; set; } + public string CategoryName { get; set; } + public string Description { get; set; } + } + + public class Customer + { + public string Id { get; set; } + public string CompanyName { get; set; } + public string ContactName { get; set; } + public string ContactTitle { get; set; } + public string Address { get; set; } + public string City { get; set; } + public string Region { get; set; } + public string PostalCode { get; set; } + public string Country { get; set; } + public string Phone { get; set; } + public string Fax { get; set; } + public string Email + { + get { return this.ContactName.Replace(" ", ".").ToLower() + "@gmail.com"; } + } + } + + public class CustomerCustomerDemo + { + public string Id { get; set; } + public string CustomerTypeId { get; set; } + } + + public class CustomerDemographic + { + public string Id { get; set; } + public string CustomerDesc { get; set; } + } + + public class CustomerOrder + { + public CustomerOrder() + { + this.OrderDetails = new List(); + } + public Order Order { get; set; } + public List OrderDetails { get; set; } + } + + public class Employee + { + public int Id { get; set; } + public string LastName { get; set; } + public string FirstName { get; set; } + public string Title { get; set; } + public string TitleOfCourtesy { get; set; } + public DateTime? BirthDate { get; set; } + public DateTime? HireDate { get; set; } + public string Address { get; set; } + public string City { get; set; } + public string Region { get; set; } + public string PostalCode { get; set; } + public string Country { get; set; } + public string HomePhone { get; set; } + public string Extension { get; set; } + public byte[] Photo { get; set; } + public string Notes { get; set; } + public int? ReportsTo { get; set; } + public string PhotoPath { get; set; } + } + + public class EmployeeTerritory + { + public string Id { get { return this.EmployeeId + "/" + this.TerritoryId; } } + public int EmployeeId { get; set; } + public string TerritoryId { get; set; } + } + + public class Order + { + public int Id { get; set; } + public string CustomerId { get; set; } + public int EmployeeId { get; set; } + public DateTime? OrderDate { get; set; } + public DateTime? RequiredDate { get; set; } + public DateTime? ShippedDate { get; set; } + public int? ShipVia { get; set; } + public decimal Freight { get; set; } + public string ShipName { get; set; } + public string ShipAddress { get; set; } + public string ShipCity { get; set; } + public string ShipRegion { get; set; } + public string ShipPostalCode { get; set; } + public string ShipCountry { get; set; } + } + + public class OrderDetail + { + public string Id { get { return this.OrderId + "/" + this.ProductId; } } + public int OrderId { get; set; } + public int ProductId { get; set; } + public decimal UnitPrice { get; set; } + public short Quantity { get; set; } + public double Discount { get; set; } + } + + public class Product + { + public int Id { get; set; } + public string ProductName { get; set; } + public int SupplierId { get; set; } + public int CategoryId { get; set; } + public string QuantityPerUnit { get; set; } + public decimal UnitPrice { get; set; } + public short UnitsInStock { get; set; } + public short UnitsOnOrder { get; set; } + public short ReorderLevel { get; set; } + public bool Discontinued { get; set; } + } + + public class Region + { + public int Id { get; set; } + public string RegionDescription { get; set; } + } + + public class Shipper + { + public int Id { get; set; } + public string CompanyName { get; set; } + public string Phone { get; set; } + } + + public class Supplier + { + public int Id { get; set; } + public string CompanyName { get; set; } + public string ContactName { get; set; } + public string ContactTitle { get; set; } + public string Address { get; set; } + public string City { get; set; } + public string Region { get; set; } + public string PostalCode { get; set; } + public string Country { get; set; } + public string Phone { get; set; } + public string Fax { get; set; } + public string HomePage { get; set; } + } + + public class Territory + { + public string Id { get; set; } + public string TerritoryDescription { get; set; } + public int RegionId { get; set; } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindHelpers.cs b/tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindHelpers.cs index bd0955bb18a..7be13728332 100644 --- a/tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindHelpers.cs +++ b/tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindHelpers.cs @@ -3,24 +3,24 @@ namespace ServiceStack.ServiceHost.Tests.AppData { - public class NorthwindHelpers - { - public string OrderTotal(List orderDetails) - { - var total = 0m; - if (!orderDetails.IsEmpty()) - total += orderDetails.Sum(item => item.Quantity * item.UnitPrice); + public class NorthwindHelpers + { + public string OrderTotal(List orderDetails) + { + var total = 0m; + if (!orderDetails.IsEmpty()) + total += orderDetails.Sum(item => item.Quantity * item.UnitPrice); - return FormatHelpers.Instance.Money(total); - } + return FormatHelpers.Instance.Money(total); + } - public string CustomerOrderTotal(List customerOrders) - { - var total = customerOrders - .Sum(x => - x.OrderDetails.Sum(item => item.Quantity*item.UnitPrice)); - - return FormatHelpers.Instance.Money(total); - } - } + public string CustomerOrderTotal(List customerOrders) + { + var total = customerOrders + .Sum(x => + x.OrderDetails.Sum(item => item.Quantity * item.UnitPrice)); + + return FormatHelpers.Instance.Money(total); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Examples/FunqEasyRegistrationHelper.cs b/tests/ServiceStack.ServiceHost.Tests/Examples/FunqEasyRegistrationHelper.cs index 0bceb053226..1780668a4b2 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Examples/FunqEasyRegistrationHelper.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Examples/FunqEasyRegistrationHelper.cs @@ -6,64 +6,64 @@ namespace ServiceStack.ServiceHost.Tests.Examples { - /// - /// Funq helper for easy registration. - /// - public static class FunqEasyRegistrationHelper - { - /// - /// Register a service with the default, look-up-all_dependencies-from-the-container behavior. - /// - /// interface type - /// implementing type - /// Funq container - public static void EasyRegister(this Container container) where implT : interfaceT - { - var lambdaParam = Expression.Parameter(typeof(Container), "ref_to_the_container_passed_into_the_lambda"); + /// + /// Funq helper for easy registration. + /// + public static class FunqEasyRegistrationHelper + { + /// + /// Register a service with the default, look-up-all_dependencies-from-the-container behavior. + /// + /// interface type + /// implementing type + /// Funq container + public static void EasyRegister(this Container container) where implT : interfaceT + { + var lambdaParam = Expression.Parameter(typeof(Container), "ref_to_the_container_passed_into_the_lambda"); - var constructorExpression = BuildImplConstructorExpression(lambdaParam); - var compiledExpression = CompileInterfaceConstructor(lambdaParam, constructorExpression); + var constructorExpression = BuildImplConstructorExpression(lambdaParam); + var compiledExpression = CompileInterfaceConstructor(lambdaParam, constructorExpression); - container.Register(compiledExpression); - } + container.Register(compiledExpression); + } - private static readonly MethodInfo FunqContainerResolveMethod; + private static readonly MethodInfo FunqContainerResolveMethod; - static FunqEasyRegistrationHelper() - { - FunqContainerResolveMethod = typeof(Container).GetMethod("Resolve", new Type[0]); - } + static FunqEasyRegistrationHelper() + { + FunqContainerResolveMethod = typeof(Container).GetMethod("Resolve", new Type[0]); + } - private static NewExpression BuildImplConstructorExpression(Expression lambdaParam) - { - var ctorWithMostParameters = GetConstructorWithMostParameters(); + private static NewExpression BuildImplConstructorExpression(Expression lambdaParam) + { + var ctorWithMostParameters = GetConstructorWithMostParameters(); - var constructorParameterInfos = ctorWithMostParameters.GetParameters(); - var regParams = constructorParameterInfos.Select(pi => GetParameterCreationExpression(pi, lambdaParam)); + var constructorParameterInfos = ctorWithMostParameters.GetParameters(); + var regParams = constructorParameterInfos.Select(pi => GetParameterCreationExpression(pi, lambdaParam)); - return Expression.New(ctorWithMostParameters, regParams.ToArray()); - } + return Expression.New(ctorWithMostParameters, regParams.ToArray()); + } - private static Func CompileInterfaceConstructor(ParameterExpression lambdaParam, Expression constructorExpression) - { - var constructorLambda = Expression.Lambda>(constructorExpression, lambdaParam); - return constructorLambda.Compile(); - } + private static Func CompileInterfaceConstructor(ParameterExpression lambdaParam, Expression constructorExpression) + { + var constructorLambda = Expression.Lambda>(constructorExpression, lambdaParam); + return constructorLambda.Compile(); + } - private static ConstructorInfo GetConstructorWithMostParameters() - { - return typeof(implT) - .GetConstructors() - .OrderBy(x => x.GetParameters().Length) - .Where(ctor => !ctor.IsStatic) - .Last(); - } + private static ConstructorInfo GetConstructorWithMostParameters() + { + return typeof(implT) + .GetConstructors() + .OrderBy(x => x.GetParameters().Length) + .Where(ctor => !ctor.IsStatic) + .Last(); + } - private static MethodCallExpression GetParameterCreationExpression(ParameterInfo pi, Expression lambdaParam) - { - var method = FunqContainerResolveMethod.MakeGenericMethod(pi.ParameterType); - return Expression.Call(lambdaParam, method); - } + private static MethodCallExpression GetParameterCreationExpression(ParameterInfo pi, Expression lambdaParam) + { + var method = FunqContainerResolveMethod.MakeGenericMethod(pi.ParameterType); + return Expression.Call(lambdaParam, method); + } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Examples/funq_easy_registration.cs b/tests/ServiceStack.ServiceHost.Tests/Examples/funq_easy_registration.cs index 24a3b098c9e..c640081b2d2 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Examples/funq_easy_registration.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Examples/funq_easy_registration.cs @@ -4,74 +4,74 @@ namespace ServiceStack.ServiceHost.Tests.Examples { - /// - /// Other examples - ///https://source.db4o.com/db4o/trunk/db4o.net/Libs/compact-3.5/System.Linq.Expressions/Test/System.Linq.Expressions/ExpressionTest_MemberInit.cs - /// - [TestFixture] - public class FunqEasyRegistration - { - public interface IFoo { } + /// + /// Other examples + ///https://source.db4o.com/db4o/trunk/db4o.net/Libs/compact-3.5/System.Linq.Expressions/Test/System.Linq.Expressions/ExpressionTest_MemberInit.cs + /// + [TestFixture] + public class FunqEasyRegistration + { + public interface IFoo { } - public class Foo : IFoo { } + public class Foo : IFoo { } - public interface IBar { } + public interface IBar { } - public class Bar : IBar - { - public IFoo Foo { get; set; } + public class Bar : IBar + { + public IFoo Foo { get; set; } - public Bar(IFoo foo) - { - Foo = foo; - } - } + public Bar(IFoo foo) + { + Foo = foo; + } + } - public interface IBaz { } + public interface IBaz { } - public class Baz : IBaz - { - public IBar Bar { get; set; } + public class Baz : IBaz + { + public IBar Bar { get; set; } - public Baz(IBar bar) - { - Bar = bar; - } - } + public Baz(IBar bar) + { + Bar = bar; + } + } - [Test] - public void should_be_able_to_get_service_impl() - { - var c = new Container(); - c.EasyRegister(); + [Test] + public void should_be_able_to_get_service_impl() + { + var c = new Container(); + c.EasyRegister(); - Assert.IsInstanceOf(c.Resolve()); - } + Assert.IsInstanceOf(c.Resolve()); + } - [Test] - public void should_be_able_to_inject_dependency() - { - var c = new Container(); - c.EasyRegister(); - c.EasyRegister(); + [Test] + public void should_be_able_to_inject_dependency() + { + var c = new Container(); + c.EasyRegister(); + c.EasyRegister(); - var bar = c.Resolve() as Bar; + var bar = c.Resolve() as Bar; - Assert.IsNotNull(bar.Foo); - } + Assert.IsNotNull(bar.Foo); + } - [Test] - public void should_be_able_to_chain_dependencies() - { - var c = new Container(); - var testFoo = new Foo(); - c.Register(testFoo); - c.EasyRegister(); - c.EasyRegister(); - var baz = c.Resolve() as Baz; + [Test] + public void should_be_able_to_chain_dependencies() + { + var c = new Container(); + var testFoo = new Foo(); + c.Register(testFoo); + c.EasyRegister(); + c.EasyRegister(); + var baz = c.Resolve() as Baz; - var bar = baz.Bar as Bar; - Assert.AreSame(bar.Foo, testFoo); - } - } + var bar = baz.Bar as Bar; + Assert.AreSame(bar.Foo, testFoo); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionExampleTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionExampleTests.cs index f794b2b827f..22d106da1f2 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionExampleTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionExampleTests.cs @@ -6,72 +6,72 @@ namespace ServiceStack.ServiceHost.Tests.Formats { - public class Product - { - public Product(){} - public Product(string name, decimal price) - { - Name = name; - Price = price; - } - - public int ProductID { get; set; } - public string Name { get; set; } - public decimal Price { get; set; } - } - - [TestFixture] - public class IntroductionExampleTests : MarkdownTestBase - { - private List products; - Dictionary productArgs; - - [TestFixtureSetUp] - public void TestFixtureSetUp() - { - this.products = new List { - new Product("Pen", 1.99m), - new Product("Glass", 9.99m), - new Product("Book", 14.99m), - new Product("DVD", 11.99m), - }; - productArgs = new Dictionary { { "products", products } }; - } - - [Test] - public void Basic_Razor_Example() - { - var template = + public class Product + { + public Product() { } + public Product(string name, decimal price) + { + Name = name; + Price = price; + } + + public int ProductID { get; set; } + public string Name { get; set; } + public decimal Price { get; set; } + } + + [TestFixture] + public class IntroductionExampleTests : MarkdownTestBase + { + private List products; + Dictionary productArgs; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + this.products = new List { + new Product("Pen", 1.99m), + new Product("Glass", 9.99m), + new Product("Book", 14.99m), + new Product("DVD", 11.99m), + }; + productArgs = new Dictionary { { "products", products } }; + } + + [Test] + public void Basic_Razor_Example() + { + var template = @"# Razor Example ### Hello @name, the year is @DateTime.Now.Year Checkout [this product](/Product/Details/@productId)"; - var expectedHtml = + var expectedHtml = @"

      Razor Example

      -

      Hello Demis, the year is 2014

      +

      Hello Demis, the year is 2020

      Checkout this product

      ".NormalizeNewLines(); - var html = RenderToHtml(template, new Dictionary { - {"name", "Demis"}, {"productId", 10} }); + var html = RenderToHtml(template, new Dictionary { + {"name", "Demis"}, {"productId", 10} }); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void Simple_loop() - { - var template = @" + [Test] + public void Simple_loop() + { + var template = @" @foreach (var p in products) { - @p.Name: (@p.Price) } "; - var expectedHtml = + var expectedHtml = @"
      • Pen: (1.99)
      • Glass: (9.99)
      • @@ -80,23 +80,23 @@ public void Simple_loop()
      ".NormalizeNewLines(); - var html = RenderToHtml(template, productArgs); + var html = RenderToHtml(template, productArgs); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void Simple_loop_with_parens_free_syntax() - { - var template = @" + [Test] + public void Simple_loop_with_parens_free_syntax() + { + var template = @" @foreach p in products { - @p.Name: (@p.Price) } "; - var expectedHtml = + var expectedHtml = @"
      • Pen: (1.99)
      • Glass: (9.99)
      • @@ -105,17 +105,17 @@ @foreach p in products {
      ".NormalizeNewLines(); - var html = RenderToHtml(template, productArgs); + var html = RenderToHtml(template, productArgs); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void If_Statment() - { - var template = @" + [Test] + public void If_Statment() + { + var template = @" @if (products.Count == 0) { Sorry - no products in this category } else { @@ -123,20 +123,20 @@ public void If_Statment() } "; - var expectedHtml = + var expectedHtml = @"

      We have products for you!

      ".NormalizeNewLines(); - var html = RenderToHtml(template, productArgs); + var html = RenderToHtml(template, productArgs); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void If_Statment_with_parens_free_syntax() - { - var template = @" + [Test] + public void If_Statment_with_parens_free_syntax() + { + var template = @" @if products.Count == 0 { Sorry - no products in this category } else { @@ -144,100 +144,100 @@ public void If_Statment_with_parens_free_syntax() } "; - var expectedHtml = + var expectedHtml = @"

      We have products for you!

      ".NormalizeNewLines(); - var html = RenderToHtml(template, productArgs); + var html = RenderToHtml(template, productArgs); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void Multi_variable_declarations() - { - var template = @" + [Test] + public void Multi_variable_declarations() + { + var template = @" @var number = 1 @var message = ""Number is "" + number Your Message: @message "; - var expectedHtml = @"

      Your Message: Number is 1

      + var expectedHtml = @"

      Your Message: Number is 1

      ".NormalizeNewLines(); - var html = RenderToHtml(template, productArgs); + var html = RenderToHtml(template, productArgs); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void Integrating_content_and_code() - { - var template = + [Test] + public void Integrating_content_and_code() + { + var template = @"Send mail to demis.bellot@gmail.com telling him the time: @DateTime.Now. "; - var expectedHtml = + var expectedHtml = @"

      Send mail to demis.bellot@gmail.com telling him the time: 02/06/2011 06:38:34.

      ".NormalizeNewLines(); - var html = RenderToHtml(template, productArgs); + var html = RenderToHtml(template, productArgs); - Console.WriteLine(html); - Assert.That(html, Is.StringMatching(expectedHtml.Substring(0, expectedHtml.Length - 25))); - } + Console.WriteLine(html); + Assert.That(html, Does.Match(expectedHtml.Substring(0, expectedHtml.Length - 25))); + } - [Test] - public void Identifying_nested_content() - { - var template = + [Test] + public void Identifying_nested_content() + { + var template = @" -@if (DateTime.Now.Year == 2014) { +@if (DateTime.Now.Year == 2020) { -If the year is 2014 then print this +If the year is 2020 then print this multi-line text block and the date: @DateTime.Now } ".NormalizeNewLines(); - var expectedHtml = -@"

      If the year is 2014 then print this + var expectedHtml = +@"

      If the year is 2020 then print this multi-line text block and the date: 02/06/2014 06:42:45

      ".NormalizeNewLines(); - var html = RenderToHtml(template, productArgs); + var html = RenderToHtml(template, productArgs); html.Print(); - Assert.That(html.Substring(0,html.Length-27), + Assert.That(html.Substring(0, html.Length - 27), Is.EqualTo(expectedHtml.Substring(0, html.Length - 27))); - } + } - [Test] - public void HTML_encoding() - { - var template = + [Test] + public void HTML_encoding() + { + var template = @" Some Content @stringContainingHtml "; - var expectedHtml = + var expectedHtml = @"

      Some Content <span>html</span>

      ".NormalizeNewLines(); - var html = RenderToHtml(template, new Dictionary { - {"stringContainingHtml", "html"} - }); + var html = RenderToHtml(template, new Dictionary { + {"stringContainingHtml", "html"} + }); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionLayoutTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionLayoutTests.cs index 663b6af5092..97ed511cdc8 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionLayoutTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionLayoutTests.cs @@ -7,72 +7,73 @@ using ServiceStack.Markdown; using ServiceStack.Support.Markdown; using ServiceStack.Testing; -using ServiceStack.VirtualPath; +using ServiceStack.IO; namespace ServiceStack.ServiceHost.Tests.Formats { - public class ExternalProductHelper - { - //Any helpers returning MvcHtmlString won't be escaped - public MvcHtmlString ProductTable(List products) - { - var sb = new StringBuilder(); - sb.AppendFormat("
      \n"); - products.ForEach(x => - sb.AppendFormat("\n", - x.ProductID, x.Name, x.Price) - ); - sb.AppendFormat("
      IdNamePrice
      {0}{1}{2}
      \n"); - - return MvcHtmlString.Create(sb.ToString()); - } - } - - public class CustomBaseClass : MarkdownViewBase - { - public MvcHtmlString Field(string fieldName, string fieldValue) - { - var sb = new StringBuilder(); - sb.AppendFormat("\n", fieldName); - sb.AppendFormat("\n", fieldName, fieldValue); - - return MvcHtmlString.Create(sb.ToString()); - } - } - - [TestFixture] - public class IntroductionLayoutTests : MarkdownTestBase - { - private InMemoryVirtualPathProvider pathProvider; - private MarkdownFormat markdownFormat; - - private ServiceStackHost appHost; - - [TestFixtureSetUp] + public class ExternalProductHelper + { + //Any helpers returning MvcHtmlString won't be escaped + public MvcHtmlString ProductTable(List products) + { + var sb = new StringBuilder(); + sb.AppendFormat("\n"); + products.ForEach(x => + sb.AppendFormat("\n", + x.ProductID, x.Name, x.Price) + ); + sb.AppendFormat("
      IdNamePrice
      {0}{1}{2}
      \n"); + + return MvcHtmlString.Create(sb.ToString()); + } + } + + public class CustomBaseClass : MarkdownViewBase + { + public MvcHtmlString Field(string fieldName, string fieldValue) + { + var sb = new StringBuilder(); + sb.AppendFormat("\n", fieldName); + sb.AppendFormat("\n", fieldName, fieldValue); + + return MvcHtmlString.Create(sb.ToString()); + } + } + + [TestFixture] + public class IntroductionLayoutTests : MarkdownTestBase + { + private MemoryVirtualFiles pathProvider; + private MarkdownFormat markdownFormat; + + private ServiceStackHost appHost; + + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); } - - [SetUp] - public void SetUp() - { - ServiceStackHost.Instance.VirtualPathProvider = pathProvider = new InMemoryVirtualPathProvider(new BasicAppHost()); - markdownFormat = new MarkdownFormat { + + [SetUp] + public void SetUp() + { + ServiceStackHost.Instance.VirtualFileSources = pathProvider = new MemoryVirtualFiles(); + markdownFormat = new MarkdownFormat + { VirtualPathProvider = pathProvider, }; } - [Test] - public void Simple_Layout_Example() - { - var websiteTemplate = + [Test] + public void Simple_Layout_Example() + { + var websiteTemplate = @" @@ -91,7 +92,7 @@ public void Simple_Layout_Example() ".NormalizeNewLines(); - var pageTemplate = + var pageTemplate = @"@Layout websiteTemplate # About this Site @@ -105,7 +106,7 @@ And obviously I can have code in here too. Here is the current date/year: @DateTime.Now.Year ".NormalizeNewLines(); - var expectedHtml = @" + var expectedHtml = @" Simple Site @@ -124,30 +125,30 @@ page of our web-site. We'll use this in conjunction with a layout template. The content you are seeing here comes from ^^^websiteTemplate.

      And obviously I can have code in here too. Here is the -current date/year: 2014

      +current date/year: 2020

      ".NormalizeNewLines(); - - markdownFormat.AddFileAndPage( - new MarkdownPage(markdownFormat, @"C:\path\to\page-tpl", PageName, pageTemplate)); - markdownFormat.AddFileAndTemplate(@"websiteTemplate", websiteTemplate); + markdownFormat.AddFileAndPage( + new MarkdownPage(markdownFormat, @"C:\path\to\page-tpl", PageName, pageTemplate)); - var html = markdownFormat.RenderDynamicPageHtml(PageName); + markdownFormat.AddFileAndTemplate(@"websiteTemplate", websiteTemplate); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + var html = markdownFormat.RenderDynamicPageHtml(PageName); + + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void Layout_MasterPage_Scenarios_Adding_Sections() - { - var websiteTemplate = + [Test] + public void Layout_MasterPage_Scenarios_Adding_Sections() + { + var websiteTemplate = @" @@ -175,7 +176,7 @@ public void Layout_MasterPage_Scenarios_Adding_Sections() ".NormalizeNewLines(); - var pageTemplate = + var pageTemplate = @"@Layout websiteTemplate # About this Site @@ -198,7 +199,7 @@ @section Footer { } ".NormalizeNewLines(); - var expectedHtml = @" + var expectedHtml = @" Simple Site @@ -225,7 +226,7 @@ page of our web-site. We'll use this in conjunction with a layout template. The content you are seeing here comes from ^^^websiteTemplate.

      And obviously I can have code in here too. Here is the -current date/year: 2014

      +current date/year: 2020

      @@ -238,21 +239,21 @@ comes from ^^^websiteTemplate.

      ".NormalizeNewLines(); - markdownFormat.AddPage( - new MarkdownPage(markdownFormat, @"C:\path\to\page-tpl", PageName, pageTemplate)); + markdownFormat.AddPage( + new MarkdownPage(markdownFormat, @"C:\path\to\page-tpl", PageName, pageTemplate)); - markdownFormat.AddFileAndTemplate(@"websiteTemplate", websiteTemplate); + markdownFormat.AddFileAndTemplate(@"websiteTemplate", websiteTemplate); - var html = markdownFormat.RenderDynamicPageHtml(PageName); + var html = markdownFormat.RenderDynamicPageHtml(PageName); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void Encapsulation_and_reuse_with_HTML_helpers() - { - var pageTemplate = + [Test] + public void Encapsulation_and_reuse_with_HTML_helpers() + { + var pageTemplate = @"@model ServiceStack.ServiceHost.Tests.Formats.Product
      Edit Product @@ -264,7 +265,7 @@ public void Encapsulation_and_reuse_with_HTML_helpers()
      ".NormalizeNewLines(); - var expectedHtml = + var expectedHtml = @"
      Edit Product
      @@ -273,17 +274,17 @@ public void Encapsulation_and_reuse_with_HTML_helpers()
      ".NormalizeNewLines(); - var product = new Product {ProductID = 10}; - var html = RenderToHtml(pageTemplate, product); + var product = new Product { ProductID = 10 }; + var html = RenderToHtml(pageTemplate, product); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void Using_External_HTML_Helpers() - { - var pageTemplate = + [Test] + public void Using_External_HTML_Helpers() + { + var pageTemplate = @"@model System.Collections.Generic.List @helper Prod: ServiceStack.ServiceHost.Tests.Formats.ExternalProductHelper @@ -292,7 +293,7 @@ public void Using_External_HTML_Helpers() @Prod.ProductTable(Model) ".NormalizeNewLines(); - var expectedHtml = + var expectedHtml = @"
      All Products @@ -303,23 +304,23 @@ public void Using_External_HTML_Helpers()
      IdNamePrice
      ".NormalizeNewLines(); - var products = new List { - new Product("Pen", 1.99m), - new Product("Glass", 9.99m), - new Product("Book", 14.99m), - new Product("DVD", 11.99m), - }; - var html = RenderToHtml(pageTemplate, products); + var products = new List { + new Product("Pen", 1.99m), + new Product("Glass", 9.99m), + new Product("Book", 14.99m), + new Product("DVD", 11.99m), + }; + var html = RenderToHtml(pageTemplate, products); - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void Using_Custom_base_class() - { - var pageTemplate = + [Test] + public void Using_Custom_base_class() + { + var pageTemplate = @"@inherits ServiceStack.ServiceHost.Tests.Formats.CustomBaseClass
      @@ -327,18 +328,18 @@ public void Using_Custom_base_class() @Field(""Name"", Model.Name)
      ".NormalizeNewLines(); - var expectedHtml = + var expectedHtml = @"
      All Products
      ".NormalizeNewLines(); - var html = RenderToHtml(pageTemplate, new Product("Pen", 1.99m)); + var html = RenderToHtml(pageTemplate, new Product("Pen", 1.99m)); + + Console.WriteLine(html); + Assert.That(html, Is.EqualTo(expectedHtml)); + } - Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } - - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatExtensions.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatExtensions.cs index f16b9a63001..34e533d8080 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatExtensions.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatExtensions.cs @@ -1,6 +1,6 @@ using ServiceStack.Formats; +using ServiceStack.IO; using ServiceStack.Support.Markdown; -using ServiceStack.VirtualPath; namespace ServiceStack.ServiceHost.Tests.Formats { @@ -8,15 +8,15 @@ public static class MarkdownFormatExtensions { public static void AddFileAndPage(this MarkdownFormat markdown, MarkdownPage markdownPage) { - var pathProvider = (InMemoryVirtualPathProvider)markdown.VirtualPathProvider; - pathProvider.AddFile(markdownPage.FilePath, markdownPage.Contents); + var pathProvider = (MemoryVirtualFiles)markdown.VirtualPathProvider; + pathProvider.WriteFile(markdownPage.FilePath, markdownPage.Contents); markdown.AddPage(markdownPage); } public static void AddFileAndTemplate(this MarkdownFormat markdown, string filePath, string contents) { - var pathProvider = (InMemoryVirtualPathProvider)markdown.VirtualPathProvider; - pathProvider.AddFile(filePath, contents); + var pathProvider = (MemoryVirtualFiles)markdown.VirtualPathProvider; + pathProvider.WriteFile(filePath, contents); markdown.AddTemplate(filePath, contents); } } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatTests.cs index c5179c04a26..5356d1cbcc2 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatTests.cs @@ -3,111 +3,112 @@ using System.IO; using NUnit.Framework; using ServiceStack.Formats; +using ServiceStack.IO; using ServiceStack.Testing; using ServiceStack.Text; -using ServiceStack.VirtualPath; namespace ServiceStack.ServiceHost.Tests.Formats { - [TestFixture] - public class MarkdownFormatTests - { - public class Person - { - public string FirstName { get; set; } - public string LastName { get; set; } - } - - private MarkdownFormat markdownFormat; - - string dynamicPagePath; - string dynamicPageContent; - - readonly string[] viewPageNames = new[] { - "Dynamic", "Customer", "CustomerDetailsResponse", "DynamicListTpl", - "DynamicNestedTpl", "DynamicTpl", - }; - readonly string[] sharedViewPageNames = new[] { - "DynamicShared", "DynamicTplShared", - }; - readonly string[] contentPageNames = new[] { - "Static", "StaticTpl", - }; - - - [TestFixtureSetUp] - public void TestFixtureSetUp() - { - dynamicPagePath = "~/Views/Template/DynamicTpl.md".MapProjectPath(); - dynamicPageContent = File.ReadAllText(dynamicPagePath); - } - - [SetUp] - public void OnBeforeEachTest() - { - markdownFormat = new MarkdownFormat { - VirtualPathProvider = new FileSystemVirtualPathProvider(new BasicAppHost(), "~/".MapProjectPath()), + [TestFixture] + public class MarkdownFormatTests + { + public class Person + { + public string FirstName { get; set; } + public string LastName { get; set; } + } + + private MarkdownFormat markdownFormat; + + string dynamicPagePath; + string dynamicPageContent; + + readonly string[] viewPageNames = new[] { + "Dynamic", "Customer", "CustomerDetailsResponse", "DynamicListTpl", + "DynamicNestedTpl", "DynamicTpl", }; - } + readonly string[] sharedViewPageNames = new[] { + "DynamicShared", "DynamicTplShared", + }; + readonly string[] contentPageNames = new[] { + "Static", "StaticTpl", + }; + + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + dynamicPagePath = "~/Views/Template/DynamicTpl.md".MapProjectPath(); + dynamicPageContent = File.ReadAllText(dynamicPagePath); + } + + [SetUp] + public void OnBeforeEachTest() + { + markdownFormat = new MarkdownFormat + { + VirtualPathProvider = new FileSystemVirtualFiles("~/".MapProjectPath()), + }; + } - [Test] - public void Can_load_all_markdown_files() - { - markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); + [Test] + public void Can_load_all_markdown_files() + { + markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); - Assert.That(markdownFormat.ViewPages.Count, Is.EqualTo(viewPageNames.Length)); - Assert.That(markdownFormat.ViewSharedPages.Count, Is.EqualTo(sharedViewPageNames.Length)); - Assert.That(markdownFormat.ContentPages.Count, Is.EqualTo(contentPageNames.Length)); - Assert.That(markdownFormat.MasterPageTemplates.Count, Is.EqualTo(4)); + Assert.That(markdownFormat.ViewPages.Count, Is.EqualTo(viewPageNames.Length)); + Assert.That(markdownFormat.ViewSharedPages.Count, Is.EqualTo(sharedViewPageNames.Length)); + Assert.That(markdownFormat.ContentPages.Count, Is.EqualTo(contentPageNames.Length)); + Assert.That(markdownFormat.MasterPageTemplates.Count, Is.EqualTo(4)); - var pageNames = new List(); - markdownFormat.ViewPages.ForEach((k, v) => pageNames.Add(k)); + var pageNames = new List(); + markdownFormat.ViewPages.ForEach((k, v) => pageNames.Add(k)); - Console.WriteLine(pageNames.Dump()); - Assert.That(pageNames.EquivalentTo(viewPageNames)); - } + Console.WriteLine(pageNames.Dump()); + Assert.That(pageNames.EquivalentTo(viewPageNames)); + } - [Test] - public void Can_Render_StaticPage() - { - markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); - var html = markdownFormat.RenderStaticPageHtml("AppData/NoTemplate/Static"); + [Test] + public void Can_Render_StaticPage() + { + markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); + var html = markdownFormat.RenderStaticPageHtml("AppData/NoTemplate/Static"); - Assert.That(html, Is.Not.Null); - Assert.That(html, Is.StringStarting("

      Static Markdown template

      ")); - } + Assert.That(html, Is.Not.Null); + Assert.That(html, Does.StartWith("

      Static Markdown template

      ")); + } - [Test] - public void Can_Render_StaticPage_WithTemplate() - { - markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); - var html = markdownFormat.RenderStaticPageHtml("AppData/Template/StaticTpl"); + [Test] + public void Can_Render_StaticPage_WithTemplate() + { + markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); + var html = markdownFormat.RenderStaticPageHtml("AppData/Template/StaticTpl"); html.Print(); - Assert.That(html, Is.Not.Null); - Assert.That(html, Is.StringStarting("")); - } + Assert.That(html, Is.Not.Null); + Assert.That(html, Does.StartWith("")); + } - [Test] - public void Can_Render_DynamicPage() - { - var person = new Person { FirstName = "Demis", LastName = "Bellot" }; - markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); + [Test] + public void Can_Render_DynamicPage() + { + var person = new Person { FirstName = "Demis", LastName = "Bellot" }; + markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); - var html = markdownFormat.RenderDynamicPageHtml("Dynamic", person); + var html = markdownFormat.RenderDynamicPageHtml("Dynamic", person); var tplPath = "~/Views/Shared/_Layout.shtml".MapProjectPath(); var tplContent = File.ReadAllText(tplPath); - var expectedHtml = markdownFormat.Transform(dynamicPageContent) - .Replace("@Model.FirstName", person.FirstName) - .Replace("@Model.LastName", person.LastName); + var expectedHtml = markdownFormat.Transform(dynamicPageContent) + .Replace("@Model.FirstName", person.FirstName) + .Replace("@Model.LastName", person.LastName); expectedHtml = tplContent.Replace("", expectedHtml); "Template: {0}".Fmt(html).Print(); - Assert.That(html, Is.EqualTo(expectedHtml)); - } - } + Assert.That(html, Is.EqualTo(expectedHtml)); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownTestBase.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownTestBase.cs index 01fca24c651..2da9dcc4fda 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownTestBase.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownTestBase.cs @@ -2,70 +2,72 @@ using System.Linq; using System.Text; using ServiceStack.Formats; +using ServiceStack.IO; using ServiceStack.Support.Markdown; using ServiceStack.Testing; -using ServiceStack.VirtualPath; namespace ServiceStack.ServiceHost.Tests.Formats { - public class MarkdownTestBase - { - public const string TemplateName = "Template"; - protected const string PageName = "Page"; + public class MarkdownTestBase + { + public const string TemplateName = "Template"; + protected const string PageName = "Page"; - public MarkdownFormat Create(string websiteTemplate, string pageTemplate) - { - var markdownFormat = new MarkdownFormat { - VirtualPathProvider = new InMemoryVirtualPathProvider(new BasicAppHost()) + public MarkdownFormat Create(string websiteTemplate, string pageTemplate) + { + var markdownFormat = new MarkdownFormat + { + VirtualPathProvider = new MemoryVirtualFiles() }; markdownFormat.AddFileAndTemplate("websiteTemplate", websiteTemplate); - markdownFormat.AddPage( - new MarkdownPage(markdownFormat, "/path/to/tpl", PageName, pageTemplate) { + markdownFormat.AddPage( + new MarkdownPage(markdownFormat, "/path/to/tpl", PageName, pageTemplate) + { Template = "websiteTemplate", - }); + }); - return markdownFormat; - } + return markdownFormat; + } - public MarkdownFormat Create(string pageTemplate) - { - var markdownFormat = new MarkdownFormat(); - markdownFormat.AddPage( - new MarkdownPage(markdownFormat, "/path/to/tpl", PageName, pageTemplate)); + public MarkdownFormat Create(string pageTemplate) + { + var markdownFormat = new MarkdownFormat(); + markdownFormat.AddPage( + new MarkdownPage(markdownFormat, "/path/to/tpl", PageName, pageTemplate)); - return markdownFormat; - } + return markdownFormat; + } - public string RenderToHtml(string pageTemplate, Dictionary scopeArgs) - { - var markdown = Create(pageTemplate); - var html = markdown.RenderDynamicPageHtml(PageName, scopeArgs); - return html; - } + public string RenderToHtml(string pageTemplate, Dictionary scopeArgs) + { + var markdown = Create(pageTemplate); + var html = markdown.RenderDynamicPageHtml(PageName, scopeArgs); + return html; + } - public string RenderToHtml(string pageTemplate, Dictionary scopeArgs, string websiteTemplate) - { - var markdown = Create(pageTemplate); - var html = markdown.RenderDynamicPageHtml(PageName, scopeArgs); - return html; - } + public string RenderToHtml(string pageTemplate, Dictionary scopeArgs, string websiteTemplate) + { + var markdown = Create(pageTemplate); + var html = markdown.RenderDynamicPageHtml(PageName, scopeArgs); + return html; + } - public string RenderToHtml(string pageTemplate, object model) - { - var markdown = Create(pageTemplate); - var html = markdown.RenderDynamicPageHtml(PageName, model); - return html; - } - } + public string RenderToHtml(string pageTemplate, object model) + { + var markdown = Create(pageTemplate); + var html = markdown.RenderDynamicPageHtml(PageName, model); + return html; + } + } - public static class MarkdownTestExtensions - { + public static class MarkdownTestExtensions + { public static string NormalizeNewLines(this string text) { return text.Replace("\r\n", "\n"); } - + public static string StripLinesAndWhitespace(this string text) { var sb = new StringBuilder(); diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/MockClass.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/MockClass.cs index 2b39962667a..95a7344fc01 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/MockClass.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/MockClass.cs @@ -7,48 +7,48 @@ namespace CSharpEval { [TestFixture] - public class _Expr - : ServiceStack.ServiceHost.Tests.Formats.TemplateTests.CustomMarkdownViewBase - { - public MvcHtmlString EvalExpr_0() - { - return null; - } + public class _Expr + : ServiceStack.ServiceHost.Tests.Formats.TemplateTests.CustomMarkdownViewBase + { + public MvcHtmlString EvalExpr_0() + { + return null; + } - //[Test] - public void Compare_access() - { - var filePath = "~/AppData/TestsResults/Customer.htm".MapProjectPath(); - const int Times = 10000; + //[Test] + public void Compare_access() + { + var filePath = "~/AppData/TestsResults/Customer.htm".MapProjectPath(); + const int Times = 10000; - var start = DateTime.Now; - var count = 0; - for (var i=0; i< Times; i++) - { - var result = File.ReadAllText(filePath); - if (result != null) count++; - } - var timeTaken = DateTime.Now - start; - Console.WriteLine("File.ReadAllText: Times {0}: {1}ms", Times, timeTaken.TotalMilliseconds); + var start = DateTime.Now; + var count = 0; + for (var i = 0; i < Times; i++) + { + var result = File.ReadAllText(filePath); + if (result != null) count++; + } + var timeTaken = DateTime.Now - start; + Console.WriteLine("File.ReadAllText: Times {0}: {1}ms", Times, timeTaken.TotalMilliseconds); - start = DateTime.Now; - count = 0; - //var fi = new FileInfo(filePath); - for (var i=0; i < Times; i++) - { - var result = File.GetLastWriteTime(filePath); - if (result != default(DateTime)) count++; - } - timeTaken = DateTime.Now - start; - Console.WriteLine("FileInfo.LastWriteTime: Times {0}: {1}ms", Times, timeTaken.TotalMilliseconds); - } + start = DateTime.Now; + count = 0; + //var fi = new FileInfo(filePath); + for (var i = 0; i < Times; i++) + { + var result = File.GetLastWriteTime(filePath); + if (result != default(DateTime)) count++; + } + timeTaken = DateTime.Now - start; + Console.WriteLine("FileInfo.LastWriteTime: Times {0}: {1}ms", Times, timeTaken.TotalMilliseconds); + } - [Test] - public void A() - { - var str = "https://github.com/ServiceStack/ServiceStack.Redis/wiki/RedisPubSub"; - var pos = str.IndexOf("/wiki"); - Console.WriteLine(str.Substring(pos)); - } - } + [Test] + public void A() + { + var str = "https://github.com/ServiceStack/ServiceStack.Redis/wiki/RedisPubSub"; + var pos = str.IndexOf("/wiki"); + Console.WriteLine(str.Substring(pos)); + } + } } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/TemplateExtentionTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/TemplateExtentionTests.cs index 149bae6b180..c4b0ea7cdbe 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/TemplateExtentionTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/TemplateExtentionTests.cs @@ -3,16 +3,16 @@ namespace ServiceStack.ServiceHost.Tests.Formats { - [TestFixture] - public class TemplateExtentionTests - { - [Test] - public void Does_all_remove_WhiteSpace() - { - var test = "this[ is ]\ta\ntest"; - var result = test.RemoveAllWhiteSpace(); + [TestFixture] + public class TemplateExtentionTests + { + [Test] + public void Does_all_remove_WhiteSpace() + { + var test = "this[ is ]\ta\ntest"; + var result = test.RemoveAllWhiteSpace(); - Assert.That(result, Is.EqualTo("this[is]atest")); - } - } + Assert.That(result, Is.EqualTo("this[is]atest")); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/TemplateTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/TemplateTests.cs index 0e7e4b5d704..da63ba76837 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/TemplateTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/TemplateTests.cs @@ -9,7 +9,7 @@ using ServiceStack.Support.Markdown; using ServiceStack.Testing; using ServiceStack.Text; -using ServiceStack.VirtualPath; +using ServiceStack.IO; namespace ServiceStack.ServiceHost.Tests.Formats { @@ -26,7 +26,7 @@ public class TemplateTests private MarkdownFormat markdownFormat; Dictionary templateArgs; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { staticTemplatePath = "~/Views/Shared/_Layout.shtml".MapProjectPath(); @@ -42,8 +42,9 @@ public void TestFixtureSetUp() [SetUp] public void OnBeforeEachTest() { - markdownFormat = new MarkdownFormat { - VirtualPathProvider = new InMemoryVirtualPathProvider(new BasicAppHost()) + markdownFormat = new MarkdownFormat + { + VirtualPathProvider = new MemoryVirtualFiles() }; templateArgs = new Dictionary { { MarkdownPage.ModelName, person } }; } @@ -85,14 +86,15 @@ public Link() public List Labels { get; set; } } - Person person = new Person { + Person person = new Person + { FirstName = "Demis", LastName = "Bellot", Links = new List - { - new Link { Name = "ServiceStack", Href = "http://www.servicestack.net", Labels = {"REST","JSON","XML"} }, - new Link { Name = "AjaxStack", Href = "http://www.ajaxstack.com", Labels = {"HTML5", "AJAX", "SPA"} }, - }, + { + new Link { Name = "ServiceStack", Href = "http://www.servicestack.net", Labels = {"REST","JSON","XML"} }, + new Link { Name = "AjaxStack", Href = "http://www.ajaxstack.com", Labels = {"HTML5", "AJAX", "SPA"} }, + }, }; @@ -353,10 +355,10 @@ Hello @Upper(Model.LastName), @Model.FirstName markdownFormat.MarkdownBaseType = typeof(CustomMarkdownViewBase); - markdownFormat.MarkdownGlobalHelpers = new Dictionary - { - {"Ext", typeof(CustomMarkdownHelper)} - }; + markdownFormat.MarkdownGlobalHelpers = new Dictionary + { + {"Ext", typeof(CustomMarkdownHelper)} + }; markdownFormat.RegisterMarkdownPage(new MarkdownPage(markdownFormat, "/path/to/page", "HeaderLinks", headerTemplate)); @@ -858,7 +860,8 @@ @section Menus { markdownFormat.AddFileAndTemplate("websiteTemplate", websiteTemplate); markdownFormat.AddPage( - new MarkdownPage(markdownFormat, "/path/to/page-tpl", "DynamicModelTpl", template) { + new MarkdownPage(markdownFormat, "/path/to/page-tpl", "DynamicModelTpl", template) + { Template = "websiteTemplate" }); @@ -941,7 +944,8 @@ @section Header { markdownFormat.AddFileAndTemplate("websiteTemplate", websiteTemplate); markdownFormat.RegisterMarkdownPage( - new MarkdownPage(markdownFormat, "pagetpl", "StaticTpl", template, MarkdownPageType.ContentPage) { + new MarkdownPage(markdownFormat, "pagetpl", "StaticTpl", template, MarkdownPageType.ContentPage) + { Template = "websiteTemplate" }); diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockTests.cs index 79e2c813f68..1f222aa59fb 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockTests.cs @@ -8,36 +8,36 @@ namespace ServiceStack.ServiceHost.Tests.Formats { - [TestFixture] - public class TextBlockTests - { - string dynamicListPagePath; - string dynamicListPageContent; - - [TestFixtureSetUp] - public void TestFixtureSetUp() - { - dynamicListPagePath = "~/Views/Template/DynamicListTpl.md".MapProjectPath(); - dynamicListPageContent = File.ReadAllText(dynamicListPagePath); - } + [TestFixture] + public class TextBlockTests + { + string dynamicListPagePath; + string dynamicListPageContent; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + dynamicListPagePath = "~/Views/Template/DynamicListTpl.md".MapProjectPath(); + dynamicListPageContent = File.ReadAllText(dynamicListPagePath); + } - [Test] - public void Does_replace_foreach_statements_with_expr_placeholders() - { - var content = (string)dynamicListPageContent.Clone(); + [Test] + public void Does_replace_foreach_statements_with_expr_placeholders() + { + var content = (string)dynamicListPageContent.Clone(); - var expected = content.ReplaceForeach("@^1"); ; + var expected = content.ReplaceForeach("@^1"); ; - var statements = new List(); - var parsedContent = StatementExprBlock.Extract(content, statements); + var statements = new List(); + var parsedContent = StatementExprBlock.Extract(content, statements); - Console.WriteLine(parsedContent); + Console.WriteLine(parsedContent); - Assert.That(parsedContent, Is.EqualTo(expected)); - Assert.That(statements.Count, Is.EqualTo(1)); - Assert.That(statements[0].Condition, Is.EqualTo("var link in Model.Links")); - Assert.That(statements[0].Statement, Is.EqualTo(" - @link.Name - @link.Href\r\n")); - } + Assert.That(parsedContent, Is.EqualTo(expected)); + Assert.That(statements.Count, Is.EqualTo(1)); + Assert.That(statements[0].Condition, Is.EqualTo("var link in Model.Links")); + Assert.That(statements[0].Statement, Is.EqualTo(" - @link.Name - @link.Href\r\n")); + } [Test] public void Does_handle_foreach_when_enumerable_is_empty_first_time() @@ -50,17 +50,17 @@ public void Does_handle_foreach_when_enumerable_is_empty_first_time() markdownPage.RenderToHtml(scopeArgs); // First time the list is empty var expected = "A new list item"; - model.Links.Add(new Link { Name = expected } ); + model.Links.Add(new Link { Name = expected }); var html = markdownPage.RenderToHtml(scopeArgs); // Second time the list has 1 item Console.WriteLine(html); Assert.That(html, Contains.Substring(expected)); } - [Test] - public void Does_replace_multiple_statements_with_expr_placeholders() - { - string template = @" + [Test] + public void Does_replace_multiple_statements_with_expr_placeholders() + { + string template = @" ## Statement 1 @if (Model.IsValid) { @@ -84,7 +84,7 @@ public void Does_replace_multiple_statements_with_expr_placeholders() # EOF".NormalizeNewLines(); - string expected = @" + string expected = @" ## Statement 1 @^1 @@ -98,27 +98,27 @@ public void Does_replace_multiple_statements_with_expr_placeholders() @^4 # EOF".NormalizeNewLines(); - var statements = new List(); - var content = StatementExprBlock.Extract(template, statements); - - Console.WriteLine(content); - - Assert.That(content, Is.EqualTo(expected)); - Assert.That(statements.Count, Is.EqualTo(4)); - Assert.That(statements[0].Condition, Is.EqualTo("Model.IsValid")); - Assert.That(statements[0].Statement, Is.EqualTo("### This is valid\n")); - Assert.That(statements[1].Condition, Is.EqualTo("var link in Model.Links")); - Assert.That(statements[1].Statement, Is.EqualTo(" - @link.Name - @link.Href\n")); - Assert.That(statements[2].Condition, Is.EqualTo("var text in Model.Texts")); - Assert.That(statements[2].Statement, Is.EqualTo("### @text.Name\n@text.body\n")); - Assert.That(statements[3].Condition, Is.EqualTo("!Model.IsValid")); - Assert.That(statements[3].Statement, Is.EqualTo("### This is not valid\n")); - } - - [Test] - public void Does_parse_parens_free_statements() - { - string template = @" + var statements = new List(); + var content = StatementExprBlock.Extract(template, statements); + + Console.WriteLine(content); + + Assert.That(content, Is.EqualTo(expected)); + Assert.That(statements.Count, Is.EqualTo(4)); + Assert.That(statements[0].Condition, Is.EqualTo("Model.IsValid")); + Assert.That(statements[0].Statement, Is.EqualTo("### This is valid\n")); + Assert.That(statements[1].Condition, Is.EqualTo("var link in Model.Links")); + Assert.That(statements[1].Statement, Is.EqualTo(" - @link.Name - @link.Href\n")); + Assert.That(statements[2].Condition, Is.EqualTo("var text in Model.Texts")); + Assert.That(statements[2].Statement, Is.EqualTo("### @text.Name\n@text.body\n")); + Assert.That(statements[3].Condition, Is.EqualTo("!Model.IsValid")); + Assert.That(statements[3].Statement, Is.EqualTo("### This is not valid\n")); + } + + [Test] + public void Does_parse_parens_free_statements() + { + string template = @" ## Statement 1 @if Model.IsValid { @@ -141,7 +141,7 @@ @foreach text in Model.Texts { } # EOF".NormalizeNewLines(); - + string expected = @" ## Statement 1 @@ -157,40 +157,40 @@ @foreach text in Model.Texts { # EOF".NormalizeNewLines(); - var statements = new List(); - var content = StatementExprBlock.Extract(template, statements); + var statements = new List(); + var content = StatementExprBlock.Extract(template, statements); - Console.WriteLine(content); + Console.WriteLine(content); - Assert.That(content, Is.EqualTo(expected)); - Assert.That(statements.Count, Is.EqualTo(4)); + Assert.That(content, Is.EqualTo(expected)); + Assert.That(statements.Count, Is.EqualTo(4)); - var stat1 = (IfStatementExprBlock)statements[0]; - Assert.That(stat1.Condition, Is.EqualTo("Model.IsValid")); - Assert.That(stat1.Statement, Is.EqualTo("### This is valid\n")); + var stat1 = (IfStatementExprBlock)statements[0]; + Assert.That(stat1.Condition, Is.EqualTo("Model.IsValid")); + Assert.That(stat1.Statement, Is.EqualTo("### This is valid\n")); - var stat2 = (ForEachStatementExprBlock)statements[1]; - Assert.That(stat2.Condition, Is.EqualTo("var link in Model.Links")); - Assert.That(stat2.Statement, Is.EqualTo(" - @link.Name - @link.Href\n")); - Assert.That(stat2.EnumeratorName, Is.EqualTo("link")); - Assert.That(stat2.MemberExpr, Is.EqualTo("Model.Links")); + var stat2 = (ForEachStatementExprBlock)statements[1]; + Assert.That(stat2.Condition, Is.EqualTo("var link in Model.Links")); + Assert.That(stat2.Statement, Is.EqualTo(" - @link.Name - @link.Href\n")); + Assert.That(stat2.EnumeratorName, Is.EqualTo("link")); + Assert.That(stat2.MemberExpr, Is.EqualTo("Model.Links")); - var stat3 = (ForEachStatementExprBlock)statements[2]; - Assert.That(stat3.Condition, Is.EqualTo("text in Model.Texts")); - Assert.That(stat3.Statement, Is.EqualTo("### @text.Name\n@text.body\n")); - Assert.That(stat3.EnumeratorName, Is.EqualTo("text")); - Assert.That(stat3.MemberExpr, Is.EqualTo("Model.Texts")); + var stat3 = (ForEachStatementExprBlock)statements[2]; + Assert.That(stat3.Condition, Is.EqualTo("text in Model.Texts")); + Assert.That(stat3.Statement, Is.EqualTo("### @text.Name\n@text.body\n")); + Assert.That(stat3.EnumeratorName, Is.EqualTo("text")); + Assert.That(stat3.MemberExpr, Is.EqualTo("Model.Texts")); - var stat4 = (IfStatementExprBlock)statements[3]; - Assert.That(stat4.Condition, Is.EqualTo("!Model.IsValid")); - Assert.That(stat4.Statement, Is.EqualTo("### This is not valid\n")); - } + var stat4 = (IfStatementExprBlock)statements[3]; + Assert.That(stat4.Condition, Is.EqualTo("!Model.IsValid")); + Assert.That(stat4.Statement, Is.EqualTo("### This is not valid\n")); + } - [Test] - public void Does_transform_escaped_html_start_tags() - { - var markdownText = - @"#### Showing Results 1 - 5 + [Test] + public void Does_transform_escaped_html_start_tags() + { + var markdownText = + @"#### Showing Results 1 - 5 ^
      @@ -200,25 +200,25 @@ public void Does_transform_escaped_html_start_tags() Text".NormalizeNewLines(); - var expectedHtml = - @"

      Showing Results 1 - 5

      + var expectedHtml = + @"

      Showing Results 1 - 5

      Markdown > About Docs

      Text

      ".NormalizeNewLines(); - var textBlock = new TextBlock(""); - var page = new MarkdownPage { Markdown = new MarkdownFormat() }; - textBlock.DoFirstRun(new PageContext(page, null, true)); + var textBlock = new TextBlock(""); + var page = new MarkdownPage { Markdown = new MarkdownFormat() }; + textBlock.DoFirstRun(new PageContext(page, null, true)); - var html = textBlock.TransformHtml(markdownText); + var html = textBlock.TransformHtml(markdownText); - Console.WriteLine(html); + Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Assert.That(html, Is.EqualTo(expectedHtml)); + } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockUtils.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockUtils.cs index ab62d15e29a..21e8d4c3ee2 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockUtils.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockUtils.cs @@ -1,17 +1,17 @@ namespace ServiceStack.ServiceHost.Tests.Formats { - public static class TextBlockUtils - { - public static string ReplaceForeach(this string tempalte, string replaceWith) - { - var startPos = tempalte.IndexOf("@foreach"); - var endPos = tempalte.IndexOf("}", startPos); + public static class TextBlockUtils + { + public static string ReplaceForeach(this string tempalte, string replaceWith) + { + var startPos = tempalte.IndexOf("@foreach"); + var endPos = tempalte.IndexOf("}", startPos); - var expected = tempalte.Substring(0, startPos) - + replaceWith - + tempalte.Substring(endPos + 1); + var expected = tempalte.Substring(0, startPos) + + replaceWith + + tempalte.Substring(endPos + 1); - return expected; - } - } + return expected; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/UseCaseTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/UseCaseTests.cs index ff2300f2852..73bb45b5ace 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/UseCaseTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/UseCaseTests.cs @@ -7,51 +7,51 @@ namespace ServiceStack.ServiceHost.Tests.Formats { - public class Page - { - public Page() - { - this.Tags = new List(); - } - - public string Name { get; set; } - public string Slug { get; set; } - public string Src { get; set; } - public string FilePath { get; set; } - public string Category { get; set; } - public string Content { get; set; } - public DateTime? CreatedDate { get; set; } - public DateTime? ModifiedDate { get; set; } - public List Tags { get; set; } - - public string AbsoluteUrl - { - get { return "http://path.com/to/" + this.Slug; } - } - } - - public class SearchResponse : IHasResponseStatus - { - public SearchResponse() - { - this.Results = new List(); - } - - public string Query { get; set; } - - public List Results { get; set; } - - public ResponseStatus ResponseStatus { get; set; } - } - - - [TestFixture] - public class UseCaseTests : MarkdownTestBase - { - private List Pages; - private SearchResponse SearchResponse; - - string websiteTemplate = + public class Page + { + public Page() + { + this.Tags = new List(); + } + + public string Name { get; set; } + public string Slug { get; set; } + public string Src { get; set; } + public string FilePath { get; set; } + public string Category { get; set; } + public string Content { get; set; } + public DateTime? CreatedDate { get; set; } + public DateTime? ModifiedDate { get; set; } + public List Tags { get; set; } + + public string AbsoluteUrl + { + get { return "http://path.com/to/" + this.Slug; } + } + } + + public class SearchResponse : IHasResponseStatus + { + public SearchResponse() + { + this.Results = new List(); + } + + public string Query { get; set; } + + public List Results { get; set; } + + public ResponseStatus ResponseStatus { get; set; } + } + + + [TestFixture] + public class UseCaseTests : MarkdownTestBase + { + private List Pages; + private SearchResponse SearchResponse; + + string websiteTemplate = @" @@ -68,23 +68,24 @@ public class UseCaseTests : MarkdownTestBase ".NormalizeNewLines(); - [TestFixtureSetUp] - public void TestFixtureSetUp() - { - var jsonPages = File.ReadAllText("~/AppData/Pages.json".MapProjectPath()); - - Pages = JsonSerializer.DeserializeFromString>(jsonPages); + [OneTimeSetUp] + public void TestFixtureSetUp() + { + var jsonPages = File.ReadAllText("~/AppData/Pages.json".MapProjectPath()); - SearchResponse = new SearchResponse { - Query = "OrmLite", - Results = Pages.Take(5).ToList(), - }; - } + Pages = JsonSerializer.DeserializeFromString>(jsonPages); - [Test] - public void Can_display_search_results_basic() - { - var pageTemplate = @"@var Title = ""Search results for "" + Model.Query + SearchResponse = new SearchResponse + { + Query = "OrmLite", + Results = Pages.Take(5).ToList(), + }; + } + + [Test] + public void Can_display_search_results_basic() + { + var pageTemplate = @"@var Title = ""Search results for "" + Model.Query @if (Model.Results.Count == 0) { @@ -108,7 +109,7 @@ @foreach page in Model.Results { @page.Content }
      "; - var expectedHtml = @" + var expectedHtml = @" Simple Site @@ -131,20 +132,20 @@ @foreach page in Model.Results { ".NormalizeNewLines(); - var markdownFormat = Create(websiteTemplate, pageTemplate); + var markdownFormat = Create(websiteTemplate, pageTemplate); - var html = markdownFormat.RenderDynamicPageHtml(PageName, SearchResponse); + var html = markdownFormat.RenderDynamicPageHtml(PageName, SearchResponse); - Console.WriteLine(html); + Console.WriteLine(html); - Assert.That(html.NormalizeNewLines(), Is.EqualTo(expectedHtml)); - } + Assert.That(html.NormalizeNewLines(), Is.EqualTo(expectedHtml)); + } - [Test] - public void Can_display_search_results() - { - var pageTemplate = @"@var Title = ""Search results for "" + Model.Query + [Test] + public void Can_display_search_results() + { + var pageTemplate = @"@var Title = ""Search results for "" + Model.Query @if (Model.Results.Count == 0) { @@ -173,7 +174,7 @@ @foreach page in Model.Results { ^ }"; - var expectedHtml = @" + var expectedHtml = @" Simple Site @@ -197,15 +198,15 @@ @foreach page in Model.Results { ".NormalizeNewLines(); - var markdownFormat = Create(websiteTemplate, pageTemplate); + var markdownFormat = Create(websiteTemplate, pageTemplate); - var html = markdownFormat.RenderDynamicPageHtml(PageName, SearchResponse); + var html = markdownFormat.RenderDynamicPageHtml(PageName, SearchResponse); - Console.WriteLine(html); + Console.WriteLine(html); - Assert.That(html, Is.EqualTo(expectedHtml)); - } - } + Assert.That(html, Is.EqualTo(expectedHtml)); + } + } } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats/ViewTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats/ViewTests.cs index ac013384222..d0caa6cdbc5 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats/ViewTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats/ViewTests.cs @@ -4,6 +4,8 @@ using System.IO; using System.Net; using System.Text; +using System.Threading; +using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.Formats; using ServiceStack.Host; @@ -22,7 +24,7 @@ public class ViewTests private MarkdownFormat markdownFormat; private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { var json = "~/AppData/ALFKI.json".MapProjectPath().ReadAllText(); @@ -30,15 +32,17 @@ public void TestFixtureSetUp() appHost = new BasicAppHost { - ConfigFilter = config => { + Plugins = { new MarkdownFormat() }, + ConfigFilter = config => + { //Files aren't copied, set RootDirectory to ProjectPath instead. - config.WebHostPhysicalPath = "~".MapProjectPath(); + config.WebHostPhysicalPath = "~".MapProjectPath(); } }.Init(); markdownFormat = appHost.GetPlugin(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -48,18 +52,17 @@ public string GetHtml(object dto, string format) { var httpReq = new MockHttpRequest { - Headers = PclExportClient.Instance.NewNameValueCollection(), + Headers = new NameValueCollection(), OperationName = "OperationName", - QueryString = PclExportClient.Instance.NewNameValueCollection(), + QueryString = new NameValueCollection(), }; httpReq.QueryString.Add("format", format); using (var ms = new MemoryStream()) { - var httpRes = new HttpResponseStreamWrapper(ms); - appHost.ViewEngines[0].ProcessRequest(httpReq, httpRes, dto); + var httpRes = new HttpResponseStreamWrapper(ms, httpReq); + appHost.ViewEngines[0].ProcessRequestAsync(httpReq, dto, httpRes.OutputStream); - var utf8Bytes = ms.ToArray(); - var html = utf8Bytes.FromUtf8Bytes(); + var html = ms.ReadToEnd(); return html; } } @@ -134,11 +137,13 @@ public class MockHttpResponse : IHttpResponse { public MemoryStream MemoryStream { get; set; } - public MockHttpResponse() + public MockHttpResponse(IRequest httpReq) { + this.Request = httpReq; this.Headers = new Dictionary(); this.MemoryStream = new MemoryStream(); - this.Cookies = new Cookies(this); + this.Cookies = new Host.Cookies(this); + this.Items = new Dictionary(); } public object OriginalResponse @@ -146,6 +151,8 @@ public object OriginalResponse get { throw new NotImplementedException(); } } + public IRequest Request { get; private set; } + public int StatusCode { set; get; } public string StatusDescription { set; get; } @@ -161,32 +168,43 @@ public void AddHeader(string name, string value) this.Headers.Add(name, value); } + public void RemoveHeader(string name) + { + Headers.Remove(name); + } + + public string GetHeader(string name) + { + this.Headers.TryGetValue(name, out var value); + return value; + } + public void Redirect(string url) { this.Headers[HttpHeaders.Location] = url; } - public Stream OutputStream { get { return MemoryStream; } } + public Stream OutputStream => MemoryStream; public object Dto { get; set; } - public void Write(string text) - { - var bytes = Encoding.UTF8.GetBytes(text); - MemoryStream.Write(bytes, 0, bytes.Length); - } - public bool UseBufferedStream { get; set; } public string Contents { get; set; } public void Close() { - this.Contents = Encoding.UTF8.GetString(MemoryStream.ToArray()); + this.Contents = MemoryStream.ReadToEnd(); MemoryStream.Close(); this.IsClosed = true; } + public Task CloseAsync(CancellationToken token = default(CancellationToken)) + { + Close(); + return TypeConstants.EmptyTask; + } + public void End() { Close(); @@ -197,6 +215,8 @@ public void Flush() MemoryStream.Flush(); } + public Task FlushAsync(CancellationToken token = new CancellationToken()) => MemoryStream.FlushAsync(token); + public bool IsClosed { get; private set; } public void SetContentLength(long contentLength) @@ -206,8 +226,16 @@ public void SetContentLength(long contentLength) public bool KeepAlive { get; set; } + public bool HasStarted { get; set; } + + public Dictionary Items { get; private set; } + public void SetCookie(Cookie cookie) - { + { + } + + public void ClearCookies() + { } } @@ -218,8 +246,8 @@ public void Does_process_Markdown_pages() { MarkdownFormat = markdownFormat, }; - var httpReq = new MockHttpRequest { QueryString = PclExportClient.Instance.NewNameValueCollection() }; - var httpRes = new MockHttpResponse(); + var httpReq = new MockHttpRequest { QueryString = new NameValueCollection() }; + var httpRes = new MockHttpResponse(httpReq); markdownHandler.ProcessRequestAsync(httpReq, httpRes, "Static").Wait(); var expectedHtml = markdownFormat.Transform( diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/CustomRazorBasePage.cs b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/CustomRazorBasePage.cs index a0dbd48c445..08b9feb27dd 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/CustomRazorBasePage.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/CustomRazorBasePage.cs @@ -3,9 +3,9 @@ namespace ServiceStack.ServiceHost.Tests.Formats_Razor { - public abstract class CustomRazorBasePage : ViewPage - { - public FormatHelpers Fmt = new FormatHelpers(); - public NorthwindHelpers Nwnd = new NorthwindHelpers(); - } + public abstract class CustomRazorBasePage : ViewPage + { + public FormatHelpers Fmt = new FormatHelpers(); + public NorthwindHelpers Nwnd = new NorthwindHelpers(); + } } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionExampleRazorTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionExampleRazorTests.cs index 763acbf390b..ecae99d6640 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionExampleRazorTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionExampleRazorTests.cs @@ -1,68 +1,69 @@ using System.Collections.Generic; using NUnit.Framework; +using ServiceStack.IO; using ServiceStack.Razor; using ServiceStack.ServiceHost.Tests.Formats; using ServiceStack.Testing; using ServiceStack.Text; -using ServiceStack.VirtualPath; namespace ServiceStack.ServiceHost.Tests.Formats_Razor { - public class Product - { - public Product() { } - public Product(string name, decimal price) - { - Name = name; - Price = price; - } - - public int ProductID { get; set; } - public string Name { get; set; } - public decimal Price { get; set; } - } - - [TestFixture] - public class IntroductionExampleRazorTests : RazorTestBase - { - private List products; - object productArgs; - - private ServiceStackHost appHost; - - [TestFixtureSetUp] - public void TestFixtureSetUp() - { + public class Product + { + public Product() { } + public Product(string name, decimal price) + { + Name = name; + Price = price; + } + + public int ProductID { get; set; } + public string Name { get; set; } + public decimal Price { get; set; } + } + + [TestFixture] + public class IntroductionExampleRazorTests : RazorTestBase + { + private List products; + object productArgs; + + private ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { appHost = new BasicAppHost().Init(); - this.products = new List { - new Product("Pen", 1.99m), - new Product("Glass", 9.99m), - new Product("Book", 14.99m), - new Product("DVD", 11.99m), - }; - productArgs = new { products = products }; - } - - [TestFixtureTearDown] + this.products = new List { + new Product("Pen", 1.99m), + new Product("Glass", 9.99m), + new Product("Book", 14.99m), + new Product("DVD", 11.99m), + }; + productArgs = new { products = products }; + } + + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); } - + [SetUp] public void SetUp() { RazorFormat.Instance = null; - RazorFormat = new RazorFormat { + RazorFormat = new RazorFormat + { PageBaseType = typeof(CustomRazorBasePage<>), - VirtualPathProvider = new InMemoryVirtualPathProvider(new BasicAppHost()), + VirtualFileSources = new MemoryVirtualFiles(), }.Init(); } - [Test] - public void Basic_Razor_Example() - { - var template = + [Test] + public void Basic_Razor_Example() + { + var template = @"

      Razor Example

      Hello @Model.name, the year is @DateTime.Now.Year

      @@ -70,32 +71,31 @@ public void Basic_Razor_Example()

      Checkout this product

      ".NormalizeNewLines(); - var expectedHtml = + var expectedHtml = @"

      Razor Example

      -

      Hello Demis, the year is 2014

      +

      Hello Demis, the year is 2020

      Checkout this product

      ".NormalizeNewLines(); - var html = RazorFormat.CreateAndRenderToHtml(template, model:new { name = "Demis", productId = 10 }); + var html = RazorFormat.CreateAndRenderToHtml(template, model: new { name = "Demis", productId = 10 }); - html.Print(); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void Simple_loop() - { - var template = @"
        + [Test] + public void Simple_loop() + { + var template = @"
          @foreach (var p in Model.products) {
        • @p.Name: (@p.Price)
        • }
        ".NormalizeNewLines(); - var expectedHtml = + var expectedHtml = @"
        • Pen: (1.99)
        • Glass: (9.99)
        • @@ -106,14 +106,13 @@ public void Simple_loop() var html = RazorFormat.CreateAndRenderToHtml(template, model: productArgs); - html.Print(); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Assert.That(html, Is.EqualTo(expectedHtml)); + } - [Test] - public void If_Statment() - { - var template = @" + [Test] + public void If_Statment() + { + var template = @" @if (Model.products.Count == 0) {

          Sorry - no products in this category

          } else { @@ -121,20 +120,19 @@ public void If_Statment() } ".NormalizeNewLines(); - var expectedHtml = @" + var expectedHtml = @"

          We have products for you!

          ".NormalizeNewLines(); var html = RazorFormat.CreateAndRenderToHtml(template, model: productArgs); - html.Print(); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Assert.That(html.NormalizeNewLines(), Is.EqualTo(expectedHtml)); + } - [Test] - public void Multi_variable_declarations() - { - var template = @" + [Test] + public void Multi_variable_declarations() + { + var template = @" @{ var number = 1; var message = ""Number is "" + number; @@ -142,76 +140,72 @@ public void Multi_variable_declarations()

          Your Message: @message

          ".NormalizeNewLines(); - var expectedHtml = @" + var expectedHtml = @"

          Your Message: Number is 1

          ".NormalizeNewLines(); var html = RazorFormat.CreateAndRenderToHtml(template, model: productArgs); - html.Print(); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Assert.That(html.NormalizeNewLines(), Is.EqualTo(expectedHtml)); + } - [Test] - public void Integrating_content_and_code() - { - var template = + [Test] + public void Integrating_content_and_code() + { + var template = @"

          Send mail to demis.bellot@gmail.com telling him the time: @DateTime.Now.

          ".NormalizeNewLines(); - var expectedHtml = + var expectedHtml = @"

          Send mail to demis.bellot@gmail.com telling him the time: 02/06/2011 06:38:34.

          ".NormalizeNewLines(); - var html = RazorFormat.CreateAndRenderToHtml(template, model:productArgs); + var html = RazorFormat.CreateAndRenderToHtml(template, model: productArgs); - html.Print(); - Assert.That(html, Is.StringMatching(expectedHtml.Substring(0, expectedHtml.Length - 25))); - } + Assert.That(html, Does.Match(expectedHtml.Substring(0, expectedHtml.Length - 25))); + } - [Test] - public void Identifying_nested_content() - { - var template = + [Test] + public void Identifying_nested_content() + { + var template = @" -@if (DateTime.Now.Year == 2014) { -

          If the year is 2014 then print this +@if (DateTime.Now.Year == 2020) { +

          If the year is 2020 then print this multi-line text block and the date: @DateTime.Now

          } ".NormalizeNewLines(); - var expectedHtml = -@"

          If the year is 2014 then print this + var expectedHtml = +@"

          If the year is 2020 then print this multi-line text block and the date: 02/06/2013 06:42:45

          ".NormalizeNewLines(); var html = RazorFormat.CreateAndRenderToHtml(template, model: productArgs); - html.Print(); - Assert.That(html, Is.StringMatching(expectedHtml.Substring(0, expectedHtml.Length - 25))); - } + Assert.That(html, Does.Match(expectedHtml.Substring(0, expectedHtml.Length - 25))); + } - [Test] - public void HTML_encoding() - { - var template = + [Test] + public void HTML_encoding() + { + var template = @"

          Some Content @Model.stringContainingHtml

          ".NormalizeNewLines(); - var expectedHtml = + var expectedHtml = @"

          Some Content <span>html</span>

          ".NormalizeNewLines(); var html = RazorFormat.CreateAndRenderToHtml(template, new { stringContainingHtml = "html" }); - html.Print(); - Assert.That(html, Is.EqualTo(expectedHtml)); - } + Assert.That(html, Is.EqualTo(expectedHtml)); + } - } + } } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionLayoutRazorTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionLayoutRazorTests.cs index da2d0a5d108..2eb2ebfa3d0 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionLayoutRazorTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionLayoutRazorTests.cs @@ -3,11 +3,11 @@ using System.Text; using NUnit.Framework; using ServiceStack.Html; +using ServiceStack.IO; using ServiceStack.Razor; using ServiceStack.ServiceHost.Tests.Formats; using ServiceStack.Testing; using ServiceStack.Text; -using ServiceStack.VirtualPath; namespace ServiceStack.ServiceHost.Tests.Formats_Razor { @@ -49,13 +49,13 @@ public class IntroductionLayoutRazorTests : RazorTestBase { private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -67,7 +67,7 @@ public void OnBeforeEachTest() RazorFormat.Instance = null; base.RazorFormat = new RazorFormat { - VirtualPathProvider = new InMemoryVirtualPathProvider(new BasicAppHost()), + VirtualFileSources = new MemoryVirtualFiles(), }.Init(); } @@ -129,8 +129,7 @@ with a layout template. The content you are seeing here comes from ^^^websiteTemplate.

          And obviously I can have code in here too. Here is the -current date/year: 2014

          - +current date/year: 2020

          @@ -142,8 +141,7 @@ comes from ^^^websiteTemplate.

          var template = RazorFormat.RenderToHtml(dynamicPage); - template.Print(); - Assert.That(template, Is.EqualTo(expectedHtml)); + Assert.That(template.NormalizeNewLines(), Is.EqualTo(expectedHtml)); } [Test] @@ -176,7 +174,6 @@ @section Section1 {
          Menu1
          }" RazorFormat.AddFileAndPage("/views/websiteTemplate1.cshtml", websiteTemplate1); var dynamicPage = RazorFormat.AddFileAndPage(@"/page.cshtml", pageTemplate); var template = RazorFormat.RenderToHtml(dynamicPage); - template.Print(); Assert.That(template, Is.EqualTo(expectedHtml)); } @@ -264,7 +261,7 @@ with a layout template. The content you are seeing here comes from ^^^websiteTemplate.

          And obviously I can have code in here too. Here is the -current date/year: 2014

          +current date/year: 2020

          @@ -286,7 +283,6 @@ comes from ^^^websiteTemplate.

          var html = RazorFormat.RenderToHtml(dynamicPage, layout: "websiteTemplate"); - html.Print(); Assert.That(html, Is.EqualTo(expectedHtml)); } @@ -323,7 +319,6 @@ public void Encapsulation_and_reuse_with_HTML_helpers() var product = new Product { ProductID = 10 }; var html = RazorFormat.CreateAndRenderToHtml(pageTemplate, product); - html.Print(); Assert.That(html, Is.EqualTo(expectedHtml)); } @@ -360,7 +355,6 @@ public void Using_External_HTML_Helpers() var html = RazorFormat.CreateAndRenderToHtml(pageTemplate, model: products); - html.Print(); Assert.That(html, Is.EqualTo(expectedHtml)); } @@ -386,7 +380,6 @@ public void Using_Custom_base_class() var html = RazorFormat.CreateAndRenderToHtml(pageTemplate, new Product("Pen", 1.99m)); - html.Print(); Assert.That(html, Is.EqualTo(expectedHtml)); } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/PrecompiledRazorEngineTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/PrecompiledRazorEngineTests.cs index 05d87f57b5b..80dc8bb6c13 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/PrecompiledRazorEngineTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/PrecompiledRazorEngineTests.cs @@ -1,7 +1,7 @@ using System.Linq; using System.Web; using NUnit.Framework; -using ServiceStack.VirtualPath; +using ServiceStack.IO; namespace ServiceStack.ServiceHost.Tests.Formats_Razor { @@ -14,13 +14,13 @@ public class PrecompiledRazorEngineTests : RazorEngineTests const string View2Html = "
          @DateTime.Now
          "; const string View3Html = "
          @DateTime.Now
          "; - protected override void InitializeFileSystem(InMemoryVirtualPathProvider fileSystem) + protected override void InitializeFileSystem(MemoryVirtualFiles fileSystem) { base.InitializeFileSystem(fileSystem); - fileSystem.AddFile("/views/v1.cshtml", View1Html); - fileSystem.AddFile("/views/v2.cshtml", View2Html); - fileSystem.AddFile("/views/v3.cshtml", View3Html); + fileSystem.WriteFile("/views/v1.cshtml", View1Html); + fileSystem.WriteFile("/views/v2.cshtml", View2Html); + fileSystem.WriteFile("/views/v3.cshtml", View3Html); } [Test] @@ -54,14 +54,15 @@ public void Pages_with_errors_dont_cause_exceptions_on_thread_starting_the_preco Assert.That(page.CompileException, Is.Not.Null); } - [ExpectedException(typeof(HttpCompileException))] [Test] public void Pages_with_errors_still_throw_exceptions_when_rendering() { const string template = "This is a bad template, Hello @SomeInvalidMember.Name!"; - RazorFormat.AddFileAndPage("/simple.cshtml", template); - RazorFormat.RenderToHtml("/simple.cshtml", new { Name = "World" }); + Assert.Throws(() => { + RazorFormat.AddFileAndPage("/simple.cshtml", template); + RazorFormat.RenderToHtml("/simple.cshtml", new { Name = "World" }); + }); } } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorEngineTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorEngineTests.cs index 2dbd645c408..1486a5a7838 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorEngineTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorEngineTests.cs @@ -1,10 +1,10 @@ using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.Html; +using ServiceStack.IO; using ServiceStack.Razor; using ServiceStack.Testing; using ServiceStack.Text; -using ServiceStack.VirtualPath; namespace ServiceStack.ServiceHost.Tests.Formats_Razor { @@ -15,13 +15,13 @@ public class RazorEngineTests private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -37,13 +37,13 @@ public void OnBeforeEachTest() { RazorFormat.Instance = null; - var fileSystem = new InMemoryVirtualPathProvider(new BasicAppHost()); - fileSystem.AddFile("/views/TheLayout.cshtml", LayoutHtml); + var fileSystem = new MemoryVirtualFiles(); + fileSystem.WriteFile("/views/TheLayout.cshtml", LayoutHtml); InitializeFileSystem(fileSystem); RazorFormat = new RazorFormat { - VirtualPathProvider = fileSystem, + VirtualFileSources = fileSystem, PageBaseType = typeof(CustomRazorBasePage<>), EnableLiveReload = false, PrecompilePages = PrecompileEnabled, @@ -51,7 +51,7 @@ public void OnBeforeEachTest() }.Init(); } - protected virtual void InitializeFileSystem(InMemoryVirtualPathProvider fileSystem) + protected virtual void InitializeFileSystem(MemoryVirtualFiles fileSystem) { } @@ -74,6 +74,21 @@ public void Can_compile_simple_template_by_name() Assert.That(result, Is.EqualTo("This is my sample template, Hello World!")); } + [Test] + public void Can_compile_simple_view_by_name() + { + const string template = "This is my sample view, Hello @Model.Name!"; + RazorFormat.VirtualFileSources.WriteFile("/Views/simple.cshtml", template); + var addedView = RazorFormat.AddPage("/Views/simple.cshtml"); + var viewPage = RazorFormat.GetViewPage("simple"); + + Assert.That(addedView == viewPage); + + var result = RazorFormat.RenderToHtml(viewPage, new { Name = "World" }); + + Assert.That(result, Is.EqualTo("This is my sample view, Hello World!")); + } + [Test] public void Can_compile_simple_template_by_name_with_layout() { @@ -83,7 +98,7 @@ public void Can_compile_simple_template_by_name_with_layout() var result = RazorFormat.RenderToHtml("/simple.cshtml", model: new { Name = "World" }); Assert.That(result, Is.EqualTo("
          This is my sample template, Hello World!")); - var result2 = RazorFormat.RenderToHtml("/simple.cshtml", model: new { Name = "World2" }, layout:"bare"); + var result2 = RazorFormat.RenderToHtml("/simple.cshtml", model: new { Name = "World2" }, layout: "bare"); Assert.That(result2, Is.EqualTo("This is my sample template, Hello World2!")); } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorPageResolutionTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorPageResolutionTests.cs index 4ec47b899aa..059715f8689 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorPageResolutionTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorPageResolutionTests.cs @@ -1,12 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using NUnit.Framework; +using ServiceStack.IO; using ServiceStack.Razor; using ServiceStack.Testing; -using ServiceStack.VirtualPath; namespace ServiceStack.ServiceHost.Tests.Formats_Razor { @@ -21,13 +17,13 @@ public class RazorPageResolutionTests private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -40,11 +36,11 @@ public void OnBeforeEachTest() { RazorFormat.Instance = null; - var fileSystem = new InMemoryVirtualPathProvider(new BasicAppHost()); + var fileSystem = new MemoryVirtualFiles(); RazorFormat = new RazorFormat { - VirtualPathProvider = fileSystem, + VirtualFileSources = fileSystem, EnableLiveReload = false, }.Init(); } @@ -53,7 +49,7 @@ public void OnBeforeEachTest() private void SetupRootViewLayout() { RazorFormat.AddFileAndPage("/Views/_Layout.cshtml", RootViewLayout); } private void SetupChildViewLayout() { RazorFormat.AddFileAndPage("/Views/Child/_Layout.cshtml", ChildViewLayout); } private void SetupRootContentLayout() { RazorFormat.AddFileAndPage("/content/_Layout.cshtml", RootContentLayout); } - private void SetupChildContentLayout() { RazorFormat.AddFileAndPage("/content/child/_Layout.cshtml", ChildContentLayout ); } + private void SetupChildContentLayout() { RazorFormat.AddFileAndPage("/content/child/_Layout.cshtml", ChildContentLayout); } private void SetupAllDefaultLayoutFiles() { @@ -63,7 +59,7 @@ private void SetupAllDefaultLayoutFiles() SetupRootContentLayout(); SetupChildContentLayout(); } - + [Test] public void Can_resolve_content_page_by_filename() { @@ -306,8 +302,8 @@ public void Content_page_without_sibling_or_parent_or_shared_default_layout_can_ { var responseDtoType = typeof(TRequest).Assembly.GetType(typeof(TRequest).FullName + "Response"); var responseDto = Activator.CreateInstance(responseDtoType); - var mockReq = new MockHttpRequest { OperationName = typeof(TRequest).Name, Dto = new TRequest()}; - var mockRes = new MockHttpResponse { Dto = responseDto }; + var mockReq = new MockHttpRequest { OperationName = typeof(TRequest).Name, Dto = new TRequest() }; + var mockRes = new MockHttpResponse(mockReq) { Dto = responseDto }; RazorFormat.ProcessRequest(mockReq, mockRes, responseDto); return mockRes.ReadAsString(); } @@ -319,12 +315,12 @@ private string ExecuteContentPage(string path) OperationName = "Razor_PageResolver", PathInfo = path, }; - var mockRes = new MockHttpResponse(); + var mockRes = new MockHttpResponse(mockReq); RazorFormat.ProcessContentPageRequest(mockReq, mockRes); return mockRes.ReadAsString(); } - public class RootView {} + public class RootView { } public class RootViewResponse { } public class ChildView { } public class ChildViewResponse { } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorTestBase.cs b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorTestBase.cs index 6aec25de44d..f408584adf3 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorTestBase.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorTestBase.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using ServiceStack.Razor; using ServiceStack.Razor.Managers; -using ServiceStack.VirtualPath; +using ServiceStack.IO; namespace ServiceStack.ServiceHost.Tests.Formats_Razor { @@ -10,17 +10,15 @@ public static class RazorFormatExtensions { public static RazorPage AddFileAndPage(this RazorFormat razorFormat, string filePath, string contents) { - var pathProvider = (IWriteableVirtualPathProvider)razorFormat.VirtualPathProvider; - pathProvider.AddFile(filePath, contents); + razorFormat.VirtualFileSources.WriteFile(filePath, contents); return razorFormat.AddPage(filePath); } } - + public class RazorTestBase - { - public const string TemplateName = "Template"; - protected const string PageName = "Page"; + { + public const string TemplateName = "Template"; + protected const string PageName = "Page"; protected RazorFormat RazorFormat; - } - + } } diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/StandAloneExampleTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/StandAloneExampleTests.cs index 563eff9a274..901f62b84e8 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/StandAloneExampleTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/StandAloneExampleTests.cs @@ -1,8 +1,8 @@ using NUnit.Framework; +using ServiceStack.IO; using ServiceStack.Razor; using ServiceStack.Testing; using ServiceStack.Text; -using ServiceStack.VirtualPath; namespace ServiceStack.ServiceHost.Tests.Formats_Razor { @@ -11,13 +11,13 @@ public class StandAloneExampleTests { private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -27,8 +27,9 @@ public void TestFixtureTearDown() public void Simple_static_example() { RazorFormat.Instance = null; - var razor = new RazorFormat { - VirtualPathProvider = new InMemoryVirtualPathProvider(new BasicAppHost()), + var razor = new RazorFormat + { + VirtualFileSources = new MemoryVirtualFiles(), EnableLiveReload = false, }.Init(); diff --git a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/TemplateTests.cs b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/TemplateTests.cs index 62afa4f149b..1f1e12410af 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/TemplateTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Formats_Razor/TemplateTests.cs @@ -5,11 +5,11 @@ using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.Html; +using ServiceStack.IO; using ServiceStack.Razor; using ServiceStack.ServiceHost.Tests.Formats; using ServiceStack.Testing; using ServiceStack.Text; -using ServiceStack.VirtualPath; namespace ServiceStack.ServiceHost.Tests.Formats_Razor { @@ -66,7 +66,7 @@ public MvcHtmlString Menu(string selectedId) sb.AppendFormat("
        • {0}
        • \n", menuItem, cls); } sb.Append("
        \n"); - + return MvcHtmlString.Create(sb.ToString()); } @@ -127,7 +127,7 @@ public class RazorTemplateTests : RazorTestBase private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost().Init(); @@ -144,7 +144,7 @@ public void TestFixtureSetUp() templateArgs = person; } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -154,8 +154,9 @@ public void TestFixtureTearDown() public void OnBeforeEachTest() { RazorFormat.Instance = null; - base.RazorFormat = new RazorFormat { - VirtualPathProvider = new InMemoryVirtualPathProvider(new BasicAppHost()), + base.RazorFormat = new RazorFormat + { + VirtualFileSources = new MemoryVirtualFiles(), EnableLiveReload = false, }.Init(); } @@ -175,11 +176,10 @@ public void Can_Use_HtmlHelper_In_Page() public void Can_Use_Model_Directive_With_HtmlHelper() { string pageSource = "@model " + typeof(Person).FullName + @" -@Html.TextBoxFor(a => a.FirstName)"; +@Html.TextBoxFor(a => a.FirstName)"; var page = RazorFormat.CreatePage(pageSource); var output = RazorFormat.RenderToHtml(page, model: templateArgs); - output.Print(); Assert.That(output, Is.EqualTo(@"")); } @@ -194,7 +194,6 @@ public void Can_Access_ViewData() var page = RazorFormat.CreatePage(pageSource); var output = RazorFormat.RenderToHtml(page, model: templateArgs).Trim(); - output.Print(); Assert.That(output, Is.EqualTo(val)); } @@ -208,7 +207,6 @@ public void Can_Access_ViewBag_From_Layout() var page = RazorFormat.CreatePage(pageSource); RazorFormat.AddFileAndPage(staticTemplatePath, @"@ViewBag.X@RenderBody()"); var output = RazorFormat.RenderToHtml(page, model: templateArgs).Trim(); - output.Print(); Assert.That(output, Is.EqualTo(@"HelloHello")); } @@ -223,9 +221,8 @@ public void Can_Render_RazorTemplate() var expectedHtml = staticTemplateContent.ReplaceFirst(RazorFormat.TemplatePlaceHolder, mockContents); - var templateOutput = RazorFormat.RenderToHtml(page, model:templateArgs); + var templateOutput = RazorFormat.RenderToHtml(page, model: templateArgs); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -233,7 +230,7 @@ public void Can_Render_RazorTemplate() public void Can_Render_RazorPage() { RazorFormat.AddFileAndPage(staticTemplatePath, staticTemplateContent); - var dynamicPage = RazorFormat.AddFileAndPage(dynamicPagePath, dynamicPageContent); + var dynamicPage = RazorFormat.AddFileAndPage(dynamicPagePath, dynamicPageContent); var expectedHtml = dynamicPageContent .Replace("@Model.FirstName", person.FirstName) @@ -241,9 +238,8 @@ public void Can_Render_RazorPage() expectedHtml = staticTemplateContent.Replace(RazorFormat.TemplatePlaceHolder, expectedHtml); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -264,9 +260,8 @@ public void Can_Render_RazorPage_with_foreach() expectedHtml = staticTemplateContent.Replace(RazorFormat.TemplatePlaceHolder, expectedHtml); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -300,9 +295,8 @@ public void Can_Render_RazorPage_with_IF_statement() var dynamicPage = RazorFormat.CreatePage(template); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -360,9 +354,8 @@ public void Can_Render_RazorPage_with_Nested_Statements() var dynamicPage = RazorFormat.CreatePage(template); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -446,9 +439,8 @@ public void Can_Render_Razor_with_StaticMethods() var dynamicPage = RazorFormat.CreatePage(template); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs).NormalizeNewLines(); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs).NormalizeNewLines(); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -471,9 +463,8 @@ public void Can_inherit_from_Generic_RazorViewPage_from_model_directive() var dynamicPage = RazorFormat.CreatePage(template); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs).NormalizeNewLines(); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs).NormalizeNewLines(); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -503,9 +494,8 @@ public void Can_inherit_from_CustomViewPage_using_inherits_directive() var dynamicPage = RazorFormat.CreatePage(template); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs).NormalizeNewLines(); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs).NormalizeNewLines(); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -533,9 +523,8 @@ public void Can_Render_RazorPage_with_external_helper() var dynamicPage = RazorFormat.CreatePage(template); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs).NormalizeNewLines(); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs).NormalizeNewLines(); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -598,9 +587,8 @@ Hello @Upper(lastName), @Model.FirstName var dynamicPage = RazorFormat.CreatePage(template); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs).NormalizeNewLines(); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs).NormalizeNewLines(); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -636,9 +624,8 @@ Plain text in a comment var dynamicPage = RazorFormat.CreatePage(template); - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model:templateArgs).NormalizeNewLines(); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, model: templateArgs).NormalizeNewLines(); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -735,13 +722,12 @@ @section Menus { var dynamicPage = RazorFormat.CreatePage(template); IRazorView razorView; - var templateOutput = RazorFormat.RenderToHtml(dynamicPage, out razorView, model:templateArgs).NormalizeNewLines(); + var templateOutput = RazorFormat.RenderToHtml(dynamicPage, out razorView, model: templateArgs).NormalizeNewLines(); - templateOutput.Print(); - Assert.That(templateOutput, Is.EqualTo(expectedHtml)); + Assert.That(templateOutput.NormalizeNewLines(), Is.EqualTo(expectedHtml)); var sectionHtml = razorView.RenderSectionToHtml("Salutations"); - Assert.That(sectionHtml.NormalizeNewLines(), Is.EqualTo("\n

        Hello BELLOT, Demis

        \n")); + Assert.That(sectionHtml.NormalizeNewLines(), Is.EqualTo("

        Hello BELLOT, Demis

        ")); } @@ -856,11 +842,10 @@ @section Menus { RazorFormat.AddFileAndPage("/views/{0}".Fmt(websiteTemplatePath), websiteTemplate); var page = RazorFormat.CreatePage(template); - var result = RazorFormat.RenderToHtml(page, model:person, layout:websiteTemplatePath); + var result = RazorFormat.RenderToHtml(page, model: person, layout: websiteTemplatePath); var templateOutput = result.NormalizeNewLines(); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } @@ -945,7 +930,6 @@ @section Header { var templateOutput = RazorFormat.RenderToHtml(staticPage, layout: "websiteTemplate").NormalizeNewLines(); - templateOutput.Print(); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); } diff --git a/tests/ServiceStack.ServiceHost.Tests/HttpRequestAuthenticationTests.cs b/tests/ServiceStack.ServiceHost.Tests/HttpRequestAuthenticationTests.cs new file mode 100644 index 00000000000..1b5157cd202 --- /dev/null +++ b/tests/ServiceStack.ServiceHost.Tests/HttpRequestAuthenticationTests.cs @@ -0,0 +1,70 @@ +using System.Collections.Specialized; +using NUnit.Framework; +using ServiceStack.Host; + +namespace ServiceStack.ServiceHost.Tests +{ + [TestFixture] + class HttpRequestAuthenticationTests + { + private static BasicRequest CreateRequest(string authHeader) => new BasicRequest { + Headers = new NameValueCollection { {HttpHeaders.Authorization, authHeader} } + }; + + [Test] + public void Correct_commas_in_digestAuth_parsing() + { + const string authHeader = "Digest username=\"кенкен\", realm=\"SWP\", nonce=\"NjM1MDk1NjA0NjExMjMuMTozOGVkMDcyYWQ1ODY5NzhhYTIxODAwNzkyYzRiNzZmYw==\", uri=\"/api/v1/projects/2969/tests?select=metadata,results\", response=\"5f818c8d263e26e787d75b60b78157d1\", qop=auth, nc=00000001, cnonce=\"7e06df0b911151b2\", "; + var req = CreateRequest(authHeader); + + var res = req.GetDigestAuth(); + + Assert.NotNull(res); + } + + [Test] + public void Should_Return_Null_When_Authorization_Header_Is_Missing() + { + var req = CreateRequest(null); + var bearerToken = req.GetBearerToken(); + + Assert.Null(bearerToken); + } + + [Test] + public void Should_Return_Null_As_Bearer_Token_When_Authorization_Header_Is_Empty() + { + var req = CreateRequest(string.Empty); + var bearerToken = req.GetBearerToken(); + + Assert.Null(bearerToken); + } + + [Test] + public void Should_Return_Null_As_Bearer_Token_When_Authorization_Header_Does_Not_Prefix() + { + var req = CreateRequest("Blablabla"); + var bearerToken = req.GetBearerToken(); + + Assert.Null(bearerToken); + } + + [Test] + public void Should_Return_Null_As_Bearer_Token_When_Authorization_Header_Does_Not_Contain_Bearer() + { + var req = CreateRequest("Basic blablabla"); + var bearerToken = req.GetBearerToken(); + + Assert.Null(bearerToken); + } + + [Test] + public void Can_Return_Bearer_Token() + { + var req = CreateRequest("Bearer blablabla"); + var bearerToken = req.GetBearerToken(); + + Assert.True("blablabla" == bearerToken); + } + } +} diff --git a/tests/ServiceStack.ServiceHost.Tests/HttpRequestAuthenticatonTests.cs b/tests/ServiceStack.ServiceHost.Tests/HttpRequestAuthenticatonTests.cs deleted file mode 100644 index ea69905b01f..00000000000 --- a/tests/ServiceStack.ServiceHost.Tests/HttpRequestAuthenticatonTests.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Specialized; -using NUnit.Framework; -using Moq; -using ServiceStack.Host; -using ServiceStack.Web; - -namespace ServiceStack.ServiceHost.Tests -{ - [TestFixture] - class HttpRequestAuthenticatonTests - { - [Test] - public void Correct_commas_in_digestAuth_parsing() - { - var requestMock = new Mock(); - const string authHeader = "Digest username=\"кенкен\", realm=\"SWP\", nonce=\"NjM1MDk1NjA0NjExMjMuMTozOGVkMDcyYWQ1ODY5NzhhYTIxODAwNzkyYzRiNzZmYw==\", uri=\"/api/v1/projects/2969/tests?select=metadata,results\", response=\"5f818c8d263e26e787d75b60b78157d1\", qop=auth, nc=00000001, cnonce=\"7e06df0b911151b2\", "; - var headers = PclExportClient.Instance.NewNameValueCollection(); - headers.Add("Authorization", authHeader); - - requestMock.Expect(e => e.Headers).Returns(headers); - - var res = requestMock.Object.GetDigestAuth(); - - Assert.NotNull(res); - } - } -} diff --git a/tests/ServiceStack.ServiceHost.Tests/HttpRequestMock.cs b/tests/ServiceStack.ServiceHost.Tests/HttpRequestMock.cs index f023dbe5d38..41302e8869d 100644 --- a/tests/ServiceStack.ServiceHost.Tests/HttpRequestMock.cs +++ b/tests/ServiceStack.ServiceHost.Tests/HttpRequestMock.cs @@ -1,174 +1,182 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.Linq; using System.Text; +using System.Threading.Tasks; using ServiceStack.Web; namespace ServiceStack.ServiceHost.Tests { - class HttpRequestMock : IHttpRequest - { - public object OriginalRequest - { - get { throw new NotImplementedException(); } - } + class HttpRequestMock : IHttpRequest + { + public object OriginalRequest + { + get { throw new NotImplementedException(); } + } - public IResponse Response { get; private set; } + public IResponse Response { get; private set; } public string OperationName { get; set; } - public string Verb { get; private set; } - public RequestAttributes RequestAttributes { get; set; } - public IRequestPreferences RequestPreferences { get; private set; } - public object Dto { get; set; } + public string Verb { get; private set; } + public RequestAttributes RequestAttributes { get; set; } + public IRequestPreferences RequestPreferences { get; private set; } + public object Dto { get; set; } - public string ContentType - { - get { throw new NotImplementedException(); } - } + public string ContentType + { + get { throw new NotImplementedException(); } + } public bool IsLocal { get { return true; } } - public IHttpResponse HttpResponse { get; private set; } - - public string HttpMethod - { - get { throw new NotImplementedException(); } - } - - public string UserAgent - { - get { throw new NotImplementedException(); } - } - - public IDictionary Cookies - { - get { throw new NotImplementedException(); } - } - - public string ResponseContentType - { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } - } - - public bool HasExplicitResponseContentType { get; private set; } - - public Dictionary Items - { - get { throw new NotImplementedException(); } - } - - public INameValueCollection Headers - { - get { throw new NotImplementedException(); } - } - - public INameValueCollection QueryString - { - get { throw new NotImplementedException(); } - } - - public INameValueCollection FormData - { - get { throw new NotImplementedException(); } - } - - public bool UseBufferedStream { get; set; } - - public string GetRawBody() - { - throw new NotImplementedException(); - } - - public string RawUrl - { - get { throw new NotImplementedException(); } - } - - public string AbsoluteUri - { - get { throw new NotImplementedException(); } - } - - public string UserHostAddress - { - get { throw new NotImplementedException(); } - } - - public string RemoteIp - { - get { throw new NotImplementedException(); } - } + public IHttpResponse HttpResponse { get; private set; } + + public string HttpMethod + { + get { throw new NotImplementedException(); } + } + + public string UserAgent + { + get { throw new NotImplementedException(); } + } + + public IDictionary Cookies + { + get { throw new NotImplementedException(); } + } + + public string ResponseContentType + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + public bool HasExplicitResponseContentType { get; private set; } + + public Dictionary Items => throw new NotImplementedException(); + public NameValueCollection Headers => throw new NotImplementedException(); + public NameValueCollection QueryString => throw new NotImplementedException(); + public NameValueCollection FormData => throw new NotImplementedException(); + + public bool UseBufferedStream { get; set; } + + public string GetRawBody() + { + throw new NotImplementedException(); + } + + public Task GetRawBodyAsync() => throw new NotImplementedException(); + + public string RawUrl + { + get { throw new NotImplementedException(); } + } + + public string AbsoluteUri + { + get { throw new NotImplementedException(); } + } + + public string UserHostAddress + { + get { throw new NotImplementedException(); } + } + + public string RemoteIp + { + get { throw new NotImplementedException(); } + } + + public string Authorization + { + get { throw new NotImplementedException(); } + } public string XForwardedFor { get { throw new NotImplementedException(); } } - public int? XForwardedPort - { + public int? XForwardedPort + { get { throw new NotImplementedException(); } } - public string XForwardedProtocol - { + public string XForwardedProtocol + { get { throw new NotImplementedException(); } } - public string XRealIp + public string XRealIp { get { throw new NotImplementedException(); } } - public bool IsSecureConnection - { - get { throw new NotImplementedException(); } - } + public string Accept + { + get { throw new NotImplementedException(); } + } - public string[] AcceptTypes - { - get { throw new NotImplementedException(); } - } + public bool IsSecureConnection + { + get => (RequestAttributes & RequestAttributes.Secure) == RequestAttributes.Secure; + set + { + if (value) + RequestAttributes |= RequestAttributes.Secure; + else + RequestAttributes &= ~RequestAttributes.Secure; + } + } - public string PathInfo - { - get { return "index.html"; } - } + public string[] AcceptTypes + { + get { throw new NotImplementedException(); } + } - public System.IO.Stream InputStream - { - get { throw new NotImplementedException(); } - } + public string PathInfo + { + get { return "index.html"; } + } - public long ContentLength - { - get { throw new NotImplementedException(); } - } + public string OriginalPathInfo => PathInfo; + + public System.IO.Stream InputStream + { + get { throw new NotImplementedException(); } + } + + public long ContentLength + { + get { throw new NotImplementedException(); } + } - public IHttpFile[] Files - { - get { throw new NotImplementedException(); } - } + public IHttpFile[] Files + { + get { throw new NotImplementedException(); } + } - public string ApplicationFilePath - { - get { return "~".MapAbsolutePath(); } - } + public string ApplicationFilePath + { + get { return "~".MapAbsolutePath(); } + } - public T TryResolve() - { - throw new NotImplementedException(); - } + public T TryResolve() + { + throw new NotImplementedException(); + } public Uri UrlReferrer { diff --git a/tests/ServiceStack.ServiceHost.Tests/IoCTests.cs b/tests/ServiceStack.ServiceHost.Tests/IoCTests.cs index 6a444b4b005..68adaf07af4 100644 --- a/tests/ServiceStack.ServiceHost.Tests/IoCTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/IoCTests.cs @@ -6,6 +6,7 @@ using ServiceStack.Commands; using ServiceStack.ServiceHost.Tests.Support; using Funq; +using ServiceStack.Configuration; namespace ServiceStack.ServiceHost.Tests { @@ -223,5 +224,136 @@ public void Can_autowire_generic_type_definitions() var barCmd = container.Resolve(); Assert.That(barCmd.Execute(), Is.EqualTo(container.Resolve())); } + + [Test] + public void Can_resolve_using_untyped_Container_Api() + { + var container = new Container(); + container.Register(c => new Foo()); + + var instance = container.TryResolve(typeof(Foo)); + Assert.That(instance, Is.Not.Null); + } + + class CustomAdapter : IContainerAdapter + { + public T TryResolve() + { + if (typeof(T) == typeof(IFoo)) + return (T)(object)new Foo(); + return default(T); + } + + public T Resolve() + { + throw new NotImplementedException(); + } + } + + [Test] + public void Does_fallback_to_Funq_when_missing_in_Adapter() + { + var container = new Container { Adapter = new CustomAdapter() }; + container.Register(c => new Bar()); + + Assert.That(container.TryResolve(), Is.Not.Null); + Assert.That(container.TryResolve(), Is.Not.Null); + } + + [Test] + public void Can_configure_and_resolve_Named_instances() + { + var container = new Container(); + container.Register("foo1", new Foo()); + container.Register("foo2", new Foo2()); + + Assert.That(container.ResolveNamed("foo1") is Foo); + Assert.That(container.ResolveNamed("foo2") is Foo2); + } + + [Test] + public void Can_autowire_named_instances() + { + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); + container.Register(c => 100); + + container.RegisterAutoWired("one"); + container.RegisterAutoWired("two"); + + var one = container.ResolveNamed("one"); + var two = container.ResolveNamed("two"); + Assert.That(one, Is.Not.Null); + Assert.AreNotSame(one, two); + } + + [Test] + public void Can_autowireAs_named_instances() + { + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); + container.Register(c => 100); + + container.RegisterAutoWiredAs("one"); + container.RegisterAutoWiredAs("two"); + + var one = container.ResolveNamed("one"); + var two = container.ResolveNamed("two"); + Assert.That(one, Is.Not.Null); + Assert.AreNotSame(one, two); + } + + [Test] + public void Can_registerAs_named_instances() + { + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); + container.Register(c => 100); + + container.RegisterAs("one"); + container.RegisterAs("two"); + + var one = container.ResolveNamed("one"); + var two = container.ResolveNamed("two"); + Assert.That(one, Is.Not.Null); + Assert.AreNotSame(one, two); + } + + [Test] + public void Can_registerAutoWiredType_as_named_instance() + { + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); + container.Register(c => 100); + + container.RegisterAutoWiredType("one", typeof(AutoWireService), typeof(IService)); + container.RegisterAutoWiredType("two", typeof(AutoWireService), typeof(IService)); + + var one = container.ResolveNamed("one"); + var two = container.ResolveNamed("two"); + Assert.That(one, Is.Not.Null); + Assert.AreNotSame(one, two); + } + + [Test] + public void Can_registerAutoWiredType_named_instance() + { + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); + container.Register(c => 100); + + container.RegisterAutoWiredType("one", typeof(AutoWireService)); + container.RegisterAutoWiredType("two", typeof(AutoWireService)); + + var one = container.ResolveNamed("one"); + var two = container.ResolveNamed("two"); + Assert.That(one, Is.Not.Null); + Assert.AreNotSame(one, two); + } } } diff --git a/tests/ServiceStack.ServiceHost.Tests/Properties/AssemblyInfo.cs b/tests/ServiceStack.ServiceHost.Tests/Properties/AssemblyInfo.cs index b41b28ababd..0886c649f09 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Properties/AssemblyInfo.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] +[assembly: AssemblyFileVersion("5.0.0.0")] diff --git a/tests/ServiceStack.ServiceHost.Tests/RequestContextExtensionsTest.cs b/tests/ServiceStack.ServiceHost.Tests/RequestContextExtensionsTest.cs index adb35fbf719..3918fb3da5c 100644 --- a/tests/ServiceStack.ServiceHost.Tests/RequestContextExtensionsTest.cs +++ b/tests/ServiceStack.ServiceHost.Tests/RequestContextExtensionsTest.cs @@ -1,10 +1,6 @@ using NUnit.Framework; using ServiceStack.Formats; -using ServiceStack.Host; -using ServiceStack.ServiceHost.Tests.Formats; using ServiceStack.Testing; -using ServiceStack.Text; -using ServiceStack.Web; namespace ServiceStack.ServiceHost.Tests { @@ -47,7 +43,9 @@ private static void CanOptimizeResult(string contentType, IPlugin pluginFormat) { var dto = new TestDto { Name = "test" }; - var httpReq = new MockHttpRequest(); + var httpReq = new MockHttpRequest { + PathInfo = "/" + }; httpReq.Headers.Add(HttpHeaders.AcceptEncoding, "gzip,deflate,sdch"); httpReq.ResponseContentType = contentType; diff --git a/tests/ServiceStack.ServiceHost.Tests/RestPathTests.cs b/tests/ServiceStack.ServiceHost.Tests/RestPathTests.cs index 4cb33c385b4..dbcb8c83ab1 100644 --- a/tests/ServiceStack.ServiceHost.Tests/RestPathTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/RestPathTests.cs @@ -13,13 +13,13 @@ public class RestPathTests { private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -105,7 +105,7 @@ public ComplexTypeWithFields(int id, string name, Guid uniqueId) [Test] public void Can_deserialize_ComplexTypeWithFields_path() { - using (JsConfig.With(includePublicFields: true)) + using (JsConfig.With(new Config { IncludePublicFields = true })) { var restPath = new RestPath(typeof(ComplexTypeWithFields), "/Complex/{Id}/{Name}/Unique/{UniqueId}"); @@ -135,7 +135,7 @@ private static void AssertMatch(string definitionPath, string requestPath, var restPath = new RestPath(typeof(BbcMusicRequest), definitionPath); var reqestTestPath = RestPath.GetPathPartsForMatching(requestPath); - Assert.That(restPath.IsMatch("GET", reqestTestPath), Is.True); + Assert.That(restPath.IsMatch("GET", reqestTestPath, out _), Is.True); Assert.That(firstMatchHashKey, Is.EqualTo(restPath.FirstMatchHashKey)); @@ -199,7 +199,7 @@ private static void AssertMatch(string definitionPath, string requestPath, var restPath = new RestPath(typeof(RackSpaceRequest), definitionPath); var reqestTestPath = RestPath.GetPathPartsForMatching(requestPath); - Assert.That(restPath.IsMatch("GET", reqestTestPath), Is.True); + Assert.That(restPath.IsMatch("GET", reqestTestPath, out _), Is.True); Assert.That(firstMatchHashKey, Is.EqualTo(restPath.FirstMatchHashKey)); @@ -255,7 +255,7 @@ private static void AssertMatch(string definitionPath, string requestPath, strin { var restPath = new RestPath(typeof(SlugRequest), definitionPath); var requestTestPath = RestPath.GetPathPartsForMatching(requestPath); - Assert.That(restPath.IsMatch("GET", requestTestPath), Is.True); + Assert.That(restPath.IsMatch("GET", requestTestPath, out _), Is.True); Assert.That(firstMatchHashKey, Is.EqualTo(restPath.FirstMatchHashKey)); @@ -271,15 +271,16 @@ private static void AssertNoMatch(string definitionPath, string requestPath) { var restPath = new RestPath(typeof(SlugRequest), definitionPath); var requestTestPath = RestPath.GetPathPartsForMatching(requestPath); - Assert.That(restPath.IsMatch("GET", requestTestPath), Is.False); + Assert.That(restPath.IsMatch("GET", requestTestPath, out _), Is.False); } [Test] - [ExpectedException(typeof(ArgumentException))] public void Cannot_have_variable_after_wildcard() { - AssertMatch("/content/{Slug*}/{Version}", - "/content/wildcard/slug/path/1", "*/content", new SlugRequest(), -1); + Assert.Throws(() => { + AssertMatch("/content/{Slug*}/{Version}", + "/content/wildcard/slug/path/1", "*/content", new SlugRequest(), -1); + }); } [Test] @@ -289,23 +290,23 @@ public void Can_support_internal_wildcard() "/content/wildcard/slug/path/literal", "*/content", new SlugRequest { Slug = "wildcard/slug/path" }, - 7901); + 97901); AssertMatch("/content/{Slug*}/version/{Version}", "/content/wildcard/slug/path/version/1", "*/content", new SlugRequest { Slug = "wildcard/slug/path", Version = 1 }, - 7801); + 97801); AssertMatch("/content/{Slug*}/with/{Options*}", "/content/wildcard/slug/path/with/optionA/optionB", "*/content", new SlugRequest { Slug = "wildcard/slug/path", Options = "optionA/optionB" }, - 5801); + 95801); - AssertMatch("/{Slug*}/content", "/content", "*/content", new SlugRequest(), 10901); + AssertMatch("/{Slug*}/content", "/content", "*/content", new SlugRequest(), 100901); - AssertMatch("/content/{Slug*}/literal", "/content/literal", "*/content", new SlugRequest(), 10901); + AssertMatch("/content/{Slug*}/literal", "/content/literal", "*/content", new SlugRequest(), 100901); AssertNoMatch("/content/{Slug*}/literal", "/content/wildcard/slug/path"); @@ -438,7 +439,7 @@ class SlugRoute new SlugRoute("ANY /content/literal-before/{Version}"), new SlugRoute("GET /content/v1/literal/slug"), - new SlugRoute("ANY /content/v1/literal/slug"), + new SlugRoute("ANY /content/v1/literal/slug"), new SlugRoute("GET /content/v1/literal/{ignore}"), new SlugRoute("GET /content/{ignore}/literal/{ignore}"), new SlugRoute("GET /content/{Version*}/literal/{Slug*}"), @@ -454,7 +455,7 @@ public SlugRoute(string definition) { this.Definition = definition; var parts = definition.SplitOnFirst(' '); - RestPath = new RestPath(typeof(SlugRequest), path: parts[1], verbs: parts[0] == "ANY" ? null : parts[0]); + RestPath = new RestPath(typeof(SlugRequest), path: parts[1], verbs: parts[0] == ActionContext.AnyAction ? null : parts[0]); } public static List GetOrderedMatchingRules(string withVerb, string forPath) @@ -490,9 +491,9 @@ public void AssertPrecedence(string requestedDefinition, params string[] expecte [Test] public void Can_match_lowercase_http_method() { - var restPath = new RestPath(typeof (ComplexType), "/Complex/{Id}/{Name}/Unique/{UniqueId}", "PUT"); + var restPath = new RestPath(typeof(ComplexType), "/Complex/{Id}/{Name}/Unique/{UniqueId}", "PUT"); var withPathInfoParts = RestPath.GetPathPartsForMatching("/complex/5/Is Alive/unique/4583B364-BBDC-427F-A289-C2923DEBD547"); - Assert.That(restPath.IsMatch("put", withPathInfoParts)); + Assert.That(restPath.IsMatch("put", withPathInfoParts, out _)); } } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/Routes/DynamicRouteAttributeTests.cs b/tests/ServiceStack.ServiceHost.Tests/Routes/DynamicRouteAttributeTests.cs index f926eb0ea25..640cf8639d3 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Routes/DynamicRouteAttributeTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Routes/DynamicRouteAttributeTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt @@ -17,7 +17,7 @@ public void Can_register_routes_dynamically() typeof(NewApiRequestDto) .AddAttributes(new RouteAttribute("/custom/NewApiRequestDto")) .AddAttributes(new RouteAttribute("/custom/NewApiRequestDto/get-only", "GET")); - + using (var appHost = new BasicAppHost(typeof(NewApiRestServiceWithAllVerbsImplemented).Assembly).Init()) { var allVerbs = appHost.RestPaths.First(x => x.Path == "/custom/NewApiRequestDto"); diff --git a/tests/ServiceStack.ServiceHost.Tests/Routes/ServiceRoutesTests.cs b/tests/ServiceStack.ServiceHost.Tests/Routes/ServiceRoutesTests.cs index c5afecf9ce7..ed74c0c61f7 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Routes/ServiceRoutesTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Routes/ServiceRoutesTests.cs @@ -76,26 +76,26 @@ public void Can_Register_NewApi_Routes_With_Id_and_Any_Fallback_From_Assembly() Assert.That(route.AllowedVerbs, Is.Null); } - [Test] - public void Can_Register_NewApi_Routes_With_Field_Id_and_Any_Fallback_From_Assembly() - { + [Test] + public void Can_Register_NewApi_Routes_With_Field_Id_and_Any_Fallback_From_Assembly() + { var routes = new ServiceRoutes(appHost); - routes.AddFromAssembly(typeof(NewApiRequestDtoWithFieldIdService).Assembly); + routes.AddFromAssembly(typeof(NewApiRequestDtoWithFieldIdService).Assembly); var route = (from r in appHost.RestPaths - where r.Path == "/NewApiRequestDtoWithFieldId" - select r).FirstOrDefault(); + where r.Path == "/NewApiRequestDtoWithFieldId" + select r).FirstOrDefault(); - Assert.That(route, Is.Not.Null); - Assert.That(route.AllowedVerbs, Is.Null); + Assert.That(route, Is.Not.Null); + Assert.That(route.AllowedVerbs, Is.Null); route = (from r in appHost.RestPaths - where r.Path == "/NewApiRequestDtoWithFieldId/{Id}" - select r).FirstOrDefault(); + where r.Path == "/NewApiRequestDtoWithFieldId/{Id}" + select r).FirstOrDefault(); - Assert.That(route, Is.Not.Null); - Assert.That(route.AllowedVerbs, Is.Null); - } + Assert.That(route, Is.Not.Null); + Assert.That(route.AllowedVerbs, Is.Null); + } [Test] public void Can_Register_Routes_Using_Add_Extension() diff --git a/tests/ServiceStack.ServiceHost.Tests/Routes/SimpleRestServices.cs b/tests/ServiceStack.ServiceHost.Tests/Routes/SimpleRestServices.cs index a6dd8dd899b..2d6927205cd 100644 --- a/tests/ServiceStack.ServiceHost.Tests/Routes/SimpleRestServices.cs +++ b/tests/ServiceStack.ServiceHost.Tests/Routes/SimpleRestServices.cs @@ -84,22 +84,22 @@ public object Any(NewApiRequestDtoWithId request) } } - public class NewApiRequestDtoWithFieldId - { - public int Id { get; set; } - } - - public class NewApiRequestDtoWithFieldIdService : IService - { - public object Get(NewApiRequestDtoWithFieldId request) - { - return new HttpResult { StatusCode = HttpStatusCode.OK }; - } - - public object Any(NewApiRequestDtoWithFieldId request) - { - return new HttpResult { StatusCode = HttpStatusCode.OK }; - } - } + public class NewApiRequestDtoWithFieldId + { + public int Id { get; set; } + } + + public class NewApiRequestDtoWithFieldIdService : IService + { + public object Get(NewApiRequestDtoWithFieldId request) + { + return new HttpResult { StatusCode = HttpStatusCode.OK }; + } + + public object Any(NewApiRequestDtoWithFieldId request) + { + return new HttpResult { StatusCode = HttpStatusCode.OK }; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/ServiceControllerPerfTests.cs b/tests/ServiceStack.ServiceHost.Tests/ServiceControllerPerfTests.cs index e84f45780c3..2a093855e20 100644 --- a/tests/ServiceStack.ServiceHost.Tests/ServiceControllerPerfTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/ServiceControllerPerfTests.cs @@ -7,72 +7,73 @@ namespace ServiceStack.ServiceHost.Tests { - [Ignore("Perf Test Only")] - [TestFixture] - public class ServiceControllerPerfTests - { - private const int Times = 100000; + [Ignore("Perf Test Only")] + [TestFixture] + public class ServiceControllerPerfTests + { + private const int Times = 100000; - [Test] - public void RunAll() - { - With_Funq_and_Expressions(); - With_Native_Funq(); - With_Funq_and_Reflection(); //Very slow - } + [Test] + public void RunAll() + { + With_Funq_and_Expressions(); + With_Native_Funq(); + With_Funq_and_Reflection(); //Very slow + } - [Test] - public void With_Native_Funq() - { - var container = new Container(); - container.Register(c => new Foo()); - container.Register(c => new Bar()); + [Test] + public void With_Native_Funq() + { + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); - container.Register( - c => new AutoWireService(c.Resolve()) { - Bar = c.Resolve() - }).ReusedWithin(ReuseScope.None); + container.Register( + c => new AutoWireService(c.Resolve()) + { + Bar = c.Resolve() + }).ReusedWithin(ReuseScope.None); - Console.WriteLine("With_Native_Funq(): {0}", Measure(() => container.Resolve(), Times)); - } + Console.WriteLine("With_Native_Funq(): {0}", Measure(() => container.Resolve(), Times)); + } - [Test] - [Ignore("Slow to run")] - public void With_Funq_and_Reflection() - { - var container = new Container(); - container.Register(c => new Foo()); - container.Register(c => new Bar()); + [Test] + [Ignore("Slow to run")] + public void With_Funq_and_Reflection() + { + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); - var funqlet = new ReflectionTypeFunqContainer(container); - funqlet.Register(typeof(AutoWireService)); + var funqlet = new ReflectionTypeFunqContainer(container); + funqlet.Register(typeof(AutoWireService)); - Console.WriteLine("With_Funq_and_Reflection(): {0}", Measure(() => container.Resolve(), Times)); - } + Console.WriteLine("With_Funq_and_Reflection(): {0}", Measure(() => container.Resolve(), Times)); + } - [Test] - public void With_Funq_and_Expressions() - { - var container = new Container(); - container.Register(c => new Foo()); - container.Register(c => new Bar()); + [Test] + public void With_Funq_and_Expressions() + { + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); - container.RegisterAutoWiredType(typeof(AutoWireService)); + container.RegisterAutoWiredType(typeof(AutoWireService)); - Console.WriteLine("With_Funq_and_Expressions(): {0}", Measure(() => container.Resolve(), Times)); - } + Console.WriteLine("With_Funq_and_Expressions(): {0}", Measure(() => container.Resolve(), Times)); + } - private static long Measure(Action action, int iterations) - { - GC.Collect(); - var watch = Stopwatch.StartNew(); + private static long Measure(Action action, int iterations) + { + GC.Collect(); + var watch = Stopwatch.StartNew(); - for (int i = 0; i < iterations; i++) - { - action(); - } + for (int i = 0; i < iterations; i++) + { + action(); + } - return watch.ElapsedTicks; - } - } + return watch.ElapsedTicks; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.ServiceHost.Tests/ServiceControllerTests.cs b/tests/ServiceStack.ServiceHost.Tests/ServiceControllerTests.cs index ace602984d9..77244c650d0 100644 --- a/tests/ServiceStack.ServiceHost.Tests/ServiceControllerTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/ServiceControllerTests.cs @@ -84,25 +84,26 @@ public void Generic_Service_should_not_get_registered_with_generic_parameter() var requestType = typeof(GenericService<>).GetGenericArguments()[0]; var exception = Assert.Throws(() => appHost.ServiceController.GetService(requestType)); - Assert.That(exception.Message, Is.StringContaining("Unable to resolve service")); + Assert.That(exception.Message, Does.Contain("Unable to resolve service")); } } [Test] public void Generic_service_with_recursive_ceneric_type_should_not_get_registered() { - using (var appHost = new BasicAppHost { - UseServiceController = x => + using (var appHost = new BasicAppHost + { + UseServiceController = x => new ServiceController(x, () => new[] { typeof(GenericService<>).MakeGenericType(new[] { typeof(Generic3<>) }) }) - }.Init()) + }.Init()) { // Tell manager to register GenericService>, which should not be possible since Generic3<> is an open type - var exception = Assert.Throws(() => + var exception = Assert.Throws(() => appHost.ServiceController.GetService(typeof(Generic3<>))); - Assert.That(exception.Message, Is.StringContaining("Unable to resolve service")); + Assert.That(exception.Message, Does.Contain("Unable to resolve service")); } } @@ -138,6 +139,7 @@ public void Generic_service_can_be_registered_with_closed_types() public void Service_with_generic_IGet_marker_interface_can_be_registered_without_DefaultRequestAttribute() { var appHost = new AppHost(); + appHost.ServiceController = new ServiceController(appHost); Assert.That(appHost.RestPaths.Count, Is.EqualTo(0)); diff --git a/tests/ServiceStack.ServiceHost.Tests/ServiceCreationTests.cs b/tests/ServiceStack.ServiceHost.Tests/ServiceCreationTests.cs index 46ab3a0e1a8..6be24229f82 100644 --- a/tests/ServiceStack.ServiceHost.Tests/ServiceCreationTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/ServiceCreationTests.cs @@ -51,7 +51,7 @@ public override void Configure(Funq.Container container) AttributeFiltersAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new AttributeFiltersAppHostHttpListener(); @@ -59,13 +59,13 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); } - protected static IRestClient[] RestClients = + protected static IRestClient[] RestClients = { new JsonServiceClient(ServiceClientBaseUri), new XmlServiceClient(ServiceClientBaseUri), diff --git a/tests/ServiceStack.ServiceHost.Tests/ServiceHostTests.cs b/tests/ServiceStack.ServiceHost.Tests/ServiceHostTests.cs index f28491db26f..446cd58bb3b 100644 --- a/tests/ServiceStack.ServiceHost.Tests/ServiceHostTests.cs +++ b/tests/ServiceStack.ServiceHost.Tests/ServiceHostTests.cs @@ -8,82 +8,82 @@ namespace ServiceStack.ServiceHost.Tests { - [TestFixture] + [TestFixture] public class ServiceHostTests - { - private ServiceController serviceController; - private ServiceStackHost appHost; + { + private ServiceController serviceController; + private ServiceStackHost appHost; - [SetUp] + [SetUp] public void SetUp() - { + { appHost = new BasicAppHost().Init(); serviceController = appHost.ServiceController; - } - + } + [TearDown] public void TearDown() { appHost.Dispose(); } - [Test] - public void Can_execute_BasicService() - { + [Test] + public void Can_execute_BasicService() + { serviceController.RegisterService(typeof(BasicService)); var result = serviceController.Execute(new EmptyRequest()) as EmptyRequestResponse; - Assert.That(result, Is.Not.Null); - } + Assert.That(result, Is.Not.Null); + } - [Test] - public void Can_execute_BasicService_from_dynamic_Type() - { - var requestType = typeof(EmptyRequest); + [Test] + public void Can_execute_BasicService_from_dynamic_Type() + { + var requestType = typeof(EmptyRequest); serviceController.RegisterService(typeof(BasicService)); - object request = Activator.CreateInstance(requestType); + object request = Activator.CreateInstance(requestType); var result = serviceController.Execute(request) as EmptyRequestResponse; - Assert.That(result, Is.Not.Null); - } + Assert.That(result, Is.Not.Null); + } - [Test] - public void Can_AutoWire_types_dynamically_with_reflection() - { - var serviceType = typeof(AutoWireService); + [Test] + public void Can_AutoWire_types_dynamically_with_reflection() + { + var serviceType = typeof(AutoWireService); - var container = new Container(); - container.Register(c => new Foo()); - container.Register(c => new Bar()); + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); - var typeContainer = new ReflectionTypeFunqContainer(container); - typeContainer.Register(serviceType); + var typeContainer = new ReflectionTypeFunqContainer(container); + typeContainer.Register(serviceType); - var service = container.Resolve(); + var service = container.Resolve(); - Assert.That(service.Foo, Is.Not.Null); - Assert.That(service.Bar, Is.Not.Null); - } + Assert.That(service.Foo, Is.Not.Null); + Assert.That(service.Bar, Is.Not.Null); + } - [Test] - public void Can_AutoWire_types_dynamically_with_expressions() - { - var serviceType = typeof(AutoWireService); + [Test] + public void Can_AutoWire_types_dynamically_with_expressions() + { + var serviceType = typeof(AutoWireService); - var container = new Container(); - container.Register(c => new Foo()); - container.Register(c => new Bar()); + var container = new Container(); + container.Register(c => new Foo()); + container.Register(c => new Bar()); - container.RegisterAutoWiredType(serviceType); + container.RegisterAutoWiredType(serviceType); - var service = container.Resolve(); + var service = container.Resolve(); - Assert.That(service.Foo, Is.Not.Null); - Assert.That(service.Bar, Is.Not.Null); - } + Assert.That(service.Foo, Is.Not.Null); + Assert.That(service.Bar, Is.Not.Null); + } private MockHttpRequest CreateContext(string httpMethod) { @@ -91,64 +91,64 @@ private MockHttpRequest CreateContext(string httpMethod) return ctx; } - [Test] - public void Can_execute_RestTestService() - { + [Test] + public void Can_execute_RestTestService() + { serviceController.RegisterService(typeof(RestTestService)); var result = serviceController.Execute(new RestTest(), CreateContext(HttpMethods.Options)) as RestTestResponse; - Assert.That(result, Is.Not.Null); - Assert.That(result.MethodName, Is.EqualTo("Any")); - } + Assert.That(result, Is.Not.Null); + Assert.That(result.MethodName, Is.EqualTo("Any")); + } - [Test] - public void Can_RestTestService_GET() - { + [Test] + public void Can_RestTestService_GET() + { serviceController.RegisterService(typeof(RestTestService)); var result = serviceController.Execute(new RestTest(), CreateContext(HttpMethods.Get)) as RestTestResponse; - Assert.That(result, Is.Not.Null); - Assert.That(result.MethodName, Is.EqualTo("Get")); - } + Assert.That(result, Is.Not.Null); + Assert.That(result.MethodName, Is.EqualTo("Get")); + } - [Test] - public void Can_RestTestService_PUT() - { + [Test] + public void Can_RestTestService_PUT() + { serviceController.RegisterService(typeof(RestTestService)); var result = serviceController.Execute(new RestTest(), CreateContext(HttpMethods.Put)) as RestTestResponse; - Assert.That(result, Is.Not.Null); - Assert.That(result.MethodName, Is.EqualTo("Put")); - } + Assert.That(result, Is.Not.Null); + Assert.That(result.MethodName, Is.EqualTo("Put")); + } - [Test] - public void Can_RestTestService_POST() - { + [Test] + public void Can_RestTestService_POST() + { serviceController.RegisterService(typeof(RestTestService)); var result = serviceController.Execute(new RestTest(), CreateContext(HttpMethods.Post)) as RestTestResponse; - Assert.That(result, Is.Not.Null); - Assert.That(result.MethodName, Is.EqualTo("Post")); - } + Assert.That(result, Is.Not.Null); + Assert.That(result.MethodName, Is.EqualTo("Post")); + } - [Test] - public void Can_RestTestService_DELETE() - { + [Test] + public void Can_RestTestService_DELETE() + { serviceController.RegisterService(typeof(RestTestService)); var result = serviceController.Execute(new RestTest(), CreateContext(HttpMethods.Delete)) as RestTestResponse; - Assert.That(result, Is.Not.Null); - Assert.That(result.MethodName, Is.EqualTo("Delete")); - } - } + Assert.That(result, Is.Not.Null); + Assert.That(result.MethodName, Is.EqualTo("Delete")); + } + } } diff --git a/tests/ServiceStack.ServiceHost.Tests/ServiceStack.ServiceHost.Tests.csproj b/tests/ServiceStack.ServiceHost.Tests/ServiceStack.ServiceHost.Tests.csproj index ea5aa739331..d6fc0acca9a 100644 --- a/tests/ServiceStack.ServiceHost.Tests/ServiceStack.ServiceHost.Tests.csproj +++ b/tests/ServiceStack.ServiceHost.Tests/ServiceStack.ServiceHost.Tests.csproj @@ -1,5 +1,6 @@  - + + Debug AnyCPU @@ -32,8 +33,10 @@ true ..\..\src\ true - v4.5 + v4.6 + + True @@ -92,34 +95,73 @@ false + + ..\..\src\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll + - - ..\..\lib\tests\Moq.dll + + ..\..\src\packages\Moq.4.9.0\lib\net45\Moq.dll + + + + ..\..\src\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll + True - - False - ..\..\src\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\..\src\packages\ServiceStack.Common.5.9.0\lib\net45\ServiceStack.Common.dll + True - - ..\..\lib\ServiceStack.Interfaces.dll + + ..\..\src\packages\ServiceStack.Interfaces.5.9.0\lib\net45\ServiceStack.Interfaces.dll + True - - ..\..\lib\ServiceStack.OrmLite.dll + + ..\..\src\packages\ServiceStack.OrmLite.5.9.0\lib\net45\ServiceStack.OrmLite.dll + True - - ..\..\lib\ServiceStack.OrmLite.Sqlite.dll + + ..\..\src\packages\ServiceStack.OrmLite.Sqlite.5.9.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll + True - - ..\..\lib\ServiceStack.Text.dll + + ..\..\src\packages\ServiceStack.Text.5.9.0\lib\net45\ServiceStack.Text.dll + True + + ..\..\src\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll + True + + + 3.5 + + ..\..\src\packages\System.Data.SQLite.Core.1.0.113.1\lib\net46\System.Data.SQLite.dll + True + + + ..\..\src\packages\System.Memory.4.5.4\lib\netstandard1.1\System.Memory.dll + True + + + ..\..\src\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll + True + 3.0 + + + + ..\..\src\packages\System.Threading.Tasks.Extensions.4.5.2\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll + True + + + ..\..\src\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll + 3.5 @@ -164,7 +206,7 @@ - + @@ -208,10 +250,6 @@ - - sqlite3.dll - PreserveNewest - @@ -236,6 +274,10 @@ {982416DB-C143-4028-A0C3-CF41892D18D3} ServiceStack.Common + + {55942102-033a-4da8-a6af-1db7b2f34a2d} + ServiceStack.Interfaces + {D73274AE-006B-4CEE-BA60-0ECF5873048D} ServiceStack.Razor @@ -273,8 +315,19 @@ + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + diff --git a/tests/ServiceStack.ServiceModel.Tests/XlinqExtensionsTests.cs b/tests/ServiceStack.ServiceModel.Tests/XlinqExtensionsTests.cs index 475b48f2fae..f23b0babc85 100644 --- a/tests/ServiceStack.ServiceModel.Tests/XlinqExtensionsTests.cs +++ b/tests/ServiceStack.ServiceModel.Tests/XlinqExtensionsTests.cs @@ -28,21 +28,21 @@ public void xelement_get_int_test() } [Test] - [ExpectedException(typeof(ArgumentNullException))] public void xelement_get_int_null_throws_exception_test() { - var el = CreateEmptyChildElement(); - el.GetInt("child"); - Assert.Fail("Expected ArgumentNullException"); + Assert.Throws(() => { + var el = CreateEmptyChildElement(); + el.GetInt("child"); + }); } [Test] - [ExpectedException(typeof(FormatException))] public void xelement_get_int_text_throws_exception_test() { - var el = CreateChildElement("Non int value"); - el.GetInt("child"); - Assert.Fail("Expected FormatException"); + Assert.Throws(() => { + var el = CreateChildElement("Non int value"); + el.GetInt("child"); + }); } [Test] diff --git a/tests/ServiceStack.ServiceModel.Tests/packages.config b/tests/ServiceStack.ServiceModel.Tests/packages.config deleted file mode 100644 index 967502dc812..00000000000 --- a/tests/ServiceStack.ServiceModel.Tests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AlwaysThrowsService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AlwaysThrowsService.cs index 5d14cedc4c8..75930004604 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AlwaysThrowsService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AlwaysThrowsService.cs @@ -46,20 +46,25 @@ public AlwaysThrowsValidator() } } + public class ThrowArgumentException : IReturn + { + public int Id { get; set; } + } + [DataContract] - public class AlwaysThrowsResponse : IHasResponseStatus - { - public AlwaysThrowsResponse() - { - this.ResponseStatus = new ResponseStatus(); - } + public class AlwaysThrowsResponse : IHasResponseStatus + { + public AlwaysThrowsResponse() + { + this.ResponseStatus = new ResponseStatus(); + } - [DataMember] - public string Result { get; set; } + [DataMember] + public string Result { get; set; } - [DataMember] - public ResponseStatus ResponseStatus { get; set; } - } + [DataMember] + public ResponseStatus ResponseStatus { get; set; } + } [DataContract] public class BasicAuthRequired @@ -67,8 +72,8 @@ public class BasicAuthRequired public string Name { get; set; } } - public class AlwaysThrowsService : Service - { + public class AlwaysThrowsService : Service + { public object Any(AlwaysThrows request) { if (request.StatusCode.HasValue) @@ -95,23 +100,31 @@ public List Any(AlwaysThrowsValidation request) } public static string GetErrorMessage(string value) - { - return value + " is not implemented"; - } + { + return value + " is not implemented"; + } public object Any(BasicAuthRequired request) { return request; } - } + + public object Any(ThrowArgumentException request) + { + throw new ArgumentNullException("Id"); + } + } public class AlwaysThrowsAppHost : AppHostHttpListenerBase { - public AlwaysThrowsAppHost() - : base("Always Throws Service", typeof(AlwaysThrowsService).Assembly) {} + public AlwaysThrowsAppHost() + : base("Always Throws Service", typeof(AlwaysThrowsService).Assembly) { } public override void Configure(Container container) { +#if !NETCORE + Plugins.Add(new SoapFormat()); +#endif Plugins.Add(new ValidationFeature()); container.RegisterValidators(typeof(AlwaysThrowsValidator).Assembly); @@ -160,14 +173,14 @@ public void Register(IAppHost appHost) /// [TestFixture] public abstract class WebServicesTests - //: TestBase + //: TestBase { public const string ListeningOn = "http://localhost:1337/"; private const string TestString = "ServiceStack"; private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new AlwaysThrowsAppHost() @@ -175,7 +188,7 @@ public void TestFixtureSetUp() .Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -192,7 +205,6 @@ public void Can_Handle_Exception_from_AlwaysThrowService() var response = client.Send( new AlwaysThrows { Value = TestString }); - response.PrintDump(); Assert.Fail("Should throw HTTP errors"); } catch (WebServiceException webEx) @@ -206,16 +218,38 @@ public void Can_Handle_Exception_from_AlwaysThrowService() } } + [Test] + public void Can_Handle_ThrowArgumentException() + { + var client = CreateNewServiceClient(); + try + { + var response = client.Send( + new ThrowArgumentException()); + + Assert.Fail("Should throw HTTP errors"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(400)); + Assert.That(webEx.StatusDescription, Is.EqualTo(typeof(ArgumentNullException).Name)); + Assert.That(webEx.Message.Replace("\r\n", "\n"), Is.EqualTo("Value cannot be null.\nParameter name: Id")); + Assert.That(webEx.ErrorCode, Is.EqualTo(typeof(ArgumentNullException).Name)); + Assert.That(webEx.ErrorMessage.Replace("\r\n", "\n"), Is.EqualTo("Value cannot be null.\nParameter name: Id")); + } + } + [Test] public void Can_Handle_Exception_from_AlwaysThrowsList_with_GET_route() { var client = CreateNewServiceClient(); +#if !NETCORE if (client is WcfServiceClient) return; +#endif try { var response = client.Get>("/throwslist/404/{0}".Fmt(TestString)); - response.PrintDump(); Assert.Fail("Should throw HTTP errors"); } catch (WebServiceException webEx) @@ -240,7 +274,6 @@ public void Can_Handle_Exception_from_AlwaysThrowsValidation() var response = client.Send>( new AlwaysThrowsValidation()); - response.PrintDump(); Assert.Fail("Should throw HTTP errors"); } catch (WebServiceException webEx) @@ -248,10 +281,10 @@ public void Can_Handle_Exception_from_AlwaysThrowsValidation() var response = (ErrorResponse)webEx.ResponseDto; var status = response.ResponseStatus; Assert.That(status.ErrorCode, Is.EqualTo("NotEmpty")); - Assert.That(status.Message, Is.EqualTo("'Value' should not be empty.")); + Assert.That(status.Message, Is.EqualTo("'Value' must not be empty.")); Assert.That(status.Errors[0].ErrorCode, Is.EqualTo("NotEmpty")); Assert.That(status.Errors[0].FieldName, Is.EqualTo("Value")); - Assert.That(status.Errors[0].Message, Is.EqualTo("'Value' should not be empty.")); + Assert.That(status.Errors[0].Message, Is.EqualTo("'Value' must not be empty.")); } } @@ -290,6 +323,14 @@ protected override IServiceClient CreateNewServiceClient() } } + public class JsonHttpIntegrationTests : WebServicesTests + { + protected override IServiceClient CreateNewServiceClient() + { + return new JsonHttpClient(ListeningOn); + } + } + public class JsvIntegrationTests : WebServicesTests { protected override IServiceClient CreateNewServiceClient() @@ -298,6 +339,7 @@ protected override IServiceClient CreateNewServiceClient() } } +#if !NETCORE public class Soap11IntegrationTests : WebServicesTests { protected override IServiceClient CreateNewServiceClient() @@ -313,4 +355,5 @@ protected override IServiceClient CreateNewServiceClient() return new Soap12ServiceClient(ListeningOn); } } +#endif } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/App.config b/tests/ServiceStack.WebHost.Endpoints.Tests/App.config index fad529db893..c0ee9ffef9d 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/App.config +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/App.config @@ -1,6 +1,23 @@ - + + - - - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostConfigTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostConfigTests.cs index cf8291c1b15..30b4bd62901 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostConfigTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostConfigTests.cs @@ -11,7 +11,7 @@ public class AppHostConfigTests ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new TestConfigAppHostHttpListener() @@ -19,7 +19,7 @@ public void TestFixtureSetUp() .Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -31,7 +31,8 @@ public void Actually_uses_the_BclJsonSerializers() var json = (ListeningOn + "login/user/pass").GetJsonFromUrl(); json.Print(); - Assert.That(json, Is.EqualTo("{\"pwd\":\"pass\",\"uname\":\"user\"}")); + Assert.That(json, Is.EqualTo("{\"pwd\":\"pass\",\"uname\":\"user\"}") + .Or.EqualTo("{\"uname\":\"user\",\"pwd\":\"pass\"}")); } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostHttpListenerLongRunningBaseTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostHttpListenerLongRunningBaseTests.cs index 5f0a15a440c..ee71c0ff4a8 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostHttpListenerLongRunningBaseTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostHttpListenerLongRunningBaseTests.cs @@ -14,17 +14,17 @@ class AppHostHttpListenerLongRunningBaseTests private const string ListeningOn = "http://localhost:1337/"; ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureStartUp() { appHost = new ExampleAppHostHttpListenerPool() .Init() .Start(ListeningOn); - Console.WriteLine("ExampleAppHost Created at {0}, listening on {1}", DateTime.Now, ListeningOn); + Console.WriteLine(@"ExampleAppHost Created at {0}, listening on {1}", DateTime.Now, ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -149,23 +149,23 @@ public void Can_GET_single_gethttpresult_using_RestClient_with_JSONP_from_servic webReq.Accept = "*/*"; using (var webRes = webReq.GetResponse()) { - Assert.That(webRes.ContentType, Is.StringStarting(MimeTypes.JavaScript)); + Assert.That(webRes.ContentType, Does.StartWith(MimeTypes.JavaScript)); response = webRes.ReadToEnd(); } Assert.That(response, Is.Not.Null, "No response received"); Console.WriteLine(response); - Assert.That(response, Is.StringStarting("cb(")); - Assert.That(response, Is.StringEnding(")")); + Assert.That(response, Does.StartWith("cb(")); + Assert.That(response, Does.EndWith(")")); } - [Test, Ignore] + [Test, Ignore("Helper test")] public void DebugHost() { Thread.Sleep(180 * 1000); } - [Test, Ignore] + [Test, Ignore("Performance test")] public void PerformanceTest() { const int clientCount = 500; diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostListenerBaseTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostListenerBaseTests.cs index a31fc2c751c..3183baa28d2 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostListenerBaseTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostListenerBaseTests.cs @@ -5,7 +5,9 @@ using System.Net.Sockets; using System.Threading; using NUnit.Framework; +#if !NETCORE_SUPPORT using ServiceStack.Host.HttpListener; +#endif using ServiceStack.Logging; using ServiceStack.Text; using ServiceStack.WebHost.Endpoints.Tests.Support.Host; @@ -23,7 +25,7 @@ static AppHostListenerBaseTests() LogManager.LogFactory = new ConsoleLogFactory(); } - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureStartUp() { appHost = new ExampleAppHostHttpListener() @@ -33,7 +35,7 @@ public void OnTestFixtureStartUp() "ExampleAppHost Created at {0}, listening on {1}".Print(DateTime.Now, ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -157,29 +159,31 @@ public void Can_GET_single_gethttpresult_using_RestClient_with_JSONP_from_servic webReq.Accept = "*/*"; using (var webRes = webReq.GetResponse()) { - Assert.That(webRes.ContentType, Is.StringStarting(MimeTypes.JavaScript)); + Assert.That(webRes.ContentType, Does.StartWith(MimeTypes.JavaScript)); response = webRes.ReadToEnd(); } Assert.That(response, Is.Not.Null, "No response received"); Console.WriteLine(response); - Assert.That(response, Is.StringStarting("cb(")); - Assert.That(response, Is.StringEnding(")")); + Assert.That(response, Does.StartWith("cb(")); + Assert.That(response, Does.EndWith(")")); } - [Test, Ignore] + [Test, Ignore("Dubug test")] public void DebugHost() { Thread.Sleep(180 * 1000); } - [Test, Ignore] + [Test, Ignore("Performance test")] public void PerformanceTest() { const int clientCount = 500; var threads = new List(clientCount); +#if !NETCORE ThreadPool.SetMinThreads(500, 50); ThreadPool.SetMaxThreads(1000, 50); +#endif for (int i = 0; i < clientCount; i++) { @@ -206,6 +210,7 @@ public void PerformanceTest() Trace.TraceInformation("Elapsed time for " + clientCount + " requests : " + sw.Elapsed); } +#if !NETCORE_SUPPORT [Test] public void Can_infer_handler_path_from_listener_uris() { @@ -225,6 +230,7 @@ public void Can_infer_handler_path_from_listener_uris() Assert.That(handlerPath, Is.EqualTo(entry.Value)); } } +#endif [Test, Ignore("You have to manually check the test output if there where NullReferenceExceptions!")] public void Rapid_Start_Stop_should_not_cause_exceptions() @@ -234,21 +240,22 @@ public void Rapid_Start_Stop_should_not_cause_exceptions() for (int i = 0; i < 100; i++) { localAppHost.Start(GetBaseAddressWithFreePort()); +#if !NETCORE_SUPPORT localAppHost.Stop(); +#endif } } private static string GetBaseAddressWithFreePort() { - TcpListener listener = new TcpListener(IPAddress.Loopback, 0); + var listener = new TcpListener(IPAddress.Loopback, 0); listener.Start(); - IPEndPoint endPoint = listener.LocalEndpoint as IPEndPoint; - if (endPoint != null) + if (listener.LocalEndpoint is IPEndPoint endPoint) { string address = endPoint.Address.ToString(); int port = endPoint.Port; - Uri uri = new UriBuilder(Uri.UriSchemeHttp, address, port).Uri; + Uri uri = new UriBuilder("http://", address, port).Uri; listener.Stop(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostListenerEchoRequestTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostListenerEchoRequestTests.cs index d901bc8969e..ec33f6f7b03 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostListenerEchoRequestTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AppHostListenerEchoRequestTests.cs @@ -4,7 +4,9 @@ using Funq; using NUnit.Framework; using ServiceStack.Host.Handlers; +#if !NETCORE_SUPPORT using ServiceStack.Host.HttpListener; +#endif using ServiceStack.Text; namespace ServiceStack.WebHost.Endpoints.Tests @@ -21,6 +23,7 @@ public AppHost() public override void Configure(Container container) { } +#if !NETCORE_SUPPORT public override ListenerRequest CreateRequest(HttpListenerContext httpContext, string operationName) { var req = new ListenerRequest(httpContext, operationName, RequestAttributes.None) @@ -30,6 +33,7 @@ public override ListenerRequest CreateRequest(HttpListenerContext httpContext, s req.RequestAttributes = req.GetAttributes(); return req; } +#endif } [Route("/echo")] @@ -77,7 +81,7 @@ public object Any(CustomHtml request) private AppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new AppHost(); @@ -85,7 +89,7 @@ public void TestFixtureSetUp() appHost.Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -96,7 +100,7 @@ public void Does_url_decode_raw_QueryString() { var testEncoding = "test://?&% encoding"; var url = "{0}echo?Param={1}".Fmt(Config.AbsoluteBaseUri, testEncoding.UrlEncode()); - Assert.That(url, Is.StringEnding("/echo?Param=test%3a%2f%2f%3f%26%25+encoding")); + Assert.That(url, Does.EndWith("/echo?Param=test%3a%2f%2f%3f%26%25+encoding")); var json = url.GetJsonFromUrl(); var response = json.FromJson(); @@ -108,7 +112,7 @@ public void Does_url_decode_raw_PathInfo() { var testEncoding = "test encoding"; var url = "{0}echo/{1}".Fmt(Config.AbsoluteBaseUri, testEncoding.UrlEncode()); - Assert.That(url, Is.StringEnding("/echo/test+encoding")); + Assert.That(url, Does.EndWith("/echo/test+encoding")); var json = url.GetJsonFromUrl(); var response = json.FromJson(); @@ -151,7 +155,8 @@ public void Can_force_default_UTF8_encoding() requestBody: "Param=" + param.UrlEncode(), contentType: MimeTypes.FormUrlEncoded, accept: MimeTypes.Json); - var value = JsonObject.Parse(json)["Param"]; + var value = JsonObject.Parse(json)["Param"] + ?? JsonObject.Parse(json)["param"]; Assert.That(value, Is.EqualTo(param)); } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AppSelfHostTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AppSelfHostTests.cs index 33c0f892a42..c1757f59300 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AppSelfHostTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AppSelfHostTests.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System; +using System.Reflection; using System.Threading; using System.Threading.Tasks; using Funq; @@ -24,7 +25,12 @@ public class PerfServices : Service public object Any(SpinWait request) { +#if NETCORE + int i = request.Iterations.GetValueOrDefault(DefaultIterations); + //SpinWait.SpinUntil(i-- > 0); +#else Thread.SpinWait(request.Iterations.GetValueOrDefault(DefaultIterations)); +#endif return request; } @@ -49,14 +55,22 @@ public class AppSelfHostTests { private readonly ServiceStackHost appHost; + private readonly string ListeningOn; + public AppSelfHostTests() { + var port = HostContext.FindFreeTcpPort(startingFrom: 5000); + if (port < 5000) + throw new Exception("Expected port >= 5000, got: " + port); + + ListeningOn = "http://localhost:{0}/".Fmt(port); + appHost = new AppHostSmartPool() .Init() - .Start(Config.ListeningOn); + .Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -65,22 +79,19 @@ public void TestFixtureTearDown() [Test] public void Can_call_SelfHost_Services() { - var client = new JsonServiceClient(Config.ServiceStackBaseUri); + var client = new JsonServiceClient(ListeningOn); - client.Get(new Sleep { ForMs = 100 }).PrintDump(); - client.Get(new SpinWait { Iterations = 1000 }).PrintDump(); + client.Get(new Sleep { ForMs = 100 }); + client.Get(new SpinWait { Iterations = 1000 }); } [Test] public async Task Can_call_SelfHost_Services_async() { - var client = new JsonServiceClient(Config.ServiceStackBaseUri); + var client = new JsonServiceClient(ListeningOn); var sleep = await client.GetAsync(new Sleep { ForMs = 100 }); var spin = await client.GetAsync(new SpinWait { Iterations = 1000 }); - - sleep.PrintDump(); - spin.PrintDump(); } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/App_Data/customers.json b/tests/ServiceStack.WebHost.Endpoints.Tests/App_Data/customers.json new file mode 100644 index 00000000000..48b62bf41b2 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/App_Data/customers.json @@ -0,0 +1,5248 @@ +[ + { + "customerId": "ALFKI", + "companyName": "Alfreds Futterkiste", + "address": "Obere Str. 57", + "city": "Berlin", + "postalCode": "12209", + "country": "Germany", + "phone": "030-0074321", + "fax": "030-0076545", + "orders": [ + { + "orderId": 10643, + "orderDate": "1997-08-25T00:00:00", + "total": 814.50 + }, + { + "orderId": 10692, + "orderDate": "1997-10-03T00:00:00", + "total": 878.00 + }, + { + "orderId": 10702, + "orderDate": "1997-10-13T00:00:00", + "total": 330.00 + }, + { + "orderId": 10835, + "orderDate": "1998-01-15T00:00:00", + "total": 845.80 + }, + { + "orderId": 10952, + "orderDate": "1998-03-16T00:00:00", + "total": 471.20 + }, + { + "orderId": 11011, + "orderDate": "1998-04-09T00:00:00", + "total": 933.50 + } + ] + }, + { + "customerId": "ANATR", + "companyName": "Ana Trujillo Emparedados y helados", + "address": "Avda. de la Constituci\u00f3n 2222", + "city": "M\u00e9xico D.F.", + "postalCode": "05021", + "country": "Mexico", + "phone": "(5) 555-4729", + "fax": "(5) 555-3745", + "orders": [ + { + "orderId": 10308, + "orderDate": "1996-09-18T00:00:00", + "total": 88.80 + }, + { + "orderId": 10625, + "orderDate": "1997-08-08T00:00:00", + "total": 479.75 + }, + { + "orderId": 10759, + "orderDate": "1997-11-28T00:00:00", + "total": 320.00 + }, + { + "orderId": 10926, + "orderDate": "1998-03-04T00:00:00", + "total": 514.40 + } + ] + }, + { + "customerId": "ANTON", + "companyName": "Antonio Moreno Taquer\u00eda", + "address": "Mataderos 2312", + "city": "M\u00e9xico D.F.", + "postalCode": "05023", + "country": "Mexico", + "phone": "(5) 555-3932", + "orders": [ + { + "orderId": 10365, + "orderDate": "1996-11-27T00:00:00", + "total": 403.20 + }, + { + "orderId": 10507, + "orderDate": "1997-04-15T00:00:00", + "total": 749.06 + }, + { + "orderId": 10535, + "orderDate": "1997-05-13T00:00:00", + "total": 1940.85 + }, + { + "orderId": 10573, + "orderDate": "1997-06-19T00:00:00", + "total": 2082.00 + }, + { + "orderId": 10677, + "orderDate": "1997-09-22T00:00:00", + "total": 813.36 + }, + { + "orderId": 10682, + "orderDate": "1997-09-25T00:00:00", + "total": 375.50 + }, + { + "orderId": 10856, + "orderDate": "1998-01-28T00:00:00", + "total": 660.00 + } + ] + }, + { + "customerId": "AROUT", + "companyName": "Around the Horn", + "address": "120 Hanover Sq.", + "city": "London", + "postalCode": "WA1 1DP", + "country": "UK", + "phone": "(171) 555-7788", + "fax": "(171) 555-6750", + "orders": [ + { + "orderId": 10355, + "orderDate": "1996-11-15T00:00:00", + "total": 480.00 + }, + { + "orderId": 10383, + "orderDate": "1996-12-16T00:00:00", + "total": 899.00 + }, + { + "orderId": 10453, + "orderDate": "1997-02-21T00:00:00", + "total": 407.70 + }, + { + "orderId": 10558, + "orderDate": "1997-06-04T00:00:00", + "total": 2142.90 + }, + { + "orderId": 10707, + "orderDate": "1997-10-16T00:00:00", + "total": 1641.00 + }, + { + "orderId": 10741, + "orderDate": "1997-11-14T00:00:00", + "total": 228.00 + }, + { + "orderId": 10743, + "orderDate": "1997-11-17T00:00:00", + "total": 319.20 + }, + { + "orderId": 10768, + "orderDate": "1997-12-08T00:00:00", + "total": 1477.00 + }, + { + "orderId": 10793, + "orderDate": "1997-12-24T00:00:00", + "total": 191.10 + }, + { + "orderId": 10864, + "orderDate": "1998-02-02T00:00:00", + "total": 282.00 + }, + { + "orderId": 10920, + "orderDate": "1998-03-03T00:00:00", + "total": 390.00 + }, + { + "orderId": 10953, + "orderDate": "1998-03-16T00:00:00", + "total": 4441.25 + }, + { + "orderId": 11016, + "orderDate": "1998-04-10T00:00:00", + "total": 491.50 + } + ] + }, + { + "customerId": "BERGS", + "companyName": "Berglunds snabbk\u00f6p", + "address": "Berguvsv\u00e4gen 8", + "city": "Lule\u00e5", + "postalCode": "S-958 22", + "country": "Sweden", + "phone": "0921-12 34 65", + "fax": "0921-12 34 67", + "orders": [ + { + "orderId": 10278, + "orderDate": "1996-08-12T00:00:00", + "total": 1488.80 + }, + { + "orderId": 10280, + "orderDate": "1996-08-14T00:00:00", + "total": 613.20 + }, + { + "orderId": 10384, + "orderDate": "1996-12-16T00:00:00", + "total": 2222.40 + }, + { + "orderId": 10444, + "orderDate": "1997-02-12T00:00:00", + "total": 1031.70 + }, + { + "orderId": 10445, + "orderDate": "1997-02-13T00:00:00", + "total": 174.90 + }, + { + "orderId": 10524, + "orderDate": "1997-05-01T00:00:00", + "total": 3192.65 + }, + { + "orderId": 10572, + "orderDate": "1997-06-18T00:00:00", + "total": 1501.08 + }, + { + "orderId": 10626, + "orderDate": "1997-08-11T00:00:00", + "total": 1503.60 + }, + { + "orderId": 10654, + "orderDate": "1997-09-02T00:00:00", + "total": 601.83 + }, + { + "orderId": 10672, + "orderDate": "1997-09-17T00:00:00", + "total": 3815.25 + }, + { + "orderId": 10689, + "orderDate": "1997-10-01T00:00:00", + "total": 472.50 + }, + { + "orderId": 10733, + "orderDate": "1997-11-07T00:00:00", + "total": 1459.00 + }, + { + "orderId": 10778, + "orderDate": "1997-12-16T00:00:00", + "total": 96.50 + }, + { + "orderId": 10837, + "orderDate": "1998-01-16T00:00:00", + "total": 1064.50 + }, + { + "orderId": 10857, + "orderDate": "1998-01-28T00:00:00", + "total": 2048.21 + }, + { + "orderId": 10866, + "orderDate": "1998-02-03T00:00:00", + "total": 1096.20 + }, + { + "orderId": 10875, + "orderDate": "1998-02-06T00:00:00", + "total": 709.55 + }, + { + "orderId": 10924, + "orderDate": "1998-03-04T00:00:00", + "total": 1835.70 + } + ] + }, + { + "customerId": "BLAUS", + "companyName": "Blauer See Delikatessen", + "address": "Forsterstr. 57", + "city": "Mannheim", + "postalCode": "68306", + "country": "Germany", + "phone": "0621-08460", + "fax": "0621-08924", + "orders": [ + { + "orderId": 10501, + "orderDate": "1997-04-09T00:00:00", + "total": 149.00 + }, + { + "orderId": 10509, + "orderDate": "1997-04-17T00:00:00", + "total": 136.80 + }, + { + "orderId": 10582, + "orderDate": "1997-06-27T00:00:00", + "total": 330.00 + }, + { + "orderId": 10614, + "orderDate": "1997-07-29T00:00:00", + "total": 464.00 + }, + { + "orderId": 10853, + "orderDate": "1998-01-27T00:00:00", + "total": 625.00 + }, + { + "orderId": 10956, + "orderDate": "1998-03-17T00:00:00", + "total": 677.00 + }, + { + "orderId": 11058, + "orderDate": "1998-04-29T00:00:00", + "total": 858.00 + } + ] + }, + { + "customerId": "BLONP", + "companyName": "Blondel p\u00e8re et fils", + "address": "24, place Kl\u00e9ber", + "city": "Strasbourg", + "postalCode": "67000", + "country": "France", + "phone": "88.60.15.31", + "fax": "88.60.15.32", + "orders": [ + { + "orderId": 10265, + "orderDate": "1996-07-25T00:00:00", + "total": 1176.00 + }, + { + "orderId": 10297, + "orderDate": "1996-09-04T00:00:00", + "total": 1420.00 + }, + { + "orderId": 10360, + "orderDate": "1996-11-22T00:00:00", + "total": 7390.20 + }, + { + "orderId": 10436, + "orderDate": "1997-02-05T00:00:00", + "total": 1994.52 + }, + { + "orderId": 10449, + "orderDate": "1997-02-18T00:00:00", + "total": 1838.20 + }, + { + "orderId": 10559, + "orderDate": "1997-06-05T00:00:00", + "total": 520.41 + }, + { + "orderId": 10566, + "orderDate": "1997-06-12T00:00:00", + "total": 1761.00 + }, + { + "orderId": 10584, + "orderDate": "1997-06-30T00:00:00", + "total": 593.75 + }, + { + "orderId": 10628, + "orderDate": "1997-08-12T00:00:00", + "total": 450.00 + }, + { + "orderId": 10679, + "orderDate": "1997-09-23T00:00:00", + "total": 660.00 + }, + { + "orderId": 10826, + "orderDate": "1998-01-12T00:00:00", + "total": 730.00 + } + ] + }, + { + "customerId": "BOLID", + "companyName": "B\u00f3lido Comidas preparadas", + "address": "C\/ Araquil, 67", + "city": "Madrid", + "postalCode": "28023", + "country": "Spain", + "phone": "(91) 555 22 82", + "fax": "(91) 555 91 99", + "orders": [ + { + "orderId": 10326, + "orderDate": "1996-10-10T00:00:00", + "total": 982.00 + }, + { + "orderId": 10801, + "orderDate": "1997-12-29T00:00:00", + "total": 3026.85 + }, + { + "orderId": 10970, + "orderDate": "1998-03-24T00:00:00", + "total": 224.00 + } + ] + }, + { + "customerId": "BONAP", + "companyName": "Bon app'", + "address": "12, rue des Bouchers", + "city": "Marseille", + "postalCode": "13008", + "country": "France", + "phone": "91.24.45.40", + "fax": "91.24.45.41", + "orders": [ + { + "orderId": 10331, + "orderDate": "1996-10-16T00:00:00", + "total": 88.50 + }, + { + "orderId": 10340, + "orderDate": "1996-10-29T00:00:00", + "total": 2436.18 + }, + { + "orderId": 10362, + "orderDate": "1996-11-25T00:00:00", + "total": 1549.60 + }, + { + "orderId": 10470, + "orderDate": "1997-03-11T00:00:00", + "total": 1820.80 + }, + { + "orderId": 10511, + "orderDate": "1997-04-18T00:00:00", + "total": 2550.00 + }, + { + "orderId": 10525, + "orderDate": "1997-05-02T00:00:00", + "total": 818.40 + }, + { + "orderId": 10663, + "orderDate": "1997-09-10T00:00:00", + "total": 1930.40 + }, + { + "orderId": 10715, + "orderDate": "1997-10-23T00:00:00", + "total": 1296.00 + }, + { + "orderId": 10730, + "orderDate": "1997-11-05T00:00:00", + "total": 484.26 + }, + { + "orderId": 10732, + "orderDate": "1997-11-06T00:00:00", + "total": 360.00 + }, + { + "orderId": 10755, + "orderDate": "1997-11-26T00:00:00", + "total": 1948.50 + }, + { + "orderId": 10827, + "orderDate": "1998-01-12T00:00:00", + "total": 843.00 + }, + { + "orderId": 10871, + "orderDate": "1998-02-05T00:00:00", + "total": 1979.23 + }, + { + "orderId": 10876, + "orderDate": "1998-02-09T00:00:00", + "total": 917.00 + }, + { + "orderId": 10932, + "orderDate": "1998-03-06T00:00:00", + "total": 1788.63 + }, + { + "orderId": 10940, + "orderDate": "1998-03-11T00:00:00", + "total": 360.00 + }, + { + "orderId": 11076, + "orderDate": "1998-05-06T00:00:00", + "total": 792.75 + } + ] + }, + { + "customerId": "BOTTM", + "companyName": "Bottom-Dollar Markets", + "address": "23 Tsawassen Blvd.", + "city": "Tsawassen", + "region": "BC", + "postalCode": "T2F 8M4", + "country": "Canada", + "phone": "(604) 555-4729", + "fax": "(604) 555-3745", + "orders": [ + { + "orderId": 10389, + "orderDate": "1996-12-20T00:00:00", + "total": 1832.80 + }, + { + "orderId": 10410, + "orderDate": "1997-01-10T00:00:00", + "total": 802.00 + }, + { + "orderId": 10411, + "orderDate": "1997-01-10T00:00:00", + "total": 966.80 + }, + { + "orderId": 10431, + "orderDate": "1997-01-30T00:00:00", + "total": 1892.25 + }, + { + "orderId": 10492, + "orderDate": "1997-04-01T00:00:00", + "total": 851.20 + }, + { + "orderId": 10742, + "orderDate": "1997-11-14T00:00:00", + "total": 3118.00 + }, + { + "orderId": 10918, + "orderDate": "1998-03-02T00:00:00", + "total": 1447.50 + }, + { + "orderId": 10944, + "orderDate": "1998-03-12T00:00:00", + "total": 1025.32 + }, + { + "orderId": 10949, + "orderDate": "1998-03-13T00:00:00", + "total": 4422.00 + }, + { + "orderId": 10975, + "orderDate": "1998-03-25T00:00:00", + "total": 717.50 + }, + { + "orderId": 10982, + "orderDate": "1998-03-27T00:00:00", + "total": 1014.00 + }, + { + "orderId": 11027, + "orderDate": "1998-04-16T00:00:00", + "total": 877.72 + }, + { + "orderId": 11045, + "orderDate": "1998-04-23T00:00:00", + "total": 1309.50 + }, + { + "orderId": 11048, + "orderDate": "1998-04-24T00:00:00", + "total": 525.00 + } + ] + }, + { + "customerId": "BSBEV", + "companyName": "B's Beverages", + "address": "Fauntleroy Circus", + "city": "London", + "postalCode": "EC2 5NT", + "country": "UK", + "phone": "(171) 555-1212", + "orders": [ + { + "orderId": 10289, + "orderDate": "1996-08-26T00:00:00", + "total": 479.40 + }, + { + "orderId": 10471, + "orderDate": "1997-03-11T00:00:00", + "total": 1328.00 + }, + { + "orderId": 10484, + "orderDate": "1997-03-24T00:00:00", + "total": 386.20 + }, + { + "orderId": 10538, + "orderDate": "1997-05-15T00:00:00", + "total": 139.80 + }, + { + "orderId": 10539, + "orderDate": "1997-05-16T00:00:00", + "total": 355.50 + }, + { + "orderId": 10578, + "orderDate": "1997-06-24T00:00:00", + "total": 477.00 + }, + { + "orderId": 10599, + "orderDate": "1997-07-15T00:00:00", + "total": 493.00 + }, + { + "orderId": 10943, + "orderDate": "1998-03-11T00:00:00", + "total": 711.00 + }, + { + "orderId": 10947, + "orderDate": "1998-03-13T00:00:00", + "total": 220.00 + }, + { + "orderId": 11023, + "orderDate": "1998-04-14T00:00:00", + "total": 1500.00 + } + ] + }, + { + "customerId": "CACTU", + "companyName": "Cactus Comidas para llevar", + "address": "Cerrito 333", + "city": "Buenos Aires", + "postalCode": "1010", + "country": "Argentina", + "phone": "(1) 135-5555", + "fax": "(1) 135-4892", + "orders": [ + { + "orderId": 10521, + "orderDate": "1997-04-29T00:00:00", + "total": 225.50 + }, + { + "orderId": 10782, + "orderDate": "1997-12-17T00:00:00", + "total": 12.50 + }, + { + "orderId": 10819, + "orderDate": "1998-01-07T00:00:00", + "total": 477.00 + }, + { + "orderId": 10881, + "orderDate": "1998-02-11T00:00:00", + "total": 150.00 + }, + { + "orderId": 10937, + "orderDate": "1998-03-10T00:00:00", + "total": 644.80 + }, + { + "orderId": 11054, + "orderDate": "1998-04-28T00:00:00", + "total": 305.00 + } + ] + }, + { + "customerId": "CENTC", + "companyName": "Centro comercial Moctezuma", + "address": "Sierras de Granada 9993", + "city": "M\u00e9xico D.F.", + "postalCode": "05022", + "country": "Mexico", + "phone": "(5) 555-3392", + "fax": "(5) 555-7293", + "orders": [ + { + "orderId": 10259, + "orderDate": "1996-07-18T00:00:00", + "total": 100.80 + } + ] + }, + { + "customerId": "CHOPS", + "companyName": "Chop-suey Chinese", + "address": "Hauptstr. 29", + "city": "Bern", + "postalCode": "3012", + "country": "Switzerland", + "phone": "0452-076545", + "orders": [ + { + "orderId": 10254, + "orderDate": "1996-07-11T00:00:00", + "total": 556.62 + }, + { + "orderId": 10370, + "orderDate": "1996-12-03T00:00:00", + "total": 1117.60 + }, + { + "orderId": 10519, + "orderDate": "1997-04-28T00:00:00", + "total": 2314.20 + }, + { + "orderId": 10731, + "orderDate": "1997-11-06T00:00:00", + "total": 1890.50 + }, + { + "orderId": 10746, + "orderDate": "1997-11-19T00:00:00", + "total": 2311.70 + }, + { + "orderId": 10966, + "orderDate": "1998-03-20T00:00:00", + "total": 1098.46 + }, + { + "orderId": 11029, + "orderDate": "1998-04-16T00:00:00", + "total": 1286.80 + }, + { + "orderId": 11041, + "orderDate": "1998-04-22T00:00:00", + "total": 1773.00 + } + ] + }, + { + "customerId": "COMMI", + "companyName": "Com\u00e9rcio Mineiro", + "address": "Av. dos Lus\u00edadas, 23", + "city": "S\u00e3o Paulo", + "region": "SP", + "postalCode": "05432-043", + "country": "Brazil", + "phone": "(11) 555-7647", + "orders": [ + { + "orderId": 10290, + "orderDate": "1996-08-27T00:00:00", + "total": 2169.00 + }, + { + "orderId": 10466, + "orderDate": "1997-03-06T00:00:00", + "total": 216.00 + }, + { + "orderId": 10494, + "orderDate": "1997-04-02T00:00:00", + "total": 912.00 + }, + { + "orderId": 10969, + "orderDate": "1998-03-23T00:00:00", + "total": 108.00 + }, + { + "orderId": 11042, + "orderDate": "1998-04-22T00:00:00", + "total": 405.75 + } + ] + }, + { + "customerId": "CONSH", + "companyName": "Consolidated Holdings", + "address": "Berkeley Gardens, 12 Brewery ", + "city": "London", + "postalCode": "WX1 6LT", + "country": "UK", + "phone": "(171) 555-2282", + "fax": "(171) 555-9199", + "orders": [ + { + "orderId": 10435, + "orderDate": "1997-02-04T00:00:00", + "total": 631.60 + }, + { + "orderId": 10462, + "orderDate": "1997-03-03T00:00:00", + "total": 156.00 + }, + { + "orderId": 10848, + "orderDate": "1998-01-23T00:00:00", + "total": 931.50 + } + ] + }, + { + "customerId": "DRACD", + "companyName": "Drachenblut Delikatessen", + "address": "Walserweg 21", + "city": "Aachen", + "postalCode": "52066", + "country": "Germany", + "phone": "0241-039123", + "fax": "0241-059428", + "orders": [ + { + "orderId": 10363, + "orderDate": "1996-11-26T00:00:00", + "total": 447.20 + }, + { + "orderId": 10391, + "orderDate": "1996-12-23T00:00:00", + "total": 86.40 + }, + { + "orderId": 10797, + "orderDate": "1997-12-25T00:00:00", + "total": 420.00 + }, + { + "orderId": 10825, + "orderDate": "1998-01-09T00:00:00", + "total": 1030.76 + }, + { + "orderId": 11036, + "orderDate": "1998-04-20T00:00:00", + "total": 1692.00 + }, + { + "orderId": 11067, + "orderDate": "1998-05-04T00:00:00", + "total": 86.85 + } + ] + }, + { + "customerId": "DUMON", + "companyName": "Du monde entier", + "address": "67, rue des Cinquante Otages", + "city": "Nantes", + "postalCode": "44000", + "country": "France", + "phone": "40.67.88.88", + "fax": "40.67.89.89", + "orders": [ + { + "orderId": 10311, + "orderDate": "1996-09-20T00:00:00", + "total": 268.80 + }, + { + "orderId": 10609, + "orderDate": "1997-07-24T00:00:00", + "total": 424.00 + }, + { + "orderId": 10683, + "orderDate": "1997-09-26T00:00:00", + "total": 63.00 + }, + { + "orderId": 10890, + "orderDate": "1998-02-16T00:00:00", + "total": 860.10 + } + ] + }, + { + "customerId": "EASTC", + "companyName": "Eastern Connection", + "address": "35 King George", + "city": "London", + "postalCode": "WX3 6FW", + "country": "UK", + "phone": "(171) 555-0297", + "fax": "(171) 555-3373", + "orders": [ + { + "orderId": 10364, + "orderDate": "1996-11-26T00:00:00", + "total": 950.00 + }, + { + "orderId": 10400, + "orderDate": "1997-01-01T00:00:00", + "total": 3063.00 + }, + { + "orderId": 10532, + "orderDate": "1997-05-09T00:00:00", + "total": 796.35 + }, + { + "orderId": 10726, + "orderDate": "1997-11-03T00:00:00", + "total": 655.00 + }, + { + "orderId": 10987, + "orderDate": "1998-03-31T00:00:00", + "total": 2772.00 + }, + { + "orderId": 11024, + "orderDate": "1998-04-15T00:00:00", + "total": 1966.81 + }, + { + "orderId": 11047, + "orderDate": "1998-04-24T00:00:00", + "total": 817.88 + }, + { + "orderId": 11056, + "orderDate": "1998-04-28T00:00:00", + "total": 3740.00 + } + ] + }, + { + "customerId": "ERNSH", + "companyName": "Ernst Handel", + "address": "Kirchgasse 6", + "city": "Graz", + "postalCode": "8010", + "country": "Austria", + "phone": "7675-3425", + "fax": "7675-3426", + "orders": [ + { + "orderId": 10258, + "orderDate": "1996-07-17T00:00:00", + "total": 1614.88 + }, + { + "orderId": 10263, + "orderDate": "1996-07-23T00:00:00", + "total": 1873.80 + }, + { + "orderId": 10351, + "orderDate": "1996-11-11T00:00:00", + "total": 5398.72 + }, + { + "orderId": 10368, + "orderDate": "1996-11-29T00:00:00", + "total": 1689.78 + }, + { + "orderId": 10382, + "orderDate": "1996-12-13T00:00:00", + "total": 2900.00 + }, + { + "orderId": 10390, + "orderDate": "1996-12-23T00:00:00", + "total": 2090.88 + }, + { + "orderId": 10402, + "orderDate": "1997-01-02T00:00:00", + "total": 2713.50 + }, + { + "orderId": 10403, + "orderDate": "1997-01-03T00:00:00", + "total": 855.02 + }, + { + "orderId": 10430, + "orderDate": "1997-01-30T00:00:00", + "total": 4899.20 + }, + { + "orderId": 10442, + "orderDate": "1997-02-11T00:00:00", + "total": 1792.00 + }, + { + "orderId": 10514, + "orderDate": "1997-04-22T00:00:00", + "total": 8623.45 + }, + { + "orderId": 10571, + "orderDate": "1997-06-17T00:00:00", + "total": 550.59 + }, + { + "orderId": 10595, + "orderDate": "1997-07-10T00:00:00", + "total": 4725.00 + }, + { + "orderId": 10633, + "orderDate": "1997-08-15T00:00:00", + "total": 5510.59 + }, + { + "orderId": 10667, + "orderDate": "1997-09-12T00:00:00", + "total": 1536.80 + }, + { + "orderId": 10698, + "orderDate": "1997-10-09T00:00:00", + "total": 3436.44 + }, + { + "orderId": 10764, + "orderDate": "1997-12-03T00:00:00", + "total": 2286.00 + }, + { + "orderId": 10771, + "orderDate": "1997-12-10T00:00:00", + "total": 344.00 + }, + { + "orderId": 10773, + "orderDate": "1997-12-11T00:00:00", + "total": 2030.40 + }, + { + "orderId": 10776, + "orderDate": "1997-12-15T00:00:00", + "total": 6635.28 + }, + { + "orderId": 10795, + "orderDate": "1997-12-24T00:00:00", + "total": 2158.00 + }, + { + "orderId": 10836, + "orderDate": "1998-01-16T00:00:00", + "total": 4705.50 + }, + { + "orderId": 10854, + "orderDate": "1998-01-27T00:00:00", + "total": 2966.50 + }, + { + "orderId": 10895, + "orderDate": "1998-02-18T00:00:00", + "total": 6379.40 + }, + { + "orderId": 10968, + "orderDate": "1998-03-23T00:00:00", + "total": 1408.00 + }, + { + "orderId": 10979, + "orderDate": "1998-03-26T00:00:00", + "total": 4813.50 + }, + { + "orderId": 10990, + "orderDate": "1998-04-01T00:00:00", + "total": 4288.85 + }, + { + "orderId": 11008, + "orderDate": "1998-04-08T00:00:00", + "total": 4680.90 + }, + { + "orderId": 11017, + "orderDate": "1998-04-13T00:00:00", + "total": 6750.00 + }, + { + "orderId": 11072, + "orderDate": "1998-05-05T00:00:00", + "total": 5218.00 + } + ] + }, + { + "customerId": "FAMIA", + "companyName": "Familia Arquibaldo", + "address": "Rua Or\u00f3s, 92", + "city": "S\u00e3o Paulo", + "region": "SP", + "postalCode": "05442-030", + "country": "Brazil", + "phone": "(11) 555-9857", + "orders": [ + { + "orderId": 10347, + "orderDate": "1996-11-06T00:00:00", + "total": 814.42 + }, + { + "orderId": 10386, + "orderDate": "1996-12-18T00:00:00", + "total": 166.00 + }, + { + "orderId": 10414, + "orderDate": "1997-01-14T00:00:00", + "total": 224.83 + }, + { + "orderId": 10512, + "orderDate": "1997-04-21T00:00:00", + "total": 525.30 + }, + { + "orderId": 10581, + "orderDate": "1997-06-26T00:00:00", + "total": 310.00 + }, + { + "orderId": 10650, + "orderDate": "1997-08-29T00:00:00", + "total": 1779.20 + }, + { + "orderId": 10725, + "orderDate": "1997-10-31T00:00:00", + "total": 287.80 + } + ] + }, + { + "customerId": "FISSA", + "companyName": "FISSA Fabrica Inter. Salchichas S.A.", + "address": "C\/ Moralzarzal, 86", + "city": "Madrid", + "postalCode": "28034", + "country": "Spain", + "phone": "(91) 555 94 44", + "fax": "(91) 555 55 93" + }, + { + "customerId": "FOLIG", + "companyName": "Folies gourmandes", + "address": "184, chauss\u00e9e de Tournai", + "city": "Lille", + "postalCode": "59000", + "country": "France", + "phone": "20.16.10.16", + "fax": "20.16.10.17", + "orders": [ + { + "orderId": 10408, + "orderDate": "1997-01-08T00:00:00", + "total": 1622.40 + }, + { + "orderId": 10480, + "orderDate": "1997-03-20T00:00:00", + "total": 756.00 + }, + { + "orderId": 10634, + "orderDate": "1997-08-15T00:00:00", + "total": 4985.50 + }, + { + "orderId": 10763, + "orderDate": "1997-12-03T00:00:00", + "total": 616.00 + }, + { + "orderId": 10789, + "orderDate": "1997-12-22T00:00:00", + "total": 3687.00 + } + ] + }, + { + "customerId": "FOLKO", + "companyName": "Folk och f\u00e4 HB", + "address": "\u00c5kergatan 24", + "city": "Br\u00e4cke", + "postalCode": "S-844 67", + "country": "Sweden", + "phone": "0695-34 67 21", + "orders": [ + { + "orderId": 10264, + "orderDate": "1996-07-24T00:00:00", + "total": 695.62 + }, + { + "orderId": 10327, + "orderDate": "1996-10-11T00:00:00", + "total": 1810.00 + }, + { + "orderId": 10378, + "orderDate": "1996-12-10T00:00:00", + "total": 103.20 + }, + { + "orderId": 10434, + "orderDate": "1997-02-03T00:00:00", + "total": 321.12 + }, + { + "orderId": 10460, + "orderDate": "1997-02-28T00:00:00", + "total": 176.10 + }, + { + "orderId": 10533, + "orderDate": "1997-05-12T00:00:00", + "total": 2222.20 + }, + { + "orderId": 10561, + "orderDate": "1997-06-06T00:00:00", + "total": 2844.50 + }, + { + "orderId": 10703, + "orderDate": "1997-10-14T00:00:00", + "total": 2545.00 + }, + { + "orderId": 10762, + "orderDate": "1997-12-02T00:00:00", + "total": 4337.00 + }, + { + "orderId": 10774, + "orderDate": "1997-12-11T00:00:00", + "total": 868.75 + }, + { + "orderId": 10824, + "orderDate": "1998-01-09T00:00:00", + "total": 250.80 + }, + { + "orderId": 10880, + "orderDate": "1998-02-10T00:00:00", + "total": 1500.00 + }, + { + "orderId": 10902, + "orderDate": "1998-02-23T00:00:00", + "total": 863.43 + }, + { + "orderId": 10955, + "orderDate": "1998-03-17T00:00:00", + "total": 74.40 + }, + { + "orderId": 10977, + "orderDate": "1998-03-26T00:00:00", + "total": 2233.00 + }, + { + "orderId": 10980, + "orderDate": "1998-03-27T00:00:00", + "total": 248.00 + }, + { + "orderId": 10993, + "orderDate": "1998-04-01T00:00:00", + "total": 4895.44 + }, + { + "orderId": 11001, + "orderDate": "1998-04-06T00:00:00", + "total": 2769.00 + }, + { + "orderId": 11050, + "orderDate": "1998-04-27T00:00:00", + "total": 810.00 + } + ] + }, + { + "customerId": "FRANK", + "companyName": "Frankenversand", + "address": "Berliner Platz 43", + "city": "M\u00fcnchen", + "postalCode": "80805", + "country": "Germany", + "phone": "089-0877310", + "fax": "089-0877451", + "orders": [ + { + "orderId": 10267, + "orderDate": "1996-07-29T00:00:00", + "total": 3536.60 + }, + { + "orderId": 10337, + "orderDate": "1996-10-24T00:00:00", + "total": 2467.00 + }, + { + "orderId": 10342, + "orderDate": "1996-10-30T00:00:00", + "total": 1840.64 + }, + { + "orderId": 10396, + "orderDate": "1996-12-27T00:00:00", + "total": 1903.80 + }, + { + "orderId": 10488, + "orderDate": "1997-03-27T00:00:00", + "total": 1512.00 + }, + { + "orderId": 10560, + "orderDate": "1997-06-06T00:00:00", + "total": 1072.42 + }, + { + "orderId": 10623, + "orderDate": "1997-08-07T00:00:00", + "total": 1336.95 + }, + { + "orderId": 10653, + "orderDate": "1997-09-02T00:00:00", + "total": 1083.15 + }, + { + "orderId": 10670, + "orderDate": "1997-09-16T00:00:00", + "total": 2301.75 + }, + { + "orderId": 10675, + "orderDate": "1997-09-19T00:00:00", + "total": 1423.00 + }, + { + "orderId": 10717, + "orderDate": "1997-10-24T00:00:00", + "total": 1270.75 + }, + { + "orderId": 10791, + "orderDate": "1997-12-23T00:00:00", + "total": 1829.76 + }, + { + "orderId": 10859, + "orderDate": "1998-01-29T00:00:00", + "total": 1078.69 + }, + { + "orderId": 10929, + "orderDate": "1998-03-05T00:00:00", + "total": 1174.75 + }, + { + "orderId": 11012, + "orderDate": "1998-04-09T00:00:00", + "total": 2825.30 + } + ] + }, + { + "customerId": "FRANR", + "companyName": "France restauration", + "address": "54, rue Royale", + "city": "Nantes", + "postalCode": "44000", + "country": "France", + "phone": "40.32.21.21", + "fax": "40.32.21.20", + "orders": [ + { + "orderId": 10671, + "orderDate": "1997-09-17T00:00:00", + "total": 920.10 + }, + { + "orderId": 10860, + "orderDate": "1998-01-29T00:00:00", + "total": 519.00 + }, + { + "orderId": 10971, + "orderDate": "1998-03-24T00:00:00", + "total": 1733.06 + } + ] + }, + { + "customerId": "FRANS", + "companyName": "Franchi S.p.A.", + "address": "Via Monte Bianco 34", + "city": "Torino", + "postalCode": "10100", + "country": "Italy", + "phone": "011-4988260", + "fax": "011-4988261", + "orders": [ + { + "orderId": 10422, + "orderDate": "1997-01-22T00:00:00", + "total": 49.80 + }, + { + "orderId": 10710, + "orderDate": "1997-10-20T00:00:00", + "total": 93.50 + }, + { + "orderId": 10753, + "orderDate": "1997-11-25T00:00:00", + "total": 88.00 + }, + { + "orderId": 10807, + "orderDate": "1997-12-31T00:00:00", + "total": 18.40 + }, + { + "orderId": 11026, + "orderDate": "1998-04-15T00:00:00", + "total": 1030.00 + }, + { + "orderId": 11060, + "orderDate": "1998-04-30T00:00:00", + "total": 266.00 + } + ] + }, + { + "customerId": "FURIB", + "companyName": "Furia Bacalhau e Frutos do Mar", + "address": "Jardim das rosas n. 32", + "city": "Lisboa", + "postalCode": "1675", + "country": "Portugal", + "phone": "(1) 354-2534", + "fax": "(1) 354-2535", + "orders": [ + { + "orderId": 10328, + "orderDate": "1996-10-14T00:00:00", + "total": 1168.00 + }, + { + "orderId": 10352, + "orderDate": "1996-11-12T00:00:00", + "total": 136.30 + }, + { + "orderId": 10464, + "orderDate": "1997-03-04T00:00:00", + "total": 1609.28 + }, + { + "orderId": 10491, + "orderDate": "1997-03-31T00:00:00", + "total": 259.50 + }, + { + "orderId": 10551, + "orderDate": "1997-05-28T00:00:00", + "total": 1677.30 + }, + { + "orderId": 10604, + "orderDate": "1997-07-18T00:00:00", + "total": 230.85 + }, + { + "orderId": 10664, + "orderDate": "1997-09-10T00:00:00", + "total": 1288.39 + }, + { + "orderId": 10963, + "orderDate": "1998-03-19T00:00:00", + "total": 57.80 + } + ] + }, + { + "customerId": "GALED", + "companyName": "Galer\u00eda del gastr\u00f3nomo", + "address": "Rambla de Catalu\u00f1a, 23", + "city": "Barcelona", + "postalCode": "08022", + "country": "Spain", + "phone": "(93) 203 4560", + "fax": "(93) 203 4561", + "orders": [ + { + "orderId": 10366, + "orderDate": "1996-11-28T00:00:00", + "total": 136.00 + }, + { + "orderId": 10426, + "orderDate": "1997-01-27T00:00:00", + "total": 338.20 + }, + { + "orderId": 10568, + "orderDate": "1997-06-13T00:00:00", + "total": 155.00 + }, + { + "orderId": 10887, + "orderDate": "1998-02-13T00:00:00", + "total": 70.00 + }, + { + "orderId": 10928, + "orderDate": "1998-03-05T00:00:00", + "total": 137.50 + } + ] + }, + { + "customerId": "GODOS", + "companyName": "Godos Cocina T\u00edpica", + "address": "C\/ Romero, 33", + "city": "Sevilla", + "postalCode": "41101", + "country": "Spain", + "phone": "(95) 555 82 82", + "orders": [ + { + "orderId": 10303, + "orderDate": "1996-09-11T00:00:00", + "total": 1117.80 + }, + { + "orderId": 10550, + "orderDate": "1997-05-28T00:00:00", + "total": 683.30 + }, + { + "orderId": 10629, + "orderDate": "1997-08-12T00:00:00", + "total": 2775.05 + }, + { + "orderId": 10872, + "orderDate": "1998-02-05T00:00:00", + "total": 2058.46 + }, + { + "orderId": 10874, + "orderDate": "1998-02-06T00:00:00", + "total": 310.00 + }, + { + "orderId": 10888, + "orderDate": "1998-02-16T00:00:00", + "total": 605.00 + }, + { + "orderId": 10911, + "orderDate": "1998-02-26T00:00:00", + "total": 858.00 + }, + { + "orderId": 10948, + "orderDate": "1998-03-13T00:00:00", + "total": 2362.25 + }, + { + "orderId": 11009, + "orderDate": "1998-04-08T00:00:00", + "total": 616.50 + }, + { + "orderId": 11037, + "orderDate": "1998-04-21T00:00:00", + "total": 60.00 + } + ] + }, + { + "customerId": "GOURL", + "companyName": "Gourmet Lanchonetes", + "address": "Av. Brasil, 442", + "city": "Campinas", + "region": "SP", + "postalCode": "04876-786", + "country": "Brazil", + "phone": "(11) 555-9482", + "orders": [ + { + "orderId": 10423, + "orderDate": "1997-01-23T00:00:00", + "total": 1020.00 + }, + { + "orderId": 10652, + "orderDate": "1997-09-01T00:00:00", + "total": 318.84 + }, + { + "orderId": 10685, + "orderDate": "1997-09-29T00:00:00", + "total": 801.10 + }, + { + "orderId": 10709, + "orderDate": "1997-10-17T00:00:00", + "total": 3424.00 + }, + { + "orderId": 10734, + "orderDate": "1997-11-07T00:00:00", + "total": 1498.35 + }, + { + "orderId": 10777, + "orderDate": "1997-12-15T00:00:00", + "total": 224.00 + }, + { + "orderId": 10790, + "orderDate": "1997-12-22T00:00:00", + "total": 722.50 + }, + { + "orderId": 10959, + "orderDate": "1998-03-18T00:00:00", + "total": 131.75 + }, + { + "orderId": 11049, + "orderDate": "1998-04-24T00:00:00", + "total": 273.60 + } + ] + }, + { + "customerId": "GREAL", + "companyName": "Great Lakes Food Market", + "address": "2732 Baker Blvd.", + "city": "Eugene", + "region": "OR", + "postalCode": "97403", + "country": "USA", + "phone": "(503) 555-7555", + "orders": [ + { + "orderId": 10528, + "orderDate": "1997-05-06T00:00:00", + "total": 392.20 + }, + { + "orderId": 10589, + "orderDate": "1997-07-04T00:00:00", + "total": 72.00 + }, + { + "orderId": 10616, + "orderDate": "1997-07-31T00:00:00", + "total": 4807.00 + }, + { + "orderId": 10617, + "orderDate": "1997-07-31T00:00:00", + "total": 1402.50 + }, + { + "orderId": 10656, + "orderDate": "1997-09-04T00:00:00", + "total": 604.22 + }, + { + "orderId": 10681, + "orderDate": "1997-09-25T00:00:00", + "total": 1287.40 + }, + { + "orderId": 10816, + "orderDate": "1998-01-06T00:00:00", + "total": 8446.45 + }, + { + "orderId": 10936, + "orderDate": "1998-03-09T00:00:00", + "total": 456.00 + }, + { + "orderId": 11006, + "orderDate": "1998-04-07T00:00:00", + "total": 329.68 + }, + { + "orderId": 11040, + "orderDate": "1998-04-22T00:00:00", + "total": 200.00 + }, + { + "orderId": 11061, + "orderDate": "1998-04-30T00:00:00", + "total": 510.00 + } + ] + }, + { + "customerId": "GROSR", + "companyName": "GROSELLA-Restaurante", + "address": "5\u00aa Ave. Los Palos Grandes", + "city": "Caracas", + "region": "DF", + "postalCode": "1081", + "country": "Venezuela", + "phone": "(2) 283-2951", + "fax": "(2) 283-3397", + "orders": [ + { + "orderId": 10268, + "orderDate": "1996-07-30T00:00:00", + "total": 1101.20 + }, + { + "orderId": 10785, + "orderDate": "1997-12-18T00:00:00", + "total": 387.50 + } + ] + }, + { + "customerId": "HANAR", + "companyName": "Hanari Carnes", + "address": "Rua do Pa\u00e7o, 67", + "city": "Rio de Janeiro", + "region": "RJ", + "postalCode": "05454-876", + "country": "Brazil", + "phone": "(21) 555-0091", + "fax": "(21) 555-8765", + "orders": [ + { + "orderId": 10250, + "orderDate": "1996-07-08T00:00:00", + "total": 1552.60 + }, + { + "orderId": 10253, + "orderDate": "1996-07-10T00:00:00", + "total": 1444.80 + }, + { + "orderId": 10541, + "orderDate": "1997-05-19T00:00:00", + "total": 1946.52 + }, + { + "orderId": 10645, + "orderDate": "1997-08-26T00:00:00", + "total": 1535.00 + }, + { + "orderId": 10690, + "orderDate": "1997-10-02T00:00:00", + "total": 862.50 + }, + { + "orderId": 10770, + "orderDate": "1997-12-09T00:00:00", + "total": 236.25 + }, + { + "orderId": 10783, + "orderDate": "1997-12-18T00:00:00", + "total": 1442.50 + }, + { + "orderId": 10886, + "orderDate": "1998-02-13T00:00:00", + "total": 3127.50 + }, + { + "orderId": 10903, + "orderDate": "1998-02-24T00:00:00", + "total": 932.05 + }, + { + "orderId": 10922, + "orderDate": "1998-03-03T00:00:00", + "total": 742.50 + }, + { + "orderId": 10925, + "orderDate": "1998-03-04T00:00:00", + "total": 475.15 + }, + { + "orderId": 10981, + "orderDate": "1998-03-27T00:00:00", + "total": 15810.00 + }, + { + "orderId": 11022, + "orderDate": "1998-04-14T00:00:00", + "total": 1402.00 + }, + { + "orderId": 11052, + "orderDate": "1998-04-27T00:00:00", + "total": 1332.00 + } + ] + }, + { + "customerId": "HILAA", + "companyName": "HILARI\u00d3N-Abastos", + "address": "Carrera 22 con Ave. Carlos Soublette #8-35", + "city": "San Crist\u00f3bal", + "region": "T\u00e1chira", + "postalCode": "5022", + "country": "Venezuela", + "phone": "(5) 555-1340", + "fax": "(5) 555-1948", + "orders": [ + { + "orderId": 10257, + "orderDate": "1996-07-16T00:00:00", + "total": 1119.90 + }, + { + "orderId": 10395, + "orderDate": "1996-12-26T00:00:00", + "total": 2122.92 + }, + { + "orderId": 10476, + "orderDate": "1997-03-17T00:00:00", + "total": 180.48 + }, + { + "orderId": 10486, + "orderDate": "1997-03-26T00:00:00", + "total": 1272.00 + }, + { + "orderId": 10490, + "orderDate": "1997-03-31T00:00:00", + "total": 3163.20 + }, + { + "orderId": 10498, + "orderDate": "1997-04-07T00:00:00", + "total": 575.00 + }, + { + "orderId": 10552, + "orderDate": "1997-05-29T00:00:00", + "total": 880.50 + }, + { + "orderId": 10601, + "orderDate": "1997-07-16T00:00:00", + "total": 2285.00 + }, + { + "orderId": 10613, + "orderDate": "1997-07-29T00:00:00", + "total": 353.20 + }, + { + "orderId": 10641, + "orderDate": "1997-08-22T00:00:00", + "total": 2054.00 + }, + { + "orderId": 10705, + "orderDate": "1997-10-15T00:00:00", + "total": 378.00 + }, + { + "orderId": 10796, + "orderDate": "1997-12-25T00:00:00", + "total": 2341.36 + }, + { + "orderId": 10863, + "orderDate": "1998-02-02T00:00:00", + "total": 441.15 + }, + { + "orderId": 10901, + "orderDate": "1998-02-23T00:00:00", + "total": 934.50 + }, + { + "orderId": 10957, + "orderDate": "1998-03-18T00:00:00", + "total": 1762.70 + }, + { + "orderId": 10960, + "orderDate": "1998-03-19T00:00:00", + "total": 265.35 + }, + { + "orderId": 10976, + "orderDate": "1998-03-25T00:00:00", + "total": 912.00 + }, + { + "orderId": 11055, + "orderDate": "1998-04-28T00:00:00", + "total": 1727.50 + } + ] + }, + { + "customerId": "HUNGC", + "companyName": "Hungry Coyote Import Store", + "address": "City Center Plaza, 516 Main St.", + "city": "Elgin", + "region": "OR", + "postalCode": "97827", + "country": "USA", + "phone": "(503) 555-6874", + "fax": "(503) 555-2376", + "orders": [ + { + "orderId": 10375, + "orderDate": "1996-12-06T00:00:00", + "total": 338.00 + }, + { + "orderId": 10394, + "orderDate": "1996-12-25T00:00:00", + "total": 442.00 + }, + { + "orderId": 10415, + "orderDate": "1997-01-15T00:00:00", + "total": 102.40 + }, + { + "orderId": 10600, + "orderDate": "1997-07-16T00:00:00", + "total": 479.80 + }, + { + "orderId": 10660, + "orderDate": "1997-09-08T00:00:00", + "total": 1701.00 + } + ] + }, + { + "customerId": "HUNGO", + "companyName": "Hungry Owl All-Night Grocers", + "address": "8 Johnstown Road", + "city": "Cork", + "region": "Co. Cork", + "country": "Ireland", + "phone": "2967 542", + "fax": "2967 3333", + "orders": [ + { + "orderId": 10298, + "orderDate": "1996-09-05T00:00:00", + "total": 2645.00 + }, + { + "orderId": 10309, + "orderDate": "1996-09-19T00:00:00", + "total": 1762.00 + }, + { + "orderId": 10335, + "orderDate": "1996-10-22T00:00:00", + "total": 2036.16 + }, + { + "orderId": 10373, + "orderDate": "1996-12-05T00:00:00", + "total": 1366.40 + }, + { + "orderId": 10380, + "orderDate": "1996-12-12T00:00:00", + "total": 1313.82 + }, + { + "orderId": 10429, + "orderDate": "1997-01-29T00:00:00", + "total": 1441.38 + }, + { + "orderId": 10503, + "orderDate": "1997-04-11T00:00:00", + "total": 2048.50 + }, + { + "orderId": 10516, + "orderDate": "1997-04-24T00:00:00", + "total": 2381.05 + }, + { + "orderId": 10567, + "orderDate": "1997-06-12T00:00:00", + "total": 2519.00 + }, + { + "orderId": 10646, + "orderDate": "1997-08-27T00:00:00", + "total": 1446.00 + }, + { + "orderId": 10661, + "orderDate": "1997-09-09T00:00:00", + "total": 562.60 + }, + { + "orderId": 10687, + "orderDate": "1997-09-30T00:00:00", + "total": 4960.90 + }, + { + "orderId": 10701, + "orderDate": "1997-10-13T00:00:00", + "total": 2864.50 + }, + { + "orderId": 10712, + "orderDate": "1997-10-21T00:00:00", + "total": 1233.48 + }, + { + "orderId": 10736, + "orderDate": "1997-11-11T00:00:00", + "total": 997.00 + }, + { + "orderId": 10897, + "orderDate": "1998-02-19T00:00:00", + "total": 10835.24 + }, + { + "orderId": 10912, + "orderDate": "1998-02-26T00:00:00", + "total": 6200.55 + }, + { + "orderId": 10985, + "orderDate": "1998-03-30T00:00:00", + "total": 2023.38 + }, + { + "orderId": 11063, + "orderDate": "1998-04-30T00:00:00", + "total": 1342.95 + } + ] + }, + { + "customerId": "ISLAT", + "companyName": "Island Trading", + "address": "Garden House, Crowther Way", + "city": "Cowes", + "region": "Isle of Wight", + "postalCode": "PO31 7PJ", + "country": "UK", + "phone": "(198) 555-8888", + "orders": [ + { + "orderId": 10315, + "orderDate": "1996-09-26T00:00:00", + "total": 516.80 + }, + { + "orderId": 10318, + "orderDate": "1996-10-01T00:00:00", + "total": 240.40 + }, + { + "orderId": 10321, + "orderDate": "1996-10-03T00:00:00", + "total": 144.00 + }, + { + "orderId": 10473, + "orderDate": "1997-03-13T00:00:00", + "total": 230.40 + }, + { + "orderId": 10621, + "orderDate": "1997-08-05T00:00:00", + "total": 758.50 + }, + { + "orderId": 10674, + "orderDate": "1997-09-18T00:00:00", + "total": 45.00 + }, + { + "orderId": 10749, + "orderDate": "1997-11-20T00:00:00", + "total": 1080.00 + }, + { + "orderId": 10798, + "orderDate": "1997-12-26T00:00:00", + "total": 446.60 + }, + { + "orderId": 10829, + "orderDate": "1998-01-13T00:00:00", + "total": 1764.00 + }, + { + "orderId": 10933, + "orderDate": "1998-03-06T00:00:00", + "total": 920.60 + } + ] + }, + { + "customerId": "KOENE", + "companyName": "K\u00f6niglich Essen", + "address": "Maubelstr. 90", + "city": "Brandenburg", + "postalCode": "14776", + "country": "Germany", + "phone": "0555-09876", + "orders": [ + { + "orderId": 10323, + "orderDate": "1996-10-07T00:00:00", + "total": 164.40 + }, + { + "orderId": 10325, + "orderDate": "1996-10-09T00:00:00", + "total": 1497.00 + }, + { + "orderId": 10456, + "orderDate": "1997-02-25T00:00:00", + "total": 557.60 + }, + { + "orderId": 10457, + "orderDate": "1997-02-25T00:00:00", + "total": 1584.00 + }, + { + "orderId": 10468, + "orderDate": "1997-03-07T00:00:00", + "total": 717.60 + }, + { + "orderId": 10506, + "orderDate": "1997-04-15T00:00:00", + "total": 415.80 + }, + { + "orderId": 10542, + "orderDate": "1997-05-20T00:00:00", + "total": 469.11 + }, + { + "orderId": 10630, + "orderDate": "1997-08-13T00:00:00", + "total": 903.60 + }, + { + "orderId": 10718, + "orderDate": "1997-10-27T00:00:00", + "total": 3463.00 + }, + { + "orderId": 10799, + "orderDate": "1997-12-26T00:00:00", + "total": 1553.50 + }, + { + "orderId": 10817, + "orderDate": "1998-01-06T00:00:00", + "total": 10952.84 + }, + { + "orderId": 10849, + "orderDate": "1998-01-23T00:00:00", + "total": 967.82 + }, + { + "orderId": 10893, + "orderDate": "1998-02-18T00:00:00", + "total": 5502.11 + }, + { + "orderId": 11028, + "orderDate": "1998-04-16T00:00:00", + "total": 2160.00 + } + ] + }, + { + "customerId": "LACOR", + "companyName": "La corne d'abondance", + "address": "67, avenue de l'Europe", + "city": "Versailles", + "postalCode": "78000", + "country": "France", + "phone": "30.59.84.10", + "fax": "30.59.85.11", + "orders": [ + { + "orderId": 10858, + "orderDate": "1998-01-29T00:00:00", + "total": 649.00 + }, + { + "orderId": 10927, + "orderDate": "1998-03-05T00:00:00", + "total": 800.00 + }, + { + "orderId": 10972, + "orderDate": "1998-03-24T00:00:00", + "total": 251.50 + }, + { + "orderId": 10973, + "orderDate": "1998-03-24T00:00:00", + "total": 291.55 + } + ] + }, + { + "customerId": "LAMAI", + "companyName": "La maison d'Asie", + "address": "1 rue Alsace-Lorraine", + "city": "Toulouse", + "postalCode": "31000", + "country": "France", + "phone": "61.77.61.10", + "fax": "61.77.61.11", + "orders": [ + { + "orderId": 10350, + "orderDate": "1996-11-11T00:00:00", + "total": 642.06 + }, + { + "orderId": 10358, + "orderDate": "1996-11-20T00:00:00", + "total": 429.40 + }, + { + "orderId": 10371, + "orderDate": "1996-12-03T00:00:00", + "total": 72.96 + }, + { + "orderId": 10413, + "orderDate": "1997-01-14T00:00:00", + "total": 2123.20 + }, + { + "orderId": 10425, + "orderDate": "1997-01-24T00:00:00", + "total": 360.00 + }, + { + "orderId": 10454, + "orderDate": "1997-02-21T00:00:00", + "total": 331.20 + }, + { + "orderId": 10493, + "orderDate": "1997-04-02T00:00:00", + "total": 608.40 + }, + { + "orderId": 10500, + "orderDate": "1997-04-09T00:00:00", + "total": 523.26 + }, + { + "orderId": 10610, + "orderDate": "1997-07-25T00:00:00", + "total": 299.25 + }, + { + "orderId": 10631, + "orderDate": "1997-08-14T00:00:00", + "total": 55.80 + }, + { + "orderId": 10787, + "orderDate": "1997-12-19T00:00:00", + "total": 2622.76 + }, + { + "orderId": 10832, + "orderDate": "1998-01-14T00:00:00", + "total": 475.11 + }, + { + "orderId": 10923, + "orderDate": "1998-03-03T00:00:00", + "total": 748.80 + }, + { + "orderId": 11051, + "orderDate": "1998-04-27T00:00:00", + "total": 36.00 + } + ] + }, + { + "customerId": "LAUGB", + "companyName": "Laughing Bacchus Wine Cellars", + "address": "1900 Oak St.", + "city": "Vancouver", + "region": "BC", + "postalCode": "V3F 2K1", + "country": "Canada", + "phone": "(604) 555-3392", + "fax": "(604) 555-7293", + "orders": [ + { + "orderId": 10495, + "orderDate": "1997-04-03T00:00:00", + "total": 278.00 + }, + { + "orderId": 10620, + "orderDate": "1997-08-05T00:00:00", + "total": 57.50 + }, + { + "orderId": 10810, + "orderDate": "1998-01-01T00:00:00", + "total": 187.00 + } + ] + }, + { + "customerId": "LAZYK", + "companyName": "Lazy K Kountry Store", + "address": "12 Orchestra Terrace", + "city": "Walla Walla", + "region": "WA", + "postalCode": "99362", + "country": "USA", + "phone": "(509) 555-7969", + "fax": "(509) 555-6221", + "orders": [ + { + "orderId": 10482, + "orderDate": "1997-03-21T00:00:00", + "total": 147.00 + }, + { + "orderId": 10545, + "orderDate": "1997-05-22T00:00:00", + "total": 210.00 + } + ] + }, + { + "customerId": "LEHMS", + "companyName": "Lehmanns Marktstand", + "address": "Magazinweg 7", + "city": "Frankfurt a.M. ", + "postalCode": "60528", + "country": "Germany", + "phone": "069-0245984", + "fax": "069-0245874", + "orders": [ + { + "orderId": 10279, + "orderDate": "1996-08-13T00:00:00", + "total": 351.00 + }, + { + "orderId": 10284, + "orderDate": "1996-08-19T00:00:00", + "total": 1170.38 + }, + { + "orderId": 10343, + "orderDate": "1996-10-31T00:00:00", + "total": 1584.00 + }, + { + "orderId": 10497, + "orderDate": "1997-04-04T00:00:00", + "total": 1380.60 + }, + { + "orderId": 10522, + "orderDate": "1997-04-30T00:00:00", + "total": 2318.24 + }, + { + "orderId": 10534, + "orderDate": "1997-05-12T00:00:00", + "total": 465.70 + }, + { + "orderId": 10536, + "orderDate": "1997-05-14T00:00:00", + "total": 1645.00 + }, + { + "orderId": 10557, + "orderDate": "1997-06-03T00:00:00", + "total": 1152.50 + }, + { + "orderId": 10592, + "orderDate": "1997-07-08T00:00:00", + "total": 516.47 + }, + { + "orderId": 10593, + "orderDate": "1997-07-09T00:00:00", + "total": 1994.40 + }, + { + "orderId": 10772, + "orderDate": "1997-12-10T00:00:00", + "total": 3603.22 + }, + { + "orderId": 10862, + "orderDate": "1998-01-30T00:00:00", + "total": 581.00 + }, + { + "orderId": 10891, + "orderDate": "1998-02-17T00:00:00", + "total": 368.93 + }, + { + "orderId": 10934, + "orderDate": "1998-03-09T00:00:00", + "total": 500.00 + }, + { + "orderId": 11070, + "orderDate": "1998-05-05T00:00:00", + "total": 1629.98 + } + ] + }, + { + "customerId": "LETSS", + "companyName": "Let's Stop N Shop", + "address": "87 Polk St. Suite 5", + "city": "San Francisco", + "region": "CA", + "postalCode": "94117", + "country": "USA", + "phone": "(415) 555-5938", + "orders": [ + { + "orderId": 10579, + "orderDate": "1997-06-25T00:00:00", + "total": 317.75 + }, + { + "orderId": 10719, + "orderDate": "1997-10-27T00:00:00", + "total": 844.25 + }, + { + "orderId": 10735, + "orderDate": "1997-11-10T00:00:00", + "total": 536.40 + }, + { + "orderId": 10884, + "orderDate": "1998-02-12T00:00:00", + "total": 1378.07 + } + ] + }, + { + "customerId": "LILAS", + "companyName": "LILA-Supermercado", + "address": "Carrera 52 con Ave. Bol\u00edvar #65-98 Llano Largo", + "city": "Barquisimeto", + "region": "Lara", + "postalCode": "3508", + "country": "Venezuela", + "phone": "(9) 331-6954", + "fax": "(9) 331-7256", + "orders": [ + { + "orderId": 10283, + "orderDate": "1996-08-16T00:00:00", + "total": 1414.80 + }, + { + "orderId": 10296, + "orderDate": "1996-09-03T00:00:00", + "total": 1050.60 + }, + { + "orderId": 10330, + "orderDate": "1996-10-16T00:00:00", + "total": 1649.00 + }, + { + "orderId": 10357, + "orderDate": "1996-11-19T00:00:00", + "total": 1167.68 + }, + { + "orderId": 10381, + "orderDate": "1996-12-12T00:00:00", + "total": 112.00 + }, + { + "orderId": 10461, + "orderDate": "1997-02-28T00:00:00", + "total": 1538.70 + }, + { + "orderId": 10499, + "orderDate": "1997-04-08T00:00:00", + "total": 1412.00 + }, + { + "orderId": 10543, + "orderDate": "1997-05-21T00:00:00", + "total": 1504.50 + }, + { + "orderId": 10780, + "orderDate": "1997-12-16T00:00:00", + "total": 720.00 + }, + { + "orderId": 10823, + "orderDate": "1998-01-09T00:00:00", + "total": 2826.00 + }, + { + "orderId": 10899, + "orderDate": "1998-02-20T00:00:00", + "total": 122.40 + }, + { + "orderId": 10997, + "orderDate": "1998-04-03T00:00:00", + "total": 1885.00 + }, + { + "orderId": 11065, + "orderDate": "1998-05-01T00:00:00", + "total": 189.42 + }, + { + "orderId": 11071, + "orderDate": "1998-05-05T00:00:00", + "total": 484.50 + } + ] + }, + { + "customerId": "LINOD", + "companyName": "LINO-Delicateses", + "address": "Ave. 5 de Mayo Porlamar", + "city": "I. de Margarita", + "region": "Nueva Esparta", + "postalCode": "4980", + "country": "Venezuela", + "phone": "(8) 34-56-12", + "fax": "(8) 34-93-93", + "orders": [ + { + "orderId": 10405, + "orderDate": "1997-01-06T00:00:00", + "total": 400.00 + }, + { + "orderId": 10485, + "orderDate": "1997-03-25T00:00:00", + "total": 1584.00 + }, + { + "orderId": 10638, + "orderDate": "1997-08-20T00:00:00", + "total": 2720.05 + }, + { + "orderId": 10697, + "orderDate": "1997-10-08T00:00:00", + "total": 805.42 + }, + { + "orderId": 10729, + "orderDate": "1997-11-04T00:00:00", + "total": 1850.00 + }, + { + "orderId": 10811, + "orderDate": "1998-01-02T00:00:00", + "total": 852.00 + }, + { + "orderId": 10838, + "orderDate": "1998-01-19T00:00:00", + "total": 1938.38 + }, + { + "orderId": 10840, + "orderDate": "1998-01-19T00:00:00", + "total": 211.20 + }, + { + "orderId": 10919, + "orderDate": "1998-03-02T00:00:00", + "total": 1122.80 + }, + { + "orderId": 10954, + "orderDate": "1998-03-17T00:00:00", + "total": 1659.54 + }, + { + "orderId": 11014, + "orderDate": "1998-04-10T00:00:00", + "total": 243.18 + }, + { + "orderId": 11039, + "orderDate": "1998-04-21T00:00:00", + "total": 3090.00 + } + ] + }, + { + "customerId": "LONEP", + "companyName": "Lonesome Pine Restaurant", + "address": "89 Chiaroscuro Rd.", + "city": "Portland", + "region": "OR", + "postalCode": "97219", + "country": "USA", + "phone": "(503) 555-9573", + "fax": "(503) 555-9646", + "orders": [ + { + "orderId": 10307, + "orderDate": "1996-09-17T00:00:00", + "total": 424.00 + }, + { + "orderId": 10317, + "orderDate": "1996-09-30T00:00:00", + "total": 288.00 + }, + { + "orderId": 10544, + "orderDate": "1997-05-21T00:00:00", + "total": 417.20 + }, + { + "orderId": 10662, + "orderDate": "1997-09-09T00:00:00", + "total": 125.00 + }, + { + "orderId": 10665, + "orderDate": "1997-09-11T00:00:00", + "total": 1295.00 + }, + { + "orderId": 10867, + "orderDate": "1998-02-03T00:00:00", + "total": 98.40 + }, + { + "orderId": 10883, + "orderDate": "1998-02-12T00:00:00", + "total": 36.00 + }, + { + "orderId": 11018, + "orderDate": "1998-04-13T00:00:00", + "total": 1575.00 + } + ] + }, + { + "customerId": "MAGAA", + "companyName": "Magazzini Alimentari Riuniti", + "address": "Via Ludovico il Moro 22", + "city": "Bergamo", + "postalCode": "24100", + "country": "Italy", + "phone": "035-640230", + "fax": "035-640231", + "orders": [ + { + "orderId": 10275, + "orderDate": "1996-08-07T00:00:00", + "total": 291.84 + }, + { + "orderId": 10300, + "orderDate": "1996-09-09T00:00:00", + "total": 608.00 + }, + { + "orderId": 10404, + "orderDate": "1997-01-03T00:00:00", + "total": 1591.25 + }, + { + "orderId": 10467, + "orderDate": "1997-03-06T00:00:00", + "total": 235.20 + }, + { + "orderId": 10635, + "orderDate": "1997-08-18T00:00:00", + "total": 1326.22 + }, + { + "orderId": 10754, + "orderDate": "1997-11-25T00:00:00", + "total": 55.20 + }, + { + "orderId": 10784, + "orderDate": "1997-12-18T00:00:00", + "total": 1488.00 + }, + { + "orderId": 10818, + "orderDate": "1998-01-07T00:00:00", + "total": 833.00 + }, + { + "orderId": 10939, + "orderDate": "1998-03-10T00:00:00", + "total": 637.50 + }, + { + "orderId": 10950, + "orderDate": "1998-03-16T00:00:00", + "total": 110.00 + } + ] + }, + { + "customerId": "MAISD", + "companyName": "Maison Dewey", + "address": "Rue Joseph-Bens 532", + "city": "Bruxelles", + "postalCode": "B-1180", + "country": "Belgium", + "phone": "(02) 201 24 67", + "fax": "(02) 201 24 68", + "orders": [ + { + "orderId": 10529, + "orderDate": "1997-05-07T00:00:00", + "total": 946.00 + }, + { + "orderId": 10649, + "orderDate": "1997-08-28T00:00:00", + "total": 1434.00 + }, + { + "orderId": 10760, + "orderDate": "1997-12-01T00:00:00", + "total": 2917.00 + }, + { + "orderId": 10892, + "orderDate": "1998-02-17T00:00:00", + "total": 2090.00 + }, + { + "orderId": 10896, + "orderDate": "1998-02-19T00:00:00", + "total": 750.50 + }, + { + "orderId": 10978, + "orderDate": "1998-03-26T00:00:00", + "total": 1303.20 + }, + { + "orderId": 11004, + "orderDate": "1998-04-07T00:00:00", + "total": 295.38 + } + ] + }, + { + "customerId": "MEREP", + "companyName": "M\u00e8re Paillarde", + "address": "43 rue St. Laurent", + "city": "Montr\u00e9al", + "region": "Qu\u00e9bec", + "postalCode": "H1J 1C3", + "country": "Canada", + "phone": "(514) 555-8054", + "fax": "(514) 555-8055", + "orders": [ + { + "orderId": 10332, + "orderDate": "1996-10-17T00:00:00", + "total": 1786.88 + }, + { + "orderId": 10339, + "orderDate": "1996-10-28T00:00:00", + "total": 3354.00 + }, + { + "orderId": 10376, + "orderDate": "1996-12-09T00:00:00", + "total": 399.00 + }, + { + "orderId": 10424, + "orderDate": "1997-01-23T00:00:00", + "total": 9194.56 + }, + { + "orderId": 10439, + "orderDate": "1997-02-07T00:00:00", + "total": 1078.00 + }, + { + "orderId": 10505, + "orderDate": "1997-04-14T00:00:00", + "total": 147.90 + }, + { + "orderId": 10565, + "orderDate": "1997-06-11T00:00:00", + "total": 639.90 + }, + { + "orderId": 10570, + "orderDate": "1997-06-17T00:00:00", + "total": 2465.25 + }, + { + "orderId": 10590, + "orderDate": "1997-07-07T00:00:00", + "total": 1101.00 + }, + { + "orderId": 10605, + "orderDate": "1997-07-21T00:00:00", + "total": 4109.70 + }, + { + "orderId": 10618, + "orderDate": "1997-08-01T00:00:00", + "total": 2697.50 + }, + { + "orderId": 10619, + "orderDate": "1997-08-04T00:00:00", + "total": 1260.00 + }, + { + "orderId": 10724, + "orderDate": "1997-10-30T00:00:00", + "total": 638.50 + } + ] + }, + { + "customerId": "MORGK", + "companyName": "Morgenstern Gesundkost", + "address": "Heerstr. 22", + "city": "Leipzig", + "postalCode": "04179", + "country": "Germany", + "phone": "0342-023176", + "orders": [ + { + "orderId": 10277, + "orderDate": "1996-08-09T00:00:00", + "total": 1200.80 + }, + { + "orderId": 10575, + "orderDate": "1997-06-20T00:00:00", + "total": 2147.40 + }, + { + "orderId": 10699, + "orderDate": "1997-10-09T00:00:00", + "total": 114.00 + }, + { + "orderId": 10779, + "orderDate": "1997-12-16T00:00:00", + "total": 1335.00 + }, + { + "orderId": 10945, + "orderDate": "1998-03-12T00:00:00", + "total": 245.00 + } + ] + }, + { + "customerId": "NORTS", + "companyName": "North\/South", + "address": "South House, 300 Queensbridge", + "city": "London", + "postalCode": "SW7 1RZ", + "country": "UK", + "phone": "(171) 555-7733", + "fax": "(171) 555-2530", + "orders": [ + { + "orderId": 10517, + "orderDate": "1997-04-24T00:00:00", + "total": 352.00 + }, + { + "orderId": 10752, + "orderDate": "1997-11-24T00:00:00", + "total": 252.00 + }, + { + "orderId": 11057, + "orderDate": "1998-04-29T00:00:00", + "total": 45.00 + } + ] + }, + { + "customerId": "OCEAN", + "companyName": "Oc\u00e9ano Atl\u00e1ntico Ltda.", + "address": "Ing. Gustavo Moncada 8585, Piso 20-A", + "city": "Buenos Aires", + "postalCode": "1010", + "country": "Argentina", + "phone": "(1) 135-5333", + "fax": "(1) 135-5535", + "orders": [ + { + "orderId": 10409, + "orderDate": "1997-01-09T00:00:00", + "total": 319.20 + }, + { + "orderId": 10531, + "orderDate": "1997-05-08T00:00:00", + "total": 110.00 + }, + { + "orderId": 10898, + "orderDate": "1998-02-20T00:00:00", + "total": 30.00 + }, + { + "orderId": 10958, + "orderDate": "1998-03-18T00:00:00", + "total": 781.00 + }, + { + "orderId": 10986, + "orderDate": "1998-03-30T00:00:00", + "total": 2220.00 + } + ] + }, + { + "customerId": "OLDWO", + "companyName": "Old World Delicatessen", + "address": "2743 Bering St.", + "city": "Anchorage", + "region": "AK", + "postalCode": "99508", + "country": "USA", + "phone": "(907) 555-7584", + "fax": "(907) 555-2880", + "orders": [ + { + "orderId": 10260, + "orderDate": "1996-07-19T00:00:00", + "total": 1504.65 + }, + { + "orderId": 10305, + "orderDate": "1996-09-13T00:00:00", + "total": 3741.30 + }, + { + "orderId": 10338, + "orderDate": "1996-10-25T00:00:00", + "total": 934.50 + }, + { + "orderId": 10441, + "orderDate": "1997-02-10T00:00:00", + "total": 1755.00 + }, + { + "orderId": 10594, + "orderDate": "1997-07-09T00:00:00", + "total": 565.50 + }, + { + "orderId": 10680, + "orderDate": "1997-09-24T00:00:00", + "total": 1261.88 + }, + { + "orderId": 10706, + "orderDate": "1997-10-16T00:00:00", + "total": 1893.00 + }, + { + "orderId": 10855, + "orderDate": "1998-01-27T00:00:00", + "total": 2227.89 + }, + { + "orderId": 10965, + "orderDate": "1998-03-20T00:00:00", + "total": 848.00 + }, + { + "orderId": 11034, + "orderDate": "1998-04-20T00:00:00", + "total": 539.40 + } + ] + }, + { + "customerId": "OTTIK", + "companyName": "Ottilies K\u00e4seladen", + "address": "Mehrheimerstr. 369", + "city": "K\u00f6ln", + "postalCode": "50739", + "country": "Germany", + "phone": "0221-0644327", + "fax": "0221-0765721", + "orders": [ + { + "orderId": 10407, + "orderDate": "1997-01-07T00:00:00", + "total": 1194.00 + }, + { + "orderId": 10508, + "orderDate": "1997-04-16T00:00:00", + "total": 240.00 + }, + { + "orderId": 10554, + "orderDate": "1997-05-30T00:00:00", + "total": 1728.52 + }, + { + "orderId": 10580, + "orderDate": "1997-06-26T00:00:00", + "total": 1013.74 + }, + { + "orderId": 10684, + "orderDate": "1997-09-26T00:00:00", + "total": 1768.00 + }, + { + "orderId": 10766, + "orderDate": "1997-12-05T00:00:00", + "total": 2310.00 + }, + { + "orderId": 10833, + "orderDate": "1998-01-15T00:00:00", + "total": 906.93 + }, + { + "orderId": 10999, + "orderDate": "1998-04-03T00:00:00", + "total": 1197.95 + }, + { + "orderId": 11020, + "orderDate": "1998-04-14T00:00:00", + "total": 632.40 + } + ] + }, + { + "customerId": "PARIS", + "companyName": "Paris sp\u00e9cialit\u00e9s", + "address": "265, boulevard Charonne", + "city": "Paris", + "postalCode": "75012", + "country": "France", + "phone": "(1) 42.34.22.66", + "fax": "(1) 42.34.22.77" + }, + { + "customerId": "PERIC", + "companyName": "Pericles Comidas cl\u00e1sicas", + "address": "Calle Dr. Jorge Cash 321", + "city": "M\u00e9xico D.F.", + "postalCode": "05033", + "country": "Mexico", + "phone": "(5) 552-3745", + "fax": "(5) 545-3745", + "orders": [ + { + "orderId": 10322, + "orderDate": "1996-10-04T00:00:00", + "total": 112.00 + }, + { + "orderId": 10354, + "orderDate": "1996-11-14T00:00:00", + "total": 568.80 + }, + { + "orderId": 10474, + "orderDate": "1997-03-13T00:00:00", + "total": 1249.10 + }, + { + "orderId": 10502, + "orderDate": "1997-04-10T00:00:00", + "total": 816.30 + }, + { + "orderId": 10995, + "orderDate": "1998-04-02T00:00:00", + "total": 1196.00 + }, + { + "orderId": 11073, + "orderDate": "1998-05-05T00:00:00", + "total": 300.00 + } + ] + }, + { + "customerId": "PICCO", + "companyName": "Piccolo und mehr", + "address": "Geislweg 14", + "city": "Salzburg", + "postalCode": "5020", + "country": "Austria", + "phone": "6562-9722", + "fax": "6562-9723", + "orders": [ + { + "orderId": 10353, + "orderDate": "1996-11-13T00:00:00", + "total": 8593.28 + }, + { + "orderId": 10392, + "orderDate": "1996-12-24T00:00:00", + "total": 1440.00 + }, + { + "orderId": 10427, + "orderDate": "1997-01-27T00:00:00", + "total": 651.00 + }, + { + "orderId": 10489, + "orderDate": "1997-03-28T00:00:00", + "total": 439.20 + }, + { + "orderId": 10530, + "orderDate": "1997-05-08T00:00:00", + "total": 4180.00 + }, + { + "orderId": 10597, + "orderDate": "1997-07-11T00:00:00", + "total": 718.08 + }, + { + "orderId": 10686, + "orderDate": "1997-09-30T00:00:00", + "total": 1404.45 + }, + { + "orderId": 10747, + "orderDate": "1997-11-19T00:00:00", + "total": 1912.85 + }, + { + "orderId": 10844, + "orderDate": "1998-01-21T00:00:00", + "total": 735.00 + }, + { + "orderId": 11053, + "orderDate": "1998-04-27T00:00:00", + "total": 3055.00 + } + ] + }, + { + "customerId": "PRINI", + "companyName": "Princesa Isabel Vinhos", + "address": "Estrada da sa\u00fade n. 58", + "city": "Lisboa", + "postalCode": "1756", + "country": "Portugal", + "phone": "(1) 356-5634", + "orders": [ + { + "orderId": 10336, + "orderDate": "1996-10-23T00:00:00", + "total": 285.12 + }, + { + "orderId": 10397, + "orderDate": "1996-12-27T00:00:00", + "total": 716.72 + }, + { + "orderId": 10433, + "orderDate": "1997-02-03T00:00:00", + "total": 851.20 + }, + { + "orderId": 10477, + "orderDate": "1997-03-17T00:00:00", + "total": 558.00 + }, + { + "orderId": 10808, + "orderDate": "1998-01-01T00:00:00", + "total": 1411.00 + }, + { + "orderId": 11007, + "orderDate": "1998-04-08T00:00:00", + "total": 2633.90 + } + ] + }, + { + "customerId": "QUEDE", + "companyName": "Que Del\u00edcia", + "address": "Rua da Panificadora, 12", + "city": "Rio de Janeiro", + "region": "RJ", + "postalCode": "02389-673", + "country": "Brazil", + "phone": "(21) 555-4252", + "fax": "(21) 555-4545", + "orders": [ + { + "orderId": 10261, + "orderDate": "1996-07-19T00:00:00", + "total": 448.00 + }, + { + "orderId": 10291, + "orderDate": "1996-08-27T00:00:00", + "total": 497.52 + }, + { + "orderId": 10379, + "orderDate": "1996-12-11T00:00:00", + "total": 863.28 + }, + { + "orderId": 10421, + "orderDate": "1997-01-21T00:00:00", + "total": 1194.27 + }, + { + "orderId": 10587, + "orderDate": "1997-07-02T00:00:00", + "total": 807.38 + }, + { + "orderId": 10647, + "orderDate": "1997-08-27T00:00:00", + "total": 636.00 + }, + { + "orderId": 10720, + "orderDate": "1997-10-28T00:00:00", + "total": 550.00 + }, + { + "orderId": 10794, + "orderDate": "1997-12-24T00:00:00", + "total": 314.76 + }, + { + "orderId": 10989, + "orderDate": "1998-03-31T00:00:00", + "total": 1353.60 + } + ] + }, + { + "customerId": "QUEEN", + "companyName": "Queen Cozinha", + "address": "Alameda dos Can\u00e0rios, 891", + "city": "S\u00e3o Paulo", + "region": "SP", + "postalCode": "05487-020", + "country": "Brazil", + "phone": "(11) 555-1189", + "orders": [ + { + "orderId": 10372, + "orderDate": "1996-12-04T00:00:00", + "total": 9210.90 + }, + { + "orderId": 10406, + "orderDate": "1997-01-07T00:00:00", + "total": 1830.78 + }, + { + "orderId": 10487, + "orderDate": "1997-03-26T00:00:00", + "total": 889.70 + }, + { + "orderId": 10637, + "orderDate": "1997-08-19T00:00:00", + "total": 2761.94 + }, + { + "orderId": 10659, + "orderDate": "1997-09-05T00:00:00", + "total": 1227.02 + }, + { + "orderId": 10704, + "orderDate": "1997-10-14T00:00:00", + "total": 595.50 + }, + { + "orderId": 10728, + "orderDate": "1997-11-04T00:00:00", + "total": 1296.75 + }, + { + "orderId": 10786, + "orderDate": "1997-12-19T00:00:00", + "total": 1531.08 + }, + { + "orderId": 10868, + "orderDate": "1998-02-04T00:00:00", + "total": 1920.60 + }, + { + "orderId": 10913, + "orderDate": "1998-02-26T00:00:00", + "total": 768.75 + }, + { + "orderId": 10914, + "orderDate": "1998-02-27T00:00:00", + "total": 537.50 + }, + { + "orderId": 10961, + "orderDate": "1998-03-19T00:00:00", + "total": 1119.90 + }, + { + "orderId": 11068, + "orderDate": "1998-05-04T00:00:00", + "total": 2027.08 + } + ] + }, + { + "customerId": "QUICK", + "companyName": "QUICK-Stop", + "address": "Taucherstra\u00dfe 10", + "city": "Cunewalde", + "postalCode": "01307", + "country": "Germany", + "phone": "0372-035188", + "orders": [ + { + "orderId": 10273, + "orderDate": "1996-08-05T00:00:00", + "total": 2037.28 + }, + { + "orderId": 10285, + "orderDate": "1996-08-20T00:00:00", + "total": 1743.36 + }, + { + "orderId": 10286, + "orderDate": "1996-08-21T00:00:00", + "total": 3016.00 + }, + { + "orderId": 10313, + "orderDate": "1996-09-24T00:00:00", + "total": 182.40 + }, + { + "orderId": 10345, + "orderDate": "1996-11-04T00:00:00", + "total": 2924.80 + }, + { + "orderId": 10361, + "orderDate": "1996-11-22T00:00:00", + "total": 2046.24 + }, + { + "orderId": 10418, + "orderDate": "1997-01-17T00:00:00", + "total": 1814.80 + }, + { + "orderId": 10451, + "orderDate": "1997-02-19T00:00:00", + "total": 3849.66 + }, + { + "orderId": 10515, + "orderDate": "1997-04-23T00:00:00", + "total": 9921.30 + }, + { + "orderId": 10527, + "orderDate": "1997-05-05T00:00:00", + "total": 1503.00 + }, + { + "orderId": 10540, + "orderDate": "1997-05-19T00:00:00", + "total": 10191.70 + }, + { + "orderId": 10549, + "orderDate": "1997-05-27T00:00:00", + "total": 3554.28 + }, + { + "orderId": 10588, + "orderDate": "1997-07-03T00:00:00", + "total": 3120.00 + }, + { + "orderId": 10658, + "orderDate": "1997-09-05T00:00:00", + "total": 4464.60 + }, + { + "orderId": 10691, + "orderDate": "1997-10-03T00:00:00", + "total": 10164.80 + }, + { + "orderId": 10694, + "orderDate": "1997-10-06T00:00:00", + "total": 4825.00 + }, + { + "orderId": 10721, + "orderDate": "1997-10-29T00:00:00", + "total": 923.88 + }, + { + "orderId": 10745, + "orderDate": "1997-11-18T00:00:00", + "total": 4529.80 + }, + { + "orderId": 10765, + "orderDate": "1997-12-04T00:00:00", + "total": 1515.60 + }, + { + "orderId": 10788, + "orderDate": "1997-12-22T00:00:00", + "total": 731.50 + }, + { + "orderId": 10845, + "orderDate": "1998-01-21T00:00:00", + "total": 3812.70 + }, + { + "orderId": 10865, + "orderDate": "1998-02-02T00:00:00", + "total": 16387.50 + }, + { + "orderId": 10878, + "orderDate": "1998-02-10T00:00:00", + "total": 1539.00 + }, + { + "orderId": 10938, + "orderDate": "1998-03-10T00:00:00", + "total": 2731.88 + }, + { + "orderId": 10962, + "orderDate": "1998-03-19T00:00:00", + "total": 3584.00 + }, + { + "orderId": 10991, + "orderDate": "1998-04-01T00:00:00", + "total": 2296.00 + }, + { + "orderId": 10996, + "orderDate": "1998-04-02T00:00:00", + "total": 560.00 + }, + { + "orderId": 11021, + "orderDate": "1998-04-14T00:00:00", + "total": 6306.24 + } + ] + }, + { + "customerId": "RANCH", + "companyName": "Rancho grande", + "address": "Av. del Libertador 900", + "city": "Buenos Aires", + "postalCode": "1010", + "country": "Argentina", + "phone": "(1) 123-5555", + "fax": "(1) 123-5556", + "orders": [ + { + "orderId": 10448, + "orderDate": "1997-02-17T00:00:00", + "total": 443.40 + }, + { + "orderId": 10716, + "orderDate": "1997-10-24T00:00:00", + "total": 706.00 + }, + { + "orderId": 10828, + "orderDate": "1998-01-13T00:00:00", + "total": 932.00 + }, + { + "orderId": 10916, + "orderDate": "1998-02-27T00:00:00", + "total": 686.70 + }, + { + "orderId": 11019, + "orderDate": "1998-04-13T00:00:00", + "total": 76.00 + } + ] + }, + { + "customerId": "RATTC", + "companyName": "Rattlesnake Canyon Grocery", + "address": "2817 Milton Dr.", + "city": "Albuquerque", + "region": "NM", + "postalCode": "87110", + "country": "USA", + "phone": "(505) 555-5939", + "fax": "(505) 555-3620", + "orders": [ + { + "orderId": 10262, + "orderDate": "1996-07-22T00:00:00", + "total": 584.00 + }, + { + "orderId": 10272, + "orderDate": "1996-08-02T00:00:00", + "total": 1456.00 + }, + { + "orderId": 10294, + "orderDate": "1996-08-30T00:00:00", + "total": 1887.60 + }, + { + "orderId": 10314, + "orderDate": "1996-09-25T00:00:00", + "total": 2094.30 + }, + { + "orderId": 10316, + "orderDate": "1996-09-27T00:00:00", + "total": 2835.00 + }, + { + "orderId": 10346, + "orderDate": "1996-11-05T00:00:00", + "total": 1618.88 + }, + { + "orderId": 10401, + "orderDate": "1997-01-01T00:00:00", + "total": 3868.60 + }, + { + "orderId": 10479, + "orderDate": "1997-03-19T00:00:00", + "total": 10495.60 + }, + { + "orderId": 10564, + "orderDate": "1997-06-10T00:00:00", + "total": 1234.05 + }, + { + "orderId": 10569, + "orderDate": "1997-06-16T00:00:00", + "total": 890.00 + }, + { + "orderId": 10598, + "orderDate": "1997-07-14T00:00:00", + "total": 2388.50 + }, + { + "orderId": 10761, + "orderDate": "1997-12-02T00:00:00", + "total": 507.00 + }, + { + "orderId": 10820, + "orderDate": "1998-01-07T00:00:00", + "total": 1140.00 + }, + { + "orderId": 10852, + "orderDate": "1998-01-26T00:00:00", + "total": 2984.00 + }, + { + "orderId": 10889, + "orderDate": "1998-02-16T00:00:00", + "total": 11380.00 + }, + { + "orderId": 10988, + "orderDate": "1998-03-31T00:00:00", + "total": 3574.80 + }, + { + "orderId": 11000, + "orderDate": "1998-04-06T00:00:00", + "total": 903.75 + }, + { + "orderId": 11077, + "orderDate": "1998-05-06T00:00:00", + "total": 1255.72 + } + ] + }, + { + "customerId": "REGGC", + "companyName": "Reggiani Caseifici", + "address": "Strada Provinciale 124", + "city": "Reggio Emilia", + "postalCode": "42100", + "country": "Italy", + "phone": "0522-556721", + "fax": "0522-556722", + "orders": [ + { + "orderId": 10288, + "orderDate": "1996-08-23T00:00:00", + "total": 80.10 + }, + { + "orderId": 10428, + "orderDate": "1997-01-28T00:00:00", + "total": 192.00 + }, + { + "orderId": 10443, + "orderDate": "1997-02-12T00:00:00", + "total": 517.44 + }, + { + "orderId": 10562, + "orderDate": "1997-06-09T00:00:00", + "total": 488.70 + }, + { + "orderId": 10586, + "orderDate": "1997-07-02T00:00:00", + "total": 23.80 + }, + { + "orderId": 10655, + "orderDate": "1997-09-03T00:00:00", + "total": 154.40 + }, + { + "orderId": 10727, + "orderDate": "1997-11-03T00:00:00", + "total": 1624.50 + }, + { + "orderId": 10812, + "orderDate": "1998-01-02T00:00:00", + "total": 1692.80 + }, + { + "orderId": 10908, + "orderDate": "1998-02-26T00:00:00", + "total": 663.10 + }, + { + "orderId": 10942, + "orderDate": "1998-03-11T00:00:00", + "total": 560.00 + }, + { + "orderId": 11010, + "orderDate": "1998-04-09T00:00:00", + "total": 645.00 + }, + { + "orderId": 11062, + "orderDate": "1998-04-30T00:00:00", + "total": 406.40 + } + ] + }, + { + "customerId": "RICAR", + "companyName": "Ricardo Adocicados", + "address": "Av. Copacabana, 267", + "city": "Rio de Janeiro", + "region": "RJ", + "postalCode": "02389-890", + "country": "Brazil", + "phone": "(21) 555-3412", + "orders": [ + { + "orderId": 10287, + "orderDate": "1996-08-22T00:00:00", + "total": 819.00 + }, + { + "orderId": 10299, + "orderDate": "1996-09-06T00:00:00", + "total": 349.50 + }, + { + "orderId": 10447, + "orderDate": "1997-02-14T00:00:00", + "total": 914.40 + }, + { + "orderId": 10481, + "orderDate": "1997-03-20T00:00:00", + "total": 1472.00 + }, + { + "orderId": 10563, + "orderDate": "1997-06-10T00:00:00", + "total": 965.00 + }, + { + "orderId": 10622, + "orderDate": "1997-08-06T00:00:00", + "total": 560.00 + }, + { + "orderId": 10648, + "orderDate": "1997-08-28T00:00:00", + "total": 372.38 + }, + { + "orderId": 10813, + "orderDate": "1998-01-05T00:00:00", + "total": 602.40 + }, + { + "orderId": 10851, + "orderDate": "1998-01-26T00:00:00", + "total": 2603.00 + }, + { + "orderId": 10877, + "orderDate": "1998-02-09T00:00:00", + "total": 1955.12 + }, + { + "orderId": 11059, + "orderDate": "1998-04-29T00:00:00", + "total": 1838.00 + } + ] + }, + { + "customerId": "RICSU", + "companyName": "Richter Supermarkt", + "address": "Grenzacherweg 237", + "city": "Gen\u00e8ve", + "postalCode": "1203", + "country": "Switzerland", + "phone": "0897-034214", + "orders": [ + { + "orderId": 10255, + "orderDate": "1996-07-12T00:00:00", + "total": 2490.50 + }, + { + "orderId": 10419, + "orderDate": "1997-01-20T00:00:00", + "total": 2097.60 + }, + { + "orderId": 10537, + "orderDate": "1997-05-14T00:00:00", + "total": 1823.80 + }, + { + "orderId": 10666, + "orderDate": "1997-09-12T00:00:00", + "total": 4666.94 + }, + { + "orderId": 10751, + "orderDate": "1997-11-24T00:00:00", + "total": 1631.48 + }, + { + "orderId": 10758, + "orderDate": "1997-11-28T00:00:00", + "total": 1644.60 + }, + { + "orderId": 10931, + "orderDate": "1998-03-06T00:00:00", + "total": 799.20 + }, + { + "orderId": 10951, + "orderDate": "1998-03-16T00:00:00", + "total": 458.76 + }, + { + "orderId": 11033, + "orderDate": "1998-04-17T00:00:00", + "total": 3232.80 + }, + { + "orderId": 11075, + "orderDate": "1998-05-06T00:00:00", + "total": 498.10 + } + ] + }, + { + "customerId": "ROMEY", + "companyName": "Romero y tomillo", + "address": "Gran V\u00eda, 1", + "city": "Madrid", + "postalCode": "28001", + "country": "Spain", + "phone": "(91) 745 6200", + "fax": "(91) 745 6210", + "orders": [ + { + "orderId": 10281, + "orderDate": "1996-08-14T00:00:00", + "total": 86.50 + }, + { + "orderId": 10282, + "orderDate": "1996-08-15T00:00:00", + "total": 155.40 + }, + { + "orderId": 10306, + "orderDate": "1996-09-16T00:00:00", + "total": 498.50 + }, + { + "orderId": 10917, + "orderDate": "1998-03-02T00:00:00", + "total": 365.89 + }, + { + "orderId": 11013, + "orderDate": "1998-04-09T00:00:00", + "total": 361.00 + } + ] + }, + { + "customerId": "SANTG", + "companyName": "Sant\u00e9 Gourmet", + "address": "Erling Skakkes gate 78", + "city": "Stavern", + "postalCode": "4110", + "country": "Norway", + "phone": "07-98 92 35", + "fax": "07-98 92 47", + "orders": [ + { + "orderId": 10387, + "orderDate": "1996-12-18T00:00:00", + "total": 1058.40 + }, + { + "orderId": 10520, + "orderDate": "1997-04-29T00:00:00", + "total": 200.00 + }, + { + "orderId": 10639, + "orderDate": "1997-08-20T00:00:00", + "total": 500.00 + }, + { + "orderId": 10831, + "orderDate": "1998-01-14T00:00:00", + "total": 2684.40 + }, + { + "orderId": 10909, + "orderDate": "1998-02-26T00:00:00", + "total": 670.00 + }, + { + "orderId": 11015, + "orderDate": "1998-04-10T00:00:00", + "total": 622.35 + } + ] + }, + { + "customerId": "SAVEA", + "companyName": "Save-a-lot Markets", + "address": "187 Suffolk Ln.", + "city": "Boise", + "region": "ID", + "postalCode": "83720", + "country": "USA", + "phone": "(208) 555-8097", + "orders": [ + { + "orderId": 10324, + "orderDate": "1996-10-08T00:00:00", + "total": 5275.72 + }, + { + "orderId": 10393, + "orderDate": "1996-12-25T00:00:00", + "total": 2556.95 + }, + { + "orderId": 10398, + "orderDate": "1996-12-30T00:00:00", + "total": 2505.60 + }, + { + "orderId": 10440, + "orderDate": "1997-02-10T00:00:00", + "total": 4924.14 + }, + { + "orderId": 10452, + "orderDate": "1997-02-20T00:00:00", + "total": 2018.50 + }, + { + "orderId": 10510, + "orderDate": "1997-04-18T00:00:00", + "total": 4707.54 + }, + { + "orderId": 10555, + "orderDate": "1997-06-02T00:00:00", + "total": 2944.40 + }, + { + "orderId": 10603, + "orderDate": "1997-07-18T00:00:00", + "total": 1483.00 + }, + { + "orderId": 10607, + "orderDate": "1997-07-22T00:00:00", + "total": 6475.40 + }, + { + "orderId": 10612, + "orderDate": "1997-07-28T00:00:00", + "total": 6375.00 + }, + { + "orderId": 10627, + "orderDate": "1997-08-11T00:00:00", + "total": 1185.75 + }, + { + "orderId": 10657, + "orderDate": "1997-09-04T00:00:00", + "total": 4371.60 + }, + { + "orderId": 10678, + "orderDate": "1997-09-23T00:00:00", + "total": 5256.50 + }, + { + "orderId": 10700, + "orderDate": "1997-10-10T00:00:00", + "total": 1638.40 + }, + { + "orderId": 10711, + "orderDate": "1997-10-21T00:00:00", + "total": 4451.70 + }, + { + "orderId": 10713, + "orderDate": "1997-10-22T00:00:00", + "total": 2827.90 + }, + { + "orderId": 10714, + "orderDate": "1997-10-22T00:00:00", + "total": 2205.75 + }, + { + "orderId": 10722, + "orderDate": "1997-10-29T00:00:00", + "total": 1570.00 + }, + { + "orderId": 10748, + "orderDate": "1997-11-20T00:00:00", + "total": 2196.00 + }, + { + "orderId": 10757, + "orderDate": "1997-11-27T00:00:00", + "total": 3082.00 + }, + { + "orderId": 10815, + "orderDate": "1998-01-05T00:00:00", + "total": 40.00 + }, + { + "orderId": 10847, + "orderDate": "1998-01-22T00:00:00", + "total": 4931.92 + }, + { + "orderId": 10882, + "orderDate": "1998-02-11T00:00:00", + "total": 892.64 + }, + { + "orderId": 10894, + "orderDate": "1998-02-18T00:00:00", + "total": 2753.10 + }, + { + "orderId": 10941, + "orderDate": "1998-03-11T00:00:00", + "total": 4011.75 + }, + { + "orderId": 10983, + "orderDate": "1998-03-27T00:00:00", + "total": 720.90 + }, + { + "orderId": 10984, + "orderDate": "1998-03-30T00:00:00", + "total": 1809.75 + }, + { + "orderId": 11002, + "orderDate": "1998-04-06T00:00:00", + "total": 1811.10 + }, + { + "orderId": 11030, + "orderDate": "1998-04-17T00:00:00", + "total": 12615.05 + }, + { + "orderId": 11031, + "orderDate": "1998-04-17T00:00:00", + "total": 2393.50 + }, + { + "orderId": 11064, + "orderDate": "1998-05-01T00:00:00", + "total": 4330.40 + } + ] + }, + { + "customerId": "SEVES", + "companyName": "Seven Seas Imports", + "address": "90 Wadhurst Rd.", + "city": "London", + "postalCode": "OX15 4NB", + "country": "UK", + "phone": "(171) 555-1717", + "fax": "(171) 555-5646", + "orders": [ + { + "orderId": 10359, + "orderDate": "1996-11-21T00:00:00", + "total": 3471.68 + }, + { + "orderId": 10377, + "orderDate": "1996-12-09T00:00:00", + "total": 863.60 + }, + { + "orderId": 10388, + "orderDate": "1996-12-19T00:00:00", + "total": 1228.80 + }, + { + "orderId": 10472, + "orderDate": "1997-03-12T00:00:00", + "total": 1036.80 + }, + { + "orderId": 10523, + "orderDate": "1997-05-01T00:00:00", + "total": 2444.31 + }, + { + "orderId": 10547, + "orderDate": "1997-05-23T00:00:00", + "total": 1792.80 + }, + { + "orderId": 10800, + "orderDate": "1997-12-26T00:00:00", + "total": 1468.94 + }, + { + "orderId": 10804, + "orderDate": "1997-12-30T00:00:00", + "total": 2278.40 + }, + { + "orderId": 10869, + "orderDate": "1998-02-04T00:00:00", + "total": 1630.00 + } + ] + }, + { + "customerId": "SIMOB", + "companyName": "Simons bistro", + "address": "Vinb\u00e6ltet 34", + "city": "K\u00f8benhavn", + "postalCode": "1734", + "country": "Denmark", + "phone": "31 12 34 56", + "fax": "31 13 35 57", + "orders": [ + { + "orderId": 10341, + "orderDate": "1996-10-29T00:00:00", + "total": 352.60 + }, + { + "orderId": 10417, + "orderDate": "1997-01-16T00:00:00", + "total": 11188.40 + }, + { + "orderId": 10556, + "orderDate": "1997-06-03T00:00:00", + "total": 835.20 + }, + { + "orderId": 10642, + "orderDate": "1997-08-22T00:00:00", + "total": 696.00 + }, + { + "orderId": 10669, + "orderDate": "1997-09-15T00:00:00", + "total": 570.00 + }, + { + "orderId": 10802, + "orderDate": "1997-12-29T00:00:00", + "total": 2942.81 + }, + { + "orderId": 11074, + "orderDate": "1998-05-06T00:00:00", + "total": 232.08 + } + ] + }, + { + "customerId": "SPECD", + "companyName": "Sp\u00e9cialit\u00e9s du monde", + "address": "25, rue Lauriston", + "city": "Paris", + "postalCode": "75016", + "country": "France", + "phone": "(1) 47.55.60.10", + "fax": "(1) 47.55.60.20", + "orders": [ + { + "orderId": 10738, + "orderDate": "1997-11-12T00:00:00", + "total": 52.35 + }, + { + "orderId": 10907, + "orderDate": "1998-02-25T00:00:00", + "total": 108.50 + }, + { + "orderId": 10964, + "orderDate": "1998-03-20T00:00:00", + "total": 2052.50 + }, + { + "orderId": 11043, + "orderDate": "1998-04-22T00:00:00", + "total": 210.00 + } + ] + }, + { + "customerId": "SPLIR", + "companyName": "Split Rail Beer & Ale", + "address": "P.O. Box 555", + "city": "Lander", + "region": "WY", + "postalCode": "82520", + "country": "USA", + "phone": "(307) 555-4680", + "fax": "(307) 555-6525", + "orders": [ + { + "orderId": 10271, + "orderDate": "1996-08-01T00:00:00", + "total": 48.00 + }, + { + "orderId": 10329, + "orderDate": "1996-10-15T00:00:00", + "total": 4578.43 + }, + { + "orderId": 10349, + "orderDate": "1996-11-08T00:00:00", + "total": 141.60 + }, + { + "orderId": 10369, + "orderDate": "1996-12-02T00:00:00", + "total": 2390.40 + }, + { + "orderId": 10385, + "orderDate": "1996-12-17T00:00:00", + "total": 691.20 + }, + { + "orderId": 10432, + "orderDate": "1997-01-31T00:00:00", + "total": 485.00 + }, + { + "orderId": 10756, + "orderDate": "1997-11-27T00:00:00", + "total": 1990.00 + }, + { + "orderId": 10821, + "orderDate": "1998-01-08T00:00:00", + "total": 678.00 + }, + { + "orderId": 10974, + "orderDate": "1998-03-25T00:00:00", + "total": 439.00 + } + ] + }, + { + "customerId": "SUPRD", + "companyName": "Supr\u00eames d\u00e9lices", + "address": "Boulevard Tirou, 255", + "city": "Charleroi", + "postalCode": "B-6000", + "country": "Belgium", + "phone": "(071) 23 67 22 20", + "fax": "(071) 23 67 22 21", + "orders": [ + { + "orderId": 10252, + "orderDate": "1996-07-09T00:00:00", + "total": 3597.90 + }, + { + "orderId": 10302, + "orderDate": "1996-09-10T00:00:00", + "total": 2708.80 + }, + { + "orderId": 10458, + "orderDate": "1997-02-26T00:00:00", + "total": 3891.00 + }, + { + "orderId": 10463, + "orderDate": "1997-03-04T00:00:00", + "total": 713.30 + }, + { + "orderId": 10475, + "orderDate": "1997-03-14T00:00:00", + "total": 1505.18 + }, + { + "orderId": 10767, + "orderDate": "1997-12-05T00:00:00", + "total": 28.00 + }, + { + "orderId": 10841, + "orderDate": "1998-01-20T00:00:00", + "total": 4581.00 + }, + { + "orderId": 10846, + "orderDate": "1998-01-22T00:00:00", + "total": 1112.00 + }, + { + "orderId": 10885, + "orderDate": "1998-02-12T00:00:00", + "total": 1209.00 + }, + { + "orderId": 10930, + "orderDate": "1998-03-06T00:00:00", + "total": 2255.50 + }, + { + "orderId": 11035, + "orderDate": "1998-04-20T00:00:00", + "total": 1754.50 + }, + { + "orderId": 11038, + "orderDate": "1998-04-21T00:00:00", + "total": 732.60 + } + ] + }, + { + "customerId": "THEBI", + "companyName": "The Big Cheese", + "address": "89 Jefferson Way, Suite 2", + "city": "Portland", + "region": "OR", + "postalCode": "97201", + "country": "USA", + "phone": "(503) 555-3612", + "orders": [ + { + "orderId": 10310, + "orderDate": "1996-09-20T00:00:00", + "total": 336.00 + }, + { + "orderId": 10708, + "orderDate": "1997-10-17T00:00:00", + "total": 180.40 + }, + { + "orderId": 10805, + "orderDate": "1997-12-30T00:00:00", + "total": 2775.00 + }, + { + "orderId": 10992, + "orderDate": "1998-04-01T00:00:00", + "total": 69.60 + } + ] + }, + { + "customerId": "THECR", + "companyName": "The Cracker Box", + "address": "55 Grizzly Peak Rd.", + "city": "Butte", + "region": "MT", + "postalCode": "59801", + "country": "USA", + "phone": "(406) 555-5834", + "fax": "(406) 555-8083", + "orders": [ + { + "orderId": 10624, + "orderDate": "1997-08-07T00:00:00", + "total": 1393.24 + }, + { + "orderId": 10775, + "orderDate": "1997-12-12T00:00:00", + "total": 228.00 + }, + { + "orderId": 11003, + "orderDate": "1998-04-06T00:00:00", + "total": 326.00 + } + ] + }, + { + "customerId": "TOMSP", + "companyName": "Toms Spezialit\u00e4ten", + "address": "Luisenstr. 48", + "city": "M\u00fcnster", + "postalCode": "44087", + "country": "Germany", + "phone": "0251-031259", + "fax": "0251-035695", + "orders": [ + { + "orderId": 10438, + "orderDate": "1997-02-06T00:00:00", + "total": 454.00 + }, + { + "orderId": 10446, + "orderDate": "1997-02-14T00:00:00", + "total": 246.24 + }, + { + "orderId": 10548, + "orderDate": "1997-05-26T00:00:00", + "total": 240.10 + }, + { + "orderId": 10608, + "orderDate": "1997-07-23T00:00:00", + "total": 1064.00 + }, + { + "orderId": 10967, + "orderDate": "1998-03-23T00:00:00", + "total": 910.40 + } + ] + }, + { + "customerId": "TORTU", + "companyName": "Tortuga Restaurante", + "address": "Avda. Azteca 123", + "city": "M\u00e9xico D.F.", + "postalCode": "05033", + "country": "Mexico", + "phone": "(5) 555-2933", + "orders": [ + { + "orderId": 10276, + "orderDate": "1996-08-08T00:00:00", + "total": 420.00 + }, + { + "orderId": 10293, + "orderDate": "1996-08-29T00:00:00", + "total": 848.70 + }, + { + "orderId": 10304, + "orderDate": "1996-09-12T00:00:00", + "total": 954.40 + }, + { + "orderId": 10319, + "orderDate": "1996-10-02T00:00:00", + "total": 1191.20 + }, + { + "orderId": 10518, + "orderDate": "1997-04-25T00:00:00", + "total": 4150.05 + }, + { + "orderId": 10576, + "orderDate": "1997-06-23T00:00:00", + "total": 838.45 + }, + { + "orderId": 10676, + "orderDate": "1997-09-22T00:00:00", + "total": 534.85 + }, + { + "orderId": 10842, + "orderDate": "1998-01-20T00:00:00", + "total": 975.00 + }, + { + "orderId": 10915, + "orderDate": "1998-02-27T00:00:00", + "total": 539.50 + }, + { + "orderId": 11069, + "orderDate": "1998-05-04T00:00:00", + "total": 360.00 + } + ] + }, + { + "customerId": "TRADH", + "companyName": "Tradi\u00e7\u00e3o Hipermercados", + "address": "Av. In\u00eas de Castro, 414", + "city": "S\u00e3o Paulo", + "region": "SP", + "postalCode": "05634-030", + "country": "Brazil", + "phone": "(11) 555-2167", + "fax": "(11) 555-2168", + "orders": [ + { + "orderId": 10249, + "orderDate": "1996-07-05T00:00:00", + "total": 1863.40 + }, + { + "orderId": 10292, + "orderDate": "1996-08-28T00:00:00", + "total": 1296.00 + }, + { + "orderId": 10496, + "orderDate": "1997-04-04T00:00:00", + "total": 190.00 + }, + { + "orderId": 10606, + "orderDate": "1997-07-22T00:00:00", + "total": 1130.40 + }, + { + "orderId": 10830, + "orderDate": "1998-01-13T00:00:00", + "total": 1974.00 + }, + { + "orderId": 10834, + "orderDate": "1998-01-15T00:00:00", + "total": 1432.71 + }, + { + "orderId": 10839, + "orderDate": "1998-01-19T00:00:00", + "total": 827.55 + } + ] + }, + { + "customerId": "TRAIH", + "companyName": "Trail's Head Gourmet Provisioners", + "address": "722 DaVinci Blvd.", + "city": "Kirkland", + "region": "WA", + "postalCode": "98034", + "country": "USA", + "phone": "(206) 555-8257", + "fax": "(206) 555-2174", + "orders": [ + { + "orderId": 10574, + "orderDate": "1997-06-19T00:00:00", + "total": 764.30 + }, + { + "orderId": 10577, + "orderDate": "1997-06-23T00:00:00", + "total": 569.00 + }, + { + "orderId": 10822, + "orderDate": "1998-01-08T00:00:00", + "total": 237.90 + } + ] + }, + { + "customerId": "VAFFE", + "companyName": "Vaffeljernet", + "address": "Smagsl\u00f8get 45", + "city": "\u00c5rhus", + "postalCode": "8200", + "country": "Denmark", + "phone": "86 21 32 43", + "fax": "86 22 33 44", + "orders": [ + { + "orderId": 10367, + "orderDate": "1996-11-28T00:00:00", + "total": 834.20 + }, + { + "orderId": 10399, + "orderDate": "1996-12-31T00:00:00", + "total": 1765.60 + }, + { + "orderId": 10465, + "orderDate": "1997-03-05T00:00:00", + "total": 2518.00 + }, + { + "orderId": 10591, + "orderDate": "1997-07-07T00:00:00", + "total": 812.50 + }, + { + "orderId": 10602, + "orderDate": "1997-07-17T00:00:00", + "total": 48.75 + }, + { + "orderId": 10688, + "orderDate": "1997-10-01T00:00:00", + "total": 3160.60 + }, + { + "orderId": 10744, + "orderDate": "1997-11-17T00:00:00", + "total": 736.00 + }, + { + "orderId": 10769, + "orderDate": "1997-12-08T00:00:00", + "total": 1684.28 + }, + { + "orderId": 10921, + "orderDate": "1998-03-03T00:00:00", + "total": 1936.00 + }, + { + "orderId": 10946, + "orderDate": "1998-03-12T00:00:00", + "total": 1407.50 + }, + { + "orderId": 10994, + "orderDate": "1998-04-02T00:00:00", + "total": 940.50 + } + ] + }, + { + "customerId": "VICTE", + "companyName": "Victuailles en stock", + "address": "2, rue du Commerce", + "city": "Lyon", + "postalCode": "69004", + "country": "France", + "phone": "78.32.54.86", + "fax": "78.32.54.87", + "orders": [ + { + "orderId": 10251, + "orderDate": "1996-07-08T00:00:00", + "total": 654.06 + }, + { + "orderId": 10334, + "orderDate": "1996-10-21T00:00:00", + "total": 144.80 + }, + { + "orderId": 10450, + "orderDate": "1997-02-19T00:00:00", + "total": 425.12 + }, + { + "orderId": 10459, + "orderDate": "1997-02-27T00:00:00", + "total": 1659.20 + }, + { + "orderId": 10478, + "orderDate": "1997-03-18T00:00:00", + "total": 471.20 + }, + { + "orderId": 10546, + "orderDate": "1997-05-23T00:00:00", + "total": 2812.00 + }, + { + "orderId": 10806, + "orderDate": "1997-12-31T00:00:00", + "total": 439.60 + }, + { + "orderId": 10814, + "orderDate": "1998-01-05T00:00:00", + "total": 1788.45 + }, + { + "orderId": 10843, + "orderDate": "1998-01-21T00:00:00", + "total": 159.00 + }, + { + "orderId": 10850, + "orderDate": "1998-01-23T00:00:00", + "total": 629.00 + } + ] + }, + { + "customerId": "VINET", + "companyName": "Vins et alcools Chevalier", + "address": "59 rue de l'Abbaye", + "city": "Reims", + "postalCode": "51100", + "country": "France", + "phone": "26.47.15.10", + "fax": "26.47.15.11", + "orders": [ + { + "orderId": 10274, + "orderDate": "1996-08-06T00:00:00", + "total": 538.60 + }, + { + "orderId": 10295, + "orderDate": "1996-09-02T00:00:00", + "total": 121.60 + }, + { + "orderId": 10737, + "orderDate": "1997-11-11T00:00:00", + "total": 139.80 + }, + { + "orderId": 10739, + "orderDate": "1997-11-12T00:00:00", + "total": 240.00 + } + ] + }, + { + "customerId": "WANDK", + "companyName": "Die Wandernde Kuh", + "address": "Adenauerallee 900", + "city": "Stuttgart", + "postalCode": "70563", + "country": "Germany", + "phone": "0711-020361", + "fax": "0711-035428", + "orders": [ + { + "orderId": 10301, + "orderDate": "1996-09-09T00:00:00", + "total": 755.00 + }, + { + "orderId": 10312, + "orderDate": "1996-09-23T00:00:00", + "total": 1614.80 + }, + { + "orderId": 10348, + "orderDate": "1996-11-07T00:00:00", + "total": 363.60 + }, + { + "orderId": 10356, + "orderDate": "1996-11-18T00:00:00", + "total": 1106.40 + }, + { + "orderId": 10513, + "orderDate": "1997-04-22T00:00:00", + "total": 1942.00 + }, + { + "orderId": 10632, + "orderDate": "1997-08-14T00:00:00", + "total": 589.00 + }, + { + "orderId": 10640, + "orderDate": "1997-08-21T00:00:00", + "total": 708.75 + }, + { + "orderId": 10651, + "orderDate": "1997-09-01T00:00:00", + "total": 397.80 + }, + { + "orderId": 10668, + "orderDate": "1997-09-15T00:00:00", + "total": 625.28 + }, + { + "orderId": 11046, + "orderDate": "1998-04-23T00:00:00", + "total": 1485.80 + } + ] + }, + { + "customerId": "WARTH", + "companyName": "Wartian Herkku", + "address": "Torikatu 38", + "city": "Oulu", + "postalCode": "90110", + "country": "Finland", + "phone": "981-443655", + "fax": "981-443655", + "orders": [ + { + "orderId": 10266, + "orderDate": "1996-07-26T00:00:00", + "total": 346.56 + }, + { + "orderId": 10270, + "orderDate": "1996-08-01T00:00:00", + "total": 1376.00 + }, + { + "orderId": 10320, + "orderDate": "1996-10-03T00:00:00", + "total": 516.00 + }, + { + "orderId": 10333, + "orderDate": "1996-10-18T00:00:00", + "total": 877.20 + }, + { + "orderId": 10412, + "orderDate": "1997-01-13T00:00:00", + "total": 334.80 + }, + { + "orderId": 10416, + "orderDate": "1997-01-16T00:00:00", + "total": 720.00 + }, + { + "orderId": 10437, + "orderDate": "1997-02-05T00:00:00", + "total": 393.00 + }, + { + "orderId": 10455, + "orderDate": "1997-02-24T00:00:00", + "total": 2684.00 + }, + { + "orderId": 10526, + "orderDate": "1997-05-05T00:00:00", + "total": 1151.40 + }, + { + "orderId": 10553, + "orderDate": "1997-05-30T00:00:00", + "total": 1546.30 + }, + { + "orderId": 10583, + "orderDate": "1997-06-30T00:00:00", + "total": 2237.50 + }, + { + "orderId": 10636, + "orderDate": "1997-08-19T00:00:00", + "total": 629.50 + }, + { + "orderId": 10750, + "orderDate": "1997-11-21T00:00:00", + "total": 1590.56 + }, + { + "orderId": 10781, + "orderDate": "1997-12-17T00:00:00", + "total": 975.88 + }, + { + "orderId": 11025, + "orderDate": "1998-04-15T00:00:00", + "total": 270.00 + } + ] + }, + { + "customerId": "WELLI", + "companyName": "Wellington Importadora", + "address": "Rua do Mercado, 12", + "city": "Resende", + "region": "SP", + "postalCode": "08737-363", + "country": "Brazil", + "phone": "(14) 555-8122", + "orders": [ + { + "orderId": 10256, + "orderDate": "1996-07-15T00:00:00", + "total": 517.80 + }, + { + "orderId": 10420, + "orderDate": "1997-01-21T00:00:00", + "total": 1707.84 + }, + { + "orderId": 10585, + "orderDate": "1997-07-01T00:00:00", + "total": 142.50 + }, + { + "orderId": 10644, + "orderDate": "1997-08-25T00:00:00", + "total": 1371.80 + }, + { + "orderId": 10803, + "orderDate": "1997-12-30T00:00:00", + "total": 1193.01 + }, + { + "orderId": 10809, + "orderDate": "1998-01-01T00:00:00", + "total": 140.00 + }, + { + "orderId": 10900, + "orderDate": "1998-02-20T00:00:00", + "total": 33.75 + }, + { + "orderId": 10905, + "orderDate": "1998-02-24T00:00:00", + "total": 342.00 + }, + { + "orderId": 10935, + "orderDate": "1998-03-09T00:00:00", + "total": 619.50 + } + ] + }, + { + "customerId": "WHITC", + "companyName": "White Clover Markets", + "address": "305 - 14th Ave. S. Suite 3B", + "city": "Seattle", + "region": "WA", + "postalCode": "98128", + "country": "USA", + "phone": "(206) 555-4112", + "fax": "(206) 555-4115", + "orders": [ + { + "orderId": 10269, + "orderDate": "1996-07-31T00:00:00", + "total": 642.20 + }, + { + "orderId": 10344, + "orderDate": "1996-11-01T00:00:00", + "total": 2296.00 + }, + { + "orderId": 10469, + "orderDate": "1997-03-10T00:00:00", + "total": 956.68 + }, + { + "orderId": 10483, + "orderDate": "1997-03-24T00:00:00", + "total": 668.80 + }, + { + "orderId": 10504, + "orderDate": "1997-04-11T00:00:00", + "total": 1388.50 + }, + { + "orderId": 10596, + "orderDate": "1997-07-11T00:00:00", + "total": 1180.88 + }, + { + "orderId": 10693, + "orderDate": "1997-10-06T00:00:00", + "total": 2071.20 + }, + { + "orderId": 10696, + "orderDate": "1997-10-08T00:00:00", + "total": 996.00 + }, + { + "orderId": 10723, + "orderDate": "1997-10-30T00:00:00", + "total": 468.45 + }, + { + "orderId": 10740, + "orderDate": "1997-11-13T00:00:00", + "total": 1416.00 + }, + { + "orderId": 10861, + "orderDate": "1998-01-30T00:00:00", + "total": 3523.40 + }, + { + "orderId": 10904, + "orderDate": "1998-02-24T00:00:00", + "total": 1924.25 + }, + { + "orderId": 11032, + "orderDate": "1998-04-17T00:00:00", + "total": 8902.50 + }, + { + "orderId": 11066, + "orderDate": "1998-05-01T00:00:00", + "total": 928.75 + } + ] + }, + { + "customerId": "WILMK", + "companyName": "Wilman Kala", + "address": "Keskuskatu 45", + "city": "Helsinki", + "postalCode": "21240", + "country": "Finland", + "phone": "90-224 8858", + "fax": "90-224 8858", + "orders": [ + { + "orderId": 10248, + "orderDate": "1996-07-04T00:00:00", + "total": 440.00 + }, + { + "orderId": 10615, + "orderDate": "1997-07-30T00:00:00", + "total": 120.00 + }, + { + "orderId": 10673, + "orderDate": "1997-09-18T00:00:00", + "total": 412.35 + }, + { + "orderId": 10695, + "orderDate": "1997-10-07T00:00:00", + "total": 642.00 + }, + { + "orderId": 10873, + "orderDate": "1998-02-06T00:00:00", + "total": 336.80 + }, + { + "orderId": 10879, + "orderDate": "1998-02-10T00:00:00", + "total": 611.30 + }, + { + "orderId": 10910, + "orderDate": "1998-02-26T00:00:00", + "total": 452.90 + }, + { + "orderId": 11005, + "orderDate": "1998-04-07T00:00:00", + "total": 586.00 + } + ] + }, + { + "customerId": "WOLZA", + "companyName": "Wolski Zajazd", + "address": "ul. Filtrowa 68", + "city": "Warszawa", + "postalCode": "01-012", + "country": "Poland", + "phone": "(26) 642-7012", + "fax": "(26) 642-7012", + "orders": [ + { + "orderId": 10374, + "orderDate": "1996-12-05T00:00:00", + "total": 459.00 + }, + { + "orderId": 10611, + "orderDate": "1997-07-25T00:00:00", + "total": 808.00 + }, + { + "orderId": 10792, + "orderDate": "1997-12-23T00:00:00", + "total": 399.85 + }, + { + "orderId": 10870, + "orderDate": "1998-02-04T00:00:00", + "total": 160.00 + }, + { + "orderId": 10906, + "orderDate": "1998-02-25T00:00:00", + "total": 427.50 + }, + { + "orderId": 10998, + "orderDate": "1998-04-03T00:00:00", + "total": 686.00 + }, + { + "orderId": 11044, + "orderDate": "1998-04-23T00:00:00", + "total": 591.60 + } + ] + } +] \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncFiltersTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncFiltersTests.cs new file mode 100644 index 00000000000..a96048a2704 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncFiltersTests.cs @@ -0,0 +1,495 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.FluentValidation; +using ServiceStack.Text; +using ServiceStack.Validation; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class TestAsyncFilter : IReturn + { + public int? ReturnAt { get; set; } + public int? CancelAt { get; set; } + public int? ErrorAt { get; set; } + public int? DirectErrorAt { get; set; } + public List Results { get; set; } + + public TestAsyncFilter() + { + this.Results = new List(); + } + } + + [Route("/test/async-filter")] + public class TestAsyncFilterRestHandler : TestAsyncFilter { } + + [Route("/test/async-validator")] + public class TestAsyncValidator : IReturn + { + public int Age { get; set; } + public string Name { get; set; } + } + + public class MyTestAsyncValidator : AbstractValidator + { + public MyTestAsyncValidator() + { + RuleSet(ApplyTo.Post, () => + { + RuleFor(x => x.Name).MustAsync(async (s, token) => + { + await Task.Delay(10, token); + return !string.IsNullOrEmpty(s); + }) + .WithMessage("'Name' should not be empty.") + .WithErrorCode("NotEmpty"); + }); + RuleSet(ApplyTo.Put, () => + { + RuleFor(x => x.Name).NotEmpty(); + }); + RuleFor(x => x.Age).GreaterThan(0); + } + } + + [Route("/test/all-async-validator")] + public class TestAllAsyncValidator : IReturn + { + public int Age { get; set; } + public string Name { get; set; } + } + + [Route("/test/async-validator-gateway")] + public class TestAsyncGatewayValidator : IReturn + { + public int Age { get; set; } + public string Name { get; set; } + } + + public class MyTestAsyncGatewayValidator : AbstractValidator + { + public MyTestAsyncGatewayValidator() + { + RuleFor(x => x.Name).MustAsync(async (s, token) => + (await Gateway.SendAsync(new GetStringLength { Value = s })).Result > 0) + .WithMessage("'Name' should not be empty.") + .WithErrorCode("NotEmpty"); + } + } + + public class GetStringLength : IReturn + { + public string Value { get; set; } + } + + public class GetStringLengthResponse + { + public int Result { get; set; } + } + + public class MyAllTestAsyncValidator : AbstractValidator + { + public MyAllTestAsyncValidator() + { + RuleFor(x => x.Name).MustAsync(async (s, token) => + { + await Task.Delay(10, token); + return !string.IsNullOrEmpty(s); + }) + .WithMessage("'Name' should not be empty.") + .WithErrorCode("NotEmpty"); + + RuleFor(x => x.Age).MustAsync(async (age, token) => + { + await Task.Delay(10, token); + return age > 0; + }) + .WithMessage("'Age' must be greater than '0'.") + .WithErrorCode("GreaterThan"); + } + } + public class TestAsyncFilterService : Service + { + public object Any(TestAsyncFilter request) + { + request.Results.Add("Service#" + request.GetType().Name); + return request; + } + + public object Any(TestAsyncFilterRestHandler request) + { + request.Results.Add("Service#" + request.GetType().Name); + return request; + } + + public object Any(TestAsyncValidator request) => request; + + public object Any(TestAllAsyncValidator request) => request; + + public object Any(TestAsyncGatewayValidator request) => request; + + public async Task Any(GetStringLength request) + { + await Task.Yield(); + return new GetStringLengthResponse + { + Result = (request.Value ?? "").Length, + }; + } + } + + public class AsyncFiltersTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(AsyncFiltersTests), typeof(TestAsyncFilterService).Assembly) { } + + public static int CancelledAt = -1; + + public override void Configure(Container container) + { + GlobalRequestFiltersAsync.Add(CreateAsyncFilter(0)); + GlobalRequestFiltersAsync.Add(CreateAsyncFilter(1)); + GlobalRequestFiltersAsync.Add(CreateAsyncFilter(2)); + + Plugins.Add(new ValidationFeature()); + container.RegisterValidators(typeof(MyTestAsyncValidator).Assembly); + } + + private static Func CreateAsyncFilter(int pos) + { + return (req, res, dto) => + { + if (dto is TestAsyncFilter asyncDto) + { + CancelledAt++; + + asyncDto.Results.Add("GlobalRequestFiltersAsync#" + pos); + if (asyncDto.ReturnAt == pos) + { + res.ContentType = MimeTypes.Json; + return res.WriteAsync(asyncDto.ToJson()) + .ContinueWith(t => res.EndRequest(skipHeaders: true)); + } + + if (asyncDto.ErrorAt == pos) + throw new ArgumentException("ErrorAt#" + pos); + + if (asyncDto.DirectErrorAt == pos) + { + res.ContentType = MimeTypes.Json; + return res.WriteError(new ArgumentException("DirectErrorAt#" + pos)); + } + + if (asyncDto.CancelAt == pos) + { + var tcs = new TaskCompletionSource(); + tcs.SetCanceled(); + return tcs.Task; + } + + return Task.Delay(10); + } + + return TypeConstants.EmptyTask; + }; + } + } + + private readonly ServiceStackHost appHost; + private JsonServiceClient client; + + public AsyncFiltersTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + client = new JsonServiceClient(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Does_Execute_all_RequestFilters() + { + var response = client.Post(new TestAsyncFilter()); + + response.PrintDump(); + + Assert.That(response.Results, Is.EquivalentTo(new[] + { + "GlobalRequestFiltersAsync#0", + "GlobalRequestFiltersAsync#1", + "GlobalRequestFiltersAsync#2", + "Service#TestAsyncFilter", + })); + } + + [Test] + public void Does_Execute_all_RequestFilters_RestHandler() + { + var response = client.Post(new TestAsyncFilterRestHandler()); + + response.PrintDump(); + + Assert.That(response.Results, Is.EquivalentTo(new[] + { + "GlobalRequestFiltersAsync#0", + "GlobalRequestFiltersAsync#1", + "GlobalRequestFiltersAsync#2", + "Service#TestAsyncFilterRestHandler", + })); + } + + [Test] + public void Does_Execute_all_RequestFilters_in_AutoBatch_Request() + { + var responseBatch = client.SendAll(new[] + { + new TestAsyncFilter(), + new TestAsyncFilter(), + new TestAsyncFilter(), + }); + + Assert.That(responseBatch.Count, Is.EqualTo(3)); + foreach (var response in responseBatch) + { + Assert.That(response.Results, Is.EquivalentTo(new[] + { + "GlobalRequestFiltersAsync#0", + "GlobalRequestFiltersAsync#1", + "GlobalRequestFiltersAsync#2", + "Service#TestAsyncFilter", + })); + } + } + + [Test] + public void Does_return_Error_in_AsyncFilter() + { + try + { + var response = client.Post(new TestAsyncFilter + { + ErrorAt = 1 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.ResponseStatus.PrintDump(); + + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("ErrorAt#1")); + } + } + + [Test] + public void Does_return_Error_in_AsyncFilter_in_AutoBatch_Request() + { + try + { + var responseBatch = client.SendAll(new[] + { + new TestAsyncFilter { ErrorAt = 1 }, + new TestAsyncFilter { ErrorAt = 1 }, + new TestAsyncFilter { ErrorAt = 1 }, + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.ResponseStatus.PrintDump(); + + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("ErrorAt#1")); + } + } + + [Test] + public void Does_return_DirectError_in_AsyncFilter() + { + try + { + var response = client.Post(new TestAsyncFilter + { + DirectErrorAt = 1 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.ResponseStatus.PrintDump(); + + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("DirectErrorAt#1")); + } + } + + [Test] + public void Can_Cancel_in_AsyncFilter() + { + AppHost.CancelledAt = -1; + + var client = new JsonServiceClient(Config.ListeningOn) + { + ResponseFilter = res => + { + Assert.That(res.StatusCode, Is.EqualTo(HttpStatusCode.PartialContent)); + } + }; + + var response = client.Post(new TestAsyncFilter + { + CancelAt = 1 + }); + + Assert.That(response, Is.Null); + Assert.That(AppHost.CancelledAt, Is.EqualTo(1)); + } + + [Test] + public void Can_Cancel_in_AsyncFilter_in_AutoBatch_Request() + { + AppHost.CancelledAt = -1; + + var client = new JsonServiceClient(Config.ListeningOn) + { + ResponseFilter = res => + { + Assert.That(res.StatusCode, Is.EqualTo(HttpStatusCode.PartialContent)); + } + }; + + var responseBatch = client.SendAll(new[] + { + new TestAsyncFilter { CancelAt = 1 }, + new TestAsyncFilter { CancelAt = 1 }, + new TestAsyncFilter { CancelAt = 1 }, + }); + + Assert.That(responseBatch, Is.Null); + Assert.That(AppHost.CancelledAt, Is.EqualTo(1)); + } + + [Test] + public void Does_execute_mixed_async_validator_as_sync() + { + try + { + var response = client.Put(new TestAsyncValidator()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.ResponseStatus.PrintDump(); + var status = ex.ResponseStatus; + + Assert.That(status.ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Message, Is.EqualTo("'Name' must not be empty.")); + + Assert.That(status.Errors.Count, Is.EqualTo(2)); + Assert.That(status.Errors[0].ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Errors[0].FieldName, Is.EqualTo("Name")); + Assert.That(status.Errors[0].Message, Is.EqualTo("'Name' must not be empty.")); + + Assert.That(status.Errors[1].ErrorCode, Is.EqualTo("GreaterThan")); + Assert.That(status.Errors[1].FieldName, Is.EqualTo("Age")); + Assert.That(status.Errors[1].Message, Is.EqualTo("'Age' must be greater than '0'.")); + } + } + + [Test] + public void Does_execute_mixed_async_validator_as_async() + { + try + { + var response = client.Post(new TestAsyncValidator()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.ResponseStatus.PrintDump(); + var status = ex.ResponseStatus; + + Assert.That(status.ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Message, Is.EqualTo("'Name' should not be empty.")); + + Assert.That(status.Errors.Count, Is.EqualTo(2)); + Assert.That(status.Errors[0].ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Errors[0].FieldName, Is.EqualTo("Name")); + Assert.That(status.Errors[0].Message, Is.EqualTo("'Name' should not be empty.")); + + Assert.That(status.Errors[1].ErrorCode, Is.EqualTo("GreaterThan")); + Assert.That(status.Errors[1].FieldName, Is.EqualTo("Age")); + Assert.That(status.Errors[1].Message, Is.EqualTo("'Age' must be greater than '0'.")); + } + } + + [Test] + public void Can_send_valid_mixed_AsyncValidator_request() + { + var syncResponse = client.Put(new TestAsyncValidator { Age = 1, Name = "one" }); + var asyncResponse = client.Post(new TestAsyncValidator { Age = 2, Name = "two" }); + } + + [Test] + public void Does_execute_all_async_validator() + { + try + { + var response = client.Post(new TestAllAsyncValidator()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.ResponseStatus.PrintDump(); + var status = ex.ResponseStatus; + + Assert.That(status.ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Message, Is.EqualTo("'Name' should not be empty.")); + + Assert.That(status.Errors.Count, Is.EqualTo(2)); + Assert.That(status.Errors[0].ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Errors[0].FieldName, Is.EqualTo("Name")); + Assert.That(status.Errors[0].Message, Is.EqualTo("'Name' should not be empty.")); + + Assert.That(status.Errors[1].ErrorCode, Is.EqualTo("GreaterThan")); + Assert.That(status.Errors[1].FieldName, Is.EqualTo("Age")); + Assert.That(status.Errors[1].Message, Is.EqualTo("'Age' must be greater than '0'.")); + } + } + + [Test] + public void Does_execute_async_validator_calling_async_Gateway() + { + try + { + var response = client.Post(new TestAsyncGatewayValidator()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.ResponseStatus.PrintDump(); + var status = ex.ResponseStatus; + + Assert.That(status.ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Message, Is.EqualTo("'Name' should not be empty.")); + + Assert.That(status.Errors.Count, Is.EqualTo(1)); + Assert.That(status.Errors[0].ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Errors[0].FieldName, Is.EqualTo("Name")); + Assert.That(status.Errors[0].Message, Is.EqualTo("'Name' should not be empty.")); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncProgressTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncProgressTests.cs index 845099c7f50..bb165985958 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncProgressTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncProgressTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt @@ -17,7 +17,7 @@ public class AsyncProgressTests ExampleAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new ExampleAppHostHttpListener(); @@ -25,7 +25,7 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncRestClientTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncRestClientTests.cs index a0e286d30ca..a9648c66ba2 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncRestClientTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncRestClientTests.cs @@ -12,7 +12,7 @@ public abstract class AsyncRestClientTests ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new ExampleAppHostHttpListener() @@ -20,13 +20,13 @@ public void OnTestFixtureSetUp() .Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); } - protected abstract IRestClientAsync CreateAsyncRestClient(); + protected abstract IHttpRestClientAsync CreateAsyncRestClient(); [Test] public async Task Can_call_GetAsync_on_GetFactorial_using_RestClientAsync() @@ -116,16 +116,25 @@ public async Task Can_call_DeleteAsync_to_delete_Movie_using_RestClientAsync() [TestFixture] public class JsonAsyncRestServiceClientTests : AsyncRestClientTests { - protected override IRestClientAsync CreateAsyncRestClient() + protected override IHttpRestClientAsync CreateAsyncRestClient() { return new JsonServiceClient(ListeningOn); } } + [TestFixture] + public class JsonAsyncRestServiceHttpClientTests : AsyncRestClientTests + { + protected override IHttpRestClientAsync CreateAsyncRestClient() + { + return new JsonHttpClient(ListeningOn); + } + } + [TestFixture] public class JsvAsyncRestServiceClientTests : AsyncRestClientTests { - protected override IRestClientAsync CreateAsyncRestClient() + protected override IHttpRestClientAsync CreateAsyncRestClient() { return new JsvServiceClient(ListeningOn); } @@ -134,7 +143,7 @@ protected override IRestClientAsync CreateAsyncRestClient() [TestFixture] public class XmlAsyncRestServiceClientTests : AsyncRestClientTests { - protected override IRestClientAsync CreateAsyncRestClient() + protected override IHttpRestClientAsync CreateAsyncRestClient() { return new XmlServiceClient(ListeningOn); } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncServiceClientTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncServiceClientTests.cs index 99633636286..5bc3e6e4174 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncServiceClientTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncServiceClientTests.cs @@ -10,7 +10,7 @@ public abstract class AsyncServiceClientTests ExampleAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new ExampleAppHostHttpListener(); @@ -18,7 +18,7 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -38,6 +38,20 @@ public async Task Can_call_SendAsync_on_ServiceClient() Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(request.ForNumber))); } + + [TestCase(CompressionTypes.Deflate)] + [TestCase(CompressionTypes.GZip)] + public async Task Can_call_SendAsync_with_compression_on_ServiceClient(string compressionType) + { + var jsonClient = new JsonServiceClient(ListeningOn) { RequestCompressionType = compressionType }; + + var request = new GetFactorial { ForNumber = 3 }; + var response = await jsonClient.SendAsync(request); + + Assert.That(response, Is.Not.Null, "No response received"); + Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(request.ForNumber))); + } + [TestFixture] public class JsonAsyncServiceClientTests : AsyncServiceClientTests { @@ -47,6 +61,15 @@ protected override IServiceClient CreateServiceClient() } } + [TestFixture] + public class JsonAsyncHttpClientTests : AsyncServiceClientTests + { + protected override IServiceClient CreateServiceClient() + { + return new JsonHttpClient(ListeningOn); + } + } + [TestFixture] public class JsvAsyncServiceClientTests : AsyncServiceClientTests { diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncTaskTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncTaskTests.cs index 3daddd3a74f..9d02ee539f0 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncTaskTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AsyncTaskTests.cs @@ -12,7 +12,7 @@ public abstract class AsyncTaskTests { private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new AsyncTaskAppHost() @@ -20,7 +20,7 @@ public void TestFixtureSetUp() .Start(Config.ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -133,7 +133,8 @@ public async Task GetAsync_ThrowErrorAwaitAsync() catch (WebServiceException ex) { Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); - Assert.That(ex.Message, Is.EqualTo("Forbidden Test")); + Assert.That(ex.ErrorCode, Is.EqualTo("Forbidden")); + Assert.That(ex.ErrorMessage, Is.EqualTo("Forbidden Test")); } } @@ -153,6 +154,15 @@ protected override IServiceClient CreateServiceClient() } } + [TestFixture] + public class JsonHttpClientAsyncTaskTests : AsyncTaskTests + { + protected override IServiceClient CreateServiceClient() + { + return new JsonHttpClient(Config.ListeningOn); + } + } + [TestFixture] public class JsvAsyncRestServiceClientTests : AsyncTaskTests { @@ -305,7 +315,8 @@ public Task Any(GetFactorialNewTcsAsync request) public async Task Any(ThrowErrorAwaitAsync request) { - throw new HttpError(System.Net.HttpStatusCode.Forbidden, request.Message ?? "Request is forbidden"); + await Task.Delay(0); + throw new HttpError(HttpStatusCode.Forbidden, HttpStatusCode.Forbidden.ToString(), request.Message ?? "Request is forbidden"); } public async Task Any(VoidAsync request) @@ -319,14 +330,14 @@ public static long GetFactorial(long n) } } - [Explicit, TestFixture] + [Ignore("Load Test"), TestFixture] public class AsyncLoadTests { const int NoOfTimes = 1000; private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new AsyncTaskTests.AsyncTaskAppHost() @@ -334,7 +345,7 @@ public void TestFixtureSetUp() .Start(Config.ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -356,6 +367,21 @@ public void Load_test_GetFactorialSync_sync() } } + [Test] + public void Load_test_GetFactorialSync_HttpClient_sync() + { + var client = new JsonHttpClient(Config.ListeningOn); + + for (var i = 0; i < NoOfTimes; i++) + { + var response = client.Get(new GetFactorialSync { ForNumber = 3 }); + if (i % 100 == 0) + { + "{0}: {1}".Print(i, response.Result); + } + } + } + [Test] public async Task Load_test_GetFactorialSync_async() { @@ -376,6 +402,26 @@ public async Task Load_test_GetFactorialSync_async() await Task.WhenAll(fetchTasks); } + [Test] + public async Task Load_test_GetFactorialSync_HttpClient_async() + { + var client = new JsonHttpClient(Config.ListeningOn); + + int i = 0; + + var fetchTasks = NoOfTimes.Times(() => + client.GetAsync(new GetFactorialSync { ForNumber = 3 }) + .ContinueWith(t => + { + if (++i % 100 == 0) + { + "{0}: {1}".Print(i, t.Result.Result); + } + })); + + await Task.WhenAll(fetchTasks); + } + [Test] public void Load_test_GetFactorialGenericAsync_sync() { diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AttributeFiltersTest.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AttributeFiltersTest.cs index 0cd6260b8be..a379c9ca499 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AttributeFiltersTest.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AttributeFiltersTest.cs @@ -32,10 +32,7 @@ public void RequestFilter(IRequest req, IResponse res, object requestDto) previousCache = Cache; } - public IHasRequestFilter Copy() - { - return (IHasRequestFilter)this.MemberwiseClone(); - } + public IRequestFilterBase Copy() => (IRequestFilterBase)this.MemberwiseClone(); } //Only executed for the provided HTTP methods (GET, POST) @@ -66,6 +63,7 @@ public AttributeFiltered() public bool RequestFilterExecuted { get; set; } public bool ContextualRequestFilterExecuted { get; set; } + public bool InheritedRequestFilterExecuted { get; set; } public bool RequestFilterDependenyIsResolved { get; set; } public List AttrsExecuted { get; set; } } @@ -88,10 +86,7 @@ public void ResponseFilter(IRequest req, IResponse res, object response) previousCache = Cache; } - public IHasResponseFilter Copy() - { - return (IHasResponseFilter)this.MemberwiseClone(); - } + public IResponseFilterBase Copy() => (IResponseFilterBase)this.MemberwiseClone(); } //Only executed for the provided HTTP methods (GET, POST) @@ -131,28 +126,76 @@ public object Any(ThrowingAttributeFiltered request) } } - [ResponseFilterTest] - [ContextualResponseFilterTest(ApplyTo.Delete | ApplyTo.Put)] public class AttributeFilteredResponse { - public bool ResponseFilterExecuted { get; set; } - public bool ContextualResponseFilterExecuted { get; set; } - public bool RequestFilterExecuted { get; set; } + public bool InheritedRequestFilterExecuted { get; set; } public bool ContextualRequestFilterExecuted { get; set; } + public bool ResponseFilterExecuted { get; set; } + public bool ContextualResponseFilterExecuted { get; set; } + public bool InheritedResponseFilterExecuted { get; set; } + public bool RequestFilterDependenyIsResolved { get; set; } public bool ResponseFilterDependencyIsResolved { get; set; } + } - public class AttributeFilteredService : IService + [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] + public class PriorityAttribute : RequestFilterAttribute { + public string Name { get; set; } + + public PriorityAttribute(int priority, string name) + { + Priority = priority; + Name = name; + } + + public override void Execute(IRequest req, IResponse res, object requestDto) + { + var dto = (PriorityAttributeTest)requestDto; + dto.Names.Add(Name); + } + } + + public class PriorityAttributeTest : IReturn + { + public PriorityAttributeTest() + { + this.Names = new List(); + } + + public List Names { get; set; } + } + + public class PriortyAttributeService : Service + { + [Priority(3, "3rd")] + [Priority(2, "2nd")] + [Priority(1, "1st")] + public object Any(PriorityAttributeTest request) + { + return request; + } + } + + [InheritedRequestFilter] + [InheritedResponseFilter] + public class AttributeFilteredServiceBase : IService { } + + public class AttributeAttributeFilteredService : AttributeFilteredServiceBase + { + [ResponseFilterTest] + [ContextualResponseFilterTest(ApplyTo.Delete | ApplyTo.Put)] public object Any(AttributeFiltered request) { - return new AttributeFilteredResponse() { + return new AttributeFilteredResponse + { ResponseFilterExecuted = false, ContextualResponseFilterExecuted = false, RequestFilterExecuted = request.RequestFilterExecuted, + InheritedRequestFilterExecuted = request.InheritedRequestFilterExecuted, ContextualRequestFilterExecuted = request.ContextualRequestFilterExecuted, RequestFilterDependenyIsResolved = request.RequestFilterDependenyIsResolved, ResponseFilterDependencyIsResolved = false @@ -160,6 +203,24 @@ public object Any(AttributeFiltered request) } } + public class InheritedRequestFilterAttribute : RequestFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object requestDto) + { + var dto = (AttributeFiltered)requestDto; + dto.InheritedRequestFilterExecuted = true; + } + } + + public class InheritedResponseFilterAttribute : ResponseFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object responseDto) + { + var dto = (AttributeFilteredResponse)responseDto; + dto.InheritedResponseFilterExecuted = true; + } + } + [TestFixture] public class AttributeFiltersTest { @@ -171,7 +232,8 @@ public class AttributeFiltersAppHostHttpListener { public AttributeFiltersAppHostHttpListener() - : base("Attribute Filters Tests", typeof(AttributeFilteredService).Assembly) { } + : base("Attribute Filters Tests", typeof(AttributeAttributeFilteredService).Assembly) + { } public override void Configure(Funq.Container container) { @@ -182,7 +244,7 @@ public override void Configure(Funq.Container container) AttributeFiltersAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new AttributeFiltersAppHostHttpListener(); @@ -190,13 +252,18 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); } - static IServiceClient[] ServiceClients = + public IServiceClient GetServiceClient() + { + return new JsonServiceClient(ServiceClientBaseUri); + } + + static IServiceClient[] ServiceClients = { new JsonServiceClient(ServiceClientBaseUri), new XmlServiceClient(ServiceClientBaseUri), @@ -213,13 +280,15 @@ public void Request_and_Response_Filters_are_executed_using_ServiceClient(IServi new AttributeFiltered { RequestFilterExecuted = false }); Assert.IsTrue(response.RequestFilterExecuted); Assert.IsTrue(response.ResponseFilterExecuted); + Assert.IsTrue(response.InheritedRequestFilterExecuted); + Assert.IsTrue(response.InheritedResponseFilterExecuted); Assert.IsFalse(response.ContextualRequestFilterExecuted); Assert.IsFalse(response.ContextualResponseFilterExecuted); Assert.IsTrue(response.RequestFilterDependenyIsResolved); Assert.IsTrue(response.ResponseFilterDependencyIsResolved); } - static IRestClient[] RestClients = + static IRestClient[] RestClients = { new JsonServiceClient(ServiceClientBaseUri), new XmlServiceClient(ServiceClientBaseUri), @@ -279,6 +348,18 @@ public void Multi_Contextual_Request_and_Response_Filters_are_executed_using_Res Assert.IsTrue(response.ResponseFilterDependencyIsResolved); } + [Test] + public void Does_order_action_attributes_by_priority() + { + var client = GetServiceClient(); + + var response = client.Post(new PriorityAttributeTest()); + + response.PrintDump(); + + Assert.That(response.Names, Is.EqualTo(new[] { "1st", "2nd", "3rd" })); + } + public class ExecutedFirstAttribute : RequestFilterAttribute { public ExecutedFirstAttribute() @@ -303,13 +384,13 @@ public class DummyHolder { } [Test] public void RequestFilters_are_prioritized() { - appHost.Metadata.Add(typeof(AttributeFilteredService), typeof(DummyHolder), null); + appHost.Metadata.Add(typeof(AttributeAttributeFilteredService), typeof(DummyHolder), null); var attributes = FilterAttributeCache.GetRequestFilterAttributes(typeof(DummyHolder)); var attrPriorities = attributes.ToList().ConvertAll(x => x.Priority); - Assert.That(attrPriorities, Is.EquivalentTo(new[] { int.MinValue, -100, -90, -80, 0 })); + Assert.That(attrPriorities, Is.EquivalentTo(new[] { int.MinValue, -100, -90, -80, 0, 0 })); - var execOrder = new IHasRequestFilter[attributes.Length]; + var execOrder = new IRequestFilterBase[attributes.Length]; var i = 0; for (; i < attributes.Length && attributes[i].Priority < 0; i++) { @@ -326,8 +407,7 @@ public void RequestFilters_are_prioritized() } var execOrderPriorities = execOrder.ToList().ConvertAll(x => x.Priority); - execOrderPriorities.PrintDump(); - Assert.That(execOrderPriorities, Is.EquivalentTo(new[] { int.MinValue, -100, -90, -80, 0 })); + Assert.That(execOrderPriorities, Is.EquivalentTo(new[] { int.MinValue, -100, -90, -80, 0, 0 })); } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AttributeFiltersTestAsync.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AttributeFiltersTestAsync.cs new file mode 100644 index 00000000000..a8d1be763a7 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AttributeFiltersTestAsync.cs @@ -0,0 +1,419 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ServiceStack.Caching; +using ServiceStack.Common.Tests.ServiceClient.Web; +using NUnit.Framework; +using ServiceStack.Support.WebHost; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + + //Always executed + public class FilterTestAsyncAttribute : AttributeBase, IHasRequestFilterAsync + { + private static ICacheClient previousCache; + + public ICacheClient Cache { get; set; } + + public int Priority { get; set; } + + public Task RequestFilterAsync(IRequest req, IResponse res, object requestDto) + { + var dto = (AttributeFilteredAsync)requestDto; + dto.AttrsExecuted.Add(GetType().Name); + dto.RequestFilterExecuted = true; + + //Check for equality to previous cache to ensure a filter attribute is no singleton + dto.RequestFilterDependenyIsResolved = Cache != null && !Cache.Equals(previousCache); + + previousCache = Cache; + return TypeConstants.EmptyTask; + } + + public IRequestFilterBase Copy() => (IRequestFilterBase)this.MemberwiseClone(); + } + + //Only executed for the provided HTTP methods (GET, POST) + public class ContextualFilterTestAsyncAttribute : RequestFilterAsyncAttribute + { + public ContextualFilterTestAsyncAttribute(ApplyTo applyTo) + : base(applyTo) {} + + public override Task ExecuteAsync(IRequest req, IResponse res, object requestDto) + { + var dto = (AttributeFilteredAsync)requestDto; + dto.AttrsExecuted.Add(GetType().Name); + dto.ContextualRequestFilterExecuted = true; + return TypeConstants.EmptyTask; + } + } + + [Route("/attributefiltered-async")] + [FilterTestAsync] + [ContextualFilterTestAsync(ApplyTo.Delete | ApplyTo.Put)] + public class AttributeFilteredAsync + { + public AttributeFilteredAsync() + { + this.AttrsExecuted = new List(); + } + + public bool RequestFilterExecuted { get; set; } + public bool ContextualRequestFilterExecuted { get; set; } + public bool InheritedRequestFilterExecuted { get; set; } + public bool RequestFilterDependenyIsResolved { get; set; } + public List AttrsExecuted { get; set; } + } + + //Always executed + public class ResponseFilterTestAsyncAttribute : AttributeBase, IHasResponseFilterAsync + { + private static ICacheClient previousCache; + + public ICacheClient Cache { get; set; } + + public int Priority { get; set; } + + public Task ResponseFilterAsync(IRequest req, IResponse res, object response) + { + var dto = response.GetResponseDto() as AttributeFilteredAsyncResponse; + dto.ResponseFilterExecuted = true; + dto.ResponseFilterDependencyIsResolved = Cache != null && !Cache.Equals(previousCache); + + previousCache = Cache; + return TypeConstants.EmptyTask; + } + + public IResponseFilterBase Copy() => (IResponseFilterBase)this.MemberwiseClone(); + } + + //Only executed for the provided HTTP methods (GET, POST) + public class ContextualResponseFilterTestAsyncAttribute : ResponseFilterAsyncAttribute + { + public ContextualResponseFilterTestAsyncAttribute(ApplyTo applyTo) + : base(applyTo) + { + } + + public override Task ExecuteAsync(IRequest req, IResponse res, object responseDto) + { + var dto = responseDto as AttributeFilteredAsyncResponse; + dto.ContextualResponseFilterExecuted = true; + return TypeConstants.EmptyTask; + } + } + + public class ThrowingFilterAsyncAttribute : RequestFilterAsyncAttribute + { + public override Task ExecuteAsync(IRequest req, IResponse res, object requestDto) + { + throw new ArgumentException("exception message"); + } + } + + [Route("/throwingattributefiltered-async")] + public class ThrowingAttributeFilteredAsync : IReturn + { + } + + [ThrowingFilter] + public class ThrowingAttributeFilteredAsyncService : IService + { + public object Any(ThrowingAttributeFilteredAsync request) + { + return "OK"; + } + } + + public class AttributeFilteredAsyncResponse + { + public bool RequestFilterExecuted { get; set; } + public bool InheritedRequestFilterExecuted { get; set; } + public bool ContextualRequestFilterExecuted { get; set; } + + public bool ResponseFilterExecuted { get; set; } + public bool ContextualResponseFilterExecuted { get; set; } + public bool InheritedResponseFilterExecuted { get; set; } + + public bool RequestFilterDependenyIsResolved { get; set; } + public bool ResponseFilterDependencyIsResolved { get; set; } + + } + + [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] + public class PriorityAsyncAttribute : RequestFilterAsyncAttribute + { + public string Name { get; set; } + + public PriorityAsyncAttribute(int priority, string name) + { + Priority = priority; + Name = name; + } + + public override Task ExecuteAsync(IRequest req, IResponse res, object requestDto) + { + var dto = (PriorityAttributeTestAsync)requestDto; + dto.Names.Add(Name); + return TypeConstants.EmptyTask; + } + } + + public class PriorityAttributeTestAsync : IReturn + { + public PriorityAttributeTestAsync() + { + this.Names = new List(); + } + + public List Names { get; set; } + } + + public class PriorityAttributeAsyncService : Service + { + [PriorityAsync(3, "3rd")] + [PriorityAsync(2, "2nd")] + [PriorityAsync(1, "1st")] + public object Any(PriorityAttributeTestAsync request) + { + return request; + } + } + + [InheritedRequestFilterAsync] + [InheritedResponseFilterAsync] + public class AttributeFilteredServiceAsyncBase : IService { } + + public class AttributeFilteredAsyncService : AttributeFilteredServiceAsyncBase + { + [ResponseFilterTestAsync] + [ContextualResponseFilterTestAsync(ApplyTo.Delete | ApplyTo.Put)] + public object Any(AttributeFilteredAsync request) + { + return new AttributeFilteredAsyncResponse + { + ResponseFilterExecuted = false, + ContextualResponseFilterExecuted = false, + RequestFilterExecuted = request.RequestFilterExecuted, + InheritedRequestFilterExecuted = request.InheritedRequestFilterExecuted, + ContextualRequestFilterExecuted = request.ContextualRequestFilterExecuted, + RequestFilterDependenyIsResolved = request.RequestFilterDependenyIsResolved, + ResponseFilterDependencyIsResolved = false + }; + } + } + + public class InheritedRequestFilterAsyncAttribute : RequestFilterAsyncAttribute + { + public override Task ExecuteAsync(IRequest req, IResponse res, object requestDto) + { + var dto = (AttributeFilteredAsync)requestDto; + dto.InheritedRequestFilterExecuted = true; + return TypeConstants.EmptyTask; + } + } + + public class InheritedResponseFilterAsyncAttribute : ResponseFilterAsyncAttribute + { + public override Task ExecuteAsync(IRequest req, IResponse res, object responseDto) + { + var dto = (AttributeFilteredAsyncResponse)responseDto; + dto.InheritedResponseFilterExecuted = true; + return TypeConstants.EmptyTask; + } + } + + [TestFixture] + public class AttributeFiltersAsyncTest + { + private const string ListeningOn = "http://localhost:1337/"; + private const string ServiceClientBaseUri = "http://localhost:1337/"; + + public class AppHost + : AppHostHttpListenerBase + { + + public AppHost() + : base("Attribute Filters Tests", typeof(AttributeAttributeFilteredService).Assembly) {} + + public override void Configure(Funq.Container container) + { + container.Register(c => new MemoryCacheClient()).ReusedWithin(Funq.ReuseScope.None); + SetConfig(new HostConfig { DebugMode = true }); //show stacktraces + } + } + + AppHost appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new AppHost(); + appHost.Init(); + appHost.Start(ListeningOn); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + public IServiceClient GetServiceClient() + { + return new JsonServiceClient(ServiceClientBaseUri); + } + + static IServiceClient[] ServiceClients = + { + new JsonServiceClient(ServiceClientBaseUri), + new XmlServiceClient(ServiceClientBaseUri), + new JsvServiceClient(ServiceClientBaseUri) + //SOAP not supported in HttpListener + //new Soap11ServiceClient(ServiceClientBaseUri), + //new Soap12ServiceClient(ServiceClientBaseUri) + }; + + [Test, TestCaseSource("ServiceClients")] + public void Request_and_Response_Filters_are_executed_using_ServiceClient(IServiceClient client) + { + var response = client.Send( + new AttributeFilteredAsync { RequestFilterExecuted = false }); + Assert.IsTrue(response.RequestFilterExecuted); + Assert.IsTrue(response.ResponseFilterExecuted); + Assert.IsTrue(response.InheritedRequestFilterExecuted); + Assert.IsTrue(response.InheritedResponseFilterExecuted); + Assert.IsFalse(response.ContextualRequestFilterExecuted); + Assert.IsFalse(response.ContextualResponseFilterExecuted); + Assert.IsTrue(response.RequestFilterDependenyIsResolved); + Assert.IsTrue(response.ResponseFilterDependencyIsResolved); + } + + static IRestClient[] RestClients = + { + new JsonServiceClient(ServiceClientBaseUri), + new XmlServiceClient(ServiceClientBaseUri), + new JsvServiceClient(ServiceClientBaseUri) + }; + + [Test] + public void Proper_exception_is_serialized_to_client() + { + var client = new HtmlServiceClient(ServiceClientBaseUri); + client.SetBaseUri(ServiceClientBaseUri); + + try + { + client.Get(new ThrowingAttributeFilteredAsync()); + } + catch (WebServiceException e) + { + //Ensure we have stack trace present + Assert.IsTrue(e.ResponseBody.Contains("ThrowingFilterAttribute"), "No stack trace in the response (it's probably empty)"); + } + } + + [Test, TestCaseSource("RestClients")] + public void Request_and_Response_Filters_are_executed_using_RestClient(IRestClient client) + { + var response = client.Post("attributefiltered-async", new AttributeFilteredAsync { RequestFilterExecuted = false }); + Assert.IsTrue(response.RequestFilterExecuted); + Assert.IsTrue(response.ResponseFilterExecuted); + Assert.IsFalse(response.ContextualRequestFilterExecuted); + Assert.IsFalse(response.ContextualResponseFilterExecuted); + Assert.IsTrue(response.RequestFilterDependenyIsResolved); + Assert.IsTrue(response.ResponseFilterDependencyIsResolved); + } + + [Test, TestCaseSource("RestClients")] + public void Contextual_Request_and_Response_Filters_are_executed_using_RestClient(IRestClient client) + { + var response = client.Delete("attributefiltered-async"); + Assert.IsTrue(response.RequestFilterExecuted); + Assert.IsTrue(response.ResponseFilterExecuted); + Assert.IsTrue(response.ContextualRequestFilterExecuted); + Assert.IsTrue(response.ContextualResponseFilterExecuted); + Assert.IsTrue(response.RequestFilterDependenyIsResolved); + Assert.IsTrue(response.ResponseFilterDependencyIsResolved); + } + + [Test, TestCaseSource("RestClients")] + public void Multi_Contextual_Request_and_Response_Filters_are_executed_using_RestClient(IRestClient client) + { + var response = client.Put("attributefiltered-async", new AttributeFilteredAsync { RequestFilterExecuted = false }); + Assert.IsTrue(response.RequestFilterExecuted); + Assert.IsTrue(response.ResponseFilterExecuted); + Assert.IsTrue(response.ContextualRequestFilterExecuted); + Assert.IsTrue(response.ContextualResponseFilterExecuted); + Assert.IsTrue(response.RequestFilterDependenyIsResolved); + Assert.IsTrue(response.ResponseFilterDependencyIsResolved); + } + + [Test] + public void Does_order_action_attributes_by_priority() + { + var client = GetServiceClient(); + + var response = client.Post(new PriorityAttributeTestAsync()); + + response.PrintDump(); + + Assert.That(response.Names, Is.EqualTo(new[] { "1st", "2nd", "3rd" })); + } + + public class ExecutedFirstAsyncAttribute : RequestFilterAsyncAttribute + { + public ExecutedFirstAsyncAttribute() + { + Priority = int.MinValue; + } + + public override Task ExecuteAsync(IRequest req, IResponse res, object requestDto) + { + var dto = (AttributeFilteredAsync)requestDto; + dto.AttrsExecuted.Add(GetType().Name); + return TypeConstants.EmptyTask; + } + } + + [ExecutedFirstAsync] + [FilterTestAsync] + [RequiredRole("test")] + [Authenticate] + [RequiredPermission("test")] + public class DummyHolderAsync { } + + [Test] + public void RequestFilters_are_prioritized() + { + appHost.Metadata.Add(typeof(AttributeFilteredAsyncService), typeof(DummyHolderAsync), null); + + var attributes = FilterAttributeCache.GetRequestFilterAttributes(typeof(DummyHolderAsync)); + var attrPriorities = attributes.ToList().ConvertAll(x => x.Priority); + Assert.That(attrPriorities, Is.EquivalentTo(new[] { int.MinValue, -100, -90, -80, 0, 0 })); + + var execOrder = new IRequestFilterBase[attributes.Length]; + var i = 0; + for (; i < attributes.Length && attributes[i].Priority < 0; i++) + { + execOrder[i] = attributes[i]; + Console.WriteLine(attributes[i].Priority); + } + + Console.WriteLine("break;"); + + for (; i < attributes.Length; i++) + { + execOrder[i] = attributes[i]; + Console.WriteLine(attributes[i].Priority); + } + + var execOrderPriorities = execOrder.ToList().ConvertAll(x => x.Priority); + Assert.That(execOrderPriorities, Is.EquivalentTo(new[] { int.MinValue, -100, -90, -80, 0, 0 })); + } + } +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AuthCaseInsensitiveUserNameTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthCaseInsensitiveUserNameTests.cs new file mode 100644 index 00000000000..37763f00acc --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthCaseInsensitiveUserNameTests.cs @@ -0,0 +1,286 @@ +using System; +using System.Reflection; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Data; +using ServiceStack.OrmLite; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class AuthSaveUserNameAsLowerCaseTests + { + public class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(AuthCaseInsensitiveUserNameTests), typeof(AuthCaseInsensitiveUserNameTests).Assembly) {} + + public override void Configure(Container container) + { + container.Register(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + container.Register(c => + new OrmLiteAuthRepository(c.Resolve())); + + container.Resolve().InitSchema(); + + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new [] + { + new CredentialsAuthProvider(AppSettings), + }) + { + IncludeRegistrationService = true, + SaveUserNamesInLowerCase = true, + }); + } + } + + private readonly ServiceStackHost appHost; + public AuthSaveUserNameAsLowerCaseTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Can_register_and_authenticate_with_exact_UserName() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var registerResponse = client.Post(new Register + { + UserName = "Exact", + Email = "exact@gmail.com", + FirstName = "First", + LastName = "Last", + DisplayName = "DisplayName", + Password = "test" + }); + + var response = client.Post(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "Exact", + Password = "test" + }); + + Assert.That(response.UserName, Is.EqualTo("Exact")); + } + + [Test] + public void Can_register_and_login_using_different_cases() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var registerResponse = client.Post(new Register + { + UserName = "Mythz", + Email = "mythz@gmail.com", + FirstName = "First", + LastName = "Last", + DisplayName = "DisplayName", + Password = "test" + }); + + var response = client.Post(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "MythZ", + Password = "test" + }); + + Assert.That(response.UserName, Is.EqualTo("MythZ")); + } + } + + public class AuthCaseInsensitiveUserNameTests + { + public class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(AuthCaseInsensitiveUserNameTests), typeof(AuthCaseInsensitiveUserNameTests).Assembly) {} + + public override void Configure(Container container) + { + container.Register(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + container.Register(c => + new OrmLiteAuthRepository(c.Resolve())); + + container.Resolve().InitSchema(); + + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new [] + { + new CredentialsAuthProvider(AppSettings), + }) + { + IncludeRegistrationService = true, + }); + } + } + + private readonly ServiceStackHost appHost; + public AuthCaseInsensitiveUserNameTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Can_register_and_authenticate_with_exact_UserName() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var registerResponse = client.Post(new Register + { + UserName = "Exact", + Email = "exact@gmail.com", + FirstName = "First", + LastName = "Last", + DisplayName = "DisplayName", + Password = "test" + }); + + var response = client.Post(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "Exact", + Password = "test" + }); + + Assert.That(response.UserName, Is.EqualTo("Exact")); + } + + [Test] + public void Can_register_and_login_using_different_cases_using_case_insensitive_fallback() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var registerResponse = client.Post(new Register + { + UserName = "Mythz", + Email = "mythz@gmail.com", + FirstName = "First", + LastName = "Last", + DisplayName = "DisplayName", + Password = "test" + }); + + var response = client.Post(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "MythZ", + Password = "test" + }); + + Assert.That(response.UserName, Is.EqualTo("MythZ")); + } + } + + public class AuthCaseSensitiveUserNameTests + { + public class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(AuthCaseInsensitiveUserNameTests), typeof(AuthCaseInsensitiveUserNameTests).Assembly) {} + + public override void Configure(Container container) + { + container.Register(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + container.Register(c => + new OrmLiteAuthRepository(c.Resolve()) + { + ForceCaseInsensitiveUserNameSearch = false, + }); + + container.Resolve().InitSchema(); + + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new [] + { + new CredentialsAuthProvider(AppSettings), + }) + { + IncludeRegistrationService = true, + }); + } + } + + private readonly ServiceStackHost appHost; + public AuthCaseSensitiveUserNameTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Can_register_and_authenticate_with_exact_UserName() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var registerResponse = client.Post(new Register + { + UserName = "Exact", + Email = "exact@gmail.com", + FirstName = "First", + LastName = "Last", + DisplayName = "DisplayName", + Password = "test" + }); + + var response = client.Post(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "Exact", + Password = "test" + }); + + Assert.That(response.UserName, Is.EqualTo("Exact")); + } + + [Test] + public void Can_disable_non_index_fallback() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var registerResponse = client.Post(new Register + { + UserName = "Mythz", + Email = "mythz@gmail.com", + FirstName = "First", + LastName = "Last", + DisplayName = "DisplayName", + Password = "test" + }); + + try + { + var response = client.Post(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "MythZ", + Password = "test" + }); + + Assert.Fail("Should fail"); + } + catch (WebServiceException) {} + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AuthDigestTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthDigestTests.cs new file mode 100644 index 00000000000..f7446bb2246 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthDigestTests.cs @@ -0,0 +1,85 @@ +using System; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class AuthDigestTests + { + protected virtual string VirtualDirectory { get { return ""; } } + protected virtual string ListeningOn { get { return "http://localhost:1337/"; } } + protected virtual string WebHostUrl { get { return "http://mydomain.com"; } } + + public class AuthDigestAppHost : AuthAppHost + { + public AuthDigestAppHost(string webHostUrl, Action configureFn = null) + : base(webHostUrl, configureFn) + { } + + public override IAuthProvider[] GetAuthProviders() + { + return new[] { new DigestAuthProvider(AppSettings) }; + } + } + ServiceStackHost appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new AuthDigestAppHost(WebHostUrl, Configure); + appHost.Init(); + appHost.Start(ListeningOn); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + public virtual void Configure(Container container) { } + + IServiceClient GetClientWithUserPassword() + { + return new JsonServiceClient(ListeningOn) + { + UserName = AuthTests.UserName, + Password = AuthTests.Password + }; + } + + [Test] + public void Does_work_with_DigestAuth() + { + try + { + var client = GetClientWithUserPassword(); + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + catch (WebServiceException webEx) + { + Assert.Fail(webEx.Message); + } + } + + [Test] + public async Task Does_work_with_DigestAuth_Async() + { + try + { + var client = GetClientWithUserPassword(); + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + catch (WebServiceException webEx) + { + Assert.Fail(webEx.Message); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AuthRepositoryQueryTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthRepositoryQueryTests.cs new file mode 100644 index 00000000000..73beefbf664 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthRepositoryQueryTests.cs @@ -0,0 +1,273 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Data; +using ServiceStack.OrmLite; +using ServiceStack.Redis; +using ServiceStack.Script; +using ServiceStack.Testing; + +using Raven.Client; +using ServiceStack.Authentication.RavenDb; +using ServiceStack.DataAnnotations; +using Raven.Client.Documents; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class MemoryAuthRepositoryQueryTests : AuthRepositoryQueryTestsBase + { + public override void ConfigureAuthRepo(Container container) => + new MemoryAuthRepositoryTests().ConfigureAuthRepo(container); + } + + public class RedisAuthRepositoryQueryTests : AuthRepositoryQueryTestsBase + { + public override void ConfigureAuthRepo(Container container) => + new RedisAuthRepositoryTests().ConfigureAuthRepo(container); + } + + public class OrmLiteAuthRepositoryQueryTests : AuthRepositoryQueryTestsBase + { + public override void ConfigureAuthRepo(Container container) => + new OrmLiteAuthRepositoryTests().ConfigureAuthRepo(container); + } + + public class OrmLiteAuthRepositoryQueryDistinctRolesTests : AuthRepositoryQueryTestsBase + { + public override void ConfigureAuthRepo(Container container) + { + new OrmLiteAuthRepositoryDistinctRolesTests().ConfigureAuthRepo(container); + } + } + + [NUnit.Framework.Ignore("Requires RavenDB")] + public class RavenDbAuthRepositoryQueryTests : AuthRepositoryQueryTestsBase + { + public override void ConfigureAuthRepo(Container container) => + new RavenDbAuthRepositoryTests().ConfigureAuthRepo(container); + } + + [NUnit.Framework.Ignore("Requires MongoDB")] + public class MongoDbAuthRepositoryQueryTests : AuthRepositoryQueryTestsBase + { + public override void ConfigureAuthRepo(Container container) => + new MongoDbAuthRepositoryTests().ConfigureAuthRepo(container); + } + + [NUnit.Framework.Ignore("Requires DynamoDB")] + public class DynamoDbAuthRepositoryQueryTests : AuthRepositoryQueryTestsBase + { + public override void ConfigureAuthRepo(Container container) => + new DynamoDbAuthRepositoryTests().ConfigureAuthRepo(container); + } + + [TestFixture] + public abstract class AuthRepositoryQueryTestsBase + { + protected ServiceStackHost appHost; + + public abstract void ConfigureAuthRepo(Container container); + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = new BasicAppHost(typeof(AuthRepositoryQueryTestsBase).Assembly) + { + ConfigureAppHost = host => + { + host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { + new CredentialsAuthProvider(), + }) + { + IncludeRegistrationService = true, + }); + + host.Plugins.Add(new SharpPagesFeature()); + }, + ConfigureContainer = container => { + + ConfigureAuthRepo(container); + + var authRepo = container.Resolve(); + if (authRepo is IClearable clearable) + { + try { clearable.Clear(); } catch {} + } + + authRepo.InitSchema(); + + SeedData(authRepo); + } + }.Init(); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + void SeedData(IAuthRepository authRepo) + { + var newUser = authRepo.CreateUserAuth(new AppUser + { + Id = 1, + DisplayName = "Test User", + Email = "user@gmail.com", + FirstName = "Test", + LastName = "User", + }, "p@55wOrd"); + + newUser = authRepo.CreateUserAuth(new AppUser + { + Id = 2, + DisplayName = "Test Manager", + Email = "manager@gmail.com", + FirstName = "Test", + LastName = "Manager", + }, "p@55wOrd"); + authRepo.AssignRoles(newUser, roles:new[]{ "Manager" }); + + newUser = authRepo.CreateUserAuth(new AppUser + { + Id = 3, + DisplayName = "Admin User", + Email = "admin@gmail.com", + FirstName = "Admin", + LastName = "Super User", + }, "p@55wOrd"); + authRepo.AssignRoles(newUser, roles:new[]{ "Admin" }); + } + + private static bool IsRavenDb(IAuthRepository authRepo) => authRepo.GetType().Name.StartsWith("Raven"); + + private static void AssertHasIdentity(IAuthRepository authRepo, List allUsers) + { + Assert.That(IsRavenDb(authRepo) + ? allUsers.Cast().All(x => x.Key != null) + : allUsers.All(x => x.Id > 0)); + } + + [Test] + public void Can_QueryUserAuth_GetUserAuths() + { + var authRepo = appHost.GetAuthRepository(); + using (authRepo as IDisposable) + { + var allUsers = authRepo.GetUserAuths(); + Assert.That(allUsers.Count, Is.EqualTo(3)); + AssertHasIdentity(authRepo, allUsers); + + Assert.That(allUsers.All(x => x.Email != null)); + + allUsers = authRepo.GetUserAuths(skip:1); + Assert.That(allUsers.Count, Is.EqualTo(2)); + allUsers = authRepo.GetUserAuths(take:2); + Assert.That(allUsers.Count, Is.EqualTo(2)); + allUsers = authRepo.GetUserAuths(skip:1,take:2); + Assert.That(allUsers.Count, Is.EqualTo(2)); + } + } + + [Test] + public void Can_QueryUserAuth_GetUserAuths_OrderBy() + { + var authRepo = appHost.GetAuthRepository(); + using (authRepo as IDisposable) + { + var allUsers = authRepo.GetUserAuths(orderBy:nameof(UserAuth.Id)); + Assert.That(allUsers.Count, Is.EqualTo(3)); + Assert.That(allUsers[0].Email, Is.EqualTo("user@gmail.com")); + + var idField = IsRavenDb(authRepo) + ? nameof(AppUser.Key) + : nameof(UserAuth.Id); + allUsers = authRepo.GetUserAuths(orderBy: idField + " DESC"); + Assert.That(allUsers.Count, Is.EqualTo(3)); + Assert.That(allUsers[0].Email, Is.EqualTo("admin@gmail.com")); + + allUsers = authRepo.GetUserAuths(orderBy:nameof(UserAuth.DisplayName)); + Assert.That(allUsers.Count, Is.EqualTo(3)); + Assert.That(allUsers[0].DisplayName, Is.EqualTo("Admin User")); + + allUsers = authRepo.GetUserAuths(orderBy:nameof(UserAuth.Email)); + Assert.That(allUsers.Count, Is.EqualTo(3)); + Assert.That(allUsers[0].Email, Is.EqualTo("admin@gmail.com")); + + allUsers = authRepo.GetUserAuths(orderBy:nameof(UserAuth.CreatedDate) + " DESC"); + Assert.That(allUsers.Count, Is.EqualTo(3)); + Assert.That(allUsers[0].DisplayName, Is.EqualTo("Admin User")); + } + } + + [Test] + public void Can_QueryUserAuth_SearchUserAuths() + { + var authRepo = appHost.GetAuthRepository(); + using (authRepo as IDisposable) + { + var allUsers = authRepo.SearchUserAuths("gmail.com"); + Assert.That(allUsers.Count, Is.EqualTo(3)); + AssertHasIdentity(authRepo, allUsers); + Assert.That(allUsers.All(x => x.Email != null)); + + allUsers = authRepo.SearchUserAuths(query:"gmail.com",skip:1); + Assert.That(allUsers.Count, Is.EqualTo(2)); + allUsers = authRepo.SearchUserAuths(query:"gmail.com",take:2); + Assert.That(allUsers.Count, Is.EqualTo(2)); + allUsers = authRepo.SearchUserAuths(query:"gmail.com",skip:1,take:2); + Assert.That(allUsers.Count, Is.EqualTo(2)); + + if (!IsRavenDb(authRepo)) // RavenDB only searches UserName/Email and only StartsWith/EndsWith + { + allUsers = authRepo.SearchUserAuths(query:"Test"); + Assert.That(allUsers.Count, Is.EqualTo(2)); + + allUsers = authRepo.SearchUserAuths(query:"Admin"); + Assert.That(allUsers.Count, Is.EqualTo(1)); + + allUsers = authRepo.SearchUserAuths(query:"Test",skip:1,take:1,orderBy:nameof(UserAuth.Email)); + Assert.That(allUsers.Count, Is.EqualTo(1)); + Assert.That(allUsers[0].Email, Is.EqualTo("user@gmail.com")); + } + } + } + + [Test] + public void Can_QueryUserAuth_in_Script() + { + var context = appHost.AssertPlugin(); + Assert.That(context.EvaluateScript("{{ authRepo.getUserAuths() | count }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ authRepo.getUserAuths({ orderBy:'Id' }) | map => it.Id | join }}"), Is.EqualTo("1,2,3")); + Assert.That(context.EvaluateScript("{{ authRepo.getUserAuths({ skip:1, orderBy:'Id' }) | map => it.Id | join }}"), Is.EqualTo("2,3")); + Assert.That(context.EvaluateScript("{{ authRepo.getUserAuths({ take:2, orderBy:'Id' }) | map => it.Id | join }}"), Is.EqualTo("1,2")); + Assert.That(context.EvaluateScript("{{ authRepo.getUserAuths({ skip:1, take:2, orderBy:'Id' }) | map => it.Id | join }}"), Is.EqualTo("2,3")); + + Assert.That(context.EvaluateScript("{{ authRepo.searchUserAuths({ query:'gmail.com',orderBy:'Id'}) | map => it.Id | join }}"), Is.EqualTo("1,2,3")); + Assert.That(context.EvaluateScript("{{ authRepo.searchUserAuths({ query:'gmail.com',skip:1,take:1,orderBy:'Id'}) | map => it.Id | join }}"), Is.EqualTo("2")); + + if (!IsRavenDb(appHost.TryResolve())) + { + Assert.That(context.EvaluateScript("{{ authRepo.searchUserAuths({ query:'gmail.com', orderBy:'LastName DESC' }) | map => it.Id | join }}"), Is.EqualTo("1,3,2")); + Assert.That(context.EvaluateScript("{{ authRepo.searchUserAuths({ query:'Test', orderBy:'Email' }) | map => it.Id | join }}"), Is.EqualTo("2,1")); + Assert.That(context.EvaluateScript("{{ authRepo.searchUserAuths({ query:'Test', orderBy:'Id' }) | map => it.Id | join }}"), Is.EqualTo("1,2")); + } + } + + [Test] + public void Can_fetch_roles_and_permissions() + { + var authRepo = appHost.GetAuthRepository(); + using (authRepo as IDisposable) + { + if (authRepo is IManageRoles manageRoles) + { + manageRoles.GetRolesAndPermissions("3", + out var roles, out var permissions); + + Assert.That(roles, Is.EquivalentTo(new[] { "Admin" })); + } + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AuthRepositoryTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthRepositoryTests.cs new file mode 100644 index 00000000000..dd1218b3397 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthRepositoryTests.cs @@ -0,0 +1,268 @@ +using System; +using System.Collections.Generic; +using System.Net; +using Amazon.DynamoDBv2; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Testing; +using ServiceStack.DataAnnotations; + +using MongoDB.Driver; +using ServiceStack.Authentication.MongoDb; + +using ServiceStack.Authentication.RavenDb; +using ServiceStack.Data; +using ServiceStack.OrmLite; +using ServiceStack.Redis; +using ServiceStack.Text; +using Raven.Client; +using Raven.Client.Documents; +using Raven.Client.Documents.Operations; +using Raven.Client.Documents.Queries; +using ServiceStack.Aws.DynamoDb; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + // Custom UserAuth Data Model with extended Metadata properties + [Index(Name = nameof(Key))] + public class AppUser : UserAuth + { + public string Key { get; set; } + public string ProfileUrl { get; set; } + public string LastLoginIp { get; set; } + public DateTime? LastLoginDate { get; set; } + } + + [Index(Name = nameof(Key))] + public class AppUserDetails : UserAuthDetails + { + public string Key { get; set; } + } + + public class MemoryAuthRepositoryTests : AuthRepositoryTestsBase + { + public override void ConfigureAuthRepo(Container container) + { + container.Register(c => new InMemoryAuthRepository()); + } + } + + public class RedisAuthRepositoryTests : AuthRepositoryTestsBase + { + public override void ConfigureAuthRepo(Container container) + { + container.Register(c => new RedisManagerPool()); + container.Register(c => + new RedisAuthRepository(c.Resolve())); + } + } + + public class OrmLiteAuthRepositoryTests : AuthRepositoryTestsBase + { + public override void ConfigureAuthRepo(Container container) + { + container.Register(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider) { + AutoDisposeConnection = false, + }); + + container.Register(c => + new OrmLiteAuthRepository(c.Resolve())); + } + } + + public class OrmLiteAuthRepositoryDistinctRolesTests : AuthRepositoryTestsBase + { + public override void ConfigureAuthRepo(Container container) + { + container.Register(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider) { + AutoDisposeConnection = false, + }); + + container.Register(c => + new OrmLiteAuthRepository(c.Resolve()) { + UseDistinctRoleTables = true, + }); + } + } + + [NUnit.Framework.Ignore("Requires RavenDB")] + public class RavenDbAuthRepositoryTests : AuthRepositoryTestsBase + { + public override void ConfigureAuthRepo(Container container) + { + var store = new DocumentStore + { + Urls = new[] // URL to the Server, + { // or list of URLs + "http://localhost:8080" // to all Cluster Servers (Nodes) + }, + Database = "test", // Default database that DocumentStore will interact with + Conventions = { + } + }; + store.Conventions.FindIdentityProperty = RavenDbUserAuthRepository.FindIdentityProperty; + + container.AddSingleton(store.Initialize()); + + container.Register(c => + new RavenDbUserAuthRepository(c.Resolve())); + + var response = $"http://localhost:8080/databases/test/queries?allowStale=False&maxOpsPerSec=&details=False" + .SendStringToUrl(HttpMethods.Delete, "{\"Query\":\"from AppUsers\",\"QueryParameters\":null}"); + } + } + + [NUnit.Framework.Ignore("Requires MongoDB")] + public class MongoDbAuthRepositoryTests : AuthRepositoryTestsBase + { + public override void ConfigureAuthRepo(Container container) + { + var mongoClient = new MongoClient(); + mongoClient.DropDatabase("MyApp"); + IMongoDatabase mongoDatabase = mongoClient.GetDatabase("MyApp"); + + container.AddSingleton(mongoDatabase); + container.AddSingleton(c => + new MongoDbAuthRepository(c.Resolve(), createMissingCollections:true)); + } + } + + [NUnit.Framework.Ignore("Requires DynamoDB")] + public class DynamoDbAuthRepositoryTests : AuthRepositoryTestsBase + { + public static IPocoDynamo CreatePocoDynamo() + { + var dynamoClient = CreateDynamoDbClient(); + var db = new PocoDynamo(dynamoClient); + return db; + } + + public static string DynamoDbUrl = Environment.GetEnvironmentVariable("CI_DYNAMODB") + ?? "http://localhost:8000"; + + public static AmazonDynamoDBClient CreateDynamoDbClient() + { + var dynamoClient = new AmazonDynamoDBClient("keyId", "key", new AmazonDynamoDBConfig { + ServiceURL = DynamoDbUrl, + }); + return dynamoClient; + } + + public override void ConfigureAuthRepo(Container container) + { + var db = CreatePocoDynamo(); + container.AddSingleton(db); + container.Register(c => + new DynamoDbAuthRepository(c.Resolve())); + } + } + + public abstract class AuthRepositoryTestsBase + { + private ServiceStackHost appHost; + + public abstract void ConfigureAuthRepo(Container container); + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = new BasicAppHost(typeof(AuthRepositoryQueryTestsBase).Assembly) + { + ConfigureAppHost = host => + { + host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { + new CredentialsAuthProvider(), + }) + { + IncludeRegistrationService = true, + }); + + host.Plugins.Add(new SharpPagesFeature()); + }, + ConfigureContainer = container => { + ConfigureAuthRepo(container); + var authRepo = container.Resolve(); + + if (authRepo is IClearable clearable) + { + try { clearable.Clear(); } catch {} + } + + authRepo.InitSchema(); + } + }.Init(); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Can_CreateUserAuth() + { + var authRepo = appHost.TryResolve(); + + var newUser = authRepo.CreateUserAuth(new AppUser + { + DisplayName = "Test User", + Email = "user@gmail.com", + FirstName = "Test", + LastName = "User", + }, "p@55wOrd"); + + Assert.That(newUser.Email, Is.EqualTo("user@gmail.com")); + + var fromDb = authRepo.GetUserAuth((newUser as AppUser)?.Key ?? newUser.Id.ToString()); + Assert.That(fromDb.Email, Is.EqualTo("user@gmail.com")); + + newUser.FirstName = "Updated"; + authRepo.SaveUserAuth(newUser); + + var newSession = SessionFeature.CreateNewSession(null, "SESSION_ID"); + newSession.PopulateSession(newUser); + + var updatedUser = authRepo.GetUserAuth(newSession.UserAuthId); + Assert.That(updatedUser, Is.Not.Null); + Assert.That(updatedUser.FirstName, Is.EqualTo("Updated")); + } + + [Test] + public void Can_AddUserAuthDetails() + { + var authRepo = appHost.TryResolve(); + + var newUser = authRepo.CreateUserAuth(new AppUser + { + DisplayName = "Facebook User", + Email = "user@fb.com", + FirstName = "Face", + LastName = "Book", + }, "p@55wOrd"); + + var newSession = SessionFeature.CreateNewSession(null, "SESSION_ID"); + newSession.PopulateSession(newUser); + Assert.That(newSession.Email, Is.EqualTo("user@fb.com")); + + var fbAuthTokens = new AuthTokens + { + Provider = FacebookAuthProvider.Name, + AccessTokenSecret = "AAADDDCCCoR848BAMkQIZCRIKnVWZAvcKWqo7Ibvec8ebV9vJrfZAz8qVupdu5EbjFzmMmbwUFDbcNDea9H6rOn5SVn8es7KYZD", + UserId = "123456", + DisplayName = "FB User", + FirstName = "FB", + LastName = "User", + Email = "user@fb.com", + }; + + var userAuthDetails = authRepo.CreateOrMergeAuthSession(newSession, fbAuthTokens); + Assert.That(userAuthDetails.Email, Is.EqualTo("user@fb.com")); + + var userAuthDetailsList = authRepo.GetUserAuthDetails(newSession.UserAuthId); + Assert.That(userAuthDetailsList.Count, Is.EqualTo(1)); + Assert.That(userAuthDetailsList[0].Email, Is.EqualTo("user@fb.com")); + } + + } +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AuthTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthTests.cs index a3b661ce57d..d6fad58b655 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AuthTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AuthTests.cs @@ -60,7 +60,7 @@ public object Post(SecuredFileUpload request) FileName = file.FileName, ContentLength = file.ContentLength, ContentType = file.ContentType, - Contents = new StreamReader(file.InputStream).ReadToEnd(), + Contents = file.InputStream.ReadToEnd(), CustomerId = request.CustomerId, CustomerName = request.CustomerName }; @@ -175,9 +175,35 @@ public class CustomUserSession : WebSudoAuthUserSession { public override void OnAuthenticated(IServiceBase authService, IAuthSession session, IAuthTokens tokens, System.Collections.Generic.Dictionary authInfo) { - if (session.UserName == AuthTests.UserNameWithSessionRedirect) + if (session.UserAuthName == AuthTests.UserNameWithSessionRedirect) session.ReferrerUrl = AuthTests.SessionRedirectUrl; } + + public int Counter { get; set; } + } + + public class IncrSession : IReturn + { + public int? By { get; set; } + } + + [Route("/unsecure")] + public class Unsecure : IReturn + { + public string Name { get; set; } + } + + public class CustomUserSessionService : Service + { + public object Any(IncrSession request) + { + var session = SessionAs(); + session.Counter += request.By.GetValueOrDefault(1); + Request.SaveSession(session); + return session; + } + + public object Any(Unsecure request) => request; } public class CustomAuthProvider : AuthProvider @@ -221,14 +247,14 @@ public RequiresCustomAuthResponse Any(RequiresCustomAuth request) public class CustomAuthenticateAttribute : AuthenticateAttribute { - public override void Execute(IRequest req, IResponse res, object requestDto) + public override Task ExecuteAsync(IRequest req, IResponse res, object requestDto) { //Need to run SessionFeature filter since its not executed before this attribute (Priority -100) SessionFeature.AddSessionIdToRequestFilter(req, res, null); //Required to get req.GetSessionId() req.Items["TriedMyOwnAuthFirst"] = true; // let's simulate some sort of auth _before_ relaying to base class. - base.Execute(req, res, requestDto); + return base.ExecuteAsync(req, res, requestDto); } } @@ -277,102 +303,108 @@ public object Any(RequiresWebSudo request) } } - public class AuthTests + public class AuthAppHost + : AppSelfHostBase { - protected virtual string VirtualDirectory { get { return ""; } } - protected virtual string ListeningOn { get { return "http://localhost:1337/"; } } - protected virtual string WebHostUrl { get { return "http://mydomain.com"; } } + private readonly string webHostUrl; + private readonly Action configureFn; + public AuthAppHost(string webHostUrl, Action configureFn = null) + : base("Validation Tests", typeof(CustomerService).Assembly) + { + this.webHostUrl = webHostUrl; + this.configureFn = configureFn; + } - private const string UserName = "user"; - private const string Password = "p@55word"; - public const string UserNameWithSessionRedirect = "user2"; - public const string PasswordForSessionRedirect = "p@55word2"; - public const string SessionRedirectUrl = "specialLandingPage.html"; - public const string LoginUrl = "specialLoginPage.html"; - private const string EmailBasedUsername = "user@email.com"; - private const string PasswordForEmailBasedAccount = "p@55word3"; + private InMemoryAuthRepository userRep; - public class AuthAppHostHttpListener - : AppHostHttpListenerBase + public override void Configure(Container container) { - private readonly string webHostUrl; - private Action configureFn; + SetConfig(new HostConfig { WebHostUrl = webHostUrl, DebugMode = true }); - public AuthAppHostHttpListener(string webHostUrl, Action configureFn=null) - : base("Validation Tests", typeof(CustomerService).Assembly) + Plugins.Add(new AuthFeature(() => new CustomUserSession(), + GetAuthProviders(), "~/" + AuthTests.LoginUrl) { - this.webHostUrl = webHostUrl; - this.configureFn = configureFn; - } + AllowGetAuthenticateRequests = req => true, + RegisterPlugins = { new WebSudoFeature() }, + }); - private InMemoryAuthRepository userRep; + container.Register(new MemoryCacheClient()); + userRep = new InMemoryAuthRepository(); + container.Register(userRep); - public override void Configure(Container container) + if (configureFn != null) { - SetConfig(new HostConfig { WebHostUrl = webHostUrl, DebugMode = true }); - - Plugins.Add(new AuthFeature(() => new CustomUserSession(), - new IAuthProvider[] { //Www-Authenticate should contain basic auth, therefore register this provider first - new BasicAuthProvider(), //Sign-in with Basic Auth - new CredentialsAuthProvider(), //HTML Form post of UserName/Password credentials - new CustomAuthProvider() - }, "~/" + LoginUrl) { RegisterPlugins = { new WebSudoFeature() } }); + configureFn(container); + } - container.Register(new MemoryCacheClient()); - userRep = new InMemoryAuthRepository(); - container.Register(userRep); + CreateUser(1, AuthTests.UserName, null, AuthTests.Password, new List { "TheRole" }, new List { "ThePermission" }); + CreateUser(2, AuthTests.UserNameWithSessionRedirect, null, AuthTests.PasswordForSessionRedirect); + CreateUser(3, null, AuthTests.EmailBasedUsername, AuthTests.PasswordForEmailBasedAccount); + } - if (configureFn != null) - { - configureFn(container); - } + public virtual IAuthProvider[] GetAuthProviders() + { + return new IAuthProvider[] { //Www-Authenticate should contain basic auth, therefore register this provider first + new BasicAuthProvider(), //Sign-in with Basic Auth + new CredentialsAuthProvider(), //HTML Form post of UserName/Password credentials + new CustomAuthProvider() + }; + } - CreateUser(1, UserName, null, Password, new List { "TheRole" }, new List { "ThePermission" }); - CreateUser(2, UserNameWithSessionRedirect, null, PasswordForSessionRedirect); - CreateUser(3, null, EmailBasedUsername, PasswordForEmailBasedAccount); - } + private void CreateUser(int id, string username, string email, string password, List roles = null, List permissions = null) + { + new SaltedHash().GetHashAndSaltString(password, out var hash, out var salt); - private void CreateUser(int id, string username, string email, string password, List roles = null, List permissions = null) + userRep.CreateUserAuth(new UserAuth { - string hash; - string salt; - new SaltedHash().GetHashAndSaltString(password, out hash, out salt); - - userRep.CreateUserAuth(new UserAuth - { - Id = id, - DisplayName = "DisplayName", - Email = email ?? "as@if{0}.com".Fmt(id), - UserName = username, - FirstName = "FirstName", - LastName = "LastName", - PasswordHash = hash, - Salt = salt, - Roles = roles, - Permissions = permissions - }, password); - } + Id = id, + DisplayName = "DisplayName", + Email = email ?? "as@if{0}.com".Fmt(id), + UserName = username, + FirstName = "FirstName", + LastName = "LastName", + PasswordHash = hash, + Salt = salt, + Roles = roles, + Permissions = permissions + }, password); + } - protected override void Dispose(bool disposing) - { - // Needed so that when the derived class tests run the same users can be added again. - userRep.Clear(); - base.Dispose(disposing); - } + protected override void Dispose(bool disposing) + { + // Needed so that when the derived class tests run the same users can be added again. + userRep.Clear(); + base.Dispose(disposing); } + } + + public class AuthTests + { + protected virtual string VirtualDirectory => ""; + protected virtual string ListeningOn => "http://localhost:1337/"; + protected virtual string WebHostUrl => "http://mydomain.com"; + + public const string UserName = "user"; + public const string Password = "p@55word"; + public const string UserNameWithSessionRedirect = "user2"; + public const string PasswordForSessionRedirect = "p@55word2"; + public const string SessionRedirectUrl = "specialLandingPage.html"; + public const string LoginUrl = "specialLoginPage.html"; + public const string EmailBasedUsername = "user@email.com"; + public const string PasswordForEmailBasedAccount = "p@55word3"; - AuthAppHostHttpListener appHost; + ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { - appHost = new AuthAppHostHttpListener(WebHostUrl, Configure); + appHost = new AuthAppHost(WebHostUrl, Configure); appHost.Init(); appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -456,7 +488,7 @@ public void PostFile_with_no_Credentials_throws_UnAuthorized() try { var client = GetClient(); - var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); client.PostFile(ListeningOn + "/securedfileupload", uploadFile, MimeTypes.GetMimeType(uploadFile.Name)); Assert.Fail("Shouldn't be allowed"); @@ -472,9 +504,9 @@ public void PostFile_with_no_Credentials_throws_UnAuthorized() public void PostFile_does_work_with_BasicAuth() { var client = GetClientWithUserPassword(); - var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); - var expectedContents = new StreamReader(uploadFile.OpenRead()).ReadToEnd(); + var expectedContents = uploadFile.OpenRead().ReadToEnd(); var response = client.PostFile(ListeningOn + "/securedfileupload", uploadFile, MimeTypes.GetMimeType(uploadFile.Name)); Assert.That(response.FileName, Is.EqualTo(uploadFile.Name)); Assert.That(response.ContentLength, Is.EqualTo(uploadFile.Length)); @@ -486,9 +518,9 @@ public void PostFileWithRequest_does_work_with_BasicAuth() { var client = GetClientWithUserPassword(); var request = new SecuredFileUpload { CustomerId = 123, CustomerName = "Foo" }; - var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); - var expectedContents = new StreamReader(uploadFile.OpenRead()).ReadToEnd(); + var expectedContents = uploadFile.OpenRead().ReadToEnd(); var response = client.PostFileWithRequest(ListeningOn + "/securedfileupload", uploadFile, request); Assert.That(response.FileName, Is.EqualTo(uploadFile.Name)); Assert.That(response.ContentLength, Is.EqualTo(uploadFile.Length)); @@ -513,6 +545,22 @@ public void Does_work_with_BasicAuth() } } + [Test] + public async Task Does_work_with_BasicAuth_Async() + { + try + { + var client = GetClientWithUserPassword(); + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + catch (WebServiceException webEx) + { + Assert.Fail(webEx.Message); + } + } + [Test] public void Does_always_send_BasicAuth() { @@ -520,16 +568,108 @@ public void Does_always_send_BasicAuth() { var client = (ServiceClientBase)GetClientWithUserPassword(); client.AlwaysSendBasicAuthHeader = true; - client.RequestFilter = req => + client.RequestFilter = req => + Assert.That(req.Headers[HttpHeaders.Authorization], Is.Not.Null); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + catch (WebServiceException webEx) + { + Assert.Fail(webEx.Message); + } + } + + [Test] + public void Authenticating_once_with_BasicAuth_does_not_establish_auth_session() + { + var client = (ServiceClientBase)GetClientWithUserPassword(); + client.AlwaysSendBasicAuthHeader = true; + client.RequestFilter = req => + Assert.That(req.Headers[HttpHeaders.Authorization], Is.Not.Null); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var nonBasicAuthClient = GetClient(); + nonBasicAuthClient.SetSessionId(client.GetSessionId()); + try + { + response = nonBasicAuthClient.Send(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + } + + [Test] + public void Does_return_SessionId_Cookies() + { + var client = GetClient(); + var authResponse = client.Send(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "user", + Password = "p@55word", + }); + var cookies = client.GetCookieValues(); + Assert.That(authResponse.SessionId, Is.EqualTo(cookies["ss-id"])); + + client = GetClient(); + authResponse = client.Send(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "user", + Password = "p@55word", + RememberMe = true, + }); + cookies = client.GetCookieValues(); + Assert.That(authResponse.SessionId, Is.EqualTo(cookies["ss-pid"])); + } + + [Test] + public async Task Does_return_SessionId_Cookies_Async() + { + var client = GetClient(); + var authResponse = await client.PostAsync(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "user", + Password = "p@55word", + }); + var cookies = client.GetCookieValues(); + Assert.That(authResponse.SessionId, Is.EqualTo(cookies["ss-id"])); + + client = GetClient(); + authResponse = await client.PostAsync(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "user", + Password = "p@55word", + RememberMe = true, + }); + cookies = client.GetCookieValues(); + Assert.That(authResponse.SessionId, Is.EqualTo(cookies["ss-pid"])); + } + + [Test] + public void Does_work_with_CredentialsAuth() + { + try + { + var client = GetClient(); + + var authResponse = client.Send(new Authenticate { - bool hasAuthentication = false; - foreach (var key in req.Headers.Keys) - { - if (key.ToString() == "Authorization") - hasAuthentication = true; - } - Assert.IsTrue(hasAuthentication); - }; + provider = CredentialsAuthProvider.Name, + UserName = "user", + Password = "p@55word", + RememberMe = true, + }); var request = new Secured { Name = "test" }; var response = client.Send(request); @@ -542,7 +682,7 @@ public void Does_always_send_BasicAuth() } [Test] - public void Does_work_with_CredentailsAuth() + public void Can_sent_Session_using_Headers() { try { @@ -556,10 +696,12 @@ public void Does_work_with_CredentailsAuth() RememberMe = true, }); - authResponse.PrintDump(); + var clientWithHeaders = (JsonServiceClient)GetClient(); + clientWithHeaders.Headers["X-ss-pid"] = authResponse.SessionId; + clientWithHeaders.Headers["X-ss-opt"] = "perm"; var request = new Secured { Name = "test" }; - var response = client.Send(request); + var response = clientWithHeaders.Send(request); Assert.That(response.Result, Is.EqualTo(request.Name)); } catch (WebServiceException webEx) @@ -569,12 +711,12 @@ public void Does_work_with_CredentailsAuth() } [Test] - public async Task Does_work_with_CredentailsAuth_Async() + public async Task Does_work_with_CredentialsAuth_Async() { var client = GetClient(); var request = new Secured { Name = "test" }; - var authResponse = await client.SendAsync( + var authResponse = await client.SendAsync( new Authenticate { provider = CredentialsAuthProvider.Name, @@ -583,8 +725,6 @@ public async Task Does_work_with_CredentailsAuth_Async() RememberMe = true, }); - authResponse.PrintDump(); - var response = await client.SendAsync(request); Assert.That(response.Result, Is.EqualTo(request.Name)); @@ -763,7 +903,7 @@ public void Does_work_with_CredentailsAuth_Multiple_Times() Console.WriteLine(authResponse.Dump()); - for (int i = 0; i < 500; i++) + for (int i = 0; i < 10; i++) { var request = new Secured { Name = "test" }; var response = client.Send(request); @@ -777,6 +917,57 @@ public void Does_work_with_CredentailsAuth_Multiple_Times() } } + [Test] + public void Does_generate_new_SessionCookies_when_Authenticating_multiple_times() + { + var client = GetClient(); + string lastPermId = null; + + 3.Times(x => + { + var authResponse = client.Send(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "user", + Password = "p@55word", + RememberMe = true, + }); + + var permId = client.GetCookieValues()[SessionFeature.PermanentSessionId]; + Assert.That(permId, Is.Not.EqualTo(lastPermId)); + + var ssOpt = client.GetCookieValues()[SessionFeature.SessionOptionsKey]; + Assert.That(ssOpt, Is.Not.Null); + + lastPermId = permId; + }); + } + + [Test] + public void Does_retain_Session_after_authenticating_multiple_times() + { + var client = GetClient(); + CustomUserSession lastSession = null; + 3.Times(x => + { + var authResponse = client.Send(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "user", + Password = "p@55word", + RememberMe = true, + }); + + var customSession = client.Send(new IncrSession { By = 1 }); + Assert.That(customSession.Counter, + lastSession == null ? Is.EqualTo(1) : Is.EqualTo(lastSession.Counter + 1)); + + lastSession = customSession; + }); + + Assert.That(lastSession.Counter, Is.EqualTo(3)); + } + [Test] public void Exceptions_thrown_are_received_by_client_when_AlwaysSendBasicAuthHeader_is_false() { @@ -823,7 +1014,21 @@ public void Html_clients_receive_redirect_to_login_page_when_accessing_unauthent }; var request = new Secured { Name = "test" }; - client.Send(request); + try + { + client.Send(request); + } +#if NETCORE + catch (WebServiceException ex) + { + //AllowAutoRedirect=false is not implemented in .NET Core and throws NotFound exception + if (ex.StatusCode == (int)HttpStatusCode.Found) + return; + throw; + } +#else + catch (WebServiceException) {} +#endif var locationUri = new Uri(lastResponseLocationHeader); var loginPath = "/".CombineWith(VirtualDirectory).CombineWith(LoginUrl); @@ -842,11 +1047,24 @@ public void Html_clients_receive_secured_url_attempt_in_login_page_redirect_quer }; var request = new Secured { Name = "test" }; - client.Send(request); + try + { + client.Send(request); + } +#if NETCORE + catch (WebServiceException ex) + { + //AllowAutoRedirect=false is not implemented in .NET Core and throws NotFound exception + if (ex.StatusCode == (int)HttpStatusCode.Found) + return; + } +#else + catch (WebServiceException) {} +#endif var locationUri = new Uri(lastResponseLocationHeader); var queryString = HttpUtility.ParseQueryString(locationUri.Query); - var redirectQueryString = queryString["redirect"]; + var redirectQueryString = queryString[Keywords.Redirect]; var redirectUri = new Uri(redirectQueryString); // Should contain the url attempted to access before the redirect to the login page. @@ -872,11 +1090,24 @@ public void Html_clients_receive_secured_url_including_query_string_within_login var request = new Secured { Name = "test" }; // Perform a GET so that the Name DTO field is encoded as query string. - client.Get(request); + try + { + client.Get(request); + } +#if NETCORE + catch (WebServiceException ex) + { + //AllowAutoRedirect=false is not implemented in .NET Core and throws NotFound exception + if (ex.StatusCode == (int)HttpStatusCode.Found) + return; + } +#else + catch (WebServiceException) {} +#endif var locationUri = new Uri(lastResponseLocationHeader); var locationUriQueryString = HttpUtility.ParseQueryString(locationUri.Query); - var redirectQueryItem = locationUriQueryString["redirect"]; + var redirectQueryItem = locationUriQueryString[Keywords.Redirect]; var redirectUri = new Uri(redirectQueryItem); // Should contain the url attempted to access before the redirect to the login page, @@ -897,13 +1128,26 @@ public void Html_clients_receive_session_ReferrerUrl_on_successful_authenticatio lastResponseLocationHeader = response.Headers["Location"]; }; - client.Send(new Authenticate + try { - provider = CredentialsAuthProvider.Name, - UserName = UserNameWithSessionRedirect, - Password = PasswordForSessionRedirect, - RememberMe = true, - }); + client.Send(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = UserNameWithSessionRedirect, + Password = PasswordForSessionRedirect, + RememberMe = true, + }); + } +#if NETCORE + catch (WebServiceException ex) + { + //AllowAutoRedirect=false is not implemented in .NET Core and throws NotFound exception + if (ex.StatusCode == (int)HttpStatusCode.Found) + return; + } +#else + catch (WebServiceException) {} +#endif Assert.That(lastResponseLocationHeader, Is.EqualTo(SessionRedirectUrl)); } @@ -1104,10 +1348,10 @@ public void Calling_AddSessionIdToRequest_from_a_custom_auth_attribute_does_not_ } - [TestCase(ExpectedException = typeof(AuthenticationException))] + [Test] public void Meaningful_Exception_for_Unknown_Auth_Header() { - var authInfo = new AuthenticationInfo("Negotiate,NTLM"); + Assert.Throws(() => new AuthenticationInfo("Negotiate,NTLM")); } [Test] @@ -1236,10 +1480,10 @@ public void Failed_re_authentication_does_not_logout_user() Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); Console.WriteLine(webEx.ResponseDto.Dump()); } - + // Should still be authenticated, but not elevated - try - { + try + { client.Send(request); Assert.Fail("Shouldn't be allowed"); } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoBatchTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoBatchTests.cs new file mode 100644 index 00000000000..0f2fcb8cc3c --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoBatchTests.cs @@ -0,0 +1,176 @@ +using System.Collections.Generic; +using System.Linq; +using System.Net; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class AutoBatchAppHost : AppSelfHostBase + { + public AutoBatchAppHost() + : base(typeof(AutoBatchTests).Name, typeof(AutoBatchIndexServices).Assembly) + { + } + + public override void Configure(Container container) + { + GlobalRequestFilters.Add((req, res, dto) => + { + var autoBatchIndex = req.GetItem(Keywords.AutoBatchIndex)?.ToString(); + if (autoBatchIndex != null) + { + res.RemoveHeader("GlobalRequestFilterAutoBatchIndex"); + res.AddHeader("GlobalRequestFilterAutoBatchIndex", autoBatchIndex); + } + }); + + GlobalResponseFilters.Add((req, res, dto) => + { + var autoBatchIndex = req.GetItem(Keywords.AutoBatchIndex)?.ToString(); + + if (autoBatchIndex != null) + { + if (dto is IMeta response) + { + response.Meta = new Dictionary + { + ["GlobalResponseFilterAutoBatchIndex"] = autoBatchIndex + }; + } + } + }); + } + } + + public class GetAutoBatchIndex : IReturn + { + } + + public class GetCustomAutoBatchIndex : IReturn + { + } + + public class GetAutoBatchIndexResponse : IMeta + { + public string Index { get; set; } + public Dictionary Meta { get; set; } + } + + public class AutoBatchIndexServices : Service + { + public object Any(GetAutoBatchIndex request) + { + var autoBatchIndex = Request.GetItem(Keywords.AutoBatchIndex)?.ToString(); + return new GetAutoBatchIndexResponse + { + Index = autoBatchIndex + }; + } + + public GetAutoBatchIndexResponse Any(GetCustomAutoBatchIndex request) + { + var autoBatchIndex = Request.GetItem(Keywords.AutoBatchIndex)?.ToString(); + return new GetAutoBatchIndexResponse + { + Index = autoBatchIndex + }; + } + + public object Any(GetCustomAutoBatchIndex[] requests) + { + var responses = new List(); + + Request.EachRequest(dto => + { + responses.Add(Any(dto)); + }); + + return responses; + } + } + + [TestFixture] + public class AutoBatchTests + { + private ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = new AutoBatchAppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Single_requests_dont_set_AutoBatchIndex() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + WebHeaderCollection responseHeaders = null; + + client.ResponseFilter = resp => { responseHeaders = resp.Headers; }; + + var response = client.Send(new GetAutoBatchIndex()); + + Assert.Null(response.Index); + Assert.Null(response.Meta); + Assert.IsFalse(responseHeaders.AllKeys.Contains("GlobalRequestFilterAutoBatchIndex")); + } + + [Test] + public void Multi_requests_set_AutoBatchIndex() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + WebHeaderCollection responseHeaders = null; + + client.ResponseFilter = response => { responseHeaders = response.Headers; }; + + var responses = client.SendAll(new[] + { + new GetAutoBatchIndex(), + new GetAutoBatchIndex() + }); + + Assert.AreEqual("0", responses[0].Index); + Assert.AreEqual("0", responses[0].Meta["GlobalResponseFilterAutoBatchIndex"]); + + Assert.AreEqual("1", responses[1].Index); + Assert.AreEqual("1", responses[1].Meta["GlobalResponseFilterAutoBatchIndex"]); + + Assert.AreEqual("1", responseHeaders["GlobalRequestFilterAutoBatchIndex"]); + } + + [Test] + public void Custom_multi_requests_set_AutoBatchIndex() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + WebHeaderCollection responseHeaders = null; + + client.ResponseFilter = response => { responseHeaders = response.Headers; }; + + var responses = client.SendAll(new[] + { + new GetCustomAutoBatchIndex(), + new GetCustomAutoBatchIndex() + }); + + Assert.AreEqual("0", responses[0].Index); + Assert.AreEqual("0", responses[0].Meta["GlobalResponseFilterAutoBatchIndex"]); + + Assert.AreEqual("1", responses[1].Index); + Assert.AreEqual("1", responses[1].Meta["GlobalResponseFilterAutoBatchIndex"]); + + Assert.AreEqual("1", responseHeaders["GlobalRequestFilterAutoBatchIndex"]); + } + } +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudModels.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudModels.cs new file mode 100644 index 00000000000..483eff29efa --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudModels.cs @@ -0,0 +1,524 @@ +using System; +using System.Threading.Tasks; +using ServiceStack.DataAnnotations; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public abstract class RockstarBase + { + public string FirstName { get; set; } + public string LastName { get; set; } + public int? Age { get; set; } + public DateTime DateOfBirth { get; set; } + public DateTime? DateDied { get; set; } + public LivingStatus LivingStatus { get; set; } + } + + [Alias(nameof(Rockstar))] + public class RockstarAuto : RockstarBase + { + [AutoIncrement] + public int Id { get; set; } + } + + public class RockstarAutoGuid : RockstarBase + { + [AutoId] + public Guid Id { get; set; } + } + + public class RockstarAudit : RockstarBase + { + [AutoIncrement] + public int Id { get; set; } + public DateTime CreatedDate { get; set; } + public string CreatedBy { get; set; } + public string CreatedInfo { get; set; } + public DateTime ModifiedDate { get; set; } + public string ModifiedBy { get; set; } + public string ModifiedInfo { get; set; } + } + + public interface IAudit + { + DateTime CreatedDate { get; set; } + string CreatedBy { get; set; } + string CreatedInfo { get; set; } + DateTime ModifiedDate { get; set; } + string ModifiedBy { get; set; } + string ModifiedInfo { get; set; } + DateTime? SoftDeletedDate { get; set; } + string SoftDeletedBy { get; set; } + string SoftDeletedInfo { get; set; } + } + + public interface IAuditTenant : IAudit + { + int TenantId { get; set; } + } + + public abstract class AuditBase : IAudit + { + public DateTime CreatedDate { get; set; } + [Required] + public string CreatedBy { get; set; } + [Required] + public string CreatedInfo { get; set; } + + public DateTime ModifiedDate { get; set; } + [Required] + public string ModifiedBy { get; set; } + [Required] + public string ModifiedInfo { get; set; } + + [Index] //Check if Deleted + public DateTime? SoftDeletedDate { get; set; } + public string SoftDeletedBy { get; set; } + public string SoftDeletedInfo { get; set; } + } + + public class RockstarAuditTenant : AuditBase + { + [Index] + public int TenantId { get; set; } + [AutoIncrement] + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public int? Age { get; set; } + public DateTime DateOfBirth { get; set; } + public DateTime? DateDied { get; set; } + public LivingStatus LivingStatus { get; set; } + } + + public class RockstarVersion : RockstarBase + { + [AutoIncrement] + public int Id { get; set; } + public ulong RowVersion { get; set; } + } + + public class CreateRockstar : RockstarBase, ICreateDb, IReturn + { + } + + public class CreateRockstarResponse + { + public ResponseStatus ResponseStatus { get; set; } + } + + public class CreateRockstarWithReturn : RockstarBase, ICreateDb, IReturn + { + } + public class CreateRockstarWithVoidReturn : RockstarBase, ICreateDb, IReturnVoid + { + } + + public class CreateRockstarWithAutoGuid : RockstarBase, ICreateDb, IReturn + { + } + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(RockstarAudit.CreatedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.CreatedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.CreatedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [AutoPopulate(nameof(RockstarAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + public class CreateRockstarAudit : RockstarBase, ICreateDb, IReturn + { + } + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(IAudit.CreatedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.CreatedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.CreatedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [AutoPopulate(nameof(IAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + public abstract class CreateAuditBase : ICreateDb, IReturn {} + + [AutoPopulate(nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + public abstract class CreateAuditTenantBase : CreateAuditBase {} + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(IAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + public abstract class UpdateAuditBase : IUpdateDb
        , IReturn {} + + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + public abstract class UpdateAuditTenantBase : UpdateAuditBase {} + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(IAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + public abstract class PatchAuditBase : IPatchDb
        , IReturn {} + + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + public abstract class PatchAuditTenantBase : PatchAuditBase {} + + [ValidateRequest("IsAuthenticated")] + [AutoPopulate(nameof(IAudit.SoftDeletedDate), Eval = "utcNow")] + [AutoPopulate(nameof(IAudit.SoftDeletedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(IAudit.SoftDeletedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + public abstract class SoftDeleteAuditBase : IUpdateDb
        , IReturn {} + + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + public abstract class SoftDeleteAuditTenantBase : SoftDeleteAuditBase {} + + [ValidateRequest("IsAuthenticated")] + [AutoFilter(QueryTerm.Ensure, nameof(IAudit.SoftDeletedDate), Template = SqlTemplate.IsNull)] + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + public abstract class QueryDbTenant : QueryDb {} + + public class CreateRockstarAuditTenant : CreateAuditTenantBase, IHasSessionId + { + public string SessionId { get; set; } //Authenticate MQ Requests + public string FirstName { get; set; } + public string LastName { get; set; } + public int? Age { get; set; } + public DateTime DateOfBirth { get; set; } + public DateTime? DateDied { get; set; } + public LivingStatus LivingStatus { get; set; } + } + + public class UpdateRockstarAuditTenant : UpdateAuditTenantBase, IHasSessionId + { + public string SessionId { get; set; } //Authenticate MQ Requests + public int Id { get; set; } + public string FirstName { get; set; } + public LivingStatus? LivingStatus { get; set; } + } + + public class PatchRockstarAuditTenant : PatchAuditTenantBase, IHasSessionId + { + public string SessionId { get; set; } //Authenticate MQ Requests + public int Id { get; set; } + public string FirstName { get; set; } + public LivingStatus? LivingStatus { get; set; } + } + + public class CreateRockstarAuditTenantGateway : IReturn + { + public string FirstName { get; set; } + public string LastName { get; set; } + public int? Age { get; set; } + public DateTime DateOfBirth { get; set; } + public DateTime? DateDied { get; set; } + public LivingStatus LivingStatus { get; set; } + } + + public class UpdateRockstarAuditTenantGateway : IReturn + { + public int Id { get; set; } + public string FirstName { get; set; } + public LivingStatus? LivingStatus { get; set; } + } + + public class PatchRockstarAuditTenantGateway : IReturn + { + public int Id { get; set; } + public string FirstName { get; set; } + public LivingStatus? LivingStatus { get; set; } + } + + public class RealDeleteAuditTenantGateway : IReturn + { + public int Id { get; set; } + } + + public class SoftDeleteAuditTenant : SoftDeleteAuditTenantBase + { + public int Id { get; set; } + } + + [Authenticate] + public class CreateRockstarAuditTenantMq : IReturnVoid + { + public string FirstName { get; set; } + public string LastName { get; set; } + public int? Age { get; set; } + public DateTime DateOfBirth { get; set; } + public DateTime? DateDied { get; set; } + public LivingStatus LivingStatus { get; set; } + } + + [Authenticate] + public class UpdateRockstarAuditTenantMq : IReturnVoid + { + public int Id { get; set; } + public string FirstName { get; set; } + public LivingStatus? LivingStatus { get; set; } + } + + public class PatchRockstarAuditTenantMq : IReturnVoid + { + public int Id { get; set; } + public string FirstName { get; set; } + public LivingStatus? LivingStatus { get; set; } + } + + public class RealDeleteAuditTenantMq : IReturnVoid + { + public int Id { get; set; } + } + + [Authenticate] + [AutoPopulate(nameof(RockstarAudit.CreatedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.CreatedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.CreatedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + [AutoPopulate(nameof(RockstarAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + public class CreateRockstarAuditMqToken : RockstarBase, ICreateDb, IReturn, IHasBearerToken + { + public string BearerToken { get; set; } + } + + + [Authenticate] + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + public class RealDeleteAuditTenant : IDeleteDb, IReturn, IHasSessionId + { + public string SessionId { get; set; } //Authenticate MQ Requests + public int Id { get; set; } + public int? Age { get; set; } + } + + public class QueryRockstarAudit : QueryDbTenant + { + public int? Id { get; set; } + } + + [QueryDb(QueryTerm.Or)] + [AutoFilter(QueryTerm.Ensure, nameof(AuditBase.SoftDeletedDate), SqlTemplate.IsNull)] + [AutoFilter(QueryTerm.Ensure, nameof(IAuditTenant.TenantId), Eval = "Request.Items.TenantId")] + public class QueryRockstarAuditSubOr : QueryDb + { + public string FirstNameStartsWith { get; set; } + public int? AgeOlderThan { get; set; } + } + + public class CreateRockstarVersion : RockstarBase, ICreateDb, IReturn + { + } + + public class RockstarWithIdResponse + { + public int Id { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + public class RockstarWithIdAndCountResponse + { + public int Id { get; set; } + public int Count { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class RockstarWithIdAndRowVersionResponse + { + public int Id { get; set; } + public uint RowVersion { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class RockstarWithIdAndResultResponse + { + public int Id { get; set; } + public RockstarAuto Result { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class CreateRockstarWithReturnGuidResponse + { + public Guid Id { get; set; } + public RockstarAutoGuid Result { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class CreateRockstarAdhocNonDefaults : ICreateDb, IReturn + { + public string FirstName { get; set; } + public string LastName { get; set; } + [AutoDefault(Value = 21)] + public int? Age { get; set; } + [AutoDefault(Expression = "date(2001,1,1)")] + public DateTime DateOfBirth { get; set; } + [AutoDefault(Eval = "utcNow")] + public DateTime? DateDied { get; set; } + [AutoDefault(Value = global::ServiceStack.WebHost.Endpoints.Tests.LivingStatus.Dead)] + public LivingStatus? LivingStatus { get; set; } + } + + public class CreateRockstarAutoMap : ICreateDb, IReturn + { + [AutoMap(nameof(RockstarAuto.FirstName))] + public string MapFirstName { get; set; } + + [AutoMap(nameof(RockstarAuto.LastName))] + public string MapLastName { get; set; } + + [AutoMap(nameof(RockstarAuto.Age))] + [AutoDefault(Value = 21)] + public int? MapAge { get; set; } + + [AutoMap(nameof(RockstarAuto.DateOfBirth))] + [AutoDefault(Expression = "date(2001,1,1)")] + public DateTime MapDateOfBirth { get; set; } + + [AutoMap(nameof(RockstarAuto.DateDied))] + [AutoDefault(Eval = "utcNow")] + public DateTime? MapDateDied { get; set; } + + [AutoMap(nameof(RockstarAuto.LivingStatus))] + [AutoDefault(Value = LivingStatus.Dead)] + public LivingStatus? MapLivingStatus { get; set; } + } + + public class UpdateRockstar : RockstarBase, IUpdateDb, IReturn + { + public int Id { get; set; } + } + + [Authenticate] + [AutoPopulate(nameof(RockstarAudit.ModifiedDate), Eval = "utcNow")] + [AutoPopulate(nameof(RockstarAudit.ModifiedBy), Eval = "userAuthName")] //or userAuthId + [AutoPopulate(nameof(RockstarAudit.ModifiedInfo), Eval = "`${userSession.DisplayName} (${userSession.City})`")] + public class UpdateRockstarAudit : RockstarBase, IPatchDb, IReturn + { + public int Id { get; set; } + public string FirstName { get; set; } + public LivingStatus? LivingStatus { get; set; } + } + + [Authenticate] + public class DeleteRockstarAudit : IDeleteDb, IReturn + { + public int Id { get; set; } + } + + public class UpdateRockstarVersion : RockstarBase, IPatchDb, IReturn + { + public int Id { get; set; } + public ulong RowVersion { get; set; } + } + + public class PatchRockstar : RockstarBase, IPatchDb, IReturn + { + public int Id { get; set; } + } + + public class UpdateRockstarAdhocNonDefaults : IUpdateDb, IReturn + { + public int Id { get; set; } + [AutoUpdate(AutoUpdateStyle.NonDefaults)] + public string FirstName { get; set; } + public string LastName { get; set; } + [AutoDefault(Value = 21)] + public int? Age { get; set; } + [AutoDefault(Expression = "date(2001,1,1)")] + public DateTime DateOfBirth { get; set; } + [AutoDefault(Eval = "utcNow")] + public DateTime? DateDied { get; set; } + [AutoUpdate(AutoUpdateStyle.NonDefaults), AutoDefault(Value = LivingStatus.Dead)] + public LivingStatus LivingStatus { get; set; } + } + + public class DeleteRockstar : IDeleteDb, IReturn + { + public int Id { get; set; } + } + + public class DeleteRockstarFilters : IDeleteDb, IReturn + { + public string FirstName { get; set; } + public string LastName { get; set; } + public int? Age { get; set; } + } + + public class DeleteRockstarCountResponse + { + public int Count { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class CreateNamedRockstar : RockstarBase, ICreateDb, IReturn + { + public int Id { get; set; } + } + + public class UpdateNamedRockstar : RockstarBase, IUpdateDb, IReturn + { + public int Id { get; set; } + } + + //[ConnectionInfo] on AutoCrudConnectionInfoServices + public class CreateConnectionInfoRockstar : RockstarBase, ICreateDb, IReturn + { + public int Id { get; set; } + } + + public class UpdateConnectionInfoRockstar : RockstarBase, IUpdateDb, IReturn + { + public int Id { get; set; } + } + + public class DefaultValue + { + public int Id { get; set; } + public int Int { get; set; } + public int? NInt { get; set; } + public bool Bool { get; set; } + public bool? NBool { get; set; } + public string String { get; set; } + } + + public class CreateDefaultValues : ICreateDb, IReturn + { + public int Id { get; set; } + public int Int { get; set; } + public int? NInt { get; set; } + public bool Bool { get; set; } + public bool? NBool { get; set; } + public string String { get; set; } + } + + public class PatchDefaultValues : IPatchDb, IReturnVoid + { + public int Id { get; set; } + public int Int { get; set; } + public int? NInt { get; set; } + public bool Bool { get; set; } + public bool? NBool { get; set; } + public string String { get; set; } + public string[] Reset { get; set; } + } + + public class QueryRockstarsUnknownField : QueryDb + { + public int Id { get; set; } + public string Unknown { get; set; } + } + public class CreateRockstarUnknownField : RockstarBase, ICreateDb, IReturn + { + public string Unknown { get; set; } + } + public class UpdateRockstarUnknownField : RockstarBase, IUpdateDb, IReturn + { + public int Id { get; set; } + public string Unknown { get; set; } + } + public class PatchRockstarUnknownField : RockstarBase, IPatchDb, IReturn + { + public int Id { get; set; } + public string Unknown { get; set; } + } + public class DeleteRockstarUnknownField : IDeleteDb, IReturn + { + public int Id { get; set; } + public string Unknown { get; set; } + } + + } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.Validate.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.Validate.cs new file mode 100644 index 00000000000..2c3e81881db --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.Validate.cs @@ -0,0 +1,716 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.Model; +using ServiceStack.OrmLite; +using ServiceStack.Script; +using ServiceStack.Validation; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class NoRockstarAlbumReferences : TypeValidator + { + public NoRockstarAlbumReferences() + : base("HasForeignKeyReferences", "Has RockstarAlbum References") {} + + public override async Task IsValidAsync(object dto, IRequest request) + { + //Example of using compiled accessor delegates to access `Id` property + //var id = TypeProperties.Get(dto.GetType()).GetPublicGetter("Id")(dto).ConvertTo(); + + var id = ((IHasId) dto).Id; + using var db = HostContext.AppHost.GetDbConnection(request); + return !await db.ExistsAsync(x => x.RockstarId == id); + } + } + + public class MyValidators : ScriptMethods + { + public ITypeValidator NoRockstarAlbumReferences() => new NoRockstarAlbumReferences(); + } + + public partial class AutoQueryCrudTests + { + private bool UseDbSource = true; + + partial void OnConfigure(AutoQueryAppHost host, Container container) + { + host.ScriptContext.ScriptMethods.AddRange(new ScriptMethods[] { + new DbScriptsAsync(), + new MyValidators(), + }); + + host.Plugins.Add(new ValidationFeature { + ConditionErrorCodes = { + [ValidationConditions.IsOdd] = "NotOdd", + }, + ErrorCodeMessages = { + ["NotOdd"] = "{PropertyName} must be odd", + ["RuleMessage"] = "ErrorCodeMessages for RuleMessage", + } + }); + + if (UseDbSource) + { + container.Register(c => + new OrmLiteValidationSource(c.Resolve(), host.GetMemoryCacheClient())); + } + else + { + container.Register(new MemoryValidationSource()); + } + + var validationSource = container.Resolve(); + validationSource.InitSchema(); + validationSource.SaveValidationRulesAsync(new List { + new ValidationRule { Type = nameof(DynamicValidationRules), Validator = "IsAuthenticated" }, + new ValidationRule { Type = nameof(DynamicValidationRules), Field = nameof(DynamicValidationRules.LastName), Validator = "NotNull" }, + new ValidationRule { Type = nameof(DynamicValidationRules), Field = nameof(DynamicValidationRules.Age), Validator = "InclusiveBetween(13,100)" }, + }); + } + + private static void AssertErrorResponse(WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(ex.ErrorMessage, Is.EqualTo("'First Name' must not be empty.")); + var status = ex.ResponseStatus; + Assert.That(status.Errors.Count, Is.EqualTo(3)); + + var fieldError = status.Errors.First(x => x.FieldName == nameof(RockstarBase.FirstName)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(fieldError.Message, Is.EqualTo("'First Name' must not be empty.")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(RockstarBase.Age)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(fieldError.Message, Is.EqualTo("'Age' must not be empty.")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(RockstarBase.LastName)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(fieldError.Message, Is.EqualTo("'Last Name' must not be empty.")); + } + + [Test] + public void Does_validate_when_no_Abstract_validator() + { + try + { + var response = client.Post(new NoAbstractValidator { + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + AssertErrorResponse(ex); + Console.WriteLine(ex); + } + + try + { + var response = client.Post(new NoAbstractValidator { + FirstName = "A", + LastName = "B", + Age = 12, + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo("InclusiveBetween")); + Assert.That(ex.ErrorMessage, Is.EqualTo("'Age' must be between 13 and 100. You entered 12.")); + var status = ex.ResponseStatus; + Assert.That(status.Errors.Count, Is.EqualTo(1)); + } + + client.Post(new NoAbstractValidator { + FirstName = "A", + LastName = "B", + Age = 13, + DateOfBirth = new DateTime(2001,1,1), + }); + } + + [Test] + public void Does_validate_DynamicValidationRules_combined_with_IValidationSource_rules() + { + try + { + var anonClient = new JsonServiceClient(Config.ListeningOn); + var response = anonClient.Post(new DynamicValidationRules { + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int) HttpStatusCode.Unauthorized)); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.Unauthorized))); + } + + var authClient = CreateAuthClient(); + try + { + var response = authClient.Post(new DynamicValidationRules { + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + AssertErrorResponse(ex); + Console.WriteLine(ex); + } + + try + { + var response = authClient.Post(new DynamicValidationRules { + FirstName = "A", + LastName = "B", + Age = 12, + DateOfBirth = new DateTime(2001,1,1), + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo("InclusiveBetween")); + Assert.That(ex.ErrorMessage, Is.EqualTo("'Age' must be between 13 and 100. You entered 12.")); + var status = ex.ResponseStatus; + Assert.That(status.Errors.Count, Is.EqualTo(1)); + } + + authClient.Post(new DynamicValidationRules { + FirstName = "A", + LastName = "B", + Age = 13, + DateOfBirth = new DateTime(2001,1,1), + }); + } + + [Test] + public void Does_validate_combined_declarative_and_AbstractValidator() + { + try + { + var response = client.Post(new ValidateCreateRockstar()); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + AssertErrorResponse(ex); + Console.WriteLine(ex); + } + } + + [Test] + public void Does_validate_all_NotEmpty_Fields() + { + try + { + var response = client.Post(new EmptyValidators()); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ResponseStatus.Errors.Count, + Is.EqualTo(typeof(EmptyValidators).GetPublicProperties().Length)); + Assert.That(ex.ResponseStatus.Errors.All(x => x.ErrorCode == "NotEmpty")); + Console.WriteLine(ex); + } + } + + [Test] + public void Does_Validate_TriggerAllValidators() + { + try + { + var response = client.Post(new TriggerAllValidators { + CreditCard = "NotCreditCard", + Email = "NotEmail", + Empty = "NotEmpty", + Equal = "NotEqual", + ExclusiveBetween = 1, + GreaterThan = 1, + GreaterThanOrEqual = 1, + InclusiveBetween = 1, + Length = "Length", + LessThan = 20, + LessThanOrEqual = 20, + NotEmpty = "", + NotEqual = "NotEqual", + Null = "NotNull", + RegularExpression = "FOO", + ScalePrecision = 123.456m + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.AssertTriggerValidators(); + Console.WriteLine(ex); + } + } + + [Test] + public void Does_use_CustomErrorMessages() + { + try + { + var response = client.Post(new CustomValidationErrors()); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Console.WriteLine(ex); + var status = ex.ResponseStatus; + Assert.That(ex.ErrorCode, Is.EqualTo("ZERROR")); + Assert.That(ex.ErrorMessage, Is.EqualTo("'Custom Error Code' must not be empty.")); + Assert.That(status.Errors.Count, Is.EqualTo(typeof(CustomValidationErrors).GetProperties().Length)); + + var fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.CustomErrorCode)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("ZERROR")); + Assert.That(fieldError.Message, Is.EqualTo("'Custom Error Code' must not be empty.")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.CustomErrorCodeAndMessage)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("ZERROR")); + Assert.That(fieldError.Message, Is.EqualTo("Custom Error Code And Message has to be between 1 and 2, you: 0")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.ErrorCodeRule)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("RuleMessage")); + Assert.That(fieldError.Message, Is.EqualTo("ErrorCodeMessages for RuleMessage")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.IsOddCondition)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("NotOdd")); + Assert.That(fieldError.Message, Is.EqualTo("Is Odd Condition must be odd")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.IsOddAndOverTwoDigitsCondition)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("RuleMessage")); + Assert.That(fieldError.Message, Is.EqualTo("ErrorCodeMessages for RuleMessage")); + + fieldError = status.Errors.First(x => x.FieldName == nameof(CustomValidationErrors.IsOddOrOverTwoDigitsCondition)); + Assert.That(fieldError.ErrorCode, Is.EqualTo("ScriptCondition")); + Assert.That(fieldError.Message, Is.EqualTo("The specified condition was not met for 'Is Odd Or Over Two Digits Condition'.")); + } + } + + [Test] + public void Can_satisfy_combined_conditions() + { + try + { + var response = client.Post(new CustomValidationErrors { + IsOddAndOverTwoDigitsCondition = 101 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ResponseStatus.Errors.Count, Is.EqualTo(typeof(CustomValidationErrors).GetProperties().Length - 1)); + Assert.That(ex.ResponseStatus.Errors.All(x => x.FieldName != nameof(CustomValidationErrors.IsOddAndOverTwoDigitsCondition))); + } + try + { + var response = client.Post(new CustomValidationErrors { + IsOddOrOverTwoDigitsCondition = 102 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ResponseStatus.Errors.Count, Is.EqualTo(typeof(CustomValidationErrors).GetProperties().Length - 1)); + Assert.That(ex.ResponseStatus.Errors.All(x => x.FieldName != nameof(CustomValidationErrors.IsOddOrOverTwoDigitsCondition))); + } + } + + [Test] + public void Does_OnlyValidatesRequest() + { + try + { + var response = client.Post(new OnlyValidatesRequest { + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.ErrorCode, Is.EqualTo("RuleMessage")); + Assert.That(ex.ErrorMessage, Is.EqualTo("ErrorCodeMessages for RuleMessage")); + Assert.That(ex.GetFieldErrors().Count, Is.EqualTo(0)); + } + + try + { + var response = client.Post(new OnlyValidatesRequest { + Test = 101 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(401)); + Assert.That(ex.ErrorCode, Is.EqualTo("AssertFailed2")); + Assert.That(ex.ErrorMessage, Is.EqualTo("2nd Assert Failed")); + Assert.That(ex.GetFieldErrors().Count, Is.EqualTo(0)); + } + + try + { + var response = client.Post(new OnlyValidatesRequest { + Test = 1001 + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.ErrorCode, Is.EqualTo("NotNull")); + Assert.That(ex.GetFieldErrors().Count, Is.EqualTo(1)); + } + } + + [Test] + public void Can_use_custom_Guid_Id_and_DateTimeOffset() + { + try + { + client.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + var response = client.Post(new CreateBookmark { + Description = "Description", + Slug = "Slug", + Title = "Title", + Url = "Url", + }); + + Assert.That(response.Id, Is.Not.EqualTo(new Guid())); + Assert.That(response.Result.Id, Is.EqualTo(response.Id)); + Assert.That(response.Result.Description, Is.EqualTo("Description")); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + + [Test] + public void Does_validate_TestAuthValidators() + { + try + { + var anonClient = new JsonServiceClient(Config.ListeningOn); + anonClient.Post(new TestAuthValidators()); + Assert.Fail("Should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(401)); + Assert.That(e.ErrorCode, Is.EqualTo("Unauthorized")); + Assert.That(e.ErrorMessage, Is.EqualTo("Not Authenticated")); + } + + try + { + var employeeClient = new JsonServiceClient(Config.ListeningOn); + + employeeClient.Post(new Authenticate { + provider = "credentials", + UserName = "employee@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + employeeClient.Post(new TestAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(403)); + Assert.That(e.ErrorCode, Is.EqualTo("Forbidden")); + Assert.That(e.ErrorMessage, Is.EqualTo("Manager Role Required")); + } + + try + { + var managerClient = new JsonServiceClient(Config.ListeningOn); + + managerClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + managerClient.Post(new TestAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + + try + { + var adminClient = new JsonServiceClient(Config.ListeningOn); + + adminClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + adminClient.Post(new TestAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + } + + + [Test] + public void Does_validate_TestMultiAuthValidators() + { + try + { + var anonClient = new JsonServiceClient(Config.ListeningOn); + anonClient.Post(new TestMultiAuthValidators()); + Assert.Fail("Should throw"); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(401)); + Assert.That(e.ErrorCode, Is.EqualTo("Unauthorized")); + Assert.That(e.ErrorMessage, Is.EqualTo("Not Authenticated")); + } + + try + { + var employeeClient = new JsonServiceClient(Config.ListeningOn); + + employeeClient.Post(new Authenticate { + provider = "credentials", + UserName = "employee@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + employeeClient.Post(new TestMultiAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(403)); + Assert.That(e.ErrorCode, Is.EqualTo("Forbidden")); + Assert.That(e.ErrorMessage, Is.EqualTo("Manager Role Required")); + } + + try + { + var managerClient = new JsonServiceClient(Config.ListeningOn); + + managerClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + managerClient.Post(new TestMultiAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + + try + { + var adminClient = new JsonServiceClient(Config.ListeningOn); + + adminClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + adminClient.Post(new TestMultiAuthValidators()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + } + + [Test] + public void Does_validate_TestIsAdmin() + { + var userNames = new[] { "employee@email.com", "manager" }; + foreach (var userName in userNames) + { + var userClient = new JsonServiceClient(Config.ListeningOn); + if (userName != null) + { + try + { + var managerClient = new JsonServiceClient(Config.ListeningOn); + + managerClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + managerClient.Post(new TestIsAdmin()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(403)); + Assert.That(e.ErrorCode, Is.EqualTo("Forbidden")); + Assert.That(e.ErrorMessage, Is.EqualTo("Admin Role Required")); + } + } + } + + try + { + var adminClient = new JsonServiceClient(Config.ListeningOn); + + adminClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + adminClient.Post(new TestIsAdmin()); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); + } + } + + [Test] + public void Does_validate_TestDbCondition() + { + using var db = appHost.Resolve().OpenDbConnection(); + db.DropAndCreateTable(); + + try + { + db.Insert(new RockstarAlbum { Id = 1, Name = "An Album", Genre = "Pop", RockstarId = 1 }); + var response = client.Post(new TestDbCondition { + Id = 1, + }); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("HasForeignKeyReferences")); + } + + try + { + db.Delete(x => x.RockstarId == 1); + var response = client.Post(new TestDbCondition { + Id = 1, + }); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); //success! + } + } + + [Test] + public void Does_validate_TestDbValidator() + { + using var db = appHost.Resolve().OpenDbConnection(); + db.DropAndCreateTable(); + + try + { + db.Insert(new RockstarAlbum { Id = 1, Name = "An Album", Genre = "Pop", RockstarId = 1 }); + var response = client.Post(new TestDbValidator { + Id = 1, + }); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("HasForeignKeyReferences")); + } + + try + { + db.Delete(x => x.RockstarId == 1); + var response = client.Post(new TestDbValidator { + Id = 1, + }); + } + catch (WebServiceException e) + { + Assert.That(e.StatusCode, Is.EqualTo(400)); + Assert.That(e.ErrorCode, Is.EqualTo("NotNull")); //success! + } + } + } + + public static class ValidationUtils + { + public static void AssertTriggerValidators(this WebServiceException ex) + { + var errors = ex.ResponseStatus.Errors; + Assert.That(errors.First(x => x.FieldName == "CreditCard").ErrorCode, Is.EqualTo("CreditCard")); + Assert.That(errors.First(x => x.FieldName == "Email").ErrorCode, Is.EqualTo("Email")); + Assert.That(errors.First(x => x.FieldName == "Email").ErrorCode, Is.EqualTo("Email")); + Assert.That(errors.First(x => x.FieldName == "Empty").ErrorCode, Is.EqualTo("Empty")); + Assert.That(errors.First(x => x.FieldName == "Equal").ErrorCode, Is.EqualTo("Equal")); + Assert.That(errors.First(x => x.FieldName == "ExclusiveBetween").ErrorCode, Is.EqualTo("ExclusiveBetween")); + Assert.That(errors.First(x => x.FieldName == "GreaterThan").ErrorCode, Is.EqualTo("GreaterThan")); + Assert.That(errors.First(x => x.FieldName == "GreaterThanOrEqual").ErrorCode, Is.EqualTo("GreaterThanOrEqual")); + Assert.That(errors.First(x => x.FieldName == "InclusiveBetween").ErrorCode, Is.EqualTo("InclusiveBetween")); + Assert.That(errors.First(x => x.FieldName == "Length").ErrorCode, Is.EqualTo("Length")); + Assert.That(errors.First(x => x.FieldName == "LessThan").ErrorCode, Is.EqualTo("LessThan")); + Assert.That(errors.First(x => x.FieldName == "LessThanOrEqual").ErrorCode, Is.EqualTo("LessThanOrEqual")); + Assert.That(errors.First(x => x.FieldName == "NotEmpty").ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(errors.First(x => x.FieldName == "NotEqual").ErrorCode, Is.EqualTo("NotEqual")); + Assert.That(errors.First(x => x.FieldName == "Null").ErrorCode, Is.EqualTo("Null")); + Assert.That(errors.First(x => x.FieldName == "RegularExpression").ErrorCode, Is.EqualTo("RegularExpression")); + Assert.That(errors.First(x => x.FieldName == "ScalePrecision").ErrorCode, Is.EqualTo("ScalePrecision")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.ValidateModels.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.ValidateModels.cs new file mode 100644 index 00000000000..f95b5817f48 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.ValidateModels.cs @@ -0,0 +1,270 @@ +using System; +using System.Collections.Generic; +using ServiceStack.FluentValidation; +using ServiceStack.Model; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public static class ValidationConditions + { + public const string IsOdd = "it.isOdd()"; + public const string IsOver2Digits = "it.log10() > 2"; + } + + public class ValidateCreateRockstar + : ICreateDb, IReturn + { + [Validate(nameof(ValidateScripts.NotNull))] + // [Validate("NotNull")] + public string FirstName { get; set; } + + //Added by Fluent Validator + public string LastName { get; set; } + + // [Validate("[" + nameof(ValidateScripts.NotNull) + "," + nameof(ValidateScripts.Length) + "(13,100)]")] e.g. Typed + // [Validate("[NotNull,Length(13,100)]")] + [Validate("NotNull")] + [Validate("InclusiveBetween(13,100)")] + public int? Age { get; set; } + + [Validate("NotEmpty(default('DateTime'))")] + //[Validate("NotEmpty")] equivalent to above thanks to: Validators.AppendDefaultValueOnEmptyValidators + public DateTime DateOfBirth { get; set; } + + public DateTime? DateDied { get; set; } + + public LivingStatus LivingStatus { get; set; } + } + + public class ValidateCreateRockstarValidator : AbstractValidator + { + public ValidateCreateRockstarValidator() + { + RuleFor(x => x.LastName).NotNull(); + } + } + + [AutoPopulate(nameof(LivingStatus), Value = LivingStatus.Alive)] + public class NoAbstractValidator + : ICreateDb, IReturn + { + [Validate("NotNull")] + public string FirstName { get; set; } + + [Validate("NotNull")] + public string LastName { get; set; } + + [Validate("[NotNull,InclusiveBetween(13,100)]")] + public int? Age { get; set; } + + [Validate("NotEmpty")] + public DateTime DateOfBirth { get; set; } + + public LivingStatus LivingStatus { get; set; } + } + + public class EmptyValidators + : ICreateDb, IReturn + { + // [Validate("NotEmpty(0)")] + [Validate("NotEmpty")] + public int Int { get; set; } + [Validate("NotEmpty")] + public int? NInt { get; set; } + [Validate("NotEmpty")] + // [Validate("NotEmpty(default('System.TimeSpan'))")] + public TimeSpan TimeSpan { get; set; } + [Validate("NotEmpty")] + public TimeSpan? NTimeSpan { get; set; } + [Validate("NotEmpty")] + public string String { get; set; } + [Validate("NotEmpty")] + public int[] IntArray { get; set; } + [Validate("NotEmpty")] + public List StringList { get; set; } + } + + public class TriggerAllValidators + : ICreateDb, IReturn + { + [ValidateCreditCard] + public string CreditCard { get; set; } + [ValidateEmail] + public string Email { get; set; } + [ValidateEmpty] + public string Empty { get; set; } + [ValidateEqual("Equal")] + public string Equal { get; set; } + [ValidateExclusiveBetween(10, 20)] + public int ExclusiveBetween { get; set; } + [ValidateGreaterThanOrEqual(10)] + public int GreaterThanOrEqual { get; set; } + [ValidateGreaterThan(10)] + public int GreaterThan { get; set; } + [ValidateInclusiveBetween(10, 20)] + public int InclusiveBetween { get; set; } + [ValidateExactLength(10)] + public string Length { get; set; } + [ValidateLessThanOrEqual(10)] + public int LessThanOrEqual { get; set; } + [ValidateLessThan(10)] + public int LessThan { get; set; } + [ValidateNotEmpty] + public string NotEmpty { get; set; } + [ValidateNotEqual("NotEqual")] + public string NotEqual { get; set; } + [ValidateNull] + public string Null { get; set; } + [ValidateRegularExpression("^[a-z]*$")] + public string RegularExpression { get; set; } + [ValidateScalePrecision(1,1)] + public decimal ScalePrecision { get; set; } + } + + public class DynamicValidationRules + : ICreateDb, IReturn + { + [ValidateNotNull] + public string FirstName { get; set; } + + //[Validate("NotNull")] added in IValidationSource + public string LastName { get; set; } + + // [Validate("[NotNull,InclusiveBetween(13,100)]")] + [ValidateNotNull] + //[Validate("InclusiveBetween(13,100)")] added in IValidationSource + public int? Age { get; set; } + + [ValidateNotEmpty] + public DateTime DateOfBirth { get; set; } + + public LivingStatus LivingStatus { get; set; } + } + + public class CustomValidationErrors + : ICreateDb, IReturn + { + // Just overrides ErrorCode + [ValidateNotNull(ErrorCode = "ZERROR")] + public string CustomErrorCode { get; set; } + + // Overrides both ErrorCode & Message + [Validate("InclusiveBetween(1,2)", ErrorCode = "ZERROR", + Message = "{PropertyName} has to be between {From} and {To}, you: {PropertyValue}")] + public int CustomErrorCodeAndMessage { get; set; } + + // Overrides ErrorCode & uses Message from Validators + [ValidateNotNull(ErrorCode = "RuleMessage")] + public string ErrorCodeRule { get; set; } + + // Overrides ErrorCode & uses Message from Validators + [Validate(Condition = ValidationConditions.IsOdd)] + public int IsOddCondition { get; set; } + + // Combined typed conditions + Error code + [Validate(AllConditions = new[]{ ValidationConditions.IsOdd, ValidationConditions.IsOver2Digits }, ErrorCode = "RuleMessage")] + public int IsOddAndOverTwoDigitsCondition { get; set; } + + // Combined typed conditions + unknown error code + [Validate(AnyConditions = new[]{ ValidationConditions.IsOdd, ValidationConditions.IsOver2Digits })] + public int IsOddOrOverTwoDigitsCondition { get; set; } + } + + [ValidateHasRole("Manager")] + public class TestAuthValidators + : ICreateDb, IReturn + { + [Validate("NotNull")] //doesn't get validated if ValidateRequest is invalid + public string NotNull { get; set; } + } + + [ValidateRequest("[IsAuthenticated,HasRole('Manager')]")] + public class TestMultiAuthValidators + : ICreateDb, IReturn + { + [ValidateNotNull] //doesn't get validated if ValidateRequest is invalid + public string NotNull { get; set; } + } + + [ValidateIsAdmin] + public class TestIsAdmin + : ICreateDb, IReturn + { + [ValidateNotNull] //doesn't get validated if ValidateRequest is invalid + public string NotNull { get; set; } + } + + [ValidateRequest(Condition = "!dbExistsSync('SELECT * FROM RockstarAlbum WHERE RockstarId = @Id', { dto.Id })", + ErrorCode = "HasForeignKeyReferences")] + public class TestDbCondition + : ICreateDb, IReturn + { + public int Id { get; set; } + + [ValidateNotNull] //doesn't get validated if ValidateRequest is invalid + public string NotNull { get; set; } + } + + [ValidateRequest("NoRockstarAlbumReferences")] + public class TestDbValidator + : ICreateDb, IReturn, IHasId + { + public int Id { get; set; } + + [Validate("NotNull")] //doesn't get validated if ValidateRequest is invalid + public string NotNull { get; set; } + } + + [ValidateRequest(Conditions = new[]{ "it.Test.isOdd()", "it.Test.log10() > 2" }, ErrorCode = "RuleMessage")] + [ValidateRequest(Condition = "it.Test.log10() > 3", ErrorCode = "AssertFailed2", Message = "2nd Assert Failed", StatusCode = 401)] + public class OnlyValidatesRequest + : ICreateDb, IReturn + { + // Combined typed conditions + Error code + public int Test { get; set; } + + [Validate("NotNull")] //doesn't get validated if ValidateRequest is invalid + public string NotNull { get; set; } + } + + + public class DaoBase + { + public virtual Guid Id { get; set; } + public virtual DateTimeOffset CreateDate { get; set; } + public virtual string CreatedBy { get; set; } + public virtual DateTimeOffset ModifiedDate { get; set; } + public virtual string ModifiedBy { get; set; } + } + + public class Bookmark : DaoBase + { + public string Slug { get; set; } + public string Title { get; set; } + public string Description { get; set; } + public string Url { get; set; } + } + + public class QueryBookmarks : QueryDb { } + + // custom script methods + [AutoPopulate(nameof(Bookmark.Id), Eval = "nguid")] + [AutoPopulate(nameof(Bookmark.CreatedBy), Eval = "userAuthId")] + [AutoPopulate(nameof(Bookmark.CreateDate), Eval = "utcNowOffset")] + [AutoPopulate(nameof(Bookmark.ModifiedBy), Eval = "userAuthId")] + [AutoPopulate(nameof(Bookmark.ModifiedDate), Eval = "utcNowOffset")] + public class CreateBookmark : ICreateDb, IReturn + { + public string Slug { get; set; } + public string Title { get; set; } + public string Description { get; set; } + public string Url { get; set; } + } + + public class CreateBookmarkResponse + { + public Guid Id { get; set; } + public Bookmark Result { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.cs new file mode 100644 index 00000000000..7995f12cb92 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.cs @@ -0,0 +1,1341 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Configuration; +using ServiceStack.Data; +using ServiceStack.Messaging; +using ServiceStack.OrmLite; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class AutoCrudGatewayServices : Service + { + public async Task Any(CreateRockstarAuditTenantGateway request) + { + var gatewayRequest = request.ConvertTo(); + var sync = Gateway.Send(gatewayRequest); + var response = await Gateway.SendAsync(gatewayRequest); + return response; + } + + public async Task Any(UpdateRockstarAuditTenantGateway request) + { + var gatewayRequest = request.ConvertTo(); + var sync = Gateway.Send(gatewayRequest); + var response = await Gateway.SendAsync(gatewayRequest); + return response; + } + + public async Task Any(PatchRockstarAuditTenantGateway request) + { + var gatewayRequest = request.ConvertTo(); + var sync = Gateway.Send(gatewayRequest); + var response = await Gateway.SendAsync(gatewayRequest); + return response; + } + + public async Task Any(RealDeleteAuditTenantGateway request) + { + var gatewayRequest = request.ConvertTo(); + var sync = Gateway.Send(gatewayRequest); + var response = await Gateway.SendAsync(gatewayRequest); + return response; + } + + public void Any(CreateRockstarAuditTenantMq request) + { + var mqRequest = request.ConvertTo(); + Request.PopulateRequestDtoIfAuthenticated(mqRequest); + PublishMessage(mqRequest); + } + + public void Any(UpdateRockstarAuditTenantMq request) + { + var mqRequest = request.ConvertTo(); + Request.PopulateRequestDtoIfAuthenticated(mqRequest); + PublishMessage(mqRequest); + } + + public void Any(PatchRockstarAuditTenantMq request) + { + var mqRequest = request.ConvertTo(); + mqRequest.SessionId = GetSession().Id; + PublishMessage(mqRequest); + } + + public void Any(RealDeleteAuditTenantMq request) + { + var mqRequest = request.ConvertTo(); + mqRequest.SessionId = GetSession().Id; + PublishMessage(mqRequest); + } + } + + [ConnectionInfo(NamedConnection = AutoQueryAppHost.SqlServerNamedConnection)] + public class AutoCrudConnectionInfoServices : Service + { + public IAutoQueryDb AutoQuery { get; set; } + + public Task Any(CreateConnectionInfoRockstar request) => + AutoQuery.CreateAsync(request, Request); + + public Task Any(UpdateConnectionInfoRockstar request) => + AutoQuery.UpdateAsync(request, Request); + } + + public partial class AutoQueryCrudTests + { + private readonly ServiceStackHost appHost; + public IServiceClient client; + + private static readonly int TotalRockstars = AutoQueryAppHost.SeedRockstars.Length; + private static readonly int TotalAlbums = AutoQueryAppHost.SeedAlbums.Length; + private const string TenantId = nameof(TenantId); + private static readonly byte[] AuthKey = AesUtils.CreateKey(); + public static string JwtUserToken = null; + + partial void OnConfigure(AutoQueryAppHost host, Funq.Container container); + + public AutoQueryCrudTests() + { + appHost = new AutoQueryAppHost { + ConfigureFn = (host,container) => { + + container.AddSingleton(c => + new OrmLiteCrudEvents(c.Resolve()) { + NamedConnections = { AutoQueryAppHost.SqlServerNamedConnection } + }.Reset() //Drop and re-create AutoCrudEvent Table + ); + container.Resolve().InitSchema(); + + container.AddSingleton(c => + new InMemoryAuthRepository()); + host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] { + new CredentialsAuthProvider(host.AppSettings), + new JwtAuthProvider(host.AppSettings) { + RequireSecureConnection = false, + AuthKey = AuthKey, + CreatePayloadFilter = (obj, session) => { + obj[nameof(AuthUserSession.City)] = ((AuthUserSession)session).City; + } + }, + })); + + var jwtProvider = host.GetPlugin().AuthProviders.OfType().First(); + JwtUserToken = jwtProvider.CreateJwtBearerToken(new AuthUserSession { + Id = SessionExtensions.CreateRandomSessionId(), + UserName = "jwtuser", + FirstName = "JWT", + LastName = "User", + DisplayName = "JWT User", + City = "Japan", + }); + + var authRepo = container.Resolve(); + authRepo.InitSchema(); + + authRepo.CreateUserAuth(new UserAuth { + Id = 1, + Email = "admin@email.com", + DisplayName = "Admin User", + City = "London", + Roles = new List { + RoleNames.Admin + } + }, "p@55wOrd"); + + authRepo.CreateUserAuth(new UserAuth { + Id = 2, + UserName = "manager", + DisplayName = "The Manager", + City = "Perth", + Roles = new List { + "Employee", + "Manager", + } + }, "p@55wOrd"); + + authRepo.CreateUserAuth(new UserAuth { + Id = 3, + Email = "employee@email.com", + DisplayName = "An Employee", + City = "Manhattan", + Roles = new List { + "Employee", + } + }, "p@55wOrd"); + + void AddTenantId(IRequest req, IResponse res, object dto) + { + var userSession = req.SessionAs(); + if (userSession.IsAuthenticated) + { + req.SetItem(TenantId, userSession.City switch { + "London" => 10, + "Perth" => 10, + _ => 20, + }); + } + } + + host.GlobalRequestFilters.Add(AddTenantId); + host.GlobalMessageRequestFilters.Add(AddTenantId); + + container.AddSingleton(c => new BackgroundMqService()); + var mqService = container.Resolve(); + mqService.RegisterHandler(host.ExecuteMessage); + mqService.RegisterHandler(host.ExecuteMessage); + mqService.RegisterHandler(host.ExecuteMessage); + mqService.RegisterHandler(host.ExecuteMessage); + mqService.RegisterHandler(host.ExecuteMessage); + host.AfterInitCallbacks.Add(_ => mqService.Start()); + + OnConfigure(host, container); + } + } + .Init() + .Start(Config.ListeningOn); + + using var db = appHost.TryResolve().OpenDbConnection(); + db.CreateTable(); + db.CreateTable(); + db.CreateTable(); + db.CreateTable(); + db.CreateTable(); + db.CreateTable(); + + AutoMapping.RegisterPopulator((Dictionary target, CreateRockstarWithAutoGuid source) => { + if (source.FirstName == "Created") + { + target[nameof(source.LivingStatus)] = LivingStatus.Dead; + } + }); + + client = new JsonServiceClient(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() => appHost.Dispose(); + + public List Rockstars => AutoQueryAppHost.SeedRockstars.ToList(); + + public List PagingTests => AutoQueryAppHost.SeedPagingTest.ToList(); + + private static JsonServiceClient CreateAuthClient() + { + var authClient = new JsonServiceClient(Config.ListeningOn); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + return authClient; + } + + [Test] + public void Can_CreateRockstar() + { + var request = new CreateRockstar { + FirstName = "Return", + LastName = "Empty", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var response = client.Post(request); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.Single(x => x.LastName == "Empty"); + Assert.That(newRockstar.FirstName, Is.EqualTo("Return")); + } + + [Test] + public void Can_CreateRockstarWithReturn() + { + var request = new CreateRockstarWithReturn { + FirstName = "Return", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,2,1), + LivingStatus = LivingStatus.Alive, + }; + + var response = client.Post(request); + + Assert.That(response.Id, Is.GreaterThan(0)); + var newRockstar = response.Result; + Assert.That(newRockstar.LastName, Is.EqualTo("Result")); + } + + [Test] + public void Can_CreateRockstarWithVoidReturn() + { + var request = new CreateRockstarWithVoidReturn { + FirstName = "Return", + LastName = "Void", + Age = 20, + DateOfBirth = new DateTime(2001,3,1), + LivingStatus = LivingStatus.Alive, + }; + + client.Post(request); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.Single(x => x.LastName == "Void"); + Assert.That(newRockstar.FirstName, Is.EqualTo("Return")); + } + + [Test] + public void Can_CreateRockstarWithAutoGuid() + { + var request = new CreateRockstarWithAutoGuid { + FirstName = "Create", + LastName = "AutoId", + Age = 20, + DateOfBirth = new DateTime(2001,4,1), + LivingStatus = LivingStatus.Alive, + }; + + var response = client.Post(request); + + Assert.That(response.Id, Is.Not.Null); + var newRockstar = response.Result; + Assert.That(newRockstar.Id, Is.EqualTo(response.Id)); + Assert.That(newRockstar.LastName, Is.EqualTo("AutoId")); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + } + + [Test] + public void Can_CreateRockstarWithAutoGuid_with_Custom_Mapping() + { + var request = new CreateRockstarWithAutoGuid { + FirstName = "Created", + LastName = "AutoId", + Age = 20, + DateOfBirth = new DateTime(2001,5,1), + LivingStatus = LivingStatus.Alive, + }; + + var response = client.Post(request); + + Assert.That(response.Id, Is.Not.Null); + var newRockstar = response.Result; + Assert.That(newRockstar.Id, Is.EqualTo(response.Id)); + Assert.That(newRockstar.LastName, Is.EqualTo("AutoId")); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Dead)); //overridden by RegisterPopulator + } + + [Test] + public void Can_UpdateRockstar() + { + var createResponse = client.Post(new CreateRockstarWithReturn { + FirstName = "UpdateReturn", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + }); + + var request = new UpdateRockstar { + Id = createResponse.Id, + LastName = "UpdateResult", + }; + + var response = client.Put(request); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.FirstName, Is.Null); + Assert.That(newRockstar.LastName, Is.EqualTo("UpdateResult")); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + } + + [Test] + public void Can_PatchRockstar() + { + var createRequest = new CreateRockstarWithReturn { + FirstName = "UpdateReturn", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + }; + var createResponse = client.Post(createRequest); + + var request = new PatchRockstar { + Id = createResponse.Id, + LastName = "UpdateResult", + }; + + var response = client.Patch(request); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.LastName, Is.EqualTo("UpdateResult")); + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.FirstName)); + Assert.That(newRockstar.Age, Is.EqualTo(createRequest.Age)); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(createRequest.LivingStatus)); + } + + [Test] + public void Can_UpdateRockstarAdhocNonDefaults() + { + var createRequest = new CreateRockstarWithReturn { + FirstName = "UpdateReturn", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + }; + var createResponse = client.Post(createRequest); + + var request = new UpdateRockstarAdhocNonDefaults { + Id = createResponse.Id, + LastName = "UpdateResult", + }; + + using (JsConfig.With(new Text.Config { AssumeUtc = true })) + { + var response = client.Put(request); + } + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.LastName, Is.EqualTo("UpdateResult")); + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.FirstName)); //[AutoUpdate(AutoUpdateStyle.NonDefaults)] + Assert.That(newRockstar.Age, Is.EqualTo(21)); //[AutoDefault(Value = 21)] + //[AutoDefault(Eval = "date(2001,1,1)")] + Assert.That(newRockstar.DateOfBirth, Is.EqualTo(new DateTime(2001,1,1))); + Assert.That(newRockstar.DateDied.Value.Date, Is.EqualTo(DateTime.UtcNow.Date)); + //[AutoUpdate(AutoUpdateStyle.NonDefaults), AutoDefault(Value = LivingStatus.Dead)] + Assert.That(newRockstar.LivingStatus, Is.EqualTo(createRequest.LivingStatus)); + } + + [Test] + public void Does_throw_when_no_rows_updated() + { + try + { + client.Put(new UpdateRockstar { + Id = 100, + LastName = "UpdateRockstar", + }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(OptimisticConcurrencyException))); + } + } + + [Test] + public void Can_Delete_CreateRockstarWithReturn() + { + var request = new CreateRockstarWithReturn { + FirstName = "Delete", + LastName = "Rockstar", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(request); + + using var db = appHost.GetDbConnection(); + + var newRockstar = db.Single(x => x.Id == createResponse.Id); + Assert.That(newRockstar, Is.Not.Null); + + var response = client.Delete(new DeleteRockstar { + Id = createResponse.Id + }); + + newRockstar = db.Single(x => x.Id == createResponse.Id); + Assert.That(newRockstar, Is.Null); + } + + [Test] + public void Does_throw_for_Delete_without_filters() + { + var request = new CreateRockstarWithReturn { + FirstName = "Delete", + LastName = "Rockstar", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(request); + + try + { + var response = client.Delete(new DeleteRockstar()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(NotSupportedException))); + } + } + + [Test] + public void Can_delete_with_multiple_non_PrimaryKey_filters() + { + var requests = 5.Times(i => new CreateRockstarWithReturn { + FirstName = "Delete", + LastName = "Filter" + i, + Age = 23, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }); + + requests.Each(x => client.Post(x)); + + try + { + client.Delete(new DeleteRockstarFilters()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(NotSupportedException))); + } + + using var db = appHost.GetDbConnection(); + + var response = client.Delete(new DeleteRockstarFilters { Age = 23, LastName = "Filter1" }); + Assert.That(response.Count, Is.EqualTo(1)); + var remaining = db.Select(x => x.Age == 23); + Assert.That(remaining.Count, Is.EqualTo(5 - 1)); + + response = client.Delete(new DeleteRockstarFilters { Age = 23 }); + Assert.That(response.Count, Is.EqualTo(4)); + remaining = db.Select(x => x.Age == 23); + Assert.That(remaining.Count, Is.EqualTo(0)); + } + + [Test] + public void Can_CreateRockstarAdhocNonDefaults() + { + var createRequest = new CreateRockstarAdhocNonDefaults { + FirstName = "Create", + LastName = "Defaults", + }; + + using var jsScope = JsConfig.With(new Text.Config { AssumeUtc = true }); + var createResponse = client.Post(createRequest); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.LastName, Is.EqualTo("Defaults")); + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.FirstName)); + Assert.That(newRockstar.Age, Is.EqualTo(21)); //[AutoDefault(Value = 21)] + //[AutoDefault(Eval = "date(2001,1,1)")] + Assert.That(newRockstar.DateOfBirth, Is.EqualTo(new DateTime(2001,1,1))); + Assert.That(newRockstar.DateDied.Value.Date, Is.EqualTo(DateTime.UtcNow.Date)); + //[AutoDefault(Value = global::ServiceStack.WebHost.Endpoints.Tests.LivingStatus.Dead)] + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + } + + [Test] + public void Can_CreateRockstarAutoMap() + { + var createRequest = new CreateRockstarAutoMap { + MapFirstName = "Map", + MapLastName = "Defaults", + MapDateOfBirth = new DateTime(2002,2,2), + MapLivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(createRequest); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.LastName, Is.EqualTo("Defaults")); + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.MapFirstName)); + Assert.That(newRockstar.Age, Is.EqualTo(21)); //[AutoDefault(Value = 21)] + //[AutoDefault(Eval = "date(2001,1,1)")] + Assert.That(newRockstar.DateOfBirth.Date, Is.EqualTo(new DateTime(2002,2,2).Date)); + Assert.That(newRockstar.DateDied.Value.Date, Is.EqualTo(DateTime.UtcNow.Date)); + //[AutoDefault(Value = LivingStatus.Alive)] + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + } + + [Test] + public void Can_CreateRockstarAudit() + { + var authClient = new JsonServiceClient(Config.ListeningOn); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + var createResponse = authClient.Post(new CreateRockstarAudit { + FirstName = "Create", + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.FirstName, Is.EqualTo("Create")); + Assert.That(newRockstar.LastName, Is.EqualTo("Audit")); + Assert.That(newRockstar.Age, Is.EqualTo(20)); + Assert.That(newRockstar.DateOfBirth.Date, Is.EqualTo(new DateTime(2002,2,2).Date)); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + Assert.That(newRockstar.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(newRockstar.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.ModifiedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.ModifiedInfo, Is.EqualTo("Admin User (London)")); + + authClient = new JsonServiceClient(Config.ListeningOn); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + authClient.Patch(new UpdateRockstarAudit { + Id = createResponse.Id, + FirstName = "Updated", + LivingStatus = LivingStatus.Alive, + }); + + newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.FirstName, Is.EqualTo("Updated")); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + Assert.That(newRockstar.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(newRockstar.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.ModifiedBy, Is.EqualTo("manager")); + Assert.That(newRockstar.ModifiedInfo, Is.EqualTo("The Manager (Perth)")); + + authClient.Delete(new DeleteRockstarAudit { + Id = createResponse.Id, + }); + + newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar, Is.Null); + } + + [Test] + public async Task Can_CreateRockstarAuditTenant_with_Events() + { + var dbEvents = (OrmLiteCrudEvents) appHost.Resolve(); + dbEvents.Clear(); + + var authClient = CreateAuthClient(); + var id = CreateAndSoftDeleteRockstarAuditTenant(authClient); + + using var db = appHost.GetDbConnection(); + + void assertState(RockstarAuditTenant result) + { + Assert.That(result.Id, Is.EqualTo(id)); + Assert.That(result.FirstName, Is.EqualTo("Updated & Patched")); + Assert.That(result.LastName, Is.EqualTo("Audit")); + Assert.That(result.Age, Is.EqualTo(20)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(new DateTime(2002, 2, 2).Date)); + Assert.That(result.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + + Assert.That(result.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(result.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(result.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(result.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(result.ModifiedBy, Is.EqualTo("manager")); + Assert.That(result.ModifiedInfo, Is.EqualTo("The Manager (Perth)")); + } + + var crudEvents = db.Select(); + // events.PrintDump(); + Assert.That(crudEvents.Count, Is.EqualTo(4)); + Assert.That(crudEvents.Count(x => x.RequestType == nameof(CreateRockstarAuditTenant)), Is.EqualTo(1)); + Assert.That(crudEvents.Count(x => x.RequestType == nameof(UpdateRockstarAuditTenant)), Is.EqualTo(1)); + Assert.That(crudEvents.Count(x => x.RequestType == nameof(PatchRockstarAuditTenant)), Is.EqualTo(1)); + Assert.That(crudEvents.Count(x => x.RequestType == nameof(SoftDeleteAuditTenant)), Is.EqualTo(1)); + + var newRockstar = db.SingleById(id); + assertState(newRockstar); + + db.DeleteById(id); + Assert.That(db.SingleById(id), Is.Null); + + // OrmLiteUtils.PrintSql(); + + var eventsPlayer = new CrudEventsExecutor(appHost); + foreach (var crudEvent in dbEvents.GetEvents(db)) + { + await eventsPlayer.ExecuteAsync(crudEvent); + } + + crudEvents = db.Select(); + Assert.That(crudEvents.Count, Is.EqualTo(4)); // Should not be any new events created by executor + + newRockstar = db.SingleById(id); //uses the same Id + assertState(newRockstar); // State should be the same + } + + [Test] + public void Can_CreateRockstarAuditTenant() + { + var authClient = CreateAuthClient(); + CreateAndSoftDeleteRockstarAuditTenant(authClient); + } + + private int CreateAndSoftDeleteRockstarAuditTenant(JsonServiceClient authClient) + { + using var db = appHost.GetDbConnection(); + db.DeleteAll(); + + var createRequest = new CreateRockstarAuditTenant { + FirstName = "Create", + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002, 2, 2), + LivingStatus = LivingStatus.Dead, + }; + var createResponse = authClient.Post(createRequest); + var id = createResponse.Id; + Assert.That(id, Is.GreaterThan(0)); + var result = createResponse.Result; + + Assert.That(result.FirstName, Is.EqualTo(createRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(createRequest.LivingStatus)); + + var newRockstar = db.SingleById(id); + Assert.That(newRockstar.TenantId, Is.EqualTo(10)); //admin.City London => 10 + Assert.That(newRockstar.FirstName, Is.EqualTo(createRequest.FirstName)); + Assert.That(newRockstar.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(newRockstar.Age, Is.EqualTo(createRequest.Age)); + Assert.That(newRockstar.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(createRequest.LivingStatus)); + + Assert.That(newRockstar.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(newRockstar.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.ModifiedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.ModifiedInfo, Is.EqualTo("Admin User (London)")); + + Assert.That(authClient.Get(new QueryRockstarAudit {Id = id}).Results.Count, + Is.EqualTo(1)); + + authClient = new JsonServiceClient(Config.ListeningOn); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "manager", + Password = "p@55wOrd", + RememberMe = true, + }); + + var updateRequest = new UpdateRockstarAuditTenant { + Id = id, + FirstName = "Updated", + LivingStatus = LivingStatus.Alive, + }; + var updateResponse = authClient.Put(updateRequest); + + void assertUpdated(RockstarAuto result) + { + Assert.That(result.FirstName, Does.StartWith(updateRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(updateRequest.LivingStatus)); + } + + Assert.That(updateResponse.Id, Is.EqualTo(id)); + assertUpdated(updateResponse.Result); + + newRockstar = db.SingleById(id); + Assert.That(newRockstar.FirstName, Is.EqualTo("Updated")); + Assert.That(newRockstar.LivingStatus, Is.EqualTo(LivingStatus.Alive)); + + Assert.That(newRockstar.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.CreatedBy, Is.EqualTo("admin@email.com")); + Assert.That(newRockstar.CreatedInfo, Is.EqualTo("Admin User (London)")); + Assert.That(newRockstar.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.ModifiedBy, Is.EqualTo("manager")); + Assert.That(newRockstar.ModifiedInfo, Is.EqualTo("The Manager (Perth)")); + + Assert.That(authClient.Get(new QueryRockstarAuditSubOr { + FirstNameStartsWith = "Up", + AgeOlderThan = 18, + }).Results.Count, + Is.EqualTo(1)); + + var patchRequest = new PatchRockstarAuditTenant { + Id = id, + FirstName = updateRequest.FirstName + " & Patched" + }; + var patchResponse = authClient.Patch(patchRequest); + Assert.That(patchResponse.Result.FirstName, Is.EqualTo("Updated & Patched")); + assertUpdated(patchResponse.Result); + + var softDeleteResponse = authClient.Put(new SoftDeleteAuditTenant { + Id = id, + }); + + Assert.That(softDeleteResponse.Id, Is.EqualTo(id)); + assertUpdated(softDeleteResponse.Result); + + newRockstar = db.SingleById(id); + Assert.That(newRockstar.SoftDeletedDate.Value.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(newRockstar.SoftDeletedBy, Is.EqualTo("manager")); + Assert.That(newRockstar.SoftDeletedInfo, Is.EqualTo("The Manager (Perth)")); + + Assert.That(authClient.Get(new QueryRockstarAudit {Id = id}).Results.Count, + Is.EqualTo(0)); + + Assert.That(authClient.Get(new QueryRockstarAuditSubOr { + FirstNameStartsWith = "Up", + AgeOlderThan = 18, + }).Results.Count, + Is.EqualTo(0)); + + return id; + } + + [Test] + public void Can_CreateRockstarAuditTenant_with_RealDelete() + { + var authClient = CreateAuthClient(); + var id = CreateAndSoftDeleteRockstarAuditTenant(authClient); + + using var db = appHost.GetDbConnection(); + + var realDeleteResponse = authClient.Delete(new RealDeleteAuditTenant { + Id = id, + Age = 99 //non matching filter + }); + Assert.That(realDeleteResponse.Id, Is.EqualTo(id)); + Assert.That(realDeleteResponse.Count, Is.EqualTo(0)); + var newRockstar = db.SingleById(id); + Assert.That(newRockstar, Is.Not.Null); + + realDeleteResponse = authClient.Delete(new RealDeleteAuditTenant { + Id = id, + }); + Assert.That(realDeleteResponse.Id, Is.EqualTo(id)); + Assert.That(realDeleteResponse.Count, Is.EqualTo(1)); + newRockstar = db.SingleById(id); + Assert.That(newRockstar, Is.Null); + } + + [Test] + public void Can_CreateRockstarAuditTenantGateway_Gateway() + { + var authClient = new JsonServiceClient(Config.ListeningOn); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + var createRequest = new CreateRockstarAuditTenantGateway { + FirstName = "CreateGateway", + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }; + + var createResponse = authClient.Post(createRequest); + Assert.That(createResponse.Id, Is.GreaterThan(0)); + var result = createResponse.Result; + + var updateRequest = new UpdateRockstarAuditTenantGateway { + Id = createResponse.Id, + FirstName = "UpdatedGateway", + LivingStatus = LivingStatus.Alive, + }; + var updateResponse = authClient.Put(updateRequest); + result = updateResponse.Result; + + Assert.That(updateResponse.Id, Is.EqualTo(createResponse.Id)); + Assert.That(result.FirstName, Is.EqualTo(updateRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(updateRequest.LivingStatus)); + + var patchRequest = new PatchRockstarAuditTenantGateway { + Id = createResponse.Id, + FirstName = "PatchedGateway", + LivingStatus = LivingStatus.Alive, + }; + var patchResponse = authClient.Patch(patchRequest); + result = patchResponse.Result; + + Assert.That(updateResponse.Id, Is.EqualTo(createResponse.Id)); + Assert.That(result.FirstName, Is.EqualTo(patchRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(patchRequest.LivingStatus)); + + var deleteRequest = authClient.Delete(new RealDeleteAuditTenantGateway { + Id = createResponse.Id, + }); + Assert.That(deleteRequest.Id, Is.EqualTo(createResponse.Id)); + } + + [Test] + public void Can_CreateRockstarAuditTenantMq() + { + var authClient = new JsonServiceClient(Config.ListeningOn); + authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + var createRequest = new CreateRockstarAuditTenantMq { + FirstName = nameof(CreateRockstarAuditTenantMq), + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }; + + authClient.Post(createRequest); + + using var db = appHost.GetDbConnection(); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(CreateRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + var result = db.Single(x => x.FirstName == nameof(CreateRockstarAuditTenantMq)); + + var updateRequest = new UpdateRockstarAuditTenantMq { + Id = result.Id, + FirstName = nameof(UpdateRockstarAuditTenantMq), + LivingStatus = LivingStatus.Alive, + }; + authClient.Put(updateRequest); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(UpdateRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + result = db.Single(x => x.FirstName == nameof(UpdateRockstarAuditTenantMq)); + + Assert.That(result.FirstName, Is.EqualTo(updateRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(updateRequest.LivingStatus)); + + var patchRequest = new PatchRockstarAuditTenantMq { + Id = result.Id, + FirstName = nameof(PatchRockstarAuditTenantMq), + LivingStatus = LivingStatus.Alive, + }; + authClient.Patch(patchRequest); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + result = db.Single(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)); + + Assert.That(result.FirstName, Is.EqualTo(patchRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(patchRequest.LivingStatus)); + + authClient.Delete(new RealDeleteAuditTenantMq { + Id = result.Id, + }); + + ExecUtils.RetryUntilTrue(() => + !db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + + Assert.That(db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), Is.False); + } + + [Test] + public void Can_CreateRockstarAuditTenant_OneWay() + { + var authClient = new JsonServiceClient(Config.ListeningOn); + var authResponse = authClient.Post(new Authenticate { + provider = "credentials", + UserName = "admin@email.com", + Password = "p@55wOrd", + RememberMe = true, + }); + + var createRequest = new CreateRockstarAuditTenant { + FirstName = nameof(CreateRockstarAuditTenant), + LastName = "Audit", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }; + + authClient.SendOneWay(createRequest); + + using var db = appHost.GetDbConnection(); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(CreateRockstarAuditTenant)), + TimeSpan.FromSeconds(2)); + var result = db.Single(x => x.FirstName == nameof(CreateRockstarAuditTenant)); + + var updateRequest = new UpdateRockstarAuditTenant { + Id = result.Id, + FirstName = nameof(UpdateRockstarAuditTenant), + LivingStatus = LivingStatus.Alive, + }; + authClient.SendOneWay(updateRequest); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(UpdateRockstarAuditTenant)), + TimeSpan.FromSeconds(2)); + result = db.Single(x => x.FirstName == nameof(UpdateRockstarAuditTenant)); + + Assert.That(result.FirstName, Is.EqualTo(updateRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(updateRequest.LivingStatus)); + + var patchRequest = new PatchRockstarAuditTenant { + Id = result.Id, + FirstName = nameof(PatchRockstarAuditTenant), + LivingStatus = LivingStatus.Alive, + }; + authClient.SendOneWay(patchRequest); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenant)), + TimeSpan.FromSeconds(2)); + result = db.Single(x => x.FirstName == nameof(PatchRockstarAuditTenant)); + + Assert.That(result.FirstName, Is.EqualTo(patchRequest.FirstName)); + Assert.That(result.LastName, Is.EqualTo(createRequest.LastName)); + Assert.That(result.Age, Is.EqualTo(createRequest.Age)); + Assert.That(result.DateOfBirth.Date, Is.EqualTo(createRequest.DateOfBirth.Date)); + Assert.That(result.LivingStatus, Is.EqualTo(patchRequest.LivingStatus)); + + authClient.Delete(new RealDeleteAuditTenant { + Id = result.Id, + }); + + ExecUtils.RetryUntilTrue(() => + !db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), + TimeSpan.FromSeconds(2)); + + Assert.That(db.Exists(x => x.FirstName == nameof(PatchRockstarAuditTenantMq)), Is.False); + } + + [Test] + public void Can_CreateRockstarAuditMqToken_OneWay() + { + var createRequest = new CreateRockstarAuditMqToken { + BearerToken = JwtUserToken, + FirstName = nameof(CreateRockstarAuditMqToken), + LastName = "JWT", + Age = 20, + DateOfBirth = new DateTime(2002,2,2), + LivingStatus = LivingStatus.Dead, + }; + + client.SendOneWay(createRequest); + + using var db = appHost.GetDbConnection(); + + ExecUtils.RetryUntilTrue(() => + db.Exists(x => x.FirstName == nameof(CreateRockstarAuditMqToken)), + TimeSpan.FromSeconds(2)); + + var result = db.Single(x => x.FirstName == nameof(CreateRockstarAuditMqToken)); + Assert.That(result.Id, Is.GreaterThan(0)); + Assert.That(result.FirstName, Is.EqualTo(nameof(CreateRockstarAuditMqToken))); + Assert.That(result.LastName, Is.EqualTo("JWT")); + Assert.That(result.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + Assert.That(result.CreatedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(result.CreatedBy, Is.EqualTo("jwtuser")); + Assert.That(result.CreatedInfo, Is.EqualTo("JWT User (Japan)")); + Assert.That(result.ModifiedDate.Date, Is.EqualTo(DateTime.UtcNow.Date)); + Assert.That(result.ModifiedBy, Is.EqualTo("jwtuser")); + Assert.That(result.ModifiedInfo, Is.EqualTo("JWT User (Japan)")); + } + + [Test] + public void Can_UpdateRockstarVersion() + { + var createResponse = client.Post(new CreateRockstarVersion { + FirstName = "Create", + LastName = "Version", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + }); + + try + { + client.Patch(new UpdateRockstarVersion { + Id = createResponse.Id, + LastName = "UpdateVersion2", + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(OptimisticConcurrencyException))); + } + + var response = client.Patch(new UpdateRockstarVersion { + Id = createResponse.Id, + LastName = "UpdateVersion3", + RowVersion = createResponse.RowVersion, + }); + + using var db = appHost.GetDbConnection(); + var newRockstar = db.SingleById(createResponse.Id); + Assert.That(newRockstar.RowVersion, Is.Not.EqualTo(default(uint))); + Assert.That(newRockstar.FirstName, Is.EqualTo("Create")); + Assert.That(newRockstar.LastName, Is.EqualTo("UpdateVersion3")); + + try + { + client.Patch(new UpdateRockstarVersion { + Id = createResponse.Id, + LastName = "UpdateVersion4", + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(OptimisticConcurrencyException))); + } + } + + [Test] + public void Can_NamedConnection_AutoCrud_Services() + { + var createRequest = new CreateNamedRockstar { + Id = 10, + FirstName = "Named", + LastName = "SqlServer", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(createRequest); + Assert.That(createResponse.Id, Is.EqualTo(10)); + Assert.That(createResponse.Result, Is.Not.Null); + + using var db = appHost.Resolve() + .OpenDbConnection(AutoQueryAppHost.SqlServerNamedConnection); + + var newRockstar = db.Single(x => x.LastName == "SqlServer"); + Assert.That(newRockstar.FirstName, Is.EqualTo("Named")); + + var updateRequest = new UpdateNamedRockstar { + Id = 10, + FirstName = "Updated", + Age = 21, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Dead, + }; + + var updateResponse = client.Put(updateRequest); + + Assert.That(updateResponse.Id, Is.EqualTo(10)); + Assert.That(updateResponse.Result.FirstName, Is.EqualTo("Updated")); + Assert.That(updateResponse.Result.Age, Is.EqualTo(21)); + Assert.That(updateResponse.Result.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + } + + [Test] + public void Can_ConnectionInfo_AutoCrud_Services() + { + var createRequest = new CreateConnectionInfoRockstar { + Id = 11, + FirstName = "Named", + LastName = "SqlServer", + Age = 20, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Alive, + }; + + var createResponse = client.Post(createRequest); + Assert.That(createResponse.Id, Is.EqualTo(11)); + Assert.That(createResponse.Result, Is.Not.Null); + + using var db = appHost.Resolve() + .OpenDbConnection(AutoQueryAppHost.SqlServerNamedConnection); + + var newRockstar = db.Single(x => x.LastName == "SqlServer"); + Assert.That(newRockstar.FirstName, Is.EqualTo("Named")); + + var updateRequest = new UpdateConnectionInfoRockstar { + Id = 11, + FirstName = "Updated", + Age = 21, + DateOfBirth = new DateTime(2001,1,1), + LivingStatus = LivingStatus.Dead, + }; + + var updateResponse = client.Put(updateRequest); + + Assert.That(updateResponse.Id, Is.EqualTo(11)); + Assert.That(updateResponse.Result.FirstName, Is.EqualTo("Updated")); + Assert.That(updateResponse.Result.Age, Is.EqualTo(21)); + Assert.That(updateResponse.Result.LivingStatus, Is.EqualTo(LivingStatus.Dead)); + } + + [Test] + public void Can_Patch_DefaultFields_to_default_values() + { + var createRequest = new CreateDefaultValues { + Id = 1, + Bool = true, + NBool = false, + Int = 2, + NInt = 3, + String = "A", + }; + var createResponse = client.Post(createRequest); + AssertCreateDefaultValues(createRequest); + + var request = new PatchDefaultValues { + Id = createRequest.Id, + Reset = new[] { + nameof(PatchDefaultValues.Bool), + nameof(PatchDefaultValues.NBool), + nameof(PatchDefaultValues.Int), + nameof(PatchDefaultValues.NInt), + nameof(PatchDefaultValues.String), + }, + }; + client.Patch(request); + + using var db = appHost.GetDbConnection(); + var row = db.SingleById(createRequest.Id); + Assert.That(row.Bool, Is.EqualTo(default(bool))); + Assert.That(row.NBool, Is.EqualTo(default(bool?))); + Assert.That(row.Int, Is.EqualTo(default(int))); + Assert.That(row.NInt, Is.EqualTo(default(int?))); + Assert.That(row.String, Is.EqualTo(default(string))); + + Assert.Throws(() => client.Post(new PatchDefaultValues { + Id = createRequest.Id, + Reset = new[] { nameof(PatchDefaultValues.Id) }, + })); + } + + private void AssertCreateDefaultValues(CreateDefaultValues createRequest) + { + using var db = appHost.GetDbConnection(); + var row = db.SingleById(createRequest.Id); + Assert.That(row.Id, Is.EqualTo(createRequest.Id)); + Assert.That(row.Bool, Is.EqualTo(createRequest.Bool)); + Assert.That(row.NBool, Is.EqualTo(createRequest.NBool)); + Assert.That(row.Int, Is.EqualTo(createRequest.Int)); + Assert.That(row.NInt, Is.EqualTo(createRequest.NInt)); + Assert.That(row.String, Is.EqualTo(createRequest.String)); + } + + [Test] + public void Does_ignore_unknown_properties_not_on_DataModel() + { + var createResponse = client.Post(new CreateRockstarUnknownField { + FirstName = "UpdateReturn", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + Unknown = "Field", + }); + + var queryResponse = client.Get(new QueryRockstarsUnknownField { + Id = createResponse.Id, + Unknown = "Field", + }); + + Assert.That(queryResponse.Results.Count, Is.EqualTo(1)); + + var updateResponse = client.Put(new UpdateRockstarUnknownField { + Id = createResponse.Id, + LastName = "UpdateResult", + Unknown = "Field", + }); + + var patchResponse = client.Patch(new PatchRockstarUnknownField { + Id = createResponse.Id, + LastName = "PatchResult", + Unknown = "Field", + }); + + var deleteResponse = client.Delete(new DeleteRockstarUnknownField { + Id = createResponse.Id, + Unknown = "Field", + }); + } + + [Test] + public async Task Does_ignore_unknown_properties_not_on_DataModel_Async() + { + var createResponse = await client.PostAsync(new CreateRockstarUnknownField { + FirstName = "UpdateReturn", + LastName = "Result", + Age = 20, + DateOfBirth = new DateTime(2001,7,1), + LivingStatus = LivingStatus.Dead, + Unknown = "Field", + }); + + var queryResponse = await client.GetAsync(new QueryRockstarsUnknownField { + Id = createResponse.Id, + Unknown = "Field", + }); + + Assert.That(queryResponse.Results.Count, Is.EqualTo(1)); + + var updateResponse = await client.PutAsync(new UpdateRockstarUnknownField { + Id = createResponse.Id, + LastName = "UpdateResult", + Unknown = "Field", + }); + + var patchResponse = await client.PatchAsync(new PatchRockstarUnknownField { + Id = createResponse.Id, + LastName = "PatchResult", + Unknown = "Field", + }); + + var deleteResponse = await client.DeleteAsync(new DeleteRockstarUnknownField { + Id = createResponse.Id, + Unknown = "Field", + }); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryDataServiceTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryDataServiceTests.cs new file mode 100644 index 00000000000..686e87fd119 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryDataServiceTests.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.OrmLite; +using ServiceStack.Text; +using ServiceStack.WebHost.Endpoints.Tests.Support; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class AutoQueryDataServiceTests : AutoQueryDataTests + { + static AutoQueryDataServiceTests() + { +#if NET45 + //https://githubengineering.com/crypto-removal-notice/ + ServicePointManager.Expect100Continue = true; + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; +#endif + } + + public override ServiceStackHost CreateAppHost() + { + return new AutoQueryDataServiceAppHost(); + } + + [Test] + public void Can_call_overidden_AutoQueryData_Service_with_custom_MemorySource() + { + var response = client.Get(new GetAllRockstarGenresData { Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(AutoQueryDataAppHost.SeedGenres.Length)); + Assert.That(response.Results.Count, Is.EqualTo(AutoQueryDataAppHost.SeedGenres.Length)); + + response = client.Get(new GetAllRockstarGenresData { Name = "Grunge" }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].RockstarId, Is.EqualTo(3)); + } + + [Test] + public void Does_Cache_third_party_api_ServiceSource() + { + GetGithubRepos.ApiCalls = 0; + QueryResponse response; + + response = client.Get(new QueryGitHubRepos { Organization = "ServiceStack" }); + Assert.That(response.Results.Count, Is.GreaterThan(20)); + Assert.That(GetGithubRepos.ApiCalls, Is.EqualTo(1)); + + response = client.Get(new QueryGitHubRepos { Organization = "ServiceStack", + NameStartsWith = "ServiceStack", + Fields = "Name,Description,Homepage,Language,Watchers_Count", + OrderByDesc = "Watchers_Count" + }); + Assert.That(response.Results.Count, Is.LessThan(20)); + Assert.That(response.Results.All(x => x.Id == 0)); + Assert.That(response.Results.All(x => x.Name != null)); + Assert.That(response.Results[0].Watchers_Count, Is.GreaterThan(3000)); + Assert.That(GetGithubRepos.ApiCalls, Is.EqualTo(1)); + + response = client.Get(new QueryGitHubRepos { User = "mythz" }); + Assert.That(response.Results.Count, Is.GreaterThan(20)); + Assert.That(GetGithubRepos.ApiCalls, Is.EqualTo(2)); + + response = client.Get(new QueryGitHubRepos { User = "mythz", + DescriptionContains = "101 LINQ Samples", + Take = 4, + OrderBy = "Name", + }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + Assert.That(GetGithubRepos.ApiCalls, Is.EqualTo(2)); + } + + [Test] + public void Does_Cache_MemorySource() + { + QueryResponse response; + + response = client.Get(new QueryServiceStackContributors + { + Repo = "ServiceStack", + Take = 20, + Include = "Total" + }); + Assert.That(response.Total, Is.GreaterThan(20)); + Assert.That(response.Results.Count, Is.EqualTo(20)); + Assert.That(HostContext.LocalCache.Get>("aqd:" + typeof(GithubContributor).Name) != null); + + response = client.Get(new QueryServiceStackContributors + { + Repo = "ServiceStack", + ContributionsAbove = 10, + Fields = "Login,Contributions" + }); + Assert.That(response.Results.Count, Is.GreaterThan(10)); + Assert.That(response.Results.All(c => c.Contributions > 10)); + Assert.That(response.Results.All(c => c.Login != null)); + Assert.That(response.Results.All(c => c.Id == 0)); + Assert.That(response.Results.All(c => c.Type == null)); + } + } + + public class AutoQueryDataServiceAppHost : AutoQueryDataAppHost + { + public override void Configure(Container container) + { +#if NET45 + //https://githubengineering.com/crypto-removal-notice/ + ServicePointManager.Expect100Continue = true; + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; +#endif + + base.Configure(container); + + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); + container.Register(dbFactory); + + using (var db = container.Resolve().Open()) + { + db.DropAndCreateTable(); + db.DropAndCreateTable(); + db.DropAndCreateTable(); + db.DropAndCreateTable(); + db.DropAndCreateTable(); + db.DropAndCreateTable(); + db.DropAndCreateTable(); + db.InsertAll(SeedRockstars); + db.InsertAll(SeedAlbums); + db.InsertAll(SeedAdhoc); + db.InsertAll(SeedMovies); + db.InsertAll(SeedAllFields); + db.InsertAll(SeedPagingTest); + db.InsertAll(SeedGenres); + } + + var feature = this.GetPlugin(); + feature.AddDataSource(ctx => ctx.ServiceSource(new GetAllRockstarData())); + feature.AddDataSource(ctx => ctx.ServiceSource(ctx.Dto.ConvertTo())); + feature.AddDataSource(ctx => ctx.ServiceSource(new GetAllAdhocData())); + feature.AddDataSource(ctx => ctx.ServiceSource(new GetAllMoviesData())); + feature.AddDataSource(ctx => ctx.ServiceSource(new GetAllFieldsData())); + feature.AddDataSource(ctx => ctx.ServiceSource(new GetAllPagingTestData())); + feature.AddDataSource(ctx => ctx.ServiceSource(new GetAllPagingTestData())); + feature.AddDataSource(ctx => ctx.ServiceSource(ctx.Dto.ConvertTo(), + HostContext.Cache, TimeSpan.FromMinutes(1))); + feature.AddDataSource(ctx => ctx.MemorySource( + () => "https://api.github.com/repos/ServiceStack/{0}/contributors" + .Fmt(ctx.Request.GetParam("repo")) + .GetJsonFromUrl(req => req.SetUserAgent("AutoQuery")).FromJson>(), + HostContext.LocalCache, TimeSpan.FromMinutes(1))); + } + } + + //No IReturn -> List + public class GetAllRockstarData {} + + //IReturn -> List + public class GetAllRockstarAlbumsData : IReturn> + { + public int? Id { get; set; } + public int? RockstarId { get; set; } + public string Name { get; set; } + public string Genre { get; set; } + public int[] IdBetween { get; set; } + } + + //Response DTO + public class GetAllAdhocData : IReturn { } + public class GetAllAdhocDataResponse + { + public DateTime Created { get; set; } + public List Results { get; set; } + } + + //GET No IReturn Task Response + public class GetAllMoviesData {} + + //Response DTO Task Response + public class GetAllFieldsData : IReturn { } + public class GetAllFieldsDataResponse + { + public DateTime Created { get; set; } + public List Results { get; set; } + } + + //GET + public class GetAllPagingTestData { } + + public class QueryGitHubRepos : QueryData + { + public string User { get; set; } + public string Organization { get; set; } + + public string NameStartsWith { get; set; } + public string DescriptionContains { get; set; } + public int? Watchers_Count { get; set; } + } + + public class GetGithubRepos : IReturn> + { + public static int ApiCalls = 0; + + public string User { get; set; } + public string Organization { get; set; } + } + + public class QueryServiceStackContributors : QueryData + { + public string Repo { get; set; } + public int? ContributionsAbove { get; set; } + } + + public class DataQueryServices : Service + { + public object Any(GetAllRockstarData request) + { + return Db.Select().AsTaskResult(); + } + + public object Any(GetAllRockstarAlbumsData request) + { + var q = Db.From(); + + if (request.IdBetween != null) + q.Where(x => x.Id >= request.IdBetween[0] && x.Id <= request.IdBetween[1]); + + if (request.Name != null) + q.Where(x => x.Name == request.Name); + + var results = Db.Select(q); + return results; + } + + public object Any(GetAllAdhocData request) + { + return new GetAllAdhocDataResponse + { + Results = Db.Select() + }; + } + + public object Any(GetAllMoviesData request) + { + return Task.FromResult(Db.Select()); + } + + public Task Get(GetAllFieldsData request) + { + return Task.FromResult(new GetAllFieldsDataResponse + { + Created = DateTime.UtcNow, + Results = Db.Select(), + }); + } + + public Task> Get(GetAllPagingTestData request) + { + return Task.FromResult(Db.Select()); + } + + public object Get(GetGithubRepos request) + { + if (request.User == null && request.Organization == null) + throw new ArgumentNullException("User"); + + var url = request.User != null + ? "https://api.github.com/users/{0}/repos".Fmt(request.User) + : "https://api.github.com/orgs/{0}/repos".Fmt(request.Organization); + + Interlocked.Increment(ref GetGithubRepos.ApiCalls); + + return url.GetJsonFromUrl(requestFilter:req => req.SetUserAgent(GetType().Name)) + .FromJson>(); + } + } + + public class GetAllRockstarGenresData : QueryData + { + public string Name { get; set; } + } + + public class CustomDataQueryServices : Service + { + public IAutoQueryData AutoQuery { get; set; } + + public object Any(GetAllRockstarGenresData requestDto) + { + var memorySource = new MemoryDataSource(Db.Select(), requestDto, Request); + var q = AutoQuery.CreateQuery(requestDto, Request, memorySource); + return AutoQuery.Execute(requestDto, q, memorySource); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryDataTests.Dynamo.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryDataTests.Dynamo.cs new file mode 100644 index 00000000000..de2a7a02ecc --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryDataTests.Dynamo.cs @@ -0,0 +1,426 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Funq; +using NUnit.Framework; +using ServiceStack.DataAnnotations; +using ServiceStack.Text; +using Amazon.DynamoDBv2; +using ServiceStack.Aws.DynamoDb; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class AutoQueryDataDynamoTests : AutoQueryDataTests + { + public override ServiceStackHost CreateAppHost() + { + return new AutoQueryDataDynamoAppHost(); + } + + [Test] + public void Does_perform_QUERY_operation_when_querying_hash_key() + { + var response = client.Get(new QueryDataRockstarAlbums + { + RockstarId = 3, + Genre = "Grunge", + }); + + Assert.That(response.Results.Count, Is.EqualTo(4)); + Assert.That(response.Results.Map(x => x.RockstarId).Distinct(), + Is.EquivalentTo(new[] { 3 })); + } + + [Test] + public void Does_perform_SCAN_operation_when_not_querying_hash_key() + { + var response = client.Get(new QueryDataRockstarAlbums + { + Genre = "Grunge", + }); + + Assert.That(response.Results.Count, Is.EqualTo(5)); + Assert.That(response.Results.Map(x => x.RockstarId).Distinct(), + Is.EquivalentTo(new[] { 3, 5 })); + } + + [Test] + public void Can_query_on_ForeignKey_and_RockstarAlbumGenreIndex() + { + QueryResponse response; + response = client.Get(new QueryDataRockstarAlbumGenreIndex { Genre = "Grunge", Include = "Total" }); //Hash + Assert.That(response.Results.Count, Is.EqualTo(5)); + Assert.That(response.Total, Is.EqualTo(5)); + + response = client.Get(new QueryDataRockstarAlbumGenreIndex { Genre = "Grunge", Id = 3, Include = "Total" }); //Hash + Range + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Name, Is.EqualTo("Nevermind")); + + //Hash + Range BETWEEN + response = client.Get(new QueryDataRockstarAlbumGenreIndex + { + Genre = "Grunge", + IdBetween = new[] { 2, 3 }, + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(2)); + + //Hash + Range BETWEEN + Filter + response = client.Get(new QueryDataRockstarAlbumGenreIndex + { + Genre = "Grunge", + IdBetween = new[] { 2, 3 }, + Name = "Nevermind", + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Id, Is.EqualTo(3)); + + response.PrintDump(); + } + + [Test] + public void Can_query_on_ForeignKey_and_RockstarAlbumGenreIndex_Mapped() + { + QueryResponse response; + response = client.Get(new QueryDataRockstarAlbumGenreIndexMapped { Genre = "Grunge", Include = "Total" }); //Hash + Assert.That(response.Results.Count, Is.EqualTo(5)); + Assert.That(response.Total, Is.EqualTo(5)); + + response = client.Get(new QueryDataRockstarAlbumGenreIndexMapped { Genre = "Grunge", Id = 3, Include = "Total" }); //Hash + Range + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Name, Is.EqualTo("Nevermind")); + + //Hash + Range BETWEEN + response = client.Get(new QueryDataRockstarAlbumGenreIndexMapped + { + Genre = "Grunge", + IdBetween = new[] { 2, 3 }, + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(2)); + + //Hash + Range BETWEEN + Filter + response = client.Get(new QueryDataRockstarAlbumGenreIndexMapped + { + Genre = "Grunge", + IdBetween = new[] { 2, 3 }, + Name = "Nevermind", + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Id, Is.EqualTo(3)); + + response.PrintDump(); + } + + [Test] + public void Can_query_MovieTitleIndex_Ratings() + { + var response = client.Get(new QueryDataMovieTitleIndex { Ratings = new[] { "G", "PG-13" } }); + Assert.That(response.Results.Count, Is.EqualTo(5)); + + var url = Config.ListeningOn + "moviesdataindex/search?ratings=G,PG-13"; + response = url.AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(5)); + + response = client.Get(new QueryDataMovieTitleIndex + { + Ids = new[] { 1, 2 }, + ImdbIds = new[] { "tt0071562", "tt0060196" }, + Ratings = new[] { "G", "PG-13" } + }); + Assert.That(response.Results.Count, Is.EqualTo(9)); + + url = Config.ListeningOn + "moviesdataindex?ratings=G,PG-13&ids=1,2&imdbIds=tt0071562,tt0060196"; + response = url.AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(9)); + } + + [Test] + public void Does_implicitly_OrderBy_PrimaryKey_when_limits_is_specified_SearchDataMovieTitleIndex() + { + var movies = client.Get(new SearchDataMovieTitleIndex { Take = 100 }); + var ids = movies.Results.Map(x => x.Id); + var orderedIds = ids.OrderBy(x => x); + Assert.That(ids, Is.EqualTo(orderedIds)); + + var rockstars = client.Get(new SearchDataMovieTitleIndex { Take = 100 }); + ids = rockstars.Results.Map(x => x.Id); + orderedIds = ids.OrderBy(x => x); + Assert.That(ids, Is.EqualTo(orderedIds)); + } + + [Test] + public void Can_OrderBy_queries_SearchDataMovieTitleIndex() + { + var movies = client.Get(new SearchDataMovieTitleIndex { Take = 100, OrderBy = "ImdbId" }); + var ids = movies.Results.Map(x => x.ImdbId); + var orderedIds = ids.OrderBy(x => x).ToList(); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovieTitleIndex { Take = 100, OrderBy = "Rating,ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating).ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovieTitleIndex { Take = 100, OrderByDesc = "ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = ids.OrderByDescending(x => x).ToList(); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovieTitleIndex { Take = 100, OrderByDesc = "Rating,ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovieTitleIndex { Take = 100, OrderBy = "Rating,-ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovieTitleIndex { Take = 100, OrderByDesc = "Rating,-ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + var url = Config.ListeningOn + "moviesdata/search?take=100&orderBy=Rating,ImdbId"; + movies = url.AsJsonInto(); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating).ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + url = Config.ListeningOn + "moviesdata/search?take=100&orderByDesc=Rating,ImdbId"; + movies = url.AsJsonInto(); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + } + + [Test] + public void Cached_DynamoQuery_does_cached_duplicate_requests_when_MaxAge() + { + var request = new QueryCacheMaxAgeDataRockstars(); + var client = new CachedServiceClient(new JsonServiceClient(Config.ListeningOn)); + + var response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(response.Results.Count, Is.EqualTo(Rockstars.Count)); + + response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryCacheMaxAgeDataRockstars { Age = 27 }); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(Rockstars.Count(x => x.Age == 27))); + } + + [Test] + public void Cached_DynamoQuery_does_cached_duplicate_requests_when_MaxAge_Custom_Cached() + { + var request = new CustomQueryCacheMaxAgeDataRockstars(); + var client = new CachedServiceClient(new JsonServiceClient(Config.ListeningOn)); + + var response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(response.Results.Count, Is.EqualTo(Rockstars.Count)); + + response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new CustomQueryCacheMaxAgeDataRockstars { Age = 27 }); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(Rockstars.Count(x => x.Age == 27))); + } + + [Test] + public void Cached_DynamoQuery_does_return_NotModified_when_MustRevalidate() + { + var request = new QueryCacheMustRevalidateDataRockstars(); + var client = new CachedServiceClient(new JsonServiceClient(Config.ListeningOn)); + + var response = client.Get(request); + Assert.That(client.NotModifiedHits, Is.EqualTo(0)); + Assert.That(response.Results.Count, Is.EqualTo(Rockstars.Count)); + + response = client.Get(request); + Assert.That(client.NotModifiedHits, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryCacheMustRevalidateDataRockstars { Age = 27 }); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(client.NotModifiedHits, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(Rockstars.Count(x => x.Age == 27))); + } + + [Test] + public void Does_throw_on_SCAN_when_not_allowScans() + { + var results = client.Get(new QueryScannedTable { Id = 1 }); + + Assert.Throws(() => + client.Get(new QueryScannedTable { Name = "foo" }) + ); + } + } + + public class AutoQueryDataDynamoAppHost : AutoQueryDataAppHost + { + public override void Configure(Container container) + { + base.Configure(container); + + container.Register(c => new PocoDynamo( + new AmazonDynamoDBClient("keyId", "key", new AmazonDynamoDBConfig + { + ServiceURL = Tests.Config.DynamoDbServiceURL, + })) + .RegisterTable() + .RegisterTable() + .RegisterTable() + .RegisterTable() + .RegisterTable() + .RegisterTable() + .RegisterTable() + ); + + var dynamo = container.Resolve(); + //dynamo.DeleteAllTables(); + dynamo.InitSchema(); + dynamo.PutItems(SeedRockstars); + dynamo.PutItems(SeedAlbums); + dynamo.PutItems(SeedAdhoc); + dynamo.PutItems(SeedMovies); + dynamo.PutItems(SeedAllFields); + dynamo.PutItems(SeedPagingTest); + + var feature = this.GetPlugin(); + feature.AddDataSource(ctx => ctx.DynamoDbSource()); + feature.AddDataSource(ctx => ctx.DynamoDbSource()); + feature.AddDataSource(ctx => ctx.DynamoDbSource()); + feature.AddDataSource(ctx => ctx.DynamoDbSource()); + feature.AddDataSource(ctx => ctx.DynamoDbSource()); + feature.AddDataSource(ctx => ctx.DynamoDbSource()); + feature.AddDataSource(ctx => ctx.DynamoDbSource()); + feature.AddDataSource(ctx => ctx.DynamoDbSource()); + feature.AddDataSource(ctx => ctx.DynamoDbSource(allowScans: false)); + } + } + + public class ScannedTable + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class QueryScannedTable : QueryData + { + public int? Id { get; set; } + public string Name { get; set; } + } + + [Route("/moviesdataindex/search")] + [QueryData(QueryTerm.And)] //Default + public class SearchDataMovieTitleIndex : QueryData { } + + [Route("/moviesdataindex")] + [QueryData(QueryTerm.Or)] + public class QueryDataMovieTitleIndex : QueryData + { + public int[] Ids { get; set; } + public string[] ImdbIds { get; set; } + public string[] Ratings { get; set; } + } + + public class MovieTitleIndex : IGlobalIndex + { + [HashKey] + public string Title { get; set; } + + [RangeKey] + public decimal Score { get; set; } + + public int Id { get; set; } + public string ImdbId { get; set; } + public string Rating { get; set; } + public string Director { get; set; } + public DateTime ReleaseDate { get; set; } + public string TagLine { get; set; } + public List Genres { get; set; } + } + + [Route("/querydata/rockstaralbumindex")] + public class QueryDataRockstarAlbumGenreIndex : QueryData + { + public int? Id { get; set; } + public int? RockstarId { get; set; } + public string Name { get; set; } + public string Genre { get; set; } + public int[] IdBetween { get; set; } + } + + [Route("/querydata/rockstaralbumindex/mapped")] + public class QueryDataRockstarAlbumGenreIndexMapped : QueryData + { + public int? Id { get; set; } + public int? RockstarId { get; set; } + public string Name { get; set; } + public string Genre { get; set; } + public int[] IdBetween { get; set; } + } + + public class RockstarAlbumGenreGlobalIndex : IGlobalIndex + { + [HashKey] + public string Genre { get; set; } + + [RangeKey] + public int Id { get; set; } + + public string Name { get; set; } + public int RockstarId { get; set; } + } + + [CacheResponse(Duration = 10, MaxAge = 10)] + [Route("/querydata/cachemaxage/rockstars")] + public class QueryCacheMaxAgeDataRockstars : QueryData + { + public int? Age { get; set; } + } + + [CacheResponse(Duration = 10, MaxAge = 0, CacheControl = CacheControl.MustRevalidate)] + [Route("/querydata/cachemustrevalidate/rockstars")] + public class QueryCacheMustRevalidateDataRockstars : QueryData + { + public int? Age { get; set; } + } + + [Route("/custom/querydata/cachemaxage/rockstars")] + public class CustomQueryCacheMaxAgeDataRockstars : QueryData + { + public int? Age { get; set; } + } + + [CacheResponse(Duration = 10, MaxAge = 10)] + public class MyCachedAutoQueryServices : Service + { + public IAutoQueryData AutoQuery { get; set; } + + public object Any(CustomQueryCacheMaxAgeDataRockstars query) + { + return AutoQuery.Execute(query, AutoQuery.CreateQuery(query, Request), Request); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryDataTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryDataTests.cs new file mode 100644 index 00000000000..03f0b2abe0e --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryDataTests.cs @@ -0,0 +1,1135 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using Funq; +using NUnit.Framework; +using ServiceStack.Extensions; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class AutoQueryDataMemoryTests : AutoQueryDataTests + { + public override ServiceStackHost CreateAppHost() + { + return new AutoQueryDataAppHost(); + } + } + + public class AutoQueryDataAppHost : AppSelfHostBase + { + public AutoQueryDataAppHost() + : base("AutoQuerData", typeof(AutoQueryService).Assembly) + { } + + public override void Configure(Container container) + { + Plugins.Add(new AutoQueryDataFeature + { + MaxLimit = 100, + ResponseFilters = { + ctx => { + var executedCmds = new List(); + var supportedFns = new Dictionary>(StringComparer.OrdinalIgnoreCase) + { + {"ADD", (a,b) => a + b }, + {"MULTIPLY", (a,b) => a * b }, + {"DIVIDE", (a,b) => a / b }, + {"SUBTRACT", (a,b) => a - b }, + }; + foreach (var cmd in ctx.Commands) + { + if (!supportedFns.TryGetValue(cmd.Name, out var fn)) continue; + var label = !cmd.Suffix.IsNullOrWhiteSpace() ? cmd.Suffix.ToString().Trim() : cmd.ToString(); + ctx.Response.Meta[label] = fn(cmd.Args[0].ParseInt32(), cmd.Args[1].ParseInt32()).ToString(); + executedCmds.Add(cmd); + } + ctx.Commands.RemoveAll(executedCmds.Contains); + } + } + } + .AddDataSource(ctx => ctx.MemorySource(SeedRockstars)) + .AddDataSource(ctx => ctx.MemorySource(SeedAlbums)) + .AddDataSource(ctx => ctx.MemorySource(SeedGenres)) + .AddDataSource(ctx => ctx.MemorySource(SeedAdhoc)) + .AddDataSource(ctx => ctx.MemorySource(SeedMovies)) + .AddDataSource(ctx => ctx.MemorySource(SeedAllFields)) + .AddDataSource(ctx => ctx.MemorySource(SeedPagingTest)) + .RegisterQueryFilter((q, dto, req) => + q.And(x => x.LastName, new EndsWithCondition(), "son") + ) + .RegisterQueryFilter((q, dto, req) => + q.And(x => x.LastName, new EndsWithCondition(), "son") + ) + .RegisterQueryFilter((q, dto, req) => + q.And(x => x.LastName, new EndsWithCondition(), "son") + ) + ); + } + + public static Rockstar[] SeedRockstars = new[] { + new Rockstar { Id = 1, FirstName = "Jimi", LastName = "Hendrix", LivingStatus = LivingStatus.Dead, Age = 27, DateOfBirth = new DateTime(1942, 11, 27), DateDied = new DateTime(1970, 09, 18), }, + new Rockstar { Id = 2, FirstName = "Jim", LastName = "Morrison", Age = 27, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1943, 12, 08), DateDied = new DateTime(1971, 07, 03), }, + new Rockstar { Id = 3, FirstName = "Kurt", LastName = "Cobain", Age = 27, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1967, 02, 20), DateDied = new DateTime(1994, 04, 05), }, + new Rockstar { Id = 4, FirstName = "Elvis", LastName = "Presley", Age = 42, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1935, 01, 08), DateDied = new DateTime(1977, 08, 16), }, + new Rockstar { Id = 5, FirstName = "David", LastName = "Grohl", Age = 44, LivingStatus = LivingStatus.Alive, DateOfBirth = new DateTime(1969, 01, 14), }, + new Rockstar { Id = 6, FirstName = "Eddie", LastName = "Vedder", Age = 48, LivingStatus = LivingStatus.Alive, DateOfBirth = new DateTime(1964, 12, 23), }, + new Rockstar { Id = 7, FirstName = "Michael", LastName = "Jackson", Age = 50, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1958, 08, 29), DateDied = new DateTime(2009, 06, 05), }, + }; + + public static RockstarAlbum[] SeedAlbums = new[] { + new RockstarAlbum { Id = 1, RockstarId = 1, Name = "Electric Ladyland", Genre = "Funk" }, + new RockstarAlbum { Id = 2, RockstarId = 3, Name = "Bleach", Genre = "Grunge" }, + new RockstarAlbum { Id = 3, RockstarId = 3, Name = "Nevermind", Genre = "Grunge" }, + new RockstarAlbum { Id = 4, RockstarId = 3, Name = "In Utero", Genre = "Grunge" }, + new RockstarAlbum { Id = 5, RockstarId = 3, Name = "Incesticide", Genre = "Grunge" }, + new RockstarAlbum { Id = 6, RockstarId = 3, Name = "MTV Unplugged in New York", Genre = "Acoustic" }, + new RockstarAlbum { Id = 7, RockstarId = 5, Name = "Foo Fighters", Genre = "Grunge" }, + new RockstarAlbum { Id = 8, RockstarId = 6, Name = "Into the Wild", Genre = "Folk" }, + }; + + public static RockstarGenre[] SeedGenres = new[] { + new RockstarGenre { RockstarId = 1, Name = "Rock" }, + new RockstarGenre { RockstarId = 3, Name = "Grunge" }, + new RockstarGenre { RockstarId = 5, Name = "Alternative Rock" }, + new RockstarGenre { RockstarId = 6, Name = "Folk Rock" }, + }; + + public static Adhoc[] SeedAdhoc = SeedRockstars.Map(x => new Adhoc + { + Id = x.Id, + FirstName = x.FirstName, + LastName = x.LastName, + }).ToArray(); + + public static Movie[] SeedMovies = new[] { + new Movie { Id = 1, ImdbId = "tt0111161", Title = "The Shawshank Redemption", Score = 9.2m, Director = "Frank Darabont", ReleaseDate = new DateTime(1995,2,17), TagLine = "Fear can hold you prisoner. Hope can set you free.", Genres = new List{"Crime","Drama"}, Rating = "R", }, + new Movie { Id = 2, ImdbId = "tt0068646", Title = "The Godfather", Score = 9.2m, Director = "Francis Ford Coppola", ReleaseDate = new DateTime(1972,3,24), TagLine = "An offer you can't refuse.", Genres = new List {"Crime","Drama", "Thriller"}, Rating = "R", }, + new Movie { Id = 3, ImdbId = "tt1375666", Title = "Inception", Score = 9.2m, Director = "Christopher Nolan", ReleaseDate = new DateTime(2010,7,16), TagLine = "Your mind is the scene of the crime", Genres = new List{"Action", "Mystery", "Sci-Fi", "Thriller"}, Rating = "PG-13", }, + new Movie { Id = 4, ImdbId = "tt0071562", Title = "The Godfather: Part II", Score = 9.0m, Director = "Francis Ford Coppola", ReleaseDate = new DateTime(1974,12,20), Genres = new List {"Crime","Drama", "Thriller"}, Rating = "R", }, + new Movie { Id = 5, ImdbId = "tt0060196", Title = "The Good, the Bad and the Ugly", Score = 9.0m, Director = "Sergio Leone", ReleaseDate = new DateTime(1967,12,29), TagLine = "They formed an alliance of hate to steal a fortune in dead man's gold", Genres = new List{"Adventure","Western"}, Rating = "R", }, + new Movie { Id = 6, ImdbId = "tt0114709", Title = "Toy Story", Score = 8.3m, Director = "John Lasseter", ReleaseDate = new DateTime(1995,11,22), TagLine = "A cowboy doll is profoundly threatened and jealous when a new spaceman figure supplants him as top toy in a boy's room.", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "G", }, + new Movie { Id = 7, ImdbId = "tt2294629", Title = "Frozen", Score = 7.8m, Director = "Chris Buck", ReleaseDate = new DateTime(2013,11,27), TagLine = "Fearless optimist Anna teams up with Kristoff in an epic journey, encountering Everest-like conditions, and a hilarious snowman named Olaf", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "PG", }, + new Movie { Id = 8, ImdbId = "tt1453405", Title = "Monsters University", Score = 7.4m, Director = "Dan Scanlon", ReleaseDate = new DateTime(2013,06,21), TagLine = "A look at the relationship between Mike and Sulley during their days at Monsters University -- when they weren't necessarily the best of friends.", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "G", }, + new Movie { Id = 9, ImdbId = "tt0468569", Title = "The Dark Knight", Score = 9.0m, Director = "Christopher Nolan", ReleaseDate = new DateTime(2008,07,18), TagLine = "When Batman, Gordon and Harvey Dent launch an assault on the mob, they let the clown out of the box, the Joker, bent on turning Gotham on itself and bringing any heroes down to his level.", Genres = new List{"Action","Crime","Drama"}, Rating = "PG-13", }, + new Movie { Id = 10, ImdbId = "tt0109830", Title = "Forrest Gump", Score = 8.8m, Director = "Robert Zemeckis", ReleaseDate = new DateTime(1996,07,06), TagLine = "Forrest Gump, while not intelligent, has accidentally been present at many historic moments, but his true love, Jenny Curran, eludes him.", Genres = new List{"Drama","Romance"}, Rating = "PG-13", }, + }; + + public static AllFields[] SeedAllFields = new[] { + new AllFields + { + Id = 1, + NullableId = 2, + Byte = 3, + DateTime = new DateTime(2001, 01, 01), + NullableDateTime = new DateTime(2002, 02, 02), + Decimal = 4, + Double = 5.5, + Float = 6.6f, + Guid = new Guid("3EE6865A-4149-4940-B7A2-F952E0FEFC5E"), + NullableGuid = new Guid("7A2FDDD8-4BB0-4735-8230-A6AC79088489"), + Long = 7, + Short = 8, + String = "string", + TimeSpan = TimeSpan.FromHours(1), + NullableTimeSpan = TimeSpan.FromDays(1), + UInt = 9, + ULong = 10, + UShort = 11, + } + }; + + public static PagingTest[] SeedPagingTest = 250.Times(i => new PagingTest { Id = i, Name = "Name" + i, Value = i % 2 }).ToArray(); + } + + [Route("/querydata/rockstars")] + public class QueryDataRockstars : QueryData + { + public int? Age { get; set; } + } + + [Route("/querydata/rockstaralbums")] + public class QueryDataRockstarAlbums : QueryData + { + public int? Id { get; set; } + public int? RockstarId { get; set; } + public string Name { get; set; } + public string Genre { get; set; } + public int[] IdBetween { get; set; } + } + + [Route("/querydata/pagingtest")] + public class QueryDataPagingTest : QueryData + { + public int? Id { get; set; } + public string Name { get; set; } + public int? Value { get; set; } + } + + public class QueryDataRockstarsConventions : QueryData + { + public DateTime? DateOfBirthGreaterThan { get; set; } + public DateTime? DateDiedLessThan { get; set; } + public int[] Ids { get; set; } + public int? AgeOlderThan { get; set; } + public int? AgeGreaterThanOrEqualTo { get; set; } + public int? AgeGreaterThan { get; set; } + public int? GreaterThanAge { get; set; } + public string FirstNameStartsWith { get; set; } + public string LastNameEndsWith { get; set; } + public string LastNameContains { get; set; } + public string RockstarAlbumNameContains { get; set; } + public int? RockstarIdAfter { get; set; } + public int? RockstarIdOnOrAfter { get; set; } + } + + public class QueryDataCustomRockstars : QueryData + { + public int? Age { get; set; } + } + + public class QueryDataOverridedRockstars : QueryData + { + public int? Age { get; set; } + } + + public class QueryDataOverridedCustomRockstars : QueryData + { + public int? Age { get; set; } + } + + public class QueryDataFieldRockstars : QueryData + { + public string FirstName { get; set; } //default to 'AND FirstName = {Value}' + + public string[] FirstNames { get; set; } //Collections default to 'FirstName IN ({Values}) + + [QueryDataField(Condition = ">=")] + public int? Age { get; set; } + + [QueryDataField(Condition = "Like", Field = "FirstName")] + public string FirstNameCaseInsensitive { get; set; } + + [QueryDataField(Condition = "StartsWith", Field = "FirstName")] + public string FirstNameStartsWith { get; set; } + + [QueryDataField(Condition = "EndsWith", Field = "LastName")] + public string LastNameEndsWith { get; set; } + + [QueryDataField(Condition = "Between", Field = "FirstName")] + public string[] FirstNameBetween { get; set; } + + [QueryDataField(Term = QueryTerm.Or, Condition = "=", Field = "LastName")] + public string OrLastName { get; set; } + } + + public class QueryDataFieldRockstarsDynamic : QueryData + { + public int? Age { get; set; } + } + + public class QueryDataRockstarsFilter : QueryData + { + public int? Age { get; set; } + } + + public class QueryDataCustomRockstarsFilter : QueryData + { + public int? Age { get; set; } + } + + public class QueryDataRockstarsIFilter : QueryData, IFilterRockstars + { + public int? Age { get; set; } + } + + [QueryData(QueryTerm.Or)] + [Route("/OrDataRockstars")] + public class QueryDataOrRockstars : QueryData + { + public int? Age { get; set; } + public string FirstName { get; set; } + } + + [Route("/OrDataRockstarsFields")] + public class QueryDataOrRockstarsFields : QueryData + { + [QueryDataField(Term = QueryTerm.Or)] + public string FirstName { get; set; } + + [QueryDataField(Term = QueryTerm.Or)] + public string LastName { get; set; } + } + + [QueryData(QueryTerm.Or)] + public class QueryDataGetRockstars : QueryData + { + public int[] Ids { get; set; } + public List Ages { get; set; } + public List FirstNames { get; set; } + public int[] IdsBetween { get; set; } + } + + [QueryData(QueryTerm.Or)] + public class QueryDataGetRockstarsDynamic : QueryData { } + + [DataContract] + [Route("/adhocdata-rockstars")] + public class QueryDataAdhocRockstars : QueryData + { + [DataMember(Name = "first_name")] + public string FirstName { get; set; } + } + + [DataContract] + [Route("/adhocdata")] + public class QueryDataAdhoc : QueryData { } + + [Route("/moviesdata/search")] + [QueryData(QueryTerm.And)] //Default + public class SearchDataMovies : QueryData { } + + [Route("/moviesdata")] + [QueryData(QueryTerm.Or)] + public class QueryDataMovies : QueryData + { + public int[] Ids { get; set; } + public string[] ImdbIds { get; set; } + public string[] Ratings { get; set; } + } + + public class StreamDataMovies : QueryData + { + public string[] Ratings { get; set; } + } + + public class QueryDataUnknownRockstars : QueryData + { + public int UnknownInt { get; set; } + public string UnknownProperty { get; set; } + + } + + public class QueryDataAllFields : QueryData + { + public virtual Guid Guid { get; set; } + } + + public class AutoQueryDataService : Service + { + public IAutoQueryData AutoQuery { get; set; } + + //Override with custom impl + public object Any(QueryDataOverridedRockstars dto) + { + var q = AutoQuery.CreateQuery(dto, Request); + q.Take(1); + return AutoQuery.Execute(dto, q, Request); + } + + public object Any(QueryDataOverridedCustomRockstars dto) + { + var q = AutoQuery.CreateQuery(dto, Request.GetRequestParams(), Request); + q.Take(1); + return AutoQuery.Execute(dto, q, Request); + } + } + + [TestFixture] + public abstract class AutoQueryDataTests + { + public readonly ServiceStackHost appHost; + protected readonly IServiceClient client; + + private static readonly int TotalRockstars = AutoQueryAppHost.SeedRockstars.Length; + private static readonly int TotalAlbums = AutoQueryAppHost.SeedAlbums.Length; + + public abstract ServiceStackHost CreateAppHost(); + + public AutoQueryDataTests() + { + appHost = CreateAppHost() + .Init() + .Start(Config.ListeningOn); + + client = new JsonServiceClient(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + public List Rockstars + { + get { return AutoQueryDataAppHost.SeedRockstars.ToList(); } + } + + public List PagingTests + { + get { return AutoQueryDataAppHost.SeedPagingTest.ToList(); } + } + + public bool IsDynamoDb + { + get + { + return appHost is AutoQueryDataDynamoAppHost; + } + } + + [Test] + public void Can_execute_basic_query() + { + var response = client.Get(new QueryDataRockstars { Include = "Total" }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + } + + [Test] + public void Can_execute_overridden_basic_query() + { + var response = client.Get(new QueryDataOverridedRockstars { Include = "Total" }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + } + + [Test] + public void Can_execute_AdhocRockstars_query() + { + var request = new QueryDataAdhocRockstars { FirstName = "Jimi", Include = "Total" }; + + Assert.That(request.ToGetUrl(), Is.EqualTo("/adhocdata-rockstars?first_name=Jimi&include=Total")); + + var response = client.Get(request); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo(request.FirstName)); + } + + [Test] + public void Can_execute_Adhoc_query_alias() + { + var response = Config.ListeningOn.CombineWith("adhocdata") + .AddQueryParam("first_name", "Jimi") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Jimi")); + } + + [Test] + public void Can_execute_Adhoc_query_convention() + { + var response = Config.ListeningOn.CombineWith("adhocdata") + .AddQueryParam("last_name", "Hendrix") + .GetJsonFromUrl() + .FromJson>(); + Assert.That(response.Results.Count, Is.EqualTo(7)); + + JsConfig.Init(new Text.Config { TextCase = TextCase.SnakeCase }); + response = Config.ListeningOn.CombineWith("adhocdata") + .AddQueryParam("last_name", "Hendrix") + .GetJsonFromUrl() + .FromJson>(); + JsConfig.Reset(); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Jimi")); + } + + [Test] + public void Can_execute_explicit_equality_condition_on_overridden_CustomRockstar() + { + var response = client.Get(new QueryDataOverridedCustomRockstars { Age = 27, Include = "Total" }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + } + + [Test] + public void Can_execute_basic_query_with_limits() + { + var response = client.Get(new QueryDataRockstars { Skip = 2, Include = "Total" }); + Assert.That(response.Offset, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 2)); + + response = client.Get(new QueryDataRockstars { Take = 2, Include = "Total" }); + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = client.Get(new QueryDataRockstars { Skip = 2, Take = 2, Include = "Total" }); + Assert.That(response.Offset, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public void Can_execute_explicit_equality_condition() + { + var response = client.Get(new QueryDataRockstars { Age = 27, Include = "Total" }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_execute_explicit_equality_condition_on_CustomRockstar() + { + var response = client.Get(new QueryDataCustomRockstars { Age = 27, Include = "Total" }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_execute_implicit_equality_condition() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryDataRockstars") + .AddQueryParam("FirstName", "Jim") + .AddQueryParam("LivingStatus", "Dead") + .AddQueryParam("Include", "Total") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].LastName, Is.EqualTo("Morrison")); + } + + [Test] + public void Can_execute_multiple_conditions_with_same_param_name() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryDataRockstars") + .AddQueryParam("FirstName", "Jim") + .AddQueryParam("FirstName", "Jim") + .AddQueryParam("Include", "Total") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].LastName, Is.EqualTo("Morrison")); + + response = Config.ListeningOn.CombineWith("json/reply/QueryDataRockstars") + .AddQueryParam("FirstNameStartsWith", "Jim") + .AddQueryParam("FirstNameStartsWith", "Jimi") + .AddQueryParam("Include", "Total") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].LastName, Is.EqualTo("Hendrix")); + } + + [Test] + public void Can_execute_implicit_IsNull_condition() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryDataRockstars?DateDied=&Include=Total") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Total, Is.EqualTo(2)); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public void Can_execute_custom_QueryFields() + { + QueryResponse response; + response = client.Get(new QueryDataFieldRockstars { FirstName = "Jim" }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + response = client.Get(new QueryDataFieldRockstars { FirstNames = new[] { "Jim", "Kurt" } }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = client.Get(new QueryDataFieldRockstars { FirstNameCaseInsensitive = "jim" }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + response = client.Get(new QueryDataFieldRockstars { FirstNameStartsWith = "Jim" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = client.Get(new QueryDataFieldRockstars { LastNameEndsWith = "son" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = client.Get(new QueryDataFieldRockstars { FirstNameBetween = new[] { "A", "F" } }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + try + { + response = client.Get(new QueryDataFieldRockstars + { + LastNameEndsWith = "son", + OrLastName = "Hendrix" + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + catch (Exception) + { + if (!IsDynamoDb) //DynamoDb doesn't support EndsWith + throw; + } + + response = client.Get(new QueryDataFieldRockstars + { + FirstNameStartsWith = "Jim", + OrLastName = "Presley" + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = client.Get(new QueryDataFieldRockstars { Age = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + } + + [Test] + public void Can_execute_combination_of_QueryFields() + { + QueryResponse response; + + response = client.Get(new QueryDataFieldRockstars + { + FirstNameStartsWith = "Jim", + LastNameEndsWith = "son", + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + response = client.Get(new QueryDataFieldRockstars + { + FirstNameStartsWith = "Jim", + OrLastName = "Cobain", + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Does_escape_values() + { + QueryResponse response; + + response = client.Get(new QueryDataFieldRockstars + { + FirstNameStartsWith = "Jim'\"", + }); + Assert.That(response.Results.Count, Is.EqualTo(0)); + } + + [Test] + public void Does_allow_adding_attributes_dynamically() + { + typeof(QueryDataFieldRockstarsDynamic) + .GetProperty("Age") + .AddAttributes(new QueryDataFieldAttribute { Condition = ">=" }); + + var response = client.Get(new QueryDataFieldRockstarsDynamic { Age = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + } + + [Test] + public void Does_execute_typed_QueryFilters() + { + // QueryFilter appends additional: x => x.LastName.EndsWith("son") + var response = client.Get(new QueryDataRockstarsFilter { Age = 27 }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + + var custom = client.Get(new QueryDataCustomRockstarsFilter { Age = 27 }); + Assert.That(custom.Results.Count, Is.EqualTo(1)); + + response = client.Get(new QueryDataRockstarsIFilter { Age = 27 }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + } + + [Test] + public void Can_execute_OR_QueryFilters() + { + var response = client.Get(new QueryDataOrRockstars { Age = 42, FirstName = "Jim" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = Config.ListeningOn.CombineWith("OrDataRockstars") + .AddQueryParam("Age", "27") + .AddQueryParam("FirstName", "Kurt") + .AddQueryParam("LastName", "Hendrix") + .GetJsonFromUrl() + .FromJson>(); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_execute_OR_QueryFilters_Fields() + { + var response = client.Get(new QueryDataOrRockstarsFields + { + FirstName = "Jim", + LastName = "Vedder", + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = Config.ListeningOn.CombineWith("OrDataRockstarsFields") + .AddQueryParam("FirstName", "Kurt") + .AddQueryParam("LastName", "Hendrix") + .GetJsonFromUrl() + .FromJson>(); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public void Can_execute_implicit_conventions() + { + var baseUrl = Config.ListeningOn.CombineWith("json/reply/QueryDataRockstars"); + + var response = baseUrl.AddQueryParam("AgeOlderThan", 42).AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = baseUrl.AddQueryParam("AgeGreaterThanOrEqualTo", 42).AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(4)); + + response = baseUrl.AddQueryParam("AgeGreaterThan", 42).AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = baseUrl.AddQueryParam("GreaterThanAge", 42).AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = baseUrl.AddQueryParam("AgeNotEqualTo", 27).AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(4)); + + response = baseUrl.AddQueryParam(">Age", 42).AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(4)); + response = baseUrl.AddQueryParam("Age>", 42).AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = baseUrl.AddQueryParam("(); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = baseUrl.AddQueryParam("Age<", 42).AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(4)); + response = baseUrl.AddQueryParam("Age!", "27").AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(4)); + + response = baseUrl.AddQueryParam("FirstNameStartsWith", "Jim").AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(2)); + response = baseUrl.AddQueryParam("LastNameEndsWith", "son").AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(2)); + response = baseUrl.AddQueryParam("LastNameContains", "e").AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_execute_Explicit_conventions() + { + QueryResponse response; + response = client.Get(new QueryDataRockstarsConventions { Ids = new[] { 1, 2, 3 } }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = client.Get(new QueryDataRockstarsConventions { AgeOlderThan = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = client.Get(new QueryDataRockstarsConventions { AgeGreaterThanOrEqualTo = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + + response = client.Get(new QueryDataRockstarsConventions { AgeGreaterThan = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = client.Get(new QueryDataRockstarsConventions { GreaterThanAge = 42 }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = client.Get(new QueryDataRockstarsConventions { FirstNameStartsWith = "Jim" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + response = client.Get(new QueryDataRockstarsConventions { LastNameEndsWith = "son" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + response = client.Get(new QueryDataRockstarsConventions { LastNameContains = "e" }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = client.Get(new QueryDataRockstarsConventions { DateOfBirthGreaterThan = new DateTime(1960, 01, 01) }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = client.Get(new QueryDataRockstarsConventions { DateDiedLessThan = new DateTime(1980, 01, 01) }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_execute_In_OR_Queries() + { + QueryResponse response; + response = client.Get(new QueryDataGetRockstars()); + Assert.That(response.Results.Count, Is.EqualTo(0)); + + response = client.Get(new QueryDataGetRockstars { Ids = new[] { 1, 2, 3 } }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = client.Get(new QueryDataGetRockstars { Ages = new[] { 42, 44 }.ToList() }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = client.Get(new QueryDataGetRockstars { FirstNames = new[] { "Jim", "Kurt" }.ToList() }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = client.Get(new QueryDataGetRockstars { IdsBetween = new[] { 1, 3 } }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_execute_In_OR_Queries_with_implicit_conventions() + { + var baseUrl = Config.ListeningOn.CombineWith("json/reply/QueryDataGetRockstarsDynamic"); + + QueryResponse response; + response = baseUrl.AddQueryParam("Ids", "1,2,3").AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = baseUrl.AddQueryParam("Ages", "42, 44").AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = baseUrl.AddQueryParam("FirstNames", "Jim,Kurt").AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = baseUrl.AddQueryParam("IdsBetween", "1,3").AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_query_Movie_Ratings() + { + var response = client.Get(new QueryDataMovies { Ratings = new[] { "G", "PG-13" } }); + Assert.That(response.Results.Count, Is.EqualTo(5)); + + var url = Config.ListeningOn + "moviesdata?ratings=G,PG-13"; + response = url.AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(5)); + + response = client.Get(new QueryDataMovies + { + Ids = new[] { 1, 2 }, + ImdbIds = new[] { "tt0071562", "tt0060196" }, + Ratings = new[] { "G", "PG-13" } + }); + Assert.That(response.Results.Count, Is.EqualTo(9)); + + url = Config.ListeningOn + "moviesdata?ratings=G,PG-13&ids=1,2&imdbIds=tt0071562,tt0060196"; + response = url.AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(9)); + } + + [Test] + public void Can_StreamMovies() + { + var results = client.GetLazy(new StreamDataMovies()).ToList(); + Assert.That(results.Count, Is.EqualTo(10)); + + results = client.GetLazy(new StreamDataMovies { Ratings = new[] { "G", "PG-13" } }).ToList(); + Assert.That(results.Count, Is.EqualTo(5)); + } + + [Test] + public void Does_implicitly_OrderBy_PrimaryKey_when_limits_is_specified() + { + var movies = client.Get(new SearchDataMovies { Take = 100 }); + var ids = movies.Results.Map(x => x.Id); + var orderedIds = ids.OrderBy(x => x); + Assert.That(ids, Is.EqualTo(orderedIds)); + + var rockstars = client.Get(new SearchDataMovies { Take = 100 }); + ids = rockstars.Results.Map(x => x.Id); + orderedIds = ids.OrderBy(x => x); + Assert.That(ids, Is.EqualTo(orderedIds)); + } + + [Test] + public void Can_OrderBy_queries() + { + var movies = client.Get(new SearchDataMovies { Take = 100, OrderBy = "ImdbId" }); + var ids = movies.Results.Map(x => x.ImdbId); + var orderedIds = ids.OrderBy(x => x).ToList(); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovies { Take = 100, OrderBy = "Rating,ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating).ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovies { Take = 100, OrderByDesc = "ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = ids.OrderByDescending(x => x).ToList(); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovies { Take = 100, OrderByDesc = "Rating,ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovies { Take = 100, OrderBy = "Rating,-ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + movies = client.Get(new SearchDataMovies { Take = 100, OrderByDesc = "Rating,-ImdbId" }); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + var url = Config.ListeningOn + "moviesdata/search?take=100&orderBy=Rating,ImdbId"; + movies = url.AsJsonInto(); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderBy(x => x.Rating).ThenBy(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + + url = Config.ListeningOn + "moviesdata/search?take=100&orderByDesc=Rating,ImdbId"; + movies = url.AsJsonInto(); + ids = movies.Results.Map(x => x.ImdbId); + orderedIds = movies.Results.OrderByDescending(x => x.Rating) + .ThenByDescending(x => x.ImdbId).Map(x => x.ImdbId); + Assert.That(ids, Is.EqualTo(orderedIds)); + } + + [Test] + public void Can_consume_as_CSV() + { + var url = Config.ListeningOn + "moviesdata/search.csv?ratings=G,PG-13"; + var csv = url.GetStringFromUrl(); + var headers = csv.SplitOnFirst('\n')[0].Trim(); + Assert.That(headers, Is.EqualTo("Id,ImdbId,Title,Rating,Score,Director,ReleaseDate,TagLine,Genres")); + csv.Print(); + + url = Config.ListeningOn + "querydata/rockstars.csv?Age=27"; + csv = url.GetStringFromUrl(); + headers = csv.SplitOnFirst('\n')[0].Trim(); + Assert.That(headers, Is.EqualTo("Id,FirstName,LastName,Age,DateOfBirth,DateDied,LivingStatus")); + csv.Print(); + } + + [Test] + public void Does_not_query_Ignored_properties() + { + var response = client.Get(new QueryDataUnknownRockstars + { + UnknownProperty = "Foo", + UnknownInt = 1, + Include = "Total" + }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(TotalRockstars)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + } + + [Test] + public void Can_Query_AllFields_Guid() + { + var guid = new Guid("3EE6865A-4149-4940-B7A2-F952E0FEFC5E"); + var response = client.Get(new QueryDataAllFields + { + Guid = guid + }); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + + Assert.That(response.Results[0].Guid, Is.EqualTo(guid)); + } + + [Test] + public void Does_populate_Total() + { + var response = client.Get(new QueryDataRockstars { Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta, Is.Null); + + response = client.Get(new QueryDataRockstars { Include = "COUNT" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryDataRockstars { Include = "COUNT(*)" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryDataRockstars { Include = "COUNT(DISTINCT LivingStatus), Total" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryDataRockstars { Include = "Count(*), Min(Age), Max(Age), Sum(Id)" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryDataRockstars { Age = 27, Include = "Count(*), Min(Age), Max(Age), Sum(Id)" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count(x => x.Age == 27))); + } + + [Test] + public void Can_Include_Aggregates_in_AutoQuery() + { + QueryResponse response; + response = client.Get(new QueryDataRockstars { Include = "COUNT" }); + Assert.That(response.Meta["COUNT(*)"], Is.EqualTo(Rockstars.Count.ToString())); + + response = client.Get(new QueryDataRockstars { Include = "COUNT(*)" }); + Assert.That(response.Meta["COUNT(*)"], Is.EqualTo(Rockstars.Count.ToString())); + + response = client.Get(new QueryDataRockstars { Include = "COUNT(DISTINCT LivingStatus)" }); + Assert.That(response.Meta["COUNT(DISTINCT LivingStatus)"], Is.EqualTo("2")); + + response = client.Get(new QueryDataRockstars { Include = "MIN(Age)" }); + Assert.That(response.Meta["MIN(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + + response = client.Get(new QueryDataRockstars { Include = "Count(*), Min(Age), Max(Age), Sum(Id), Avg(Age), First(Id), Last(Id)", OrderBy = "Id" }); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(Rockstars.Count.ToString())); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Max(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["Sum(Id)"], Is.EqualTo(Rockstars.Map(x => x.Id).Sum().ToString())); + Assert.That(response.Meta["Avg(Age)"], Is.EqualTo(Rockstars.Average(x => x.Age).ToString())); + Assert.That(response.Meta["First(Id)"], Is.EqualTo(Rockstars.First().Id.ToString())); + Assert.That(response.Meta["Last(Id)"], Is.EqualTo(Rockstars.Last().Id.ToString())); + + response = client.Get(new QueryDataRockstars { Age = 27, Include = "Count(*), Min(Age), Max(Age), Sum(Id), Avg(Age), First(Id), Last(Id)", OrderBy = "Id" }); + var rockstars27 = Rockstars.Where(x => x.Age == 27).ToList(); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(rockstars27.Count.ToString())); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(rockstars27.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Max(Age)"], Is.EqualTo(rockstars27.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["Sum(Id)"], Is.EqualTo(rockstars27.Map(x => x.Id).Sum().ToString())); + Assert.That(response.Meta["Avg(Age)"], Is.EqualTo(rockstars27.Average(x => x.Age).ToString())); + Assert.That(response.Meta["First(Id)"], Is.EqualTo(rockstars27.First().Id.ToString())); + Assert.That(response.Meta["Last(Id)"], Is.EqualTo(rockstars27.Last().Id.ToString())); + } + + [Test] + public void Does_ignore_unknown_aggregate_commands() + { + var response = client.Get(new QueryDataRockstars { Include = "FOO(1), Total" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta, Is.Null); + + response = client.Get(new QueryDataRockstars { Include = "FOO(1), Min(Age), Bar('a') alias, Count(*), Baz(1,'foo')" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(Rockstars.Count.ToString())); + } + + [Test] + public void Can_Include_Aggregates_in_AutoQuery_with_Aliases() + { + var response = client.Get(new QueryDataRockstars { Include = "COUNT(*) Count" }); + Assert.That(response.Meta["Count"], Is.EqualTo(Rockstars.Count.ToString())); + + response = client.Get(new QueryDataRockstars { Include = "COUNT(DISTINCT LivingStatus) as UniqueStatus" }); + Assert.That(response.Meta["UniqueStatus"], Is.EqualTo("2")); + + response = client.Get(new QueryDataRockstars { Include = "MIN(Age) MinAge" }); + Assert.That(response.Meta["MinAge"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + + response = client.Get(new QueryDataRockstars { Include = "Count(*) count, Min(Age) min, Max(Age) max, Sum(Id) sum" }); + Assert.That(response.Meta["count"], Is.EqualTo(Rockstars.Count.ToString())); + Assert.That(response.Meta["min"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["max"], Is.EqualTo(Rockstars.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["sum"], Is.EqualTo(Rockstars.Map(x => x.Id).Sum().ToString())); + } + + [Test] + public void Can_execute_custom_aggregate_functions() + { + var response = client.Get(new QueryDataRockstars + { + Include = "ADD(6,2), Multiply(6,2) SixTimesTwo, Subtract(6,2), divide(6,2) TheDivide" + }); + Assert.That(response.Meta["ADD(6,2)"], Is.EqualTo("8")); + Assert.That(response.Meta["SixTimesTwo"], Is.EqualTo("12")); + Assert.That(response.Meta["Subtract(6,2)"], Is.EqualTo("4")); + Assert.That(response.Meta["TheDivide"], Is.EqualTo("3")); + } + + [Test] + public void Can_select_partial_list_of_fields() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryDataRockstars") + .AddQueryParam("Age", "27") + .AddQueryParam("Fields", "Id,FirstName,Age") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Results.All(x => x.Id > 0)); + Assert.That(response.Results.All(x => x.FirstName != null)); + Assert.That(response.Results.All(x => x.LastName == null)); + Assert.That(response.Results.Any(x => x.Age > 0)); + Assert.That(response.Results.All(x => x.DateDied == null)); + Assert.That(response.Results.All(x => x.DateOfBirth == default(DateTime).ToLocalTime())); + } + + [Test] + public void Can_select_partial_list_of_fields_case_insensitive() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryDataRockstars") + .AddQueryParam("Age", "27") + .AddQueryParam("Fields", "id,firstname,age") + .GetJsonFromUrl() + .FromJson>(); + + response.PrintDump(); + + Assert.That(response.Results.All(x => x.Id > 0)); + Assert.That(response.Results.All(x => x.FirstName != null)); + Assert.That(response.Results.All(x => x.LastName == null)); + Assert.That(response.Results.Any(x => x.Age > 0)); + Assert.That(response.Results.All(x => x.DateDied == null)); + Assert.That(response.Results.All(x => x.DateOfBirth == default(DateTime).ToLocalTime())); + } + + [Test] + public void Does_return_MaxLimit_results() + { + QueryResponse response; + response = client.Get(new QueryDataPagingTest { Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(100)); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count)); + + response = client.Get(new QueryDataPagingTest { Skip = 200, Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(PagingTests.Skip(200).Count())); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count)); + + response = client.Get(new QueryDataPagingTest { Value = 1, Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(100)); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count(x => x.Value == 1))); + } + + [Test] + public void Can_query_on_ForeignKey_and_Index() + { + QueryResponse response; + response = client.Get(new QueryDataRockstarAlbums { RockstarId = 3, Include = "Total" }); //Hash + Assert.That(response.Results.Count, Is.EqualTo(5)); + Assert.That(response.Total, Is.EqualTo(5)); + + response = client.Get(new QueryDataRockstarAlbums { RockstarId = 3, Id = 3, Include = "Total" }); //Hash + Range + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Name, Is.EqualTo("Nevermind")); + + //Hash + Range BETWEEN + response = client.Get(new QueryDataRockstarAlbums + { + RockstarId = 3, + IdBetween = new[] { 2, 3 }, + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(2)); + + //Hash + Range BETWEEN + Filter + response = client.Get(new QueryDataRockstarAlbums + { + RockstarId = 3, + IdBetween = new[] { 2, 3 }, + Name = "Nevermind", + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Id, Is.EqualTo(3)); + + //Hash + LocalSecondaryIndex + response = client.Get(new QueryDataRockstarAlbums { RockstarId = 3, Genre = "Grunge", Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + Assert.That(response.Total, Is.EqualTo(4)); + + response.PrintDump(); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryTests.cs index f0df8177aa6..2e2a1689a7d 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryTests.cs @@ -2,13 +2,20 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Net; +using System.Runtime.Serialization; using System.Threading; +using System.Threading.Tasks; using Funq; using NUnit.Framework; using ServiceStack.Data; using ServiceStack.DataAnnotations; +using ServiceStack.Extensions; +using ServiceStack.Host; using ServiceStack.OrmLite; +using ServiceStack.Testing; using ServiceStack.Text; +using TestsConfig = ServiceStack.WebHost.Endpoints.Tests.Config; namespace ServiceStack.WebHost.Endpoints.Tests { @@ -17,15 +24,62 @@ public class AutoQueryAppHost : AppSelfHostBase public AutoQueryAppHost() : base("AutoQuery", typeof(AutoQueryService).Assembly) { } + public static readonly string SqlServerConnString = TestsConfig.SqlServerConnString; + public const string SqlServerNamedConnection = "SqlServer"; + public const string SqlServerProvider = "SqlServer2012"; + + public static string SqliteFileConnString = "~/App_Data/autoquery.sqlite".MapProjectPath(); + + public Action ConfigureFn { get; set; } + public override void Configure(Container container) { - container.Register( - new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); + container.Register(dbFactory); + + dbFactory.RegisterConnection(SqlServerNamedConnection, SqlServerConnString, SqlServer2012Dialect.Provider); + dbFactory.RegisterDialectProvider(SqlServerProvider, SqlServer2012Dialect.Provider); + + using (var db = dbFactory.OpenDbConnection(SqlServerNamedConnection)) + { + db.DropTable(); + db.DropAndCreateTable(); + + db.Insert(new NamedRockstar { + Id = 1, + FirstName = "Microsoft", + LastName = "SQL Server", + Age = 27, + DateOfBirth = new DateTime(1989,1,1), + LivingStatus = LivingStatus.Alive, + }); + } + + using (var db = dbFactory.OpenDbConnectionString(SqliteFileConnString)) + { + db.DropTable(); + db.DropAndCreateTable(); + db.Insert(new Rockstar { + Id = 1, + FirstName = "Sqlite", + LastName = "File DB", + Age = 16, + DateOfBirth = new DateTime(2000, 8, 1), + LivingStatus = LivingStatus.Alive, + }); + } + + RegisterTypedRequestFilter((req, res, dto) => + req.Items[Keywords.DbInfo] = dto.ConvertTo()); //container.Register( - // new OrmLiteConnectionFactory("Server={0};Database=test;User Id=test;Password=test;".Fmt(Environment.GetEnvironmentVariable("CI_HOST")), + // new OrmLiteConnectionFactory("Server=localhost;Database=test;User Id=test;Password=test;", // SqlServerDialect.Provider)); + //container.Register( + // new OrmLiteConnectionFactory("Server=localhost;Database=test;User Id=test;Password=test;", + // SqlServer2012Dialect.Provider)); + //container.Register( // new OrmLiteConnectionFactory("Server=localhost;Database=test;UID=root;Password=test", // MySqlDialect.Provider)); @@ -36,71 +90,185 @@ public override void Configure(Container container) using (var db = container.Resolve().Open()) { - db.DropAndCreateTable(); - db.DropAndCreateTable(); + db.DropTable(); + db.DropTable(); + db.CreateTable(); + db.CreateTable(); + + db.DropAndCreateTable(); db.DropAndCreateTable(); + db.DropAndCreateTable(); + db.InsertAll(SeedRockstars); db.InsertAll(SeedAlbums); + db.InsertAll(SeedGenres); db.InsertAll(SeedMovies); + db.InsertAll(SeedPagingTest); + + db.DropAndCreateTable(); + db.Insert(new AllFields + { + Id = 1, + NullableId = 2, + Byte = 3, + DateTime = new DateTime(2001, 01, 01), + NullableDateTime = new DateTime(2002, 02, 02), + Decimal = 4, + Double = 5.5, + Float = 6.6f, + Guid = new Guid("3EE6865A-4149-4940-B7A2-F952E0FEFC5E"), + NullableGuid = new Guid("7A2FDDD8-4BB0-4735-8230-A6AC79088489"), + Long = 7, + Short = 8, + String = "string", + TimeSpan = TimeSpan.FromHours(1), + NullableTimeSpan = TimeSpan.FromDays(1), + UInt = 9, + ULong = 10, + UShort = 11, + Enum = HttpStatusCode.MethodNotAllowed, + NullableEnum = HttpStatusCode.MethodNotAllowed, + }); + + db.DropAndCreateTable(); + db.InsertAll(SeedRockstars.Map(x => new Adhoc + { + Id = x.Id, + FirstName = x.FirstName, + LastName = x.LastName + })); + + db.CreateTable(); + + db.Insert(new TypeWithEnum { Id = 1, Name = "Value1", SomeEnum = SomeEnum.Value1, NSomeEnum = SomeEnum.Value1, SomeEnumAsInt = SomeEnumAsInt.Value1, NSomeEnumAsInt = SomeEnumAsInt.Value1 }); + db.Insert(new TypeWithEnum { Id = 2, Name = "Value2", SomeEnum = SomeEnum.Value2, NSomeEnum = SomeEnum.Value2, SomeEnumAsInt = SomeEnumAsInt.Value2, NSomeEnumAsInt = SomeEnumAsInt.Value2 }); + db.Insert(new TypeWithEnum { Id = 3, Name = "Value3", SomeEnum = SomeEnum.Value3, NSomeEnum = SomeEnum.Value3, SomeEnumAsInt = SomeEnumAsInt.Value3, NSomeEnumAsInt = SomeEnumAsInt.Value3 }); } var autoQuery = new AutoQueryFeature { MaxLimit = 100, + // EnableAsync = false, EnableRawSqlFilters = true, + ResponseFilters = { + ctx => { + var executedCmds = new List(); + var supportedFns = new Dictionary>(StringComparer.OrdinalIgnoreCase) + { + {"ADD", (a,b) => a + b }, + {"MULTIPLY", (a,b) => a * b }, + {"DIVIDE", (a,b) => a / b }, + {"SUBTRACT", (a,b) => a - b }, + }; + foreach (var cmd in ctx.Commands) + { + if (!supportedFns.TryGetValue(cmd.Name, out var fn)) continue; + var label = !cmd.Suffix.IsNullOrWhiteSpace() ? cmd.Suffix.ToString().Trim() : cmd.ToString(); + ctx.Response.Meta[label] = fn(cmd.Args[0].ParseInt32(), cmd.Args[1].ParseInt32()).ToString(); + executedCmds.Add(cmd); + } + ctx.Commands.RemoveAll(executedCmds.Contains); + } + } } - .RegisterQueryFilter((req, q, dto) => + .RegisterQueryFilter((q, dto, req) => q.And(x => x.LastName.EndsWith("son")) ) - .RegisterQueryFilter((req, q, dto) => + .RegisterQueryFilter((q, dto, req) => q.And(x => x.LastName.EndsWith("son")) ) - .RegisterQueryFilter((req, q, dto) => + .RegisterQueryFilter((q, dto, req) => q.And(x => x.LastName.EndsWith("son")) ); Plugins.Add(autoQuery); + + ConfigureFn?.Invoke(this,container); } public static Rockstar[] SeedRockstars = new[] { - new Rockstar { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 }, - new Rockstar { Id = 2, FirstName = "Jim", LastName = "Morrison", Age = 27 }, - new Rockstar { Id = 3, FirstName = "Kurt", LastName = "Cobain", Age = 27 }, - new Rockstar { Id = 4, FirstName = "Elvis", LastName = "Presley", Age = 42 }, - new Rockstar { Id = 5, FirstName = "David", LastName = "Grohl", Age = 44 }, - new Rockstar { Id = 6, FirstName = "Eddie", LastName = "Vedder", Age = 48 }, - new Rockstar { Id = 7, FirstName = "Michael", LastName = "Jackson", Age = 50 }, + new Rockstar { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1942, 11, 27), DateDied = new DateTime(1970, 09, 18), }, + new Rockstar { Id = 2, FirstName = "Jim", LastName = "Morrison", Age = 27, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1943, 12, 08), DateDied = new DateTime(1971, 07, 03), }, + new Rockstar { Id = 3, FirstName = "Kurt", LastName = "Cobain", Age = 27, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1967, 02, 20), DateDied = new DateTime(1994, 04, 05), }, + new Rockstar { Id = 4, FirstName = "Elvis", LastName = "Presley", Age = 42, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1935, 01, 08), DateDied = new DateTime(1977, 08, 16), }, + new Rockstar { Id = 5, FirstName = "David", LastName = "Grohl", Age = 44, LivingStatus = LivingStatus.Alive, DateOfBirth = new DateTime(1969, 01, 14), }, + new Rockstar { Id = 6, FirstName = "Eddie", LastName = "Vedder", Age = 48, LivingStatus = LivingStatus.Alive, DateOfBirth = new DateTime(1964, 12, 23), }, + new Rockstar { Id = 7, FirstName = "Michael", LastName = "Jackson", Age = 50, LivingStatus = LivingStatus.Dead, DateOfBirth = new DateTime(1958, 08, 29), DateDied = new DateTime(2009, 06, 05), }, }; public static RockstarAlbum[] SeedAlbums = new[] { - new RockstarAlbum { RockstarId = 1, Name = "Electric Ladyland" }, - new RockstarAlbum { RockstarId = 3, Name = "Nevermind" }, - new RockstarAlbum { RockstarId = 5, Name = "Foo Fighters" }, - new RockstarAlbum { RockstarId = 6, Name = "Into the Wild" }, + new RockstarAlbum { Id = 1, RockstarId = 1, Name = "Electric Ladyland", Genre = "Funk" }, + new RockstarAlbum { Id = 2, RockstarId = 3, Name = "Bleach", Genre = "Grunge" }, + new RockstarAlbum { Id = 3, RockstarId = 3, Name = "Nevermind", Genre = "Grunge" }, + new RockstarAlbum { Id = 4, RockstarId = 3, Name = "In Utero", Genre = "Grunge" }, + new RockstarAlbum { Id = 5, RockstarId = 3, Name = "Incesticide", Genre = "Grunge" }, + new RockstarAlbum { Id = 6, RockstarId = 3, Name = "MTV Unplugged in New York", Genre = "Acoustic" }, + new RockstarAlbum { Id = 7, RockstarId = 5, Name = "Foo Fighters", Genre = "Grunge" }, + new RockstarAlbum { Id = 8, RockstarId = 6, Name = "Into the Wild", Genre = "Folk" }, + }; + + public static RockstarGenre[] SeedGenres = new[] { + new RockstarGenre { RockstarId = 1, Name = "Rock" }, + new RockstarGenre { RockstarId = 3, Name = "Grunge" }, + new RockstarGenre { RockstarId = 5, Name = "Alternative Rock" }, + new RockstarGenre { RockstarId = 6, Name = "Folk Rock" }, }; public static Movie[] SeedMovies = new[] { - new Movie { ImdbId = "tt0111161", Title = "The Shawshank Redemption", Score = 9.2m, Director = "Frank Darabont", ReleaseDate = new DateTime(1995,2,17), TagLine = "Fear can hold you prisoner. Hope can set you free.", Genres = new List{"Crime","Drama"}, Rating = "R", }, - new Movie { ImdbId = "tt0068646", Title = "The Godfather", Score = 9.2m, Director = "Francis Ford Coppola", ReleaseDate = new DateTime(1972,3,24), TagLine = "An offer you can't refuse.", Genres = new List {"Crime","Drama", "Thriller"}, Rating = "R", }, - new Movie { ImdbId = "tt1375666", Title = "Inception", Score = 9.2m, Director = "Christopher Nolan", ReleaseDate = new DateTime(2010,7,16), TagLine = "Your mind is the scene of the crime", Genres = new List{"Action", "Mystery", "Sci-Fi", "Thriller"}, Rating = "PG-13", }, - new Movie { ImdbId = "tt0071562", Title = "The Godfather: Part II", Score = 9.0m, Director = "Francis Ford Coppola", ReleaseDate = new DateTime(1974,12,20), Genres = new List {"Crime","Drama", "Thriller"}, Rating = "R", }, - new Movie { ImdbId = "tt0060196", Title = "The Good, the Bad and the Ugly", Score = 9.0m, Director = "Sergio Leone", ReleaseDate = new DateTime(1967,12,29), TagLine = "They formed an alliance of hate to steal a fortune in dead man's gold", Genres = new List{"Adventure","Western"}, Rating = "R", }, - new Movie { ImdbId = "tt0114709", Title = "Toy Story", Score = 8.3m, Director = "John Lasseter", ReleaseDate = new DateTime(1995,11,22), TagLine = "A cowboy doll is profoundly threatened and jealous when a new spaceman figure supplants him as top toy in a boy's room.", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "G", }, - new Movie { ImdbId = "tt2294629", Title = "Frozen", Score = 7.8m, Director = "Chris Buck", ReleaseDate = new DateTime(2013,11,27), TagLine = "Fearless optimist Anna teams up with Kristoff in an epic journey, encountering Everest-like conditions, and a hilarious snowman named Olaf", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "PG", }, - new Movie { ImdbId = "tt1453405", Title = "Monsters University", Score = 7.4m, Director = "Dan Scanlon", ReleaseDate = new DateTime(2013,06,21), TagLine = "A look at the relationship between Mike and Sulley during their days at Monsters University -- when they weren't necessarily the best of friends.", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "G", }, - new Movie { ImdbId = "tt0468569", Title = "The Dark Knight", Score = 9.0m, Director = "Christopher Nolan", ReleaseDate = new DateTime(2008,07,18), TagLine = "When Batman, Gordon and Harvey Dent launch an assault on the mob, they let the clown out of the box, the Joker, bent on turning Gotham on itself and bringing any heroes down to his level.", Genres = new List{"Action","Crime","Drama"}, Rating = "PG-13", }, - new Movie { ImdbId = "tt0109830", Title = "Forrest Gump", Score = 8.8m, Director = "Robert Zemeckis", ReleaseDate = new DateTime(1996,07,06), TagLine = "Forrest Gump, while not intelligent, has accidentally been present at many historic moments, but his true love, Jenny Curran, eludes him.", Genres = new List{"Drama","Romance"}, Rating = "PG-13", }, + new Movie { ImdbId = "tt0111161", Title = "The Shawshank Redemption", Score = 9.2m, Director = "Frank Darabont", ReleaseDate = new DateTime(1995,2,17), TagLine = "Fear can hold you prisoner. Hope can set you free.", Genres = new List{"Crime","Drama"}, Rating = "R", }, + new Movie { ImdbId = "tt0068646", Title = "The Godfather", Score = 9.2m, Director = "Francis Ford Coppola", ReleaseDate = new DateTime(1972,3,24), TagLine = "An offer you can't refuse.", Genres = new List {"Crime","Drama", "Thriller"}, Rating = "R", }, + new Movie { ImdbId = "tt1375666", Title = "Inception", Score = 9.2m, Director = "Christopher Nolan", ReleaseDate = new DateTime(2010,7,16), TagLine = "Your mind is the scene of the crime", Genres = new List{"Action", "Mystery", "Sci-Fi", "Thriller"}, Rating = "PG-13", }, + new Movie { ImdbId = "tt0071562", Title = "The Godfather: Part II", Score = 9.0m, Director = "Francis Ford Coppola", ReleaseDate = new DateTime(1974,12,20), Genres = new List {"Crime","Drama", "Thriller"}, Rating = "R", }, + new Movie { ImdbId = "tt0060196", Title = "The Good, the Bad and the Ugly", Score = 9.0m, Director = "Sergio Leone", ReleaseDate = new DateTime(1967,12,29), TagLine = "They formed an alliance of hate to steal a fortune in dead man's gold", Genres = new List{"Adventure","Western"}, Rating = "R", }, + new Movie { ImdbId = "tt0114709", Title = "Toy Story", Score = 8.3m, Director = "John Lasseter", ReleaseDate = new DateTime(1995,11,22), TagLine = "A cowboy doll is profoundly threatened and jealous when a new spaceman figure supplants him as top toy in a boy's room.", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "G", }, + new Movie { ImdbId = "tt2294629", Title = "Frozen", Score = 7.8m, Director = "Chris Buck", ReleaseDate = new DateTime(2013,11,27), TagLine = "Fearless optimist Anna teams up with Kristoff in an epic journey, encountering Everest-like conditions, and a hilarious snowman named Olaf", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "PG", }, + new Movie { ImdbId = "tt1453405", Title = "Monsters University", Score = 7.4m, Director = "Dan Scanlon", ReleaseDate = new DateTime(2013,06,21), TagLine = "A look at the relationship between Mike and Sulley during their days at Monsters University -- when they weren't necessarily the best of friends.", Genres = new List{"Animation","Adventure","Comedy"}, Rating = "G", }, + new Movie { ImdbId = "tt0468569", Title = "The Dark Knight", Score = 9.0m, Director = "Christopher Nolan", ReleaseDate = new DateTime(2008,07,18), TagLine = "When Batman, Gordon and Harvey Dent launch an assault on the mob, they let the clown out of the box, the Joker, bent on turning Gotham on itself and bringing any heroes down to his level.", Genres = new List{"Action","Crime","Drama"}, Rating = "PG-13", }, + new Movie { ImdbId = "tt0109830", Title = "Forrest Gump", Score = 8.8m, Director = "Robert Zemeckis", ReleaseDate = new DateTime(1996,07,06), TagLine = "Forrest Gump, while not intelligent, has accidentally been present at many historic moments, but his true love, Jenny Curran, eludes him.", Genres = new List{"Drama","Romance"}, Rating = "PG-13", }, }; + + public static PagingTest[] SeedPagingTest = 250.Times(i => new PagingTest { Id = i, Name = "Name" + i, Value = i % 2 }).ToArray(); } - + + [Alias("Rockstar")] + [NamedConnection("SqlServer")] + public class NamedRockstar : Rockstar { } + + [Route("/query/namedrockstars")] + public class QueryNamedRockstars : QueryDb + { + public int? Age { get; set; } + } + [Route("/query/rockstars")] - public class QueryRockstars : QueryBase + public class QueryRockstars : QueryDb { public int? Age { get; set; } + //public LivingStatus? LivingStatus { get; set; } + } + + [Route("/query/rockstaralbums")] + public class QueryRockstarAlbums : QueryDb + { + public int? Id { get; set; } + public int? RockstarId { get; set; } + public string Name { get; set; } + public string Genre { get; set; } + public int[] IdBetween { get; set; } + } + + [Route("/query/pagingtest")] + public class QueryPagingTest : QueryDb + { + public int? Id { get; set; } + public string Name { get; set; } + public int? Value { get; set; } } - public class QueryRockstarsConventions : QueryBase + public class QueryRockstarsConventions : QueryDb { + public DateTime? DateOfBirthGreaterThan { get; set; } + public DateTime? DateDiedLessThan { get; set; } public int[] Ids { get; set; } public int? AgeOlderThan { get; set; } public int? AgeGreaterThanOrEqualTo { get; set; } @@ -114,95 +282,168 @@ public class QueryRockstarsConventions : QueryBase public int? RockstarIdOnOrAfter { get; set; } } - public class QueryCustomRockstars : QueryBase + public class QueryCustomRockstars : QueryDb { public int? Age { get; set; } } [Route("/customrockstars")] - public class QueryRockstarAlbums : QueryBase, IJoin + public class QueryJoinedRockstarAlbums : QueryDb, IJoin { public int? Age { get; set; } public string RockstarAlbumName { get; set; } } - public class QueryRockstarAlbumsImplicit : QueryBase, IJoin + public class QueryRockstarAlbumsImplicit : QueryDb, IJoin { } - public class QueryRockstarAlbumsLeftJoin : QueryBase, ILeftJoin + public class QueryRockstarAlbumsLeftJoin : QueryDb, ILeftJoin { public int? Age { get; set; } public string AlbumName { get; set; } + public int? IdNotEqualTo { get; set; } } + public class QueryRockstarAlbumsCustomLeftJoin : QueryDb + { + public int? Age { get; set; } + public string AlbumName { get; set; } + public int? IdNotEqualTo { get; set; } + } - public class QueryOverridedRockstars : QueryBase + public class QueryMultiJoinRockstar : QueryDb, + IJoin, + IJoin { public int? Age { get; set; } + public string RockstarAlbumName { get; set; } + public string RockstarGenreName { get; set; } } - public class QueryOverridedCustomRockstars : QueryBase + public class QueryOverridedRockstars : QueryDb { public int? Age { get; set; } } - public class QueryFieldRockstars : QueryBase + public class QueryOverridedCustomRockstars : QueryDb + { + public int? Age { get; set; } + } + + public class QueryCaseInsensitiveOrderBy : QueryDb + { + public int? Age { get; set; } + } + + public class QueryFieldRockstars : QueryDb { public string FirstName { get; set; } //default to 'AND FirstName = {Value}' public string[] FirstNames { get; set; } //Collections default to 'FirstName IN ({Values}) - [QueryField(Operand = ">=")] + [QueryDbField(Operand = ">=")] public int? Age { get; set; } - [QueryField(Template = "UPPER({Field}) LIKE UPPER({Value})", Field = "FirstName")] + [QueryDbField(Template = "UPPER({Field}) LIKE UPPER({Value})", Field = "FirstName")] public string FirstNameCaseInsensitive { get; set; } - [QueryField(Template = "{Field} LIKE {Value}", Field = "FirstName", ValueFormat = "{0}%")] + [QueryDbField(Template = "{Field} LIKE {Value}", Field = "FirstName", ValueFormat = "{0}%")] public string FirstNameStartsWith { get; set; } - [QueryField(Template = "{Field} LIKE {Value}", Field = "LastName", ValueFormat = "%{0}")] + [QueryDbField(Template = "{Field} LIKE {Value}", Field = "LastName", ValueFormat = "%{0}")] public string LastNameEndsWith { get; set; } - [QueryField(Template = "{Field} BETWEEN {Value1} AND {Value2}", Field = "FirstName")] + [QueryDbField(Template = "{Field} BETWEEN {Value1} AND {Value2}", Field = "FirstName")] public string[] FirstNameBetween { get; set; } - [QueryField(Term = QueryTerm.Or, Template = "UPPER({Field}) LIKE UPPER({Value})", Field = "LastName")] + [QueryDbField(Term = QueryTerm.Or, Template = "UPPER({Field}) LIKE UPPER({Value})", Field = "LastName")] public string OrLastName { get; set; } } - public class QueryFieldRockstarsDynamic : QueryBase + public class QueryRockstarAlias : QueryDb, + IJoin + { + public int? Age { get; set; } + public string RockstarAlbumName { get; set; } + } + + [DataContract] + public class RockstarAlias + { + [DataMember] + [Alias("Id")] + public int RockstarId { get; set; } + + [DataMember] + public string FirstName { get; set; } + + [DataMember] + [Alias("LastName")] + public string Surname { get; set; } + + [DataMember(Name = "album")] + public string RockstarAlbumName { get; set; } + } + + public class QueryFieldRockstarsDynamic : QueryDb { public int? Age { get; set; } } - public class QueryRockstarsFilter : QueryBase + public class QueryRockstarsFilter : QueryDb { public int? Age { get; set; } } - public class QueryCustomRockstarsFilter : QueryBase + public class QueryCustomRockstarsFilter : QueryDb { public int? Age { get; set; } } public interface IFilterRockstars { } - public class QueryRockstarsIFilter : QueryBase, IFilterRockstars + public class QueryRockstarsIFilter : QueryDb, IFilterRockstars { public int? Age { get; set; } } - [Query(QueryTerm.Or)] + [QueryDb(QueryTerm.Or)] [Route("/OrRockstars")] - public class QueryOrRockstars : QueryBase + public class QueryOrRockstars : QueryDb { public int? Age { get; set; } public string FirstName { get; set; } } - [Query(QueryTerm.Or)] - public class QueryGetRockstars : QueryBase + [Route("/OrRockstarsFields")] + public class QueryOrRockstarsFields : QueryDb + { + [QueryDbField(Term = QueryTerm.Or)] + public string FirstName { get; set; } + + [QueryDbField(Term = QueryTerm.Or)] + public string LastName { get; set; } + } + + public class QueryFieldsImplicitConventions : QueryDb + { + [QueryDbField(Term = QueryTerm.Or)] + public string FirstNameContains { get; set; } + + [QueryDbField(Term = QueryTerm.Or)] + public string LastNameEndsWith { get; set; } + } + + [QueryDb(QueryTerm.Or)] + public class QueryGetRockstars : QueryDb + { + public int[] Ids { get; set; } + public List Ages { get; set; } + public List FirstNames { get; set; } + public int[] IdsBetween { get; set; } + } + + public class QueryRockstarFilters : QueryDb { public int[] Ids { get; set; } public List Ages { get; set; } @@ -210,10 +451,22 @@ public class QueryGetRockstars : QueryBase public int[] IdsBetween { get; set; } } - [Query(QueryTerm.Or)] - public class QueryGetRockstarsDynamic : QueryBase {} + [QueryDb(QueryTerm.Or)] + public class QueryGetRockstarsDynamic : QueryDb {} + [References(typeof(RockstarAlbumGenreGlobalIndex))] public class RockstarAlbum + { + [AutoIncrement] + public int Id { get; set; } + [References(typeof(Rockstar))] + public int RockstarId { get; set; } + public string Name { get; set; } + [Index] + public string Genre { get; set; } + } + + public class RockstarGenre { [AutoIncrement] public int Id { get; set; } @@ -227,21 +480,38 @@ public class CustomRockstar public string LastName { get; set; } public int? Age { get; set; } public string RockstarAlbumName { get; set; } + public string RockstarGenreName { get; set; } + } + + public class QueryCustomRockstarsSchema : QueryDb + { + public int? Age { get; set; } + } + + [Schema("dbo")] + public class CustomRockstarSchema + { + public string FirstName { get; set; } + public string LastName { get; set; } + public int? Age { get; set; } + public string RockstarAlbumName { get; set; } + public string RockstarGenreName { get; set; } } [Route("/movies/search")] - [Query(QueryTerm.And)] //Default - public class SearchMovies : QueryBase {} + [QueryDb(QueryTerm.And)] //Default + public class SearchMovies : QueryDb {} [Route("/movies")] - [Query(QueryTerm.Or)] - public class QueryMovies : QueryBase + [QueryDb(QueryTerm.Or)] + public class QueryMovies : QueryDb { public int[] Ids { get; set; } public string[] ImdbIds { get; set; } public string[] Ratings { get; set; } } + [References(typeof(MovieTitleIndex))] public class Movie { [AutoIncrement] @@ -256,19 +526,24 @@ public class Movie public List Genres { get; set; } } - public class StreamMovies : QueryBase + public class StreamMovies : QueryDb { public string[] Ratings { get; set; } } - public class QueryUnknownRockstars : QueryBase + public class QueryUnknownRockstars : QueryDb { public int UnknownInt { get; set; } public string UnknownProperty { get; set; } } [Route("/query/rockstar-references")] - public class QueryRockstarsWithReferences : QueryBase + public class QueryRockstarsWithReferences : QueryDb + { + public int? Age { get; set; } + } + + public class QueryCustomRockstarsReferences : QueryDb { public int? Age { get; set; } } @@ -285,10 +560,93 @@ public class RockstarReference public List Albums { get; set; } } + [Route("/query/all-fields")] + public class QueryAllFields : QueryDb + { + public virtual Guid? Guid { get; set; } + } + + public class AllFields + { + public virtual int Id { get; set; } + public virtual int? NullableId { get; set; } + public virtual byte Byte { get; set; } + public virtual short Short { get; set; } + public virtual int Int { get; set; } + public virtual long Long { get; set; } + public virtual ushort UShort { get; set; } + public virtual uint UInt { get; set; } + public virtual ulong ULong { get; set; } + public virtual float Float { get; set; } + public virtual double Double { get; set; } + public virtual decimal Decimal { get; set; } + public virtual string String { get; set; } + public virtual DateTime DateTime { get; set; } + public virtual TimeSpan TimeSpan { get; set; } + public virtual Guid Guid { get; set; } + public virtual DateTime? NullableDateTime { get; set; } + public virtual TimeSpan? NullableTimeSpan { get; set; } + public virtual Guid? NullableGuid { get; set; } + public HttpStatusCode Enum { get; set; } + public HttpStatusCode? NullableEnum { get; set; } + } + + [EnumAsInt] + public enum SomeEnumAsInt + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + } + + public enum SomeEnum + { + Value1 = 1, + Value2 = 2, + Value3 = 3 + } + + public class TypeWithEnum + { + public int Id { get; set; } + public string Name { get; set; } + public SomeEnum SomeEnum { get; set; } + public SomeEnumAsInt SomeEnumAsInt { get; set; } + public SomeEnum? NSomeEnum { get; set; } + public SomeEnumAsInt? NSomeEnumAsInt { get; set; } + } + + [Route("/query-enums")] + public class QueryTypeWithEnums : QueryDb {} + + [DataContract] + public class Adhoc + { + [DataMember] + public int Id { get; set; } + + [DataMember(Name = "first_name")] + public string FirstName { get; set; } + + [DataMember] + public string LastName { get; set; } + } + + [DataContract] + [Route("/adhoc-rockstars")] + public class QueryAdhocRockstars : QueryDb + { + [DataMember(Name = "first_name")] + public string FirstName { get; set; } + } + + [DataContract] + [Route("/adhoc")] + public class QueryAdhoc : QueryDb {} public class AutoQueryService : Service { - public IAutoQuery AutoQuery { get; set; } + public IAutoQueryDb AutoQuery { get; set; } //Override with custom impl public object Any(QueryOverridedRockstars dto) @@ -305,12 +663,176 @@ public object Any(QueryOverridedCustomRockstars dto) return AutoQuery.Execute(dto, q); } + public object Any(QueryCaseInsensitiveOrderBy dto) + { + var q = AutoQuery.CreateQuery(dto, Request); + if (q.OrderByExpression != null) + q.OrderByExpression += " COLLATE NOCASE"; + + return AutoQuery.Execute(dto, q); + } + public object Any(StreamMovies dto) { var q = AutoQuery.CreateQuery(dto, Request.GetRequestParams()); q.Take(2); return AutoQuery.Execute(dto, q); } + + public object Any(QueryCustomRockstarsReferences request) + { + var q = AutoQuery.CreateQuery(request, Request.GetRequestParams()); + var response = new QueryResponse + { + Offset = q.Offset.GetValueOrDefault(0), + Results = Db.LoadSelect(q, include:new string[0]), + Total = (int)Db.Count(q), + }; + return response; + } + + public object Any(QueryRockstarAlbumsCustomLeftJoin query) + { + var q = AutoQuery.CreateQuery(query, Request) + .LeftJoin((r, a) => r.Id == a.RockstarId); + return AutoQuery.Execute(query, q); + } + } + + public interface IChangeDb + { + string NamedConnection { get; set; } + string ConnectionString { get; set; } + string ProviderName { get; set; } + } + + [Route("/querychangedb")] + public class QueryChangeDb : QueryDb, IChangeDb + { + public string NamedConnection { get; set; } + public string ConnectionString { get; set; } + public string ProviderName { get; set; } + } + + [Route("/changedb")] + public class ChangeDb : IReturn, IChangeDb + { + public string NamedConnection { get; set; } + public string ConnectionString { get; set; } + public string ProviderName { get; set; } + } + + public class ChangeDbResponse + { + public List Results { get; set; } + } + + public class DynamicDbServices : Service + { + public object Any(ChangeDb request) + { + return new ChangeDbResponse { Results = Db.Select() }; + } + } + + public class ChangeConnectionInfo : IReturn { } + public class QueryChangeConnectionInfo : QueryDb { } + + [ConnectionInfo(NamedConnection = AutoQueryAppHost.SqlServerNamedConnection)] + public class NamedConnectionServices : Service + { + public IAutoQueryDb AutoQuery { get; set; } + + public object Any(ChangeConnectionInfo request) + { + return new ChangeDbResponse { Results = Db.Select() }; + } + + public object Any(QueryChangeConnectionInfo query) + { + return AutoQuery.Execute(query, AutoQuery.CreateQuery(query, Request), Request); + } + } + + [Alias(nameof(Rockstar))] + public class CustomSelectRockstar + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + [CustomSelect("Age * 2")] + public int? Age { get; set; } + } + + public class QueryJoinedRockstarAlbumsCustomSelect : QueryDb, + IJoin + { + public int? Age { get; set; } + public string RockstarAlbumName { get; set; } + } + + public class CustomSelectRockstarResponse + { + public int Id { get; set; } + public string FirstName { get; set; } + public int? Age { get; set; } + } + + public class QueryJoinedRockstarAlbumsCustomSelectResponse : QueryDb, + IJoin + { + public int? Age { get; set; } + public string RockstarAlbumName { get; set; } + } + + public class AutoQueryUnitTests + { + private ServiceStackHost appHost; + + public AutoQueryUnitTests() + { + appHost = new BasicAppHost { + ConfigureAppHost = host => { + host.Plugins.Add(new AutoQueryFeature()); + }, + ConfigureContainer = container => { + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); + container.Register(dbFactory); + using (var db = dbFactory.Open()) + { + db.DropAndCreateTable(); + db.InsertAll(AutoQueryAppHost.SeedMovies); + } + container.RegisterAutoWired(); + }, + }.Init(); + } + + [OneTimeTearDown] public void OneTimeTearDown() => appHost.Dispose(); + + public class MyQueryServices : Service + { + public IAutoQueryDb AutoQuery { get; set; } + + public async Task Any(QueryMovies query) + { + using var db = AutoQuery.GetDb(query, base.Request); + var q = AutoQuery.CreateQuery(query, base.Request, db); + return await AutoQuery.ExecuteAsync(query, q, base.Request, db); + } + } + + [Test] + public async Task Can_execute_AutoQueryService_in_UnitTest() + { + var service = appHost.Resolve(); + service.Request = new BasicRequest(); + + var response = (QueryResponse) await service.Any( + new QueryMovies { Ratings = new[] {"G", "PG-13"} }); + + Assert.That(response.Results.Count, Is.EqualTo(5)); + } } [TestFixture] @@ -331,44 +853,137 @@ public AutoQueryTests() client = new JsonServiceClient(Config.ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); } - [NUnit.Framework.Ignore("Debug Run")] - [Test] + public List Rockstars => AutoQueryAppHost.SeedRockstars.ToList(); + + public List PagingTests => AutoQueryAppHost.SeedPagingTest.ToList(); + + // [NUnit.Framework.Ignore("Debug Run"), Test] public void RunFor10Mins() { +#if NET45 Process.Start(Config.ListeningOn); +#endif Thread.Sleep(TimeSpan.FromMinutes(10)); } [Test] public void Can_execute_basic_query() { - var response = client.Get(new QueryRockstars()); + var response = client.Get(new QueryRockstars { Include = "Total" }); Assert.That(response.Offset, Is.EqualTo(0)); Assert.That(response.Total, Is.EqualTo(TotalRockstars)); Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); } + [Test] + public void Can_execute_basic_query_NamedRockstar() + { + var response = client.Get(new QueryNamedRockstars { Include = "Total" }); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].LastName, Is.EqualTo("SQL Server")); + } + [Test] public void Can_execute_overridden_basic_query() { - var response = client.Get(new QueryOverridedRockstars()); + var response = client.Get(new QueryOverridedRockstars { Include = "Total" }); Assert.That(response.Offset, Is.EqualTo(0)); Assert.That(response.Total, Is.EqualTo(TotalRockstars)); Assert.That(response.Results.Count, Is.EqualTo(1)); } + [Test] + public void Can_execute_overridden_basic_query_with_case_insensitive_orderBy() + { + var response = client.Get(new QueryCaseInsensitiveOrderBy { Age = 27, OrderBy = "FirstName" }); + + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_query_IsNull() + { + var url = $"{Config.ListeningOn}query/rockstars?DateDiedIsNull"; + var response = url.GetJsonFromUrl().FromJson>(); + + response.PrintDump(); + Assert.That(response.Results.Count, Is.GreaterThan(0)); + Assert.That(response.Results.All(x => x.DateDied == null)); + } + + [Test] + public void Can_query_IsNotNull() + { + var url = $"{Config.ListeningOn}query/rockstars?DateDiedIsNotNull"; + var response = url.GetJsonFromUrl().FromJson>(); + + response.PrintDump(); + Assert.That(response.Results.Count, Is.GreaterThan(0)); + Assert.That(response.Results.All(x => x.DateDied != null)); + } + + [Test] + public void Can_execute_AdhocRockstars_query() + { + var request = new QueryAdhocRockstars { FirstName = "Jimi", Include = "Total" }; + + Assert.That(request.ToGetUrl(), Is.EqualTo("/adhoc-rockstars?first_name=Jimi&include=Total")); + + var response = client.Get(request); + + Assert.That(response.Offset, Is.EqualTo(0)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo(request.FirstName)); + } + + [Test] + public void Can_execute_Adhoc_query_alias() + { + var response = Config.ListeningOn.CombineWith("adhoc") + .AddQueryParam("first_name", "Jimi") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Jimi")); + } + + [Test] + public void Can_execute_Adhoc_query_convention() + { + var response = Config.ListeningOn.CombineWith("adhoc") + .AddQueryParam("last_name", "Hendrix") + .GetJsonFromUrl() + .FromJson>(); + Assert.That(response.Results.Count, Is.EqualTo(7)); + + JsConfig.Init(new Text.Config { TextCase = TextCase.SnakeCase }); + response = Config.ListeningOn.CombineWith("adhoc") + .AddQueryParam("last_name", "Hendrix") + .GetJsonFromUrl() + .FromJson>(); + JsConfig.Reset(); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Jimi")); + } + [Test] public void Can_execute_explicit_equality_condition_on_overridden_CustomRockstar() { - var response = client.Get(new QueryOverridedCustomRockstars { Age = 27 }); + var response = client.Get(new QueryOverridedCustomRockstars { Age = 27, Include = "Total" }); Assert.That(response.Total, Is.EqualTo(3)); Assert.That(response.Results.Count, Is.EqualTo(1)); @@ -377,17 +992,17 @@ public void Can_execute_explicit_equality_condition_on_overridden_CustomRockstar [Test] public void Can_execute_basic_query_with_limits() { - var response = client.Get(new QueryRockstars { Skip = 2 }); + var response = client.Get(new QueryRockstars { Skip = 2, Include = "Total" }); Assert.That(response.Offset, Is.EqualTo(2)); Assert.That(response.Total, Is.EqualTo(TotalRockstars)); Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 2)); - response = client.Get(new QueryRockstars { Take = 2 }); + response = client.Get(new QueryRockstars { Take = 2, Include = "Total" }); Assert.That(response.Offset, Is.EqualTo(0)); Assert.That(response.Total, Is.EqualTo(TotalRockstars)); Assert.That(response.Results.Count, Is.EqualTo(2)); - response = client.Get(new QueryRockstars { Skip = 2, Take = 2 }); + response = client.Get(new QueryRockstars { Skip = 2, Take = 2, Include = "Total" }); Assert.That(response.Offset, Is.EqualTo(2)); Assert.That(response.Total, Is.EqualTo(TotalRockstars)); Assert.That(response.Results.Count, Is.EqualTo(2)); @@ -396,7 +1011,7 @@ public void Can_execute_basic_query_with_limits() [Test] public void Can_execute_explicit_equality_condition() { - var response = client.Get(new QueryRockstars { Age = 27 }); + var response = client.Get(new QueryRockstars { Age = 27, Include = "Total" }); Assert.That(response.Total, Is.EqualTo(3)); Assert.That(response.Results.Count, Is.EqualTo(3)); @@ -405,10 +1020,24 @@ public void Can_execute_explicit_equality_condition() [Test] public void Can_execute_explicit_equality_condition_on_CustomRockstar() { - var response = client.Get(new QueryCustomRockstars { Age = 27 }); + var response = client.Get(new QueryCustomRockstars { Age = 27, Include = "Total" }); + + Assert.That(response.Total, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_execute_explicit_equality_condition_on_CustomRockstarSchema() + { + var response = client.Get(new QueryCustomRockstarsSchema { Age = 27, Include = "Total" }); + + response.PrintDump(); Assert.That(response.Total, Is.EqualTo(3)); Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results[0].FirstName, Is.Not.Null); + Assert.That(response.Results[0].LastName, Is.Not.Null); + Assert.That(response.Results[0].Age, Is.EqualTo(27)); } [Test] @@ -416,6 +1045,8 @@ public void Can_execute_implicit_equality_condition() { var response = Config.ListeningOn.CombineWith("json/reply/QueryRockstars") .AddQueryParam("FirstName", "Jim") + .AddQueryParam("LivingStatus", "Dead") + .AddQueryParam("Include", "Total") .GetJsonFromUrl() .FromJson>(); @@ -425,29 +1056,114 @@ public void Can_execute_implicit_equality_condition() } [Test] - public void Can_execute_query_with_JOIN_on_RockstarAlbums() + public void Can_execute_multiple_conditions_with_same_param_name() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryRockstars") + .AddQueryParam("FirstName", "Jim") + .AddQueryParam("FirstName", "Jim") + .AddQueryParam("Include", "Total") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].LastName, Is.EqualTo("Morrison")); + + response = Config.ListeningOn.CombineWith("json/reply/QueryRockstars") + .AddQueryParam("FirstNameStartsWith", "Jim") + .AddQueryParam("FirstNameStartsWith", "Jimi") + .AddQueryParam("Include", "Total") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].LastName, Is.EqualTo("Hendrix")); + } + + [Test] + public void Can_execute_implicit_IsNull_condition() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryRockstars?DateDied=&Include=Total") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Total, Is.EqualTo(2)); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public void Can_execute_query_with_JOIN_on_RockstarAlbums() + { + var response = client.Get(new QueryJoinedRockstarAlbums { Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(TotalAlbums)); + Assert.That(response.Results.Count, Is.EqualTo(TotalAlbums)); + var albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York", "Foo Fighters", "Into the Wild", + })); + + response = client.Get(new QueryJoinedRockstarAlbums { Age = 27, Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(6)); + Assert.That(response.Results.Count, Is.EqualTo(6)); + albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York", + })); + + response = client.Get(new QueryJoinedRockstarAlbums { RockstarAlbumName = "Nevermind", Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + albumNames = response.Results.Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { "Nevermind" })); + } + + [Test] + public void Can_execute_query_with_JOIN_on_RockstarAlbums_and_CustomSelectRockstar() + { + var response = client.Get(new QueryJoinedRockstarAlbumsCustomSelect { Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(TotalAlbums)); + Assert.That(response.Results.Count, Is.EqualTo(TotalAlbums)); + var ages = response.Results.Select(x => x.Age); + Assert.That(ages.Contains(27 * 2)); + + var customRes = client.Get(new QueryJoinedRockstarAlbumsCustomSelectResponse { Include = "Total" }); + Assert.That(customRes.Total, Is.EqualTo(TotalAlbums)); + Assert.That(customRes.Results.Count, Is.EqualTo(TotalAlbums)); + ages = customRes.Results.Select(x => x.Age); + Assert.That(ages.Contains(27 * 2)); + } + + [Test] + public void Can_execute_query_with_multiple_JOINs_on_Rockstar_Albums_and_Genres() { - var response = client.Get(new QueryRockstarAlbums()); + var response = client.Get(new QueryMultiJoinRockstar { Include = "Total" }); Assert.That(response.Total, Is.EqualTo(TotalAlbums)); Assert.That(response.Results.Count, Is.EqualTo(TotalAlbums)); var albumNames = response.Results.Select(x => x.RockstarAlbumName); Assert.That(albumNames, Is.EquivalentTo(new[] { - "Electric Ladyland", "Nevermind", "Foo Fighters", "Into the Wild" + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York", "Foo Fighters", "Into the Wild", })); - response = client.Get(new QueryRockstarAlbums { Age = 27 }); - Assert.That(response.Total, Is.EqualTo(2)); - Assert.That(response.Results.Count, Is.EqualTo(2)); - albumNames = response.Results.Select(x => x.RockstarAlbumName); - Assert.That(albumNames, Is.EquivalentTo(new[] { - "Electric Ladyland", "Nevermind" + var genreNames = response.Results.Select(x => x.RockstarGenreName).Distinct(); + Assert.That(genreNames, Is.EquivalentTo(new[] { + "Rock", "Grunge", "Alternative Rock", "Folk Rock" })); - response = client.Get(new QueryRockstarAlbums { RockstarAlbumName = "Nevermind" }); + response = client.Get(new QueryMultiJoinRockstar { RockstarAlbumName = "Nevermind", Include = "Total" }); Assert.That(response.Total, Is.EqualTo(1)); Assert.That(response.Results.Count, Is.EqualTo(1)); albumNames = response.Results.Select(x => x.RockstarAlbumName); Assert.That(albumNames, Is.EquivalentTo(new[] { "Nevermind" })); + + response = client.Get(new QueryMultiJoinRockstar { RockstarGenreName = "Folk Rock", Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results.Count, Is.EqualTo(1)); + albumNames = response.Results.Select(x => x.RockstarGenreName); + Assert.That(albumNames, Is.EquivalentTo(new[] { "Folk Rock" })); } [Test] @@ -455,17 +1171,20 @@ public void Can_execute_IMPLICIT_query_with_JOIN_on_RockstarAlbums() { var response = Config.ListeningOn.CombineWith("json/reply/QueryRockstarAlbumsImplicit") .AddQueryParam("Age", "27") + .AddQueryParam("Include", "Total") .GetJsonFromUrl() .FromJson>(); - Assert.That(response.Total, Is.EqualTo(2)); - Assert.That(response.Results.Count, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(6)); + Assert.That(response.Results.Count, Is.EqualTo(6)); var albumNames = response.Results.Select(x => x.RockstarAlbumName); Assert.That(albumNames, Is.EquivalentTo(new[] { - "Electric Ladyland", "Nevermind" + "Electric Ladyland", "Bleach", "Nevermind", "In Utero", "Incesticide", + "MTV Unplugged in New York" })); response = Config.ListeningOn.CombineWith("json/reply/QueryRockstarAlbumsImplicit") .AddQueryParam("RockstarAlbumName", "Nevermind") + .AddQueryParam("Include", "Total") .GetJsonFromUrl() .FromJson>(); Assert.That(response.Total, Is.EqualTo(1)); @@ -477,13 +1196,24 @@ public void Can_execute_IMPLICIT_query_with_JOIN_on_RockstarAlbums() [Test] public void Can_execute_query_with_LEFTJOIN_on_RockstarAlbums() { - var response = client.Get(new QueryRockstarAlbumsLeftJoin()); - response.PrintDump(); - Assert.That(response.Total, Is.EqualTo(TotalRockstars)); - Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + var response = client.Get(new QueryRockstarAlbumsLeftJoin { IdNotEqualTo = 3, Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(TotalRockstars - 1)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 1)); + var albumNames = response.Results.Where(x => x.RockstarAlbumName != null).Select(x => x.RockstarAlbumName); + Assert.That(albumNames, Is.EquivalentTo(new[] { + "Electric Ladyland", "Foo Fighters", "Into the Wild" + })); + } + + [Test] + public void Can_execute_query_with_custom_LEFTJOIN_on_RockstarAlbums() + { + var response = client.Get(new QueryRockstarAlbumsCustomLeftJoin { IdNotEqualTo = 3, Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(TotalRockstars - 1)); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars - 1)); var albumNames = response.Results.Where(x => x.RockstarAlbumName != null).Select(x => x.RockstarAlbumName); Assert.That(albumNames, Is.EquivalentTo(new[] { - "Electric Ladyland", "Nevermind", "Foo Fighters", "Into the Wild" + "Electric Ladyland", "Foo Fighters", "Into the Wild" })); } @@ -516,6 +1246,13 @@ public void Can_execute_custom_QueryFields() }); Assert.That(response.Results.Count, Is.EqualTo(3)); + response = client.Get(new QueryFieldRockstars + { + FirstNameStartsWith = "Jim", + OrLastName = "Presley" + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = client.Get(new QueryFieldRockstars { Age = 42 }); Assert.That(response.Results.Count, Is.EqualTo(4)); } @@ -552,14 +1289,25 @@ public void Does_escape_values() Assert.That(response.Results.Count, Is.EqualTo(0)); } + [Test] + public void Does_use_custom_model_to_select_columns() + { + var response = client.Get(new QueryRockstarAlias { RockstarAlbumName = "Nevermind" }); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].RockstarId, Is.EqualTo(3)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Kurt")); + Assert.That(response.Results[0].RockstarAlbumName, Is.EqualTo("Nevermind")); + } + [Test] public void Does_allow_adding_attributes_dynamically() { typeof(QueryFieldRockstarsDynamic) .GetProperty("Age") - .AddAttributes(new QueryFieldAttribute { Operand = ">=" }); + .AddAttributes(new QueryDbFieldAttribute { Operand = ">=" }); - var response = client.Get(new QueryFieldRockstars { Age = 42 }); + var response = client.Get(new QueryFieldRockstarsDynamic { Age = 42 }); Assert.That(response.Results.Count, Is.EqualTo(4)); } @@ -592,6 +1340,34 @@ public void Can_execute_OR_QueryFilters() Assert.That(response.Results.Count, Is.EqualTo(3)); } + [Test] + public void Does_retain_implicit_convention_when_not_overriding_template_or_ValueFormat() + { + var response = client.Get(new QueryFieldsImplicitConventions { FirstNameContains = "im" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = client.Get(new QueryFieldsImplicitConventions { LastNameEndsWith = "son" }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + + [Test] + public void Can_execute_OR_QueryFilters_Fields() + { + var response = client.Get(new QueryOrRockstarsFields + { + FirstName = "Jim", + LastName = "Vedder", + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + + response = Config.ListeningOn.CombineWith("OrRockstarsFields") + .AddQueryParam("FirstName", "Kurt") + .AddQueryParam("LastName", "Hendrix") + .GetJsonFromUrl() + .FromJson>(); + Assert.That(response.Results.Count, Is.EqualTo(2)); + } + [Test] public void Can_execute_implicit_conventions() { @@ -607,6 +1383,8 @@ public void Can_execute_implicit_conventions() Assert.That(response.Results.Count, Is.EqualTo(3)); response = baseUrl.AddQueryParam("GreaterThanAge", 42).AsJsonInto(); Assert.That(response.Results.Count, Is.EqualTo(3)); + response = baseUrl.AddQueryParam("AgeNotEqualTo", 27).AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(4)); response = baseUrl.AddQueryParam(">Age", 42).AsJsonInto(); Assert.That(response.Results.Count, Is.EqualTo(4)); @@ -616,6 +1394,8 @@ public void Can_execute_implicit_conventions() Assert.That(response.Results.Count, Is.EqualTo(3)); response = baseUrl.AddQueryParam("Age<", 42).AsJsonInto(); Assert.That(response.Results.Count, Is.EqualTo(4)); + response = baseUrl.AddQueryParam("Age!", "27").AsJsonInto(); + Assert.That(response.Results.Count, Is.EqualTo(4)); response = baseUrl.AddQueryParam("FirstNameStartsWith", "jim").AsJsonInto(); Assert.That(response.Results.Count, Is.EqualTo(2)); @@ -628,13 +1408,13 @@ public void Can_execute_implicit_conventions() [Test] public void Can_execute_implicit_conventions_on_JOIN() { - var baseUrl = Config.ListeningOn.CombineWith("json/reply/QueryRockstarAlbums"); + var baseUrl = Config.ListeningOn.CombineWith("json/reply/QueryJoinedRockstarAlbums"); var response = baseUrl.AddQueryParam("RockstarAlbumNameContains", "n").AsJsonInto(); - Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(6)); response = baseUrl.AddQueryParam(">RockstarId", "3").AsJsonInto(); - Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results.Count, Is.EqualTo(7)); response = baseUrl.AddQueryParam("RockstarId>", "3").AsJsonInto(); Assert.That(response.Results.Count, Is.EqualTo(2)); } @@ -662,6 +1442,11 @@ public void Can_execute_Explicit_conventions() Assert.That(response.Results.Count, Is.EqualTo(2)); response = client.Get(new QueryRockstarsConventions { LastNameContains = "e" }); Assert.That(response.Results.Count, Is.EqualTo(3)); + + response = client.Get(new QueryRockstarsConventions { DateOfBirthGreaterThan = new DateTime(1960, 01, 01) }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + response = client.Get(new QueryRockstarsConventions { DateDiedLessThan = new DateTime(1980, 01, 01) }); + Assert.That(response.Results.Count, Is.EqualTo(3)); } [Test] @@ -717,10 +1502,26 @@ public void Can_execute_In_OR_Queries() Assert.That(response.Results.Count, Is.EqualTo(2)); response = client.Get(new QueryGetRockstars { IdsBetween = new[] { 1, 3 } }); - response.Results.PrintDump(); Assert.That(response.Results.Count, Is.EqualTo(3)); } + [Test] + public void Does_ignore_empty_collection_filters_by_default() + { + QueryResponse response; + response = client.Get(new QueryRockstarFilters()); + Assert.That(response.Results.Count, Is.EqualTo(AutoQueryAppHost.SeedRockstars.Length)); + + response = client.Get(new QueryRockstarFilters + { + Ids = new int[] {}, + Ages = new List(), + FirstNames = new List(), + IdsBetween = new int[] {}, + }); + Assert.That(response.Results.Count, Is.EqualTo(AutoQueryAppHost.SeedRockstars.Length)); + } + [Test] public void Can_execute_In_OR_Queries_with_implicit_conventions() { @@ -737,7 +1538,6 @@ public void Can_execute_In_OR_Queries_with_implicit_conventions() Assert.That(response.Results.Count, Is.EqualTo(2)); response = baseUrl.AddQueryParam("IdsBetween", "1,3").AsJsonInto(); - response.Results.PrintDump(); Assert.That(response.Results.Count, Is.EqualTo(3)); } @@ -849,13 +1649,13 @@ public void Can_consume_as_CSV() url = Config.ListeningOn + "query/rockstars.csv?Age=27"; csv = url.GetStringFromUrl(); headers = csv.SplitOnFirst('\n')[0].Trim(); - Assert.That(headers, Is.EqualTo("Id,FirstName,LastName,Age")); + Assert.That(headers, Is.EqualTo("Id,FirstName,LastName,Age,DateOfBirth,DateDied,LivingStatus")); csv.Print(); url = Config.ListeningOn + "customrockstars.csv"; csv = url.GetStringFromUrl(); headers = csv.SplitOnFirst('\n')[0].Trim(); - Assert.That(headers, Is.EqualTo("FirstName,LastName,Age,RockstarAlbumName")); + Assert.That(headers, Is.EqualTo("FirstName,LastName,Age,RockstarAlbumName,RockstarGenreName")); csv.Print(); } @@ -865,6 +1665,7 @@ public void Does_not_query_Ignored_properties() var response = client.Get(new QueryUnknownRockstars { UnknownProperty = "Foo", UnknownInt = 1, + Include = "Total" }); Assert.That(response.Offset, Is.EqualTo(0)); @@ -879,8 +1680,6 @@ public void Can_Query_Rockstars_with_References() Age = 27 }); - response.PrintDump(); - Assert.That(response.Results.Count, Is.EqualTo(3)); var jimi = response.Results.First(x => x.FirstName == "Jimi"); @@ -891,8 +1690,412 @@ public void Can_Query_Rockstars_with_References() Assert.That(jim.Albums, Is.Null); var kurt = response.Results.First(x => x.FirstName == "Kurt"); - Assert.That(kurt.Albums.Count, Is.EqualTo(1)); - Assert.That(kurt.Albums[0].Name, Is.EqualTo("Nevermind")); + Assert.That(kurt.Albums.Count, Is.EqualTo(5)); + + response = client.Get(new QueryRockstarsWithReferences + { + Age = 27, + Fields = "Id,FirstName,Age" + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results.All(x => x.Id > 0)); + Assert.That(response.Results.All(x => x.LastName == null)); + Assert.That(response.Results.All(x => x.Albums == null)); + + response = client.Get(new QueryRockstarsWithReferences + { + Age = 27, + Fields = "Id,FirstName,Age,Albums" + }); + Assert.That(response.Results.Where(x => x.FirstName != "Jim").All(x => x.Albums != null)); + } + + [Test] + public void Can_Query_RockstarReference_without_References() + { + var response = client.Get(new QueryCustomRockstarsReferences + { + Age = 27 + }); + Assert.That(response.Results.Count, Is.EqualTo(3)); + Assert.That(response.Results.All(x => x.Albums == null)); + } + + [Test] + public void Can_Query_AllFields_Guid() + { + var guid = new Guid("3EE6865A-4149-4940-B7A2-F952E0FEFC5E"); + var response = client.Get(new QueryAllFields { + Guid = guid + }); + + Assert.That(response.Results.Count, Is.EqualTo(1)); + + Assert.That(response.Results[0].Guid, Is.EqualTo(guid)); + } + + [Test] + public void Does_populate_Total() + { + var response = client.Get(new QueryRockstars { Include = "Total" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta, Is.Null); + + response = client.Get(new QueryRockstars { Include = "COUNT" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryRockstars { Include = "COUNT(*)" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryRockstars { Include = "COUNT(DISTINCT LivingStatus), Total" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryRockstars { Include = "Count(*), Min(Age), Max(Age), Sum(Id)" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + + response = client.Get(new QueryRockstars { Age = 27, Include = "Count(*), Min(Age), Max(Age), Sum(Id)" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count(x => x.Age == 27))); + } + + [Test] + public void Can_Include_Aggregates_in_AutoQuery() + { + var response = client.Get(new QueryRockstars { Include = "COUNT" }); + Assert.That(response.Meta["COUNT(*)"], Is.EqualTo(Rockstars.Count.ToString())); + + response = client.Get(new QueryRockstars { Include = "COUNT(*)" }); + Assert.That(response.Meta["COUNT(*)"], Is.EqualTo(Rockstars.Count.ToString())); + + response = client.Get(new QueryRockstars { Include = "COUNT(DISTINCT LivingStatus)" }); + Assert.That(response.Meta["COUNT(DISTINCT LivingStatus)"], Is.EqualTo("2")); + + response = client.Get(new QueryRockstars { Include = "MIN(Age)" }); + Assert.That(response.Meta["MIN(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + + response = client.Get(new QueryRockstars { Include = "Count(*), Min(Age), Max(Age), Sum(Id), Avg(Age)", OrderBy = "Id" }); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(Rockstars.Count.ToString())); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Max(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["Sum(Id)"], Is.EqualTo(Rockstars.Map(x => x.Id).Sum().ToString())); + Assert.That(double.Parse(response.Meta["Avg(Age)"]), Is.EqualTo(Rockstars.Average(x => x.Age)).Within(1d)); + //Not supported by Sqlite + //Assert.That(response.Meta["First(Id)"], Is.EqualTo(Rockstars.First().Id.ToString())); + //Assert.That(response.Meta["Last(Id)"], Is.EqualTo(Rockstars.Last().Id.ToString())); + + response = client.Get(new QueryRockstars { Age = 27, Include = "Count(*), Min(Age), Max(Age), Sum(Id), Avg(Age)", OrderBy = "Id" }); + var rockstars27 = Rockstars.Where(x => x.Age == 27).ToList(); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(rockstars27.Count.ToString())); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(rockstars27.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Max(Age)"], Is.EqualTo(rockstars27.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["Sum(Id)"], Is.EqualTo(rockstars27.Map(x => x.Id).Sum().ToString())); + Assert.That(double.Parse(response.Meta["Avg(Age)"]), Is.EqualTo(rockstars27.Average(x => x.Age)).Within(1d)); + //Not supported by Sqlite + //Assert.That(response.Meta["First(Id)"], Is.EqualTo(rockstars27.First().Id.ToString())); + //Assert.That(response.Meta["Last(Id)"], Is.EqualTo(rockstars27.Last().Id.ToString())); + } + + [Test] + public void Does_ignore_unknown_aggregate_commands() + { + var response = client.Get(new QueryRockstars { Include = "FOO(1), Total" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta, Is.Null); + + response = client.Get(new QueryRockstars { Include = "FOO(1), Min(Age), Bar('a') alias, Count(*), Baz(1,'foo')" }); + Assert.That(response.Total, Is.EqualTo(Rockstars.Count)); + Assert.That(response.Meta["Min(Age)"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["Count(*)"], Is.EqualTo(Rockstars.Count.ToString())); + } + + [Test] + public void Can_Include_Aggregates_in_AutoQuery_with_Aliases() + { + var response = client.Get(new QueryRockstars { Include = "COUNT(*) count" }); + Assert.That(response.Meta["count"], Is.EqualTo(Rockstars.Count.ToString())); + + response = client.Get(new QueryRockstars { Include = "COUNT(DISTINCT LivingStatus) as uniquestatus" }); + Assert.That(response.Meta["uniquestatus"], Is.EqualTo("2")); + + response = client.Get(new QueryRockstars { Include = "MIN(Age) minage" }); + Assert.That(response.Meta["minage"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + + response = client.Get(new QueryRockstars { Include = "Count(*) count, Min(Age) min, Max(Age) max, Sum(Id) sum" }); + Assert.That(response.Meta["count"], Is.EqualTo(Rockstars.Count.ToString())); + Assert.That(response.Meta["min"], Is.EqualTo(Rockstars.Map(x => x.Age).Min().ToString())); + Assert.That(response.Meta["max"], Is.EqualTo(Rockstars.Map(x => x.Age).Max().ToString())); + Assert.That(response.Meta["sum"], Is.EqualTo(Rockstars.Map(x => x.Id).Sum().ToString())); + } + + [Test] + public void Can_execute_custom_aggregate_functions() + { + var response = client.Get(new QueryRockstars { + Include = "ADD(6,2), Multiply(6,2) SixTimesTwo, Subtract(6,2), divide(6,2) TheDivide" + }); + Assert.That(response.Meta["ADD(6,2)"], Is.EqualTo("8")); + Assert.That(response.Meta["SixTimesTwo"], Is.EqualTo("12")); + Assert.That(response.Meta["Subtract(6,2)"], Is.EqualTo("4")); + Assert.That(response.Meta["TheDivide"], Is.EqualTo("3")); + } + + [Test] + public void Sending_empty_ChangeDb_returns_default_info() + { + var response = client.Get(new ChangeDb()); + Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); + + var aqResponse = client.Get(new QueryChangeDb()); + Assert.That(aqResponse.Results.Count, Is.EqualTo(TotalRockstars)); + } + + [Test] + public void Can_ChangeDb_with_Named_Connection() + { + var response = client.Get(new ChangeDb { NamedConnection = AutoQueryAppHost.SqlServerNamedConnection }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Microsoft")); + + var aqResponse = client.Get(new QueryChangeDb { NamedConnection = AutoQueryAppHost.SqlServerNamedConnection }); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Microsoft")); + } + + [Test] + public void Can_ChangeDb_with_ConnectionString() + { + var response = client.Get(new ChangeDb { ConnectionString = AutoQueryAppHost.SqliteFileConnString }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Sqlite")); + + var aqResponse = client.Get(new QueryChangeDb { ConnectionString = AutoQueryAppHost.SqliteFileConnString }); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Sqlite")); + } + + [Test] + public void Can_ChangeDb_with_ConnectionString_and_Provider() + { + var response = client.Get(new ChangeDb + { + ConnectionString = AutoQueryAppHost.SqlServerConnString, + ProviderName = AutoQueryAppHost.SqlServerProvider, + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Microsoft")); + + var aqResponse = client.Get(new QueryChangeDb + { + ConnectionString = AutoQueryAppHost.SqlServerConnString, + ProviderName = AutoQueryAppHost.SqlServerProvider, + }); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Microsoft")); + } + + [Test] + public void Can_Change_Named_Connection_with_ConnectionInfoAttribute() + { + var response = client.Get(new ChangeConnectionInfo()); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Results[0].FirstName, Is.EqualTo("Microsoft")); + + var aqResponse = client.Get(new QueryChangeConnectionInfo()); + Assert.That(aqResponse.Results.Count, Is.EqualTo(1)); + Assert.That(aqResponse.Results[0].FirstName, Is.EqualTo("Microsoft")); + } + + [Test] + public void Can_select_partial_list_of_fields() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryRockstars") + .AddQueryParam("Age", "27") + .AddQueryParam("Fields", "Id,FirstName,Age") + .GetJsonFromUrl() + .FromJson>(); + + response.PrintDump(); + + Assert.That(response.Results.All(x => x.Id > 0)); + Assert.That(response.Results.All(x => x.FirstName != null)); + Assert.That(response.Results.All(x => x.LastName == null)); + Assert.That(response.Results.Any(x => x.Age > 0)); + Assert.That(response.Results.All(x => x.DateDied == null)); + Assert.That(response.Results.All(x => x.DateOfBirth == default(DateTime).ToLocalTime())); + } + + [Test] + public void Can_select_partial_list_of_fields_DISTINCT() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryRockstars") + .AddQueryParam("Fields", "DISTINCT Age") + .GetJsonFromUrl() + .FromJson>(); + + response.PrintDump(); + + Assert.That(response.Results.Any(x => x.Age > 0)); + Assert.That(response.Results.Count, Is.EqualTo(response.Results.Select(x => x.Age).ToHashSet().Count)); + Assert.That(response.Results.All(x => x.Id == 0)); + Assert.That(response.Results.All(x => x.FirstName == null)); + Assert.That(response.Results.All(x => x.LastName == null)); + Assert.That(response.Results.All(x => x.DateDied == null)); + Assert.That(response.Results.All(x => x.DateOfBirth == default(DateTime).ToLocalTime())); + } + + [Test] + public void Can_select_partial_list_of_fields_case_insensitive() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryRockstars") + .AddQueryParam("Age", "27") + .AddQueryParam("Fields", "id,firstname,age") + .GetJsonFromUrl() + .FromJson>(); + + response.PrintDump(); + + Assert.That(response.Results.All(x => x.Id > 0)); + Assert.That(response.Results.All(x => x.FirstName != null)); + Assert.That(response.Results.All(x => x.LastName == null)); + Assert.That(response.Results.Any(x => x.Age > 0)); + Assert.That(response.Results.All(x => x.DateDied == null)); + Assert.That(response.Results.All(x => x.DateOfBirth == default(DateTime).ToLocalTime())); + } + + [Test] + public void Can_select_partial_list_of_fields_from_joined_table() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryJoinedRockstarAlbums") + .AddQueryParam("Age", "27") + .AddQueryParam("fields", "FirstName,Age,RockstarAlbumName") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Results.All(x => x.FirstName != null)); + Assert.That(response.Results.All(x => x.LastName == null)); + Assert.That(response.Results.All(x => x.Age > 0)); + Assert.That(response.Results.All(x => x.RockstarAlbumName != null)); + } + + [Test] + public void Can_select_partial_list_of_fields_from_joined_table_case_insensitive() + { + var response = Config.ListeningOn.CombineWith("json/reply/QueryJoinedRockstarAlbums") + .AddQueryParam("Age", "27") + .AddQueryParam("fields", "firstname,age,rockstaralbumname") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Results.All(x => x.FirstName != null)); + Assert.That(response.Results.All(x => x.LastName == null)); + Assert.That(response.Results.All(x => x.Age > 0)); + Assert.That(response.Results.All(x => x.RockstarAlbumName != null)); + } + + [Test] + public void Does_return_MaxLimit_results() + { + QueryResponse response; + response = client.Get(new QueryPagingTest { Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(100)); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count)); + + response = client.Get(new QueryPagingTest { Skip = 200, Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(PagingTests.Skip(200).Count())); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count)); + + response = client.Get(new QueryPagingTest { Value = 1, Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(100)); + Assert.That(response.Total, Is.EqualTo(PagingTests.Count(x => x.Value == 1))); + } + + [Test] + public void Can_query_on_ForeignKey_and_Index() + { + QueryResponse response; + response = client.Get(new QueryRockstarAlbums { RockstarId = 3, Include = "Total" }); //Hash + Assert.That(response.Results.Count, Is.EqualTo(5)); + Assert.That(response.Total, Is.EqualTo(5)); + + response = client.Get(new QueryRockstarAlbums { RockstarId = 3, Id = 3, Include = "Total" }); //Hash + Range + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Name, Is.EqualTo("Nevermind")); + + //Hash + Range BETWEEN + response = client.Get(new QueryRockstarAlbums + { + RockstarId = 3, + IdBetween = new[] { 2, 3 }, + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(2)); + Assert.That(response.Total, Is.EqualTo(2)); + + //Hash + Range BETWEEN + Filter + response = client.Get(new QueryRockstarAlbums + { + RockstarId = 3, + IdBetween = new[] { 2, 3 }, + Name = "Nevermind", + Include = "Total" + }); + Assert.That(response.Results.Count, Is.EqualTo(1)); + Assert.That(response.Total, Is.EqualTo(1)); + Assert.That(response.Results[0].Id, Is.EqualTo(3)); + + //Hash + LocalSecondaryIndex + response = client.Get(new QueryRockstarAlbums { RockstarId = 3, Genre = "Grunge", Include = "Total" }); + Assert.That(response.Results.Count, Is.EqualTo(4)); + Assert.That(response.Total, Is.EqualTo(4)); + + response.PrintDump(); + } + + [Test] + public void Can_use_implicit_query_on_enums_on_all_fields() + { + var allFieldsResponse = Config.ListeningOn.CombineWith("query", "all-fields") + .AddQueryParam("EnumContains", "MethodNotAllowed") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(allFieldsResponse.Results[0].Enum, Is.EqualTo(HttpStatusCode.MethodNotAllowed)); + } + + [Test] + public void Can_use_implicit_query_to_query_equals_on_int_enums() + { + var response = Config.ListeningOn.CombineWith("query-enums") + .AddQueryParam("SomeEnumAsInt", "Value2") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Results[0].SomeEnumAsInt, Is.EqualTo(SomeEnumAsInt.Value2)); + + response = Config.ListeningOn.CombineWith("query-enums") + .AddQueryParam("NSomeEnumAsInt", "Value2") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Results[0].NSomeEnumAsInt, Is.EqualTo(SomeEnumAsInt.Value2)); + } + + [Test] + public void Can_use_implicit_query_to_query_contains_on_string_enums() + { + var response = Config.ListeningOn.CombineWith("query-enums") + .AddQueryParam("SomeEnumContains", "Value2") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Results[0].SomeEnum, Is.EqualTo(SomeEnum.Value2)); + + response = Config.ListeningOn.CombineWith("query-enums") + .AddQueryParam("NSomeEnumContains", "Value2") + .GetJsonFromUrl() + .FromJson>(); + + Assert.That(response.Results[0].NSomeEnum, Is.EqualTo(SomeEnum.Value2)); } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/BufferedRequestTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/BufferedRequestTests.cs index 3ceeefa3700..a4429626bb3 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/BufferedRequestTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/BufferedRequestTests.cs @@ -11,7 +11,7 @@ public class BufferedRequestTests { private BufferedRequestAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BufferedRequestAppHost(); @@ -19,7 +19,7 @@ public void TestFixtureSetUp() appHost.Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -29,7 +29,7 @@ public void TestFixtureTearDown() public void BufferredRequest_allows_rereading_of_Request_InputStream() { appHost.LastRequestBody = null; - appHost.UseBufferredStream = true; + appHost.UseBufferedStream = true; var client = new JsonServiceClient(Config.ServiceStackBaseUri); var request = new MyRequest { Data = "RequestData" }; @@ -43,7 +43,7 @@ public void BufferredRequest_allows_rereading_of_Request_InputStream() public void Cannot_reread_Request_InputStream_without_bufferring() { appHost.LastRequestBody = null; - appHost.UseBufferredStream = false; + appHost.UseBufferedStream = false; var client = new JsonServiceClient(Config.ServiceStackBaseUri); var request = new MyRequest { Data = "RequestData" }; @@ -58,7 +58,7 @@ public void Cannot_reread_Request_InputStream_without_bufferring() public void Cannot_see_RequestBody_in_RequestLogger_without_bufferring() { appHost.LastRequestBody = null; - appHost.UseBufferredStream = false; + appHost.UseBufferedStream = false; var client = new JsonServiceClient(Config.ServiceStackBaseUri); var request = new MyRequest { Data = "RequestData" }; @@ -80,7 +80,7 @@ public class BufferedRequestLoggerTests private BufferedRequestAppHost appHost; MyRequest request = new MyRequest { Data = "RequestData" }; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BufferedRequestAppHost { EnableRequestBodyTracking = true }; @@ -88,7 +88,7 @@ public void TestFixtureSetUp() appHost.Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -102,6 +102,7 @@ public void Can_see_RequestBody_in_RequestLogger_when_EnableRequestBodyTracking( Assert.That(logBody, Is.EqualTo(request.ToJson())); } +#if !NETCORE [Test] public void Can_see_RequestBody_in_RequestLogger_when_EnableRequestBodyTracking_Soap12() { @@ -110,13 +111,12 @@ public void Can_see_RequestBody_in_RequestLogger_when_EnableRequestBodyTracking_ var logBody = Run(new Soap12ServiceClient(Config.ServiceStackBaseUri)); - Assert.That(appHost.LastRequestBody, Is.StringStarting(soap12start)); - Assert.That(appHost.LastRequestBody, Is.StringEnding(soap12end)); - Assert.That(logBody, Is.StringStarting(soap12start)); - Assert.That(logBody, Is.StringEnding(soap12end)); + Assert.That(appHost.LastRequestBody, Does.StartWith(soap12start)); + Assert.That(appHost.LastRequestBody, Does.EndWith(soap12end)); + Assert.That(logBody, Does.StartWith(soap12start)); + Assert.That(logBody, Does.EndWith(soap12end)); } - [Test] public void Can_see_RequestBody_in_RequestLogger_when_EnableRequestBodyTracking_Soap11() { @@ -126,13 +126,13 @@ public void Can_see_RequestBody_in_RequestLogger_when_EnableRequestBodyTracking_ Assert.That(appHost.LastRequestBody, Is.EqualTo(soap11)); Assert.That(logBody, Is.EqualTo(soap11)); } - +#endif string Run(IServiceClient client) { var requestLogger = appHost.TryResolve(); appHost.LastRequestBody = null; - appHost.UseBufferredStream = false; + appHost.UseBufferedStream = false; var response = client.Send(request); //Debug.WriteLine(appHost.LastRequestBody); @@ -147,17 +147,20 @@ string Run(IServiceClient client) public class BufferedRequestAppHost : AppHostHttpListenerBase { - public BufferedRequestAppHost() : base(typeof(BufferedRequestTests).Name, typeof(MyService).Assembly) { } + public BufferedRequestAppHost() : base(nameof(BufferedRequestTests), typeof(MyService).Assembly) { } public string LastRequestBody { get; set; } - public bool UseBufferredStream { get; set; } + public bool UseBufferedStream { get; set; } public bool EnableRequestBodyTracking { get; set; } public override void Configure(Container container) { +#if !NETCORE + Plugins.Add(new SoapFormat()); +#endif PreRequestFilters.Add((httpReq, httpRes) => { - if (UseBufferredStream) - httpReq.UseBufferedStream = UseBufferredStream; + if (UseBufferedStream) + httpReq.UseBufferedStream = UseBufferedStream; LastRequestBody = null; LastRequestBody = httpReq.GetRawBody(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/BuiltinRouteTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/BuiltinRouteTests.cs new file mode 100644 index 00000000000..b80e8ef1082 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/BuiltinRouteTests.cs @@ -0,0 +1,64 @@ +using System; +using System.Diagnostics; +using System.Threading; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class BuiltinRouteServices : Service {} + + public class BuiltinRouteTests + { + public class BuiltinPathAppHost : AppSelfHostBase + { + public BuiltinPathAppHost() + : base(typeof(BuiltinPathAppHost).Name, typeof(BuiltinRouteServices).Assembly) {} + + public override void Configure(Container container) + { + PreRequestFilters.Add((req, res) => + { + req.UseBufferedStream = true; + res.UseBufferedStream = true; + }); + } + } + + readonly ServiceStackHost appHost; + public BuiltinRouteTests() + { + appHost = new BuiltinPathAppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + [Ignore("Debug Run")] + [Test] + public void RunFor10Mins() + { + Process.Start(Config.AbsoluteBaseUri); + Thread.Sleep(TimeSpan.FromMinutes(10)); + } + + [Test] + public void Can_download_metadata_page() + { + var contents = "{0}/metadata".Fmt(Config.AbsoluteBaseUri).GetStringFromUrl(); + Assert.That(contents, Does.Contain("The following operations are supported.")); + } + + [Test] + public void Can_download_File_Template_OperationControl() + { + var contents = "{0}/json/metadata?op=Hello".Fmt(Config.AbsoluteBaseUri).GetStringFromUrl(); + Assert.That(contents, Does.Contain("/hello/{Name}")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CacheResponseTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CacheResponseTests.cs new file mode 100644 index 00000000000..4ddf3ef1c22 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CacheResponseTests.cs @@ -0,0 +1,669 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Text; +using ServiceStack.WebHost.Endpoints.Tests.Support.Services; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Route("/cache/serveronly/{Id}")] + public class ServerCacheOnly : ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + [Route("/cache/serveronlyasync/{Id}")] + public class ServerCacheOnlyAsync : ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + [Route("/cache/servershort/{Id}")] + public class ServerCacheShort : ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + [Route("/cache/serversuser/{Id}")] + public class ServerCacheUser : ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + [Route("/cache/serversroles/{Id}")] + public class ServerCacheRoles : ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + [Route("/cache/clientmaxage/{Id}")] + public class ClientCacheMaxAge : IReturn, ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + [Route("/cache/clientmustrevalidate/{Id}")] + public class ClientCacheMustRevalidate : IReturn, ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + [Route("/cache/serverscustomkey/{Id}")] + public class ServerCustomCacheKey : ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + [Route("/cache/alwaysthrows")] + public class CacheAlwaysThrows : IReturn + { + public string Message { get; set; } + } + + public interface ICacheDto + { + int Id { get; set; } + string Value { get; set; } + } + + public class HelloCache : IReturn + { + public string Name { get; set; } + } + + [Route("/cache/custom-json/{Id}")] + public class CacheCustomJson : ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + [Route("/cache/stream-result/{Id}")] + public class CacheStream : ICacheDto + { + internal static int Count = 0; + + public int Id { get; set; } + public string Value { get; set; } + } + + public class CacheResponseServices : Service + { + [CacheResponse(Duration = 5000)] + public object Any(HelloCache request) + { + return new HelloResponse { Result = $"Hello, {request.Name}!"}; + } + + [CacheResponse(Duration = 10)] + public object Any(ServerCacheOnly request) + { + Interlocked.Increment(ref ServerCacheOnly.Count); + return request; + } + + [CacheResponse(Duration = 10)] + public async Task Any(ServerCacheOnlyAsync request) + { + await Task.Yield(); + Interlocked.Increment(ref ServerCacheOnlyAsync.Count); + return request; + } + + [CacheResponse(Duration = 1)] + public object Any(ServerCacheShort request) + { + Interlocked.Increment(ref ServerCacheShort.Count); + return request; + } + + [CacheResponse(Duration = 10, VaryByUser = true)] + public object Any(ServerCacheUser request) + { + Interlocked.Increment(ref ServerCacheUser.Count); + return request; + } + + [CacheResponse(Duration = 10, VaryByRoles = new[]{ "RoleA", "RoleB" })] + public object Any(ServerCacheRoles request) + { + Interlocked.Increment(ref ServerCacheRoles.Count); + return request; + } + + [CacheResponse(Duration = 10, MaxAge = 10)] + public object Any(ClientCacheMaxAge request) + { + Interlocked.Increment(ref ClientCacheMaxAge.Count); + return request; + } + + [CacheResponse(Duration = 10, MaxAge = 0, CacheControl = CacheControl.MustRevalidate)] + public object Any(ClientCacheMustRevalidate request) + { + Interlocked.Increment(ref ClientCacheMustRevalidate.Count); + return request; + } + + [CacheResponse(Duration = 10)] + public async Task Any(ServerCustomCacheKey request) + { + if (Request.GetItem(Keywords.CacheInfo) is CacheInfo cacheInfo) + { + cacheInfo.KeyBase += "::flag=" + (ServerCustomCacheKey.Count % 2 == 0); + if (await Request.HandleValidCache(cacheInfo)) + return null; + } + + Interlocked.Increment(ref ServerCustomCacheKey.Count); + return request; + } + + [CacheResponse(Duration = 5000)] + public object Any(CacheAlwaysThrows request) + { + throw new Exception(request.Message); + } + + [CacheResponse(Duration = 10)] + public object Any(CacheCustomJson request) + { + Interlocked.Increment(ref CacheCustomJson.Count); + return new HttpResult(request) + { + ResultScope = () => JsConfig.With(new Text.Config + { + TextCase = TextCase.CamelCase, + IncludeNullValues = true, + }) + }; + } + + [AddHeader(ContentType = MimeTypes.Jsv)] + [CacheResponse(Duration = 5000)] + public object Any(CacheStream request) + { + Interlocked.Increment(ref CacheStream.Count); + + var jsv = request.ToJsv(); + var bytes = jsv.ToUtf8Bytes(); + var ms = bytes.InMemoryStream(); + return ms; + } + } + + [TestFixture] + public class CacheResponseTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(typeof (CacheServerFeatureTests).Name, typeof (CacheEtagServices).Assembly) {} + + public override void Configure(Container container) + { + PreRequestFilters.Add((req, res) => + { + var roleHeader = req.GetHeader("X-role"); + if (roleHeader == null) + return; + + req.Items[Keywords.Session] = new AuthUserSession + { + UserAuthId = "1", + UserAuthName = "test", + Roles = new List { roleHeader } + }; + }); + + ServiceExceptionHandlers.Add((req, dto, ex) => + { + return DtoUtils.CreateErrorResponse(dto, ex); + }); + } + } + + private readonly ServiceStackHost appHost; + public CacheResponseTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + private void AssertEquals(ICacheDto actual, ICacheDto expected) + { + Assert.That(actual.Id, Is.EqualTo(expected.Id)); + Assert.That(actual.Value, Is.EqualTo(expected.Value)); + } + + [Test] + public void Does_cache_duplicate_requests() + { + ServerCacheOnly.Count = 0; + var request = new ServerCacheOnly { Id = 1, Value = "foo" }; + + var response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(responseFilter: res => + { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Json)); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.Null); + }) + .FromJson(); + + Assert.That(ServerCacheOnly.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(responseFilter: res => + { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Json)); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.Null); + }) + .FromJson(); + + Assert.That(ServerCacheOnly.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + var client = new JsonServiceClient(Config.ListeningOn); + response = client.Get(request); + Assert.That(ServerCacheOnly.Count, Is.EqualTo(1)); + AssertEquals(response, request); + } + + [Test] + public async Task Does_cache_duplicate_requests_async() + { + ServerCacheOnlyAsync.Count = 0; + var request = new ServerCacheOnlyAsync { Id = 1, Value = "foo" }; + + var response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(responseFilter: res => + { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Json)); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.Null); + }) + .FromJson(); + + Assert.That(ServerCacheOnlyAsync.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(responseFilter: res => + { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Json)); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.Null); + }) + .FromJson(); + + Assert.That(ServerCacheOnlyAsync.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + var client = new JsonServiceClient(Config.ListeningOn); + response = await client.GetAsync(request); + Assert.That(ServerCacheOnlyAsync.Count, Is.EqualTo(1)); + AssertEquals(response, request); + } + + [Test] + public void Does_vary_cache_by_QueryString() + { + ServerCacheOnly.Count = 0; + var request = new ServerCacheOnly { Id = 2, Value = "foo" }; + + var response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl() + .FromJson(); + + Assert.That(ServerCacheOnly.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(new ServerCacheOnly { Id = 1 }.ToGetUrl()) + .GetJsonFromUrl() + .FromJson(); + + Assert.That(ServerCacheOnly.Count, Is.EqualTo(2)); + Assert.That(response.Id, Is.EqualTo(1)); + Assert.That(response.Value, Is.Null); + } + + [Test] + public void Does_vary_cache_by_UserSession() + { + ServerCacheOnly.Count = 0; + var request = new ServerCacheUser { Id = 3, Value = "foo" }; + + var response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(requestFilter: req => req.Headers["X-ss-id"] = "1") + .FromJson(); + + Assert.That(ServerCacheUser.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(requestFilter: req => req.Headers["X-ss-id"] = "1") + .FromJson(); + + Assert.That(ServerCacheUser.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(requestFilter: req => req.Headers["X-ss-id"] = "2") + .FromJson(); + + Assert.That(ServerCacheUser.Count, Is.EqualTo(2)); + AssertEquals(response, request); + } + + [Test] + public void Does_vary_cache_by_Role() + { + ServerCacheRoles.Count = 0; + var request = new ServerCacheRoles { Id = 3, Value = "foo" }; + + var response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(requestFilter: req => req.Headers["X-role"] = "RoleA") + .FromJson(); + + Assert.That(ServerCacheRoles.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(requestFilter: req => req.Headers["X-role"] = "RoleA") + .FromJson(); + + Assert.That(ServerCacheRoles.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl(requestFilter: req => req.Headers["X-role"] = "RoleB") + .FromJson(); + + Assert.That(ServerCacheRoles.Count, Is.EqualTo(2)); + AssertEquals(response, request); + } + + [Test] + public void Does_cache_different_content_types_and_encoding() + { + ServerCacheOnly.Count = 0; + var request = new ServerCacheOnly { Id = 4, Value = "bar" }; + var url = Config.ListeningOn.CombineWith(request.ToGetUrl()); + + ServerCacheOnly response; + + //JSON + Deflate + response = url.GetJsonFromUrl(responseFilter: res => + { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Json)); + }) + .FromJson(); + + Assert.That(ServerCacheOnly.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + //JSON + No Accept-Encoding + var webReq = (HttpWebRequest)WebRequest.Create(url); + webReq.Accept = MimeTypes.Json; +#if !NETCORE + webReq.AutomaticDecompression = DecompressionMethods.None; +#endif + var webRes = webReq.GetResponse(); + Assert.That(webRes.ContentType, Does.StartWith(MimeTypes.Json)); + response = webRes.GetResponseStream().ReadToEnd() + .FromJson(); + Assert.That(ServerCacheOnly.Count, Is.EqualTo(1)); //Uses plain json cache from #1 + AssertEquals(response, request); + + //JSON + GZip + webReq = (HttpWebRequest)WebRequest.Create(url); + webReq.Accept = MimeTypes.Json; + webReq.Headers[HttpHeaders.AcceptEncoding] = CompressionTypes.GZip; +#if !NETCORE + webReq.AutomaticDecompression = DecompressionMethods.GZip; +#endif + webRes = webReq.GetResponse(); + Assert.That(webRes.ContentType, Does.StartWith(MimeTypes.Json)); + var responseGzip = webRes.GetResponseStream().ReadFully(); +#if !NETCORE + response = responseGzip.FromUtf8Bytes().FromJson(); +#else + response = responseGzip.Decompress("gzip").FromJson(); +#endif + Assert.That(ServerCacheOnly.Count, Is.EqualTo(2)); //New encoding new cache + AssertEquals(response, request); + + //XML + Deflate + response = url.GetXmlFromUrl(responseFilter: res => { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Xml)); + }) + .FromXml(); + Assert.That(ServerCacheOnly.Count, Is.EqualTo(3)); + AssertEquals(response, request); + + //HTML + Deflate + var html = url.GetStringFromUrl(requestFilter:req => req.ContentType = MimeTypes.Html); + Assert.That(ServerCacheOnly.Count, Is.EqualTo(4)); + Assert.That(html, Does.StartWith("")); + html = url.GetStringFromUrl(requestFilter: req => req.ContentType = MimeTypes.Html); + Assert.That(ServerCacheOnly.Count, Is.EqualTo(4)); + Assert.That(html, Does.StartWith("")); + } + + [Test] + public void Can_execute_with_CompressionDisabled() + { + var client = new JsvServiceClient(Config.ListeningOn) + { + DisableAutoCompression = true, + }; + + var result = client.Get(new ServerCacheOnly { Value = "Hello" }); + Assert.That(result.Value, Is.EqualTo("Hello")); + + var response = client.Get(new HelloCache { Name = "World" }); + Assert.That(response.Result, Is.EqualTo("Hello, World!")); + } + + [Test] + public void Cache_does_Expire() + { + var request = new ServerCacheShort { Id = 5, Value = "foo" }; + + var response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl() + .FromJson(); + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl() + .FromJson(); + + Assert.That(ServerCacheShort.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + Thread.Sleep(1100); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl() + .FromJson(); + + Assert.That(ServerCacheShort.Count, Is.EqualTo(2)); + AssertEquals(response, request); + } + + [Test] + public void Cached_client_does_return_local_cache_when_MaxAge() + { + ClientCacheMaxAge.Count = 0; + var request = new ClientCacheMaxAge { Id = 6, Value = "foo" }; + var client = new CachedServiceClient(new JsonServiceClient(Config.ListeningOn)); + + ClientCacheMaxAge response; + + response = client.Get(request); + Assert.That(ClientCacheMaxAge.Count, Is.EqualTo(1)); + Assert.That(client.CacheHits, Is.EqualTo(0)); + AssertEquals(response, request); + + response = client.Get(request); + Assert.That(ClientCacheMaxAge.Count, Is.EqualTo(1)); + Assert.That(client.CacheHits, Is.EqualTo(1)); + AssertEquals(response, request); + } + + [Test] + public void Cached_client_does_return_NotModified_when_MustRevalidate() + { + ClientCacheMaxAge.Count = 0; + var request = new ClientCacheMustRevalidate { Id = 7, Value = "foo" }; + var client = new CachedServiceClient(new JsonServiceClient(Config.ListeningOn)); + + ClientCacheMustRevalidate response; + + response = client.Get(request); + Assert.That(ClientCacheMustRevalidate.Count, Is.EqualTo(1)); + Assert.That(client.NotModifiedHits, Is.EqualTo(0)); + AssertEquals(response, request); + + response = client.Get(request); + Assert.That(ClientCacheMustRevalidate.Count, Is.EqualTo(1)); + Assert.That(client.NotModifiedHits, Is.EqualTo(1)); + AssertEquals(response, request); + } + + [Test] + public void Does_cache_by_custom_CacheKey() + { + ServerCustomCacheKey.Count = 0; + var request = new ServerCustomCacheKey { Id = 8, Value = "foo" }; + + var response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl() + .FromJson(); + + Assert.That(ServerCustomCacheKey.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl() + .FromJson(); + + Assert.That(ServerCustomCacheKey.Count, Is.EqualTo(2)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetJsonFromUrl() + .FromJson(); + + Assert.That(ServerCustomCacheKey.Count, Is.EqualTo(2)); + AssertEquals(response, request); + } + + [Test] + public void Does_not_cache_Error_Responses() + { + var client = new JsonServiceClient(Config.ListeningOn); + + try + { + var response = client.Get(new CacheAlwaysThrows { Message = "foo" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorMessage, Is.EqualTo("foo")); + } + + try + { + var response = client.Get(new CacheAlwaysThrows { Message = "bar" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorMessage, Is.EqualTo("bar")); + } + } + + [Test] + public void Cache_does_use_custom_serialization() + { + var json = Config.ListeningOn.CombineWith("/cache/custom-json/1") + .GetJsonFromUrl(); + + Assert.That(json, Is.EqualTo("{\"id\":1,\"value\":null}")); + } + + [Test] + public void Does_cache_MemoryStream_HttpResult_Responses_preserving_ContentType() + { + CacheStream.Count = 0; + var request = new CacheStream { Id = 1, Value = "foo" }; + + var response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetStringFromUrl(responseFilter: res => + { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Jsv)); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.Null); + }) + .FromJsv(); + + Assert.That(CacheStream.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + response = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .GetStringFromUrl(responseFilter: res => + { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Jsv)); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.Null); + }) + .FromJsv(); + + Assert.That(CacheStream.Count, Is.EqualTo(1)); + AssertEquals(response, request); + + var client = new JsvServiceClient(Config.ListeningOn); + response = client.Get(request); + Assert.That(CacheStream.Count, Is.EqualTo(1)); + AssertEquals(response, request); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CacheServerFeatureTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CacheServerFeatureTests.cs new file mode 100644 index 00000000000..eca7ef2da3d --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CacheServerFeatureTests.cs @@ -0,0 +1,446 @@ +using System; +using Funq; +using NUnit.Framework; +using ServiceStack.Caching; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [TestFixture] + public class CacheServerFeatureTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(typeof(CacheServerFeatureTests).Name, typeof(CacheEtagServices).Assembly) + { } + + public override void Configure(Container container) { } + } + + private readonly ServiceStackHost appHost; + public CacheServerFeatureTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [TearDown] + public void TearDown() + { + //clear cache after each test + var cache = appHost.TryResolve(); + cache.FlushAll(); + } + + protected JsonServiceClient GetClient() + { + var client = new JsonServiceClient(Config.ListeningOn); +#if NETCORE + client.AddHeader(HttpHeaders.AcceptEncoding, "gzip,deflate"); +#endif + return client; + } + + [Test] + public void Does_set_Etag_and_Default_MaxAge() + { + var client = GetClient(); + client.ResponseFilter = res => + { + Assert.That(res.Headers[HttpHeaders.ETag], Is.EqualTo("etag".Quoted())); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.EqualTo("max-age=600")); + }; + + var request = new SetCache { ETag = "etag" }; + var response = client.Get(request); + + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void Does_not_set_Etag_and_Default_MaxAge_on_POST() + { + var client = GetClient(); + client.ResponseFilter = res => + { + Assert.That(res.Headers[HttpHeaders.ETag], Is.Null); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.Null); + }; + + var request = new SetCache { ETag = "etag" }; + var response = client.Post(request); + + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void Does_set_LastModified_and_Default_MaxAge() + { + var client = GetClient(); + var request = new SetCache { LastModified = new DateTime(2016, 1, 1, 0, 0, 0) }; + + client.ResponseFilter = res => + { + Assert.That(res.Headers[HttpHeaders.LastModified], Is.EqualTo(request.LastModified.Value.ToUniversalTime().ToString("r"))); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.EqualTo("max-age=600")); + }; + + var response = client.Get(request); + + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void Does_set_Etag_MaxAge_and_CacheControl() + { + var client = GetClient(); + client.ResponseFilter = res => + { + Assert.That(res.Headers[HttpHeaders.Age], Is.EqualTo("864000")); + Assert.That(res.Headers[HttpHeaders.ETag], Is.EqualTo("etag".Quoted())); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.EqualTo("max-age=86400, public, must-revalidate, no-store") + .Or.EqualTo("no-store, public, must-revalidate, max-age=86400")); + }; + + var request = new SetCache + { + ETag = "etag", + Age = TimeSpan.FromDays(10), + MaxAge = TimeSpan.FromDays(1), + CacheControl = CacheControl.Public | CacheControl.NoStore | CacheControl.MustRevalidate, + }; + var response = client.Get(request); + + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void Does_throw_304_when_etag_matches() + { + var client = GetClient(); + client.RequestFilter = req => + req.Headers[HttpHeaders.IfNoneMatch] = "etag".Quoted(); + + client.ResponseFilter = res => + Assert.That(res.ContentLength, Is.EqualTo(0)); + + try + { + var response = client.Get(new SetCache { ETag = "etag" }); + Assert.Fail("Should throw 304 NotModified"); + } + catch (Exception ex) + { + if (!ex.IsNotModified()) + throw; + } + } + + [Test] + public void Returns_response_when_etag_does_not_match() + { + var client = GetClient(); + client.RequestFilter = req => + req.Headers[HttpHeaders.IfNoneMatch] = "etag".Quoted(); + + client.ResponseFilter = res => + { + Assert.That(res.Headers[HttpHeaders.ETag], Is.EqualTo("etag-alt".Quoted())); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.EqualTo("max-age=600")); + }; + + var request = new SetCache { ETag = "etag-alt" }; + var response = client.Get(request); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void Does_throw_304_when_not_ModifiedSince() + { + var client = GetClient(); + var request = new SetCache { LastModified = new DateTime(2016, 1, 1, 0, 0, 0) }; + + client.RequestFilter = req => + PclExportClient.Instance.SetIfModifiedSince(req, request.LastModified.Value); + + client.ResponseFilter = res => + { + Assert.That(res.ContentLength, Is.EqualTo(0)); + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.EqualTo("max-age=3600")); + }; + + try + { + var response = client.Get(request); + Assert.Fail("Should throw 304 NotModified"); + } + catch (Exception ex) + { + if (!ex.IsNotModified()) + throw; + } + } + + [Test] + public void Returns_response_when_ModifiedSince_LastModified() + { + var client = GetClient(); + var request = new SetCache { LastModified = new DateTime(2016, 1, 1, 0, 0, 0) }; + + client.RequestFilter = req => + PclExportClient.Instance.SetIfModifiedSince(req, request.LastModified.Value + TimeSpan.FromSeconds(-1)); + + client.ResponseFilter = res => + Assert.That(res.Headers[HttpHeaders.CacheControl], Is.EqualTo("max-age=600")); + + var response = client.Get(request); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void Can_short_circuit_Service_implementation_when_ETag_matches() + { + var client = GetClient(); + client.RequestFilter = req => + req.Headers[HttpHeaders.IfNoneMatch] = "etag".Quoted(); + + client.ResponseFilter = res => + { + Assert.That(res.ContentLength, Is.EqualTo(0)); + Assert.That(res.Headers[HttpHeaders.Age], Is.Null); //short-circuit + }; + + try + { + var response = client.Get(new ShortCircuitImpl { ETag = "etag", Age = TimeSpan.FromDays(1) }); + Assert.Fail("Should throw 304 NotModified"); + } + catch (Exception ex) + { + if (!ex.IsNotModified()) + throw; + } + } + + [Test] + public void Does_bypass_short_circuit_Service_implementation_when_ETag_not_matches() + { + var client = GetClient(); + client.RequestFilter = req => + req.Headers[HttpHeaders.IfNoneMatch] = "etag".Quoted(); + + client.ResponseFilter = res => + Assert.That(res.Headers[HttpHeaders.Age], Is.EqualTo("86400")); + + var request = new ShortCircuitImpl + { + ETag = "etag-alt", + Age = TimeSpan.FromDays(1) + }; + var response = client.Get(request); + + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void ToOptimizedResult_does_populate_LastModified() + { + var client = GetClient(); + + client.ResponseFilter = res => + Assert.That(DateTime.Parse(res.Headers[HttpHeaders.LastModified]).ToUniversalTime(), + Is.EqualTo(DateTime.UtcNow).Within(TimeSpan.FromMinutes(1))); + + var request = new CachedRequest { ETag = "etag" }; + var response = client.Get(request); + Assert.That(response, Is.EqualTo(request)); + + response = client.Get(request); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void ToOptimizedResult_throws_304_when_not_ModifiedSince() + { + var client = GetClient(); + + DateTime? lastModified = null; + + client.ResponseFilter = res => + lastModified = DateTime.Parse(res.Headers[HttpHeaders.LastModified]); + + var request = new CachedRequest { Age = TimeSpan.FromHours(1) }; + var response = client.Get(request); + Assert.That(response, Is.EqualTo(request)); + + try + { + client.RequestFilter = req => + PclExportClient.Instance.SetIfModifiedSince(req, lastModified.Value); + + response = client.Get(request); + Assert.Fail("Should throw 304 NotModified"); + } + catch (Exception ex) + { + if (!ex.IsNotModified()) + throw; + } + } + + [Test] + public void CachedServiceClient_does_return_cached_ETag_Requests() + { + var client = new CachedServiceClient(GetClient()); + + var request = new SetCache { ETag = "etag" }; + + var response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(response, Is.EqualTo(request)); + + response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response, Is.EqualTo(request)); + } + } + + public abstract class CacheRequestBase + { + public string ETag { get; set; } + public TimeSpan? Age { get; set; } + public TimeSpan? MaxAge { get; set; } + public DateTime? Expires { get; set; } + public DateTime? LastModified { get; set; } + public CacheControl? CacheControl { get; set; } + + public bool Equals(CacheRequestBase other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return string.Equals(ETag, other.ETag) + && MaxAge.Equals(other.MaxAge) + && Expires.Equals(other.Expires) + && LastModified.Equals(other.LastModified) + && CacheControl == other.CacheControl; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != this.GetType()) return false; + return Equals((SetCache)obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = (ETag != null ? ETag.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ MaxAge.GetHashCode(); + hashCode = (hashCode * 397) ^ Expires.GetHashCode(); + hashCode = (hashCode * 397) ^ LastModified.GetHashCode(); + hashCode = (hashCode * 397) ^ CacheControl.GetHashCode(); + return hashCode; + } + } + } + + [Route("/set-cache")] + public class SetCache : CacheRequestBase, IReturn, IEquatable + { + public bool Equals(SetCache other) + { + return base.Equals(other); + } + } + + public class ShortCircuitImpl : CacheRequestBase, IReturn, IEquatable + { + public bool Equals(ShortCircuitImpl other) + { + return base.Equals(other); + } + } + + public class CachedRequest : CacheRequestBase, IReturn, IEquatable + { + public bool Equals(CachedRequest other) + { + return base.Equals(other); + } + } + + public class FailsAfterOnce : CacheRequestBase, IReturn, IEquatable + { + internal static int Count = 0; + + public bool Equals(FailsAfterOnce other) + { + return base.Equals(other); + } + } + + public class CacheEtagServices : Service + { + public object Any(SetCache request) + { + return new HttpResult(request) + { + Age = request.Age, + ETag = request.ETag, + MaxAge = request.MaxAge, + Expires = request.Expires, + LastModified = request.LastModified, + CacheControl = request.CacheControl.GetValueOrDefault(CacheControl.None), + }; + } + + public object Any(ShortCircuitImpl request) + { + if (Request.HasValidCache(request.ETag, request.LastModified)) + return HttpResult.NotModified(); + + return new HttpResult(request) + { + Age = request.Age, + ETag = request.ETag, + MaxAge = request.MaxAge, + Expires = request.Expires, + LastModified = request.LastModified, + CacheControl = request.CacheControl.GetValueOrDefault(CacheControl.None), + }; + } + + public object Any(CachedRequest request) + { + var cacheKey = Request.QueryString.ToString(); + + return Request.ToOptimizedResultUsingCache(Cache, cacheKey, () => request); + } + + public object Any(FailsAfterOnce request) + { + if (FailsAfterOnce.Count++ > 0) + throw new Exception("Can only be called once"); + + return new HttpResult(request) + { + Age = request.Age, + ETag = request.ETag, + MaxAge = request.MaxAge, + Expires = request.Expires, + LastModified = request.LastModified, + CacheControl = request.CacheControl.GetValueOrDefault(CacheControl.None), + }; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CachedServiceClientTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CachedServiceClientTests.cs new file mode 100644 index 00000000000..7245b2384c8 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CachedServiceClientTests.cs @@ -0,0 +1,243 @@ +using System; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Caching; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class CachedJsonServiceClientTests : CachedServiceClientTests + { + protected override ICachedServiceClient GetCachedServiceClient() + { + var client = new JsonServiceClient(Config.ListeningOn); +#if NETCORE + client.AddHeader(HttpHeaders.AcceptEncoding, "gzip,deflate"); +#endif + return new CachedServiceClient(client); + } + } + + public class CachedJsonHttpClientTests : CachedServiceClientTests + { + protected override ICachedServiceClient GetCachedServiceClient() + { + return new CachedHttpClient(new JsonHttpClient(Config.ListeningOn)); + } + } + + [TestFixture] + public abstract class CachedServiceClientTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(typeof(CacheServerFeatureTests).Name, typeof(CacheEtagServices).Assembly) + { } + + public override void Configure(Container container) { } + } + + private readonly ServiceStackHost appHost; + protected CachedServiceClientTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [TearDown] + public void TearDown() + { + //clear cache after each test + var cache = Service.GlobalResolver.TryResolve(); + cache.FlushAll(); + } + + protected abstract ICachedServiceClient GetCachedServiceClient(); + + [Test] + public void CachedServiceClient_does_return_cached_ETag_Requests_when_MustRevalidate() + { + var client = GetCachedServiceClient(); + + var request = new SetCache { ETag = "etag", CacheControl = CacheControl.MustRevalidate }; + + var response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(response, Is.EqualTo(request)); + + response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public async Task CachedServiceClient_does_return_cached_ETag_Requests_Async() + { + var client = GetCachedServiceClient(); + + var request = new SetCache { ETag = "etag", CacheControl = CacheControl.MustRevalidate }; + + var response = await client.GetAsync(request); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(response, Is.EqualTo(request)); + + response = await client.GetAsync(request); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void CachedServiceClient_does_return_cached_ETag_Requests_using_URL() + { + var client = GetCachedServiceClient(); + + var requestUrl = Config.ListeningOn.CombineWith("set-cache?etag=etag"); + + var response = client.Get(requestUrl); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(response.ETag, Is.EqualTo("etag")); + + response = client.Get(requestUrl); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response.ETag, Is.EqualTo("etag")); + } + + [Test] + public void CachedServiceClient_does_return_cached_LastModified_Requests() + { + var client = GetCachedServiceClient(); + + var request = new SetCache { LastModified = new DateTime(2016, 1, 1, 0, 0, 0) }; + + var response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(response, Is.EqualTo(request)); + + response = client.Get(request); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void CachedServiceClient_does_return_cached_LastModified_Requests_using_URL() + { + var client = GetCachedServiceClient(); + + var requestUrl = Config.ListeningOn.CombineWith("set-cache?lastModified=2016-01-01"); + + var response = client.Get(requestUrl); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(response.LastModified, Is.EqualTo(new DateTime(2016, 1, 1, 0, 0, 0))); + + response = client.Get(requestUrl); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response.LastModified, Is.EqualTo(new DateTime(2016, 1, 1, 0, 0, 0))); + } + + [Test] + public async Task CachedServiceClient_does_return_cached_LastModified_Requests_using_URL_Async() + { + var client = GetCachedServiceClient(); + + var requestUrl = Config.ListeningOn.CombineWith("set-cache?lastModified=2016-01-01"); + + var response = await client.GetAsync(requestUrl); + Assert.That(client.CacheHits, Is.EqualTo(0)); + Assert.That(response.LastModified, Is.EqualTo(new DateTime(2016, 1, 1, 0, 0, 0))); + + response = await client.GetAsync(requestUrl); + Assert.That(client.CacheHits, Is.EqualTo(1)); + Assert.That(response.LastModified, Is.EqualTo(new DateTime(2016, 1, 1, 0, 0, 0))); + } + + [Test] + public void CachedServiceClient_does_return_cached_ToOptimizedResults() + { + var client = GetCachedServiceClient(); + + var request = new CachedRequest { Age = TimeSpan.FromHours(1) }; + var response = client.Get(request); + Assert.That(client.NotModifiedHits, Is.EqualTo(0)); + Assert.That(response, Is.EqualTo(request)); + + response = client.Get(request); + Assert.That(client.NotModifiedHits, Is.EqualTo(1)); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public async Task CachedServiceClient_does_return_cached_ToOptimizedResults_Async() + { + var client = GetCachedServiceClient(); + + var request = new CachedRequest { Age = TimeSpan.FromHours(1) }; + var response = await client.GetAsync(request); + Assert.That(client.NotModifiedHits, Is.EqualTo(0)); + Assert.That(response, Is.EqualTo(request)); + + response = await client.GetAsync(request); + Assert.That(client.NotModifiedHits, Is.EqualTo(1)); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void CachedServiceClient_does_return_cached_after_FailedResponse() + { + var client = GetCachedServiceClient(); + FailsAfterOnce.Count = 0; + + var request = new FailsAfterOnce { ETag = "etag", MaxAge = TimeSpan.FromSeconds(0) }; + var response = client.Get(request); + Assert.That(client.ErrorFallbackHits, Is.EqualTo(0)); + Assert.That(response, Is.EqualTo(request)); + + response = client.Get(request); + Assert.That(client.ErrorFallbackHits, Is.EqualTo(1)); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public async Task CachedServiceClient_does_return_cached_after_FailedResponse_Async() + { + var client = GetCachedServiceClient(); + FailsAfterOnce.Count = 0; + + var request = new FailsAfterOnce { ETag = "etag", MaxAge = TimeSpan.FromSeconds(0) }; + var response = await client.GetAsync(request); + Assert.That(client.ErrorFallbackHits, Is.EqualTo(0)); + Assert.That(response, Is.EqualTo(request)); + + response = await client.GetAsync(request); + Assert.That(client.ErrorFallbackHits, Is.EqualTo(1)); + Assert.That(response, Is.EqualTo(request)); + } + + [Test] + public void CachedServiceClient_does_not_return_NoCache_after_FailedResponse() + { + var client = GetCachedServiceClient(); + FailsAfterOnce.Count = 0; + + var request = new FailsAfterOnce { ETag = "etag", CacheControl = CacheControl.NoCache }; + var response = client.Get(request); + Assert.That(client.ErrorFallbackHits, Is.EqualTo(0)); + Assert.That(response, Is.EqualTo(request)); + + try + { + client.Get(request); + Assert.Fail("Should throw"); + } + catch (Exception) {} + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CachedServiceTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CachedServiceTests.cs index 4731fd42b08..438378b59dd 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CachedServiceTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CachedServiceTests.cs @@ -1,6 +1,6 @@ using NUnit.Framework; -using ServiceStack.ProtoBuf; using ServiceStack.WebHost.Endpoints.Tests.Support.Host; +using ServiceStack.ProtoBuf; namespace ServiceStack.WebHost.Endpoints.Tests { @@ -9,7 +9,7 @@ public class CachedServiceTests { ExampleAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new ExampleAppHostHttpListener(); @@ -17,7 +17,7 @@ public void OnTestFixtureSetUp() appHost.Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CancellableRequestTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CancellableRequestTests.cs new file mode 100644 index 00000000000..127cbbacacf --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CancellableRequestTests.cs @@ -0,0 +1,93 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class CancellableRequestAppHost : AppSelfHostBase + { + public CancellableRequestAppHost() + : base("CancellableRequests", typeof(CancellableRequestTestService).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new CancellableRequestsFeature()); + } + } + + public class TestCancelRequest : IReturn + { + public string Tag { get; set; } + } + + public class TestCancelRequestResponse + { + public ResponseStatus ResponseStatus { get; set; } + } + + public class CancellableRequestTestService : Service + { + public object Any(TestCancelRequest req) + { + using (var cancellableRequest = base.Request.CreateCancellableRequest()) + { + while (true) + { + cancellableRequest.Token.ThrowIfCancellationRequested(); + Thread.Sleep(100); + } + } + } + } + + public class CancellableRequestTests + { + ServiceStackHost appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new CancellableRequestAppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public async Task Can_Cancel_long_running_request() + { + var tag = Guid.NewGuid().ToString(); + var client = new JsonServiceClient(Config.AbsoluteBaseUri) { + RequestFilter = req => req.Headers[HttpHeaders.XTag] = tag + }; + + var responseTask = client.PostAsync(new TestCancelRequest + { + Tag = tag + }); + + await Task.Delay(1000); + + var cancelResponse = client.Post(new CancelRequest { Tag = tag }); + Assert.That(cancelResponse.Tag, Is.EqualTo(tag)); + + try + { + var response = await responseTask; + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(OperationCanceledException).Name)); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CompressResponseTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CompressResponseTests.cs new file mode 100644 index 00000000000..e63af7dd29c --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CompressResponseTests.cs @@ -0,0 +1,355 @@ +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Text; +using ServiceStack.VirtualPath; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class CompressData : IReturn + { + public string String { get; set; } + public byte[] Bytes { get; set; } + } + + public class CompressString : IReturn + { + public string String { get; set; } + } + + public class CompressBytes : IReturn + { + public byte[] Bytes { get; set; } + } + + [Route("/compress/{Path*}")] + public class CompressFile + { + public string Path { get; set; } + } + + public class CompressError : IReturn { } + + [Route("/compress/dto-result/{Name}")] + public class CompressDtoResult : IReturn + { + public string Name { get; set; } + } + + [CompressResponse] + public class CompressedServices : Service + { + public object Any(CompressData request) => request; + public object Any(CompressString request) => request.String; + public object Any(CompressBytes request) => request.Bytes; + + public object Any(CompressFile request) + { + var file = VirtualFileSources.GetFile(request.Path); + if (file == null) + throw HttpError.NotFound($"{request.Path} does not exist"); + + return new HttpResult(file); + } + + public object Any(CompressDtoResult request) => new HttpResult(request, MimeTypes.Xml); + + public object Any(CompressError request) + { + throw HttpError.NotFound("Always NotFound"); + } + } + + public class CompressResponseTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(CompressResponseTests), typeof(CompressedServices).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + CompressFilesWithExtensions = { "html", "css" } + }); + } + + public override List GetVirtualFileSources() + { + var existingProviders = base.GetVirtualFileSources(); + var memFs = new MemoryVirtualFiles(); + + memFs.WriteFile("/file.js", "console.log('foo')"); + memFs.WriteFile("/file.css", ".foo{}"); + memFs.WriteFile("/file.txt", "foo"); + memFs.WriteFile("/default.html", "foo"); + + //Give new Memory FS highest priority + existingProviders.Insert(0, memFs); + return existingProviders; + } + } + + private ServiceStackHost appHost; + + public CompressResponseTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Does_compress_RequestDto_responses() + { + var client = new JsonServiceClient(Config.ListeningOn); + var response = client.Post(new CompressData + { + String = "Hello", + Bytes = "World".ToUtf8Bytes() + }); + + Assert.That(response.String, Is.EqualTo("Hello")); + Assert.That(response.Bytes, Is.EqualTo("World".ToUtf8Bytes())); + } + + [Test] + public async Task Does_compress_RequestDto_responses_HttpClient() + { + var client = new JsonHttpClient(Config.ListeningOn); + var response = await client.PostAsync(new CompressData + { + String = "Hello", + Bytes = "World".ToUtf8Bytes() + }); + + Assert.That(response.String, Is.EqualTo("Hello")); + Assert.That(response.Bytes, Is.EqualTo("World".ToUtf8Bytes())); + } + + [Test] + public void Does_compress_raw_String_responses() + { + var client = new JsonServiceClient(Config.ListeningOn); + var response = client.Post(new CompressString + { + String = "foo", + }); + + Assert.That(response, Is.EqualTo("foo")); + } + + [Test] + public async Task Does_compress_raw_String_responses_HttpClient() + { + var client = new JsonHttpClient(Config.ListeningOn); + var response = await client.PostAsync(new CompressString + { + String = "foo", + }); + + Assert.That(response, Is.EqualTo("foo")); + } + + [Test] + public void Does_compress_raw_Bytes_responses() + { + var client = new JsonServiceClient(Config.ListeningOn); + var response = client.Post(new CompressBytes + { + Bytes = "foo".ToUtf8Bytes(), + }); + + Assert.That(response, Is.EquivalentTo("foo".ToUtf8Bytes())); + } + + [Test] + public async Task Does_compress_raw_Bytes_responses_HttpClient() + { + var client = new JsonHttpClient(Config.ListeningOn); + var response = await client.PostAsync(new CompressBytes + { + Bytes = "foo".ToUtf8Bytes(), + }); + + Assert.That(response, Is.EquivalentTo("foo".ToUtf8Bytes())); + } + + [Test] + public void Does_not_compress_error_responses() + { + var client = new JsonServiceClient(Config.ListeningOn); + + try + { + client.Post(new CompressError()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(404)); + Assert.That(ex.ErrorCode, Is.EqualTo("NotFound")); + Assert.That(ex.ErrorMessage, Is.EqualTo("Always NotFound")); + } + } + + [Test] + public async Task Does_not_compress_error_responses_HttpClient() + { + var client = new JsonHttpClient(Config.ListeningOn); + + try + { + await client.PostAsync(new CompressError()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(404)); + Assert.That(ex.ErrorCode, Is.EqualTo("NotFound")); + Assert.That(ex.ErrorMessage, Is.EqualTo("Always NotFound")); + } + } + + [Test] + public void Does_compress_using_ContenType_in_HttpResult() + { + var url = Config.ListeningOn.CombineWith(new CompressDtoResult { Name = "foo" }.ToGetUrl()); + + var xml = url.GetJsonFromUrl(responseFilter: res => + { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Xml)); + }); + + Assert.That(xml, Does.StartWith(" + { + Assert.That(res.ContentType, Does.StartWith(MimeTypes.Xml)); + }); + + Assert.That(xml, Does.StartWith(" + { + req.AutomaticDecompression = DecompressionMethods.None; + req.Headers[HttpRequestHeader.AcceptEncoding] = "deflate"; + }, responseFilter: res => + { + Assert.That(res.Headers[HttpResponseHeader.ContentEncoding], Is.EqualTo("deflate")); + }); + + var bytes = zipBytes.DecompressBytes("deflate"); + Assert.That(bytes.FromUtf8Bytes(), Is.EqualTo("console.log('foo')")); + } + + [Test] + public async Task Does_compress_file_returned_in_HttpResult_Async() + { + var url = Config.ListeningOn.CombineWith("/compress/file.js"); + var zipBytes = await url.GetBytesFromUrlAsync( + requestFilter: req => + { + req.AutomaticDecompression = DecompressionMethods.None; + req.Headers[HttpRequestHeader.AcceptEncoding] = "deflate"; + }, responseFilter: res => + { + Assert.That(res.Headers[HttpResponseHeader.ContentEncoding], Is.EqualTo("deflate")); + }); + + var bytes = zipBytes.DecompressBytes("deflate"); + Assert.That(bytes.FromUtf8Bytes(), Is.EqualTo("console.log('foo')")); + } + + [Test] + public void Does_compress_static_file_in_CompressFilesWithExtensions() + { + var url = Config.ListeningOn.CombineWith("/file.css"); + var zipBytes = url.GetBytesFromUrl( + requestFilter: req => + { + req.AutomaticDecompression = DecompressionMethods.None; + req.Headers[HttpRequestHeader.AcceptEncoding] = "deflate"; + }, responseFilter: res => + { + Assert.That(res.Headers[HttpResponseHeader.ContentEncoding], Is.EqualTo("deflate")); + }); + + var bytes = zipBytes.DecompressBytes("deflate"); + Assert.That(bytes.FromUtf8Bytes(), Is.EqualTo(".foo{}")); + } + + [Test] + public async Task Does_compress_static_file_in_CompressFilesWithExtensions_Async() + { + var url = Config.ListeningOn.CombineWith("/file.css"); + var zipBytes = await url.GetBytesFromUrlAsync( + requestFilter: req => + { + req.AutomaticDecompression = DecompressionMethods.None; + req.Headers[HttpRequestHeader.AcceptEncoding] = "deflate"; + }, responseFilter: res => + { + Assert.That(res.Headers[HttpResponseHeader.ContentEncoding], Is.EqualTo("deflate")); + }); + + var bytes = zipBytes.DecompressBytes("deflate"); + Assert.That(bytes.FromUtf8Bytes(), Is.EqualTo(".foo{}")); + } + + [Test] + public void Does_compress_default_page_in_CompressFilesWithExtensions() + { + var url = Config.ListeningOn.CombineWith("/default.html"); + var zipBytes = url.GetBytesFromUrl( + requestFilter: req => + { + req.AutomaticDecompression = DecompressionMethods.None; + req.Headers[HttpRequestHeader.AcceptEncoding] = "deflate"; + }, responseFilter: res => + { + Assert.That(res.Headers[HttpResponseHeader.ContentEncoding], Is.EqualTo("deflate")); + }); + + var bytes = zipBytes.DecompressBytes("deflate"); + Assert.That(bytes.FromUtf8Bytes(), Is.EqualTo("foo")); + } + + [Test] + public async Task Does_compress_default_page_in_CompressFilesWithExtensions_Async() + { + var url = Config.ListeningOn.CombineWith("/default.html"); + var zipBytes = await url.GetBytesFromUrlAsync( + requestFilter: req => + { + req.AutomaticDecompression = DecompressionMethods.None; + req.Headers[HttpRequestHeader.AcceptEncoding] = "deflate"; + }, responseFilter: res => + { + Assert.That(res.Headers[HttpResponseHeader.ContentEncoding], Is.EqualTo("deflate")); + }); + + var bytes = zipBytes.DecompressBytes("deflate"); + Assert.That(bytes.FromUtf8Bytes(), Is.EqualTo("foo")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CompressionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CompressionTests.cs index e43c229f9c8..944fe983d3b 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CompressionTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CompressionTests.cs @@ -38,6 +38,12 @@ public class CompressionTests { private static readonly ILog Log = LogManager.GetLogger(typeof(CompressionTests)); + [OneTimeSetUp] + public void Init() + { + LogManager.LogFactory = null; + } + [Test] public void Can_compress_and_decompress_SimpleDto() { @@ -75,8 +81,9 @@ public void Test_response_with_CompressedResult() var simpleDtoXml = DataContractSerializer.Instance.SerializeToString(simpleDto); const string expectedXml = "1name"; + const string expectedXmlNetCore = "1name"; - Assert.That(simpleDtoXml, Is.EqualTo(expectedXml)); + Assert.That(simpleDtoXml, Is.EqualTo(expectedXml).Or.EqualTo(expectedXmlNetCore)); var simpleDtoZip = simpleDtoXml.Deflate(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ConcurrencyTest.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ConcurrencyTest.cs new file mode 100644 index 00000000000..d4c2a60bd86 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ConcurrencyTest.cs @@ -0,0 +1,117 @@ +using System; +using System.Diagnostics; +using System.Threading; +using Funq; +using NUnit.Framework; +using ServiceStack.Logging; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class SleepTest : IReturn + { + public string Name { get; set; } + public int WaitingSecs { get; set; } + } + + public class SleepTestResponse + { + public string Message { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class TestConcurrencyService : Service + { + public object Any(SleepTest request) + { + var sw = Stopwatch.StartNew(); + + Thread.Sleep(TimeSpan.FromSeconds(request.WaitingSecs)); + + return new SleepTestResponse + { + Message = $"{request.Name} took {sw.Elapsed.TotalSeconds} secs", + }; + } + } + + [Ignore("Comment out to run load test")] + public class ConcurrencyTest + { + private static ILog log; + private readonly ServiceStackHost appHost; + + public ConcurrencyTest() + { + LogManager.LogFactory = new ConsoleLogFactory(); + log = LogManager.GetLogger(typeof(ConcurrencyTest)); + + appHost = new AppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + public class AppHost : AppHostHttpListenerPoolBase + { + public AppHost() : base("Server", 500, typeof(TestConcurrencyService).Assembly) {} + + public override void Configure(Container container) + { + } + } + + [Test] + public void Does_handle_concurrent_requests() + { + var rand = new Random(); + var client = new JsonHttpClient(Config.AbsoluteBaseUri); + client.GetHttpClient().Timeout = TimeSpan.FromMinutes(5); + long responsesReceived = 0; + long totalSecondsWaited = 0; + var sw = Stopwatch.StartNew(); + const int ConcurrentRequests = 50; + + ConcurrentRequests.Times(i => + { + Interlocked.Increment(ref responsesReceived); + + ThreadPool.QueueUserWorkItem(async _ => + { + var request = new SleepTest + { + Name = $"Request {i+1}", + WaitingSecs = rand.Next(30, 60), + }; + Interlocked.Add(ref totalSecondsWaited, request.WaitingSecs); + + log.Info($"[{DateTime.Now.TimeOfDay}] Sending {request.Name} to sleep for {request.WaitingSecs} seconds..."); + + try + { + var response = await client.GetAsync(request); + + log.Info($"[{DateTime.Now.TimeOfDay}] Received {request.Name}: {response.Message}"); + } + catch (Exception ex) + { + log.Error($"[{DateTime.Now.TimeOfDay}] Error Response: {ex.UnwrapIfSingleException().Message}", ex); + } + finally + { + Interlocked.Decrement(ref responsesReceived); + } + }); + }); + + while (Interlocked.Read(ref responsesReceived) > 0) + { + Thread.Sleep(10); + } + + log.Info($"Took {sw.Elapsed.TotalSeconds} to execute {ConcurrentRequests} Concurrent Requests waiting a total of {totalSecondsWaited} seconds."); + } + } +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Config.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Config.cs index 47571a6af5e..ec4ed4fe2aa 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Config.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Config.cs @@ -1,10 +1,20 @@ -namespace ServiceStack.WebHost.Endpoints.Tests +using System; + +namespace ServiceStack.WebHost.Endpoints.Tests { - public class Config - { - public const string ServiceStackBaseUri = "http://localhost:20000"; - public const string AbsoluteBaseUri = ServiceStackBaseUri + "/"; - public const string ListeningOn = ServiceStackBaseUri + "/"; + public class Config + { + public static readonly string ServiceStackBaseUri = Environment.GetEnvironmentVariable("CI_BASEURI") ?? "http://localhost:20000"; + public static readonly string AbsoluteBaseUri = ServiceStackBaseUri + "/"; + + public static readonly string HostNameBaseUrl = "http://DESKTOP-BCS76J0:20000/"; //Allow fiddler + public static readonly string AnyHostBaseUrl = "http://*:20000/"; //Allow capturing by fiddler + + public static readonly string ListeningOn = ServiceStackBaseUri + "/"; + public static readonly string RabbitMQConnString = Environment.GetEnvironmentVariable("CI_RABBITMQ") ?? "localhost"; + public static readonly string SqlServerConnString = Environment.GetEnvironmentVariable("MSSQL_CONNECTION") ?? "Server=localhost;Database=test;User Id=test;Password=test;"; + public static readonly string PostgreSqlConnString = Environment.GetEnvironmentVariable("PGSQL_CONNECTION") ?? "Server=localhost;Port=5432;User Id=test;Password=test;Database=test;Pooling=true;MinPoolSize=0;MaxPoolSize=200"; + public static readonly string DynamoDbServiceURL = Environment.GetEnvironmentVariable("CI_DYNAMODB") ?? "http://localhost:8000"; public const string AspNetBaseUri = "http://localhost:50000/"; public const string AspNetServiceStackBaseUri = AspNetBaseUri + "api"; diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ContainerTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ContainerTests.cs new file mode 100644 index 00000000000..1b038e949c4 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ContainerTests.cs @@ -0,0 +1,278 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + class SimpleContainerTests : ContainerTests + { + protected override IContainer CreateContainer() + { + return new SimpleContainer(); + } + } + + class FunqContainerTests : ContainerTests + { + protected override IContainer CreateContainer() + { + return new Funq.Container(); + } + + [Test] + public void Does_use_native_Exists_method() + { + var container = new Funq.Container(); + + container.AddTransient(() => new Foo()); + + Assert.That(container.Exists(typeof(IFoo))); + Assert.That(container.Exists()); + + Assert.That(!container.Exists(typeof(Foo))); + Assert.That(!container.Exists()); + } + } + + public abstract class ContainerTests + { + protected abstract IContainer CreateContainer(); + + public class Foo : IFoo + { + } + + public class Foo2 : IFoo + { + } + + public interface IFoo + { + } + + public class Bar : IBar + { + } + + public class Bar2 : IBar + { + } + + public interface IBar + { + } + + public class Test + { + public IFoo Foo { get; set; } + public IBar Bar { get; set; } + public Foo2 Foo2 { get; set; } + public IEnumerable Names { get; set; } + public int Age { get; set; } + public string Name { get; set; } + + public Test() + { + this.Age = 27; + this.Name = "foo"; + this.Names = new List { "bar" }; + } + } + + public class TestCtor + { + public IFoo Foo; + public Foo2 Foo2; + public IBar Bar { get; set; } + + public TestCtor(IFoo foo, Foo2 foo2) + { + Foo = foo; + Foo2 = foo2; + } + } + + [Test] + public void Does_not_throw_when_registering_null_dependency() + { + var container = new Funq.Container(); + container.Register((IFoo) new Foo()); + Assert.That(container.TryResolve() != null); + container.Register((IFoo) null); + Assert.That(container.TryResolve() == null); + } + + [Test] + public void Can_register_transient() + { + var container = CreateContainer(); + + container.AddTransient(() => new Test()); + + var instance = container.Resolve(typeof(Test)); + Assert.That(instance, Is.Not.Null); + Assert.That(container.Resolve(typeof(Test)), Is.Not.EqualTo(instance)); + + container.AddTransient(() => new Foo()); + var foo = container.Resolve(); + Assert.That(foo, Is.Not.Null); + Assert.That(container.Resolve(), Is.Not.EqualTo(foo)); + + container.AddTransient(() => new Foo()); + var ifoo = container.Resolve(); + Assert.That(ifoo, Is.Not.Null); + Assert.That(container.Resolve(), Is.Not.EqualTo(ifoo)); + } + + [Test] + public void Can_register_singleton() + { + var container = CreateContainer(); + + container.AddSingleton(() => new Test()); + + var instance = container.Resolve(typeof(Test)); + Assert.That(instance, Is.Not.Null); + Assert.That(container.Resolve(typeof(Test)), Is.EqualTo(instance)); + + container.AddSingleton(() => new Foo()); + var foo = container.Resolve(); + Assert.That(foo, Is.Not.Null); + Assert.That(container.Resolve(), Is.EqualTo(foo)); + + container.AddSingleton(() => new Foo()); + var ifoo = container.Resolve(); + Assert.That(ifoo, Is.Not.Null); + Assert.That(container.Resolve(), Is.EqualTo(ifoo)); + } + + [Test] + public void Can_register_Autowired_Transient() + { + var container = CreateContainer(); + + container.AddTransient(() => new Foo()); + container.AddTransient(() => new Bar()); + container.AddTransient(() => new Foo2()); + + //Should not be autowired + container.AddTransient(() => "Replaced String"); + container.AddTransient(() => 99); + + container.AddTransient(); + + var instance1 = container.Resolve(); + var instance2 = container.Resolve(); + + Assert.That(instance1, Is.Not.Null); + Assert.That(instance1.Foo, Is.Not.Null); + Assert.That(instance1.Bar, Is.Not.Null); + Assert.That(instance1.Foo2, Is.Not.Null); + Assert.That(instance1.Age, Is.EqualTo(27)); + Assert.That(instance1.Name, Is.EqualTo("foo")); + Assert.That(instance1.Names, Is.Null); //overridden + + Assert.That(instance1, Is.Not.EqualTo(instance2)); + Assert.That(instance1.Foo, Is.Not.EqualTo(instance2.Foo)); + Assert.That(instance1.Bar, Is.Not.EqualTo(instance2.Bar)); + Assert.That(instance1.Foo2, Is.Not.EqualTo(instance2.Foo2)); + } + + [Test] + public void Can_register_Autowired_Singleton() + { + var container = CreateContainer(); + + container.AddSingleton(() => new Foo()); + container.AddSingleton(() => new Bar()); + container.AddSingleton(() => new Foo2()); + + //Should not be autowired + container.AddSingleton(() => "Replaced String"); + container.AddSingleton(() => 99); + + container.AddSingleton(); + + var instance1 = container.Resolve(); + var instance2 = container.Resolve(); + + Assert.That(instance1, Is.Not.Null); + Assert.That(instance1.Foo, Is.Not.Null); + Assert.That(instance1.Bar, Is.Not.Null); + Assert.That(instance1.Foo2, Is.Not.Null); + Assert.That(instance1.Age, Is.EqualTo(27)); + Assert.That(instance1.Name, Is.EqualTo("foo")); + Assert.That(instance1.Names, Is.Null); //overridden + + Assert.That(instance1, Is.EqualTo(instance2)); + Assert.That(instance1.Foo, Is.EqualTo(instance2.Foo)); + Assert.That(instance1.Bar, Is.EqualTo(instance2.Bar)); + Assert.That(instance1.Foo2, Is.EqualTo(instance2.Foo2)); + } + + [Test] + public void Resolve_does_use_ctor_and_property_injection() + { + var container = CreateContainer(); + + container.AddTransient(() => new Foo()); + container.AddTransient(() => new Bar()); + container.AddTransient(() => new Foo2()); + + container.AddTransient(); + + var instance = container.Resolve(); + + Assert.That(instance.Foo, Is.Not.Null); + Assert.That(instance.Foo2, Is.Not.Null); + Assert.That(instance.Bar, Is.Not.Null); + } + + [Test] + public void Missing_ctor_dependency_should_throw() + { + var container = CreateContainer(); + + container.AddTransient(() => new Foo()); + container.AddTransient(() => new Bar()); + + container.AddTransient(); + + try + { + var instance = container.Resolve(); + Assert.Fail("Should throw"); + } + catch (Exception e) + { + e.ToString().Print(); + } + + try + { + var instance = container.Resolve(typeof(TestCtor)); + Assert.Fail("Should throw"); + } + catch (Exception e) + { + e.ToString().Print(); + } + } + + [Test] + public void Can_use_exists() + { + var container = CreateContainer(); + + container.AddTransient(() => new Foo()); + + Assert.That(container.Exists(typeof(IFoo))); + Assert.That(container.Exists()); + + Assert.That(!container.Exists(typeof(Foo))); + Assert.That(!container.Exists()); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ContentTypeDisabledTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ContentTypeDisabledTests.cs new file mode 100644 index 00000000000..01b120b29ad --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ContentTypeDisabledTests.cs @@ -0,0 +1,86 @@ +using System; +using System.Net; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class ContentTypeDisabledTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(ContentTypeDisabledTests), typeof(TestContentTypeService).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig { + EnableFeatures = Feature.All.Remove(Feature.Xml | Feature.Csv | Feature.Jsv | Feature.Soap), + DefaultContentType = MimeTypes.Json, + }); + } + } + + private readonly ServiceStackHost appHost; + + public ContentTypeDisabledTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Disabling_XML_ContentType_fallbacks_to_DefaultContentType() + { + var json = Config.ListeningOn.AppendPath("testcontenttype") + .GetStringFromUrl( + requestFilter: req => { + req.Accept = "text/xml,*/*"; + }, + responseFilter: res => { + Assert.That(res.ContentType.MatchesContentType(MimeTypes.Json)); + }); + } + + [Test] + public void Requesting_only_disabled_ContentType_returns_Forbidden_response() + { + try + { + Config.ListeningOn.AppendPath("testcontenttype") + .GetStringFromUrl(requestFilter: req => req.Accept = "text/xml"); + } + catch (WebException ex) + { + Assert.That(ex.GetStatus(), Is.EqualTo(403)); + } + } + + [Test] + public void Disabling_XML_ContentType_prevents_posting_XML() + { + var client = new XmlServiceClient(Config.ListeningOn); + + try + { + client.Post(new TestContentType { Id = 1 }); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(403)); + Assert.That(ex.StatusDescription, Is.EqualTo(nameof(HttpStatusCode.Forbidden))); + } + } + + [Test] + public void Can_use_JSON_when_other_default_ContentTypes_are_removed() + { + var client = new JsonServiceClient(Config.ListeningOn); + var response = client.Post(new TestContentType { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ContentTypeRouteTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ContentTypeRouteTests.cs new file mode 100644 index 00000000000..a7b06af2dda --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ContentTypeRouteTests.cs @@ -0,0 +1,105 @@ +using Funq; +using NUnit.Framework; +using ServiceStack.DataAnnotations; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [ExcludeMetadata] + [Route("/content/{Id}")] + public class ContentRoute + { + public int Id { get; set; } + } + + public class ContentRouteService : Service + { + public object Any(ContentRoute request) + { + return request; + } + + public object GetJson(ContentRoute request) + { + request.Id++; + return request; + } + + public object AnyHtml(ContentRoute request) + { + return $@" + + +

        AnyHtml {request.Id}

        + +"; + } + + public object GetHtml(ContentRoute request) + { + return $@" + + +

        GetHtml {request.Id}

        + +"; + } + } + + public class ContentTypeRouteTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ContentTypeRouteTests), typeof(ContentRouteService).Assembly) { } + + public override void Configure(Container container) {} + } + + private readonly ServiceStackHost appHost; + public ContentTypeRouteTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void GET_Html_Request_calls_GetHtml() + { + var html = Config.ListeningOn.CombineWith("/content/1") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.That(html, Does.Contain("

        GetHtml 1

        ")); + } + + [Test] + public void POST_Html_Request_calls_AnyHtml() + { + var html = Config.ListeningOn.CombineWith("/content/1") + .PostStringToUrl(accept: MimeTypes.Html, requestBody: ""); + + Assert.That(html, Does.Contain("

        AnyHtml 1

        ")); + } + + [Test] + public void GET_JSON_Request_calls_GetJson() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var response = client.Get(new ContentRoute { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1 + 1)); + } + + [Test] + public void POST_JSON_Request_calls_Any() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var response = client.Post(new ContentRoute { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ContentTypeTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ContentTypeTests.cs new file mode 100644 index 00000000000..96b93f6c29e --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ContentTypeTests.cs @@ -0,0 +1,119 @@ +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Text; +using ServiceStack.WebHost.Endpoints.Tests.Support.Host; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Route("/testcontenttype")] + public class TestContentType : IReturn + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class TestContentTypeService : Service + { + public object Any(TestContentType request) + { + return request; + } + } + + + [TestFixture] + public class ContentTypeTests + { + private const string ListeningOn = "http://localhost:1337/"; + + ExampleAppHostHttpListener appHost; + readonly JsonServiceClient client = new JsonServiceClient(ListeningOn); + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new ExampleAppHostHttpListener(); + appHost.Init(); + appHost.Start(ListeningOn); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Does_return_JSON() + { + var json = ListeningOn.AppendPath("testcontenttype") + .AddQueryParam("id", 1) + .GetStringFromUrl(accept: MimeTypes.Json, + responseFilter: res => + Assert.That(res.ContentType.MatchesContentType(MimeTypes.Json))); + + var dto = json.FromJson(); + Assert.That(dto.Id, Is.EqualTo(1)); + } + + [Test] + public void Does_return_JSON_UpperCase() + { + var json = ListeningOn.AppendPath("testcontenttype") + .AddQueryParam("id", 1) + .GetStringFromUrl(accept: MimeTypes.Json.ToUpper(), + responseFilter: res => + Assert.That(res.ContentType.MatchesContentType(MimeTypes.Json))); + + var dto = json.FromJson(); + Assert.That(dto.Id, Is.EqualTo(1)); + } + + [Test] + public void Does_return_JSON_extension() + { + var json = ListeningOn.AppendPath("testcontenttype.json") + .AddQueryParam("id", 1) + .GetStringFromUrl(responseFilter: res => + Assert.That(res.ContentType.MatchesContentType(MimeTypes.Json))); + + var dto = json.FromJson(); + Assert.That(dto.Id, Is.EqualTo(1)); + } + + [Test] + public void Does_return_JSON_format() + { + var json = ListeningOn.AppendPath("testcontenttype") + .AddQueryParam("id", 1) + .AddQueryParam("format", "json") + .GetStringFromUrl(responseFilter: res => + Assert.That(res.ContentType.MatchesContentType(MimeTypes.Json))); + + var dto = json.FromJson(); + Assert.That(dto.Id, Is.EqualTo(1)); + } + + [Test] + public void Can_call_JSON_Service_with_UTF8_BOM() + { + var dto = new TestContentType { Id = 1, Name = "Foo" }; + var json = dto.ToJson(); + var jsonBytes = json.ToUtf8Bytes(); + + var bytes = new List(new byte[] { 0xEF, 0xBB, 0xBF }); + bytes.AddRange(jsonBytes); + + var mergedBytes = bytes.ToArray(); + + var responseBytes = ListeningOn.AppendPath("testcontenttype") + .PostBytesToUrl(mergedBytes, contentType: MimeTypes.Json); + + var responseJson = responseBytes.FromUtf8Bytes(); + var fromJson = responseJson.FromJson(); + + Assert.That(fromJson.Id, Is.EqualTo(dto.Id)); + Assert.That(fromJson.Name, Is.EqualTo(dto.Name)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CorsFeaturePluginTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CorsFeaturePluginTests.cs index 2af4f8557a5..e808bf59e0d 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CorsFeaturePluginTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CorsFeaturePluginTests.cs @@ -18,7 +18,6 @@ public object Any(CorsFeaturePlugin request) } } - //[Explicit] [TestFixture] public class CorsFeaturePluginTests { @@ -36,7 +35,7 @@ public override void Configure(Funq.Container container) ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new CorsFeaturePluginAppHostHttpListener() @@ -44,7 +43,7 @@ public void OnTestFixtureSetUp() .Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -55,9 +54,9 @@ public void Can_Get_CORS_Headers_with_non_matching_OPTIONS_Request() { "{0}/corsplugin".Fmt(Config.ServiceStackBaseUri).OptionsFromUrl(responseFilter: r => { - Assert.That(r.Headers[HttpHeaders.AllowOrigin], Is.EqualTo("*")); - Assert.That(r.Headers[HttpHeaders.AllowMethods], Is.EqualTo("GET, POST, PUT, DELETE, OPTIONS")); - Assert.That(r.Headers[HttpHeaders.AllowHeaders], Is.EqualTo("Content-Type")); + Assert.That(r.Headers[HttpHeaders.AllowOrigin], Is.EqualTo(CorsFeature.DefaultOrigin)); + Assert.That(r.Headers[HttpHeaders.AllowMethods], Is.EqualTo(CorsFeature.DefaultMethods)); + Assert.That(r.Headers[HttpHeaders.AllowHeaders], Is.EqualTo(CorsFeature.DefaultHeaders)); }); } @@ -66,9 +65,9 @@ public void Can_Get_CORS_Headers_with_not_found_OPTIONS_Request() { "{0}/notfound".Fmt(Config.ServiceStackBaseUri).OptionsFromUrl(responseFilter: r => { - Assert.That(r.Headers[HttpHeaders.AllowOrigin], Is.EqualTo("*")); - Assert.That(r.Headers[HttpHeaders.AllowMethods], Is.EqualTo("GET, POST, PUT, DELETE, OPTIONS")); - Assert.That(r.Headers[HttpHeaders.AllowHeaders], Is.EqualTo("Content-Type")); + Assert.That(r.Headers[HttpHeaders.AllowOrigin], Is.EqualTo(CorsFeature.DefaultOrigin)); + Assert.That(r.Headers[HttpHeaders.AllowMethods], Is.EqualTo(CorsFeature.DefaultMethods)); + Assert.That(r.Headers[HttpHeaders.AllowHeaders], Is.EqualTo(CorsFeature.DefaultHeaders)); }); } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CorsFeatureTest.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CorsFeatureTest.cs index a8bd528fc21..45d8fa176ef 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CorsFeatureTest.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CorsFeatureTest.cs @@ -53,7 +53,7 @@ public override void Configure(Funq.Container container) {} ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new CorsFeatureAppHostHttpListener() @@ -61,7 +61,7 @@ public void OnTestFixtureSetUp() .Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -74,7 +74,7 @@ public void OnTestFixtureTearDown() new JsvServiceClient(Config.AbsoluteBaseUri) }; - [Test, Explicit] + [Ignore("Debug Only")] public void RunFor5Mins() { Thread.Sleep(TimeSpan.FromMinutes(5)); @@ -92,16 +92,16 @@ public void CorsMethodHasAccessControlHeaders(IRestClient client) Assert.That(response[HttpHeaders.AllowCredentials], Is.EqualTo("true")); } - [Test, TestCaseSource("RestClients")] - public void GlobalCorsHasAccessControlHeaders(IRestClient client) + [Test] + public void GlobalCorsHasAccessControlHeaders() { appHost.LoadPlugin(new CorsFeature { AutoHandleOptionsRequests = false }); var response = RequestContextTests.GetResponseHeaders(Config.ServiceStackBaseUri + "/globalcorsfeature"); - Assert.That(response[HttpHeaders.AllowOrigin], Is.EqualTo("*")); - Assert.That(response[HttpHeaders.AllowMethods], Is.EqualTo("GET, POST, PUT, DELETE, OPTIONS")); + Assert.That(response[HttpHeaders.AllowOrigin], Is.EqualTo(CorsFeature.DefaultOrigin)); + Assert.That(response[HttpHeaders.AllowMethods], Is.EqualTo(CorsFeature.DefaultMethods)); Assert.False(response.ContainsKey(HttpHeaders.AllowCredentials)); - Assert.That(response[HttpHeaders.AllowHeaders], Is.EqualTo("Content-Type")); + Assert.That(response[HttpHeaders.AllowHeaders], Is.EqualTo(CorsFeature.DefaultHeaders)); } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CsvContentTypeFilterTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CsvContentTypeFilterTests.cs index e92ad7c3b3b..00d2d413f9f 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CsvContentTypeFilterTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CsvContentTypeFilterTests.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Net; using System.Threading; +using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.Common; using ServiceStack.Text; @@ -11,164 +12,153 @@ namespace ServiceStack.WebHost.Endpoints.Tests { - [TestFixture] - public class CsvContentTypeFilterTests - { - const int HeaderRowCount = 1; - private const string ListeningOn = "http://localhost:1182/"; - - ExampleAppHostHttpListener appHost; - - [TestFixtureSetUp] - public void OnTestFixtureSetUp() - { - appHost = new ExampleAppHostHttpListener(); - appHost.Init(); - appHost.Start(ListeningOn); - } - - [TestFixtureTearDown] - public void OnTestFixtureTearDown() - { - appHost.Dispose(); - } - - [Test] - [Explicit("Helps debugging when you need to find out WTF is going on")] - public void Run_for_30secs() - { - Thread.Sleep(30000); - } - - private static void FailOnAsyncError(T response, Exception ex) - { - Assert.Fail(ex.Message); - } - - [Test] - public void Can_Serialize_Movies_Dto() - { - var csv = CsvSerializer.SerializeToString(ResetMoviesService.Top5Movies); - var csvRows = csv.Split('\n').Where(x => !x.IsNullOrEmpty()).ToArray(); - Assert.That(csvRows.Length, Is.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); - } - - [Test] - public void Can_Serialize_MovieResponse_Dto() - { - var request = new MovieResponse { Movie = ResetMoviesService.Top5Movies[0] }; - var csv = CsvSerializer.SerializeToString(request); - var csvRows = csv.Split('\n').Where(x => !x.IsNullOrEmpty()).ToArray(); - Assert.That(csvRows.Length, Is.EqualTo(HeaderRowCount + 1)); - } - - [Test] - public void Can_Serialize_MoviesResponse_Dto() - { - var request = new MoviesResponse { Movies = ResetMoviesService.Top5Movies }; - var csv = CsvSerializer.SerializeToString(request); - var csvRows = csv.Split('\n').Where(x => !x.IsNullOrEmpty()).ToArray(); - Assert.That(csvRows.Length, Is.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); - } - - [Test][Ignore("Fails because CSV Deserializer is not implemented")] - public void Can_download_movies_in_Csv() - { - var asyncClient = new AsyncServiceClient - { - ContentType = MimeTypes.Csv, - StreamSerializer = (r,o,s) => CsvSerializer.SerializeToStream(o,s), - StreamDeserializer = CsvSerializer.DeserializeFromStream, - }; - - MoviesResponse response = null; - asyncClient.SendAsync(HttpMethods.Get, ListeningOn + "movies", null, - r => response = r, FailOnAsyncError); - - Thread.Sleep(1000); - - Assert.That(response, Is.Not.Null, "No response received"); - } - - [Test] - public void Can_download_CSV_movies_using_csv_reply_endpoint() - { + [TestFixture] + public class CsvContentTypeFilterTests + { + const int HeaderRowCount = 1; + private const string ListeningOn = "http://localhost:1182/"; + + ExampleAppHostHttpListener appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new ExampleAppHostHttpListener(); + appHost.Init(); + appHost.Start(ListeningOn); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + [Ignore("Helps debugging when you need to find out WTF is going on")] + public void Run_for_30secs() + { + Thread.Sleep(30000); + } + + private static void FailOnAsyncError(T response, Exception ex) + { + Assert.Fail(ex.Message); + } + + [Test] + public void Can_Serialize_Movies_Dto() + { + var csv = CsvSerializer.SerializeToString(ResetMoviesService.Top5Movies); + var csvRows = csv.Split('\n').Where(x => !x.IsNullOrEmpty()).ToArray(); + Assert.That(csvRows.Length, Is.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); + } + + [Test] + public void Can_Serialize_MovieResponse_Dto() + { + var request = new MovieResponse { Movie = ResetMoviesService.Top5Movies[0] }; + var csv = CsvSerializer.SerializeToString(request); + var csvRows = csv.Split('\n').Where(x => !x.IsNullOrEmpty()).ToArray(); + Assert.That(csvRows.Length, Is.EqualTo(HeaderRowCount + 1)); + } + + [Test] + public void Can_Serialize_MoviesResponse_Dto() + { + var request = new MoviesResponse { Movies = ResetMoviesService.Top5Movies }; + var csv = CsvSerializer.SerializeToString(request); + var csvRows = csv.Split('\n').Where(x => !x.IsNullOrEmpty()).ToArray(); + Assert.That(csvRows.Length, Is.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); + } + + [Test] + public async Task Can_download_movies_in_Csv() + { + var client = new CsvServiceClient(ListeningOn); + + var response = await client.GetAsync(new Movies()); + + Assert.That(response, Is.Not.Null, "No response received"); + } + + [Test] + public void Can_download_CSV_movies_using_csv_reply_endpoint() + { var req = (HttpWebRequest)WebRequest.Create(ListeningOn + "csv/reply/Movies"); - - var res = req.GetResponse(); + + var res = req.GetResponse(); Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Console.WriteLine(res.Headers); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Movies.csv")); + Console.WriteLine(res.Headers); + Assert.That(res.Headers[HttpHeaders.ContentDisposition].Replace("; ", ";"), Is.EqualTo("attachment;filename=\"Movies.csv\"")); var csvRows = res.ReadLines().ToList(); - const int headerRowCount = 1; - Assert.That(csvRows, Has.Count.EqualTo(headerRowCount + ResetMoviesService.Top5Movies.Count)); - //Console.WriteLine(csvRows.Join("\n")); - } + const int headerRowCount = 1; + Assert.That(csvRows, Has.Count.EqualTo(headerRowCount + ResetMoviesService.Top5Movies.Count)); + //Console.WriteLine(csvRows.Join("\n")); + } - [Test] - public void Can_download_CSV_movies_using_csv_Accept_and_RestPath() - { - var req = (HttpWebRequest)WebRequest.Create(ListeningOn + "all-movies"); + [Test] + public void Can_download_CSV_movies_using_csv_Accept_and_RestPath() + { + var req = (HttpWebRequest)WebRequest.Create(ListeningOn + "all-movies"); req.Accept = MimeTypes.Csv; - var res = req.GetResponse(); + var res = req.GetResponse(); Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Movies.csv")); + Assert.That(res.Headers[HttpHeaders.ContentDisposition].Replace("; ", ";"), Is.EqualTo("attachment;filename=\"Movies.csv\"")); var csvRows = res.ReadLines().ToList(); - Assert.That(csvRows, Has.Count.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); - //Console.WriteLine(csvRows.Join("\n")); - } - - [Test] - public void Can_download_CSV_Hello_using_csv_reply_endpoint() - { - var req = (HttpWebRequest)WebRequest.Create(ListeningOn + "csv/reply/Hello?Name=World!"); - - var res = req.GetResponse(); - Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Hello.csv")); - - var csv = res.ReadToEnd(); - var lf = Environment.NewLine; - Assert.That(csv, Is.EqualTo("Result{0}\"Hello, World!\"{0}".Fmt(lf))); - - Console.WriteLine(csv); - } - - [Test] - public void Can_download_CSV_Hello_using_csv_Accept_and_RestPath() - { - var req = (HttpWebRequest)WebRequest.Create(ListeningOn + "hello/World!"); - req.Accept = MimeTypes.Csv; - - var res = req.GetResponse(); - Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Hello.csv")); - - var csv = res.ReadToEnd(); - var lf = Environment.NewLine; - Assert.That(csv, Is.EqualTo("Result{0}\"Hello, World!\"{0}".Fmt(lf))); - - Console.WriteLine(csv); - } - - [Test] - public void Can_download_CSV_movies_using_csv_reply_Path() - { - var req = (HttpWebRequest)WebRequest.Create(ListeningOn + "csv/reply/Movies"); - req.Accept = "application/xml"; - - var res = req.GetResponse(); + Assert.That(csvRows, Has.Count.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); + //Console.WriteLine(csvRows.Join("\n")); + } + + [Test] + public void Can_download_CSV_Hello_using_csv_reply_endpoint() + { + var req = (HttpWebRequest)WebRequest.Create(ListeningOn + "csv/reply/Hello?Name=World!"); + + var res = req.GetResponse(); + Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); + Assert.That(res.Headers[HttpHeaders.ContentDisposition].Replace("; ", ";"), Is.EqualTo("attachment;filename=\"Hello.csv\"")); + + var csv = res.ReadToEnd(); + Assert.That(csv, Is.EqualTo("Result\r\n\"Hello, World!\"\r\n")); + + Console.WriteLine(csv); + } + + [Test] + public void Can_download_CSV_Hello_using_csv_Accept_and_RestPath() + { + var req = (HttpWebRequest)WebRequest.Create(ListeningOn + "hello/World!"); + req.Accept = MimeTypes.Csv; + + var res = req.GetResponse(); + Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); + Assert.That(res.Headers[HttpHeaders.ContentDisposition].Replace("; ", ";"), Is.EqualTo("attachment;filename=\"Hello.csv\"")); + + var csv = res.ReadToEnd(); + Assert.That(csv, Is.EqualTo("Result\r\n\"Hello, World!\"\r\n")); + + Console.WriteLine(csv); + } + + [Test] + public void Can_download_CSV_movies_using_csv_reply_Path() + { + var req = (HttpWebRequest)WebRequest.Create(ListeningOn + "csv/reply/Movies"); + req.Accept = "application/xml"; + + var res = req.GetResponse(); Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Movies.csv")); + Assert.That(res.Headers[HttpHeaders.ContentDisposition].Replace("; ", ";"), Is.EqualTo("attachment;filename=\"Movies.csv\"")); var csvRows = res.ReadLines().ToList(); - Assert.That(csvRows, Has.Count.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); - } - } + Assert.That(csvRows, Has.Count.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); + } + } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CsvServiceClientTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CsvServiceClientTests.cs new file mode 100644 index 00000000000..85db0a522c4 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CsvServiceClientTests.cs @@ -0,0 +1,272 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public partial class CsvItem : IReturn + { + public int Id { get; set; } + public string Name { get; set; } + public List Ints { get; set; } + public List Strings { get; set; } + public List CsvPocos { get; set; } + public Dictionary CsvPocoMap { get; set; } + } + + public partial class CsvPoco + { + public int Id { get; set; } + public string Name { get; set; } + } + + + [Route("/csvlist")] + public class CsvList : List, IReturn + { + public CsvList() {} + public CsvList(IEnumerable collection) : base(collection) {} + } + + [Route("/csvfirst")] + [Csv(CsvBehavior.FirstEnumerable)] + public class CsvFirstEnumerable : IReturn + { + public int Id { get; set; } + public string Name { get; set; } + public List Items { get; set; } + } + + [Route("/csvdto")] + [DataContract] + public class CsvDtoEnumerable : IReturn + { + [DataMember] + public int Id { get; set; } + + [DataMember] + public string Name { get; set; } + + [DataMember] + public List Items { get; set; } + } + + public class CsvServices : Service + { + public object Any(CsvItem request) + { + return request; + } + + public object Any(CsvList request) + { + return request; + } + + public object Any(CsvFirstEnumerable request) + { + return request; + } + + public object Any(CsvDtoEnumerable request) + { + return request; + } + } + + [TestFixture] + public class CsvServiceClientTests + { + private readonly ServiceStackHost appHost; + class AppHost : AppSelfHostBase + { + public AppHost() : base(typeof(CsvServiceClientTests).Name, typeof(CsvServices).Assembly) {} + + public override void Configure(Container container) {} + } + + public CsvServiceClientTests() + { + appHost = new AppHost().Init().Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + CsvItem CreateCsvItem(int i) + { + return new CsvItem + { + Id = i, + Name = "Name" + i, + Ints = i.Times(x => x), + Strings = i.Times(x => "Name" + x), + CsvPocos = new List + { + new CsvPoco { Id = 10 + i, Name = "CsvPoco" + i }, + }, + CsvPocoMap = new Dictionary + { + { "Key" + i, new CsvPoco { Id = 10 + i, Name = "CsvPoco" + i } } + } + }; + } + + [Test] + public void Can_SendAll_CsvItem() + { + var client = new CsvServiceClient(Config.ListeningOn); + + var dtos = 3.Times(x => CreateCsvItem(x)); + + var response = client.SendAll(dtos); + Assert.That(response, Is.EquivalentTo(dtos)); + + response = Config.ListeningOn.CombineWith("csv/reply/CsvItem[]") + .PostCsvToUrl(dtos) + .FromCsv>(); + Assert.That(response, Is.EquivalentTo(dtos)); + } + + [Test] + public void Can_POST_CsvList() + { + var client = new CsvServiceClient(Config.ListeningOn); + + var dtos = 3.Times(x => CreateCsvItem(x)); + + var response = client.Post(new CsvList(dtos)); + Assert.That(response, Is.EquivalentTo(dtos)); + + response = Config.ListeningOn.CombineWith("csvlist") + .PostCsvToUrl(dtos) + .FromCsv(); + Assert.That(response, Is.EquivalentTo(dtos)); + + var csv = dtos.ToCsv(); + response = Config.ListeningOn.CombineWith("csvlist") + .PostCsvToUrl(csv) + .FromCsv(); + Assert.That(response, Is.EquivalentTo(dtos)); + } + + [Test] + public void Can_POST_CsvFirstEnumerable() + { + var client = new CsvServiceClient(Config.ListeningOn); + + var dto = new CsvFirstEnumerable + { + Id = 1, + Name = "Name", + Items = 3.Times(x => CreateCsvItem(x)) + }; + + var response = client.Post(dto); + Assert.That(response.Id, Is.EqualTo(0)); + Assert.That(response.Name, Is.Null); + Assert.That(response.Items, Is.EquivalentTo(dto.Items)); + + response = Config.ListeningOn.CombineWith("csvfirst") + .PostCsvToUrl(dto) + .FromCsv(); + Assert.That(response.Id, Is.EqualTo(0)); + Assert.That(response.Name, Is.Null); + Assert.That(response.Items, Is.EquivalentTo(dto.Items)); + } + + [Test] + public void Can_POST_CsvDto() + { + var client = new CsvServiceClient(Config.ListeningOn); + + var dto = new CsvDtoEnumerable + { + Id = 1, + Name = "Name", + Items = 3.Times(x => CreateCsvItem(x)) + }; + + var response = client.Post(dto); + Assert.That(response.Id, Is.EqualTo(0)); + Assert.That(response.Name, Is.Null); + Assert.That(response.Items, Is.EquivalentTo(dto.Items)); + + response = Config.ListeningOn.CombineWith("csvdto") + .PostCsvToUrl(dto) + .FromCsv(); + Assert.That(response.Id, Is.EqualTo(0)); + Assert.That(response.Name, Is.Null); + Assert.That(response.Items, Is.EquivalentTo(dto.Items)); + } + } + + public partial class CsvItem : IEquatable + { + public bool Equals(CsvItem other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Id == other.Id + && string.Equals(Name, other.Name) + && Ints.EquivalentTo(other.Ints) + && Strings.EquivalentTo(other.Strings) + && CsvPocos.EquivalentTo(other.CsvPocos) + && CsvPocoMap.EquivalentTo(other.CsvPocoMap); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != this.GetType()) return false; + return Equals((CsvItem)obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = Id; + hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (Ints != null ? Ints.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (Strings != null ? Strings.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (CsvPocos != null ? CsvPocos.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (CsvPocoMap != null ? CsvPocoMap.GetHashCode() : 0); + return hashCode; + } + } + } + + public partial class CsvPoco : IEquatable + { + public bool Equals(CsvPoco other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Id == other.Id && string.Equals(Name, other.Name); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != this.GetType()) return false; + return Equals((CsvPoco)obj); + } + + public override int GetHashCode() + { + unchecked + { + return (Id * 397) ^ (Name != null ? Name.GetHashCode() : 0); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomFormatTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomFormatTests.cs index 893c8ef0a01..a755b1a1a0f 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomFormatTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomFormatTests.cs @@ -46,7 +46,7 @@ public override void Configure(Container container) private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new AppHost() @@ -54,7 +54,7 @@ public void TestFixtureSetUp() .Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -66,7 +66,8 @@ public void Can_get_service_with_default_content_type() var json = Config.AbsoluteBaseUri.CombineWith("hellojson", "World") .GetStringFromUrl(accept: "text/html,*/*;q=0.9"); - Assert.That(json, Is.EqualTo("{\"Name\":\"Hello, World!\"}")); + Assert.That(json, Is.EqualTo("{\"Name\":\"Hello, World!\"}") + .Or.EqualTo("{\"name\":\"Hello, World!\"}")); } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomHttpMethodTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomHttpMethodTests.cs new file mode 100644 index 00000000000..a251896a527 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomHttpMethodTests.cs @@ -0,0 +1,99 @@ +using System.Reflection; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Route("/custom-method/result")] + public class CustomMethodResult : IReturn + { + public int Id { get; set; } + } + + [Route("/custom-method/headers")] + public class CustomMethodHeaders : IReturn + { + public int Id { get; set; } + } + + public class CustomMethodService : Service + { + public object Head(CustomMethodResult request) + { + return new HttpResult { + Headers = { + {"X-Method", "HEAD"}, + {"X-Id", request.Id.ToString()}, + {"Content-Length", "100"}, + {"Content-Type", "video/mp4"}, + } + }; + } + + public object Any(CustomMethodResult request) => request; + + public void Head(CustomMethodHeaders request) + { + Response.AddHeader("X-Method", "HEAD"); + Response.AddHeader("X-Id", request.Id.ToString()); + Response.AddHeader("Content-Type", "video/mp4"); + Response.SetContentLength(100); + } + + public object Any(CustomMethodHeaders request) => request; + } + + public class CustomHttpMethodTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(CustomHttpMethodTests), typeof(CustomMethodService).Assembly) { } + + public override void Configure(Container container) { } + } + + private ServiceStackHost appHost; + + public CustomHttpMethodTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Does_execute_HEAD_Request_returning_custom_HttpResult() + { + var response = Config.ListeningOn.AppendPath("custom-method","result").AddQueryParam("id", 1) + .SendStringToUrl(method: "HEAD", + requestFilter: req => { req.Method = "HEAD"; }, + responseFilter: res => { + Assert.That(res.Headers["X-Method"], Is.EqualTo("HEAD")); + Assert.That(res.Headers["X-Id"], Is.EqualTo("1")); + Assert.That(res.ContentType, Is.EqualTo("video/mp4")); + Assert.That(res.ContentLength, Is.EqualTo(100)); + }); + + Assert.That(response, Is.Empty); + } + + [Test] + public void Does_execute_HEAD_Request_writing_custom_headers() + { + var response = Config.ListeningOn.AppendPath("custom-method","headers").AddQueryParam("id", 1) + .SendStringToUrl(method: "HEAD", + requestFilter: req => { req.Method = "HEAD"; }, + responseFilter: res => { + Assert.That(res.Headers["X-Method"], Is.EqualTo("HEAD")); + Assert.That(res.Headers["X-Id"], Is.EqualTo("1")); + Assert.That(res.ContentType, Is.EqualTo("video/mp4")); + Assert.That(res.ContentLength, Is.EqualTo(100)); + }); + + Assert.That(response, Is.Empty); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomOrmLiteAuthRepositoryTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomOrmLiteAuthRepositoryTests.cs new file mode 100644 index 00000000000..e8b0ed3cca8 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomOrmLiteAuthRepositoryTests.cs @@ -0,0 +1,229 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Configuration; +using ServiceStack.Data; +using ServiceStack.DataAnnotations; +using ServiceStack.FluentValidation; +using ServiceStack.OrmLite; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class CustomUserAuth : IUserAuth + { + [AutoIncrement] + public int Id { get; set; } + public string UserName { get; set; } + public string DisplayName { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Company { get; set; } + public string Email { get; set; } + public string PhoneNumber { get; set; } + public DateTime? BirthDate { get; set; } + public string BirthDateRaw { get; set; } + public string Address { get; set; } + public string Address2 { get; set; } + public string City { get; set; } + public string State { get; set; } + public string Country { get; set; } + public string Culture { get; set; } + public string FullName { get; set; } + public string Gender { get; set; } + public string Language { get; set; } + public string MailAddress { get; set; } + public string Nickname { get; set; } + public string PostalCode { get; set; } + public string TimeZone { get; set; } + public Dictionary Meta { get; set; } + public string PrimaryEmail { get; set; } + public string Salt { get; set; } + public string PasswordHash { get; set; } + public string DigestHa1Hash { get; set; } + public List Roles { get; set; } + public List Permissions { get; set; } + public int? RefId { get; set; } + public string RefIdStr { get; set; } + public int InvalidLoginAttempts { get; set; } + public DateTime? LastLoginAttempt { get; set; } + public DateTime? LockedDate { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime ModifiedDate { get; set; } + } + + public class CustomUserAuthDetails : IUserAuthDetails + { + public string UserName { get; set; } + public string DisplayName { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Company { get; set; } + public string Email { get; set; } + public string PhoneNumber { get; set; } + public DateTime? BirthDate { get; set; } + public string BirthDateRaw { get; set; } + public string Address { get; set; } + public string Address2 { get; set; } + public string City { get; set; } + public string State { get; set; } + public string Country { get; set; } + public string Culture { get; set; } + public string FullName { get; set; } + public string Gender { get; set; } + public string Language { get; set; } + public string MailAddress { get; set; } + public string Nickname { get; set; } + public string PostalCode { get; set; } + public string TimeZone { get; set; } + public string Provider { get; set; } + public string UserId { get; set; } + public string AccessToken { get; set; } + public string AccessTokenSecret { get; set; } + public string RefreshToken { get; set; } + public DateTime? RefreshTokenExpiry { get; set; } + public string RequestToken { get; set; } + public string RequestTokenSecret { get; set; } + public Dictionary Items { get; set; } + public Dictionary Meta { get; set; } + public int Id { get; set; } + public int UserAuthId { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime ModifiedDate { get; set; } + public int? RefId { get; set; } + public string RefIdStr { get; set; } + } + + [DataContract] + public class CustomAuthUserSession : AuthUserSession + { + [DataMember] + public string CustomField { get; set; } + } + + public class CustomOrmLiteAuthRepositoryTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(CustomOrmLiteAuthRepositoryTests), typeof(CustomOrmLiteAuthRepositoryTests).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + DebugMode = true, + }); + + Plugins.Add(new AuthFeature(() => new CustomAuthUserSession(), + new IAuthProvider[] { + new CredentialsAuthProvider(AppSettings), + }) { + IncludeRegistrationService = true + }); + + container.Register(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + container.Register(c => + new OrmLiteAuthRepository(c.Resolve())); + + container.Resolve().InitSchema(); + + container.RegisterAs>(); + + var authRepo = container.Resolve(); + var userAuth = authRepo.CreateUserAuth(new CustomUserAuth + { + UserName = "admin", + Email = "admin@if.com", + DisplayName = "Admin User", + FirstName = "Admin", + LastName = "User", + Roles = new List { RoleNames.Admin } + }, "p@55w0rd"); + + userAuth = authRepo.GetUserAuth(userAuth.Id.ToString()); + Assert.That(userAuth, Is.Not.Null); + Assert.That(userAuth.UserName, Is.EqualTo("admin")); + } + } + + private readonly ServiceStackHost appHost; + + public CustomOrmLiteAuthRepositoryTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Can_resgiter_user_using_Custom_UserAuth_and_UserAuthDetails() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var response = client.Post(new Register + { + UserName = "user", + Password = "pass", + Email = "as@if.com", + DisplayName = "DisplayName", + FirstName = "FirstName", + LastName = "LastName", + }); + + Assert.That(response.UserId, Is.Not.Null); + } + + [Test] + public void Can_assign_roles_to_Custom_UserAuth() + { + var client = new JsonServiceClient(Config.ListeningOn); + + client.Post(new Register + { + UserName = "user2", + Password = "pass2", + Email = "as2@if.com", + DisplayName = "DisplayName2", + FirstName = "FirstName2", + LastName = "LastName2", + }); + + client.Post(new Authenticate + { + provider = "credentials", + UserName = "admin", + Password = "p@55w0rd", + RememberMe = true + }); + + var response = client.Post(new AssignRoles + { + UserName = "user2", + Roles = new List { "role1", "role2" }, + Permissions = new List { "perm1", "perm2" }, + }); + + Assert.That(response.AllRoles, Is.EquivalentTo(new[] { "role1", "role2" })); + Assert.That(response.AllPermissions, Is.EquivalentTo(new[] { "perm1", "perm2" })); + + var currentRoles = client.Post(new UnAssignRoles + { + UserName = "user2", + Roles = new List { "role1" }, + Permissions = new List { "perm2" }, + }); + + Assert.That(currentRoles.AllRoles, Is.EquivalentTo(new[] { "role2" })); + Assert.That(currentRoles.AllPermissions, Is.EquivalentTo(new[] { "perm1" })); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomRequestDataTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomRequestDataTests.cs index 43f831a6f39..60fb69438ec 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomRequestDataTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomRequestDataTests.cs @@ -21,7 +21,7 @@ public class CustomRequestDataTests private string customUrl = ListeningOn.CombineWith("customrequestbinder"); private string predefinedUrl = ListeningOn.CombineWith("json/reply/customrequestbinder"); - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new ExampleAppHostHttpListener(); @@ -29,7 +29,7 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -47,18 +47,23 @@ public void Can_parse_custom_form_data() try { - using (var sw = new StreamWriter(webReq.GetRequestStream())) + using (var sw = new StreamWriter(PclExport.Instance.GetRequestStream(webReq))) { - sw.Write("&first-name=tom&item-0=blah&item-1-delete=1"); +#if !NETCORE + sw.Write("&"); +#endif + sw.Write("first-name=tom&item-0=blah&item-1-delete=1"); } - var response = new StreamReader(webReq.GetResponse().GetResponseStream()).ReadToEnd(); + var response = webReq.GetResponse().GetResponseStream().ReadToEnd(); - Assert.That(response, Is.EqualTo("{\"FirstName\":\"tom\",\"Item0\":\"blah\",\"Item1Delete\":\"1\"}")); + Assert.That(response, Is.EqualTo("{\"FirstName\":\"tom\",\"Item0\":\"blah\",\"Item1Delete\":\"1\"}") + .Or.EqualTo("{\"firstName\":\"tom\",\"item0\":\"blah\",\"item1Delete\":\"1\"}") + ); } catch (WebException webEx) { var errorWebResponse = ((HttpWebResponse)webEx.Response); - var errorResponse = new StreamReader(errorWebResponse.GetResponseStream()).ReadToEnd(); + var errorResponse = errorWebResponse.GetResponseStream().ReadToEnd(); Assert.Fail(errorResponse); } @@ -150,6 +155,9 @@ public void Does_use_request_binder_for_predefined_POST_FormData() } [Test] +#if NETCORE + [Ignore("HttpClient does not support `Expect: 100-Continue`. Should be fixed in .NET Core 1.1")] +#endif public void Does_use_request_binder_for_PUT() { var response = client.Put("/customrequestbinder", new CustomRequestBinder()); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomServiceRunnerTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomServiceRunnerTests.cs index 17e8ee66caf..cb0d2502b86 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomServiceRunnerTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomServiceRunnerTests.cs @@ -7,10 +7,10 @@ namespace ServiceStack.WebHost.Endpoints.Tests [TestFixture] public class CustomServiceRunnerTests { - private const string ListeningOn = Config.AbsoluteBaseUri; + string ListeningOn = Config.AbsoluteBaseUri; private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new CustomServiceRunnerAppHost() @@ -18,7 +18,7 @@ public void TestFixtureSetUp() .Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -43,15 +43,14 @@ public CustomServiceRunner(IAppHost appHost, ActionContext actionContext) : base(appHost, actionContext) { } - public override object OnAfterExecute(Web.IRequest requestContext, object response) + public override object OnAfterExecute(Web.IRequest req, object response, object service) { - var dto = response as CustomRunnerResponse; - if (dto != null) + if (response is CustomRunnerResponse dto) { dto.ServiceName = base.ActionContext.ServiceType.Name; dto.RequestName = base.ActionContext.RequestType.Name; } - return base.OnAfterExecute(requestContext, response); + return base.OnAfterExecute(req, response, service); } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomValidationErrorTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomValidationErrorTests.cs index f6775ddf199..269a6fa6529 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomValidationErrorTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomValidationErrorTests.cs @@ -1,26 +1,29 @@ using System; +using System.Collections.Generic; using System.IO; using System.Net; +using System.Runtime.Serialization; using Funq; using NUnit.Framework; using ServiceStack.FluentValidation; using ServiceStack.FluentValidation.Results; using ServiceStack.Text; using ServiceStack.Validation; +using ServiceStack.Web; namespace ServiceStack.WebHost.Endpoints.Tests { - public class CustomValidationAppHost : AppHostHttpListenerBase + public class CustomValidationAppHost : AppSelfHostBase { - public CustomValidationAppHost() : base("Custom Error", typeof(CustomValidationAppHost).Assembly) {} + public CustomValidationAppHost() : base("Custom Error", typeof(CustomValidationAppHost).Assembly) { } public override void Configure(Container container) { Plugins.Add(new ValidationFeature { ErrorResponseFilter = CustomValidationError }); - container.RegisterValidators(typeof(MyValidator).Assembly); + container.RegisterValidators(typeof(MyValidator).Assembly); } - public static object CustomValidationError(ValidationResult validationResult, object errorDto) + public static object CustomValidationError(IRequest req, ValidationResult validationResult, object errorDto) { var firstError = validationResult.Errors[0]; var dto = new MyCustomErrorDto { code = firstError.ErrorCode, error = firstError.ErrorMessage }; @@ -50,12 +53,69 @@ public MyValidator() } } - public class CustomValidationService : Service + [Route("/customrequesterror/{Name}")] + public class CustomRequestError + { + public string Name { get; set; } + + public List Items { get; set; } + } + + public class CustomRequestItem + { + public string Name { get; set; } + } + + public class MyRequestValidator : AbstractValidator + { + public MyRequestValidator() + { + RuleSet(ApplyTo.Post | ApplyTo.Put | ApplyTo.Get, () => + { + var req = base.Request; + RuleFor(c => c.Name) + .Must(x => !base.Request.PathInfo.ContainsAny("-", ".", " ")); + + RuleFor(x => x.Items).SetCollectionValidator(new MyRequestItemValidator()); + }); + } + } + + public class MyRequestItemValidator : AbstractValidator + { + public MyRequestItemValidator() + { + RuleFor(x => x.Name) + .Must(x => !base.Request.QueryString["Items"].ContainsAny("-", ".", " ")); + } + } + + public class CustomValidationErrorService : Service { public object Get(CustomError request) { return request; } + + public object Any(CustomRequestError request) + { + return request; + } + } + + [Route("/errorrequestbinding")] + public class ErrorRequestBinding : IReturn + { + public int Int { get; set; } + public decimal Decimal { get; set; } + } + + public class TestRequestBindingService : Service + { + public object Any(ErrorRequestBinding errorRequest) + { + return errorRequest; + } } [TestFixture] @@ -63,7 +123,7 @@ public class CustomValidationErrorTests { private CustomValidationAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new CustomValidationAppHost(); @@ -71,7 +131,7 @@ public void TestFixtureSetUp() appHost.Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -91,20 +151,143 @@ public void Can_create_custom_validation_error() Assert.That(body, Is.EqualTo("{\"code\":\"GreaterThan\",\"error\":\"'Age' must be greater than '0'.\"}")); } } + + [Test] + public void Can_access_Request_in_Validator() + { + try + { + var response = "{0}/customrequesterror/the.name".Fmt(Config.ServiceStackBaseUri) + .GetJsonFromUrl(); + Assert.Fail("Should throw HTTP Error"); + } + catch (Exception ex) + { + var body = ex.GetResponseBody(); + Assert.That(body, Is.EquivalentTo("{\"code\":\"Predicate\",\"error\":\"The specified condition was not met for 'Name'.\"}")); + } + } + + [Test] + public void Can_access_Request_in_item_collection_Validator() + { + try + { + var response = (Config.ServiceStackBaseUri + "/customrequesterror/thename?items=[{name:item.name}]") + .GetJsonFromUrl(); + Assert.Fail("Should throw HTTP Error"); + } + catch (Exception ex) + { + var body = ex.GetResponseBody(); + /** + * Need to add `Request = Request,` in all ValidationContext.Clone* APIs starting from L177 + GetFromNonGenericContext() L96 + */ + // body.Print(); + Assert.That(body, Is.EqualTo("{\"code\":\"Predicate\",\"error\":\"The specified condition was not met for 'Name'.\"}")); + } + } + + [Test] + public void RequestBindingException_QueryString_returns_populated_FieldError() + { + var client = new JsonServiceClient(Config.ServiceStackBaseUri); + try + { + var response = client.Get("/errorrequestbinding?Int=string&Decimal=string"); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ResponseStatus.Message, + Is.EqualTo("Unable to bind to request 'ErrorRequestBinding'")); + + var intFieldError = ex.GetFieldErrors()[0]; + Assert.That(intFieldError.FieldName, Is.EqualTo("Int")); + Assert.That(intFieldError.ErrorCode, Is.EqualTo(typeof(SerializationException).Name)); + Assert.That(intFieldError.Message, Is.EqualTo("'string' is an Invalid value for 'Int'")); + + var decimalFieldError = ex.GetFieldErrors()[1]; + Assert.That(decimalFieldError.FieldName, Is.EqualTo("Decimal")); + Assert.That(decimalFieldError.ErrorCode, Is.EqualTo(typeof(SerializationException).Name)); + Assert.That(decimalFieldError.Message, Is.EqualTo("'string' is an Invalid value for 'Decimal'")); + } + } + + [Test] + public void RequestBindingException_QueryString_predefined_route_returns_populated_FieldError() + { + try + { + var response = Config.ServiceStackBaseUri.CombineWith("/json/reply/ErrorRequestBinding?Int=string&Decimal=string") + .GetJsonFromUrl(); + Assert.Fail("Should throw"); + } + catch (WebException ex) + { + AssertErrorRequestBindingResponse(ex); + } + } + + [Test] + public void RequestBindingException_FormData_returns_populated_FieldError() + { + try + { + var response = Config.ServiceStackBaseUri.CombineWith("errorrequestbinding") + .PostStringToUrl("Int=string&Decimal=string", contentType: MimeTypes.FormUrlEncoded, accept: MimeTypes.Json); + Assert.Fail("Should throw"); + } + catch (WebException ex) + { + AssertErrorRequestBindingResponse(ex); + } + } + + [Test] + public void RequestBindingException_FormData_predefined_route_returns_populated_FieldError() + { + try + { + var response = Config.ServiceStackBaseUri.CombineWith("/json/reply/ErrorRequestBinding") + .PostStringToUrl("Int=string&Decimal=string", contentType: MimeTypes.FormUrlEncoded, accept: MimeTypes.Json); + Assert.Fail("Should throw"); + } + catch (WebException ex) + { + AssertErrorRequestBindingResponse(ex); + } + } + + private static void AssertErrorRequestBindingResponse(WebException ex) + { + var responseBody = ex.GetResponseBody(); + var status = responseBody.FromJson().ResponseStatus; + + Assert.That(status.Message, + Is.EqualTo("Unable to bind to request 'ErrorRequestBinding'")); + + var fieldError = status.Errors[0]; + Assert.That(fieldError.FieldName, Is.EqualTo("Int")); + Assert.That(fieldError.ErrorCode, Is.EqualTo(typeof(SerializationException).Name)); + Assert.That(fieldError.Message, Is.EqualTo("'string' is an Invalid value for 'Int'")); + + var fieldError2 = status.Errors[1]; + Assert.That(fieldError2.FieldName, Is.EqualTo("Decimal")); + Assert.That(fieldError2.ErrorCode, Is.EqualTo(typeof(SerializationException).Name)); + Assert.That(fieldError2.Message, Is.EqualTo("'string' is an Invalid value for 'Decimal'")); + } } public static class WebRequestUtils { public static string GetResponseBody(this Exception ex) { - var webEx = ex as WebException; - if (webEx == null || webEx.Status != WebExceptionStatus.ProtocolError) return null; + if (!(ex is WebException webEx) || webEx.Status != WebExceptionStatus.ProtocolError) + return null; var errorResponse = ((HttpWebResponse)webEx.Response); - using (var reader = new StreamReader(errorResponse.GetResponseStream())) - { - return reader.ReadToEnd(); - } + return errorResponse.GetResponseStream().ReadToEnd(); } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomerRestExample.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomerRestExample.cs new file mode 100644 index 00000000000..f79d1693620 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomerRestExample.cs @@ -0,0 +1,160 @@ +using System.Collections.Generic; +using Funq; +using NUnit.Framework; +using ServiceStack; +using ServiceStack.Data; +using ServiceStack.DataAnnotations; +using ServiceStack.OrmLite; + +namespace NewApi.Customers +{ + public class AppHost : AppSelfHostBase + { + public AppHost() : base("Customer REST Example", typeof(CustomerService).Assembly) {} + + public override void Configure(Container container) + { + container.Register(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + using (var db = container.Resolve().Open()) + { + db.CreateTableIfNotExists(); + } + } + } + + [Route("/customers", "GET")] + public class GetCustomers : IReturn {} + + public class GetCustomersResponse + { + public List Results { get; set; } + } + + [Route("/customers/{Id}", "GET")] + public class GetCustomer : IReturn + { + public int Id { get; set; } + } + + [Route("/customers", "POST")] + public class CreateCustomer : IReturn + { + public string Name { get; set; } + } + + [Route("/customers/{Id}", "PUT")] + public class UpdateCustomer : IReturn + { + public int Id { get; set; } + + public string Name { get; set; } + } + + [Route("/customers/{Id}", "DELETE")] + public class DeleteCustomer : IReturnVoid + { + public int Id { get; set; } + } + + public class Customer + { + [AutoIncrement] + public int Id { get; set; } + + public string Name { get; set; } + } + + public class CustomerService : Service + { + public object Get(GetCustomers request) + { + return new GetCustomersResponse { Results = Db.Select() }; + } + + public object Get(GetCustomer request) + { + return Db.SingleById(request.Id); + } + + public object Post(CreateCustomer request) + { + var customer = new Customer { Name = request.Name }; + Db.Save(customer); + return customer; + } + + public object Put(UpdateCustomer request) + { + var customer = Db.SingleById(request.Id); + if (customer == null) + throw HttpError.NotFound("Customer '{0}' does not exist".Fmt(request.Id)); + + customer.Name = request.Name; + Db.Update(customer); + + return customer; + } + + public void Delete(DeleteCustomer request) + { + Db.DeleteById(request.Id); + } + } + + + [TestFixture] + public class CustomerRestExample + { + const string BaseUri = "http://localhost:1337/"; + + ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = new AppHost() + .Init() + .Start(BaseUri); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Run_Customer_REST_Example() + { + var client = new JsonServiceClient(BaseUri); + + //GET /customers + var all = client.Get(new GetCustomers()); + Assert.That(all.Results.Count, Is.EqualTo(0)); + + //POST /customers + var customer = client.Post(new CreateCustomer { Name = "Foo" }); + Assert.That(customer.Id, Is.EqualTo(1)); + //GET /customer/1 + customer = client.Get(new GetCustomer { Id = customer.Id }); + Assert.That(customer.Name, Is.EqualTo("Foo")); + + //GET /customers + all = client.Get(new GetCustomers()); + Assert.That(all.Results.Count, Is.EqualTo(1)); + + //PUT /customers/1 + customer = client.Put(new UpdateCustomer { Id = customer.Id, Name = "Bar" }); + Assert.That(customer.Name, Is.EqualTo("Bar")); + + //DELETE /customers/1 + client.Delete(new DeleteCustomer { Id = customer.Id }); + //GET /customers + all = client.Get(new GetCustomers()); + Assert.That(all.Results.Count, Is.EqualTo(0)); + } + + } +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomerServiceValidationTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomerServiceValidationTests.cs index c113d4176ac..73d207a91ba 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/CustomerServiceValidationTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/CustomerServiceValidationTests.cs @@ -13,9 +13,9 @@ namespace ServiceStack.WebHost.IntegrationTests.Services { - [Route("/customers")] - [Route("/customers/{Id}")] - public class Customers + [Route("/validcustomers")] + [Route("/validcustomers/{Id}")] + public class ValidCustomers { public int Id { get; set; } public string FirstName { get; set; } @@ -25,6 +25,7 @@ public class Customers public string Address { get; set; } public string Postcode { get; set; } public bool HasDiscount { get; set; } + public string[] NickNames { get; set; } } public interface IAddressValidator @@ -42,7 +43,7 @@ public bool ValidAddress(string address) } } - public class CustomersValidator : AbstractValidator + public class CustomersValidator : AbstractValidator { public IAddressValidator AddressValidator { get; set; } @@ -58,6 +59,7 @@ public CustomersValidator() RuleFor(x => x.Discount).NotEqual(0).When(x => x.HasDiscount); RuleFor(x => x.Address).Must(x => AddressValidator.ValidAddress(x)); RuleFor(x => x.Postcode).Must(BeAValidPostcode).WithMessage("Please specify a valid postcode"); + RuleForEach(x => x.NickNames).NotNull(); }); } @@ -69,34 +71,86 @@ private bool BeAValidPostcode(string postcode) } } - public class CustomersResponse + public class ValidCustomersResponse { - public Customers Result { get; set; } + public ValidCustomers Result { get; set; } public ResponseStatus ResponseStatus { get; set; } } - [DefaultRequest(typeof(Customers))] + [DefaultRequest(typeof(ValidCustomers))] public class CustomerService : Service { - public object Get(Customers request) + public object Get(ValidCustomers request) { - return new CustomersResponse { Result = request }; + return new ValidCustomersResponse { Result = request }; } - public object Post(Customers request) + public object Post(ValidCustomers request) { - return new CustomersResponse { Result = request }; + return new ValidCustomersResponse { Result = request }; } - public object Put(Customers request) + public object Put(ValidCustomers request) { - return new CustomersResponse { Result = request }; + return new ValidCustomersResponse { Result = request }; } - public object Delete(Customers request) + public object Delete(ValidCustomers request) { - return new CustomersResponse { Result = request }; + return new ValidCustomersResponse { Result = request }; + } + } + + public class SaveUser : IReturn + { + public int Id { get; set; } + + public User User { get; set; } + } + + public class User + { + public string Name { get; set; } + } + + public class UserValidator : AbstractValidator + { + public UserValidator() + { + this.CascadeMode = CascadeMode.StopOnFirstFailure; + + RuleFor(x => x.Name).NotEmpty(); + } + } + + public class SaveUserValidator : AbstractValidator + { + public SaveUserValidator() + { + this.CascadeMode = CascadeMode.StopOnFirstFailure; + + RuleFor(x => x.Id) + .Must(ThrowException); + + RuleFor(x => x.User) + .NotEmpty() + .SetValidator(new UserValidator()); + } + + private bool ThrowException(int arg) + { + if (arg < 0) + throw new ApplicationException("Validator Exception"); + return true; + } + } + + public class UserService : Service + { + public object Post(SaveUser request) + { + return new HttpResult(new SaveUser { Id = -100, User = new User { Name = "bad name" } }, HttpStatusCode.Created); } } @@ -121,7 +175,7 @@ public override void Configure(Container container) static ValidationAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new ValidationAppHostHttpListener(); @@ -129,13 +183,13 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); } - private static List GetValidationFieldErrors(string httpMethod, Customers request) + private static List GetValidationFieldErrors(string httpMethod, ValidCustomers request) { var validator = (IValidator)new CustomersValidator { @@ -161,20 +215,25 @@ private static List GetValidationFieldErrors(string httpMethod, C }; private string[] ExpectedPostErrorCodes = new[] { - "NotEqual", - "ShouldNotBeEmpty", - "NotEmpty", - "NotNull", - "Predicate", - "Predicate", - }; + "NotEqual", + "ShouldNotBeEmpty", + "NotEmpty", + "NotNull", + "Predicate", + "Predicate", + }; - Customers validRequest; + ValidCustomers validRequest; [SetUp] public void SetUp() { - validRequest = new Customers + validRequest = CreateValidCustomers(); + } + + private ValidCustomers CreateValidCustomers() + { + return new ValidCustomers { Id = 1, FirstName = "FirstName", @@ -187,6 +246,44 @@ public void SetUp() }; } + [Test] + public void Does_validate_using_registered_UserValidator() + { + var client = new JsonServiceClient(ListeningOn); + + try + { + var response = client.Post(new SaveUser()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + var status = ex.ResponseStatus; + Assert.That(status.ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Message, Is.EqualTo("'User' must not be empty.")); + Assert.That(status.Errors[0].FieldName, Is.EqualTo("User")); + Assert.That(status.Errors[0].Message, Is.EqualTo("'User' must not be empty.")); + } + } + + [Test] + public void Does_handle_Exception_thrown_in_validator() + { + var client = new JsonServiceClient(ListeningOn); + + try + { + var response = client.Post(new SaveUser { Id = -1 }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + var status = ex.ResponseStatus; + Assert.That(status.ErrorCode, Is.EqualTo(nameof(ApplicationException))); + Assert.That(status.Message, Is.EqualTo("Validator Exception")); + } + } + [Test] public void ValidationFeature_add_request_filter_once() { @@ -223,7 +320,7 @@ public void Validates_Conditional_Request_request_on_Post() [Test] public void Validates_empty_request_on_Post() { - var request = new Customers(); + var request = new ValidCustomers(); var errorFields = GetValidationFieldErrors(HttpMethods.Post, request); var fieldNames = errorFields.Select(x => x.FieldName).ToArray(); @@ -237,7 +334,7 @@ public void Validates_empty_request_on_Post() [Test] public void Validates_empty_request_on_Put() { - var request = new Customers(); + var request = new ValidCustomers(); var errorFields = GetValidationFieldErrors(HttpMethods.Put, request); var fieldNames = errorFields.Select(x => x.FieldName).ToArray(); @@ -251,7 +348,7 @@ public void Validates_empty_request_on_Put() [Test] public void Validates_empty_request_on_Get() { - var request = new Customers(); + var request = new ValidCustomers(); var errorFields = GetValidationFieldErrors(HttpMethods.Get, request); Assert.That(errorFields.Count, Is.EqualTo(1)); @@ -262,7 +359,7 @@ public void Validates_empty_request_on_Get() [Test] public void Validates_empty_request_on_Delete() { - var request = new Customers(); + var request = new ValidCustomers(); var errorFields = GetValidationFieldErrors(HttpMethods.Delete, request); Assert.That(errorFields.Count, Is.EqualTo(1)); @@ -270,6 +367,20 @@ public void Validates_empty_request_on_Delete() Assert.That(errorFields[0].FieldName, Is.EqualTo("Id")); } + [Test] + public void Validates_collection_with_null_request_on_Post() + { + var invalidCollection = CreateValidCustomers(); + invalidCollection.NickNames = new[] { null, "foo", null }; + var errorFields = GetValidationFieldErrors(HttpMethods.Post, invalidCollection); + + Assert.That(errorFields.Count, Is.EqualTo(2)); + Assert.That(errorFields[0].ErrorCode, Is.EqualTo("NotNull")); + Assert.That(errorFields[0].FieldName, Is.EqualTo("NickNames[0]")); + Assert.That(errorFields[1].ErrorCode, Is.EqualTo("NotNull")); + Assert.That(errorFields[1].FieldName, Is.EqualTo("NickNames[2]")); + } + protected static IServiceClient UnitTestServiceClient() { return new DirectServiceClient(appHost.ServiceController); @@ -297,12 +408,12 @@ public void Post_empty_request_throws_validation_exception(Func try { var client = factory(); - var response = client.Send(new Customers()); + var response = client.Send(new ValidCustomers()); Assert.Fail("Should throw Validation Exception"); } catch (WebServiceException ex) { - var response = (CustomersResponse)ex.ResponseDto; + var response = (ValidCustomersResponse)ex.ResponseDto; var errorFields = response.ResponseStatus.Errors; var fieldNames = errorFields.Select(x => x.FieldName).ToArray(); @@ -321,21 +432,21 @@ public void Get_empty_request_throws_validation_exception(Func f try { var client = (IRestClient)factory(); - var response = client.Get("Customers"); + var response = client.Get("ValidCustomers"); Assert.Fail("Should throw Validation Exception"); } catch (WebServiceException ex) { - var response = (CustomersResponse)ex.ResponseDto; + var response = (ValidCustomersResponse)ex.ResponseDto; var errorFields = response.ResponseStatus.Errors; Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.BadRequest)); Assert.That(ex.StatusDescription, Is.EqualTo("NotEqual")); - Assert.That(response.ResponseStatus.Message, Is.EqualTo("'Id' should not be equal to '0'.")); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("'Id' must not be equal to '0'.")); Assert.That(errorFields.Count, Is.EqualTo(1)); Assert.That(errorFields[0].ErrorCode, Is.EqualTo("NotEqual")); Assert.That(errorFields[0].FieldName, Is.EqualTo("Id")); - Assert.That(errorFields[0].Message, Is.EqualTo("'Id' should not be equal to '0'.")); + Assert.That(errorFields[0].Message, Is.EqualTo("'Id' must not be equal to '0'.")); } } @@ -343,7 +454,7 @@ public void Get_empty_request_throws_validation_exception(Func f public void Post_ValidRequest_succeeds(Func factory) { var client = factory(); - var response = client.Send(validRequest); + var response = client.Send(validRequest); Assert.That(response.ResponseStatus, Is.Null); } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/EncodingTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/EncodingTests.cs index 99a20b52fdb..bda196b9891 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/EncodingTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/EncodingTests.cs @@ -40,7 +40,7 @@ public class EncodingTests { private EncodingTestsAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new EncodingTestsAppHost(); @@ -48,7 +48,7 @@ public void TestFixtureSetUp() appHost.Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/EndpointRestrictionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/EndpointRestrictionTests.cs index 3bd2d7a92cf..6805bb150a3 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/EndpointRestrictionTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/EndpointRestrictionTests.cs @@ -8,89 +8,90 @@ namespace ServiceStack.WebHost.Endpoints.Tests { - [TestFixture] - public class EndpointRestrictionTests - : ServiceHostTestBase - { - //Localhost and LocalSubnet is always included with the Internal flag - private const int EndpointAttributeCount = 17; + [TestFixture] + public class EndpointRestrictionTests + : ServiceHostTestBase + { + //Localhost and LocalSubnet is always included with the Internal flag + private const int EndpointAttributeCount = 17; private static readonly List AllAttributes = (EndpointAttributeCount).Times().Map(x => (RequestAttributes)(1 << (int)x)); - ServiceStackHost appHost; + ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new TestAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); } - public void ShouldAllowAccessWhen(RequestAttributes withScenario) - { + public void ShouldAllowAccessWhen(RequestAttributes withScenario) + { ShouldNotThrow(() => appHost.ExecuteService(typeof(TRequestDto).New(), withScenario)); - } - - public void ShouldDenyAccessWhen(RequestAttributes withScenario) - { - ShouldThrow(() => appHost.ExecuteService(typeof(TRequestDto).New(), withScenario)); - } - - public void ShouldDenyAccessForAllOtherScenarios(params RequestAttributes[] notIncluding) - { - ShouldDenyAccessForOtherScenarios(AllAttributes.Where(x => !notIncluding.Contains(x)).ToList()); - } - - public void ShouldDenyAccessForOtherNetworkAccessScenarios(params RequestAttributes[] notIncluding) - { - var scenarios = new List { RequestAttributes.Localhost, RequestAttributes.LocalSubnet, RequestAttributes.External }; - ShouldDenyAccessForOtherScenarios(scenarios.Where(x => !notIncluding.Contains(x)).ToList()); - } - - public void ShouldDenyAccessForOtherHttpRequestTypesScenarios(params RequestAttributes[] notIncluding) - { - var scenarios = new List - { - RequestAttributes.HttpHead, - RequestAttributes.HttpGet, - RequestAttributes.HttpPost, - RequestAttributes.HttpPut, - RequestAttributes.HttpDelete, - RequestAttributes.HttpPatch, - RequestAttributes.HttpOptions, - RequestAttributes.HttpOther - }; - ShouldDenyAccessForOtherScenarios(scenarios.Where(x => !notIncluding.Contains(x)).ToList()); - } - - private void ShouldDenyAccessForOtherScenarios(IEnumerable otherScenarios) - { + } + + public void ShouldDenyAccessWhen(RequestAttributes withScenario) + { + ShouldThrow(() => + appHost.ExecuteService(typeof(TRequestDto).New(), withScenario)); + } + + public void ShouldDenyAccessForAllOtherScenarios(params RequestAttributes[] notIncluding) + { + ShouldDenyAccessForOtherScenarios(AllAttributes.Where(x => !notIncluding.Contains(x)).ToList()); + } + + public void ShouldDenyAccessForOtherNetworkAccessScenarios(params RequestAttributes[] notIncluding) + { + var scenarios = new List { RequestAttributes.Localhost, RequestAttributes.LocalSubnet, RequestAttributes.External }; + ShouldDenyAccessForOtherScenarios(scenarios.Where(x => !notIncluding.Contains(x)).ToList()); + } + + public void ShouldDenyAccessForOtherHttpRequestTypesScenarios(params RequestAttributes[] notIncluding) + { + var scenarios = new List + { + RequestAttributes.HttpHead, + RequestAttributes.HttpGet, + RequestAttributes.HttpPost, + RequestAttributes.HttpPut, + RequestAttributes.HttpDelete, + RequestAttributes.HttpPatch, + RequestAttributes.HttpOptions, + RequestAttributes.HttpOther + }; + ShouldDenyAccessForOtherScenarios(scenarios.Where(x => !notIncluding.Contains(x)).ToList()); + } + + private void ShouldDenyAccessForOtherScenarios(IEnumerable otherScenarios) + { var requestDto = typeof(TRequestDto).New(); - foreach (var otherScenario in otherScenarios) - { - try - { - ShouldThrow(() => appHost.ExecuteService(requestDto, otherScenario)); - } - catch (Exception ex) - { - throw new Exception("Failed to throw on: " + otherScenario, ex); - } - } - } - - - [Test] - public void InternalRestriction_allows_calls_from_Localhost_or_LocalSubnet() - { - ShouldAllowAccessWhen(RequestAttributes.Localhost); - ShouldAllowAccessWhen(RequestAttributes.LocalSubnet); - ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.Localhost, RequestAttributes.LocalSubnet); - } + foreach (var otherScenario in otherScenarios) + { + try + { + ShouldThrow(() => appHost.ExecuteService(requestDto, otherScenario)); + } + catch (Exception ex) + { + throw new Exception("Failed to throw on: " + otherScenario, ex); + } + } + } + + + [Test] + public void InternalRestriction_allows_calls_from_Localhost_or_LocalSubnet() + { + ShouldAllowAccessWhen(RequestAttributes.Localhost); + ShouldAllowAccessWhen(RequestAttributes.LocalSubnet); + ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.Localhost, RequestAttributes.LocalSubnet); + } [Test] public void LocalhostRestriction_allows_calls_from_localhost() @@ -101,165 +102,186 @@ public void LocalhostRestriction_allows_calls_from_localhost() ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.Localhost); } - [Test] - public void LocalSubnetRestriction_allows_calls_from_LocalSubnet() - { - ShouldAllowAccessWhen(RequestAttributes.LocalSubnet); - ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.LocalSubnet); - } - - [Test] - public void LocalSubnetRestriction_does_not_allow_calls_from_Localhost() - { - ShouldDenyAccessWhen(RequestAttributes.Localhost); - ShouldDenyAccessWhen(RequestAttributes.External); - } - - [Test] - public void InternalRestriction_allows_calls_from_Localhost_and_LocalSubnet() - { - ShouldAllowAccessWhen(RequestAttributes.Localhost); - ShouldAllowAccessWhen(RequestAttributes.LocalSubnet); - ShouldDenyAccessWhen(RequestAttributes.External); - } - - [Test] - public void SecureLocalSubnetRestriction_does_not_allow_partial_success() - { - ShouldDenyAccessWhen(RequestAttributes.Localhost); - ShouldDenyAccessWhen(RequestAttributes.InSecure | RequestAttributes.LocalSubnet); - ShouldDenyAccessWhen(RequestAttributes.InSecure); - ShouldDenyAccessWhen(RequestAttributes.Secure | RequestAttributes.Localhost); - ShouldAllowAccessWhen(RequestAttributes.Secure | RequestAttributes.LocalSubnet); - - ShouldDenyAccessWhen(RequestAttributes.Secure | RequestAttributes.InternalNetworkAccess); - ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.LocalSubnet); - } - - [Test] - public void HttpPostXmlAndSecureLocalSubnetRestriction_does_not_allow_partial_success() - { - ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.LocalSubnet); - ShouldDenyAccessForOtherHttpRequestTypesScenarios(RequestAttributes.HttpPost); - - ShouldDenyAccessWhen(RequestAttributes.Localhost); - ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Json | RequestAttributes.Secure | RequestAttributes.LocalSubnet); - ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.Localhost); - - ShouldDenyAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpHead); - ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.InSecure ); - - ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Json | RequestAttributes.Secure | RequestAttributes.LocalSubnet); - ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.Localhost); - - ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.LocalSubnet); - } - - [Test] - public void HttpPostXmlOrSecureLocalSubnetRestriction_does_allow_partial_success() - { - ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.LocalSubnet); - - ShouldDenyAccessWhen(RequestAttributes.Localhost | RequestAttributes.HttpPut); - ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Secure | RequestAttributes.LocalSubnet); - ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Json | RequestAttributes.Secure | RequestAttributes.Localhost); - - ShouldAllowAccessWhen(RequestAttributes.Secure | RequestAttributes.LocalSubnet); - ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml); - - ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Json | RequestAttributes.Secure | RequestAttributes.LocalSubnet); - ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.Localhost); - - ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.LocalSubnet); - } - - [Test] - public void Can_access_from_insecure_dev_environment() - { - ShouldAllowAccessWhen(RequestAttributes.Localhost | RequestAttributes.InSecure | RequestAttributes.HttpPost); - ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.InSecure | RequestAttributes.HttpPost); - ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.Reply); - ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.OneWay); - } - - [Test] - public void Can_access_from_secure_dev_environment() - { - ShouldAllowAccessWhen(RequestAttributes.Localhost | RequestAttributes.Secure | RequestAttributes.HttpPost); - ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpPost); - ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Reply); - ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.OneWay); - } - - [Test] - public void Can_access_from_insecure_live_environment() - { - ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.InSecure | RequestAttributes.HttpPost); - ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.Reply); - ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.OneWay); - } - - [Test] - public void Can_access_from_secure_live_environment() - { - ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.Secure | RequestAttributes.HttpPost); - ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Reply); - ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.OneWay); - } - - - [Ignore] - [Test] - public void Print_enum_results() - { - PrintEnumResult(RequestAttributes.InternalNetworkAccess, RequestAttributes.Secure); - PrintEnumResult(RequestAttributes.InternalNetworkAccess, RequestAttributes.Secure | RequestAttributes.External); - PrintEnumResult(RequestAttributes.InternalNetworkAccess, RequestAttributes.Secure | RequestAttributes.Localhost); - PrintEnumResult(RequestAttributes.InternalNetworkAccess, RequestAttributes.Localhost); - - PrintEnumResult(RequestAttributes.Localhost, RequestAttributes.Secure | RequestAttributes.External); - PrintEnumResult(RequestAttributes.Localhost, RequestAttributes.Secure | RequestAttributes.InternalNetworkAccess); - PrintEnumResult(RequestAttributes.Localhost, RequestAttributes.LocalSubnet); - PrintEnumResult(RequestAttributes.Localhost, RequestAttributes.Secure); - } - - public void PrintEnumResult(RequestAttributes actual, RequestAttributes required) - { - Console.WriteLine(string.Format("({0} | {1}): {2}", actual, required, (actual | required))); - Console.WriteLine(string.Format("({0} & {1}): {2}", actual, required, (actual & required))); - Console.WriteLine(string.Format("({0} ^ {1}): {2}", actual, required, (actual ^ required))); - Console.WriteLine(); - } - - [Test] - public void Enum_masks_are_correct() - { + [Test] + public void LocalSubnetRestriction_allows_calls_from_LocalSubnet() + { + ShouldAllowAccessWhen(RequestAttributes.LocalSubnet); + ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.LocalSubnet); + } + + [Test] + public void LocalSubnetRestriction_does_not_allow_calls_from_Localhost() + { + ShouldDenyAccessWhen(RequestAttributes.Localhost); + ShouldDenyAccessWhen(RequestAttributes.External); + } + + [Test] + public void InternalRestriction_allows_calls_from_Localhost_and_LocalSubnet() + { + ShouldAllowAccessWhen(RequestAttributes.InProcess); + ShouldAllowAccessWhen(RequestAttributes.Localhost); + ShouldAllowAccessWhen(RequestAttributes.LocalSubnet); + ShouldDenyAccessWhen(RequestAttributes.External); + } + + [Test] + public void InProcessRestriction_does_not_allow_any_other_NetworkAccess() + { + ShouldAllowAccessWhen(RequestAttributes.InProcess); + ShouldDenyAccessWhen(RequestAttributes.Localhost); + ShouldDenyAccessWhen(RequestAttributes.LocalSubnet); + ShouldDenyAccessWhen(RequestAttributes.External); + } + + [Test] + public void SecureLocalSubnetRestriction_does_not_allow_partial_success() + { + ShouldDenyAccessWhen(RequestAttributes.Localhost); + ShouldDenyAccessWhen(RequestAttributes.InSecure | RequestAttributes.LocalSubnet); + ShouldDenyAccessWhen(RequestAttributes.InSecure); + ShouldDenyAccessWhen(RequestAttributes.Secure | RequestAttributes.Localhost); + ShouldAllowAccessWhen(RequestAttributes.Secure | RequestAttributes.LocalSubnet); + + ShouldDenyAccessWhen(RequestAttributes.Secure | RequestAttributes.External); + ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.LocalSubnet); + } + + [Test] + public void HttpPostXmlAndSecureLocalSubnetRestriction_does_not_allow_partial_success() + { + ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.LocalSubnet); + ShouldDenyAccessForOtherHttpRequestTypesScenarios(RequestAttributes.HttpPost); + + ShouldDenyAccessWhen(RequestAttributes.Localhost); + ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Json | RequestAttributes.Secure | RequestAttributes.LocalSubnet); + ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.Localhost); + + ShouldDenyAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpHead); + ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.InSecure); + + ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Json | RequestAttributes.Secure | RequestAttributes.LocalSubnet); + ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.Localhost); + + ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.LocalSubnet); + } + + [Test] + public void HttpPostXmlOrSecureLocalSubnetRestriction_does_allow_partial_success() + { + ShouldDenyAccessForOtherNetworkAccessScenarios(RequestAttributes.LocalSubnet); + + ShouldDenyAccessWhen(RequestAttributes.Localhost | RequestAttributes.HttpPut); + ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Secure | RequestAttributes.LocalSubnet); + ShouldDenyAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Json | RequestAttributes.Secure | RequestAttributes.Localhost); + + ShouldAllowAccessWhen(RequestAttributes.Secure | RequestAttributes.LocalSubnet); + ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml); + + ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Json | RequestAttributes.Secure | RequestAttributes.LocalSubnet); + ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.Localhost); + + ShouldAllowAccessWhen(RequestAttributes.HttpPost | RequestAttributes.Xml | RequestAttributes.Secure | RequestAttributes.LocalSubnet); + } + + [Test] + public void Can_access_from_insecure_dev_environment() + { + ShouldAllowAccessWhen(RequestAttributes.Localhost | RequestAttributes.InSecure | RequestAttributes.HttpPost); + ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.InSecure | RequestAttributes.HttpPost); + ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.Reply); + ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.OneWay); + } + + [Test] + public void Can_access_from_secure_dev_environment() + { + ShouldAllowAccessWhen(RequestAttributes.Localhost | RequestAttributes.Secure | RequestAttributes.HttpPost); + ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpPost); + ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Reply); + ShouldAllowAccessWhen(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.OneWay); + } + + [Test] + public void Can_access_from_insecure_live_environment() + { + ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.InSecure | RequestAttributes.HttpPost); + ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.Reply); + ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.OneWay); + } + + [Test] + public void Can_access_from_secure_live_environment() + { + ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.Secure | RequestAttributes.HttpPost); + ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Reply); + ShouldAllowAccessWhen(RequestAttributes.External | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.OneWay); + } + + [Test] + public void Can_access_MessageQueueRestriction_from_MQ() + { + ShouldAllowAccessWhen(RequestAttributes.Localhost | RequestAttributes.MessageQueue | RequestAttributes.HttpPost); + } + + [Test] + public void Can_not_access_MessageQueueRestriction_from_HTTP() + { + ShouldDenyAccessWhen(RequestAttributes.Localhost | RequestAttributes.Http | RequestAttributes.HttpPost); + } + + [Ignore("TODO: Ignore reason")] + [Test] + public void Print_enum_results() + { + PrintEnumResult(RequestAttributes.InternalNetworkAccess, RequestAttributes.Secure); + PrintEnumResult(RequestAttributes.InternalNetworkAccess, RequestAttributes.Secure | RequestAttributes.External); + PrintEnumResult(RequestAttributes.InternalNetworkAccess, RequestAttributes.Secure | RequestAttributes.Localhost); + PrintEnumResult(RequestAttributes.InternalNetworkAccess, RequestAttributes.Localhost); + + PrintEnumResult(RequestAttributes.Localhost, RequestAttributes.Secure | RequestAttributes.External); + PrintEnumResult(RequestAttributes.Localhost, RequestAttributes.Secure | RequestAttributes.InternalNetworkAccess); + PrintEnumResult(RequestAttributes.Localhost, RequestAttributes.LocalSubnet); + PrintEnumResult(RequestAttributes.Localhost, RequestAttributes.Secure); + } + + public void PrintEnumResult(RequestAttributes actual, RequestAttributes required) + { + $"({actual} | {required}): {actual | required}".Print(); + $"({actual} & {required}): {actual & required}".Print(); + $"({actual} ^ {required}): {actual ^ required}".Print(); + "".Print(); + } + + [Test] + public void Enum_masks_are_correct() + { const RequestAttributes network = RequestAttributes.Localhost | RequestAttributes.LocalSubnet | RequestAttributes.External; Assert.That((network.ToAllowedFlagsSet() & network) == network); const RequestAttributes security = RequestAttributes.Secure | RequestAttributes.InSecure; Assert.That((security.ToAllowedFlagsSet() & security) == security); - const RequestAttributes method = - RequestAttributes.HttpHead | RequestAttributes.HttpGet | RequestAttributes.HttpPost | - RequestAttributes.HttpPut | RequestAttributes.HttpDelete | RequestAttributes.HttpPatch | - RequestAttributes.HttpOptions | RequestAttributes.HttpOther; + const RequestAttributes method = + RequestAttributes.HttpHead | RequestAttributes.HttpGet | RequestAttributes.HttpPost | + RequestAttributes.HttpPut | RequestAttributes.HttpDelete | RequestAttributes.HttpPatch | + RequestAttributes.HttpOptions | RequestAttributes.HttpOther; Assert.That((method.ToAllowedFlagsSet() & method) == method); const RequestAttributes call = RequestAttributes.OneWay | RequestAttributes.Reply; Assert.That((call.ToAllowedFlagsSet() & call) == call); - const RequestAttributes format = - RequestAttributes.Soap11 | RequestAttributes.Soap12 | RequestAttributes.Xml | RequestAttributes.Json | - RequestAttributes.Jsv | RequestAttributes.ProtoBuf | RequestAttributes.Csv | RequestAttributes.Html | - RequestAttributes.Yaml | RequestAttributes.MsgPack | RequestAttributes.FormatOther; + const RequestAttributes format = + RequestAttributes.Soap11 | RequestAttributes.Soap12 | RequestAttributes.Xml | RequestAttributes.Json | + RequestAttributes.Jsv | RequestAttributes.ProtoBuf | RequestAttributes.Csv | RequestAttributes.Html | + RequestAttributes.Wire | RequestAttributes.MsgPack | RequestAttributes.FormatOther; Assert.That((format.ToAllowedFlagsSet() & format) == format); - const RequestAttributes endpoint = - RequestAttributes.Http | RequestAttributes.MessageQueue | RequestAttributes.Tcp | - RequestAttributes.EndpointOther; + const RequestAttributes endpoint = + RequestAttributes.Http | RequestAttributes.MessageQueue | RequestAttributes.Tcp | + RequestAttributes.EndpointOther; Assert.That((endpoint.ToAllowedFlagsSet() & endpoint) == endpoint); } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandling2Tests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandling2Tests.cs index 017587cd120..410f67b03a6 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandling2Tests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandling2Tests.cs @@ -3,13 +3,15 @@ using System.Runtime.Serialization; using NUnit.Framework; using ProtoBuf; +using ServiceStack.Text; using ServiceStack.ProtoBuf; +#if !NETCORE_SUPPORT using ServiceStack.ServiceModel; -using ServiceStack.Text; +#endif +using ServiceStack.Logging; namespace ServiceStack.WebHost.Endpoints.Tests { - [Route("/reqstars")] [DataContract] public class Reqstar //: IReturn> @@ -96,8 +98,8 @@ public object Any(SearchReqstars request) Total = 2, Aged = 10, Results = new List { - new Reqstar { Id = 1, FirstName = "Max", LastName = "Meier", Age = 10 }, - new Reqstar { Id = 2, FirstName = "Susan", LastName = "Stark", Age = 10 } + new Reqstar {Id = 1, FirstName = "Max", LastName = "Meier", Age = 10}, + new Reqstar {Id = 2, FirstName = "Susan", LastName = "Stark", Age = 10} } }; @@ -116,21 +118,19 @@ public object Any(SearchReqstars2 request) Total = 2, Aged = 10, Results = new List { - new Reqstar { Id = 1, FirstName = "Max", LastName = "Meier", Age = 10 }, - new Reqstar { Id = 2, FirstName = "Susan", LastName = "Stark", Age = 10 } + new Reqstar {Id = 1, FirstName = "Max", LastName = "Meier", Age = 10}, + new Reqstar {Id = 2, FirstName = "Susan", LastName = "Stark", Age = 10} } }; return response; } } - + public class AppHost : AppHostHttpListenerBase { public AppHost() - : base("Test ErrorHandling", typeof(ReqstarsService).Assembly) - { - } + : base("Test ErrorHandling", typeof(ReqstarsService).Assembly) { } public override void Configure(Funq.Container container) { @@ -141,19 +141,20 @@ public override void Configure(Funq.Container container) [TestFixture] public class ExceptionHandling2Tests { - private static string testUri = "http://localhost:1337/"; + private static string testUri = Config.ListeningOn; AppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { try { + LogManager.LogFactory = null; appHost = new AppHost(); appHost.Init(); + appHost.Start(Config.ListeningOn); appHost.Config.DebugMode = true; - appHost.Start("http://*:1337/"); } catch (Exception ex) { @@ -161,19 +162,19 @@ public void Init() } } - [TestFixtureTearDown] + [OneTimeTearDown] public void TearDown() { appHost.Dispose(); } - static IRestClient[] ServiceClients = - { - new JsonServiceClient(testUri), - new XmlServiceClient(testUri), - new JsvServiceClient(testUri), - new ProtoBufServiceClient(testUri) - }; + static IRestClient[] ServiceClients = { + new JsonServiceClient(testUri), + new JsonHttpClient(testUri), + new XmlServiceClient(testUri), + new JsvServiceClient(testUri), + new ProtoBufServiceClient(testUri) + }; /// @@ -183,7 +184,7 @@ public void TearDown() [Category("OldNamingConvention")] public void OldNamingConv_Get_ExpectingResults(IRestClient client) { - var response = client.Get(new SearchReqstars { Age = 10 }); + var response = client.Get(new SearchReqstars {Age = 10}); Assert.AreEqual(2, response.Total); } @@ -197,7 +198,7 @@ public void OldNamingConv_Get_ArgumentException_InvalidAge(IRestClient client) { try { - client.Get(new SearchReqstars { Age = -1 }); + client.Get(new SearchReqstars {Age = -1}); } catch (WebServiceException ex) { @@ -213,7 +214,7 @@ public void OldNamingConv_Get_ArgumentException_InvalidAge(IRestClient client) [Category("OldNamingConvention")] public void OldNamingConv_Post_ExpectingResults(IRestClient client) { - var response = client.Post(new SearchReqstars { Age = 10 }); + var response = client.Post(new SearchReqstars {Age = 10}); Assert.AreEqual(2, response.Total); } @@ -227,7 +228,7 @@ public void OldNamingConv_Post_ArgumentException_InvalidAge(IRestClient client) { try { - client.Post(new SearchReqstars { Age = -1 }); + client.Post(new SearchReqstars {Age = -1}); } catch (WebServiceException ex) { @@ -244,7 +245,7 @@ public void OldNamingConv_Post_ArgumentException_InvalidAge(IRestClient client) [Category("NoNamingConvention")] public void NoNamingConv_Get_ExpectingResults(IRestClient client) { - var response = client.Get(new SearchReqstars2 { Age = 10 }); + var response = client.Get(new SearchReqstars2 {Age = 10}); Assert.AreEqual(2, response.Total); } @@ -258,7 +259,7 @@ public void NoNamingConv_Get_ArgumentException_InvalidAge(IRestClient client) { try { - client.Get(new SearchReqstars2 { Age = -1 }); + client.Get(new SearchReqstars2 {Age = -1}); } catch (WebServiceException ex) { @@ -274,7 +275,7 @@ public void NoNamingConv_Get_ArgumentException_InvalidAge(IRestClient client) [Category("NoNamingConvention")] public void NoNamingConv_Post_ExpectingResults(IRestClient client) { - var response = client.Post(new SearchReqstars2 { Age = 10 }); + var response = client.Post(new SearchReqstars2 {Age = 10}); Assert.AreEqual(2, response.Total); } @@ -288,7 +289,7 @@ public void NoNamingConv_Post_ArgumentException_InvalidAge(IRestClient client) { try { - client.Post(new SearchReqstars2 { Age = -1 }); + client.Post(new SearchReqstars2 {Age = -1}); } catch (WebServiceException ex) { @@ -296,6 +297,5 @@ public void NoNamingConv_Post_ArgumentException_InvalidAge(IRestClient client) Assert.AreEqual("Invalid Age", ex.ErrorMessage, "Wrong message"); } } - } -} +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandlingTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandlingTests.cs index 83c42418f52..364c7aa4174 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandlingTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandlingTests.cs @@ -1,21 +1,37 @@ using System; +using System.IO; using System.Net; using System.Runtime.Serialization; using System.Threading.Tasks; using NUnit.Framework; using Funq; +using ServiceStack.ProtoBuf; using ServiceStack.Text; using ServiceStack.Web; namespace ServiceStack.WebHost.Endpoints.Tests { [Route("/users")] - public class User { } + [DataContract] + public class User {} + + [DataContract] public class UserResponse : IHasResponseStatus { - public ResponseStatus ResponseStatus { get; set; } + [DataMember(Order = 1)] public ResponseStatus ResponseStatus { get; set; } + } + + [Route("/usersvoid")] + public class UserVoid {} + + [DataContract] + public class UserVoidResponse : IHasResponseStatus + { + [DataMember(Order = 1)] public ResponseStatus ResponseStatus { get; set; } } + public class UserReturnVoid : IReturnVoid {} + public class UserService : Service { public object Get(User request) @@ -37,18 +53,32 @@ public object Put(User request) { throw new ArgumentException(); } + + public void Delete(UserVoid request) + { + throw new HttpError(HttpStatusCode.Forbidden, "CanNotExecute", "Failed to execute!"); + } + + public void Delete(UserReturnVoid request) + { + throw new HttpError(HttpStatusCode.Forbidden, "CanNotExecute", "Failed to execute!"); + } } public class CustomException : ArgumentException { - public CustomException() : base("User Defined Error") { } + public CustomException() : base("User Defined Error") + { + } } - public class ExceptionWithResponseStatus { } + public class ExceptionWithResponseStatus {} + public class ExceptionWithResponseStatusResponse { public ResponseStatus ResponseStatus { get; set; } } + public class ExceptionWithResponseStatusService : Service { public object Any(ExceptionWithResponseStatus request) @@ -57,8 +87,10 @@ public object Any(ExceptionWithResponseStatus request) } } - public class ExceptionNoResponseStatus { } - public class ExceptionNoResponseStatusResponse { } + public class ExceptionNoResponseStatus {} + + public class ExceptionNoResponseStatusResponse {} + public class ExceptionNoResponseStatusService : Service { public object Any(ExceptionNoResponseStatus request) @@ -67,7 +99,8 @@ public object Any(ExceptionNoResponseStatus request) } } - public class ExceptionNoResponseDto { } + public class ExceptionNoResponseDto {} + public class ExceptionNoResponseDtoService : Service { public object Any(ExceptionNoResponseDto request) @@ -76,8 +109,19 @@ public object Any(ExceptionNoResponseDto request) } } - public class CaughtException { } - public class CaughtExceptionAsync { } + public class ExceptionReturnVoid : IReturnVoid {} + + public class ExceptionReturnVoidService : Service + { + public void Any(ExceptionReturnVoid request) + { + throw new CustomException(); + } + } + + public class CaughtException {} + public class CaughtExceptionAsync {} + public class CaughtExceptionService : Service { public object Any(CaughtException request) @@ -92,9 +136,10 @@ public async Task Any(CaughtExceptionAsync request) } } - public class UncatchedException { } - public class UncatchedExceptionAsync { } - public class UncatchedExceptionResponse { } + public class UncatchedException {} + public class UncatchedExceptionAsync {} + public class UncatchedExceptionResponse {} + public class UncatchedExceptionService : Service { public object Any(UncatchedException request) @@ -125,27 +170,68 @@ public object Any(ExceptionWithRequestBinding request) } } - public class CustomHttpError { } + public class CustomHttpError + { + public int StatusCode { get; set; } + public string StatusDescription { get; set; } + } + public class CustomHttpErrorResponse { public string Custom { get; set; } public ResponseStatus ResponseStatus { get; set; } } + public class CustomHttpErrorService : Service { public object Any(CustomHttpError request) { - throw new HttpError(new CustomHttpErrorResponse - { - Custom = "Ignored", - ResponseStatus = new ResponseStatus("StatusErrorCode", "StatusErrorMessage") - }, - 500, - "HeaderErrorCode"); + throw new HttpError(request.StatusCode, request.StatusDescription); + } + } + + + [Route("/alwaysthrowsjsscope")] + [DataContract] + public class AlwaysThrowsJsScope + { + [DataMember] public string TheValue { get; set; } + } + + public class CustomFieldHttpError {} + + public class CustomFieldHttpErrorResponse + { + public string Custom { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class CustomFieldHttpErrorService : Service + { + public object Any(CustomFieldHttpError request) + { + throw new HttpError(new CustomFieldHttpErrorResponse + { + Custom = "Ignored", + ResponseStatus = new ResponseStatus("StatusErrorCode", "StatusErrorMessage") + }, + 500, + "HeaderErrorCode"); } + + public object Any(AlwaysThrowsJsScope request) => + throw new HttpError(HttpStatusCode.BadRequest) + { + ResultScope = () => JsConfig.With(new Text.Config + { + TextCase = TextCase.SnakeCase, + }) + }; } - public class DirectHttpError { } + + public class DirectHttpError {} + public class DirectResponseService : Service { public object Any(DirectHttpError request) @@ -153,7 +239,7 @@ public object Any(DirectHttpError request) base.Response.StatusCode = 500; base.Response.StatusDescription = "HeaderErrorCode"; - return new CustomHttpErrorResponse + return new CustomFieldHttpErrorResponse { Custom = "Not Ignored", ResponseStatus = new ResponseStatus("StatusErrorCode", "StatusErrorMessage") @@ -161,29 +247,51 @@ public object Any(DirectHttpError request) } } + public class ErrorStream {} + + public class ErrorStreamService : Service + { + [AddHeader(ContentType = "application/pdf")] + public Stream Any(ErrorStream request) + { + throw new NotImplementedException("Exception in Stream Response"); + } + } + [TestFixture] public class ExceptionHandlingTests { - private const string ListeningOn = "http://localhost:1337/"; - - public class ExceptionHandlingAppHostHttpListener - : AppHostHttpListenerBase + public class AppHost : AppSelfHostBase { - - public ExceptionHandlingAppHostHttpListener() - : base("Exception handling tests", typeof(UserService).Assembly) { } + public AppHost() + : base(nameof(ExceptionHandlingTests), typeof(UserService).Assembly) + { + } public override void Configure(Container container) { - JsConfig.EmitCamelCaseNames = true; + JsConfig.Init(new Text.Config + { + TextCase = TextCase.CamelCase, + }); + + SetConfig(new HostConfig + { + DebugMode = false, + }); - SetConfig(new HostConfig { DebugMode = false }); + Plugins.Add(new ProtoBufFormat()); + + GlobalRequestFilters.Add((req, res, dto) => { + if (dto is UncatchedException || dto is UncatchedExceptionAsync) + throw new ArgumentException(); + }); //Custom global uncaught exception handling strategy this.UncaughtExceptionHandlers.Add((req, res, operationName, ex) => { - res.Write(string.Format("UncaughtException {0}", ex.GetType().Name)); - res.EndRequest(skipHeaders: true); + res.WriteAsync($"UncaughtException {ex.GetType().Name}") + .ContinueWith(t => res.EndRequest(skipHeaders: true)); }); this.ServiceExceptionHandlers.Add((httpReq, request, ex) => @@ -192,9 +300,7 @@ public override void Configure(Container container) throw ex; if (request is CaughtException || request is CaughtExceptionAsync) - { return DtoUtils.CreateErrorResponse(request, new ArgumentException("ExceptionCaught")); - } return null; }); @@ -206,39 +312,42 @@ public override void OnExceptionTypeFilter(Exception ex, ResponseStatus response base.OnExceptionTypeFilter(ex, responseStatus); } - public override void OnUncaughtException(IRequest httpReq, IResponse httpRes, string operationName, Exception ex) + public override Task OnUncaughtException(IRequest httpReq, IResponse httpRes, string operationName, + Exception ex) { "In OnUncaughtException...".Print(); - base.OnUncaughtException(httpReq, httpRes, operationName, ex); + return base.OnUncaughtException(httpReq, httpRes, operationName, ex); } } - ExceptionHandlingAppHostHttpListener appHost; + AppHost appHost; - [TestFixtureSetUp] - public void OnTestFixtureSetUp() + public ExceptionHandlingTests() { - appHost = new ExceptionHandlingAppHostHttpListener(); + appHost = new AppHost(); appHost.Init(); - appHost.Start(ListeningOn); + appHost.Start(Config.ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); appHost.UncaughtExceptionHandlers = null; + JsConfig.Reset(); } - static IRestClient[] ServiceClients = - { - new JsonServiceClient(ListeningOn), - new XmlServiceClient(ListeningOn), - new JsvServiceClient(ListeningOn) - //SOAP not supported in HttpListener - //new Soap11ServiceClient(ServiceClientBaseUri), - //new Soap12ServiceClient(ServiceClientBaseUri) - }; + static IRestClient[] ServiceClients = + { + new JsonServiceClient(Config.ListeningOn), + new JsonHttpClient(Config.ListeningOn), + new XmlServiceClient(Config.ListeningOn), + new JsvServiceClient(Config.ListeningOn), + new ProtoBufServiceClient(Config.ListeningOn), + //SOAP not supported in HttpListener + //new Soap11ServiceClient(ServiceClientBaseUri), + //new Soap12ServiceClient(ServiceClientBaseUri) + }; [Test, TestCaseSource("ServiceClients")] @@ -251,9 +360,9 @@ public void Handles_Returned_Http_Error(IRestClient client) } catch (WebServiceException ex) { + Assert.That(ex.StatusCode, Is.EqualTo((int) System.Net.HttpStatusCode.BadRequest)); Assert.That(ex.ErrorCode, Is.EqualTo("CanNotExecute")); - Assert.That(ex.StatusCode, Is.EqualTo((int)System.Net.HttpStatusCode.BadRequest)); - Assert.That(ex.Message, Is.EqualTo("CanNotExecute")); + Assert.That(ex.Message, Is.EqualTo("Failed to execute!")); } } @@ -267,9 +376,9 @@ public void Handles_Thrown_Http_Error(IRestClient client) } catch (WebServiceException ex) { + Assert.That(ex.StatusCode, Is.EqualTo((int) System.Net.HttpStatusCode.BadRequest)); Assert.That(ex.ErrorCode, Is.EqualTo("CanNotExecute")); - Assert.That(ex.StatusCode, Is.EqualTo((int)System.Net.HttpStatusCode.BadRequest)); - Assert.That(ex.Message, Is.EqualTo("CanNotExecute")); + Assert.That(ex.Message, Is.EqualTo("Failed to execute!")); } } @@ -283,9 +392,41 @@ public void Handles_Thrown_Http_Error_With_Forbidden_status_code(IRestClient cli } catch (WebServiceException ex) { + Assert.That(ex.StatusCode, Is.EqualTo((int) System.Net.HttpStatusCode.Forbidden)); Assert.That(ex.ErrorCode, Is.EqualTo("CanNotExecute")); - Assert.That(ex.StatusCode, Is.EqualTo((int)System.Net.HttpStatusCode.Forbidden)); - Assert.That(ex.Message, Is.EqualTo("CanNotExecute")); + Assert.That(ex.Message, Is.EqualTo("Failed to execute!")); + } + } + + [Test, TestCaseSource("ServiceClients")] + public void Handles_Thrown_Http_Error_With_Forbidden_status_code_in_void_method(IRestClient client) + { + try + { + client.Delete("/usersvoid"); + Assert.Fail(); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int) System.Net.HttpStatusCode.Forbidden)); + Assert.That(ex.ErrorCode, Is.EqualTo("CanNotExecute")); + Assert.That(ex.Message, Is.EqualTo("Failed to execute!")); + } + } + + [Test, TestCaseSource("ServiceClients")] + public void Handles_Thrown_Http_Error_With_Forbidden_status_code_using_IReturnVoid(IRestClient client) + { + try + { + client.Delete(new UserReturnVoid()); + Assert.Fail(); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int) System.Net.HttpStatusCode.Forbidden)); + Assert.That(ex.ErrorCode, Is.EqualTo("CanNotExecute")); + Assert.That(ex.Message, Is.EqualTo("Failed to execute!")); } } @@ -299,14 +440,33 @@ public void Handles_Normal_Exception(IRestClient client) } catch (WebServiceException ex) { + Assert.That(ex.IsAny400()); + Assert.That(!ex.IsAny500()); Assert.That(ex.ErrorCode, Is.EqualTo("ArgumentException")); - Assert.That(ex.StatusCode, Is.EqualTo((int)System.Net.HttpStatusCode.BadRequest)); + Assert.That(ex.StatusCode, Is.EqualTo((int) System.Net.HttpStatusCode.BadRequest)); + } + } + + [Test, TestCaseSource("ServiceClients")] + public void Handles_Exception_in_Stream_Response(IRestClient client) + { + try + { + var response = client.Get(new ErrorStream()); + Assert.Fail(); + } + catch (WebServiceException ex) + { + Assert.That(ex.IsAny400()); + Assert.That(!ex.IsAny500()); + Assert.That(ex.ErrorCode, Is.EqualTo("NotImplementedException")); + Assert.That(ex.StatusCode, Is.EqualTo((int) System.Net.HttpStatusCode.MethodNotAllowed)); } } public string PredefinedJsonUrl() { - return ListeningOn + "json/reply/" + typeof(T).Name; + return Config.ListeningOn + "json/reply/" + typeof(T).Name; } [Test] @@ -319,8 +479,10 @@ public void Returns_populated_dto_when_has_ResponseStatus() } catch (WebException webEx) { - var errorResponse = ((HttpWebResponse)webEx.Response); - var body = errorResponse.GetResponseStream().ReadFully().FromUtf8Bytes(); + var errorResponse = ((HttpWebResponse) webEx.Response); + Assert.That(webEx.IsAny400()); + Assert.That(!webEx.IsAny500()); + var body = errorResponse.GetResponseStream().ReadToEnd(); Assert.That(body, Is.EqualTo( "{\"responseStatus\":{\"errorCode\":\"CustomException\",\"message\":\"User Defined Error\",\"errors\":[]}}")); } @@ -336,8 +498,8 @@ public void Returns_empty_dto_when_NoResponseStatus() } catch (WebException webEx) { - var errorResponse = ((HttpWebResponse)webEx.Response); - var body = errorResponse.GetResponseStream().ReadFully().FromUtf8Bytes(); + var errorResponse = ((HttpWebResponse) webEx.Response); + var body = errorResponse.GetResponseStream().ReadToEnd(); Assert.That(body, Is.EqualTo("{}")); } } @@ -352,28 +514,67 @@ public void Returns_no_body_when_NoResponseDto() } catch (WebException webEx) { - var errorResponse = ((HttpWebResponse)webEx.Response); - var body = errorResponse.GetResponseStream().ReadFully().FromUtf8Bytes(); - Assert.That(body, Is.StringStarting("{\"responseStatus\":{\"errorCode\":\"CustomException\",\"message\":\"User Defined Error\"")); + var errorResponse = ((HttpWebResponse) webEx.Response); + var body = errorResponse.GetResponseStream().ReadToEnd(); + Assert.That(body, + Does.StartWith( + "{\"responseStatus\":{\"errorCode\":\"CustomException\",\"message\":\"User Defined Error\"")); } } [Test] - public void Returns_custom_ResponseStatus_with_CustomHttpError() + public void Returns_exception_when_ReturnVoid() { try { - var json = PredefinedJsonUrl().GetJsonFromUrl(); + var json = PredefinedJsonUrl().GetJsonFromUrl(); Assert.Fail("Should throw"); } catch (WebException webEx) { - var errorResponse = ((HttpWebResponse)webEx.Response); - Assert.That((int)errorResponse.StatusCode, Is.EqualTo(500)); + var errorResponse = ((HttpWebResponse) webEx.Response); + var body = errorResponse.GetResponseStream().ReadToEnd(); + Assert.That(body, + Does.StartWith( + "{\"responseStatus\":{\"errorCode\":\"CustomException\",\"message\":\"User Defined Error\"")); + } + + try + { + var client = new JsonServiceClient(Config.ListeningOn); + client.Get(new ExceptionReturnVoid()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.IsAny400()); + Assert.That(ex.StatusDescription, Is.EqualTo(typeof(CustomException).Name)); + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(CustomException).Name)); + Assert.That(ex.ErrorMessage, Is.EqualTo("User Defined Error")); + Assert.That(ex.ResponseBody, + Does.StartWith( + "{\"responseStatus\":{\"errorCode\":\"CustomException\",\"message\":\"User Defined Error\"")); + } + } + + [Test] + public void Returns_custom_ResponseStatus_with_CustomFieldHttpError() + { + try + { + var json = PredefinedJsonUrl().GetJsonFromUrl(); + Assert.Fail("Should throw"); + } + catch (WebException webEx) + { + var errorResponse = ((HttpWebResponse) webEx.Response); + Assert.That((int) errorResponse.StatusCode, Is.EqualTo(500)); + Assert.That(webEx.IsAny500()); Assert.That(errorResponse.StatusDescription, Is.EqualTo("HeaderErrorCode")); - var body = errorResponse.GetResponseStream().ReadFully().FromUtf8Bytes(); - var customResponse = body.FromJson(); + var body = errorResponse.GetResponseStream().ReadToEnd(); + var customResponse = body.FromJson(); var errorStatus = customResponse.ResponseStatus; Assert.That(errorStatus.ErrorCode, Is.EqualTo("StatusErrorCode")); Assert.That(errorStatus.Message, Is.EqualTo("StatusErrorMessage")); @@ -381,6 +582,26 @@ public void Returns_custom_ResponseStatus_with_CustomHttpError() } } + [Test] + public void Returns_custom_Status_and_Description_with_CustomHttpError() + { + try + { + var json = PredefinedJsonUrl() + .AddQueryParam("StatusCode", 406) + .AddQueryParam("StatusDescription", "CustomDescription") + .GetJsonFromUrl(); + Assert.Fail("Should throw"); + } + catch (WebException webEx) + { + var errorResponse = ((HttpWebResponse) webEx.Response); + Assert.That((int) errorResponse.StatusCode, Is.EqualTo(406)); + Assert.That(webEx.IsAny400()); + Assert.That(errorResponse.StatusDescription, Is.EqualTo("CustomDescription")); + } + } + [Test] public void Returns_custom_ResponseStatus_with_DirectHttpError() { @@ -391,12 +612,13 @@ public void Returns_custom_ResponseStatus_with_DirectHttpError() } catch (WebException webEx) { - var errorResponse = ((HttpWebResponse)webEx.Response); - Assert.That((int)errorResponse.StatusCode, Is.EqualTo(500)); + var errorResponse = ((HttpWebResponse) webEx.Response); + Assert.That((int) errorResponse.StatusCode, Is.EqualTo(500)); + Assert.That(webEx.IsAny500()); Assert.That(errorResponse.StatusDescription, Is.EqualTo("HeaderErrorCode")); - var body = errorResponse.GetResponseStream().ReadFully().FromUtf8Bytes(); - var customResponse = body.FromJson(); + var body = errorResponse.GetResponseStream().ReadToEnd(); + var customResponse = body.FromJson(); var errorStatus = customResponse.ResponseStatus; Assert.That(errorStatus.ErrorCode, Is.EqualTo("StatusErrorCode")); Assert.That(errorStatus.Message, Is.EqualTo("StatusErrorMessage")); @@ -407,7 +629,7 @@ public void Returns_custom_ResponseStatus_with_DirectHttpError() [Test] public void Can_override_global_exception_handling() { - var req = (HttpWebRequest)WebRequest.Create(PredefinedJsonUrl()); + var req = (HttpWebRequest) WebRequest.Create(PredefinedJsonUrl()); var res = req.GetResponse().ReadToEnd(); Assert.AreEqual("UncaughtException ArgumentException", res); } @@ -415,7 +637,7 @@ public void Can_override_global_exception_handling() [Test] public void Can_override_global_exception_handling_async() { - var req = (HttpWebRequest)WebRequest.Create(PredefinedJsonUrl()); + var req = (HttpWebRequest) WebRequest.Create(PredefinedJsonUrl()); var res = req.GetResponse().ReadToEnd(); Assert.AreEqual("UncaughtException ArgumentException", res); } @@ -425,7 +647,7 @@ public void Can_override_caught_exception() { try { - var req = (HttpWebRequest)WebRequest.Create(PredefinedJsonUrl()); + var req = (HttpWebRequest) WebRequest.Create(PredefinedJsonUrl()); var res = req.GetResponse().ReadToEnd(); Assert.Fail("Should Throw"); } @@ -443,7 +665,7 @@ public void Can_override_caught_exception_async() { try { - var req = (HttpWebRequest)WebRequest.Create(PredefinedJsonUrl()); + var req = (HttpWebRequest) WebRequest.Create(PredefinedJsonUrl()); var res = req.GetResponse().ReadToEnd(); Assert.Fail("Should Throw"); } @@ -465,5 +687,20 @@ public void Request_binding_error_raises_UncaughtException() Assert.That(response, Is.EqualTo("UncaughtException SerializationException")); } + + [Test] + public void Does_serialize_HttpError_with_CustomScope() + { + try + { + var json = Config.ListeningOn.AppendPath("/alwaysthrowsjsscope").GetJsonFromUrl(); + Assert.Fail("Should throw"); + } + catch (WebException e) + { + var json = e.GetResponseBody(); + Assert.That(json, Does.Contain("response_status")); + } + } } -} +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandlingTestsAsync.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandlingTestsAsync.cs new file mode 100644 index 00000000000..8e9d60b7426 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ExceptionHandlingTestsAsync.cs @@ -0,0 +1,148 @@ +using System; +using System.Net; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [TestFixture] + public class ExceptionHandlingTestsAsync + { + readonly AppHost appHost; + public ExceptionHandlingTestsAsync() + { + appHost = new AppHost(); + appHost.Init(); + appHost.Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + appHost.UncaughtExceptionHandlers = null; + } + + public class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ExceptionHandlingTestsAsync), typeof(UserService).Assembly) { } + + public static int OnEndRequestCallbacksCount; + + public override void Configure(Container container) + { + SetConfig(new HostConfig { DebugMode = false }); + + OnEndRequestCallbacks.Add(req => { + Interlocked.Increment(ref OnEndRequestCallbacksCount); + }); + + GlobalRequestFilters.Add((req, res, dto) => { + if (dto is UncatchedException || dto is UncatchedExceptionAsync) + throw new ArgumentException(); + }); + + //Custom global uncaught exception handling strategy + this.UncaughtExceptionHandlersAsync.Add(async (req, res, operationName, ex) => + { + await res.WriteAsync($"UncaughtException {ex.GetType().Name}"); + res.EndRequest(skipHeaders: true); + }); + + this.ServiceExceptionHandlersAsync.Add(async (httpReq, request, ex) => + { + await Task.Yield(); + + if (request is UncatchedException || request is UncatchedExceptionAsync) + throw ex; + + if (request is CaughtException || request is CaughtExceptionAsync) + return DtoUtils.CreateErrorResponse(request, new ArgumentException("ExceptionCaught")); + + return null; + }); + } + + public override Task OnUncaughtException(IRequest httpReq, IResponse httpRes, string operationName, Exception ex) + { + "In OnUncaughtException...".Print(); + return base.OnUncaughtException(httpReq, httpRes, operationName, ex); + } + } + + public string PredefinedJsonUrl() + { + return Config.ListeningOn + "json/reply/" + typeof(T).Name; + } + + [Test] + public void Can_override_global_exception_handling() + { + var req = (HttpWebRequest)WebRequest.Create(PredefinedJsonUrl()); + var res = req.GetResponse().ReadToEnd(); + Assert.AreEqual("UncaughtException ArgumentException", res); + } + + [Test] + public void Can_override_global_exception_handling_async() + { + var req = (HttpWebRequest)WebRequest.Create(PredefinedJsonUrl()); + var res = req.GetResponse().ReadToEnd(); + Assert.AreEqual("UncaughtException ArgumentException", res); + } + + [Test] + public void Can_override_caught_exception() + { + try + { + var req = (HttpWebRequest)WebRequest.Create(PredefinedJsonUrl()); + var res = req.GetResponse().ReadToEnd(); + Assert.Fail("Should Throw"); + } + catch (WebException ex) + { + Assert.That(ex.IsAny400()); + var json = ex.GetResponseBody(); + var response = json.FromJson(); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("ExceptionCaught")); + } + } + + [Test] + public void Can_override_caught_exception_async() + { + try + { + var req = (HttpWebRequest)WebRequest.Create(PredefinedJsonUrl()); + var res = req.GetResponse().ReadToEnd(); + Assert.Fail("Should Throw"); + } + catch (WebException ex) + { + Assert.That(ex.IsAny400()); + var json = ex.GetResponseBody(); + var response = json.FromJson(); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("ExceptionCaught")); + } + } + + [Test] + public void Request_binding_error_raises_UncaughtException() + { + Interlocked.Exchange(ref AppHost.OnEndRequestCallbacksCount, 0); + + var response = PredefinedJsonUrl() + .AddQueryParam("Id", "NaN") + .GetStringFromUrl(); + + Assert.That(AppHost.OnEndRequestCallbacksCount, Is.EqualTo(1)); + Assert.That(response, Is.EqualTo("UncaughtException SerializationException")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/FileUploadTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/FileUploadTests.cs index 68aed6bf798..fda5b13cd1a 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/FileUploadTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/FileUploadTests.cs @@ -2,6 +2,7 @@ using System.IO; using System.Net; using System.Threading; +using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.Text; using ServiceStack.Web; @@ -13,10 +14,10 @@ namespace ServiceStack.WebHost.Endpoints.Tests [TestFixture] public class FileUploadTests { - public const string ListeningOn = "http://localhost:8082/"; + string ListeningOn = Config.ListeningOn; ExampleAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TextFixtureSetUp() { try @@ -31,14 +32,14 @@ public void TextFixtureSetUp() } } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); } [Test] - [Explicit("Helps debugging when you need to find out WTF is going on")] + [Ignore("Helps debugging when you need to find out WTF is going on")] public void Run_for_30secs() { Thread.Sleep(30000); @@ -50,7 +51,7 @@ public void AssertResponse(HttpWebResponse response, Action customAssert) AssertResponse(response, contentType); - var contents = new StreamReader(response.GetResponseStream()).ReadToEnd(); + var contents = response.GetResponseStream().ReadToEnd(); var result = DeserializeResult(response, contents, contentType); customAssert(result); @@ -87,10 +88,11 @@ public void AssertResponse(HttpWebResponse response, string contentType) Assert.That(response.ContentType.StartsWith(contentType)); } +#if !NETCORE_SUPPORT [Test] public void Can_POST_upload_file() { - var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); var webRequest = (HttpWebRequest)WebRequest.Create(ListeningOn + "/fileuploads"); webRequest.Accept = MimeTypes.Json; @@ -98,27 +100,30 @@ public void Can_POST_upload_file() AssertResponse((HttpWebResponse)webResponse, r => { - var expectedContents = new StreamReader(uploadFile.OpenRead()).ReadToEnd(); + var expectedContents = uploadFile.OpenRead().ReadToEnd(); + Assert.That(r.Name, Is.EqualTo("file")); Assert.That(r.FileName, Is.EqualTo(uploadFile.Name)); Assert.That(r.ContentLength, Is.EqualTo(uploadFile.Length)); Assert.That(r.ContentType, Is.EqualTo(MimeTypes.GetMimeType(uploadFile.Name))); Assert.That(r.Contents, Is.EqualTo(expectedContents)); }); } +#endif [Test] public void Can_POST_upload_file_using_ServiceClient() { IServiceClient client = new JsonServiceClient(ListeningOn); - var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); var response = client.PostFile( ListeningOn + "/fileuploads", uploadFile, MimeTypes.GetMimeType(uploadFile.Name)); - var expectedContents = new StreamReader(uploadFile.OpenRead()).ReadToEnd(); + var expectedContents = uploadFile.OpenRead().ReadToEnd(); + Assert.That(response.Name, Is.EqualTo("file")); Assert.That(response.FileName, Is.EqualTo(uploadFile.Name)); Assert.That(response.ContentLength, Is.EqualTo(uploadFile.Length)); Assert.That(response.ContentType, Is.EqualTo(MimeTypes.GetMimeType(uploadFile.Name))); @@ -130,12 +135,16 @@ public void Can_POST_upload_file_using_ServiceClient_with_request() { IServiceClient client = new JsonServiceClient(ListeningOn); - var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); var request = new FileUpload { CustomerId = 123, CustomerName = "Foo,Bar" }; - var response = client.PostFileWithRequest(ListeningOn + "/fileuploads", uploadFile, request); + var response = client.PostFileWithRequest( + ListeningOn + "/fileuploads", + uploadFile, + request); - var expectedContents = new StreamReader(uploadFile.OpenRead()).ReadToEnd(); + var expectedContents = uploadFile.OpenRead().ReadToEnd(); + Assert.That(response.Name, Is.EqualTo("upload")); Assert.That(response.FileName, Is.EqualTo(uploadFile.Name)); Assert.That(response.ContentLength, Is.EqualTo(uploadFile.Length)); Assert.That(response.Contents, Is.EqualTo(expectedContents)); @@ -143,16 +152,115 @@ public void Can_POST_upload_file_using_ServiceClient_with_request() Assert.That(response.CustomerId, Is.EqualTo(123)); } + [Test] + public void Can_POST_upload_file_using_ServiceClient_with_request_and_QueryString() + { + IServiceClient client = new JsonServiceClient(ListeningOn); + + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); + + var request = new FileUpload(); + var response = client.PostFileWithRequest( + ListeningOn + "/fileuploads?CustomerId=123&CustomerName=Foo,Bar", + uploadFile, request); + + var expectedContents = uploadFile.OpenRead().ReadToEnd(); + Assert.That(response.Name, Is.EqualTo("upload")); + Assert.That(response.FileName, Is.EqualTo(uploadFile.Name)); + Assert.That(response.ContentLength, Is.EqualTo(uploadFile.Length)); + Assert.That(response.Contents, Is.EqualTo(expectedContents)); + Assert.That(response.CustomerName, Is.EqualTo("Foo,Bar")); + Assert.That(response.CustomerId, Is.EqualTo(123)); + } + + [Test] + public void Can_POST_upload_multiple_files_using_ServiceClient_with_request_and_QueryString() + { + IServiceClient client = new JsonServiceClient(ListeningOn); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); + + using (var stream1 = uploadFile.OpenRead()) + using (var stream2 = uploadFile.OpenRead()) + { + var response = client.PostFilesWithRequest( + ListeningOn + "/multi-fileuploads?CustomerId=123", + new MultipleFileUpload { CustomerName = "Foo,Bar" }, + new[] { + new UploadFile("upload1.html", stream1), + new UploadFile("upload2.html", stream2), + }); + + var expectedContents = uploadFile.OpenRead().ReadToEnd(); + + Assert.That(response.Results.Count, Is.EqualTo(2)); + + var file1 = response.Results[0]; + Assert.That(file1.Name, Is.EqualTo("upload0")); + Assert.That(file1.FileName, Is.EqualTo("upload1.html")); + Assert.That(file1.ContentLength, Is.EqualTo(uploadFile.Length)); + Assert.That(file1.Contents, Is.EqualTo(expectedContents)); + Assert.That(file1.CustomerName, Is.EqualTo("Foo,Bar")); + Assert.That(file1.CustomerId, Is.EqualTo(123)); + + var file2 = response.Results[1]; + Assert.That(file2.Name, Is.EqualTo("upload1")); + Assert.That(file2.FileName, Is.EqualTo("upload2.html")); + Assert.That(file2.ContentLength, Is.EqualTo(uploadFile.Length)); + Assert.That(file2.Contents, Is.EqualTo(expectedContents)); + Assert.That(file2.CustomerName, Is.EqualTo("Foo,Bar")); + Assert.That(file2.CustomerId, Is.EqualTo(123)); + } + } + + [Test] + public async Task Can_POST_upload_multiple_files_using_ServiceClient_with_request_and_QueryString_JsonHttpClient() + { + var client = new JsonHttpClient(ListeningOn); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); + + using (var stream1 = uploadFile.OpenRead()) + using (var stream2 = uploadFile.OpenRead()) + { + var response = await client.PostFilesWithRequestAsync( + new MultipleFileUpload { CustomerId = 123, CustomerName = "Foo,Bar" }, + new[] { + new UploadFile("upload1.html", stream1), + new UploadFile("upload2.html", stream2), + }); + + var expectedContents = uploadFile.OpenRead().ReadToEnd(); + + Assert.That(response.Results.Count, Is.EqualTo(2)); + + var file1 = response.Results[0]; + Assert.That(file1.Name, Is.EqualTo("upload0")); + Assert.That(file1.FileName, Is.EqualTo("upload1.html")); + Assert.That(file1.ContentLength, Is.EqualTo(uploadFile.Length)); + Assert.That(file1.Contents, Is.EqualTo(expectedContents)); + Assert.That(file1.CustomerName, Is.EqualTo("Foo,Bar")); + Assert.That(file1.CustomerId, Is.EqualTo(123)); + + var file2 = response.Results[1]; + Assert.That(file2.Name, Is.EqualTo("upload1")); + Assert.That(file2.FileName, Is.EqualTo("upload2.html")); + Assert.That(file2.ContentLength, Is.EqualTo(uploadFile.Length)); + Assert.That(file2.Contents, Is.EqualTo(expectedContents)); + Assert.That(file2.CustomerName, Is.EqualTo("Foo,Bar")); + Assert.That(file2.CustomerId, Is.EqualTo(123)); + } + } + [Test] public void Can_POST_upload_file_using_ServiceClient_with_request_containing_utf8_chars() { var client = new JsonServiceClient(ListeningOn); - var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); var request = new FileUpload { CustomerId = 123, CustomerName = "Föяšč" }; var response = client.PostFileWithRequest(ListeningOn + "/fileuploads", uploadFile, request); - var expectedContents = new StreamReader(uploadFile.OpenRead()).ReadToEnd(); + var expectedContents = uploadFile.OpenRead().ReadToEnd(); + Assert.That(response.Name, Is.EqualTo("upload")); Assert.That(response.FileName, Is.EqualTo(uploadFile.Name)); Assert.That(response.ContentLength, Is.EqualTo(uploadFile.Length)); Assert.That(response.Contents, Is.EqualTo(expectedContents)); @@ -165,7 +273,7 @@ public void Can_handle_error_on_POST_upload_file_using_ServiceClient() { IServiceClient client = new JsonServiceClient(ListeningOn); - var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); try { @@ -187,12 +295,12 @@ public void Can_handle_error_on_POST_upload_file_using_ServiceClient() [Test] public void Can_GET_upload_file() { - var uploadedFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadedFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); var webRequest = (HttpWebRequest)WebRequest.Create(ListeningOn + "/fileuploads/TestExistingDir/upload.html"); - var expectedContents = new StreamReader(uploadedFile.OpenRead()).ReadToEnd(); + var expectedContents = uploadedFile.OpenRead().ReadToEnd(); var webResponse = webRequest.GetResponse(); - var actualContents = new StreamReader(webResponse.GetResponseStream()).ReadToEnd(); + var actualContents = webResponse.GetResponseStream().ReadToEnd(); Assert.That(webResponse.ContentType, Is.EqualTo(MimeTypes.GetMimeType(uploadedFile.Name))); Assert.That(actualContents, Is.EqualTo(expectedContents)); @@ -205,7 +313,7 @@ public void Can_POST_upload_file_and_apply_filter_using_ServiceClient() { var client = new JsonServiceClient(ListeningOn); - var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); bool isFilterCalled = false; ServiceClientBase.GlobalRequestFilter = request => { isFilterCalled = true; }; @@ -213,8 +321,9 @@ public void Can_POST_upload_file_and_apply_filter_using_ServiceClient() ListeningOn + "/fileuploads", uploadFile, MimeTypes.GetMimeType(uploadFile.Name)); - var expectedContents = new StreamReader(uploadFile.OpenRead()).ReadToEnd(); + var expectedContents = uploadFile.OpenRead().ReadToEnd(); Assert.That(isFilterCalled); + Assert.That(response.Name, Is.EqualTo("file")); Assert.That(response.FileName, Is.EqualTo(uploadFile.Name)); Assert.That(response.ContentLength, Is.EqualTo(uploadFile.Length)); Assert.That(response.ContentType, Is.EqualTo(MimeTypes.GetMimeType(uploadFile.Name))); @@ -233,7 +342,7 @@ public void Can_POST_upload_stream_using_ServiceClient() { var client = new JsonServiceClient(ListeningOn); - using (var fileStream = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()).OpenRead()) + using (var fileStream = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()).OpenRead()) { var fileName = "upload.html"; @@ -243,12 +352,13 @@ public void Can_POST_upload_stream_using_ServiceClient() isFilterCalled = true; }; var response = client.PostFile( - ListeningOn + "/fileuploads", fileStream, fileName, MimeTypes.GetMimeType(fileName)); + "/fileuploads", fileStream, fileName, MimeTypes.GetMimeType(fileName)); fileStream.Position = 0; - var expectedContents = new StreamReader(fileStream).ReadToEnd(); + var expectedContents = fileStream.ReadToEnd(); Assert.That(isFilterCalled); + Assert.That(response.Name, Is.EqualTo("file")); Assert.That(response.FileName, Is.EqualTo(fileName)); Assert.That(response.ContentLength, Is.EqualTo(fileStream.Length)); Assert.That(response.ContentType, Is.EqualTo(MimeTypes.GetMimeType(fileName))); @@ -262,27 +372,89 @@ public void Can_POST_upload_stream_using_ServiceClient() } [Test] - public void PostFileWithRequest_returns_the_same_date_as_normal_Put() + public void Can_POST_upload_stream_using_JsonHttpClient() + { + try + { + var client = new JsonHttpClient(ListeningOn); + + using (var fileStream = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()).OpenRead()) + { + var fileName = "upload.html"; + + bool isFilterCalled = false; + JsonHttpClient.GlobalRequestFilter = request => + { + isFilterCalled = true; + }; + var response = client.PostFile( + "/fileuploads", fileStream, fileName, MimeTypes.GetMimeType(fileName)); + + fileStream.Position = 0; + var expectedContents = fileStream.ReadToEnd(); + + Assert.That(isFilterCalled); + Assert.That(response.Name, Is.EqualTo("file")); + Assert.That(response.FileName, Is.EqualTo(fileName)); + Assert.That(response.ContentLength, Is.EqualTo(fileStream.Length)); + Assert.That(response.ContentType, Is.EqualTo(MimeTypes.GetMimeType(fileName))); + Assert.That(response.Contents, Is.EqualTo(expectedContents)); + } + } + finally + { + JsonHttpClient.GlobalRequestFilter = null; //reset this to not cause side-effects + } + } + + [Test] + public void PostFileWithRequest_returns_the_same_date_as_normal_Put_with_ServiceClient() { var client = new JsonServiceClient(ListeningOn); - using (var fileStream = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()).OpenRead()) + using (var fileStream = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()).OpenRead()) { var request = new FileUpload { CreatedDate = new DateTime(2014, 1, 1, 1, 0, 0) }; var response = client.PostFileWithRequest( - ListeningOn + "/fileuploads", + "/fileuploads", + fileStream, + "upload.html", + request); + + Assert.That(response.CreatedDate, Is.EqualTo(request.CreatedDate).Within(TimeSpan.FromHours(1))); + + response = client.Put(request); + + Assert.That(response.CreatedDate, Is.EqualTo(request.CreatedDate).Within(TimeSpan.FromHours(1))); + } + } + + [Test] + public void PostFileWithRequest_returns_the_same_date_as_normal_Put_with_JsonHttpClient() + { + var client = new JsonHttpClient(ListeningOn); + + using (var fileStream = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()).OpenRead()) + { + var request = new FileUpload + { + CreatedDate = new DateTime(2014, 1, 1, 1, 0, 0) + }; + + var response = client.PostFileWithRequest( + "/fileuploads", fileStream, "upload.html", request); - Assert.That(response.CreatedDate, Is.EqualTo(request.CreatedDate).Within(TimeSpan.FromMilliseconds(1))); + Assert.That(response.CreatedDate, Is.EqualTo(request.CreatedDate).Within(TimeSpan.FromHours(1))); response = client.Put(request); - Assert.That(response.CreatedDate, Is.EqualTo(request.CreatedDate).Within(TimeSpan.FromMilliseconds(1))); + Assert.That(response.CreatedDate, Is.EqualTo(request.CreatedDate).Within(TimeSpan.FromHours(1))); } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/GetEncodingFromContentTypeTest.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/GetEncodingFromContentTypeTest.cs index 694b56731fd..0aeba800a64 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/GetEncodingFromContentTypeTest.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/GetEncodingFromContentTypeTest.cs @@ -1,4 +1,5 @@ -using System; +#if !NETCORE_SUPPORT +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -47,3 +48,4 @@ public void Return_Null_When_Wrong_Encoding() } } +#endif diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/GithubGatewayTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/GithubGatewayTests.cs new file mode 100644 index 00000000000..4dd8eb0a71a --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/GithubGatewayTests.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Ignore("Integration Tests")] + public class GithubGatewayTests + { + public static readonly string GistId = "67bc8f75273a29a1ba0609675b8ed1ae"; + public static readonly string AccessToken = Environment.GetEnvironmentVariable("GITHUB_GIST_TOKEN"); + + [Test] + public void Can_create_gist() + { + var gateway = new GitHubGateway(AccessToken); + + var gist = gateway.CreateGithubGist( + description: "Hello World Examples", + isPublic: true, + textFiles: new Dictionary { + ["hello_world_ruby.txt"] = "Run `ruby hello_world.rb` to print Hello World", + ["hello_world_python.txt"] = "Run `python hello_world.py` to print Hello World", + }); + + gist.PrintDump(); + + Assert.That(gist.Owner.Login, Is.EqualTo("gistlyn")); + Assert.That(gist.Owner.Url, Is.EqualTo("https://api.github.com/users/gistlyn")); + Assert.That(gist.Owner.Html_Url, Is.EqualTo("https://github.com/gistlyn")); + + var file = gist.Files["hello_world_ruby.txt"]; + Assert.That(file.Filename, Is.EqualTo("hello_world_ruby.txt")); + Assert.That(file.Type, Is.EqualTo("text/plain")); + Assert.That(file.Language, Is.EqualTo("Text")); + Assert.That(file.Raw_Url, Does.EndWith("/hello_world_ruby.txt")); + Assert.That(file.Size, Is.GreaterThan(0)); + Assert.That(file.Content, Does.Contain("Run `ruby hello_world.rb` to print Hello World")); + + file = gist.Files["hello_world_python.txt"]; + Assert.That(file.Filename, Is.EqualTo("hello_world_python.txt")); + Assert.That(file.Type, Is.EqualTo("text/plain")); + Assert.That(file.Language, Is.EqualTo("Text")); + Assert.That(file.Raw_Url, Does.EndWith("/hello_world_python.txt")); + Assert.That(file.Size, Is.GreaterThan(0)); + Assert.That(file.Content, Does.Contain("Run `python hello_world.py` to print Hello World")); + } + + [Test] + public void Can_download_public_gist() + { + var gateway = new GitHubGateway(); + var result = gateway.GetGist(GistId); + var gist = (GithubGist)result; + Assert.That(gist.Owner.Login, Is.EqualTo("gistlyn")); + Assert.That(gist.Owner.Url, Is.EqualTo("https://api.github.com/users/gistlyn")); + Assert.That(gist.Owner.Html_Url, Is.EqualTo("https://github.com/gistlyn")); + + var file = gist.Files["main.cs"]; + Assert.That(file.Filename, Is.EqualTo("main.cs")); + Assert.That(file.Type, Is.EqualTo("text/plain")); + Assert.That(file.Language, Is.EqualTo("C#")); + Assert.That(file.Raw_Url, Does.EndWith("/main.cs")); + Assert.That(file.Size, Is.GreaterThan(0)); + Assert.That(file.Content, Does.Contain("Hello, {name}!")); + } + + [Test] + public async Task Can_download_public_gist_Async() + { + var gateway = new GitHubGateway(); + var result = await gateway.GetGistAsync(GistId); + var gist = (GithubGist)result; + Assert.That(gist.Owner.Login, Is.EqualTo("gistlyn")); + Assert.That(gist.Owner.Url, Is.EqualTo("https://api.github.com/users/gistlyn")); + Assert.That(gist.Owner.Html_Url, Is.EqualTo("https://github.com/gistlyn")); + + var file = gist.Files["main.cs"]; + Assert.That(file.Filename, Is.EqualTo("main.cs")); + Assert.That(file.Type, Is.EqualTo("text/plain")); + Assert.That(file.Language, Is.EqualTo("C#")); + Assert.That(file.Raw_Url, Does.EndWith("/main.cs")); + Assert.That(file.Size, Is.GreaterThan(0)); + Assert.That(file.Content, Does.Contain("Hello, {name}!")); + } + + [Test] + public void Can_add_and_delete_gist_file() + { + var gateway = new GitHubGateway(AccessToken); + + var newFile = "new.txt"; + gateway.WriteGistFile(GistId, newFile, "this is a new file"); + + var gist = gateway.GetGist(GistId); + var file = gist.Files[newFile]; + Assert.That(file.Filename, Is.EqualTo(newFile)); + Assert.That(file.Type, Is.EqualTo("text/plain")); + Assert.That(file.Content, Is.EqualTo("this is a new file")); + + gateway.DeleteGistFiles(GistId, newFile); + + gist = gateway.GetGist(GistId); + Assert.That(gist.Files.TryGetValue(newFile, out file), Is.False); + } + + [Test] + public async Task Does_FetchAllTruncatedFilesAsync() + { + var gistWithTruncatedFiles = "6f3484ef287c85b118ee6ca3262c1534"; + var vfs = new GistVirtualFiles(gistWithTruncatedFiles); + var gist = await vfs.GetGistAsync(); + Assert.That(gist.Files.Values.Any(x => x.Truncated && string.IsNullOrEmpty(x.Content))); + + await vfs.LoadAllTruncatedFilesAsync(); + + Assert.That(!gist.Files.Values.Any(x => x.Truncated && string.IsNullOrEmpty(x.Content))); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpErrorAsyncTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpErrorAsyncTests.cs index 756cf57f38b..0a59b1a374b 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpErrorAsyncTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpErrorAsyncTests.cs @@ -1,21 +1,45 @@ using System; using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; using System.Threading; using System.Threading.Tasks; using NUnit.Framework; +using ServiceStack.Text; using ServiceStack.WebHost.Endpoints.Tests.Support.Host; using ServiceStack.WebHost.Endpoints.Tests.Support.Services; namespace ServiceStack.WebHost.Endpoints.Tests { - [TestFixture] - public class HttpErrorAsyncTests + public class HttpErrorAsyncJsonServiceClientTests : HttpErrorAsyncTests + { + public override IHttpRestClientAsync CreateRestClient(string baseUri = null) + { + return baseUri != null + ? new JsonServiceClient(baseUri) + : new JsonServiceClient(); + } + } + + public class HttpErrorAsyncJsonHttpClientTests : HttpErrorAsyncTests + { + public override IHttpRestClientAsync CreateRestClient(string baseUri = null) + { + return baseUri != null + ? new JsonHttpClient(baseUri) + : new JsonHttpClient(); + } + } + + + public abstract class HttpErrorAsyncTests { private const string ListeningOn = "http://localhost:1337/"; ExampleAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new ExampleAppHostHttpListener(); @@ -23,18 +47,13 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); } - public IRestClientAsync CreateRestClient(string baseUri = null) - { - return baseUri != null - ? new JsonServiceClient(baseUri) - : new JsonServiceClient(); - } + public abstract IHttpRestClientAsync CreateRestClient(string baseUri = null); [Test] public async Task GET_returns_ArgumentNullException() @@ -49,7 +68,7 @@ public async Task GET_returns_ArgumentNullException() catch (WebServiceException webEx) { Assert.That(webEx.StatusCode, Is.EqualTo(400)); - Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(typeof(ArgumentNullException).Name)); + Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(nameof(ArgumentNullException))); } } @@ -67,7 +86,7 @@ public async Task GET_returns_custom_Exception_and_StatusCode() catch (WebServiceException webEx) { Assert.That(webEx.StatusCode, Is.EqualTo(404)); - Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(typeof(FileNotFoundException).Name)); + Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(nameof(FileNotFoundException))); } } @@ -86,7 +105,7 @@ public async Task GET_returns_custom_Exception_Message_and_StatusCode() catch (WebServiceException webEx) { Assert.That(webEx.StatusCode, Is.EqualTo(404)); - Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(typeof(FileNotFoundException).Name)); + Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(nameof(FileNotFoundException))); Assert.That(webEx.ResponseStatus.Message, Is.EqualTo("ClientErrorMessage")); } } @@ -101,7 +120,7 @@ public async Task PUT_returning_custom_403_Exception() var response = await restClient.PutAsync(new ThrowHttpError { StatusCode = 403, - Type = typeof(Exception).Name, + Type = nameof(Exception), Message = "ForbiddenErrorMessage", }); @@ -110,9 +129,35 @@ public async Task PUT_returning_custom_403_Exception() catch (WebServiceException webEx) { Assert.That(webEx.StatusCode, Is.EqualTo(403)); - Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(typeof(Exception).Name)); + Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(nameof(Exception))); Assert.That(webEx.ResponseStatus.Message, Is.EqualTo("ForbiddenErrorMessage")); } } + + [Test] + public async Task Can_catch_async_error_to_non_existing_host() + { + var client = CreateRestClient("https://blahblahblah/"); + try + { + var response = await client.GetAsync("/not-here"); + Assert.Fail("Should throw"); + } + catch (WebException ex) //JsonServiceClient + { + Assert.That(ex.Status, Is.EqualTo(WebExceptionStatus.NameResolutionFailure)); + } + catch (Exception ex) //JsonHttpClient + { + var innerEx = ex.UnwrapIfSingleException().InnerException; +#if !NETCORE + Assert.That(((WebException)innerEx).Status, Is.EqualTo(WebExceptionStatus.NameResolutionFailure)); +#else + Assert.That(innerEx.Message, Is.EqualTo("Couldn't resolve host name") + .Or.EqualTo("No such host is known") // .NET Core 2.1 + .Or.EqualTo("The server name or address could not be resolved")); // .NET Core 2.0 +#endif + } + } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpErrorSyncTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpErrorSyncTests.cs index f0ebfc5d9ea..4a62f8af651 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpErrorSyncTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpErrorSyncTests.cs @@ -1,46 +1,66 @@ using System; +using System.Net; using NUnit.Framework; +using ServiceStack.Testing; +using ServiceStack.Text; using ServiceStack.WebHost.Endpoints.Tests.Support.Host; using ServiceStack.WebHost.Endpoints.Tests.Support.Services; +using ServiceStack.Logging; namespace ServiceStack.WebHost.Endpoints.Tests { + public class HttpErrorSyncJsonServiceClientTests : HttpErrorSyncTests + { + public override IRestClient CreateClient(string baseUri = null) + { + return baseUri != null + ? new JsonServiceClient(baseUri) + : new JsonServiceClient(); + } + } + + public class HttpErrorSyncJsonHttpClientTests : HttpErrorSyncTests + { + public override IRestClient CreateClient(string baseUri = null) + { + return baseUri != null + ? new JsonHttpClient(baseUri) + : new JsonHttpClient(); + } + } + [TestFixture] - public class HttpErrorSyncTests + public abstract class HttpErrorSyncTests { private const string ListeningOn = "http://localhost:1337/"; private ExampleAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { + LogManager.LogFactory = null; appHost = new ExampleAppHostHttpListener(); appHost.Init(); appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); } - public IRestClient CreateRestClient(string baseUri = null) - { - return baseUri != null - ? new JsonServiceClient(baseUri) - : new JsonServiceClient(); - } + public abstract IRestClient CreateClient(string baseUri = null); [Test] public void PUT_returning_custom_403_Exception() { - var restClient = CreateRestClient(ListeningOn); + var client = CreateClient(ListeningOn); try { - var response = restClient.Put(new ThrowHttpError + var response = client.Put(new ThrowHttpError { StatusCode = 403, Type = typeof(Exception).Name, @@ -60,11 +80,11 @@ public void PUT_returning_custom_403_Exception() [Test] public void PUT_throwing_custom_403_Exception() { - var restClient = CreateRestClient(ListeningOn); + var client = CreateClient(ListeningOn); try { - restClient.Put(new ThrowHttpErrorNoReturn + client.Put(new ThrowHttpErrorNoReturn { StatusCode = 403, Type = typeof(Exception).Name, @@ -79,9 +99,173 @@ public void PUT_throwing_custom_403_Exception() Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(typeof(Exception).Name)); Assert.That(webEx.ResponseStatus.Message, Is.EqualTo("ForbiddenErrorMessage")); } - catch (Exception ex) + } + + [Test] + public void Throw404_does_return_404() + { + var client = CreateClient(ListeningOn); + + try + { + var response = client.Get(new Throw404()); + } + catch (WebServiceException webEx) + { + webEx.StatusDescription.Print(); + Assert404(webEx); + } + } + + [Test] + public void Throw404Description_does_return_404_with_Custom_StatusDescription() + { + var client = CreateClient(ListeningOn); + + try + { + var response = client.Get(new Throw404Description()); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + Assert.That(webEx.StatusDescription, Is.EqualTo("Custom Status Description")); + Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(HttpStatusCode.NotFound.ToString())); + } + } + + [Test] + public void Return404_does_return_404() + { + var client = CreateClient(ListeningOn); + + try + { + var response = client.Get(new Return404()); + } + catch (WebServiceException webEx) + { + Assert404(webEx); + } + } + + [Test] + public void Return404Result_does_return_404_with_Empty_Response_Body() + { + var client = CreateClient(ListeningOn); + + try + { + var response = client.Get(new Return404Result()); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + Assert.That(webEx.StatusDescription, Is.EqualTo("Custom Status Description")); + Assert.That(webEx.ResponseStatus, Is.Null); + Assert.That(webEx.ResponseBody, Is.Null.Or.Empty); + } + } + + private static void Assert404(WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(HttpStatusCode.NotFound.ToString())); + Assert.That(webEx.ResponseStatus.Message, Is.EqualTo("Custom Status Description")); + } + + [Test] + public void ThrowCustom404_does_return_404() + { + var client = CreateClient(ListeningOn); + + try + { + var response = client.Get(new ThrowCustom404()); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(404)); + Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(typeof(Custom404Exception).Name)); + Assert.That(webEx.ResponseStatus.Message, Is.EqualTo("Custom Status Description")); + Assert.That(webEx.ResponseStatus.Errors[0].ErrorCode, Is.EqualTo("FieldErrorCode")); + Assert.That(webEx.ResponseStatus.Errors[0].Message, Is.EqualTo("FieldMessage")); + Assert.That(webEx.ResponseStatus.Errors[0].FieldName, Is.EqualTo("FieldName")); + } + } + + [Test] + public void Does_preserve_WebServiceException() + { + var client = CreateClient(ListeningOn); + + var request = new ThrowWebServiceException + { + StatusCode = 400, + StatusDescription = "Original Message", + ResponseStatus = new ResponseStatus + { + ErrorCode = "ResponseStatus.ErrorCode", + Message = "ResponseStatus.Message" + } + }; + + try + { + var response = client.Get(request); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo(request.StatusCode.Value)); + Assert.That(webEx.Message, Is.EqualTo(request.ResponseStatus.Message)); + Assert.That(webEx.StatusDescription, Is.EqualTo(request.StatusDescription)); + Assert.That(webEx.ResponseStatus.ErrorCode, Is.EqualTo(request.ResponseStatus.ErrorCode)); + Assert.That(webEx.ResponseStatus.Message, Is.EqualTo(request.ResponseStatus.Message)); + } + } + } + + public class Custom400Exception : Exception { } + + public class Custom400SubException : Custom400Exception { } + + public class Custom401Exception : Exception, IHasStatusCode + { + public int StatusCode => 401; + } + + public class CustomErrorCodeException : Exception, IHasErrorCode + { + public string ErrorCode { get; set; } + } + + [TestFixture] + public class ErrorStatusTests + { + [Test] + public void Does_map_Exception_to_StatusCode() + { + using (new BasicAppHost + { + ConfigFilter = c => + { + c.MapExceptionToStatusCode[typeof(Custom400Exception)] = 400; + } + }.Init()) + { + Assert.That(new Custom400Exception().ToStatusCode(), Is.EqualTo(400)); + Assert.That(new Custom400SubException().ToStatusCode(), Is.EqualTo(400)); + Assert.That(new Custom401Exception().ToStatusCode(), Is.EqualTo(401)); + } + } + + [Test] + public void Does_map_Exception_to_ErrorCode() + { + using (new BasicAppHost().Init()) { - throw; + Assert.That(new CustomErrorCodeException().ToErrorCode(), Is.EqualTo("CustomErrorCodeException")); + Assert.That(new CustomErrorCodeException { ErrorCode = "ERR401" }.ToErrorCode(), Is.EqualTo("ERR401")); } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpHandlerTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpHandlerTests.cs new file mode 100644 index 00000000000..16277323d62 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpHandlerTests.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Route("/customresult")] + public class CustomResult { } + + public class CustomXmlResult : IStreamWriterAsync, IHasOptions + { + public IDictionary Options { get; set; } + + public CustomXmlResult() + { + Options = new Dictionary + { + { "Content-Type", "application/xml" }, + { "Content-Disposition", "attachement; filename=\"file.xml\"" }, + }; + } + + public async Task WriteToAsync(Stream responseStream, CancellationToken token = new CancellationToken()) + { + await responseStream.WriteAsync("quz", token); + } + } + + + + public class CustomService : Service + { + public object Any(CustomResult request) + { + return new CustomXmlResult(); + } + } + + + public class HttpHandlerTests + { + private readonly ServiceStackHost appHost; + + public HttpHandlerTests() + { + appHost = new HttpHandlerAppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + public static int BeginRequestCount = 0; + public static int EndRequestCount = 0; + + public class HttpHandlerAppHost : AppSelfHostBase + { + public HttpHandlerAppHost() : base("HttpHandlerAppHost", typeof(PerfServices).Assembly) { } + + public override void Configure(Container container) + { + } + +#if !NETCORE_SUPPORT + protected override void OnBeginRequest(HttpListenerContext context) + { + Interlocked.Increment(ref BeginRequestCount); + base.OnBeginRequest(context); + } +#endif + + public override void OnEndRequest(IRequest request = null) + { + Interlocked.Increment(ref EndRequestCount); + base.OnEndRequest(request); + } + } + + [SetUp] + public void SetUp() + { + BeginRequestCount = EndRequestCount = 0; + } + + [Test] +#if NETCORE + [Ignore("NotFoundHttpHandler is not used in .NET Core and is skipped in AppSelfHostBase.ProcessRequest")] +#endif + public void Does_call_begin_and_end_on_Raw_HttpHandler_requests() + { + try + { + var response = Config.ListeningOn.CombineWith("/non-existing-request") + .GetJsonFromUrl(); + Assert.Fail("Should throw"); + } + catch (WebException ex) + { + Assert.That(ex.Message, Does.Contain("(404) Not Found")); + + Assert.That(BeginRequestCount, Is.EqualTo(1)); + Thread.Sleep(1); + Assert.That(EndRequestCount, Is.EqualTo(1)); + } + } + + [Test] + public void Can_set_Headers_with_Custom_Result() + { + var xml = Config.ListeningOn.CombineWith("customresult") + .GetStringFromUrl(responseFilter: res => { + Assert.That(res.ContentType, Is.EqualTo("application/xml")); + Assert.That(res.Headers["Content-Disposition"], Is.EqualTo("attachement; filename=\"file.xml\"")); + }); + + Assert.That(xml, Is.EqualTo("quz")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpResultContentTypeTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpResultContentTypeTests.cs index fb1395c369e..b832b20e8dd 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpResultContentTypeTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpResultContentTypeTests.cs @@ -3,18 +3,21 @@ using System.Net; using NUnit.Framework; using ServiceStack.Logging; +using ServiceStack.Text; using ServiceStack.Web; namespace ServiceStack.WebHost.Endpoints.Tests { [TestFixture] - public class HttpResultContentTypeTests { - #region setup for example plaintext service - public class SimpleAppHostHttpListener : AppHostHttpListenerBase { + public class HttpResultContentTypeTests + { + public class SimpleAppHostHttpListener : AppHostHttpListenerBase + { //Tell Service Stack the name of your application and where to find your web services public SimpleAppHostHttpListener() - : base("Test Services", typeof(SimpleAppHostHttpListener).Assembly) { + : base("Test Services", typeof(SimpleAppHostHttpListener).Assembly) + { LogManager.LogFactory = new TestLogFactory(); } @@ -22,72 +25,110 @@ public SimpleAppHostHttpListener() /// AppHostHttpListenerBase method. /// /// SS's funq container - public override void Configure(Funq.Container container) { + public override void Configure(Funq.Container container) + { HostContext.Config.GlobalResponseHeaders.Clear(); - //Signal advanced web browsers what HTTP Methods you accept - //base.SetConfig(new EndpointHostConfig()); - Routes.Add("/test/plaintext", "GET"); + PreRequestFilters.Add((req,res) => req.UseBufferedStream = res.UseBufferedStream = true); + + //Signal advanced web browsers what HTTP Methods you accept + //base.SetConfig(new EndpointHostConfig()); + Routes.Add<PlainText>("/test/plaintext", "GET"); } } /// <summary> /// *Request* DTO /// </summary> - public class PlainText { + public class PlainText + { /// <summary> /// Controls if the service calls response.ContentType or just new HttpResult /// </summary> - public bool SetContentTypeBrutally { get; set; } + public bool SetContentType { get; set; } /// <summary> /// Text to respond with /// </summary> public string Text { get; set; } } - public class TimedService : Service + [Route("/plain-dto")] + public class PlainDto : IReturn<PlainDto> + { + public string Name { get; set; } + } + + [Route("/httpresult-dto")] + public class HttpResultDto : IReturn<HttpResultDto> { - public object Any(PlainText request) + public string Name { get; set; } + } + + public class HttpResultServices : Service + { + public object Any(PlainText request) { - string contentType = "text/plain"; + var contentType = "text/plain"; var response = new HttpResult(request.Text, contentType); - if(request.SetContentTypeBrutally) { + if (request.SetContentType) + { response.ContentType = contentType; } return response; } - } -#endregion + public object Any(PlainDto request) => request; - private const string ListeningOn = "http://localhost:1337/"; - SimpleAppHostHttpListener appHost; + public object Any(HttpResultDto request) => + new HttpResult(request, HttpStatusCode.Created); + } + readonly ServiceStackHost appHost; public HttpResultContentTypeTests() - { - - } - - [TestFixtureSetUp] - public void OnTestFixtureStartUp() - { - appHost = new SimpleAppHostHttpListener(); - appHost.Init(); - appHost.Start(ListeningOn); - - System.Console.WriteLine("ExampleAppHost Created at {0}, listening on {1}", - DateTime.Now, ListeningOn); - } - - [TestFixtureTearDown] - public void OnTestFixtureTearDown() - { - appHost.Dispose(); + { + appHost = new SimpleAppHostHttpListener() + .Init() + .Start(Config.ListeningOn); + + Console.WriteLine($"ExampleAppHost Created at {DateTime.Now}, listening on {Config.ListeningOn}"); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); //Clear the logs so other tests dont inherit log entries TestLogger.GetLogs().Clear(); - } + } + [Test] + public void When_Buffered_does_not_return_ChunkedEncoding_for_DTO_responses() + { + var response = Config.ListeningOn.CombineWith("plain-dto").AddQueryParam("name", "foo") + .GetJsonFromUrl(responseFilter: res => + { + res.Headers[HttpHeaders.TransferEncoding].Print(); + Assert.That(res.Headers[HttpHeaders.TransferEncoding], Is.Null); + Assert.That(res.ContentLength, Is.GreaterThan(0)); + }).FromJson<PlainDto>(); + + Assert.That(response.Name, Is.EqualTo("foo")); + } + + [Test] + public void When_Buffered_does_not_return_ChunkedEncoding_for_DTO_responses_in_HttpResult() + { + var response = Config.ListeningOn.CombineWith("httpresult-dto").AddQueryParam("name", "foo") + .GetJsonFromUrl(responseFilter: res => + { + res.Headers[HttpHeaders.TransferEncoding].Print(); + Assert.That(res.Headers[HttpHeaders.TransferEncoding], Is.Null); + Assert.That(res.ContentLength, Is.GreaterThan(0)); + }).FromJson<HttpResultDto>(); + + Assert.That(response.Name, Is.EqualTo("foo")); + } /// <summary> /// This test calls a simple web service which uses HttpResult(string responseText, string contentType) constructor @@ -98,31 +139,28 @@ public void OnTestFixtureTearDown() /// <param name="setContentTypeBrutally">If true the service additionally 'brutally' sets the content type after using HttpResult constructor which should do it anyway</param> //This test case fails on mono 2.6.7 (the content type is 'text/html') [TestCase(false)] - //This test case passes on mono 2.6.7 [TestCase(true)] - public void TestHttpRestulSettingContentType(bool setContentTypeBrutally) { - string text = "Some text"; - string url = string.Format("{0}/test/plaintext?SetContentTypeBrutally={1}&Text={2}", ListeningOn, setContentTypeBrutally,text); - HttpWebRequest req = WebRequest.Create(url) as HttpWebRequest; + public void TestHttpRestulSettingContentType(bool setContentTypeBrutally) + { + var text = "Some text"; + var url = $"{Config.ListeningOn}/test/plaintext?SetContentType={setContentTypeBrutally}&Text={text}"; + var req = WebRequest.Create(url) as HttpWebRequest; HttpWebResponse res = null; - try { - res = (HttpWebResponse)req.GetResponse(); - - string downloaded; - using(StreamReader s = new StreamReader(res.GetResponseStream())) { - downloaded = s.ReadToEnd(); - } + try + { + res = (HttpWebResponse)req.GetResponse(); + + var downloaded = res.GetResponseStream().ReadToEnd(); Assert.AreEqual(text, downloaded, "Checking the downloaded string"); - Assert.AreEqual("text/plain", res.ContentType, "Checking for expected contentType" ); + Assert.AreEqual("text/plain", res.ContentType, "Checking for expected contentType"); } - finally { - if(res != null) { - res.Close(); - } + finally + { + res?.Close(); } } - } + } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpResultTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpResultTests.cs index 5ce312d8db1..7e28edbd8dc 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpResultTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpResultTests.cs @@ -3,6 +3,7 @@ using ServiceStack.Common.Tests; using ServiceStack.Host; using ServiceStack.Testing; +using ServiceStack.Text; namespace ServiceStack.WebHost.Endpoints.Tests { @@ -21,14 +22,14 @@ public void Can_send_ResponseText_test_with_Custom_Header() var httpResult = new HttpResult(customText, MimeTypes.Html) { Headers = - { - {"X-Custom","Header"} - } + { + {"X-Custom","Header"} + } }; - var reponseWasAutoHandled = mockResponse.WriteToResponse(httpResult, MimeTypes.Html); + var responseWasAutoHandled = mockResponse.WriteToResponse(httpResult, MimeTypes.Html); - Assert.That(reponseWasAutoHandled.Result, Is.True); + Assert.That(responseWasAutoHandled.Result, Is.True); var writtenString = mockResponse.ReadAsString(); Assert.That(writtenString, Is.EqualTo(customText)); @@ -49,14 +50,14 @@ public void Can_send_ResponseStream_test_with_Custom_Header() var httpResult = new HttpResult(ms, MimeTypes.Html) { Headers = - { - {"X-Custom","Header"} - } + { + {"X-Custom","Header"} + } }; - var reponseWasAutoHandled = mockResponse.WriteToResponse(httpResult, MimeTypes.Html); + var responseWasAutoHandled = mockResponse.WriteToResponse(httpResult, MimeTypes.Html); - Assert.That(reponseWasAutoHandled.Result, Is.True); + Assert.That(responseWasAutoHandled.Result, Is.True); var writtenString = mockResponse.ReadAsString(); Assert.That(writtenString, Is.EqualTo(customText)); @@ -76,9 +77,9 @@ public void Can_send_ResponseText_test_with_StatusDescription() RequestContext = mockRequest }; - var reponseWasAutoHandled = mockResponse.WriteToResponse(httpResult, MimeTypes.Html); + var responseWasAutoHandled = mockResponse.WriteToResponse(httpResult, MimeTypes.Html); - Assert.That(reponseWasAutoHandled.Result, Is.True); + Assert.That(responseWasAutoHandled.Result, Is.True); var statusDesc = mockResponse.StatusDescription; Assert.That(mockResponse.StatusCode, Is.EqualTo((int)System.Net.HttpStatusCode.Accepted)); @@ -92,11 +93,57 @@ public void Can_handle_null_HttpResult_StatusDescription() var httpResult = new HttpResult { StatusDescription = null }; - var reponseWasAutoHandled = mockResponse.WriteToResponse(httpResult, MimeTypes.Html); - Assert.That(reponseWasAutoHandled.Result, Is.True); + var responseWasAutoHandled = mockResponse.WriteToResponse(httpResult, MimeTypes.Html); + Assert.That(responseWasAutoHandled.Result, Is.True); Assert.IsNotNull(mockResponse.StatusDescription); } + + [Test] + public void Can_change_serialization_options() + { + var mockResponse = new MockHttpResponse(); + + var dto = new Poco(); + Assert.That(dto.ToJson(), Is.EqualTo("{}")); + + var httpResult = new HttpResult(dto) + { + ResultScope = () => JsConfig.With(new Text.Config { IncludeNullValues = true }) + }; + + var responseWasAutoHandled = mockResponse.WriteToResponse(httpResult, MimeTypes.Html); + Assert.That(responseWasAutoHandled.Result, Is.True); + + Assert.That(mockResponse.ReadAsString(), Is.EqualTo("{\"Text\":null}").Or.EqualTo("{\"text\":null}")); + } + + [Test] + public void Can_parse_ExtractHttpRanges() + { + void assertRange(long start, long expectedStart, long end, long expectedEnd) + { + Assert.That(start, Is.EqualTo(expectedStart)); + Assert.That(end, Is.EqualTo(expectedEnd)); + } + + "bytes=0-".ExtractHttpRanges(100, out var rangeStart, out var rangeEnd); + assertRange(rangeStart, 0, rangeEnd, 99); + "bytes=0-99".ExtractHttpRanges(100, out rangeStart, out rangeEnd); + assertRange(rangeStart, 0, rangeEnd, 99); + "bytes=1-2".ExtractHttpRanges(100, out rangeStart, out rangeEnd); + assertRange(rangeStart, 1, rangeEnd, 2); + "bytes=-50".ExtractHttpRanges(100, out rangeStart, out rangeEnd); + assertRange(rangeStart, 49, rangeEnd, 99); + + Assert.Throws<HttpError>(() => + "".ExtractHttpRanges(100, out rangeStart, out rangeEnd)); + Assert.Throws<HttpError>(() => + "-100".ExtractHttpRanges(100, out rangeStart, out rangeEnd)); + Assert.Throws<HttpError>(() => + "0-10,10-20".ExtractHttpRanges(100, out rangeStart, out rangeEnd)); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/HttpUtility.Core.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpUtility.Core.cs new file mode 100644 index 00000000000..8a2965621aa --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/HttpUtility.Core.cs @@ -0,0 +1,25 @@ +#if NETCORE +using System; +using System.Collections.Specialized; +using Microsoft.AspNetCore.WebUtilities; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class HttpUtility + { + public static NameValueCollection ParseQueryString(string query) + { + NameValueCollection result = new NameValueCollection(); + + var queryDict = QueryHelpers.ParseQuery(query); + + foreach(var key in queryDict.Keys) + { + result.Add(key, String.Join("; ", queryDict[key])); + } + + return result; + } + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/InProcessServiceGatewayRequestResponseFiltersTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/InProcessServiceGatewayRequestResponseFiltersTests.cs new file mode 100644 index 00000000000..d16218d2f8e --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/InProcessServiceGatewayRequestResponseFiltersTests.cs @@ -0,0 +1,93 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class SomeResponse + { + public string Info { get; set; } + } + + public class InternalResponse : SomeResponse + { + } + + public class RequestSync : IReturn<SomeResponse> { } + public class RequestAsync : IReturn<SomeResponse> { } + public class RequestInternal: IGet, IReturn<InternalResponse> { } + + public class FooBarService: Service + { + public SomeResponse Get(RequestSync request) + { + var resp = Gateway.Send(new RequestInternal()); + return new SomeResponse() {Info = resp.Info}; + } + + public async Task<SomeResponse> Get(RequestAsync req) + { + var resp = await Gateway.SendAsync(new RequestInternal()); + return new SomeResponse() {Info = resp.Info}; + } + + public Task<InternalResponse> Get(RequestInternal req) => Task.FromResult(new InternalResponse() {Info = "yay"}); + } + + public class InProcessServiceGatewayRequestResponseFiltersTests + { + class InProcessAppHost : AppSelfHostBase + { + public InProcessAppHost() : base(typeof(InProcessServiceGatewayRequestResponseFiltersTests).Name, + typeof(ServiceGatewayServices).Assembly) { } + + public override void Configure(Container container) + { + } + } + + private readonly ServiceStackHost _appHost; + private readonly List<string> _filterCallLog = new List<string>(); + private readonly JsonServiceClient _client; + + public InProcessServiceGatewayRequestResponseFiltersTests() + { + _appHost = new InProcessAppHost(); + _appHost.GlobalRequestFilters.Add((req ,resp, dto) => _filterCallLog.Add(req.PathInfo)); + _appHost.GlobalResponseFilters.Add((req, resp, dto) => _filterCallLog.Add(dto.GetType().Name)); + + _appHost.Init() + .Start(Config.ListeningOn); + _client = new JsonServiceClient(Config.ListeningOn); + } + + [TearDown] + public void CleanAfterTest() + { + _filterCallLog.Clear(); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + _appHost.Dispose(); + } + + [Test] + public void Should_Not_Call_Filters_When_Using_SyncGateway() + { + var result = _client.Get(new RequestSync()); + Assert.AreEqual("yay", result.Info); + CollectionAssert.AreEqual(new []{ "/json/reply/RequestSync", "SomeResponse" }, _filterCallLog); + } + + [Test] + public void Should_Not_Call_Filters_When_Using_AsyncGateway() + { + var result = _client.Get(new RequestAsync()); + Assert.AreEqual("yay", result.Info); + CollectionAssert.AreEqual(new[] { "/json/reply/RequestAsync", "SomeResponse" }, _filterCallLog); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/ErrorRestTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/ErrorRestTests.cs index b77f5045697..b2193f1bd8c 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/ErrorRestTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/ErrorRestTests.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Net; +using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.Text; using ServiceStack.Web; @@ -45,7 +47,7 @@ public void Handles_error_from_Filter() { Assert.That(ex.StatusCode, Is.EqualTo(500)); Assert.That(ex.StatusDescription, Is.EqualTo("NullReferenceException")); - Assert.That(ex.Message, Is.EqualTo("NullReferenceException")); + Assert.That(ex.Message, Is.EqualTo("Object reference not set to an instance of an object.")); } } @@ -62,7 +64,65 @@ public void Handles_error_from_Filter_async() var ex = (WebServiceException)aex.UnwrapIfSingleException(); Assert.That(ex.StatusCode, Is.EqualTo(500)); Assert.That(ex.StatusDescription, Is.EqualTo("NullReferenceException")); - Assert.That(ex.Message, Is.EqualTo("NullReferenceException")); + Assert.That(ex.Message, Is.EqualTo("Object reference not set to an instance of an object.")); + } + } + + [Test] + public void Does_handle_304_NotModified_Response() + { + var client = new JsonServiceClient(BaseUrl); + try + { + var response = client.Get(new EchoCustomResponse + { + StatusCode = (int)HttpStatusCode.NotModified, + StatusDescription = "NotModified", + Body = "NOT MODIFIED" + }); + + Assert.Fail("304 Throws"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo("NotModified")); + } + } + + [Test] + public void Does_handle_304_NotModified_Response_JsonHttpClient() + { + var client = new JsonHttpClient(BaseUrl); + try + { + var response = client.Get(new EchoCustomResponse + { + StatusCode = (int)HttpStatusCode.NotModified, + StatusDescription = "NotModified", + Body = "NOT MODIFIED" + }); + + Assert.Fail("304 Throws"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo("NotModified")); + } + } + + [Test] + public void Does_handle_304_NotModified_Response_HttpUtils() + { + var url = BaseUrl.CombineWith("/customresponse/304?StatusDescription=NotModified&Body=NOT+MODIFIED"); + try + { + var response = url.GetStringFromUrl(); + + Assert.Fail("304 Throws"); + } + catch (WebException ex) + { + Assert.That(ex.GetStatus().Value, Is.EqualTo(HttpStatusCode.NotModified)); } } } @@ -97,7 +157,7 @@ public class ErrorService : Service { public object Get(Error request) { - if (request != null && !String.IsNullOrEmpty(request.Id)) + if (!string.IsNullOrEmpty(request?.Id)) return new ErrorResponse(new Error { Id = "Test" }); return new ErrorCollectionResponse(new List<Error> { new Error { Id = "TestCollection" } }); @@ -113,6 +173,20 @@ public object Any(ActionError request) { return new ActionError(); } + + public async Task<string> Any(EchoCustomResponse request) + { + base.Response.StatusCode = request.StatusCode; + base.Response.StatusDescription = request.StatusDescription; + base.Response.ContentType = request.ContentType ?? MimeTypes.PlainText; + + if (request.Body != null) + await base.Response.WriteAsync(request.Body); + + base.Response.EndRequest(skipHeaders:true); + + return request.Body; + } } public class ErrorResponse : IHasResponseStatus @@ -141,4 +215,13 @@ public ErrorCollectionResponse(IList<Error> result) public ResponseStatus ResponseStatus { get; set; } } + + [Route("/customresponse/{StatusCode}")] + public class EchoCustomResponse : IReturn<string> + { + public int StatusCode { get; set; } + public string StatusDescription { get; set; } + public string ContentType { get; set; } + public string Body { get; set; } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/IntegrationTestBase.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/IntegrationTestBase.cs index 312a22dcf38..4bae9a8244f 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/IntegrationTestBase.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/IntegrationTestBase.cs @@ -22,7 +22,7 @@ public IntegrationTestBase() appHost.Start(BaseUrl); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -41,6 +41,9 @@ public IntegrationTestAppHost() public override void Configure(Container container) { +#if !NETCORE + Plugins.Add(new SoapFormat()); +#endif container.Register<IAppSettings>(new AppSettings()); container.Register(c => new ExampleConfig(c.Resolve<IAppSettings>())); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/MovieSoap11Tests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/MovieSoap11Tests.cs index 250733c1dee..1caec5a9cea 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/MovieSoap11Tests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/MovieSoap11Tests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +#if !NETCORE +using NUnit.Framework; namespace ServiceStack.WebHost.Endpoints.Tests.IntegrationTests { @@ -28,3 +29,4 @@ public void Can_ResetMovieDatabase() } } } +#endif \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/OAuthIntegrationTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/OAuthIntegrationTests.cs new file mode 100644 index 00000000000..69ba6a69af9 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/OAuthIntegrationTests.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack; +using ServiceStack.Auth; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.IntegrationTests +{ + [Ignore("Integration Test")] + public class OAuthIntegrationTests + { + private Dictionary<string,string> AccessTokens { get; set; } + + public OAuthIntegrationTests() + { + AccessTokens = "~/App_Data/accesstokens.txt".MapProjectPath() + .ReadAllText() + .ParseKeyValueText(delimiter:" "); + } + + [Test] + public void Can_authenticate_twitter_with_AccessToken() + { + var client = new JsonServiceClient("http://localhost:11001/"); + + var request = new Authenticate + { + provider = TwitterAuthProvider.Name, + AccessToken = "2931572242-zmVKk5leFHJXJWRUpQqyEkdlRlNbDMjNlUcXViJ", + AccessTokenSecret = AccessTokens[TwitterAuthProvider.Name] + }; + + var response = client.Post(request); + + response.PrintDump(); + + Assert.That(response.UserId, Is.Not.Null); + Assert.That(response.SessionId, Is.Not.Null); + Assert.That(response.DisplayName, Is.EqualTo("TechStacks")); + } + + [Test] + public void Can_authenticate_facebook_with_AccessToken() + { + var client = new JsonServiceClient("http://localhost:11001/"); + + var request = new Authenticate + { + provider = FacebookAuthProvider.Name, + AccessToken = AccessTokens[FacebookAuthProvider.Name], + }; + + var response = client.Post(request); + + response.PrintDump(); + + Assert.That(response.UserId, Is.Not.Null); + Assert.That(response.SessionId, Is.Not.Null); + Assert.That(response.DisplayName, Is.EqualTo("Demis Bellot")); + } + + [Test] + public void Can_authenticate_github_with_AccessToken() + { + var client = new JsonServiceClient("http://localhost:11001/"); + + var request = new Authenticate + { + provider = GithubAuthProvider.Name, + AccessToken = AccessTokens[GithubAuthProvider.Name], + }; + + var response = client.Post(request); + + response.PrintDump(); + + Assert.That(response.UserId, Is.Not.Null); + Assert.That(response.SessionId, Is.Not.Null); + Assert.That(response.UserName, Is.EqualTo("mythz")); + Assert.That(response.DisplayName, Is.EqualTo("Demis Bellot")); + } + + [Test] + public void Can_authenticate_GoogleOAuth2_with_AccessToken() + { + //var client = new JsonServiceClient("http://localhost:11001/"); + var client = new JsonServiceClient("http://localhost:1337/"); + + var request = new Authenticate + { + provider = "GoogleOAuth", + AccessToken = AccessTokens["GoogleOAuth"], + }; + + var response = client.Post(request); + + response.PrintDump(); + + Assert.That(response.UserId, Is.Not.Null); + Assert.That(response.SessionId, Is.Not.Null); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/ResetMovieDatabase.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/ResetMovieDatabase.cs index ff6e028f426..fe9a2754c34 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/ResetMovieDatabase.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/IntegrationTests/ResetMovieDatabase.cs @@ -1,5 +1,7 @@ using System.Runtime.Serialization; +#if !NETCORE_SUPPORT using ServiceStack.ServiceModel; +#endif namespace ServiceStack.WebHost.Endpoints.Tests.IntegrationTests { diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/InvalidRequests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/InvalidRequests.cs new file mode 100644 index 00000000000..14184333fe6 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/InvalidRequests.cs @@ -0,0 +1,53 @@ +using System; +using System.Net; +using System.Reflection; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class InvalidRequests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(InvalidRequests), typeof(MyServices).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig { + DebugMode = false + }); + } + } + + private readonly ServiceStackHost appHost; + public InvalidRequests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Invalid_Request_does_not_return_StackTrace_when_not_DebugMode() + { + try + { + var response = Config.ListeningOn.CombineWith("*|?") + .GetJsonFromUrl(); + + Assert.Fail("Should throw"); + } + catch (WebException e) + { + var errorBody = e.GetResponseBody(); + Assert.That(errorBody.ToLower(), Does.Not.Contain("stacktrace")); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/IocServiceTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/IocServiceTests.cs index 2bb660d5790..6cbb04b1724 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/IocServiceTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/IocServiceTests.cs @@ -1,11 +1,14 @@ using System; using System.Collections.Generic; +using System.Net; using System.Threading; using Funq; using NUnit.Framework; +using ServiceStack.Common.Tests; using ServiceStack.Configuration; using ServiceStack.Shared.Tests; using ServiceStack.Text; +using ServiceStack.Web; namespace ServiceStack.WebHost.Endpoints.Tests { @@ -24,21 +27,31 @@ public override void Release(object instance) ((IRelease)Container.Adapter).Release(instance); } - public override void OnEndRequest() + public override void OnEndRequest(IRequest request = null) { - base.OnEndRequest(); + base.OnEndRequest(request); + } + + public override object OnPreExecuteServiceFilter(IService service, object request, IRequest httpReq, IResponse httpRes) + { + if (service is IocScopeService) + service.InjectRequestIntoDependencies(httpReq); + return request; } } +#if !NETCORE + [Ignore("Causes dll conflicts in ASP.NET Host projects when run from this test project")] public class IocServiceAspNetTests : IocServiceTests { public override IServiceClient CreateClient(ResetIoc request = null) { var client = new JsonServiceClient(Config.AspNetServiceStackBaseUri); - client.Post(request ?? new ResetIoc()); + using(client.Post<HttpWebResponse>(request ?? new ResetIoc())){} return client; } } +#endif public class IocServiceHttpListenerTests : IocServiceTests { @@ -46,7 +59,7 @@ public class IocServiceHttpListenerTests : IocServiceTests IocAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new IocAppHost(); @@ -54,7 +67,7 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { if (appHost != null) @@ -66,7 +79,7 @@ public void OnTestFixtureTearDown() public override IServiceClient CreateClient(ResetIoc request = null) { var client = new JsonServiceClient(ListeningOn); - client.Post(request ?? new ResetIoc()); + using(client.Post<HttpWebResponse>(request ?? new ResetIoc())){} return client; } } @@ -74,7 +87,7 @@ public override IServiceClient CreateClient(ResetIoc request = null) [TestFixture] public abstract class IocServiceTests { - private const int WaitForRequestCleanup = 100; + private const int WaitForRequestCleanup = 200; public abstract IServiceClient CreateClient(ResetIoc request = null); @@ -86,13 +99,13 @@ public void Can_resolve_all_dependencies() { var response = client.Get<IocResponse>("ioc"); var expected = new List<string> { - typeof(FunqDepCtor).Name, - typeof(AltDepCtor).Name, - typeof(FunqDepProperty).Name, - typeof(FunqDepDisposableProperty).Name, - typeof(AltDepProperty).Name, - typeof(AltDepDisposableProperty).Name, - }; + typeof(FunqDepCtor).Name, + typeof(AltDepCtor).Name, + typeof(FunqDepProperty).Name, + typeof(FunqDepDisposableProperty).Name, + typeof(AltDepProperty).Name, + typeof(AltDepDisposableProperty).Name, + }; //Console.WriteLine(response.Results.Dump()); Assert.That(expected.EquivalentTo(response.Results)); @@ -111,13 +124,13 @@ public void Can_resolve_all_dependencies_Async() { var response = client.Get<IocResponse>("iocasync"); var expected = new List<string> { - typeof(FunqDepCtor).Name, - typeof(AltDepCtor).Name, - typeof(FunqDepProperty).Name, - typeof(FunqDepDisposableProperty).Name, - typeof(AltDepProperty).Name, - typeof(AltDepDisposableProperty).Name, - }; + typeof(FunqDepCtor).Name, + typeof(AltDepCtor).Name, + typeof(FunqDepProperty).Name, + typeof(FunqDepDisposableProperty).Name, + typeof(AltDepProperty).Name, + typeof(AltDepDisposableProperty).Name, + }; //Console.WriteLine(response.Results.Dump()); Assert.That(expected.EquivalentTo(response.Results)); @@ -175,12 +188,12 @@ public void Does_create_correct_instances_per_scope() var response1 = client.Get<IocScopeResponse>("iocscope"); var response2 = client.Get<IocScopeResponse>("iocscope"); - response1.PrintDump(); - Assert.That(response2.Results[typeof(FunqSingletonScope).Name], Is.EqualTo(1)); Assert.That(response2.Results[typeof(FunqRequestScope).Name], Is.EqualTo(2)); Assert.That(response2.Results[typeof(FunqNoneScope).Name], Is.EqualTo(4)); + Assert.That(response2.InjectsRequest, Is.EqualTo(2)); + Thread.Sleep(WaitForRequestCleanup); var stats = client.Get(new IocStats()); @@ -195,9 +208,6 @@ public void Does_create_correct_instances_per_scope_Async() var response1 = client.Get<IocScopeResponse>("iocscopeasync"); var response2 = client.Get<IocScopeResponse>("iocscopeasync"); - response1.PrintDump(); - response2.PrintDump(); - Assert.That(response2.Results[typeof(FunqSingletonScope).Name], Is.EqualTo(1)); Assert.That(response2.Results[typeof(FunqRequestScope).Name], Is.EqualTo(2)); Assert.That(response2.Results[typeof(FunqNoneScope).Name], Is.EqualTo(4)); @@ -262,13 +272,11 @@ public void Does_AutoWire_ActionLevel_RequestFilters() var response = client.Get(new ActionAttr()); var expected = new List<string> { - typeof(FunqDepProperty).Name, - typeof(FunqDepDisposableProperty).Name, - typeof(AltDepProperty).Name, - typeof(AltDepDisposableProperty).Name, - }; - - response.Results.PrintDump(); + typeof(FunqDepProperty).Name, + typeof(FunqDepDisposableProperty).Name, + typeof(AltDepProperty).Name, + typeof(AltDepDisposableProperty).Name, + }; Assert.That(expected.EquivalentTo(response.Results)); @@ -289,13 +297,11 @@ public void Does_AutoWire_ActionLevel_RequestFilters_Async() var response = client.Get(new ActionAttrAsync()); var expected = new List<string> { - typeof(FunqDepProperty).Name, - typeof(FunqDepDisposableProperty).Name, - typeof(AltDepProperty).Name, - typeof(AltDepDisposableProperty).Name, - }; - - response.Results.PrintDump(); + typeof(FunqDepProperty).Name, + typeof(FunqDepDisposableProperty).Name, + typeof(AltDepProperty).Name, + typeof(AltDepDisposableProperty).Name, + }; Assert.That(expected.EquivalentTo(response.Results)); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/AutoQueryIssues.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/AutoQueryIssues.cs new file mode 100644 index 00000000000..2c620a799f1 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/AutoQueryIssues.cs @@ -0,0 +1,186 @@ +using System.Linq; +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.DataAnnotations; +using ServiceStack.OrmLite; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + [Route("/query/employees/{Id}", "GET")] + public class QueryEmployee : QueryDb<Employee> + { + public string Id { get; set; } + } + + [Route("/query/employees", "GET")] + public class QueryEmployees : QueryDb<Employee>, IJoin<Employee, Department> { } + + public class Employee + { + [PrimaryKey] + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + [References(typeof(Department))] + public int DepartmentId { get; set; } + + [DataAnnotations.Ignore] + public Department Department { get; set; } + } + + public class Department + { + [PrimaryKey] + public int Id { get; set; } + public string Name { get; set; } + } + + public class AutoQueryJoinReferenceId + { + private static readonly Department[] SeedDepartments = new[] + { + new Department { Id = 10, Name = "Dept 1" }, + new Department { Id = 20, Name = "Dept 2" }, + new Department { Id = 30, Name = "Dept 3" }, + }; + + public static Employee[] SeedEmployees = new[] + { + new Employee { Id = 1, DepartmentId = 10, FirstName = "First 1", LastName = "Last 1" }, + new Employee { Id = 2, DepartmentId = 20, FirstName = "First 2", LastName = "Last 2" }, + new Employee { Id = 3, DepartmentId = 30, FirstName = "First 3", LastName = "Last 3" }, + }; + + class AppHost : AppSelfHostBase + { + public AppHost() + : base(typeof(ClientMemoryLeak).Name, typeof(AutoQueryJoinReferenceId).Assembly) {} + + public override void Configure(Container container) + { + SetConfig(new HostConfig{ UseCamelCase = true}); + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); + //var dbFactory = new OrmLiteConnectionFactory(Tests.Config.SqlServerConnString, SqlServerDialect.Provider); + container.Register<IDbConnectionFactory>(dbFactory); + + Plugins.Add(new AutoQueryFeature { MaxLimit = 100 }); + + using (var db = container.Resolve<IDbConnectionFactory>().Open()) + { + db.DropTable<Employee>(); + db.DropTable<Department>(); + db.CreateTable<Department>(); + db.CreateTable<Employee>(); + + db.InsertAll(SeedDepartments); + db.InsertAll(SeedEmployees); + } + } + } + + public IServiceClient client; + private readonly ServiceStackHost appHost; + public AutoQueryJoinReferenceId() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + + client = new JsonServiceClient(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TearDown() + { + appHost.Dispose(); + } + + [Test] + public void Does_only_populate_selected_fields() + { + QueryResponse<Employee> response; + response = client.Get(new QueryEmployees { Fields = "id,departmentid" }); + response.PrintDump(); + Assert.That(response.Results.All(x => x.Id > 0 && x.Id < 10)); + Assert.That(response.Results.All(x => x.DepartmentId >= 10)); + + response = client.Get(new QueryEmployees { Fields = "departmentid" }); + response.PrintDump(); + Assert.That(response.Results.All(x => x.Id == 0)); + Assert.That(response.Results.All(x => x.DepartmentId >= 10)); + } + + public partial class CustomFields + { + [Required] + [PrimaryKey] + [CustomField("CHAR(20)")] + public string StringId { get; set; } + [Required] + [CustomField("TINYINT")] + public byte Byte { get; set; } + } + + [Route("/Queries/CustomFields", "GET")] + public partial class CustomFieldsQuery + : QueryDb<CustomFields>, IReturn<QueryResponse<CustomFields>> + { + public CustomFieldsQuery() + { + StringIdBetween = new string[] { }; + StringIdIn = new string[] { }; + ByteBetween = new byte[] { }; + ByteIn = new byte[] { }; + } + + public virtual string StringId { get; set; } + public virtual string StringIdStartsWith { get; set; } + public virtual string StringIdEndsWith { get; set; } + public virtual string StringIdContains { get; set; } + public virtual string StringIdLike { get; set; } + public virtual string[] StringIdBetween { get; set; } + public virtual string[] StringIdIn { get; set; } + public virtual byte? Byte { get; set; } + public virtual byte? ByteGreaterThanOrEqualTo { get; set; } + public virtual byte? ByteGreaterThan { get; set; } + public virtual byte? ByteLessThan { get; set; } + public virtual byte? ByteLessThanOrEqualTo { get; set; } + public virtual byte? ByteNotEqualTo { get; set; } + public virtual byte[] ByteBetween { get; set; } + public virtual byte[] ByteIn { get; set; } + } + + [Test] + public void Can_query_Table_with_Byte_property() + { + using (var db = appHost.Resolve<IDbConnectionFactory>().Open()) + { + db.DropAndCreateTable<CustomFields>(); + db.Insert(new CustomFields { StringId = "1001", Byte = 1 }); + db.Insert(new CustomFields { StringId = "1002", Byte = 2 }); + } + + var response = client.Get(new CustomFieldsQuery + { + StringIdIn = new[] { "1001", "1002" }, + }); + Assert.That(response.Results.Map(x => x.Byte), Is.EquivalentTo(new[] { 1, 2 })); + + response = client.Get(new CustomFieldsQuery + { + StringIdIn = new[] { "1001", "1002" }, + Byte = 2 + }); + Assert.That(response.Results.Map(x => x.Byte), Is.EquivalentTo(new[] { (byte)2 })); + + response = client.Get(new CustomFieldsQuery + { + ByteIn = new byte[] { 1, 2 } + }); + Assert.That(response.Results.Map(x => x.Byte), Is.EquivalentTo(new[] { 1, 2 })); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/ClientMemoryLeak.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/ClientMemoryLeak.cs new file mode 100644 index 00000000000..cf1c0717f50 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/ClientMemoryLeak.cs @@ -0,0 +1,123 @@ +using System.Diagnostics; +using System.Reflection; +using Funq; +using NUnit.Framework; +using System.Collections.Generic; +using System.Net; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + [Ignore("Regression Test")] + [TestFixture] + public class ClientMemoryLeak + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(typeof(ClientMemoryLeak).Name, typeof(LeakServices).Assembly) + { } + + public override void Configure(Container container) { } + } + + private readonly ServiceStackHost appHost; + public ClientMemoryLeak() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TearDown() + { + appHost.Dispose(); + } + + [Route("/leak/{Name}")] + public class LeakRequest : IReturn<LeakRequest> + { + public string Name { get; set; } + } + + public class LeakServices : Service + { + public object Any(LeakRequest request) + { + return request; + } + } + + [Test] + public void Run_GET_dto_in_loop() + { + var client = new JsonServiceClient(Config.ListeningOn); + + client.Get(new LeakRequest { Name = "warmup" }); + + var sw = Stopwatch.StartNew(); + var elapsedTicks = new List<double> { sw.ElapsedMilliseconds }; + + for (int i = 0; i < 10001; i++) + { + var response = client.Get(new LeakRequest { Name = "request" + i }); + Assert.That(response.Name, Is.EqualTo("request" + i)); + elapsedTicks.Add(sw.ElapsedTicks); + } + + for (int i = 0; i < 10001; i += 1000) + { + "Elapsed Time: {0} ticks for Request at: #{1}".Print( + elapsedTicks[i + 1] - elapsedTicks[i], i); + } + } + + [Test] + public void Run_GET_url_in_loop() + { + var client = new JsonServiceClient(Config.ListeningOn); + + client.Get(new LeakRequest { Name = "warmup" }); + + var sw = Stopwatch.StartNew(); + var elapsedTicks = new List<double> { sw.ElapsedMilliseconds }; + + for (int i = 0; i < 10001; i++) + { + var response = client.Get<LeakRequest>("/leak/request" + i); + Assert.That(response.Name, Is.EqualTo("request" + i)); + elapsedTicks.Add(sw.ElapsedTicks); + } + + for (int i = 0; i < 10001; i += 1000) + { + "Elapsed Time: {0} ticks for Request at: #{1}".Print( + elapsedTicks[i + 1] - elapsedTicks[i], i); + } + } + + [Test] + public void Run_GET_url_HttpWebResponse_in_loop() + { + var client = new JsonServiceClient(Config.ListeningOn); + + client.Get(new LeakRequest { Name = "warmup" }); + + var sw = Stopwatch.StartNew(); + var elapsedTicks = new List<double> { sw.ElapsedMilliseconds }; + + for (int i = 0; i < 10001; i++) + { + using (HttpWebResponse response = client.Get<HttpWebResponse>("/leak/request" + i)) {} + elapsedTicks.Add(sw.ElapsedTicks); + } + + for (int i = 0; i < 10001; i += 1000) + { + "Elapsed Time: {0} ticks for Request at: #{1}".Print( + elapsedTicks[i + 1] - elapsedTicks[i], i); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/CustomPathTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/CustomPathTests.cs new file mode 100644 index 00000000000..1d665283003 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/CustomPathTests.cs @@ -0,0 +1,82 @@ +using Funq; +using NUnit.Framework; +using ServiceStack.WebHost.Endpoints.Tests.Support.Services; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + [TestFixture] + public class CustomPathTests + { + [Test] + public void Can_make_CustomPath_Request_without_HandlerPath() + { + var apiUrl = Config.ListeningOn + "api/"; + + var appHost = new AppHostWithHandlerPath() + .Init() + .Start(apiUrl); + + JsonServiceClient serviceClient = new JsonServiceClient(apiUrl); + + var request = new Hello { Name = "ServiceStack" }; + HelloResponse response = serviceClient.Post(request); + + Assert.That(response.Result.Contains(request.Name)); + + appHost.Dispose(); + } + + [Test] + public void Can_make_CustomPath_Request_with_HandlerPath() + { + var apiUrl = Config.ListeningOn + "api/"; + + var appHost = new AppHostWithoutHandlerPath() + .Init() + .Start(apiUrl); + + JsonServiceClient serviceClient = new JsonServiceClient(apiUrl); + + var request = new Hello { Name = "ServiceStack" }; + HelloResponse response = serviceClient.Post(request); + + Assert.That(response.Result.Contains(request.Name)); + + appHost.Dispose(); + } + } + + public class AppHostWithHandlerPath : AppSelfHostBase + { + public AppHostWithHandlerPath() + : base(nameof(CustomPathTests), typeof(AppHostWithHandlerPath).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + ApiVersion = "v1", + WsdlServiceNamespace = "http://schemas.example.com/", + DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), true) + }); + } + } + + public class AppHostWithoutHandlerPath : AppSelfHostBase + { + public AppHostWithoutHandlerPath() + : base(nameof(CustomPathTests), typeof(AppHostWithoutHandlerPath).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + ApiVersion = "v1", + HandlerFactoryPath = "api", // comment this out and it works + WsdlServiceNamespace = "http://schemas.example.com/", + DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), true) + }); + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/EmptyDtoIssue.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/EmptyDtoIssue.cs new file mode 100644 index 00000000000..b131b542621 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/EmptyDtoIssue.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + public class PostEmptyArray : IReturnVoid + { + public int[] Ids { get; set; } + } + + public class GetEmptyArray : IReturn<List<int>> + { + public int[] Ids { get; set; } + } + + public class TestService : Service + { + public void Post(PostEmptyArray e) + { + if (e.Ids == null) + throw new Exception(); + } + + public List<int> Get(GetEmptyArray e) + { + if (e.Ids == null) + throw new Exception(); + + return e.Ids.ToList(); + } + } + + public class EmptyDtoIssue + { + public class EmptyArrayDtoTest + { + public class AppHost : AppHostHttpListenerBase + { + public AppHost() : base(typeof(EmptyArrayDtoTest).Name, typeof(GetEmptyArray).Assembly) { } + + public override void Configure(Container container) { } + } + + ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Can_POST_empty_array() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + client.Post(new PostEmptyArray { Ids = new int[] { } }); + } + + [Test] + public void Can_GET_empty_array() + { + + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + client.Get(new GetEmptyArray { Ids = new int[] { } }); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/LoadWwwFormIssue.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/LoadWwwFormIssue.cs new file mode 100644 index 00000000000..36e9bd0756c --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/LoadWwwFormIssue.cs @@ -0,0 +1,71 @@ +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.OrmLite; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + [Route("/wwwform")] + public class TestForm + { + public string A { get; set; } + } + + public class TestFormService : Service + { + public object Any(TestForm request) + { + using (var cmd = Db.CreateCommand()) + { + var reqAttrs = request.ToObjectDictionary(); + Db.GetDialectProvider().PrepareInsertRowStatement<TestForm>(cmd, reqAttrs); + return cmd.CommandText; + } + } + } + + public class LoadWwwFormIssue + { + public class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(LoadWwwFormIssue), typeof(TestFormService).Assembly) { } + + public override void Configure(Container container) + { + container.Register<IDbConnectionFactory>(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + } + } + + private ServiceStackHost appHost; + public LoadWwwFormIssue() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Can_call_wwwform() + { + string ValidResponse = $"INSERT INTO \"{nameof(TestForm)}\" (\"{nameof(TestForm.A)}\") VALUES (@{nameof(TestForm.A)})"; + + var baseUrl = Config.ListeningOn.CombineWith("wwwform"); + + var responseStr = baseUrl.PostToUrl(null);//"A=B"); + Assert.That(responseStr, Is.EqualTo(ValidResponse)); + + responseStr = baseUrl.PostToUrl("A"); + Assert.That(responseStr, Is.EqualTo(ValidResponse)); + + responseStr = baseUrl.GetStringFromUrl("A=B"); + Assert.That(responseStr, Is.EqualTo(ValidResponse)); + + responseStr = baseUrl.GetStringFromUrl(); + Assert.That(responseStr, Is.EqualTo(ValidResponse)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/LocalizationIssues.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/LocalizationIssues.cs new file mode 100644 index 00000000000..3190df0f718 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/LocalizationIssues.cs @@ -0,0 +1,71 @@ +using System.Globalization; +using Funq; +using NUnit.Framework; +using ServiceStack.Common.Tests; +using ServiceStack.Host; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + [Route("/test/{Id}")] + public class LocalizationTest : IReturn<LocalizationTest> + { + public string Id { get; set; } + public string Data { get; set; } + } + + public class LocalizationTestService : Service + { + public object Any(LocalizationTest request) => request; + } + + public class LocalizationIssues + { + public class AppHost : AppSelfHostBase + { + public AppHost() : base("Test", typeof(AppHost).Assembly) { } + public override void Configure(Container container) { } + } + + private ServiceStackHost appHost; + + public LocalizationIssues() + { + CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("tr-TR"); + + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() + { + appHost.Dispose(); + CultureInfo.CurrentCulture = CultureInfo.InvariantCulture; + } + + [Test] + public void Can_resolve_routes_in_Turkish_Culture() + { + var restPath = new RestPath(typeof(LocalizationTest), "/test/{Id}"); + + foreach (var varName in new[] {"id", "ID", "Id", "iD"}) + { + //$"IsVariable({varName}) = {restPath.IsVariable(varName)}".Print(); + Assert.That(restPath.IsVariable(varName)); + } + + var request = restPath.CreateRequest("/test/3"); + } + + [Test] + public void Can_call_Service_in_Turkish_Culture() + { + var client = new JsonServiceClient(Config.ListeningOn); + var request = new LocalizationTest { Id = "foo" }; + var response = client.Get(request); + Assert.That(response.Id, Is.EqualTo(request.Id)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/NetworkIssues.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/NetworkIssues.cs new file mode 100644 index 00000000000..400b0f61b54 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/NetworkIssues.cs @@ -0,0 +1,51 @@ +using System.Net; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + [Route("/wait/{ForMs}")] + public class Wait : IReturn<Wait> + { + public int ForMs { get; set; } + } + + [TestFixture, Ignore("Requires external Services")] + public class NetworkIssues + { + [Test] + public async Task Simulate_broken_Network() + { + var client = new JsonServiceClient("http://test.servicestack.net"); + + var response = await client.GetAsync(new Wait { ForMs = 50000 }); + + } + + [Route("/hello")] + public partial class Hello : IReturn<HelloResponse> + { + public virtual string Name { get; set; } + } + + public partial class HelloResponse + { + public virtual string Result { get; set; } + } + + [Test] + public void Call_TestService_through_Fiddler_Proxy() + { + var client = new JsonServiceClient("http://test.servicestack.net") { + Proxy = new WebProxy("http://localhost:8888") + }; + +// var response = await client.GetAsync(new Hello { Name = "Hello, World! 1 + 1 = 2" }); + var response = client.Get(new Hello { Name = "Hello, World! 1 + 1 = 2" }); + + response.PrintDump(); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/RequestScopeIssue.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/RequestScopeIssue.cs new file mode 100644 index 00000000000..a36c6ffb26c --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/RequestScopeIssue.cs @@ -0,0 +1,72 @@ +using System.Threading; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + public class RequestScopeAppHost : AppSelfHostBase + { + public RequestScopeAppHost() + : base(typeof(RequestScopeAppHost).Name, typeof(RequestScopeService).Assembly) {} + + private static int counter = 0; + + public override void Configure(Container container) + { + container.Register(c => new MasterConfig { + Id = Interlocked.Increment(ref counter) + }).ReusedWithin(ReuseScope.Request); + } + } + + public class MasterConfig + { + public int Id { get; set; } + } + + public class GetMasterConfig : IReturn<MasterConfig> { } + + public class RequestScopeService : Service + { + private readonly MasterConfig config; + + public RequestScopeService(MasterConfig config) + { + this.config = config; + } + + public object Any(GetMasterConfig request) + { + return config; + } + } + + [TestFixture] + public class RequestScopeIssue + { + private readonly ServiceStackHost appHost; + + public RequestScopeIssue() + { + appHost = new RequestScopeAppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Can_get_RequestScope_dependency() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + Assert.That(client.Get(new GetMasterConfig()).Id, Is.EqualTo(1)); + Assert.That(client.Get(new GetMasterConfig()).Id, Is.EqualTo(2)); + Assert.That(client.Get(new GetMasterConfig()).Id, Is.EqualTo(3)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/ResponseFilterHeadersIssue.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/ResponseFilterHeadersIssue.cs new file mode 100644 index 00000000000..1c287ac60fb --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/ResponseFilterHeadersIssue.cs @@ -0,0 +1,74 @@ +using Funq; +using NUnit.Framework; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + public class ResponseFilterHeadersIssue + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(ResponseFilterHeadersIssue), typeof(ResponseFilterHeadersIssue).Assembly) { } + public override void Configure(Container container) + { +// Config.GlobalResponseHeaders.Remove(HttpHeaders.Vary); + + SetConfig(new HostConfig { + GlobalResponseHeaders = { + [HttpHeaders.Vary] = "accept,origin,authorization" + } + }); + } + } + + private readonly ServiceStackHost appHost; + public ResponseFilterHeadersIssue() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void ResponseFilterIShouldHaveVaryFilterTest() + { + using (var client = new JsonHttpClient(Config.ListeningOn)) + { + client.ResponseFilter = message => + { + var headers = message.Headers.Vary.Join(","); + Assert.That(headers, Is.EqualTo("accept,origin,authorization")); + Assert.That(message.Headers.CacheControl.ToString(), Is.EqualTo("no-cache")); + }; + + var response = client.Get(new ResponseFilterWithVaryRequest()); + Assert.That(response, Is.EqualTo("Should have vary headers.")); + } + } + } + + [NoCacheResponseFilter] + public class ResponseFilterService : Service + { + public object Get(ResponseFilterWithVaryRequest withVaryRequest) + { + return "Should have vary headers."; + } + } + + public class ResponseFilterWithVaryRequest: IGet, IReturn<string> + { + } + + public class NoCacheResponseFilterAttribute : ResponseFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object responseDto) + { + res.AddHeader("Cache-Control", "no-cache"); + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/SerializationIssues.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/SerializationIssues.cs new file mode 100644 index 00000000000..b1f110b7295 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/SerializationIssues.cs @@ -0,0 +1,84 @@ +using System.Collections.Generic; +using System.Reflection; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + [Route("/confirmations", "PUT")] + public class PutConfirmed : IReturn<PutConfirmedResponse> + { + public List<Confirmation> Confirmations { get; set; } + } + + public class Confirmation + { + public Confirmation() + { + ChangeId = 0; + Confirmed = false; + } + public int ChangeId { get; set; } + public bool Confirmed { get; set; } + } + + public class PutConfirmedResponse + { + public bool IsSucceed { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class SerializationIssuesService : Service + { + public object Put(PutConfirmed request) => new PutConfirmedResponse + { + IsSucceed = request.Confirmations[0].Confirmed && request.Confirmations[0].ChangeId == 126552616 + }; + } + + public class SerializationIssues + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(SerializationIssues), typeof(SerializationIssuesService).Assembly) + { + } + + public override void Configure(Container container) + { + } + } + + private readonly ServiceStackHost appHost; + + public SerializationIssues() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Does_serialize_request() + { + var client = new JsonHttpClient(Config.ListeningOn); + + var response = client.Put(new PutConfirmed + { + Confirmations = new List<Confirmation> + { + new Confirmation + { + ChangeId = 126552616, + Confirmed = true, + } + } + }); + + Assert.That(response.IsSucceed); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/ServiceExceptionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/ServiceExceptionTests.cs new file mode 100644 index 00000000000..489a9987ece --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/ServiceExceptionTests.cs @@ -0,0 +1,93 @@ +using System; +using System.Reflection; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + public class ThrowSync : IReturn<ThrowSync> { } + public class ThrowAsync : IReturn<ThrowAsync> { } + + public class ServiceExceptionServices : Service + { + public object Any(ThrowSync request) => + throw new WebServiceException(nameof(ThrowSync)); + + public Task<object> Any(ThrowAsync request) => + throw new WebServiceException(nameof(ThrowAsync)); + } + + public class ServiceExceptionTests + { + public static Exception ServiceEx; + public static Exception UnHandledEx; + + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ServiceExceptionTests), typeof(ServiceExceptionServices).Assembly) {} + + public override void Configure(Container container) + { + ServiceExceptionHandlers.Add((req, dto, ex) => { + ServiceEx = ex; + return null; + }); + + UncaughtExceptionHandlers.Add((req, res, op, ex) => { + UnHandledEx = ex; + }); + } + } + + private readonly ServiceStackHost appHost; + public ServiceExceptionTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public async Task ThrowSync_ServiceException_only_calls_ServiceExceptionHandlers() + { + ServiceEx = UnHandledEx = null; + var client = new JsonHttpClient(Config.ListeningOn); + + try + { + var response = await client.GetAsync(new ThrowSync()); + Assert.Fail("Should fail"); + } + catch (WebServiceException ex) + { + Assert.That(ServiceEx.Message, Is.EqualTo(nameof(ThrowSync))); + Assert.That(UnHandledEx, Is.Null); + Assert.That(ex.Message, Is.EqualTo(nameof(ThrowSync))); + } + } + + [Test] + public async Task ThrowAsync_ServiceException_only_calls_ServiceExceptionHandlers() + { + ServiceEx = UnHandledEx = null; + var client = new JsonHttpClient(Config.ListeningOn); + + try + { + var response = await client.GetAsync(new ThrowAsync()); + Assert.Fail("Should fail"); + } + catch (WebServiceException ex) + { + Assert.That(ServiceEx.Message, Is.EqualTo(nameof(ThrowAsync))); + Assert.That(UnHandledEx, Is.Null); + Assert.That(ex.Message, Is.EqualTo(nameof(ThrowAsync))); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/XmlContentTypeIssue.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/XmlContentTypeIssue.cs new file mode 100644 index 00000000000..a0af005cb18 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Issues/XmlContentTypeIssue.cs @@ -0,0 +1,66 @@ +using System.Reflection; +using System.Runtime.Serialization; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.Issues +{ + + [Route("/testxml", Verbs = "POST")] + [DataContract(Namespace = "")] + public class TestXml + { + [DataMember(Order = 0)] + public string User { get; set; } + } + + public class SimpleXmlService : Service + { + public object Any(TestXml request) + { + return request; + } + } + + [TestFixture] + public class XmlContentTypeIssue + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(typeof(XmlContentTypeIssue).Name, typeof(XmlContentTypeIssue).Assembly) {} + + public override void Configure(Container container) + { + } + } + + private ServiceStackHost appHost; + + public XmlContentTypeIssue() + { + appHost = new AppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Can_Post_Xml_with_Utf8_charset() + { + var xml = @"<TestXml> + <User>steve</User> + </TestXml>"; + var response = Config.AbsoluteBaseUri.CombineWith("/testxml") + .PostStringToUrl(xml, contentType: "text/xml; charset=utf-8", accept: "application/json"); + + Assert.That(response, Is.EqualTo("{\"User\":\"steve\"}").Or.EqualTo("{\"user\":\"steve\"}")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/JSTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/JSTests.cs new file mode 100644 index 00000000000..cc9e90fbe19 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/JSTests.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class JSTests + { + [Test] + public void Can_parse_dynamic_json() + { + Assert.That(JSON.parse("1"), Is.EqualTo(1)); + Assert.That(JSON.parse("1.1"), Is.EqualTo(1.1)); + Assert.That(JSON.parse("'a'"), Is.EqualTo("a")); + Assert.That(JSON.parse("\"a\""), Is.EqualTo("a")); + Assert.That(JSON.parse("{a:1}"), Is.EqualTo(new Dictionary<string, object> { {"a", 1 }})); + Assert.That(JSON.parse("{\"a\":1}"), Is.EqualTo(new Dictionary<string, object> { {"a", 1 }})); + Assert.That(JSON.parse("[{a:1},{b:2}]"), Is.EqualTo(new List<object> + { + new Dictionary<string, object> { { "a", 1 } }, + new Dictionary<string, object> { { "b", 2 } } + })); + } + + public class CustomFilter : ScriptMethods + { + public string reverse(string text) => new string(text.Reverse().ToArray()); + } + + [Test] + public void Can_eval_js() + { + var scope = JS.CreateScope( + args: new Dictionary<string, object> + { + { "arg", "value"} + }, + functions: new CustomFilter()); + + Assert.That(JS.eval("arg", scope), Is.EqualTo("value")); + + Assert.That(JS.eval("reverse(arg)", scope), Is.EqualTo("eulav")); + + Assert.That(JS.eval("itemsOf(3, padRight(reverse(arg), 8, '_'))", scope), Is.EqualTo(new List<object> { "eulav___", "eulav___", "eulav___" })); + + Assert.That(JS.eval("{a: itemsOf(3, padRight(reverse(arg), 8, '_')) }", scope), Is.EqualTo(new Dictionary<string, object> + { + { "a", new List<object> { "eulav___", "eulav___", "eulav___" } } + })); + + Assert.That(JS.eval("3.itemsOf(arg.reverse().padRight(8, '_'))", scope), Is.EqualTo(new List<object> { "eulav___", "eulav___", "eulav___" })); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/JsonpTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/JsonpTests.cs index 9594be920dc..ab6d2fa1f25 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/JsonpTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/JsonpTests.cs @@ -13,7 +13,7 @@ public class JsonpTests ExampleAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { LogManager.LogFactory = new ConsoleLogFactory(); @@ -23,7 +23,7 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { Dispose(); @@ -45,14 +45,14 @@ public void Can_GET_single_Movie_using_RestClient_with_JSONP() webReq.Accept = "*/*"; using (var webRes = webReq.GetResponse()) { - Assert.That(webRes.ContentType, Is.StringStarting(MimeTypes.JavaScript)); + Assert.That(webRes.ContentType, Does.StartWith(MimeTypes.JavaScript)); response = webRes.ReadToEnd(); } Assert.That(response, Is.Not.Null, "No response received"); Console.WriteLine(response); - Assert.That(response, Is.StringStarting("cb(")); - Assert.That(response, Is.StringEnding(")")); + Assert.That(response, Does.StartWith("cb(")); + Assert.That(response, Does.EndWith(")")); Assert.That(response.Length, Is.GreaterThan(50)); } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/LicenseUsageTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/LicenseUsageTests.cs index d6875f43400..3f1fb994e03 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/LicenseUsageTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/LicenseUsageTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt @@ -29,7 +29,8 @@ public void SetUp() [TearDown] public void TearDown() { - Licensing.RegisterLicense(new AppSettings().GetString("servicestack:license")); +// Licensing.RegisterLicense(new AppSettings().GetString("servicestack:license")); + Licensing.RegisterLicense(Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE")); } [Test] @@ -47,14 +48,19 @@ public void Allows_registration_of_10_operations() [Test] public void Throws_on_registration_of_11_operations() { - using (var appHost = new LicenseTestsAppHost(typeof(Services10), typeof(Service1))) + using (var appHost = new NoLicenseTestsAppHost(typeof(Services10), typeof(Service1))) { - Assert.Throws<LicenseException>(() => - appHost.Init()); + Assert.Throws(Is.TypeOf<LicenseException>() + .Or.TypeOf<TargetInvocationException>() + .With.Property("InnerException").TypeOf<LicenseException>(), + () => { + appHost.Init(); + appHost.Start(Config.ListeningOn); + }); } } - [Test] + [Ignore("TODO: Ignore reason"), Test] public void Allows_MegaDto_through_ServiceClient() { using (var appHost = new LicenseTestsAppHost(typeof(MegaDtoService))) @@ -84,10 +90,10 @@ public void Allows_MegaDto_through_ServiceClient() [TestFixture] public class FreeUsageRabbitMqClientTests : LicenseUsageTests { - [Test] + [Ignore("Integration Test"), Test] public void Allows_MegaDto_through_RabbitMqClients() { - var mqFactory = new RabbitMqMessageFactory(); + var mqFactory = new RabbitMqMessageFactory(connectionString: Config.RabbitMQConnString); var request = MegaDto.Create(); @@ -137,7 +143,8 @@ public class RegisteredLicenseUsageTests : LicenseUsageTests [Test] public void Allows_registration_of_11_operations() { - Licensing.RegisterLicense(new AppSettings().GetString("servicestack:license")); +// Licensing.RegisterLicense(new AppSettings().GetString("servicestack:license")); + Licensing.RegisterLicense(Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE")); using (var appHost = new LicenseTestsAppHost(typeof(Services10), typeof(Service1))) { @@ -270,6 +277,19 @@ protected override ServiceController CreateServiceController(params Assembly[] a public override void Configure(Container container) { Plugins.RemoveAll(x => x is NativeTypesFeature); + GetPlugin<MetadataFeature>().ServiceRoutes.Clear(); + } + } + + protected class NoLicenseTestsAppHost : LicenseTestsAppHost + { + public NoLicenseTestsAppHost(params Type[] services) + : base(services) {} + + public override void OnConfigLoad() + { + base.OnConfigLoad(); + LicenseUtils.RemoveLicense(); } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ManualValidationTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ManualValidationTests.cs new file mode 100644 index 00000000000..9aa9b644daa --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ManualValidationTests.cs @@ -0,0 +1,143 @@ +using System; +using System.Reflection; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.FluentValidation; +using ServiceStack.Text; +using ServiceStack.Validation; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class MyRegister : IReturn<EmptyResponse> + { + public string Email { get; set; } + } + + public class MyRegisterValidator : AbstractValidator<MyRegister> + { + public MyRegisterValidator() + { + RuleSet(ApplyTo.Get | ApplyTo.Post | ApplyTo.Put, + () => + { + RuleFor(x => x.Email).EmailAddress(); + }); + } + } + + public class MyRegisterService : Service + { + public object Get(MyRegister request) + { + var validator = new MyRegisterValidator { Request = Request }; + var validationResult = validator.Validate(Request, request); + if (!validationResult.IsValid) + throw validationResult.ToException(); + return new EmptyResponse(); + } + + public async Task<object> Post(MyRegister request) + { + var validator = new MyRegisterValidator { Request = Request }; + var validationResult = await validator.ValidateAsync(Request, request); + if (!validationResult.IsValid) + throw validationResult.ToException(); + return new EmptyResponse(); + } + + public async Task<object> Put(MyRegister request) + { + var validator = new MyRegisterValidator { Request = Request }; + var validationResult = validator.Validate(Request, request); + if (!validationResult.IsValid) + throw validationResult.ToException(); + return new EmptyResponse(); + } + } + + public class ManualValidationTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(ManualValidationTests), typeof(MyRegisterService).Assembly) {} + + public override void Configure(Container container) + { + Plugins.Add(new ValidationFeature { + ScanAppHostAssemblies = false, + }); + } + } + + private readonly ServiceStackHost appHost; + public ManualValidationTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + JsonServiceClient CreateClient() => new JsonServiceClient(Config.ListeningOn); + + private static void AssertMyRegisterManualValidation(WebServiceException e) + { + Assert.That(e.ErrorCode, Is.EqualTo(nameof(MyRegister.Email))); + Assert.That(e.Message, Is.EqualTo("'Email' is not a valid email address.")); + Assert.That(e.ResponseStatus.Errors[0].ErrorCode, Is.EqualTo(nameof(MyRegister.Email))); + Assert.That(e.ResponseStatus.Errors[0].FieldName, Is.EqualTo(nameof(MyRegister.Email))); + Assert.That(e.ResponseStatus.Errors[0].Message, Is.EqualTo("'Email' is not a valid email address.")); + } + + [Test] + public void Can_manual_validate_sync_Get_Validate() + { + var client = CreateClient(); + + try + { + client.Get(new MyRegister { Email = "not.an.email" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException e) + { + AssertMyRegisterManualValidation(e); + } + } + + [Test] + public async Task Can_manual_validate_async_Post_ValidateAsync() + { + var client = CreateClient(); + + try + { + await client.PostAsync(new MyRegister { Email = "not.an.email" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException e) + { + AssertMyRegisterManualValidation(e); + } + } + + [Test] + public async Task Can_manual_validate_async_Put_Validate() + { + var client = CreateClient(); + + try + { + await client.PutAsync(new MyRegister { Email = "not.an.email" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException e) + { + AssertMyRegisterManualValidation(e); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/MessageSerializationTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/MessageSerializationTests.cs index 5769628b361..dd1e15d7900 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/MessageSerializationTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/MessageSerializationTests.cs @@ -64,6 +64,7 @@ protected override void OnWriteBodyContents(XmlDictionaryWriter writer) } } +#if !NETCORE [Test] public void Can_create_entire_message_from_xml() { @@ -153,6 +154,7 @@ public void Can_create_message_from_xml() var request = (Reverse)DataContractSerializer.Instance.DeserializeFromString(requestXml, requestType); Assert.That(request.Value, Is.EqualTo("Testing")); } +#endif public class DtoBodyWriter : BodyWriter { diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/MockSessionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/MockSessionTests.cs new file mode 100644 index 00000000000..dd4ba649a38 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/MockSessionTests.cs @@ -0,0 +1,152 @@ +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Testing; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class MockSessionTests + { + public static AuthUserSession CreateUserSession() + { + return new AuthUserSession + { + UserAuthId = "1", + Language = "en", + PhoneNumber = "*****", + FirstName = "Test", + LastName = "User", + PrimaryEmail = "test@email.com", + UserAuthName = "Mocked", + UserName = "Mocked", + }; + } + + [Test] + public void Can_Mock_Session_in_Container() + { + using (var appHost = new BasicAppHost + { + ConfigureAppHost = host => host.RegisterService(typeof(MockSessionTestService)), + ConfigureContainer = x => x.Register<IAuthSession>(c => CreateUserSession()) + }.Init()) + { + var response = appHost.ExecuteService(new MockSessionTest()) as AuthUserSession; + + Assert.That(response.UserAuthId, Is.EqualTo("1")); + Assert.That(response.UserAuthName, Is.EqualTo("Mocked")); + Assert.That(response.PrimaryEmail, Is.EqualTo("test@email.com")); + } + } + + [Test] + public void Can_Mock_UnitTest_Session_in_IOC_with_MockHttpRequest() + { + using (new BasicAppHost + { + ConfigureContainer = container => + container.Register<IAuthSession>(c => CreateUserSession()) + }.Init()) + { + var service = new SessionService + { + Request = new MockHttpRequest() + }; + var session = service.GetSession(); + Assert.That(session.UserAuthId, Is.EqualTo("1")); + Assert.That(session.UserAuthName, Is.EqualTo("Mocked")); + } + } + + [Test] + public void Can_Mock_IntegrationTest_Session_with_Request() + { + using (new BasicAppHost(typeof(SessionService).Assembly).Init()) + { + var req = new MockHttpRequest + { + Items = { [Keywords.Session] = new AuthUserSession { UserName = "Mocked" } } + }; + + using (var service = HostContext.ResolveService<SessionService>(req)) + { + Assert.That(service.GetSession().UserName, Is.EqualTo("Mocked")); + } + } + } + + [Test] + public void Can_Mock_Session_in_RequestFilterAttribute() + { + using (var appHost = new BasicAppHost + { + ConfigureAppHost = host => + { + host.RegisterService(typeof(MockSessionTestService)); + } + }.Init()) + { + var response = appHost.ExecuteService(new MockSessionAttributeTest()) as AuthUserSession; + + Assert.That(response.UserAuthId, Is.EqualTo("1")); + Assert.That(response.UserAuthName, Is.EqualTo("Mocked")); + Assert.That(response.PrimaryEmail, Is.EqualTo("test@email.com")); + } + } + + public class AppHost : AppSelfHostBase + { + public AppHost() + : base("Mock Session Integration Test", typeof(MockSessionTestService).Assembly) { } + + public override void Configure(Container container) + { + GlobalRequestFilters.Add((req, res, dto) => + { + req.Items[Keywords.Session] = new AuthUserSession + { + UserAuthId = "1", + Language = "en", + PhoneNumber = "*****", + FirstName = "Test", + LastName = "User", + PrimaryEmail = "test@emailtest.com", + UserAuthName = "testuser", + }; + }); + } + } + + [Test] + public void Can_Mock_Session_in_RequestFilter_in_IntegrationTest() + { + using (new AppHost().Init().Start(Config.AbsoluteBaseUri)) + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + var response = client.Get(new MockSessionTest()); + + Assert.That(response.UserAuthId, Is.EqualTo("1")); + Assert.That(response.UserAuthName, Is.EqualTo("testuser")); + Assert.That(response.PrimaryEmail, Is.EqualTo("test@emailtest.com")); + } + } + } + + public class MockSessionTest : IReturn<AuthUserSession> { } + public class MockSessionAttributeTest : IReturn<AuthUserSession> { } + + public class UseMockedSession : RequestFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object requestDto) => + req.Items[Keywords.Session] = MockSessionTests.CreateUserSession(); + } + + public class MockSessionTestService : Service + { + public object Any(MockSessionTest request) => SessionAs<AuthUserSession>(); + + [UseMockedSession] + public object Any(MockSessionAttributeTest request) => SessionAs<AuthUserSession>(); + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/MultiTennantAppHostTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/MultiTennantAppHostTests.cs new file mode 100644 index 00000000000..098488d2b49 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/MultiTennantAppHostTests.cs @@ -0,0 +1,244 @@ +using System.Data; +using System.Linq; +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.OrmLite; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class MultiTenantChangeDbAppHost : AppSelfHostBase + { + public MultiTenantChangeDbAppHost() + : base("Multi Tenant Test", typeof (MultiTenantChangeDbAppHost).Assembly) {} + + public override void Configure(Container container) + { + container.Register<IDbConnectionFactory>(new OrmLiteConnectionFactory( + "~/App_Data/master.sqlite".MapAbsolutePath(), SqliteDialect.Provider)); + + var dbFactory = container.Resolve<IDbConnectionFactory>(); + + const int noOfTennants = 3; + + using (var db = dbFactory.OpenDbConnection()) + InitDb(db, "MASTER", "Masters inc."); + + noOfTennants.Times(i => + { + var tenantId = "T0" + (i + 1); + using (var db = dbFactory.OpenDbConnectionString(GetTenantConnString(tenantId))) + InitDb(db, tenantId, "ACME {0} inc.".Fmt(tenantId)); + }); + + RegisterTypedRequestFilter<IForTenant>((req,res,dto) => + req.Items[Keywords.DbInfo] = new ConnectionInfo { ConnectionString = GetTenantConnString(dto.TenantId)}); + } + + public void InitDb(IDbConnection db, string tenantId, string company) + { + db.DropAndCreateTable<TenantConfig>(); + db.Insert(new TenantConfig { Id = tenantId, Company = company }); + } + + public string GetTenantConnString(string tenantId) + { + return tenantId != null + ? "~/App_Data/tenant-{0}.sqlite".Fmt(tenantId).MapAbsolutePath() + : null; + } + } + + [TestFixture] + public class MultiTenantChangeDbAppHostTests + { + ServiceStackHost appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new MultiTenantChangeDbAppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Does_use_different_tenant_connections() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + var response = client.Get(new GetTenant()); + Assert.That(response.Config.Company, Is.EqualTo("Masters inc.")); + + response = client.Get(new GetTenant { TenantId = "T01" }); + Assert.That(response.Config.Company, Is.EqualTo("ACME T01 inc.")); + + response = client.Get(new GetTenant { TenantId = "T02" }); + Assert.That(response.Config.Company, Is.EqualTo("ACME T02 inc.")); + + response = client.Get(new GetTenant { TenantId = "T03" }); + Assert.That(response.Config.Company, Is.EqualTo("ACME T03 inc.")); + + Assert.Throws<WebServiceException>(() => + client.Get(new GetTenant { TenantId = "T04" })); + } + } + + /* + Common Service + */ + + public interface IForTenant + { + string TenantId { get; } + } + + public class TenantConfig + { + public string Id { get; set; } + public string Company { get; set; } + } + + public class GetTenant : IForTenant, IReturn<GetTenantResponse> + { + public string TenantId { get; set; } + } + + public class GetTenantResponse + { + public TenantConfig Config { get; set; } + } + + public class MultiTenantService : Service + { + public object Any(GetTenant request) + { + return new GetTenantResponse + { + Config = Db.Select<TenantConfig>().FirstOrDefault(), + }; + } + } + + /* + Alternative way to support multi tenancy using a Custom DB Factory + */ + public class MultiTenantCustomDbFactoryAppHost : AppSelfHostBase + { + public MultiTenantCustomDbFactoryAppHost() + : base("Multi Tennant Test", typeof(MultiTenantCustomDbFactoryAppHost).Assembly) { } + + public override void Configure(Container container) + { + var dbFactory = new OrmLiteConnectionFactory( + "~/App_Data/master.sqlite".MapAbsolutePath(), SqliteDialect.Provider); + + const int noOfTennants = 3; + + container.Register<IDbConnectionFactory>(c => + new MultiTenantDbFactory(dbFactory)); + + var multiDbFactory = (MultiTenantDbFactory) + container.Resolve<IDbConnectionFactory>(); + + using (var db = multiDbFactory.OpenTenant()) + InitDb(db, "MASTER", "Masters inc."); + + noOfTennants.Times(i => + { + var tenantId = "T0" + (i + 1); + using (var db = multiDbFactory.OpenTenant(tenantId)) + InitDb(db, tenantId, "ACME {0} inc.".Fmt(tenantId)); + }); + + GlobalRequestFilters.Add((req, res, dto) => + { + var forTennant = dto as IForTenant; + if (forTennant != null) + RequestContext.Instance.Items.Add("TenantId", forTennant.TenantId); + }); + } + + public void InitDb(IDbConnection db, string tenantId, string company) + { + db.DropAndCreateTable<TenantConfig>(); + db.Insert(new TenantConfig { Id = tenantId, Company = company }); + } + + public class MultiTenantDbFactory : IDbConnectionFactory + { + private readonly IDbConnectionFactory dbFactory; + + public MultiTenantDbFactory(IDbConnectionFactory dbFactory) + { + this.dbFactory = dbFactory; + } + + public IDbConnection OpenDbConnection() + { + var tenantId = RequestContext.Instance.Items["TenantId"] as string; + return OpenTenant(tenantId); + } + + public IDbConnection OpenTenant(string tenantId = null) + { + return tenantId != null + ? dbFactory.OpenDbConnectionString( + "~/App_Data/tenant-{0}.sqlite".Fmt(tenantId).MapAbsolutePath()) + : dbFactory.OpenDbConnection(); + } + + public IDbConnection CreateDbConnection() + { + return dbFactory.CreateDbConnection(); + } + } + } + + [TestFixture] + public class MultiTenantCustomDbFactoryAppHostTests + { + ServiceStackHost appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new MultiTenantCustomDbFactoryAppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Does_use_different_tenant_connections() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + var response = client.Get(new GetTenant()); + Assert.That(response.Config.Company, Is.EqualTo("Masters inc.")); + + response = client.Get(new GetTenant { TenantId = "T01" }); + Assert.That(response.Config.Company, Is.EqualTo("ACME T01 inc.")); + + response = client.Get(new GetTenant { TenantId = "T02" }); + Assert.That(response.Config.Company, Is.EqualTo("ACME T02 inc.")); + + response = client.Get(new GetTenant { TenantId = "T03" }); + Assert.That(response.Config.Company, Is.EqualTo("ACME T03 inc.")); + + Assert.Throws<WebServiceException>(() => + client.Get(new GetTenant { TenantId = "T04" })); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/NestedServiceTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/NestedServiceTests.cs index f0737d7ec81..12f70af6319 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/NestedServiceTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/NestedServiceTests.cs @@ -11,7 +11,7 @@ public class NestedServiceTests ExampleAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new ExampleAppHostHttpListener(); @@ -19,7 +19,7 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/NetCoreExtensions.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/NetCoreExtensions.cs new file mode 100644 index 00000000000..2c156d3f049 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/NetCoreExtensions.cs @@ -0,0 +1,59 @@ +using System; +using System.Net; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public static class NetCoreExtensions + { +#if NETCORE + public static HttpWebResponse GetResponse(this HttpWebRequest request) + { + return (HttpWebResponse)PclExport.Instance.GetResponse(request); + } + + public static bool AddRange(this HttpWebRequest request, int from, int? to) + { + string rangeSpecifier = "bytes"; + string curRange = request.Headers[HttpRequestHeader.Range]; + + if ((curRange == null) || (curRange.Length == 0)) { + curRange = rangeSpecifier + "="; + } + else { + if (String.Compare(curRange.Substring(0, curRange.IndexOf('=')), rangeSpecifier, StringComparison.OrdinalIgnoreCase) != 0) { + return false; + } + curRange = string.Empty; + } + curRange += from.ToString(); + if (to != null) { + curRange += "-" + to.ToString(); + } + request.Headers[HttpRequestHeader.Range] = curRange; + return true; + } + + public static void Close(this HttpWebResponse response) + { + response.Dispose(); + } +#endif + public static void SetUserAgent(this HttpWebRequest request, string userAgent) + { +#if NETCORE + request.Headers[HttpRequestHeader.UserAgent] = userAgent; +#else + request.UserAgent = userAgent; +#endif + } + + public static void SetContentLength(this HttpWebRequest request, int contentLength) + { +#if NETCORE + request.Headers[HttpRequestHeader.ContentLength] = contentLength.ToString(); +#else + request.ContentLength = contentLength; +#endif + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/NetCoreIocTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/NetCoreIocTests.cs new file mode 100644 index 00000000000..83c55aea32b --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/NetCoreIocTests.cs @@ -0,0 +1,80 @@ +#if NETCORE + +using System.Reflection; +using System.Threading; +using Funq; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class NetCoreIocTests + { + private readonly ServiceStackHost appHost; + public NetCoreIocTests() => appHost = new AppHost().Init().Start(Config.ListeningOn); + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(NetCoreIocTests), typeof(NetCoreIocTests).Assembly) {} + + public override void Configure(IServiceCollection services) + { + services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); + services.AddSingleton(c => new SingletonDep()); + services.AddScoped(c => new ScopedDep()); + } + + public override void Configure(Container container) {} + } + + [Test] + public void Does_resolve_scoped_deps_when() + { + var client = new JsonServiceClient(Config.ListeningOn); + var response = client.Get(new NetCoreIocTest()); + Assert.That(response.SingletonDepCounter, Is.EqualTo(1)); + Assert.That(response.ScopedDepCounter, Is.EqualTo(1)); + + response = client.Get(new NetCoreIocTest()); + Assert.That(response.SingletonDepCounter, Is.EqualTo(1)); + Assert.That(response.ScopedDepCounter, Is.EqualTo(2)); + } + } + + public class NetCoreIocTest : IReturn<NetCoreIocTestResponse> {} + + public class NetCoreIocTestResponse + { + public int SingletonDepCounter { get; set; } + public int ScopedDepCounter { get; set; } + } + + public class SingletonDep + { + public static int Counter; + public SingletonDep() => Interlocked.Increment(ref Counter); + } + public class ScopedDep + { + public static int Counter; + public ScopedDep() => Interlocked.Increment(ref Counter); + } + + public class NetCoreScopedTestServices : Service + { + public SingletonDep Singleton { get; set; } + public ScopedDep Scoped { get; set; } + + public object Any(NetCoreIocTest request) => new NetCoreIocTestResponse { + SingletonDepCounter = SingletonDep.Counter, + ScopedDepCounter = ScopedDep.Counter + }; + } + +} + +#endif \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/NetCoreTestsRunner.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/NetCoreTestsRunner.cs new file mode 100644 index 00000000000..e31b9c04c28 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/NetCoreTestsRunner.cs @@ -0,0 +1,36 @@ +#if NUNITLITE +using NUnitLite; +using NUnit.Common; +using System.Reflection; +using ServiceStack.Text; +using System; +using System.Globalization; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class NetCoreTestsRunner + { + /// <summary> + /// The main program executes the tests. Output may be routed to + /// various locations, depending on the arguments passed. + /// </summary> + /// <remarks>Run with --help for a full list of arguments supported</remarks> + /// <param name="args"></param> + public static int Main(string[] args) + { + var licenseKey = Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE"); + if (licenseKey.IsNullOrEmpty()) + throw new ArgumentNullException("SERVICESTACK_LICENSE", "Add Environment variable for SERVICESTACK_LICENSE"); + + Licensing.RegisterLicense(licenseKey); + //"ActivatedLicenseFeatures: ".Print(LicenseUtils.ActivatedLicenseFeatures()); + + CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); + JsConfig.InitStatics(); + //JsonServiceClient client = new JsonServiceClient(); + var writer = new ExtendedTextWrapper(Console.Out); + return new AutoRun(((IReflectableType)typeof(NetCoreTestsRunner)).GetTypeInfo().Assembly).Execute(args, writer, Console.In); + } + } +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/NewApiTodos.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/NewApiTodos.cs index f775c7d74bf..c4cf747293d 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/NewApiTodos.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/NewApiTodos.cs @@ -106,7 +106,7 @@ public class NewApiTodosTests AppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new AppHost(); @@ -114,7 +114,7 @@ public void TestFixtureSetUp() appHost.Start(BaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/OperationTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/OperationTests.cs index b673c0a8bdc..118b72bcd95 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/OperationTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/OperationTests.cs @@ -1,21 +1,24 @@ using System; +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Runtime.Serialization; using System.Threading; +using System.Threading.Tasks; using System.Web.UI; using Funq; using NUnit.Framework; using ServiceStack.Common.Tests; using ServiceStack.Metadata; using ServiceStack.Testing; +using ServiceStack.Text; using ServiceStack.WebHost.Endpoints.Tests.Support.Operations; namespace ServiceStack.WebHost.Endpoints.Tests { public class OperationTestsAppHost : AppHostHttpListenerBase { - public OperationTestsAppHost() : base(typeof(GetCustomer).Name, typeof(GetCustomer).Assembly) { } + public OperationTestsAppHost() : base(nameof(GetCustomer), typeof(GetCustomer).Assembly) { } public override void Configure(Container container) { } } @@ -25,11 +28,14 @@ public class OperationTests : IService private OperationTestsAppHost appHost; private OperationControl operationControl; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new OperationTestsAppHost(); appHost.Init(); +#if NETCORE + appHost.Start(Config.ListeningOn); +#endif var dummyServiceType = GetType(); appHost.Metadata.Add(dummyServiceType, typeof(GetCustomer), typeof(GetCustomerResponse)); @@ -46,11 +52,11 @@ public void OnTestFixtureSetUp() ResponseMessage = "(HttpWebResponse)", Title = "Metadata page", OperationName = "operationname", - MetadataHtml = "<p>Operation</p>" + MetadataHtml = "<p>Operation</p>", }; } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -59,29 +65,29 @@ public void OnTestFixtureTearDown() [TearDown] public void OnTearDown() { - appHost.Config.WebHostUrl = null; + if (appHost?.Config?.WebHostUrl != null) + appHost.Config.WebHostUrl = null; } [Test] - public void OperationControl_render_creates_link_back_to_main_page_using_WebHostUrl_when_set() + public async Task OperationControl_render_creates_link_back_to_main_page_using_WebHostUrl_when_set() { appHost.Config.WebHostUrl = "https://host.example.com/_api"; - var stringWriter = new StringWriter(); - operationControl.Render(new HtmlTextWriter(stringWriter)); - - string html = stringWriter.ToString(); + using var ms = MemoryStreamFactory.GetStream(); + await operationControl.RenderAsync(ms); + + string html = await ms.ReadToEndAsync(); Assert.IsTrue(html.Contains("<a href=\"https://host.example.com/_api/metadata\">&lt;back to all web services</a>")); } [Test] - public void OperationControl_render_creates_link_back_to_main_page_using_relative_uri_when_WebHostUrl_not_set() + public async Task OperationControl_render_creates_link_back_to_main_page_using_relative_uri_when_WebHostUrl_not_set() { - var stringWriter = new StringWriter(); - operationControl.Render(new HtmlTextWriter(stringWriter)); - - string html = stringWriter.ToString(); - Assert.IsTrue(html.Contains("<a href=\"/metadata\">&lt;back to all web services</a>")); + using var ms = MemoryStreamFactory.GetStream(); + await operationControl.RenderAsync(ms); + string html = await ms.ReadToEndAsync(); + Assert.That(html, Does.Contain("<a href=\"http://localhost/metadata\">&lt;back to all web services</a>")); } [Test] @@ -107,15 +113,24 @@ public class CultureSwitch : IDisposable public CultureSwitch(string culture) { +#if NETCORE + _currentCulture = CultureInfo.CurrentCulture; + CultureInfo.CurrentCulture = new CultureInfo(culture); +#else var currentThread = Thread.CurrentThread; _currentCulture = currentThread.CurrentCulture; var switchCulture = CultureInfo.GetCultureInfo(culture); currentThread.CurrentCulture = switchCulture; +#endif } public void Dispose() { +#if NETCORE + CultureInfo.CurrentCulture = _currentCulture; +#else Thread.CurrentThread.CurrentCulture = _currentCulture; +#endif } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/PartialContentResultTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/PartialContentResultTests.cs index 5b9520e1388..753435dadc7 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/PartialContentResultTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/PartialContentResultTests.cs @@ -32,7 +32,7 @@ public object Get(PartialFile request) if (request.RelativePath.IsNullOrEmpty()) throw new ArgumentNullException("RelativePath"); - string filePath = "~/{0}".Fmt(request.RelativePath).MapProjectPath(); + string filePath = "~/{0}".Fmt(request.RelativePath).MapProjectPlatformPath(); if (!File.Exists(filePath)) throw new FileNotFoundException(request.RelativePath); @@ -67,34 +67,24 @@ public override void Configure(Container container) {} [TestFixture] public class PartialContentResultTests { - public const string BaseUri = Config.ServiceStackBaseUri; - public const string ListeningOn = Config.AbsoluteBaseUri; + string BaseUri = Config.ServiceStackBaseUri; + string ListeningOn = Config.AbsoluteBaseUri; - private PartialContentAppHost appHost; + private ServiceStackHost appHost; - readonly FileInfo uploadedFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPath()); - readonly FileInfo uploadedTextFile = new FileInfo("~/TestExistingDir/textfile.txt".MapProjectPath()); + readonly FileInfo uploadedFile = new FileInfo("~/TestExistingDir/upload.html".MapProjectPlatformPath()); + readonly FileInfo uploadedTextFile = new FileInfo("~/TestExistingDir/textfile.txt".MapProjectPlatformPath()); - [TestFixtureSetUp] + [OneTimeSetUp] public void TextFixtureSetUp() { - try - { - appHost = new PartialContentAppHost(); - appHost.Init(); - appHost.Start(ListeningOn); - } - catch (Exception ex) - { - throw ex; - } + appHost = new PartialContentAppHost() + .Init() + .Start(ListeningOn); } - [TestFixtureTearDown] - public void TestFixtureTearDown() - { - if (appHost != null) appHost.Dispose(); - } + [OneTimeTearDown] + public void TestFixtureTearDown() => appHost?.Dispose(); [Test] public void Can_StaticFile_GET_200_OK_response_for_file_with_no_range_header() @@ -178,7 +168,7 @@ public void Can_GET_206_Partial_response_for_text_with_range_header() public async Task Can_respond_to_non_range_requests_with_200_OK_response() { var mockRequest = new MockHttpRequest(); - var mockResponse = new MockHttpResponse(); + var mockResponse = new MockHttpResponse(mockRequest); string customText = "1234567890"; byte[] customTextBytes = customText.ToUtf8Bytes(); @@ -187,13 +177,13 @@ public async Task Can_respond_to_non_range_requests_with_200_OK_response() var httpResult = new HttpResult(ms, "audio/mpeg"); - bool reponseWasAutoHandled = await mockResponse.WriteToResponse(mockRequest, httpResult); - Assert.That(reponseWasAutoHandled, Is.True); + bool responseWasAutoHandled = await mockResponse.WriteToResponse(mockRequest, httpResult); + Assert.That(responseWasAutoHandled, Is.True); string writtenString = mockResponse.ReadAsString(); Assert.That(writtenString, Is.EqualTo(customText)); - Assert.That(mockResponse.Headers["Content-Range"], Is.Null); + Assert.That(mockResponse.Headers.ContainsKey("Content-Range"), Is.False); Assert.That(mockResponse.Headers["Accept-Ranges"], Is.EqualTo("bytes")); Assert.That(mockResponse.StatusCode, Is.EqualTo(200)); } @@ -202,9 +192,9 @@ public async Task Can_respond_to_non_range_requests_with_200_OK_response() public async Task Can_seek_from_beginning_to_end() { var mockRequest = new MockHttpRequest(); - var mockResponse = new MockHttpResponse(); + var mockResponse = new MockHttpResponse(mockRequest); - mockRequest.Headers[HttpHeaders.Range] = "bytes=0"; + mockRequest.Headers[HttpHeaders.Range] = "bytes=0-"; string customText = "1234567890"; byte[] customTextBytes = customText.ToUtf8Bytes(); @@ -233,7 +223,7 @@ public async Task Can_seek_from_beginning_to_further_than_end() // e.g. Facebook crawler always sends range header of 'bytes=0-524287'. var mockRequest = new MockHttpRequest(); - var mockResponse = new MockHttpResponse(); + var mockResponse = new MockHttpResponse(mockRequest); mockRequest.Headers[HttpHeaders.Range] = "bytes=0-524287"; @@ -260,7 +250,7 @@ public async Task Can_seek_from_beginning_to_further_than_end() public async Task Can_seek_from_beginning_to_middle() { var mockRequest = new MockHttpRequest(); - var mockResponse = new MockHttpResponse(); + var mockResponse = new MockHttpResponse(mockRequest); mockRequest.Headers[HttpHeaders.Range] = "bytes=0-2"; @@ -289,7 +279,7 @@ public async Task Can_seek_from_middle_to_end() { var mockRequest = new MockHttpRequest(); mockRequest.Headers.Add("Range", "bytes=4-"); - var mockResponse = new MockHttpResponse(); + var mockResponse = new MockHttpResponse(mockRequest); string customText = "1234567890"; byte[] customTextBytes = customText.ToUtf8Bytes(); @@ -316,7 +306,7 @@ public async Task Can_seek_from_middle_to_middle() { var mockRequest = new MockHttpRequest(); mockRequest.Headers.Add("Range", "bytes=3-5"); - var mockResponse = new MockHttpResponse(); + var mockResponse = new MockHttpResponse(mockRequest); string customText = "1234567890"; byte[] customTextBytes = customText.ToUtf8Bytes(); @@ -348,7 +338,7 @@ public async Task Can_use_fileStream() "File content is {0}".Print(fileText); var mockRequest = new MockHttpRequest(); - var mockResponse = new MockHttpResponse(); + var mockResponse = new MockHttpResponse(mockRequest); mockRequest.Headers.Add("Range", "bytes=6-8"); var httpResult = new HttpResult(uploadedTextFile, "audio/mpeg"); @@ -366,7 +356,7 @@ public async Task Can_use_fileStream() } [Test] - [Explicit("Helps debugging when you need to find out WTF is going on")] + [Ignore("Helps debugging when you need to find out WTF is going on")] public void Run_for_30secs() { Thread.Sleep(30000); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/PasswordHasherTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/PasswordHasherTests.cs new file mode 100644 index 00000000000..40968b6cd93 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/PasswordHasherTests.cs @@ -0,0 +1,272 @@ +using System; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Data; +using ServiceStack.OrmLite; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public abstract class PasswordHasherTestsBase + { + protected ServiceStackHost appHost; + + protected class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(PasswordHasherTestsBase), typeof(PasswordHasherTestsBase).Assembly) {} + + public bool UsePasswordHasher { get; set; } + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + DebugMode = true + }); + + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] { + new CredentialsAuthProvider(AppSettings), + }) + { + IncludeRegistrationService = true + }); + + container.Register<IDbConnectionFactory>(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + container.Register<IAuthRepository>(c => + new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>())); + + container.Resolve<IAuthRepository>().InitSchema(); + + var authRepo = container.Resolve<IAuthRepository>(); + + Config.UseSaltedHash = UsePasswordHasher; + + authRepo.CreateUserAuth(new UserAuth + { + UserName = "oldUser", + Email = "oldUser@email.com", + DisplayName = "Old User", + FirstName = "Old", + LastName = "User", + }, "oldpass"); + + Config.UseSaltedHash = !UsePasswordHasher; + + authRepo.CreateUserAuth(new UserAuth + { + UserName = "newUser", + Email = "newUser@email.com", + DisplayName = "New User", + FirstName = "New", + LastName = "User", + }, "newpass"); + } + } + + protected readonly IUserAuth origNewUser; + protected readonly IUserAuth origOldUser; + + protected PasswordHasherTestsBase() + { + appHost = CreateAppHost(); + + origNewUser = appHost.GetAuthRepository().GetUserAuthByUserName("newUser"); + origOldUser = appHost.GetAuthRepository().GetUserAuthByUserName("oldUser"); + } + + protected abstract ServiceStackHost CreateAppHost(); + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + protected virtual JsonServiceClient CreateClient() => new JsonServiceClient(Config.ListeningOn); + + protected void AssertUsedNewPasswordHasher(IUserAuth user) + { + Assert.That(user.PasswordHash != null && user.Salt == null); + + byte[] decodedHashedPassword = Convert.FromBase64String(user.PasswordHash); + + Assert.That(decodedHashedPassword[0], Is.EqualTo(0x01)); + Assert.That(appHost.TryResolve<IPasswordHasher>().Version, Is.EqualTo(0x01)); + } + + protected void AssertUsedOldSaltedHash(IUserAuth user) => Assert.That(user.PasswordHash != null && user.Salt != null); + } + + class PasswordHasherUpgradeTests : PasswordHasherTestsBase + { + protected override ServiceStackHost CreateAppHost() => new AppHost + { + UsePasswordHasher = true, + } + .Init() + .Start(Config.ListeningOn); + + [Test] + public void Does_use_old_SaltedHash_for_oldUser() + { + AssertUsedOldSaltedHash(origOldUser); + } + + [Test] + public void Does_use_new_PasswordHasher_for_newUser() + { + AssertUsedNewPasswordHasher(origNewUser); + } + + [Test] + public void Can_authenticate_with_oldUser_which_upgrade_to_PasswordHash() + { + var client = CreateClient(); + + var response = client.Post(new Authenticate + { + provider = "credentials", + UserName = "oldUser", + Password = "oldpass", + }); + + Assert.That(response.DisplayName, Is.EqualTo("Old User")); + + var oldUserAfterAuth = appHost.GetAuthRepository().GetUserAuthByUserName("oldUser"); + AssertUsedNewPasswordHasher(oldUserAfterAuth); + + //Can re-auth after password hash upgrade + response = client.Post(new Authenticate + { + provider = "credentials", + UserName = "oldUser", + Password = "oldpass", + }); + + Assert.That(response.DisplayName, Is.EqualTo("Old User")); + AssertUsedNewPasswordHasher(oldUserAfterAuth); + } + + [Test] + public void Can_Autenticate_with_newUser_which_retains_new_PasswordHash() + { + var client = CreateClient(); + + var response = client.Post(new Authenticate + { + provider = "credentials", + UserName = "newUser", + Password = "newpass", + }); + + Assert.That(response.DisplayName, Is.EqualTo("New User")); + + var newUserAfterAuth = appHost.GetAuthRepository().GetUserAuthByUserName("newUser"); + AssertUsedNewPasswordHasher(newUserAfterAuth); + } + + [Test] + public void New_registered_user_uses_new_PasswordHash() + { + var client = CreateClient(); + + var response = client.Post(new Register + { + UserName = "newUser2", + Email = "newUser2@email.com", + DisplayName = "New User2", + FirstName = "New2", + LastName = "User", + Password = "newpass2" + }); + + var newUser2 = appHost.GetAuthRepository().GetUserAuthByUserName("newUser2"); + AssertUsedNewPasswordHasher(newUser2); + + client.Post(new Authenticate + { + provider = "credentials", + UserName = "newUser2", + Password = "newpass2", + }); + } + } + + public class PasswordHasherDowngradeTests : PasswordHasherTestsBase + { + protected override ServiceStackHost CreateAppHost() => new AppHost + { + UsePasswordHasher = false, + } + .Init() + .Start(Config.ListeningOn); + + [Test] + public void Does_use_new_PasswordHasher_for_oldUser() + { + AssertUsedNewPasswordHasher(origOldUser); + } + + [Test] + public void Does_use_old_SaltedHash_for_newUser() + { + AssertUsedOldSaltedHash(origNewUser); + } + + [Test] + public void Can_authenticate_with_oldUser_which_downgrades_to_SaltedHash() + { + var client = CreateClient(); + + var response = client.Post(new Authenticate + { + provider = "credentials", + UserName = "oldUser", + Password = "oldpass", + }); + + Assert.That(response.DisplayName, Is.EqualTo("Old User")); + + var oldUserAfterAuth = appHost.GetAuthRepository().GetUserAuthByUserName("oldUser"); + AssertUsedOldSaltedHash(oldUserAfterAuth); + + //Can re-auth after password hash downgrade + response = client.Post(new Authenticate + { + provider = "credentials", + UserName = "oldUser", + Password = "oldpass", + }); + + Assert.That(response.DisplayName, Is.EqualTo("Old User")); + AssertUsedOldSaltedHash(oldUserAfterAuth); + } + + [Test] + public void New_registered_user_uses_old_SaltedHash() + { + var client = CreateClient(); + + var response = client.Post(new Register + { + UserName = "newUser2", + Email = "newUser2@email.com", + DisplayName = "New User2", + FirstName = "New2", + LastName = "User", + Password = "newpass2" + }); + + var newUser2 = appHost.GetAuthRepository().GetUserAuthByUserName("newUser2"); + AssertUsedOldSaltedHash(newUser2); + + client.Post(new Authenticate + { + provider = "credentials", + UserName = "newUser2", + Password = "newpass2", + }); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Properties/AssemblyInfo.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Properties/AssemblyInfo.cs index 5be7548f78d..4ea3fe1bfdd 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Properties/AssemblyInfo.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Properties/AssemblyInfo.cs @@ -1,40 +1,7 @@ using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using System.Runtime.Serialization; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ServiceStack.WebHost.Endpoints.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ServiceStack.WebHost.Endpoints.Tests")] -[assembly: AssemblyCopyright("Copyright (c) 2009")] -[assembly: AssemblyTrademark("Service Stack")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a10fdf44-0168-49d4-9f25-0dfac96998ea")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] //Default DataContract namespace instead of tempuri.org //Note: doesn't work for ilmerged assemblies diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Properties/launchSettings.json b/tests/ServiceStack.WebHost.Endpoints.Tests/Properties/launchSettings.json new file mode 100644 index 00000000000..a28e6aaa3d4 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Properties/launchSettings.json @@ -0,0 +1,22 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:63815/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "ServiceStack.WebHost.Endpoints.Tests": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ProtoBufServiceTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ProtoBufServiceTests.cs index 44f1fa29072..64576389c28 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ProtoBufServiceTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ProtoBufServiceTests.cs @@ -1,8 +1,7 @@ -using System; -using System.Runtime.Serialization; +using System.Runtime.Serialization; using System.Text; +using System.Threading.Tasks; using NUnit.Framework; -using ServiceStack.Common.Tests; using ServiceStack.Logging; using ServiceStack.ProtoBuf; using ServiceStack.Text; @@ -10,125 +9,175 @@ namespace ServiceStack.WebHost.Endpoints.Tests { - [DataContract] - public class ProtoBufEmail - { - [DataMember(Order = 1)] - public string ToAddress { get; set; } - [DataMember(Order = 2)] - public string FromAddress { get; set; } - [DataMember(Order = 3)] - public string Subject { get; set; } - [DataMember(Order = 4)] - public string Body { get; set; } - [DataMember(Order = 5)] - public byte[] AttachmentData { get; set; } - - public bool Equals(ProtoBufEmail other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return Equals(other.ToAddress, ToAddress) - && Equals(other.FromAddress, FromAddress) - && Equals(other.Subject, Subject) - && Equals(other.Body, Body) - && other.AttachmentData.EquivalentTo(AttachmentData); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (ProtoBufEmail)) return false; - return Equals((ProtoBufEmail) obj); - } - - public override int GetHashCode() - { - unchecked - { - int result = (ToAddress != null ? ToAddress.GetHashCode() : 0); - result = (result*397) ^ (FromAddress != null ? FromAddress.GetHashCode() : 0); - result = (result*397) ^ (Subject != null ? Subject.GetHashCode() : 0); - result = (result*397) ^ (Body != null ? Body.GetHashCode() : 0); - result = (result*397) ^ (AttachmentData != null ? AttachmentData.GetHashCode() : 0); - return result; - } - } - } - - [DataContract] - public class ProtoBufEmailResponse - { - [DataMember(Order = 1)] - public ResponseStatus ResponseStatus { get; set; } - } - - public class ProtoBufEmailService : Service - { + [Route("/protobufemail")] + [DataContract] + public class ProtoBufEmail + { + [DataMember(Order = 1)] + public string ToAddress { get; set; } + + [DataMember(Order = 2)] + public string FromAddress { get; set; } + + [DataMember(Order = 3)] + public string Subject { get; set; } + + [DataMember(Order = 4)] + public string Body { get; set; } + + [DataMember(Order = 5)] + public byte[] AttachmentData { get; set; } + + public bool Equals(ProtoBufEmail other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Equals(other.ToAddress, ToAddress) + && Equals(other.FromAddress, FromAddress) + && Equals(other.Subject, Subject) + && Equals(other.Body, Body) + && other.AttachmentData.EquivalentTo(AttachmentData); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof(ProtoBufEmail)) return false; + return Equals((ProtoBufEmail) obj); + } + + public override int GetHashCode() + { + unchecked + { + int result = (ToAddress != null ? ToAddress.GetHashCode() : 0); + result = (result * 397) ^ (FromAddress != null ? FromAddress.GetHashCode() : 0); + result = (result * 397) ^ (Subject != null ? Subject.GetHashCode() : 0); + result = (result * 397) ^ (Body != null ? Body.GetHashCode() : 0); + result = (result * 397) ^ (AttachmentData != null ? AttachmentData.GetHashCode() : 0); + return result; + } + } + } + + [DataContract] + public class ProtoBufEmailResponse + { + [DataMember(Order = 1)] + public ResponseStatus ResponseStatus { get; set; } + } + + public class ProtoBufEmailService : Service + { public object Any(ProtoBufEmail request) - { - return request; - } - } + { + return request; + } + } - [TestFixture] + [TestFixture] public class ProtoBufServiceTests - { - protected const string ListeningOn = "http://localhost:1337/"; - - ExampleAppHostHttpListener appHost; - - [TestFixtureSetUp] - public void OnTestFixtureSetUp() - { - LogManager.LogFactory = new ConsoleLogFactory(); - - appHost = new ExampleAppHostHttpListener(); - appHost.Plugins.Add(new ProtoBufFormat()); - appHost.Init(); - appHost.Start(ListeningOn); - } - - [TestFixtureTearDown] - public void OnTestFixtureTearDown() - { - Dispose(); - } - - public void Dispose() - { - if (appHost == null) return; - appHost.Dispose(); - } - - [Test] - public void Can_Send_ProtoBuf_request() - { - var client = new ProtoBufServiceClient(ListeningOn); - - var request = new ProtoBufEmail { - ToAddress = "to@email.com", - FromAddress = "from@email.com", - Subject = "Subject", - Body = "Body", - AttachmentData = Encoding.UTF8.GetBytes("AttachmentData"), - }; - - try - { - var response = client.Send<ProtoBufEmail>(request); - - Console.WriteLine(response.Dump()); - - Assert.That(response.Equals(request)); - } - catch (WebServiceException webEx) - { - Console.WriteLine(webEx.ResponseDto.Dump()); - } - } - - } -} + { + protected const string ListeningOn = "http://localhost:1337/"; + + ExampleAppHostHttpListener appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + LogManager.LogFactory = new ConsoleLogFactory(); + + appHost = new ExampleAppHostHttpListener(); + appHost.Plugins.Add(new ProtoBufFormat()); + appHost.Init(); + appHost.Start(ListeningOn); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + Dispose(); + } + + public void Dispose() + { + if (appHost == null) return; + appHost.Dispose(); + } + + private static ProtoBufEmail CreateProtoBufEmail() + { + var request = new ProtoBufEmail { + ToAddress = "to@email.com", + FromAddress = "from@email.com", + Subject = "Subject", + Body = "Body", + AttachmentData = Encoding.UTF8.GetBytes("AttachmentData"), + }; + return request; + } + + [Test] + public void Can_Serialize_ProtoBufEmail_with_RecyclableMemoryStream() + { + var request = CreateProtoBufEmail(); + + // using var ms = new MemoryStream(); + using var ms = MemoryStreamFactory.GetStream(); + ProtoBufFormat.Serialize(request, ms); + + ms.Position = 0; + var response = ProtoBufFormat.Deserialize(request.GetType(), ms); + + Assert.That(response.Equals(request)); + } + + [Test] + public void Can_Send_ProtoBuf_request() + { + var client = new ProtoBufServiceClient(ListeningOn) { + RequestFilter = req => + Assert.That(req.Accept, Is.EqualTo(MimeTypes.ProtoBuf)) + }; + + var request = CreateProtoBufEmail(); + var response = client.Send<ProtoBufEmail>(request); + + response.PrintDump(); + Assert.That(response.Equals(request)); + } + + [Test] + public async Task Can_Send_ProtoBuf_request_Async() + { + var client = new ProtoBufServiceClient(ListeningOn) { + RequestFilter = req => + Assert.That(req.Accept, Is.EqualTo(MimeTypes.ProtoBuf)) + }; + + var request = CreateProtoBufEmail(); + var response = await client.SendAsync<ProtoBufEmail>(request); + + response.PrintDump(); + Assert.That(response.Equals(request)); + } + + [Test] + public void Does_return_ProtoBuf_when_using_ProtoBuf_Content_Type_and_Wildcard() + { + var bytes = ListeningOn.CombineWith("protobufemail") + .PostBytesToUrl(accept: "{0}, */*".Fmt(MimeTypes.ProtoBuf), + contentType: MimeTypes.ProtoBuf, + requestBody: CreateProtoBufEmail().ToProtoBuf(), + responseFilter: res => Assert.That(res.ContentType, Is.EqualTo(MimeTypes.ProtoBuf))); + + Assert.That(bytes.Length, Is.GreaterThan(0)); + + bytes = ListeningOn.CombineWith("protobufemail") + .GetBytesFromUrl(accept: "{0}, */*".Fmt(MimeTypes.ProtoBuf), + responseFilter: res => Assert.That(res.ContentType, Is.EqualTo(MimeTypes.ProtoBuf))); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RawRequestTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RawRequestTests.cs index fd144ddbf6a..89e89766e4b 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RawRequestTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RawRequestTests.cs @@ -1,88 +1,181 @@ using System; using System.IO; -using System.Net; +using System.Reflection; +using Funq; using NUnit.Framework; -using ServiceStack.Common; -using ServiceStack.Common.Web; -using ServiceStack.Logging; -using ServiceStack.Logging.Support.Logging; -using ServiceStack.ServiceClient.Web; -using ServiceStack.ServiceHost; -using ServiceStack.ServiceInterface; using ServiceStack.Text; -using ServiceStack.WebHost.Endpoints.Tests.Support.Host; -using ServiceStack.WebHost.IntegrationTests.Services; +using ServiceStack.Web; +using ServiceStack.WebHost.Endpoints.Tests.Support.Services; -namespace ServiceStack.WebHost.IntegrationTests.Tests +namespace ServiceStack.WebHost.Endpoints.Tests { - [RestService("/rawrequest")] - public class RawRequest : IRequiresRequestStream - { - public Stream RequestStream { get; set; } - } - - public class RawRequestResponse - { - public string Result { get; set; } - } - - public class RawRequestService : IService<RawRequest> - { - public object Execute(RawRequest request) - { - var rawRequest = request.RequestStream.ToUtf8String(); - return new RawRequestResponse { Result = rawRequest }; - } - } - - [TestFixture] - public class RawRequestTests - { - static class Config - { - public const string AbsoluteBaseUri = "http://localhost:82/"; - } - - ExampleAppHostHttpListener appHost; - - [TestFixtureSetUp] - public void OnTestFixtureStartUp() - { - appHost = new ExampleAppHostHttpListener(); - appHost.Init(); - appHost.Start(Config.AbsoluteBaseUri); - - System.Console.WriteLine("RawRequestTests Created at {0}, listening on {1}", - DateTime.Now, Config.AbsoluteBaseUri); - } - - [TestFixtureTearDown] - public void OnTestFixtureTearDown() - { - appHost.Dispose(); - appHost = null; - } - - [Test] - public void Can_POST_raw_request() - { - var rawData = "<<(( 'RAW_DATA' ))>>"; - var requestUrl = Config.AbsoluteBaseUri + "/rawrequest"; - var json = requestUrl.PutToUrl(rawData, ContentType.Json); - var response = json.FromJson<RawRequestResponse>(); - Assert.That(response.Result, Is.EqualTo(rawData)); - } - - [Test] - public void Can_PUT_raw_request() - { - var rawData = "<<(( 'RAW_DATA' ))>>"; - var requestUrl = Config.AbsoluteBaseUri + "/rawrequest"; - var json = requestUrl.PutToUrl(rawData, ContentType.Json); - var response = json.FromJson<RawRequestResponse>(); - Assert.That(response.Result, Is.EqualTo(rawData)); - } - - } + [Route("/rawrequest")] + public class RawRequest : IRequiresRequestStream + { + public Stream RequestStream { get; set; } + } + + [Route("/rawrequest/{Path}")] + public class RawRequestWithParam : IRequiresRequestStream + { + public string Path { get; set; } + public string Param { get; set; } + public Stream RequestStream { get; set; } + } + + public class RawRequestResponse + { + public string Result { get; set; } + } + + [Restrict(RequestAttributes.Xml)] + [Route("/Leads/LeadData/", "POST", Notes = "LMS - DirectApi")] + public class CustomXml : IRequiresRequestStream + { + public Stream RequestStream { get; set; } + } + + [Route("/rawsvg/{Letter}", "GET")] + public class RawSvg + { + public string Letter { get; set; } + } + + public class RawRequestService : Service + { + public object Any(RawRequest request) + { + var rawRequest = request.RequestStream.ToUtf8String(); + return new RawRequestResponse { Result = rawRequest }; + } + + public object Any(RawRequestWithParam request) + { + var rawRequest = request.RequestStream.ToUtf8String(); + return new RawRequestResponse { Result = request.Path + ":" + request.Param + ":" + rawRequest }; + } + + public object Any(CustomXml request) + { + var xml = request.RequestStream.ReadToEnd(); + return xml; + } + + private const string SvgTemplate = @"<svg width=""100"" height=""100"" xmlns=""http://www.w3.org/2000/svg""> + <g> + <rect x=""0"" y=""0"" width=""100"" height=""100"" id=""canvas_background"" fill=""#999999""/> + </g> + <g> + <text x=""50%"" y=""60%"" alignment-baseline=""middle"" text-anchor=""middle"" fill=""#ffffff"" font-size=""80"" font-family=""Helvetica, Arial, sans-serif"" font-weight=""bold"">LETTER</text> + </g> +</svg>"; + + public object Get(RawSvg request) + { + Response.ContentType = MimeTypes.GetMimeType("svg"); + return SvgTemplate.Replace("LETTER", (request.Letter ?? "A").Substring(0, 1).ToUpper()); + } + } + + [TestFixture] + public class RawRequestTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(RawRequestTests), typeof(RawRequestService).Assembly) {} + + public override void Configure(Container container) + { + } + } + + private readonly ServiceStackHost appHost; + public RawRequestTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Can_POST_raw_request() + { + var rawData = "<<(( 'RAW_DATA' ))>>"; + var requestUrl = Config.ServiceStackBaseUri + "/rawrequest"; + var json = requestUrl.PostStringToUrl(rawData, contentType: MimeTypes.PlainText, accept: MimeTypes.Json); + var response = json.FromJson<RawRequestResponse>(); + Assert.That(response.Result, Is.EqualTo(rawData)); + } + + [Test] + public void Can_POST_raw_request_to_predefined_route() + { + var rawData = "{\"raw\":\"json\"}"; + var requestUrl = Config.ServiceStackBaseUri + "/json/reply/RawRequest"; + var json = requestUrl.PostJsonToUrl(rawData); + var response = json.FromJson<RawRequestResponse>(); + Assert.That(response.Result, Is.EqualTo(rawData)); + } + + [Test] + public void Can_POST_raw_request_with_params() + { + var rawData = "<<(( 'RAW_DATA' ))>>"; + var requestUrl = Config.ServiceStackBaseUri + "/rawrequest/Foo?Param=Bar"; + var json = requestUrl.PostStringToUrl(rawData, contentType: MimeTypes.PlainText, accept: MimeTypes.Json); + var response = json.FromJson<RawRequestResponse>(); + var expected = "{0}:{1}:{2}".Fmt("Foo", "Bar", rawData); + Assert.That(response.Result, Is.EqualTo(expected)); + } + + [Test] + public void Can_PUT_raw_request() + { + var rawData = "<<(( 'RAW_DATA' ))>>"; + var requestUrl = Config.ServiceStackBaseUri + "/rawrequest"; + var json = requestUrl.PutStringToUrl(rawData, contentType: MimeTypes.PlainText, accept: MimeTypes.Json); + var response = json.FromJson<RawRequestResponse>(); + Assert.That(response.Result, Is.EqualTo(rawData)); + } + + [Test] + public void Can_POST_Custom_XML() + { + var xml = @"<LeadApplications> + <LeadApplication> + <Email>daffy.duck@example.com</Email> + <FirstName>Joey</FirstName> + <MiddleName>Disney</MiddleName> + <LastName>Duck</LastName> + <Street1>1 Disneyland Street</Street1> + <Street2>2 Disneyland Street</Street2> + <City>PAUMA VALLEY</City> + <State>CA</State> + <Zip>92503</Zip> + </LeadApplication> + </LeadApplications>"; + + var requestUrl = Config.ServiceStackBaseUri + "/Leads/LeadData/"; + var responseXml = requestUrl.PostXmlToUrl(xml); + + Assert.That(responseXml, Is.EqualTo(xml)); + } + + [Test] + public void Can_download_svg() + { + var requestUrl = Config.ServiceStackBaseUri + "/rawsvg/M"; + var svg = requestUrl.GetStringFromUrl( + accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + responseFilter: res => Assert.That(res.ContentType, Does.StartWith(MimeTypes.ImageSvg))); + + Assert.That(svg, Does.Contain(">M</text>")); + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RedirectPathTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RedirectPathTests.cs new file mode 100644 index 00000000000..ce95571e136 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RedirectPathTests.cs @@ -0,0 +1,54 @@ +using System.Reflection; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [TestFixture] + public class RedirectPathTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(RedirectPathTests), typeof(RedirectPathTests).Assembly) + { + } + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + DefaultRedirectPath = "~/does-resolve" + }); + } + + public override string ResolveAbsoluteUrl(string virtualPath, IRequest httpReq) + { + return virtualPath == "~/does-resolve" + ? base.ResolveAbsoluteUrl("~/webpage.html", httpReq) + : base.ResolveAbsoluteUrl(virtualPath, httpReq); + } + } + + private readonly ServiceStackHost appHost; + + public RedirectPathTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void DefaultRedirectPath_RelativeUrl_does_resolve() + { + var html = Config.ListeningOn.GetStringFromUrl(); + Assert.That(html, Does.Contain("Default index")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RemoteEndDropsConnectionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RemoteEndDropsConnectionTests.cs index e1a97da7c55..a2c19daef84 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RemoteEndDropsConnectionTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RemoteEndDropsConnectionTests.cs @@ -19,7 +19,7 @@ public RemoteEndDropsConnectionTests() LogManager.LogFactory = new TestLogFactory(); } - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureStartUp() { appHost = new ExampleAppHostHttpListener(); @@ -31,7 +31,7 @@ public void OnTestFixtureStartUp() DateTime.Now, ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -88,7 +88,9 @@ public void TestClientDropsConnection(bool writeErrorsToResponse) var url = string.Format("{0}test/timed?Milliseconds={1}", ListeningOn, sleepMs); var req = WebRequest.Create(url) as HttpWebRequest; //Set a short timeout so we'll give up before the request is processed +#if !NETCORE req.Timeout = 100; +#endif try { var res = (HttpWebResponse)req.GetResponse(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ReplyAllTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ReplyAllTests.cs new file mode 100644 index 00000000000..1035976dc69 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ReplyAllTests.cs @@ -0,0 +1,736 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.OrmLite; +using ServiceStack.Redis; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class ReplyAllAppHost : AppSelfHostBase + { + public ReplyAllAppHost() + : base(typeof(ReplyAllTests).Name, typeof(ReplyAllService).Assembly) + { } + + public override void Configure(Container container) + { + GlobalRequestFilters.Add((rew, res, dto) => + ReplyAllRequestAttribute.AssertSingleDto(dto)); + + GlobalResponseFilters.Add((rew, res, dto) => + ReplyAllResponseAttribute.AssertSingleDto(dto)); + + container.Register<IDbConnectionFactory>(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + container.Register<IRedisClientsManager>(c => + new RedisManagerPool()); + } + } + + public class ReplyAllRequestAttribute : RequestFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object requestDto) + { + AssertSingleDto(requestDto); + } + + public static void AssertSingleDto(object dto) + { + if (!(dto is BatchThrows || dto is BatchThrowsAsync || dto is NoRepeat || dto is HelloAll || dto is HelloAllAsync || dto is HelloAllVoid || dto is HelloAllVoidAsync || dto is HelloGet || dto is HelloAllCustom || dto is HelloAllTransaction || dto is Request)) + throw new Exception("Invalid " + dto.GetType().Name); + } + } + + public class ReplyAllResponseAttribute : ResponseFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object responseDto) + { + AssertSingleDto(responseDto); + } + + public static void AssertSingleDto(object dto) + { + if (!(dto == null || dto is Task || dto is BatchThrowsResponse || dto is NoRepeatResponse || dto is HelloAllResponse || dto is HelloAllCustomResponse + || dto is HelloAllTransactionResponse || dto is IHttpResult)) + throw new Exception("Invalid " + dto.GetType().Name); + } + } + + public class ReplyAllArrayRequestAttribute : RequestFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object requestDto) + { + if (requestDto.GetType() != typeof(HelloAllCustom[])) + throw new Exception("Invalid " + requestDto.GetType().Name); + } + } + + public class ReplyAllArrayResponseAttribute : ResponseFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object responseDto) + { + //still based on Response of Service + if (responseDto.GetType() != typeof(List<HelloAllCustomResponse>)) + throw new Exception("Invalid " + responseDto.GetType().Name); + } + } + + public class HelloAll : IReturn<HelloAllResponse> + { + public string Name { get; set; } + } + + public class HelloAllAsync : IReturn<HelloAllResponse> + { + public string Name { get; set; } + } + + public class HelloAllVoid : IReturnVoid + { + public static int Counter; + + public string Name { get; set; } + } + + public class HelloAllVoidAsync : IReturnVoid + { + public static int Counter; + + public string Name { get; set; } + } + + public class HelloGet : IReturn<HelloAllResponse> + { + public string Name { get; set; } + } + + public class HelloAllResponse + { + public string Result { get; set; } + } + + public class HelloAllCustom : IReturn<HelloAllCustomResponse> + { + public string Name { get; set; } + } + + public class HelloAllCustomResponse + { + public string Result { get; set; } + } + + public class HelloAllTransaction : IReturn<HelloAllTransactionResponse> + { + public string Name { get; set; } + } + + public class HelloAllTransactionResponse + { + public string Result { get; set; } + } + + public class Request : IReturnVoid + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class ReplyAllService : Service + { + public static int TimesExecuted = 0; + + [ReplyAllRequest] + [ReplyAllResponse] + public object Any(HelloAll request) + { + TimesExecuted++; + return new HelloAllResponse { Result = "Hello, {0}!".Fmt(request.Name) }; + } + + [ReplyAllRequest] + [ReplyAllResponse] + public object Any(HelloAllAsync request) + { + return Task.FromResult(new HelloAllResponse { Result = "Hello, {0}!".Fmt(request.Name) }); + } + + public object Get(HelloGet request) + { + return new HelloAllResponse { Result = "Hello, {0}!".Fmt(request.Name) }; + } + + public void Any(HelloAllVoid request) + { + HelloAllVoid.Counter++; + } + + public async Task Any(HelloAllVoidAsync request) + { + HelloAllVoidAsync.Counter++; + await Task.FromResult(0); + } + + [ReplyAllRequest] + [ReplyAllResponse] + public object Any(HelloAllCustom request) + { + return new HelloAllCustomResponse { Result = "Hello, {0}!".Fmt(request.Name) }; + } + + [ReplyAllArrayRequest] + [ReplyAllArrayResponse] + public object Any(HelloAllCustom[] requests) + { + return requests.Map(x => new HelloAllCustomResponse + { + Result = "Custom, {0}!".Fmt(x.Name) + }); + } + + public object Any(HelloAllTransaction request) + { + if (request.Name == "Bar") + throw new ArgumentException("No Bar allowed here"); + + Db.Insert(request); + + return new HelloAllTransactionResponse { Result = "Hello, {0}!".Fmt(request.Name) }; + } + + public object Any(HelloAllTransaction[] requests) + { + using (var trans = Db.OpenTransaction()) + { + var response = requests.Map(Any); + + trans.Commit(); + + return response; + } + } + + public void Any(Request request) + { + Redis.Store(request); + } + + public void Any(Request[] requests) + { + Redis.StoreAll(requests); + } + } + + public class NoRepeat : IReturn<NoRepeatResponse> + { + public Guid Id { get; set; } + } + + public class NoRepeatResponse + { + public Guid Id { get; set; } + } + + public class BatchThrows : IReturn<BatchThrowsResponse> + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class BatchThrowsAsync : IReturn<BatchThrowsResponse> + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class BatchThrowsResponse + { + public string Result { get; set; } + + public ResponseStatus ResponseStatus { get; set; } + } + + public class AutoBatchServices : IService + { + private static readonly HashSet<Guid> ReceivedGuids = new HashSet<Guid>(); + + public NoRepeatResponse Any(NoRepeat request) + { + if (ReceivedGuids.Contains(request.Id)) + throw new ArgumentException("Id {0} already received".Fmt(request.Id)); + + ReceivedGuids.Add(request.Id); + + return new NoRepeatResponse + { + Id = request.Id + }; + } + + public object Any(BatchThrows request) + { + throw new Exception("Batch Throws"); + } + + public async Task Any(BatchThrowsAsync request) + { + await Task.Delay(0); + + throw new Exception("Batch Throws"); + } + } + + public class ReplyAllJsonServiceClientTests : ReplyAllTests + { + public override IServiceClient CreateClient(string baseUri) + { + return new JsonServiceClient(baseUri); + } + + public override IServiceClientAsync CreateClientAsync(string baseUri) + { + return new JsonServiceClient(baseUri); + } + } + + public class ReplyAllJsonHttpClientTests : ReplyAllTests + { + public override IServiceClient CreateClient(string baseUri) + { + return new JsonHttpClient(baseUri); + } + + public override IServiceClientAsync CreateClientAsync(string baseUri) + { + return new JsonHttpClient(baseUri); + } + } + + public class ReplyAllXmlServiceClientTests : ReplyAllTests + { + public override IServiceClient CreateClient(string baseUri) + { + return new XmlServiceClient(baseUri); + } + + public override IServiceClientAsync CreateClientAsync(string baseUri) + { + return new XmlServiceClient(baseUri); + } + } + + public class ReplyAllCsvServiceClientTests : ReplyAllTests + { + public override IServiceClient CreateClient(string baseUri) + { + return new CsvServiceClient(baseUri); + } + + public override IServiceClientAsync CreateClientAsync(string baseUri) + { + return new CsvServiceClient(baseUri); + } + } + + [TestFixture] + public abstract class ReplyAllTests + { + private ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = new ReplyAllAppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + public abstract IServiceClient CreateClient(string baseUri); + public abstract IServiceClientAsync CreateClientAsync(string baseUri); + + [Test] + public void Can_send_single_HelloAll_request() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var request = new HelloAll { Name = "Foo" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo("Hello, Foo!")); + } + + [Test] + public async Task Can_send_single_HelloAllAsync_request() + { + var client = CreateClientAsync(Config.AbsoluteBaseUri); + + var request = new HelloAllAsync { Name = "Foo" }; + var response = await client.SendAsync<HelloAllResponse>(request); + Assert.That(response.Result, Is.EqualTo("Hello, Foo!")); + } + + [Test] + public void Can_send_multi_reply_HelloAll_requests() + { + ReplyAllService.TimesExecuted = 0; + + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new HelloAll { Name = "Foo" }, + new HelloAll { Name = "Bar" }, + new HelloAll { Name = "Baz" }, + }; + + var responses = client.SendAll(requests); + var results = responses.Map(x => x.Result); + + Assert.That(results, Is.EquivalentTo(new[] { + "Hello, Foo!", "Hello, Bar!", "Hello, Baz!" + })); + + Assert.That(ReplyAllService.TimesExecuted, Is.EqualTo(requests.Length)); + } + + [Test] + public async Task Can_send_multi_reply_HelloAllAsync_requests() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new HelloAllAsync { Name = "Foo" }, + new HelloAllAsync { Name = "Bar" }, + new HelloAllAsync { Name = "Baz" }, + }; + + var responses = await client.SendAllAsync(requests); + var results = responses.Map(x => x.Result); + + Assert.That(results, Is.EquivalentTo(new[] { + "Hello, Foo!", "Hello, Bar!", "Hello, Baz!" + })); + } + + [Test] + public void Can_send_multi_reply_HelloGet_requests() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri) + { + RequestFilter = req => + req.Headers[HttpHeaders.XHttpMethodOverride] = HttpMethods.Get + }; + + var requests = new[] + { + new HelloGet { Name = "Foo" }, + new HelloGet { Name = "Bar" }, + new HelloGet { Name = "Baz" }, + }; + + client.Get(new HelloGet { Name = "aaa" }); + + var responses = client.SendAll(requests); + var results = responses.Map(x => x.Result); + + Assert.That(results, Is.EquivalentTo(new[] { + "Hello, Foo!", "Hello, Bar!", "Hello, Baz!" + })); + } + + [Test] + public void Can_send_multi_HelloAllVoid() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new HelloAllVoid { Name = "Foo" }, + new HelloAllVoid { Name = "Bar" }, + new HelloAllVoid { Name = "Baz" }, + }; + + client.SendAllOneWay(requests); + } + + [Test] + public void Can_send_PublishAll_HelloAllVoid() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new HelloAllVoid { Name = "Foo" }, + new HelloAllVoid { Name = "Bar" }, + new HelloAllVoid { Name = "Baz" }, + }; + + client.PublishAll(requests); + } + + [Test] + public void Can_send_multi_HelloAllVoidAsync() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new HelloAllVoidAsync { Name = "Foo" }, + new HelloAllVoidAsync { Name = "Bar" }, + new HelloAllVoidAsync { Name = "Baz" }, + }; + + client.SendAllOneWay(requests); + } + + [Test] + public async Task Can_send_PublishAllAsync_HelloAllVoidAsync() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new HelloAllVoidAsync { Name = "Foo" }, + new HelloAllVoidAsync { Name = "Bar" }, + new HelloAllVoidAsync { Name = "Baz" }, + }; + + await client.PublishAllAsync(requests); + } + + [Test] + public void Can_send_single_HelloAllCustom_request() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var request = new HelloAllCustom { Name = "Foo" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo("Hello, Foo!")); + } + + [Test] + public void Can_send_multi_reply_HelloAllCustom_requests() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new HelloAllCustom { Name = "Foo" }, + new HelloAllCustom { Name = "Bar" }, + new HelloAllCustom { Name = "Baz" }, + }; + + var responses = client.SendAll(requests); + var results = responses.Map(x => x.Result); + + Assert.That(results, Is.EquivalentTo(new[] { + "Custom, Foo!", "Custom, Bar!", "Custom, Baz!" + })); + } + + [Test] + public async Task Can_send_async_multi_reply_HelloAllCustom_requests() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new HelloAllCustom { Name = "Foo" }, + new HelloAllCustom { Name = "Bar" }, + new HelloAllCustom { Name = "Baz" }, + }; + + var responses = await client.SendAllAsync(requests); + var results = responses.Map(x => x.Result); + + Assert.That(results, Is.EquivalentTo(new[] { + "Custom, Foo!", "Custom, Bar!", "Custom, Baz!" + })); + } + + [Test] + public void Can_send_multi_oneway_HelloAllCustom_requests() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new HelloAllCustom { Name = "Foo" }, + new HelloAllCustom { Name = "Bar" }, + new HelloAllCustom { Name = "Baz" }, + }; + + client.SendAllOneWay(requests); + } + + [Test] + public void Can_send_multiple_single_HelloAllTransaction() + { + using (var db = appHost.Resolve<IDbConnectionFactory>().Open()) + { + db.DropAndCreateTable<HelloAllTransaction>(); + } + + var client = CreateClient(Config.AbsoluteBaseUri); + + var names = new[] { "Foo", "Bar", "Baz" }; + + try + { + foreach (var name in names) + { + client.Send(new HelloAllTransaction { Name = name }); + } + + Assert.Fail("Should throw on Bar"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(ArgumentException).Name)); + } + + using (var db = appHost.Resolve<IDbConnectionFactory>().Open()) + { + var allRequests = db.Select<HelloAllTransaction>(); + Assert.That(allRequests.Count, Is.EqualTo(1)); + Assert.That(allRequests[0].Name, Is.EqualTo("Foo")); + } + } + + [Test] + public void Sending_multiple_HelloAllTransaction_does_rollback_transaction() + { + using (var db = appHost.Resolve<IDbConnectionFactory>().Open()) + { + db.DropAndCreateTable<HelloAllTransaction>(); + } + + var client = CreateClient(Config.AbsoluteBaseUri); + var requests = new[] + { + new HelloAllTransaction { Name = "Foo" }, + new HelloAllTransaction { Name = "Bar" }, + new HelloAllTransaction { Name = "Baz" }, + }; + + try + { + var responses = client.SendAll(requests); + + Assert.Fail("Should throw on Bar"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(ArgumentException).Name)); + } + + using (var db = appHost.Resolve<IDbConnectionFactory>().Open()) + { + var allRequests = db.Select<HelloAllTransaction>(); + Assert.That(allRequests.Count, Is.EqualTo(0)); + } + } + + [Test] + public void Can_store_multiple_requests_with_SendAllOneWay() + { + using (var redis = appHost.Resolve<IRedisClientsManager>().GetClient()) + { + redis.FlushAll(); + + var client = CreateClient(Config.AbsoluteBaseUri); + var requests = new[] + { + new Request { Id = 1, Name = "Foo" }, + new Request { Id = 2, Name = "Bar" }, + new Request { Id = 3, Name = "Baz" }, + }; + + client.SendAllOneWay(requests); + + var savedRequests = redis.As<Request>().GetAll(); + + Assert.That(savedRequests.Map(x => x.Name), Is.EquivalentTo(new[] { + "Foo", "Bar", "Baz" + })); + } + } + + [Test] + public void Does_not_repeat() + { + var client = CreateClient(Config.AbsoluteBaseUri); + var batch = new[] { new NoRepeat { Id = Guid.NewGuid() }, new NoRepeat { Id = Guid.NewGuid() } }; + + var results = client.SendAll(batch); + var guids = results.Select(r => r.Id); + Assert.IsTrue(guids.SequenceEqual(batch.Select(b => b.Id))); + } + + [Test] + public void Does_throw_WebServiceException_on_Error() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new BatchThrows { Id = 1, Name = "Foo" }, + new BatchThrows { Id = 2, Name = "Bar" }, + new BatchThrows { Id = 3, Name = "Baz" }, + }; + + try + { + var responses = client.SendAll(requests); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(Exception).Name)); + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(typeof(Exception).Name)); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("Batch Throws")); + Assert.That(ex.ResponseHeaders[HttpHeaders.XAutoBatchCompleted], Is.EqualTo("0")); + } + } + + [Test] + public async Task Does_throw_WebServiceException_on_Error_Async() + { + var client = CreateClient(Config.AbsoluteBaseUri); + + var requests = new[] + { + new BatchThrowsAsync { Id = 1, Name = "Foo" }, + new BatchThrowsAsync { Id = 2, Name = "Bar" }, + new BatchThrowsAsync { Id = 3, Name = "Baz" }, + }; + + try + { + var responses = await client.SendAllAsync(requests); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(Exception).Name)); + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(typeof(Exception).Name)); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("Batch Throws")); + Assert.That(ex.ResponseHeaders[HttpHeaders.XAutoBatchCompleted], Is.EqualTo("0")); + } + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestContextTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestContextTests.cs index daf7e14224f..724fb975f90 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestContextTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestContextTests.cs @@ -14,8 +14,6 @@ namespace ServiceStack.WebHost.Endpoints.Tests [TestFixture] public class RequestContextTests { - private const string ListeningOn = "http://localhost:1337/"; - public class HeadersAppHostHttpListener : AppHostHttpListenerBase { @@ -38,8 +36,7 @@ public override void Configure(Container container) this.GlobalRequestFilters.Add((req, res, dto) => { - var requestFilter = dto as RequestFilter; - if (requestFilter != null) + if (dto is RequestFilter requestFilter) { res.StatusCode = requestFilter.StatusCode; if (!requestFilter.HeaderName.IsNullOrEmpty()) @@ -53,15 +50,15 @@ public override void Configure(Container container) HeadersAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new HeadersAppHostHttpListener(); appHost.Init(); - appHost.Start(ListeningOn); + appHost.Start(Config.ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -69,25 +66,33 @@ public void OnTestFixtureTearDown() public static Dictionary<string, string> GetResponseHeaders(String url) { - var webRequest = (HttpWebRequest)WebRequest.Create(url); + try + { + var webRequest = (HttpWebRequest)WebRequest.Create(url); - var webResponse = webRequest.GetResponse(); + var webResponse = webRequest.GetResponse(); - var map = new Dictionary<string, string>(); - for (var i = 0; i < webResponse.Headers.Count; i++) + var map = new Dictionary<string, string>(); + for (var i = 0; i < webResponse.Headers.Count; i++) + { + var header = webResponse.Headers.AllKeys[i]; + map[header] = webResponse.Headers[header]; + } + + return map; + } + catch (WebException e) { - var header = webResponse.Headers.Keys[i]; - map[header] = webResponse.Headers[header]; + Console.WriteLine(e); + throw; } - - return map; } [Test] public void Can_resolve_CustomHeader() { var webRequest = (HttpWebRequest)WebRequest.Create( - ListeningOn + "json/reply/Headers?Name=X-CustomHeader"); + Config.ListeningOn + "json/reply/Headers?Name=X-CustomHeader"); webRequest.Headers["X-CustomHeader"] = "CustomValue"; var response = JsonSerializer.DeserializeFromStream<HeadersResponse>( @@ -99,7 +104,7 @@ public void Can_resolve_CustomHeader() [Test] public void Does_Send_Global_Headers() { - var headers = GetResponseHeaders(ListeningOn + "json/reply/Headers"); + var headers = GetResponseHeaders(Config.ListeningOn + "json/reply/Headers"); Assert.That(headers["Access-Control-Allow-Origin"], Is.EqualTo("*")); Assert.That(headers["Access-Control-Allow-Methods"], Is.EqualTo("GET, POST, PUT, DELETE, OPTIONS")); } @@ -110,7 +115,7 @@ public void Does_return_bare_401_StatusCode() try { var webRequest = (HttpWebRequest)WebRequest.Create( - ListeningOn + "json/reply/RequestFilter?StatusCode=401"); + Config.ListeningOn + "json/reply/RequestFilter?StatusCode=401"); webRequest.GetResponse(); @@ -128,7 +133,7 @@ public void Does_return_bare_401_with_AuthRequired_header() { try { - var webRequest = (HttpWebRequest)WebRequest.Create(ListeningOn + var webRequest = (HttpWebRequest)WebRequest.Create(Config.ListeningOn + "json/reply/RequestFilter?StatusCode=401" + "&HeaderName=" + HttpHeaders.WwwAuthenticate + "&HeaderValue=" + "Basic realm=\"Auth Required\"".UrlEncode()); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestFiltersTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestFiltersTests.cs index 981aeea7332..ad69b0ca76e 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestFiltersTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestFiltersTests.cs @@ -2,332 +2,468 @@ using System.IO; using System.Net; using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; using System.Text; using System.Threading.Tasks; using Funq; using NUnit.Framework; using ServiceStack.Host; using ServiceStack.Text; +using ServiceStack.Web; using ServiceStack.WebHost.Endpoints.Tests.Support; using ServiceStack.WebHost.Endpoints.Tests.Support.Host; namespace ServiceStack.WebHost.Endpoints.Tests { - [DataContract] - [Route("/secure")] - public class Secure - { - [DataMember] - public string UserName { get; set; } - } - - [DataContract] - public class SecureResponse : IHasResponseStatus - { - [DataMember] - public string Result { get; set; } - - [DataMember] - public ResponseStatus ResponseStatus { get; set; } - } - - public class SecureService : IService - { - public object Any(Secure request) - { - return new SecureResponse { Result = "Confidential" }; - } - } - - [DataContract] - [Route("/insecure")] - public class Insecure - { - [DataMember] - public string UserName { get; set; } - } - - [DataContract] - public class InsecureResponse : IHasResponseStatus - { - [DataMember] - public string Result { get; set; } - - [DataMember] - public ResponseStatus ResponseStatus { get; set; } - } - - public class InsecureService : IService - { - public object Any(Insecure request) - { - return new InsecureResponse { Result = "Public" }; - } - } - - [TestFixture] - public abstract class RequestFiltersTests - { - private const string ListeningOn = "http://localhost:82/"; - private const string ServiceClientBaseUri = "http://localhost:82/"; - - private const string AllowedUser = "user"; - private const string AllowedPass = "p@55word"; - - public class RequestFiltersAppHostHttpListener - : AppHostHttpListenerBase - { - private Guid currentSessionGuid; - - public RequestFiltersAppHostHttpListener() - : base("Request Filters Tests", typeof(GetFactorialService).Assembly) { } - - public override void Configure(Container container) - { - this.GlobalRequestFilters.Add((req, res, dto) => - { - var userPass = req.GetBasicAuthUserAndPassword(); - if (userPass == null) - { - return; - } - - var userName = userPass.Value.Key; - if (userName == AllowedUser && userPass.Value.Value == AllowedPass) - { - currentSessionGuid = Guid.NewGuid(); - var sessionKey = userName + "/" + currentSessionGuid.ToString("N"); - - //set session for this request (as no cookies will be set on this request) - req.Items["ss-session"] = sessionKey; - res.SetPermanentCookie("ss-session", sessionKey); - } - }); - this.GlobalRequestFilters.Add((req, res, dto) => - { - if (dto is Secure) - { - var sessionId = req.GetItemOrCookie("ss-session") ?? string.Empty; - var sessionIdParts = sessionId.SplitOnFirst('/'); - if (sessionIdParts.Length < 2 || sessionIdParts[0] != AllowedUser || sessionIdParts[1] != currentSessionGuid.ToString("N")) - { - res.ReturnAuthRequired(); - } - } - }); - } - } - - RequestFiltersAppHostHttpListener appHost; - - [TestFixtureSetUp] - public void OnTestFixtureSetUp() - { - appHost = new RequestFiltersAppHostHttpListener(); - appHost.Init(); - appHost.Start(ListeningOn); - } - - [TestFixtureTearDown] - public void OnTestFixtureTearDown() - { - appHost.Dispose(); - } - - protected abstract IServiceClient CreateNewServiceClient(); - protected abstract IRestClientAsync CreateNewRestClientAsync(); - - protected virtual string GetFormat() - { - return null; - } - - private static void Assert401(IServiceClient client, WebServiceException ex) - { - if (client is Soap11ServiceClient || client is Soap12ServiceClient) - { - if (ex.StatusCode != 401) - { - Console.WriteLine("WARNING: SOAP clients returning 500 instead of 401"); - } - return; - } - - Console.WriteLine(ex); - Assert.That(ex.StatusCode, Is.EqualTo(401)); - } - - private static void FailOnAsyncError<T>(T response, Exception ex) - { - Assert.Fail(ex.Message); - } - - private static bool Assert401(Exception ex) - { - var webEx = (WebServiceException)ex; - Assert.That(webEx.StatusCode, Is.EqualTo(401)); - return true; - } - - [Test] - public void Can_login_with_Basic_auth_to_access_Secure_service() - { - var format = GetFormat(); - if (format == null) return; - - var req = (HttpWebRequest)WebRequest.Create( - string.Format("http://localhost:82/{0}/reply/Secure", format)); - - req.Headers[HttpHeaders.Authorization] - = "basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(AllowedUser + ":" + AllowedPass)); - - var dtoString = new StreamReader(req.GetResponse().GetResponseStream()).ReadToEnd(); - Assert.That(dtoString.Contains("Confidential")); - Console.WriteLine(dtoString); - } - - [Test] - public void Can_login_with_Basic_auth_to_access_Secure_service_using_ServiceClient() - { - var format = GetFormat(); - if (format == null) return; - - var client = CreateNewServiceClient(); - client.SetCredentials(AllowedUser, AllowedPass); - - var response = client.Send<SecureResponse>(new Secure()); - - Assert.That(response.Result, Is.EqualTo("Confidential")); - } - - [Test] + [DataContract] + [Route("/secure")] + public class Secure + { + [DataMember] + public string UserName { get; set; } + } + + [DataContract] + public class SecureResponse : IHasResponseStatus + { + [DataMember] + public string Result { get; set; } + + [DataMember] + public ResponseStatus ResponseStatus { get; set; } + } + + public class SecureService : IService + { + public object Any(Secure request) + { + return new SecureResponse { Result = "Confidential" }; + } + } + + [DataContract] + [Route("/insecure")] + public class Insecure + { + [DataMember] + public string UserName { get; set; } + } + + [DataContract] + public class InsecureResponse : IHasResponseStatus + { + [DataMember] + public string Result { get; set; } + + [DataMember] + public ResponseStatus ResponseStatus { get; set; } + } + + public class InsecureService : IService + { + public object Any(Insecure request) + { + return new InsecureResponse { Result = "Public" }; + } + } + + [DataContract(Namespace = HostConfig.DefaultWsdlNamespace)] + public class SoapDeserializationException : IReturn<SoapDeserializationExceptionResponse> { } + + [DataContract(Namespace = HostConfig.DefaultWsdlNamespace)] + public class SoapDeserializationExceptionResponse + { + [DataMember(EmitDefaultValue = false, IsRequired = true)] + public string RequiredProperty { get; set; } + + [DataMember] + public ResponseStatus ResponseStatus { get; set; } + } + + [DataContract(Namespace = HostConfig.DefaultWsdlNamespace)] + public class SoapFaultTest : IReturn<SoapFaultTestResponse> { } + + [DataContract(Namespace = HostConfig.DefaultWsdlNamespace)] + public class SoapFaultTestResponse + { + [DataMember] + public ResponseStatus ResponseStatus { get; set; } + } + + public class SoapServices : Service + { + public object Any(SoapDeserializationException request) + { + return new SoapDeserializationExceptionResponse(); + } + + public object Any(SoapFaultTest request) + { + throw new Exception("Test SOAP Fault"); + } + } + + public class ThrowsInFilterAttribute : RequestFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object requestDto) + { + var dto = (ThrowsInFilter)requestDto; + + var status = (HttpStatusCode)dto.StatusCode.GetValueOrDefault(400); + var errorMsg = dto.Message ?? nameof(ThrowsInFilter); + + if (dto.ExceptionType == nameof(HttpError)) + throw new HttpError(status, errorMsg); + + throw new Exception(errorMsg); + } + } + + public class ThrowsInFilter : IReturn<ThrowsInFilter> + { + public string ExceptionType { get; set; } + public string Message { get; set; } + public int? StatusCode { get; set; } + } + + [ThrowsInFilter] + public class ThrowsInFilterService : Service + { + public object Any(ThrowsInFilter request) => request; + } + + [TestFixture] + public abstract class RequestFiltersTests + { + private const string AllowedUser = "user"; + private const string AllowedPass = "p@55word"; + + public class RequestFiltersAppHostHttpListener + : AppHostHttpListenerBase + { + private Guid currentSessionGuid; + + public RequestFiltersAppHostHttpListener() + : base("Request Filters Tests", typeof(GetFactorialService).Assembly) { } + + public override void Configure(Container container) + { +#if !NETCORE + Plugins.Add(new SoapFormat()); +#endif + + this.GlobalRequestFilters.Add((req, res, dto) => + { + var userPass = req.GetBasicAuthUserAndPassword(); + if (userPass == null) + { + return; + } + + var userName = userPass.Value.Key; + if (userName == AllowedUser && userPass.Value.Value == AllowedPass) + { + currentSessionGuid = Guid.NewGuid(); + var sessionKey = userName + "/" + currentSessionGuid.ToString("N"); + + //set session for this request (as no cookies will be set on this request) + req.Items["ss-session"] = sessionKey; + res.SetPermanentCookie("ss-session", sessionKey); + } + }); + this.GlobalRequestFilters.Add((req, res, dto) => + { + if (dto is Secure) + { + var sessionId = req.GetItemOrCookie("ss-session") ?? string.Empty; + var sessionIdParts = sessionId.SplitOnFirst('/'); + if (sessionIdParts.Length < 2 || sessionIdParts[0] != AllowedUser || sessionIdParts[1] != currentSessionGuid.ToString("N")) + { + res.ReturnAuthRequired(); + } + } + if (dto is SoapDeserializationException) + { + req.Response.UseBufferedStream = true; + } + }); +#if !NETCORE + this.ServiceExceptionHandlers.Add((req, dto, ex) => + { + if (dto is SoapDeserializationException) + return new SoapDeserializationExceptionResponse { RequiredProperty = "ServiceExceptionHandlers" }; + + if (dto is SoapFaultTest) + { + if (req.GetItem(Keywords.SoapMessage) is System.ServiceModel.Channels.Message requestMsg) + { + var msgVersion = requestMsg.Version; + using (var response = System.Xml.XmlWriter.Create(req.Response.OutputStream)) + { + var message = System.ServiceModel.Channels.Message.CreateMessage( + msgVersion, new System.ServiceModel.FaultCode("Receiver"), ex.Message, null); + message.WriteMessage(response); + } + req.Response.End(); + } + } + + return null; + }); +#endif + } + } + + RequestFiltersAppHostHttpListener appHost; + + string ServiceClientBaseUri = Config.ListeningOn; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new RequestFiltersAppHostHttpListener(); + appHost.Init(); + appHost.Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + protected abstract IServiceClient CreateNewServiceClient(); + protected abstract IHttpRestClientAsync CreateNewRestClientAsync(); + + protected virtual string GetFormat() + { + return null; + } + + private static void Assert401(IServiceClient client, WebServiceException ex) + { +#if !NETCORE + if (client is Soap11ServiceClient || client is Soap12ServiceClient) + { + if (ex.StatusCode != 401) + { + Console.WriteLine("WARNING: SOAP clients returning 500 instead of 401"); + } + return; + } +#endif + Console.WriteLine(ex); + Assert.That(ex.StatusCode, Is.EqualTo(401)); + } + + private static void FailOnAsyncError<T>(T response, Exception ex) + { + Assert.Fail(ex.Message); + } + + private static bool Assert401(Exception ex) + { + var webEx = (WebServiceException)ex; + Assert.That(webEx.StatusCode, Is.EqualTo(401)); + return true; + } + + [Test] + public void Can_login_with_Basic_auth_to_access_Secure_service() + { + var format = GetFormat(); + if (format == null) return; + + var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri.CombineWith("{0}/reply/Secure".Fmt(format))); + + req.Headers[HttpHeaders.Authorization] + = "basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(AllowedUser + ":" + AllowedPass)); + + var dtoString = req.GetResponse().GetResponseStream().ReadToEnd(); + Assert.That(dtoString.Contains("Confidential")); + Console.WriteLine(dtoString); + } + + [Test] + public void Can_login_with_Basic_auth_to_access_Secure_service_using_ServiceClient() + { + var format = GetFormat(); + if (format == null) return; + + var client = CreateNewServiceClient(); + client.SetCredentials(AllowedUser, AllowedPass); + + var response = client.Send<SecureResponse>(new Secure()); + + Assert.That(response.Result, Is.EqualTo("Confidential")); + } + + [Test] public async Task Can_login_with_Basic_auth_to_access_Secure_service_using_RestClientAsync() - { - var format = GetFormat(); - if (format == null) return; + { + var format = GetFormat(); + if (format == null) return; - var client = CreateNewRestClientAsync(); - client.SetCredentials(AllowedUser, AllowedPass); + var client = CreateNewRestClientAsync(); + client.SetCredentials(AllowedUser, AllowedPass); - var response = await client.GetAsync<SecureResponse>(ServiceClientBaseUri + "secure"); + var response = await client.GetAsync<SecureResponse>(ServiceClientBaseUri + "secure"); - Assert.That(response.Result, Is.EqualTo("Confidential")); - } + Assert.That(response.Result, Is.EqualTo("Confidential")); + } - [Test] - public void Can_login_without_authorization_to_access_Insecure_service() - { - var format = GetFormat(); - if (format == null) return; + [Test] + public void Can_login_without_authorization_to_access_Insecure_service() + { + var format = GetFormat(); + if (format == null) return; - var req = (HttpWebRequest)WebRequest.Create( - string.Format("{0}{1}/reply/Insecure", ServiceClientBaseUri, format)); + var req = (HttpWebRequest)WebRequest.Create($"{ServiceClientBaseUri}{format}/reply/Insecure"); - req.Headers[HttpHeaders.Authorization] - = "basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(AllowedUser + ":" + AllowedPass)); + req.Headers[HttpHeaders.Authorization] + = "basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(AllowedUser + ":" + AllowedPass)); - var dtoString = new StreamReader(req.GetResponse().GetResponseStream()).ReadToEnd(); - Assert.That(dtoString.Contains("Public")); - Console.WriteLine(dtoString); - } + var dtoString = req.GetResponse().GetResponseStream().ReadToEnd(); + Assert.That(dtoString.Contains("Public")); + Console.WriteLine(dtoString); + } - [Test] - public void Can_login_without_authorization_to_access_Insecure_service_using_ServiceClient() - { - var format = GetFormat(); - if (format == null) return; + [Test] + public void Can_login_without_authorization_to_access_Insecure_service_using_ServiceClient() + { + var format = GetFormat(); + if (format == null) return; - var client = CreateNewServiceClient(); + var client = CreateNewServiceClient(); - var response = client.Send<InsecureResponse>(new Insecure()); + var response = client.Send<InsecureResponse>(new Insecure()); - Assert.That(response.Result, Is.EqualTo("Public")); - } + Assert.That(response.Result, Is.EqualTo("Public")); + } - [Test] + [Test] public async Task Can_login_without_authorization_to_access_Insecure_service_using_RestClientAsync() - { - var format = GetFormat(); - if (format == null) return; - - var client = CreateNewRestClientAsync(); - - var response = await client.GetAsync<InsecureResponse>(ServiceClientBaseUri + "insecure"); - - Assert.That(response.Result, Is.EqualTo("Public")); - } - - [Test] - public void Can_login_with_session_cookie_to_access_Secure_service() - { - var format = GetFormat(); - if (format == null) return; - - var req = (HttpWebRequest)WebRequest.Create( - string.Format("http://localhost:82/{0}/reply/Secure", format)); - - req.Headers[HttpHeaders.Authorization] - = "basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(AllowedUser + ":" + AllowedPass)); - - var res = (HttpWebResponse)req.GetResponse(); - var cookie = res.Cookies["ss-session"]; - if (cookie != null) - { - req = (HttpWebRequest)WebRequest.Create( - string.Format("http://localhost:82/{0}/reply/Secure", format)); - req.CookieContainer.Add(new Cookie("ss-session", cookie.Value)); - - var dtoString = new StreamReader(req.GetResponse().GetResponseStream()).ReadToEnd(); - Assert.That(dtoString.Contains("Confidential")); - Console.WriteLine(dtoString); - } - } - - [Test] - public void Get_401_When_accessing_Secure_using_fake_sessionid_cookie() - { - var format = GetFormat(); - if (format == null) return; - - var req = (HttpWebRequest)WebRequest.Create( - string.Format("http://localhost:82/{0}/reply/Secure", format)); - - req.CookieContainer = new CookieContainer(); - req.CookieContainer.Add(new Cookie("ss-session", AllowedUser + "/" + Guid.NewGuid().ToString("N"), "/", "localhost")); - - try - { - var res = req.GetResponse(); - } - catch (WebException x) - { - Assert.That(((HttpWebResponse)x.Response).StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized)); - } - } - - [Test] - public void Get_401_When_accessing_Secure_using_ServiceClient_without_Authorization() - { - var client = CreateNewServiceClient(); - - try - { - var response = client.Send<SecureResponse>(new Secure()); - Console.WriteLine(response.Dump()); - } - catch (WebServiceException ex) - { - Assert401(client, ex); - return; - } - Assert.Fail("Should throw WebServiceException.StatusCode == 401"); - } - - [Test] + { + var format = GetFormat(); + if (format == null) return; + + var client = CreateNewRestClientAsync(); + + var response = await client.GetAsync<InsecureResponse>(ServiceClientBaseUri + "insecure"); + + Assert.That(response.Result, Is.EqualTo("Public")); + } + + [Test] + public void Can_login_with_session_cookie_to_access_Secure_service() + { + var format = GetFormat(); + if (format == null) return; + + var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri.CombineWith("{0}/reply/Secure".Fmt(format))); + + req.Headers[HttpHeaders.Authorization] + = "basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(AllowedUser + ":" + AllowedPass)); + + var res = (HttpWebResponse)req.GetResponse(); + var cookie = res.Cookies["ss-session"]; + if (cookie != null) + { + req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri.CombineWith("{0}/reply/Secure".Fmt(format))); + req.CookieContainer.Add(new Uri(ServiceClientBaseUri), new Cookie("ss-session", cookie.Value)); + + var dtoString = req.GetResponse().GetResponseStream().ReadToEnd(); + Assert.That(dtoString.Contains("Confidential")); + Console.WriteLine(dtoString); + } + } + + [Test] + public void Get_401_When_accessing_Secure_using_fake_sessionid_cookie() + { + var format = GetFormat(); + if (format == null) return; + + var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri.CombineWith("{0}/reply/Secure".Fmt(format))); + + req.CookieContainer = new CookieContainer(); + req.CookieContainer.Add(new Uri("http://localhost"), new Cookie("ss-session", AllowedUser + "/" + Guid.NewGuid().ToString("N"), "/", "localhost")); + + try + { + var res = req.GetResponse(); + } + catch (WebException x) + { + Assert.That(((HttpWebResponse)x.Response).StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized)); + } + } + + [Test] + public void Get_401_When_accessing_Secure_using_ServiceClient_without_Authorization() + { + var client = CreateNewServiceClient(); + + try + { + var response = client.Send<SecureResponse>(new Secure()); + Console.WriteLine(response.Dump()); + } + catch (WebServiceException ex) + { + Assert401(client, ex); + return; + } + Assert.Fail("Should throw WebServiceException.StatusCode == 401"); + } + + [Test] + public async Task Does_populate_ResponseStatus_when_Exception_thrown_in_RequestFilter() + { + var client = CreateNewRestClientAsync(); + if (client == null) return; + + try + { + var response = await client.PostAsync(new ThrowsInFilter + { + StatusCode = 409, + ExceptionType = nameof(HttpError), + Message = "POST HttpError CONFLICT", + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(409)); + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo("Conflict")); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("POST HttpError CONFLICT")); + } + + try + { + var response = await client.PostAsync(new ThrowsInFilter + { + ExceptionType = nameof(Exception), + Message = "POST Generic Exception", + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(500)); + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo("Exception")); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("POST Generic Exception")); + } + } + + [Test] public async Task Get_401_When_accessing_Secure_using_RestClient_GET_without_Authorization() - { - var client = CreateNewRestClientAsync(); - if (client == null) return; + { + var client = CreateNewRestClientAsync(); + if (client == null) return; try { @@ -339,13 +475,13 @@ public async Task Get_401_When_accessing_Secure_using_RestClient_GET_without_Aut Assert401(webEx); Assert.That(webEx.ResponseDto, Is.Null); } - } + } - [Test] + [Test] public async Task Get_401_When_accessing_Secure_using_RestClient_DELETE_without_Authorization() - { - var client = CreateNewRestClientAsync(); - if (client == null) return; + { + var client = CreateNewRestClientAsync(); + if (client == null) return; try { @@ -357,13 +493,13 @@ public async Task Get_401_When_accessing_Secure_using_RestClient_DELETE_without_ Assert401(webEx); Assert.That(webEx.ResponseDto, Is.Null); } - } + } - [Test] + [Test] public async Task Get_401_When_accessing_Secure_using_RestClient_POST_without_Authorization() - { - var client = CreateNewRestClientAsync(); - if (client == null) return; + { + var client = CreateNewRestClientAsync(); + if (client == null) return; try { @@ -375,13 +511,13 @@ public async Task Get_401_When_accessing_Secure_using_RestClient_POST_without_Au Assert401(webEx); Assert.That(webEx.ResponseDto, Is.Null); } - } + } - [Test] + [Test] public async Task Get_401_When_accessing_Secure_using_RestClient_PUT_without_Authorization() - { - var client = CreateNewRestClientAsync(); - if (client == null) return; + { + var client = CreateNewRestClientAsync(); + if (client == null) return; try { @@ -393,110 +529,143 @@ public async Task Get_401_When_accessing_Secure_using_RestClient_PUT_without_Aut Assert401(webEx); Assert.That(webEx.ResponseDto, Is.Null); } - } + } - public class UnitTests : RequestFiltersTests - { - protected override IServiceClient CreateNewServiceClient() - { + public class UnitTests : RequestFiltersTests + { + protected override IServiceClient CreateNewServiceClient() + { return new DirectServiceClient(appHost.ServiceController); } - protected override IRestClientAsync CreateNewRestClientAsync() - { - return null; //TODO implement REST calls with DirectServiceClient (i.e. Unit Tests) - //EndpointHandlerBase.ServiceManager = new ServiceManager(true, typeof(SecureService).Assembly); - //return new DirectServiceClient(EndpointHandlerBase.ServiceManager); - } - } - - public class XmlIntegrationTests : RequestFiltersTests - { - protected override string GetFormat() - { - return "xml"; - } - - protected override IServiceClient CreateNewServiceClient() - { - return new XmlServiceClient(ServiceClientBaseUri); - } - - protected override IRestClientAsync CreateNewRestClientAsync() - { + protected override IHttpRestClientAsync CreateNewRestClientAsync() + { + return null; //TODO implement REST calls with DirectServiceClient (i.e. Unit Tests) + //EndpointHandlerBase.ServiceManager = new ServiceManager(true, typeof(SecureService).Assembly); + //return new DirectServiceClient(EndpointHandlerBase.ServiceManager); + } + } + + public class XmlIntegrationTests : RequestFiltersTests + { + protected override string GetFormat() + { + return "xml"; + } + + protected override IServiceClient CreateNewServiceClient() + { + return new XmlServiceClient(ServiceClientBaseUri); + } + + protected override IHttpRestClientAsync CreateNewRestClientAsync() + { return new XmlServiceClient(ServiceClientBaseUri); - } - } - - [TestFixture] - public class JsonIntegrationTests : RequestFiltersTests - { - protected override string GetFormat() - { - return "json"; - } - - protected override IServiceClient CreateNewServiceClient() - { - return new JsonServiceClient(ServiceClientBaseUri); - } - - protected override IRestClientAsync CreateNewRestClientAsync() - { + } + } + + [TestFixture] + public class JsonIntegrationTests : RequestFiltersTests + { + protected override string GetFormat() + { + return "json"; + } + + protected override IServiceClient CreateNewServiceClient() + { return new JsonServiceClient(ServiceClientBaseUri); - } - } - - [TestFixture] - public class JsvIntegrationTests : RequestFiltersTests - { - protected override string GetFormat() - { - return "jsv"; - } - - protected override IServiceClient CreateNewServiceClient() - { - return new JsvServiceClient(ServiceClientBaseUri); - } - - protected override IRestClientAsync CreateNewRestClientAsync() - { + } + + protected override IHttpRestClientAsync CreateNewRestClientAsync() + { + return new JsonServiceClient(ServiceClientBaseUri); + } + } + + [TestFixture] + public class JsvIntegrationTests : RequestFiltersTests + { + protected override string GetFormat() + { + return "jsv"; + } + + protected override IServiceClient CreateNewServiceClient() + { + return new JsvServiceClient(ServiceClientBaseUri); + } + + protected override IHttpRestClientAsync CreateNewRestClientAsync() + { return new JsvServiceClient(ServiceClientBaseUri); - } - } - -#if !IOS - - [TestFixture] - public class Soap11IntegrationTests : RequestFiltersTests - { - protected override IServiceClient CreateNewServiceClient() - { - return new Soap11ServiceClient(ServiceClientBaseUri); - } - - protected override IRestClientAsync CreateNewRestClientAsync() - { - return null; - } - } - - [TestFixture] - public class Soap12IntegrationTests : RequestFiltersTests - { - protected override IServiceClient CreateNewServiceClient() - { - return new Soap12ServiceClient(ServiceClientBaseUri); - } - - protected override IRestClientAsync CreateNewRestClientAsync() - { - return null; - } - } + } + } + +#if !NETCORE + + [TestFixture] + public class Soap11IntegrationTests : RequestFiltersTests + { + protected override IServiceClient CreateNewServiceClient() + { + return new Soap11ServiceClient(ServiceClientBaseUri); + } + + protected override IHttpRestClientAsync CreateNewRestClientAsync() + { + return null; + } + } + + [TestFixture] + public class Soap12IntegrationTests : RequestFiltersTests + { + protected override IServiceClient CreateNewServiceClient() + { + return new Soap12ServiceClient(ServiceClientBaseUri); + } + + protected override IHttpRestClientAsync CreateNewRestClientAsync() + { + return null; + } + + [Test] + public void Response_serialization_errors_does_call_ServiceExceptionHandlers() + { + var client = CreateNewServiceClient(); + var response = client.Send(new SoapDeserializationException()); + Assert.That(response.RequiredProperty, Is.EqualTo("ServiceExceptionHandlers")); + } + + [Test] + public void Does_return_Custom_SoapFault() + { + var responseSoap = ServiceClientBaseUri.CombineWith("/Soap12") + .SendStringToUrl(method: "POST", + requestBody: @"<s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" xmlns:a=""http://www.w3.org/2005/08/addressing""> + <s:Header> + <a:Action s:mustUnderstand=""1"">SoapFaultTest</a:Action> + <a:MessageID>urn:uuid:84d9f946-d3c3-4252-84ff-0b306ce53386</a:MessageID> + <a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address> + </a:ReplyTo> + <a:To s:mustUnderstand=""1"">http://localhost:20000/Soap12</a:To> + </s:Header> + <s:Body> + <SoapFaultTest xmlns=""http://schemas.servicestack.net/types"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""/> + </s:Body> + </s:Envelope>", + contentType: "application/soap+xml; charset=utf-8", + responseFilter: res => { }); + + Assert.That(responseSoap, Is.EqualTo( + @"<?xml version=""1.0"" encoding=""utf-8""?><s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope""><s:Body><s:Fault><s:Code><s:Value>s:Receiver</s:Value></s:Code><s:Reason><s:Text xml:lang=""en-US"">Test SOAP Fault</s:Text></s:Reason></s:Fault></s:Body></s:Envelope>")); + } + + } #endif - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestInfoTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestInfoTests.cs new file mode 100644 index 00000000000..64931c1c7a1 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestInfoTests.cs @@ -0,0 +1,152 @@ +using System.Net; +using System.Reflection; +using Funq; +using NUnit.Framework; +using ServiceStack.Api.OpenApi; +using ServiceStack.Host.Handlers; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class RequestInfoServices : Service {} + + public partial class RequestInfoTests + { + public string BaseUrl = Config.ListeningOn; + + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(RequestInfoTests), typeof(RequestInfoServices).Assembly) {} + + public override void Configure(Container container) + { +#if NETCORE + var useProjectPath = MapProjectPath("~/"); // .NET Core accurately reports the ContentPath from where it's run +#else + var useProjectPath = MapProjectPath("~/../"); +#endif + + var parentDir = useProjectPath.Replace("\\", "/").TrimEnd('/').LastRightPart('/'); + Assert.That(parentDir, Is.EqualTo("ServiceStack.WebHost.Endpoints.Tests")); + + SetConfig(new HostConfig + { + DebugMode = true, + WebHostPhysicalPath = useProjectPath + }); + + Plugins.Add(new OpenApiFeature()); + } + } + + private readonly ServiceStackHost appHost; + + public RequestInfoTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + private RequestInfoResponse GetRequestInfoForPath(string path) + { + var url = BaseUrl.CombineWith(path).AddQueryParam("debug", "requestinfo"); + var json = url.GetJsonFromUrl(); + var info = json.FromJson<RequestInfoResponse>(); + return info; + } + + private void AssertHasContent(string pathInfo, string accept, string containsContent) + { + var url = BaseUrl.CombineWith(pathInfo); + var content = url.GetStringFromUrl(accept: accept); + Assert.That(content, Does.Contain(containsContent)); + } + + [Test] + public void Does_return_expected_content() + { + AssertHasContent("metadata", MimeTypes.Html, "The following operations are supported"); + AssertHasContent("metadata/", MimeTypes.Html, "The following operations are supported"); + AssertHasContent("dir", MimeTypes.Html, "<h1>dir/index.html</h1>"); + AssertHasContent("dir/", MimeTypes.Html, "<h1>dir/index.html</h1>"); + AssertHasContent("dir/sub", MimeTypes.Html, "<h1>dir/sub/index.html</h1>"); + AssertHasContent("dir/sub/", MimeTypes.Html, "<h1>dir/sub/index.html</h1>"); + AssertHasContent("swagger-ui", MimeTypes.Html, "<title>Swagger UI</title>"); + AssertHasContent("swagger-ui/", MimeTypes.Html, "<title>Swagger UI</title>"); + } + + [Test] + public void Does_have_correct_path_info() + { + Assert.That(GetRequestInfoForPath("dir/").PathInfo, Is.EqualTo("/dir/")); + Assert.That(GetRequestInfoForPath("dir/sub/").PathInfo, Is.EqualTo("/dir/sub/")); + Assert.That(GetRequestInfoForPath("dir/sub/").PathInfo, Is.EqualTo("/dir/sub/")); + Assert.That(GetRequestInfoForPath("swagger-ui/").PathInfo, Is.EqualTo("/swagger-ui/")); + } + + [Test] + public void Does_return_expected_request_info() + { + var info = GetRequestInfoForPath("metadata"); + + info.PrintDump(); + + Assert.That(info.ServiceName, Is.EqualTo(nameof(RequestInfoTests))); + Assert.That(info.HttpMethod, Is.EqualTo("GET")); + Assert.That(info.PathInfo, Is.EqualTo("/metadata")); + Assert.That(info.RawUrl, Is.EqualTo("/metadata?debug=requestinfo")); + Assert.That(info.AbsoluteUri, Is.EqualTo("http://localhost:20000/metadata?debug=requestinfo")); + } + } + +#if NET45 + public partial class RequestInfoTests + { + private void DoesRedirectToRemoveTrailingSlash(string dirWIthoutSlash) + { + BaseUrl.CombineWith(dirWIthoutSlash) + .GetStringFromUrl(accept: MimeTypes.Html, + requestFilter: req => req.AllowAutoRedirect = false, + responseFilter: res => + { + Assert.That(res.StatusCode, Is.EqualTo(HttpStatusCode.Redirect)); + Assert.That(res.Headers[HttpHeaders.Location], + Is.EqualTo(BaseUrl.CombineWith(dirWIthoutSlash + "/"))); + }); + } + + private void DoesRedirectToAddTrailingSlash(string dirWithoutSlash) + { + BaseUrl.CombineWith(dirWithoutSlash) + .GetStringFromUrl(accept: MimeTypes.Html, + requestFilter: req => req.AllowAutoRedirect = false, + responseFilter: res => + { + Assert.That(res.StatusCode, Is.EqualTo(HttpStatusCode.Redirect)); + Assert.That(res.Headers[HttpHeaders.Location], + Is.EqualTo(BaseUrl.CombineWith(dirWithoutSlash.TrimEnd('/')))); + }); + } + + [Test] + public void Does_redirect_dirs_without_trailing_slash() + { + DoesRedirectToRemoveTrailingSlash("dir"); + DoesRedirectToRemoveTrailingSlash("dir/sub"); + DoesRedirectToRemoveTrailingSlash("swagger-ui"); + } + + [Test] + public void Does_redirect_metadata_page_to_without_slash() + { + DoesRedirectToAddTrailingSlash("metadata/"); + } + } +#endif + + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestLogsFeatureTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestLogsFeatureTests.cs new file mode 100644 index 00000000000..c5e89fd2ac1 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestLogsFeatureTests.cs @@ -0,0 +1,208 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Funq; +using NUnit.Framework; +using ServiceStack.Admin; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Route("/requestlogs-test")] + public class RequestLogsTest : IReturn<RequestLogsTest> + { + public string Name { get; set; } + } + + [Route("/requestlogs-error-test")] + public class RequestLogsErrorTest : IReturn<RequestLogsErrorTest> + { + public string Message { get; set; } + } + + class MyServices : Service + { + public object Any(RequestLogsTest request) => request; + + public object Any(RequestLogsErrorTest request) => + throw new Exception("Error: " + request.Message); + } + + public class RequestLogsFeatureTests + { + private readonly ServiceStackHost appHost; + + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(RequestLogsFeatureTests), typeof(MyServices).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + DebugMode = true + }); + + Plugins.Add(new RequestLogsFeature + { + LimitToServiceRequests = false + }); + + Plugins.Add(new CorsFeature()); + } + } + + public RequestLogsFeatureTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Does_log_Service_request() + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestFilter = req => req.Referer = Config.ListeningOn + }; + + var response = client.Get(new RequestLogsTest { Name = "foo1" }); + + var json = Config.ListeningOn.CombineWith("requestlogs").GetJsonFromUrl(); + var requestLogs = json.FromJson<RequestLogsResponse>(); + var requestLog = requestLogs.Results.First(); + var request = (RequestLogsTest)requestLog.RequestDto; + Assert.That(request.Name, Is.EqualTo("foo1")); + Assert.That(requestLog.Referer, Is.EqualTo(Config.ListeningOn)); + } + + [Test] + public void Does_log_autobatch_request() + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestFilter = req => req.Referer = Config.ListeningOn + }; + + var request = new[] + { + new RequestLogsTest { Name = "foo1" }, + new RequestLogsTest { Name = "bar1" } + }; + var response = client.SendAll(request); + + var json = Config.ListeningOn.CombineWith("requestlogs").GetJsonFromUrl(); + var requestLogs = json.FromJson<RequestLogsResponse>(); + var requestLog = requestLogs.Results.First(); + + var loggedRequests = requestLog.RequestDto.ConvertTo<List<RequestLogsTest>>(); + + Assert.That(request is IEnumerable<RequestLogsTest>); + Assert.That(loggedRequests is IEnumerable<RequestLogsTest>); + + Assert.That(loggedRequests.First().Name, Is.EqualTo("foo1")); + Assert.That(loggedRequests.Last().Name, Is.EqualTo("bar1")); + + Assert.That(requestLog.Referer, Is.EqualTo(Config.ListeningOn)); + } + + [Test] + public void Does_log_Error_request() + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestFilter = req => req.Referer = Config.ListeningOn + }; + + try + { + var response = client.Get(new RequestLogsErrorTest { Message = "foo2" }); + } + catch (WebServiceException ex) + { + Assert.That(ex.Message, Is.EqualTo("Error: foo2")); + var json = Config.ListeningOn.CombineWith("requestlogs").GetJsonFromUrl(); + var requestLogs = json.FromJson<RequestLogsResponse>(); + var requestLog = requestLogs.Results.First(); + var request = (RequestLogsErrorTest)requestLog.RequestDto; + Assert.That(request.Message, Is.EqualTo("foo2")); + Assert.That(requestLog.Referer, Is.EqualTo(Config.ListeningOn)); + } + } + + [Test] + public void Does_log_Options_request() + { + var response = Config.ListeningOn.CombineWith("requestlogs-test") + .AddQueryParam("name", "foo3") + .OptionsFromUrl(requestFilter: req => req.Referer = Config.ListeningOn); + + var json = Config.ListeningOn.CombineWith("requestlogs").GetJsonFromUrl(); + var requestLogs = json.FromJson<RequestLogsResponse>(); + var requestLog = requestLogs.Results.First(); + Assert.That(requestLog.HttpMethod, Is.EqualTo("OPTIONS")); + Assert.That(requestLog.Referer, Is.EqualTo(Config.ListeningOn)); + } + + [Test] + public void Does_log_error_response() + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestFilter = req => req.Referer = Config.ListeningOn + }; + + try + { + var response = client.Get(new RequestLogsErrorTest { Message = "foo2" }); + } + catch (WebServiceException ex) + { + Assert.That(ex.Message, Is.EqualTo("Error: foo2")); + var json = Config.ListeningOn.CombineWith("requestlogs").GetJsonFromUrl(); + var requestLogs = json.FromJson<RequestLogsResponse>(); + var requestLog = requestLogs.Results.First(); + var request = (RequestLogsErrorTest)requestLog.RequestDto; + Assert.That(requestLog.ErrorResponse != null); + Assert.That(requestLog.ErrorResponse is ErrorResponse); + var responseStatus = requestLog.ErrorResponse.GetResponseStatus(); + Assert.That(responseStatus.Message == "Error: foo2"); + } + } + + [Test] + public void Does_log_autobatch_error_response() + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestFilter = req => req.Referer = Config.ListeningOn + }; + + var request = new[] + { + new RequestLogsErrorTest { Message = "foo1" }, + new RequestLogsErrorTest { Message = "bar1" } + }; + + try + { + var response = client.SendAll(request); + } + catch (WebServiceException ex) + { + + var json = Config.ListeningOn.CombineWith("requestlogs").GetJsonFromUrl(); + var requestLogs = json.FromJson<RequestLogsResponse>(); + var requestLog = requestLogs.Results.First(); + + Assert.That(requestLog.ErrorResponse != null); + Assert.That(requestLog.ErrorResponse is ErrorResponse); + var responseStatus = requestLog.ErrorResponse.GetResponseStatus(); + Assert.That(responseStatus.Message == "Error: foo1"); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestPipelineTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestPipelineTests.cs index 1871dac7add..08ff58e0770 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestPipelineTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestPipelineTests.cs @@ -185,7 +185,7 @@ public class RequestPipelineTests { private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new RequestPipelineAppHost() @@ -193,7 +193,7 @@ public void TestFixtureSetUp() .Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestTypedFilterTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestTypedFilterTests.cs index 67c825b021b..adbfe64619d 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RequestTypedFilterTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RequestTypedFilterTests.cs @@ -94,7 +94,7 @@ public override void Configure(Container container) ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new TypedFilterAppHost() @@ -102,7 +102,7 @@ public void OnTestFixtureSetUp() .Start(Config.ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RestHandlerTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RestHandlerTests.cs index c906ca617c4..8bb65c5df9d 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RestHandlerTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RestHandlerTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using Moq; +using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.Host; using ServiceStack.Web; @@ -14,74 +14,56 @@ public class RestHandlerTests { ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new TestAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); } [Test] - public void Throws_binding_exception_when_unable_to_match_path_values() + public async Task Throws_binding_exception_when_unable_to_match_path_values() { var path = "/request/{will_not_match_property_id}/pathh"; var request = ConfigureRequest(path); - var response = new Mock<IHttpResponse>().Object; + var response = request.Response; var handler = new RestHandler { RestPath = new RestPath(typeof(RequestType), path) }; - try - { - handler.ProcessRequestAsync(request, response, string.Empty).Wait(); - Assert.Fail("Should throw RequestBindingException"); - } - catch (AggregateException aex) - { - Assert.That(aex.InnerExceptions.Count, Is.EqualTo(1)); - Assert.That(aex.InnerException is RequestBindingException); - } + await handler.ProcessRequestAsync(request, response, string.Empty); + Assert.That(response.StatusCode, Is.EqualTo(400)); } [Test] - public void Throws_binding_exception_when_unable_to_bind_request() + public async Task Throws_binding_exception_when_unable_to_bind_request() { var path = "/request/{id}/path"; var request = ConfigureRequest(path); - var response = new Mock<IHttpResponse>().Object; + var response = request.Response; var handler = new RestHandler { RestPath = new RestPath(typeof(RequestType), path) }; - try - { - handler.ProcessRequestAsync(request, response, string.Empty).Wait(); - Assert.Fail("Should throw RequestBindingException"); - } - catch (AggregateException aex) - { - Assert.That(aex.InnerExceptions.Count, Is.EqualTo(1)); - Assert.That(aex.InnerException is RequestBindingException); - } - } + await handler.ProcessRequestAsync(request, response, string.Empty); + Assert.That(response.StatusCode, Is.EqualTo(400)); + } private IHttpRequest ConfigureRequest(string path) { - var request = new Mock<IHttpRequest>(); - request.Expect(x => x.Items).Returns(new Dictionary<string, object>()); - request.Expect(x => x.QueryString).Returns(PclExportClient.Instance.NewNameValueCollection()); - request.Expect(x => x.PathInfo).Returns(path); - - return request.Object; + var request = new BasicHttpRequest { + PathInfo = path + }; + return request; } public class RequestType diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RouteInferenceTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RouteInferenceTests.cs index b79b1b4227e..97bfb92a5b2 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RouteInferenceTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RouteInferenceTests.cs @@ -15,7 +15,7 @@ public class RouteInferenceTests { ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void InferRoutes() { appHost = new BasicAppHost().Init(); @@ -25,7 +25,7 @@ public void InferRoutes() appHost.Routes.AddFromAssembly(typeof(RouteInferenceTests).Assembly); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RouteMatchTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RouteMatchTests.cs new file mode 100644 index 00000000000..9634b7fa0db --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RouteMatchTests.cs @@ -0,0 +1,393 @@ +using System.Net; +using Funq; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Route("/matches/html", Matches = "AcceptsHtml")] + public class MatchesHtml : IReturn<MatchesHtml> + { + public string Name { get; set; } + } + + [Route("/matches/json", Matches = "AcceptsJson")] + public class MatchesJson : IReturn<MatchesJson> + { + public string Name { get; set; } + } + + public class MatchesCsv : IReturn<MatchesCsv> + { + public string Name { get; set; } + } + + [Route("/{SlugFirst}/matchrule")] + public class MatchesNotFirstInt + { + public string SlugFirst { get; set; } + } + + [Route("/{IdFirst}/matchrule", Matches = @"{int}/**")] + public class MatchesFirstInt + { + public int IdFirst { get; set; } + } + + [Route("/matchrule/{SlugLast}")] + public class MatchesNotLastInt + { + public string SlugLast { get; set; } + } + + [Route("/matchrule/{IdLast}", Matches = @"**/{int}")] + public class MatchesLastInt + { + public int IdLast { get; set; } + } + + [Route("/matchrule/{Slug2}/remaining/path")] + public class MatchesSecondSlug + { + public string Slug2 { get; set; } + } + + [Route("/matchrule/{Id2}/remaining/path", Matches = @"path/{int}/**")] + public class MatchesSecondInt + { + public int Id2 { get; set; } + } + + [Route("/remaining/path/{Slug2}/matchrule")] + public class MatchesSecondLastSlug + { + public string Slug2 { get; set; } + } + + [Route("/remaining/path/{Id2}/matchrule", Matches = @"**/{int}/path")] + public class MatchesSecondLastInt + { + public int Id2 { get; set; } + } + + [Route("/matchregex/{Slug}")] + public class MatchesSlug + { + public string Slug { get; set; } + } + + [Route("/matchregex/{Id}", Matches = @"PathInfo =~ \/[0-9]+$")] + public class MatchesInt + { + public int Id { get; set; } + } + + [Route("/matchexact/{Exact}", Matches = @"UserAgent = specific-client")] + public class MatchesExactUserAgent + { + public string Exact { get; set; } + } + + [Route("/matchexact/{Any}")] + public class MatchesAnyUserAgent + { + public string Any { get; set; } + } + + [Route("/matchsite/{Mobile}", Matches = "IsMobile")] + public class MatchMobileSite + { + public string Mobile { get; set; } + } + + [Route("/matchsite/{Desktop}")] + public class MatchDesktopSite + { + public string Desktop { get; set; } + } + + [Route("/matchauth/{Authenticated}", Matches = "IsAuthenticated")] + public class MatchAuthenticated + { + public string Authenticated { get; set; } + } + + [Route("/matchauth/{Unauthenticated}")] + public class MatchUnauthenticated + { + public string Unauthenticated { get; set; } + } + + public class RouteMatchService : Service + { + public object Any(MatchesHtml request) => request; + public object Any(MatchesJson request) => request; + public object Any(MatchesCsv request) => request; + + public object Any(MatchesNotFirstInt request) => request; + public object Any(MatchesFirstInt request) => request; + + public object Any(MatchesNotLastInt request) => request; + public object Any(MatchesLastInt request) => request; + + public object Any(MatchesSecondSlug request) => request; + public object Any(MatchesSecondInt request) => request; + + public object Any(MatchesSecondLastSlug request) => request; + public object Any(MatchesSecondLastInt request) => request; + + public object Any(MatchesSlug request) => request; + public object Any(MatchesInt request) => request; + + public object Any(MatchesExactUserAgent request) => request; + public object Any(MatchesAnyUserAgent request) => request; + + public object Any(MatchMobileSite request) => request; + public object Any(MatchDesktopSite request) => request; + + public object Any(MatchAuthenticated request) => request; + public object Any(MatchUnauthenticated request) => request; + } + + public class RouteMatchTests + { + private readonly ServiceStackHost appHost; + public IServiceClient CreateClient() => new JsonServiceClient(Config.ListeningOn); + + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(RouteMatchTests), typeof(RouteMatchService).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + RequestRules = + { + { "CustomAcceptsCsv", httpReq => httpReq.Accept?.IndexOf(MimeTypes.Csv) >= 0 }, + }, + AdminAuthSecret = "secretz" + }); + + Routes.Add(typeof(MatchesCsv), "/matches/csv", null, null, null, matches:"CustomAcceptsCsv"); + } + } + + public RouteMatchTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Does_match_builtin_RequestRules_JSON() + { + var client = CreateClient(); + + var response = client.Get(new MatchesJson { Name = "JSON" }); + Assert.That(response.Name, Is.EqualTo("JSON")); + + try + { + var html = Config.ListeningOn.AppendPath("matches/json").AddQueryParam("name", "JSON") + .GetStringFromUrl(accept: MimeTypes.Html); + Assert.Fail("Should throw"); + } + catch (WebException ex) + { + Assert.That(ex.ToStatusCode(), Is.EqualTo(404)); + } + } + + [Test] + public void Does_match_builtin_RequestRules_HTML() + { + var client = CreateClient(); + + var html = Config.ListeningOn.AppendPath("matches/html").AddQueryParam("name", "HTML") + .GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html, Does.StartWith("<")); + + try + { + var response = client.Get(new MatchesHtml { Name = "HTML" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(404)); + } + } + + [Test] + public void Does_match_new_RequestRules_CSV() + { + var client = CreateClient(); + + var csv = Config.ListeningOn.AppendPath("matches/csv").AddQueryParam("name", "CSV") + .GetStringFromUrl(accept: MimeTypes.Csv); + Assert.That(csv.NormalizeNewLines(), Is.EqualTo("Name\nCSV")); + + try + { + var response = client.Get(new MatchesCsv { Name = "CSV" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(404)); + } + } + + [Test] + public void Can_match_on_builtin_FirstInt() + { + var json = Config.ListeningOn.AppendPath("1/matchrule") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"idfirst\":1}")); + } + + [Test] + public void Can_match_on_builtin_NotFirstInt() + { + var json = Config.ListeningOn.AppendPath("name/matchrule") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"slugfirst\":\"name\"}")); + } + + [Test] + public void Can_match_on_builtin_LastInt() + { + var json = Config.ListeningOn.AppendPath("matchrule/1") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"idlast\":1}")); + } + + [Test] + public void Can_match_on_builtin_NotLastInt() + { + var json = Config.ListeningOn.AppendPath("matchrule/name") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"sluglast\":\"name\"}")); + } + + [Test] + public void Can_match_on_builtin_Second_Int() + { + var json = Config.ListeningOn.AppendPath("matchrule/1/remaining/path") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"id2\":1}")); + } + + [Test] + public void Can_match_on_builtin_Second_NotInt() + { + var json = Config.ListeningOn.AppendPath("matchrule/name/remaining/path") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"slug2\":\"name\"}")); + } + + [Test] + public void Can_match_on_builtin_SecondLast_Int() + { + var json = Config.ListeningOn.AppendPath("/remaining/path/1/matchrule") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"id2\":1}")); + } + + [Test] + public void Can_match_on_builtin_SecondLast_NotInt() + { + var json = Config.ListeningOn.AppendPath("/remaining/path/name/matchrule") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"slug2\":\"name\"}")); + } + + [Test] + public void Can_match_on_regex_int_id() + { + var json = Config.ListeningOn.AppendPath("matchregex/1") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"id\":1}")); + } + + [Test] + public void Can_match_on_regex_slug() + { + var json = Config.ListeningOn.AppendPath("matchregex/name") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"slug\":\"name\"}")); + } + + [Test] + public void Can_match_on_exact_UserAgent() + { + var json = Config.ListeningOn.AppendPath("matchexact/specific-client") + .GetJsonFromUrl(req => req.UserAgent = "specific-client"); + + Assert.That(json.ToLower(), Is.EqualTo("{\"exact\":\"specific-client\"}")); + } + + [Test] + public void Can_match_on_any_UserAgent() + { + var json = Config.ListeningOn.AppendPath("matchexact/any-client") + .GetJsonFromUrl(req => req.UserAgent = "any-client"); + + Assert.That(json.ToLower(), Is.EqualTo("{\"any\":\"any-client\"}")); + } + + [Test] + public void Does_match_builtin_IsMobile_Rule_with_iPhone6UA() + { + const string iPhone6UA = "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25"; + var json = Config.ListeningOn.AppendPath("matchsite/iPhone6") + .GetJsonFromUrl(req => req.UserAgent = iPhone6UA); + + Assert.That(json.ToLower(), Is.EqualTo("{\"mobile\":\"iphone6\"}")); + } + + [Test] + public void Does_not_match_builtin_IsMobile_Rule_with_SafariUA() + { + const string SafariUA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7"; + var json = Config.ListeningOn.AppendPath("matchsite/Safari") + .GetJsonFromUrl(req => req.UserAgent = SafariUA); + + Assert.That(json.ToLower(), Is.EqualTo("{\"desktop\":\"safari\"}")); + } + + [Test] + public void Can_match_on_IsAuthenticated_using_AuthSecret() + { + var json = Config.ListeningOn.AppendPath("matchauth/secure") + .AddQueryParam("authsecret","secretz") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"authenticated\":\"secure\"}")); + } + + [Test] + public void Does_not_match_on_IsAuthenticated_when_not_authenticated() + { + var json = Config.ListeningOn.AppendPath("matchauth/public") + .GetJsonFromUrl(); + + Assert.That(json.ToLower(), Is.EqualTo("{\"unauthenticated\":\"public\"}")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RoutePriorityTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RoutePriorityTests.cs index b3ec7b73785..5431b0d466c 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RoutePriorityTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RoutePriorityTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RouteTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RouteTests.cs index cfa09da98b7..08d70a8a839 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RouteTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RouteTests.cs @@ -1,8 +1,14 @@ -using System.Net; +using System; +using System.Net; +using System.Runtime.Serialization; +using System.Threading.Tasks; using Funq; using NUnit.Framework; using ServiceStack.Formats; +using ServiceStack.Host; +using ServiceStack.Host.Handlers; using ServiceStack.Text; +using ServiceStack.WebHost.Endpoints.Tests.Support.Services; namespace ServiceStack.WebHost.Endpoints.Tests { @@ -11,7 +17,7 @@ public class RouteTests { private RouteAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new RouteAppHost(); @@ -19,7 +25,7 @@ public void TestFixtureSetUp() appHost.Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -31,11 +37,38 @@ public void Can_download_original_route() var response = Config.AbsoluteBaseUri.CombineWith("/custom/foo") .GetStringFromUrl(responseFilter: httpRes => { - httpRes.ContentType.Print(); Assert.That(httpRes.ContentType.MatchesContentType(MimeTypes.Html)); }); - Assert.That(response, Is.StringStarting("<!doctype html>")); + Assert.That(response, Does.StartWith("<!doctype html>")); + } + + [Test] + public void Can_download_original_route_with_Accept_json() + { + var response = Config.AbsoluteBaseUri.CombineWith("/custom/foo") + .GetStringFromUrl( + requestFilter: req => req.Accept = MimeTypes.Json, + responseFilter: httpRes => + { + Assert.That(httpRes.ContentType.MatchesContentType(MimeTypes.Json)); + }); + + Assert.That(response.ToLower(), Is.EqualTo("{\"data\":\"foo\"}")); + } + + [Test] + public void Can_download_original_route_with_trailing_slash_and_Accept_json() + { + var response = Config.AbsoluteBaseUri.CombineWith("/custom/foo/") + .GetStringFromUrl( + requestFilter: req => req.Accept = MimeTypes.Json, + responseFilter: httpRes => + { + Assert.That(httpRes.ContentType.MatchesContentType(MimeTypes.Json)); + }); + + Assert.That(response.ToLower(), Is.EqualTo("{\"data\":\"foo\"}")); } [Test] @@ -44,11 +77,24 @@ public void Can_download_original_route_with_json_extension() var response = Config.AbsoluteBaseUri.CombineWith("/custom/foo.json") .GetStringFromUrl(responseFilter: httpRes => { - httpRes.ContentType.Print(); Assert.That(httpRes.ContentType.MatchesContentType(MimeTypes.Json)); }); - Assert.That(response.ToLower(), Is.EqualTo( "{\"data\":\"foo\"}")); + Assert.That(response.ToLower(), Is.EqualTo("{\"data\":\"foo\"}")); + } + + [Test] + public void Can_process_plaintext_as_JSON() + { + var response = Config.AbsoluteBaseUri.CombineWith("/custom") + .PostStringToUrl("{\"data\":\"foo\"}", + contentType:MimeTypes.PlainText, + responseFilter: httpRes => + { + Assert.That(httpRes.ContentType.MatchesContentType(MimeTypes.Json)); + }); + + Assert.That(response.ToLower(), Is.EqualTo("{\"data\":\"foo\"}")); } [Test] @@ -57,7 +103,6 @@ public void Can_download_original_route_with_xml_extension() var response = Config.AbsoluteBaseUri.CombineWith("/custom/foo.xml") .GetStringFromUrl(responseFilter: httpRes => { - httpRes.ContentType.Print(); Assert.That(httpRes.ContentType.MatchesContentType(MimeTypes.Xml)); }); @@ -70,11 +115,10 @@ public void Can_download_original_route_with_html_extension() var response = Config.AbsoluteBaseUri.CombineWith("/custom/foo.html") .GetStringFromUrl(responseFilter: httpRes => { - httpRes.ContentType.Print(); Assert.That(httpRes.ContentType.MatchesContentType(MimeTypes.Html)); }); - Assert.That(response, Is.StringStarting("<!doctype html>")); + Assert.That(response, Does.StartWith("<!doctype html>")); } [Test] @@ -83,12 +127,186 @@ public void Can_download_original_route_with_csv_extension() var response = Config.AbsoluteBaseUri.CombineWith("/custom/foo.csv") .GetStringFromUrl(responseFilter: httpRes => { - httpRes.ContentType.Print(); Assert.That(httpRes.ContentType.MatchesContentType(MimeTypes.Csv)); }); + + Assert.That(response, Is.EqualTo("Data\r\nfoo\r\n")); + } + + [Test] + public void Does_encode_route_with_backslash() + { + var request = new CustomRoute { Data = "D\\SN" }; + Assert.That(request.ToUrl(), Is.EqualTo("/custom/D%5CSN")); + Assert.That(request.ToUrl().UrlDecode(), Is.EqualTo("/custom/D\\SN")); + + //HttpListener and ASP.NET hosts doesn't support `\` or %5C in urls + //var client = new JsonServiceClient(Config.AbsoluteBaseUri); + //var response = client.Get(request); + //Assert.That(response.Data, Is.EqualTo("D\\SN")); + } + + [Test] + public void Does_encode_QueryString() + { + var msg = "Field with comma, to demonstrate. "; + var response = Config.AbsoluteBaseUri.CombineWith("/custom") + .PostToUrl(new CustomRoute { Data = msg }, + requestFilter:req => req.Accept = MimeTypes.Json); + + response.Print(); + + var dto = response.FromJson<CustomRoute>(); + Assert.That(dto.Data, Is.EqualTo(msg)); + + response = Config.AbsoluteBaseUri.CombineWith("/custom") + .PostToUrl(new CustomRoute { Data = msg }.ToStringDictionary(), + requestFilter:req => req.Accept = MimeTypes.Json); + + response.Print(); + + dto = response.FromJson<CustomRoute>(); + Assert.That(dto.Data, Is.EqualTo(msg)); + } + + [Test] + public void Can_download_route_with_dot_seperator() + { + var response = Config.AbsoluteBaseUri.CombineWith("/customdot/id.data") + .GetJsonFromUrl() + .FromJson<CustomRouteDot>(); + + Assert.That(response.Id, Is.EqualTo("id")); + Assert.That(response.Data, Is.EqualTo("data")); + } + + [Test] + public void Can_download_route_with_dot_seperator_and_extension() + { + var response = Config.AbsoluteBaseUri.CombineWith("/pics/100x100/1.png") + .GetJsonFromUrl() + .FromJson<GetPngPic>(); + + Assert.That(response.Size, Is.EqualTo("100x100")); + Assert.That(response.Id, Is.EqualTo("1")); + } + + [Test] + public void Can_download_route_with_dot_seperator_and_extension_with_jsonserviceclient() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + var request = new GetPngPic { + Id = "1", + Size = "100x100", + }; + + Assert.That(request.ToGetUrl(), Is.EqualTo("/pics/100x100/1.png")); + + var response = client.Get<GetPngPic>(request); + + Assert.That(response.Size, Is.EqualTo("100x100")); + Assert.That(response.Id, Is.EqualTo("1")); + } + + [Test] + public void Does_populate_version_when_using_Version_Abbreviation() + { + var response = Config.AbsoluteBaseUri.CombineWith("/versioned-request?v=1") + .GetJsonFromUrl() + .FromJson<RequestWithVersion>(); + + Assert.That(response.Version, Is.EqualTo(1)); + + response = Config.AbsoluteBaseUri.CombineWith("/versioned-request/1?v=2") + .GetJsonFromUrl() + .FromJson<RequestWithVersion>(); + + Assert.That(response.Version, Is.EqualTo(2)); + + response = Config.AbsoluteBaseUri.CombineWith("/versioned-request/1?v=4&Version=3") + .GetJsonFromUrl() + .FromJson<RequestWithVersion>(); + + Assert.That(response.Version, Is.EqualTo(3)); + } + + [Test] + public async Task Does_send_version_using_JsonServiceClient() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + var response = client.Send(new RequestWithVersion { Version = 1 }); + Assert.That(response.Version, Is.EqualTo(1)); + + response = await client.SendAsync(new RequestWithVersion { Version = 1 }); + Assert.That(response.Version, Is.EqualTo(1)); - var lf = System.Environment.NewLine; - Assert.That(response, Is.EqualTo("Data{0}foo{0}".Fmt(lf))); + client.Version = 1; + response = client.Send(new RequestWithVersion()); + Assert.That(response.Version, Is.EqualTo(1)); + + response = await client.SendAsync(new RequestWithVersion()); + Assert.That(response.Version, Is.EqualTo(1)); + } + + [Test] + public async Task Does_send_version_using_JsonHttpClient() + { + var client = new JsonHttpClient(Config.AbsoluteBaseUri); + var response = client.Send(new RequestWithVersion { Version = 1 }); + Assert.That(response.Version, Is.EqualTo(1)); + + response = await client.SendAsync(new RequestWithVersion { Version = 1 }); + Assert.That(response.Version, Is.EqualTo(1)); + + client.Version = 1; + response = client.Send(new RequestWithVersion()); + Assert.That(response.Version, Is.EqualTo(1)); + + response = await client.SendAsync(new RequestWithVersion()); + Assert.That(response.Version, Is.EqualTo(1)); + } + + [Test] + public async Task Can_POST_to_IdWithAlias_with_JsonServiceClient_async() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + var response = await client.PostAsync(new IdWithAlias { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + } + + [Test] + public async Task Can_POST_to_IdWithAlias_with_JsonHttpClient_async() + { + var client = new JsonHttpClient(Config.AbsoluteBaseUri); + + var response = await client.PostAsync(new IdWithAlias { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + } + + [Test] + public void Can_create_request_DTO_from_URL() + { + Assert.That(HostContext.Metadata.CreateRequestFromUrl("/hello") is Hello); + + var request = (Hello)HostContext.Metadata.CreateRequestFromUrl("/hello/foo"); + Assert.That(request.Name, Is.EqualTo("foo")); + + request = (Hello)HostContext.Metadata.CreateRequestFromUrl("http://domain.org/hello/foo"); + Assert.That(request.Name, Is.EqualTo("foo")); + + request = (Hello)HostContext.Metadata.CreateRequestFromUrl("https://www.sub.domain.org/hello/foo"); + Assert.That(request.Name, Is.EqualTo("foo")); + + request = (Hello)HostContext.Metadata.CreateRequestFromUrl("/hello?name=bar"); + Assert.That(request.Name, Is.EqualTo("bar")); + + var responseType = HostContext.Metadata.GetResponseTypeByRequest(request.GetType()); + Assert.That(responseType, Is.EqualTo(typeof(HelloResponse))); + + request = (Hello)HostContext.Metadata.CreateRequestFromUrl("/hello?name=gateway"); + var response = (HelloResponse)HostContext.AppHost.GetServiceGateway(new BasicRequest()).Send(responseType, request); + Assert.That(response.Result, Is.EqualTo("Hello, gateway")); } } @@ -98,11 +316,21 @@ public RouteAppHost() : base(typeof(BufferedRequestTests).Name, typeof(CustomRou public override void Configure(Container container) { - SetConfig(new HostConfig { + SetConfig(new HostConfig + { AllowRouteContentTypeExtensions = true }); Plugins.Add(new CsvFormat()); //required to allow .csv + + ContentTypes.Register(MimeTypes.PlainText, + (req, o, stream) => JsonSerializer.SerializeToStream(o.GetType(), stream), + JsonSerializer.DeserializeFromStream); + + PreRequestFilters.Add((req, res) => { + if (req.ContentType.MatchesContentType(MimeTypes.PlainText)) + req.ResponseContentType = MimeTypes.Json; + }); } } @@ -113,12 +341,45 @@ public class CustomRoute : IReturn<CustomRoute> public string Data { get; set; } } + [Route("/customdot/{Id}.{Data}")] + public class CustomRouteDot : IReturn<CustomRouteDot> + { + public string Id { get; set; } + public string Data { get; set; } + } + + [Route("/pics/{Size}/{Id}.png", "GET")] + public class GetPngPic + { + public string Id { get; set; } + + public string Size { get; set; } + } + + [Route("/versioned-request")] + [Route("/versioned-request/{Id}")] + public class RequestWithVersion : IReturn<RequestWithVersion>, IHasVersion + { + public int Id { get; set; } + public int Version { get; set; } + } + + [Route("/thing/{Id}/point", "POST")] + [DataContract] + public class IdWithAlias : IReturn<IdWithAlias> + { + [DataMember(Name = "id")] + public int Id { get; set; } + } + + public class CustomRouteService : IService { - public object Any(CustomRoute request) - { - return request; - } + public object Any(CustomRoute request) => request; + public object Any(CustomRouteDot request) => request; + public object Any(GetPngPic request) => request; + public object Any(RequestWithVersion request) => request; + public object Any(IdWithAlias request) => request; } [TestFixture] @@ -126,20 +387,35 @@ public class ModifiedRouteTests { private ModifiedRouteAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new ModifiedRouteAppHost(); appHost.Init(); appHost.Start(Config.AbsoluteBaseUri); +// appHost.Start(Config.AnyHostBaseUrl); //go through fiddler } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); } + [Test] + public void Does_URL_Decode_PathInfo() + { + var client = new JsonServiceClient(Config.ListeningOn); +// var client = new JsonServiceClient("http://test.servicestack.net"); + + var pathInfo = "ern::Closer2U::Userprofile::1c7e9ead-c7d9-46f8-a0cc-2777c4373ac4"; + var response = client.Get(new CustomRoute { + Data = pathInfo + }); + + Assert.That(response.Data, Is.EqualTo(pathInfo)); + } + [Test] public void Can_download_modified_routes() { @@ -156,10 +432,8 @@ public void Can_download_modified_routes() var response = Config.AbsoluteBaseUri.CombineWith("/api/modified/foo.csv") .GetStringFromUrl(); - - var lf = System.Environment.NewLine; - Assert.That(response, Is.EqualTo("Data{0}foo{0}".Fmt(lf))); + Assert.That(response, Is.EqualTo("Data\r\nfoo\r\n")); } } @@ -195,4 +469,190 @@ public object Any(ModifiedRoute request) return request; } } + + [TestFixture] + public class InvalidRouteTests + { + public class UnknownRoute { } + + class InvalidRoutesAppHost : AppSelfHostBase + { + public InvalidRoutesAppHost() : base(typeof(InvalidRoutesAppHost).Name, typeof(InvalidRoutesAppHost).Assembly) { } + + public override void Configure(Container container) + { + Routes.Add<UnknownRoute>("/unknownroute"); + } + } + + [Test] + public void Throws_error_when_registering_route_for_unknown_Service() + { + using (var appHost = new InvalidRoutesAppHost() + .Init() + .Start(Config.AbsoluteBaseUri)) + { + try + { + var json = Config.AbsoluteBaseUri.CombineWith("/unknownroute").GetJsonFromUrl(); + Assert.Fail("Should throw"); + } + catch (WebException ex) + { + Assert.That(ex.GetStatus(), Is.EqualTo(HttpStatusCode.MethodNotAllowed)); + } + } + } + } + + [Route("/routeinfo/{Path*}")] + public class GetRouteInfo + { + public string Path { get; set; } + } + + public class GetRouteInfoResponse + { + public string BaseUrl { get; set; } + public string ResolvedUrl { get; set; } + } + + public class RouteInfoService : Service + { + public object Any(GetRouteInfo request) + { + return new GetRouteInfoResponse + { + BaseUrl = base.Request.GetBaseUrl(), + ResolvedUrl = base.Request.ResolveAbsoluteUrl("~/resolved") + }; + } + } + + class RouteInfoAppHost : AppSelfHostBase + { + public RouteInfoAppHost() : base(typeof(RouteInfoAppHost).Name, typeof(RouteInfoAppHost).Assembly) { } + public override void Configure(Container container) + { + CatchAllHandlers.Add((httpMethod, pathInfo, filePath) => + { + if (pathInfo.StartsWith("/swagger-ui")) + { + return new CustomResponseHandler((req, res) => + new GetRouteInfoResponse + { + BaseUrl = req.GetBaseUrl(), + ResolvedUrl = req.ResolveAbsoluteUrl("~/resolved") + }); + } + return null; + }); + } + } + + public class RouteInfoPathTests + { + [Test] + public void RootPath_returns_BaseUrl() + { + var url = Config.ServiceStackBaseUri; + using (var appHost = new RouteInfoAppHost() + .Init() + .Start(url + "/")) + { + var response = url.CombineWith("/routeinfo").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/routeinfo/dir").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/routeinfo/dir/sub").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/swagger-ui").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/swagger-ui/").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + } + } + + [Test] + public void ApiPath_returns_BaseUrl() + { + var url = Config.AbsoluteBaseUri.AppendPath("api"); + using (var appHost = new RouteInfoAppHost() + .Init() + .Start(url + "/")) + { + var response = url.CombineWith("/routeinfo").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/routeinfo/dir").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/routeinfo/dir/sub").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/swagger-ui").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/swagger-ui/").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + } + } + + [Test] + public void ApiV1Path_returns_BaseUrl() + { + var url = Config.AbsoluteBaseUri.AppendPath("api").AppendPath("v1"); + using (var appHost = new RouteInfoAppHost() + .Init() + .Start(url + "/")) + { + var response = url.CombineWith("/routeinfo").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/routeinfo/dir").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/routeinfo/dir/sub").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/swagger-ui").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/swagger-ui/").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + } + } + + [Test] + public void Does_NormalizePathInfo() + { + Assert.That(ServiceStackHost.NormalizePathInfo("/api/a", "api"), Is.EqualTo("/a")); + Assert.That(ServiceStackHost.NormalizePathInfo("/api/a/b", "api"), Is.EqualTo("/a/b")); + Assert.That(ServiceStackHost.NormalizePathInfo("/a", "api"), Is.EqualTo("/a")); + Assert.That(ServiceStackHost.NormalizePathInfo("/a/b", "api"), Is.EqualTo("/a/b")); + Assert.That(ServiceStackHost.NormalizePathInfo("/apikeys", "api"), Is.EqualTo("/apikeys")); + Assert.That(ServiceStackHost.NormalizePathInfo("/apikeys/a", "api"), Is.EqualTo("/apikeys/a")); + Assert.That(ServiceStackHost.NormalizePathInfo("/apikeys/a/b", "api"), Is.EqualTo("/apikeys/a/b")); + } + + } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RoutingPageTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RoutingPageTests.cs new file mode 100644 index 00000000000..94aa64f94d8 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RoutingPageTests.cs @@ -0,0 +1,271 @@ +using System; +using System.IO; +using System.Threading; +using Funq; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class RoutingPageTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(RoutingPageTests), typeof(RoutingPageTests).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig { + DebugMode = true, // need this to disable caching + }); + Plugins.Add(new SharpPagesFeature()); + } + } + + protected ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [SetUp] + public void SetUp() + { + try + { + appHost.VirtualFileSources.GetMemoryVirtualFiles().Clear(); + appHost.VirtualFileSources.GetFileSystemVirtualFiles().DeleteFolder("dir"); + } + catch (IOException e) + { + //sometimes throws The process cannot access the file 'bundle.js' because it is being used by another process. + } + } + + public static StringDictionary Files = new StringDictionary { + { "dir/contacts/_layout.html", PageHtml("{{ page }}") }, + { "dir/contacts/index.html", "<h2>/contacts/index.html</h2>" }, + { "dir/contacts/_id/edit.html", "<h2>/_id/edit.html {{id}}</h2>" }, + { "dir/contacts/edit/_id.html", "<h2>/edit/_id.html {{id}}</h2>" }, + }; + + static string PageHtml(string pageHtml) => $"<html><body><h1>/contacts/_layout.html</h1>{pageHtml}</body></html>"; + + public static StringDictionary Expected = new StringDictionary { + { "dir/contacts/index.html", PageHtml("<h2>/contacts/index.html</h2>") }, + { "dir/contacts/index", PageHtml("<h2>/contacts/index.html</h2>") }, + { "dir/contacts/", PageHtml("<h2>/contacts/index.html</h2>") }, + { "dir/contacts/1/edit", PageHtml("<h2>/_id/edit.html 1</h2>") }, + { "dir/contacts/edit/1", PageHtml("<h2>/edit/_id.html 1</h2>") }, + }; + + private static void AssertCanGetRoutingPages(IVirtualFiles vfs, Action fn=null) + { + Files.ForEach(vfs.WriteFile); + + foreach (var entry in Expected) + { + entry.Key.Print(); + var html = Config.ListeningOn.CombineWith(entry.Key).GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(entry.Value)); + } + + fn?.Invoke(); + } + + [Test] + public void Can_get_routing_pages_from_FileSystemVirtualFiles() + { + AssertCanGetRoutingPages(appHost.VirtualFileSources.GetFileSystemVirtualFiles()); + } + + [Test] + public void Can_get_routing_pages_from_MemoryVirtualFiles() + { + AssertCanGetRoutingPages(appHost.VirtualFileSources.GetMemoryVirtualFiles()); + } + + [Test] + public void Can_get_routing_pages_from_FileSystemVirtualFiles_when_file_in_MemoryVfs() + { + var memFs = appHost.VirtualFileSources.GetMemoryVirtualFiles(); + memFs.WriteFile("alt-dir/page.html", "<h2>alt-dir/page.html</h2>"); + + AssertCanGetRoutingPages(appHost.VirtualFileSources.GetFileSystemVirtualFiles(), () => { + var html = Config.ListeningOn.CombineWith("alt-dir/page").GetStringFromUrl(accept:MimeTypes.Html); + Assert.That(html, Is.EqualTo("<h2>alt-dir/page.html</h2>")); + }); + } + + [Test] + public void Can_get_routing_pages_from_FileSystemVirtualFiles_when_file_in_dir_in_MemoryVfs() + { + var memFs = appHost.VirtualFileSources.GetMemoryVirtualFiles(); + memFs.WriteFile("dir/page.html", "<h2>dir/page.html</h2>"); + memFs.WriteFile("dir/contacts/page.html", "<h2>dir/contacts/page.html</h2>"); + + AssertCanGetRoutingPages(appHost.VirtualFileSources.GetFileSystemVirtualFiles(), () => { + var html = Config.ListeningOn.CombineWith("dir/page").GetStringFromUrl(accept:MimeTypes.Html); + Assert.That(html.NormalizeNewLines(), Is.EqualTo("<h2>dir/page.html</h2>")); + + html = Config.ListeningOn.CombineWith("dir/contacts/page").GetStringFromUrl(accept:MimeTypes.Html); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(PageHtml("<h2>dir/contacts/page.html</h2>"))); + }); + } + + static string BundledJsPageHtml(string pageHtml) => $"<html><body><script src=\"/dir/js/bundle.js\"></script><h1>/contacts/_layout.html</h1>{pageHtml}</body></html>"; + + public static StringDictionary BundledJsFiles => new StringDictionary { + { "dir/js/default.js", "function fn(){ }" }, + { "dir/lib/js/a.js", "function a(){ }" }, + { "dir/lib/js/b.js", "function b(){ }" }, + { "dir/lib/js/c.js", "function c(){ }" }, + { "dir/contacts/_layout.html", "<html><body>{{ ['/dir/lib/js','/dir/js/default.js'] | bundleJs({disk:false,out:'/dir/js/bundle.js'}) }}<h1>/contacts/_layout.html</h1>{{page}}</body></html>" }, + { "dir/contacts/index.html", "<h2>/contacts/index.html</h2>" }, + { "dir/contacts/_id/edit.html", "<h2>/_id/edit.html {{id}}</h2>" }, + { "dir/contacts/edit/_id.html", "<h2>/edit/_id.html {{id}}</h2>" }, + }; + + public static StringDictionary BundledJsExpected => new StringDictionary { + { "dir/contacts/", BundledJsPageHtml("<h2>/contacts/index.html</h2>") }, + { "dir/contacts/1/edit", BundledJsPageHtml("<h2>/_id/edit.html 1</h2>") }, + { "dir/contacts/edit/1", BundledJsPageHtml("<h2>/edit/_id.html 1</h2>") }, + }; + + public static string ExpectedBundleJs = "function a(){};\n\nfunction b(){};\n\nfunction c(){};\n\nfunction fn(){};"; + + [Test] + public void Can_get_Routing_Page_after_in_Memory_js_Bundle() + { + var fs = appHost.VirtualFileSources.GetFileSystemVirtualFiles(); + BundledJsFiles.ForEach(fs.WriteFile); + + foreach (var entry in BundledJsExpected) + { + entry.Key.Print(); + var html = Config.ListeningOn.CombineWith(entry.Key).GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(entry.Value)); + } + + var memFs = appHost.VirtualFileSources.GetMemoryVirtualFiles(); + var bundleJs = memFs.GetFile("dir/js/bundle.js")?.ReadAllText(); + Assert.That(bundleJs, Is.Not.Null); + $"\nbundle.js:\n{bundleJs}".Print(); + Assert.That(bundleJs.NormalizeNewLines(), Is.EqualTo(ExpectedBundleJs)); + + bundleJs = Config.ListeningOn.CombineWith("/dir/js/bundle.js").GetStringFromUrl(); + Assert.That(bundleJs.NormalizeNewLines(), Is.EqualTo(ExpectedBundleJs)); + } + + public static string ExpectedOnDiskBundleJs = "function a(){ }\nfunction b(){ }\nfunction c(){ }\nfunction fn(){ }"; + + [Test] + public void Can_get_Routing_Page_after_on_disk_js_Bundle() + { + var fs = appHost.VirtualFileSources.GetFileSystemVirtualFiles(); + var files = BundledJsFiles; + files["dir/contacts/_layout.html"] = files["dir/contacts/_layout.html"] + .Replace("disk:false", "disk:true,minify:false"); + files.ForEach(fs.WriteFile); + + foreach (var entry in BundledJsExpected) + { + entry.Key.Print(); + var html = Config.ListeningOn.CombineWith(entry.Key).GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(entry.Value)); + } + + var bundleJs = fs.GetFile("dir/js/bundle.js")?.ReadAllText(); + Assert.That(bundleJs, Is.Not.Null); + $"\nbundle.js:\n{bundleJs}".Print(); + Assert.That(bundleJs.NormalizeNewLines(), Is.EqualTo(ExpectedOnDiskBundleJs)); + + bundleJs = Config.ListeningOn.CombineWith("/dir/js/bundle.js").GetStringFromUrl(); + Assert.That(bundleJs.NormalizeNewLines(), Is.EqualTo(ExpectedOnDiskBundleJs)); + } + + static string BundledCssPageHtml(string pageHtml) => $"<html><body><link rel=\"stylesheet\" href=\"/dir/css/bundle.css\"><h1>/contacts/_layout.html</h1>{pageHtml}</body></html>"; + + public static StringDictionary BundledCssFiles => new StringDictionary { + { "dir/css/default.css", "body { }" }, + { "dir/lib/css/a.css", ".a { }" }, + { "dir/lib/css/b.css", ".b { }" }, + { "dir/lib/css/c.css", ".c { }" }, + { "dir/contacts/_layout.html", "<html><body>{{ ['/dir/lib/css','/dir/css/default.css'] | bundleCss({disk:false,out:'/dir/css/bundle.css'}) }}<h1>/contacts/_layout.html</h1>{{page}}</body></html>" }, + { "dir/contacts/index.html", "<h2>/contacts/index.html</h2>" }, + { "dir/contacts/_id/edit.html", "<h2>/_id/edit.html {{id}}</h2>" }, + { "dir/contacts/edit/_id.html", "<h2>/edit/_id.html {{id}}</h2>" }, + }; + + public static StringDictionary BundledCssExpected => new StringDictionary { + { "dir/contacts/", BundledCssPageHtml("<h2>/contacts/index.html</h2>") }, + { "dir/contacts/1/edit", BundledCssPageHtml("<h2>/_id/edit.html 1</h2>") }, + { "dir/contacts/edit/1", BundledCssPageHtml("<h2>/edit/_id.html 1</h2>") }, + }; + + public static string ExpectedBundleCss = ".a{}\n.b{}\n.c{}\nbody{}"; + + [Test] + public void Can_get_Routing_Page_after_in_Memory_css_Bundle() + { + var fs = appHost.VirtualFileSources.GetFileSystemVirtualFiles(); + BundledCssFiles.ForEach(fs.WriteFile); + + foreach (var entry in BundledCssExpected) + { + entry.Key.Print(); + var html = Config.ListeningOn.CombineWith(entry.Key).GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(entry.Value)); + } + + var memFs = appHost.VirtualFileSources.GetMemoryVirtualFiles(); + var bundleCss = memFs.GetFile("dir/css/bundle.css")?.ReadAllText(); + Assert.That(bundleCss, Is.Not.Null); + $"\nbundle.css:\n{bundleCss}".Print(); + Assert.That(bundleCss.NormalizeNewLines(), Is.EqualTo(ExpectedBundleCss)); + + bundleCss = Config.ListeningOn.CombineWith("/dir/css/bundle.css").GetStringFromUrl(); + Assert.That(bundleCss.NormalizeNewLines(), Is.EqualTo(ExpectedBundleCss)); + } + + public static string ExpectedOnDiskBundleCss = ".a { }\n.b { }\n.c { }\nbody { }"; + + [Test] + public void Can_get_Routing_Page_after_on_disk_css_Bundle() + { + var fs = appHost.VirtualFileSources.GetFileSystemVirtualFiles(); + var files = BundledCssFiles; + files["dir/contacts/_layout.html"] = files["dir/contacts/_layout.html"] + .Replace("disk:false", "disk:true,minify:false"); + files.ForEach(fs.WriteFile); + + foreach (var entry in BundledCssExpected) + { + entry.Key.Print(); + var html = Config.ListeningOn.CombineWith(entry.Key).GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(entry.Value)); + } + + var bundleCss = fs.GetFile("dir/css/bundle.css")?.ReadAllText(); + Assert.That(bundleCss, Is.Not.Null); + $"\nbundle.js:\n{bundleCss}".Print(); + Assert.That(bundleCss.NormalizeNewLines(), Is.EqualTo(ExpectedOnDiskBundleCss)); + + bundleCss = Config.ListeningOn.CombineWith("/dir/css/bundle.css").GetStringFromUrl(); + Assert.That(bundleCss.NormalizeNewLines(), Is.EqualTo(ExpectedOnDiskBundleCss)); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/RuntimeAttributeTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/RuntimeAttributeTests.cs index b0255174fa5..df6f103ee0f 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/RuntimeAttributeTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/RuntimeAttributeTests.cs @@ -1,57 +1,108 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt using System; using Funq; using NUnit.Framework; +using ServiceStack.Api.Swagger; using ServiceStack.Auth; +using ServiceStack.DataAnnotations; using ServiceStack.Host; -using ServiceStack.Testing; +using ServiceStack.Web; namespace ServiceStack.WebHost.Endpoints.Tests { + public class RuntimeAttributes : IReturn<RuntimeAttributes> + { + public int Id { get; set; } + } + + public class RuntimeAttributeService : Service + { + public object Any(RuntimeAttributes request) + { + return request; + } + } + + public class RuntimeAttributeRequestFilter : RequestFilterAttribute + { + public override void Execute(IRequest req, IResponse res, object requestDto) + { + ((RuntimeAttributes)requestDto).Id++; + } + } + [TestFixture] public class RuntimeAttributeTests { - public class RuntimeAttributeAppHost : BasicAppHost + private ServiceStackHost appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetUp() + { + appHost = new RuntimeAttributeAppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + public class RuntimeAttributeAppHost : AppSelfHostBase { public RuntimeAttributeAppHost() - : base(typeof (RuntimeAttributeAppHost).Assembly) + : base(typeof(RuntimeAttributeTests).Name, typeof (RuntimeAttributeAppHost).Assembly) { + typeof(RuntimeAttributes) + .AddAttributes(new RuntimeAttributeRequestFilter()); + typeof(Register) .AddAttributes(new RouteAttribute("/custom-register")) .AddAttributes(new RestrictAttribute(RequestAttributes.Json)); + + typeof(SwaggerResource) + .AddAttributes(new ExcludeAttribute(Feature.Soap)); } public override void Configure(Container container) { - Plugins.Add(new AuthFeature(() => new AuthUserSession(), + this.RegisterService<RegisterService>("/register"); + + Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new BasicAuthProvider(), })); - - Plugins.Add(new RegistrationFeature()); } } [Test] public void Does_add_CustomAttributes_to_when_added_in_AppHost_constructor() { - using (var appHost = new RuntimeAttributeAppHost().Init()) - { - string contentType; - var restPath = RestHandler.FindMatchingRestPath("GET", "/custom-register", out contentType); + var restPath = RestHandler.FindMatchingRestPath("GET", "/custom-register", out _); - Assert.That(restPath, Is.Not.Null); - Assert.That(restPath.RequestType, Is.EqualTo(typeof(Register))); + Assert.That(restPath, Is.Not.Null); + Assert.That(restPath.RequestType, Is.EqualTo(typeof(Register))); - //Allows JSON - appHost.ServiceController.AssertServiceRestrictions(typeof(Register), RequestAttributes.Json); + //Allows JSON + appHost.ServiceController.AssertServiceRestrictions(typeof(Register), RequestAttributes.Json); - Assert.Throws<UnauthorizedAccessException>(() => - appHost.ServiceController.AssertServiceRestrictions(typeof(Register), RequestAttributes.Xml)); - } + Assert.Throws<UnauthorizedAccessException>(() => + appHost.ServiceController.AssertServiceRestrictions(typeof(Register), RequestAttributes.Xml)); + } + + [Test] + public void Can_add_RequestFilter_attribute_in_Configure() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var response = client.Get(new RuntimeAttributes { Id = 1 }); + + Assert.That(response.Id, Is.EqualTo(2)); } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/BAK_CompatTemplateTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/BAK_CompatTemplateTests.cs new file mode 100644 index 00000000000..63004044caf --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/BAK_CompatTemplateTests.cs @@ -0,0 +1,773 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Caching; +using ServiceStack.Configuration; +using ServiceStack.Data; +using ServiceStack.DataAnnotations; +using ServiceStack.IO; +using ServiceStack.OrmLite; +using ServiceStack.OrmLite.Sqlite; +using ServiceStack.Redis; +using ServiceStack.Script; +using ServiceStack.Templates; +using ServiceStack.Testing; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class TemplateDbFiltersAsync : ScriptMethods + { + private IDbConnectionFactory dbFactory; + public IDbConnectionFactory DbFactory + { + get => dbFactory ?? (dbFactory = Context.Container.Resolve<IDbConnectionFactory>()); + set => dbFactory = value; + } + + public async Task<IDbConnection> OpenDbConnectionAsync(ScriptScopeContext scope, Dictionary<string, object> options) + { + if (options != null) + { + if (options.TryGetValue("connectionString", out var connectionString)) + return options.TryGetValue("providerName", out var providerName) + ? await DbFactory.OpenDbConnectionStringAsync((string)connectionString, (string)providerName) + : await DbFactory.OpenDbConnectionStringAsync((string)connectionString); + + if (options.TryGetValue("namedConnection", out var namedConnection)) + return await DbFactory.OpenDbConnectionAsync((string)namedConnection); + } + + if (scope.PageResult != null && scope.PageResult.Args.TryGetValue("__dbinfo", out var oDbInfo) && oDbInfo is ConnectionInfo dbInfo) // Keywords.DbInfo + return await DbFactory.OpenDbConnectionAsync(dbInfo); + + return await DbFactory.OpenAsync(); + } + + async Task<object> exec<T>(Func<IDbConnection, Task<T>> fn, ScriptScopeContext scope, object options) + { + try + { + using (var db = await OpenDbConnectionAsync(scope, options as Dictionary<string, object>)) + { + var result = await fn(db); + return result; + } + } + catch (Exception ex) + { + throw new StopFilterExecutionException(scope, options, ex); + } + } + + public Task<object> dbSelect(TemplateScopeContext scope, string sql) => + exec(db => db.SqlListAsync<Dictionary<string, object>>(sql), scope, null); + + public Task<object> dbSelect(TemplateScopeContext scope, string sql, Dictionary<string, object> args) => + exec(db => db.SqlListAsync<Dictionary<string, object>>(sql, args), scope, null); + + public Task<object> dbSingle(TemplateScopeContext scope, string sql) => + exec(db => db.SingleAsync<Dictionary<string, object>>(sql), scope, null); + + public Task<object> dbSingle(TemplateScopeContext scope, string sql, Dictionary<string, object> args) => + exec(db => db.SingleAsync<Dictionary<string, object>>(sql, args), scope, null); + + public Task<object> dbScalar(ScriptScopeContext scope, string sql) => + exec(db => db.ScalarAsync<object>(sql), scope, null); + + public string sqlLimit(int? offset, int? limit) => padCondition(OrmLiteConfig.DialectProvider.SqlLimit(offset, limit)); + public string sqlLimit(int? limit) => padCondition(OrmLiteConfig.DialectProvider.SqlLimit(null, limit)); + private string padCondition(string text) => string.IsNullOrEmpty(text) ? "" : " " + text; + } + + public class TemplateRedisFilters : TemplateFilter + { + private IRedisClientsManager redisManager; + public IRedisClientsManager RedisManager + { + get => redisManager ?? (redisManager = Context.Container.Resolve<IRedisClientsManager>()); + set => redisManager = value; + } + + T exec<T>(Func<IRedisClient, T> fn, TemplateScopeContext scope, object options) + { + try + { + using (var redis = RedisManager.GetClient()) + { + return fn(redis); + } + } + catch (Exception ex) + { + throw new StopFilterExecutionException(scope, options, ex); + } + } + + public Dictionary<string, object> redisConnection(TemplateScopeContext scope) => exec(r => new Dictionary<string, object> + { + { "host", r.Host }, + { "port", r.Port }, + { "db", r.Db }, + }, scope, null); + } + + class Post + { + [AutoIncrement] + public int Id { get; set; } + public string Title { get; set; } + public string Content { get; set; } + public DateTime Created { get; set; } + public string CreatedBy { get; set; } + public DateTime Modified { get; set; } + public string ModifiedBy { get; set; } + } + + [TestFixture] + public class BAK_CompatTemplateTests + { + [Test] + public void BAK_Filters_evaluates_async_results() + { + OrmLiteConfig.BeforeExecFilter = cmd => cmd.GetDebugString().Print(); + + var context = new TemplateContext + { + TemplateFilters = { new TemplateDbFiltersAsync() }, + Args = { + ["objectCount"] = Task.FromResult((object)1) + } + }; + context.Container.AddSingleton<IDbConnectionFactory>(() => new OrmLiteConnectionFactory(":memory:", SqliteOrmLiteDialectProvider.Instance)); + context.Init(); + + using (var db = context.Container.Resolve<IDbConnectionFactory>().Open()) + { + db.DropAndCreateTable<Post>(); + db.Insert(new Post { Title = "The Title", Content = "The Content", Created = DateTime.Now, Modified = DateTime.Now }); + } + + context.VirtualFiles.WriteFile("objectCount.html", "{{ objectCount | assignTo: count }}{{ count }}"); + context.VirtualFiles.WriteFile("dbCount.html", "{{ dbScalar(`SELECT COUNT(*) FROM Post`) | assignTo: count }}{{ count }}"); + + Assert.That(new PageResult(context.GetPage("objectCount")).Result, Is.EqualTo("1")); + Assert.That(new PageResult(context.GetPage("dbCount")).Result, Is.EqualTo("1")); + + OrmLiteConfig.BeforeExecFilter = null; + } + + [Test] + public void BAK_Can_pass_filter_by_argument_to_partial() + { + var context = new TemplateContext + { + TemplateFilters = + { + new TemplateRedisFilters { RedisManager = new RedisManagerPool() }, + } + }.Init(); + + context.VirtualFiles.WriteFile("page-argument.html", "{{ 'partial-argument' | partial({ redis: redisConnection }) }}"); + context.VirtualFiles.WriteFile("partial-argument.html", "{{ redis.host }}, {{ redis.port }}"); + + var output = new PageResult(context.GetPage("page-argument")).Result; + + Assert.That(output, Is.EqualTo("localhost, 6379")); + } + + [Test] + public void BAK_Can_include_plugins_into_new_eval_context() + { + var context = new TemplateContext { + TemplateBlocks = { new EvalScriptBlock() }, + Plugins = { new MarkdownTemplatePlugin() }, + Args = { + ["evalContent"] = "{{#markdown}}# Heading{{/markdown}}", + } + }.Init(); + + Assert.Throws<NotSupportedException>(() => + context.EvaluateTemplate("{{#eval}}{{evalContent}}{{/eval}}")); + Assert.Throws<NotSupportedException>(() => + context.EvaluateTemplate("{{ evalContent | evalTemplate}}")); + + Assert.That(context.EvaluateTemplate("{{#eval {use:{plugins:'MarkdownTemplatePlugin'} }}{{evalContent}}{{/eval}}"), + Is.EqualTo("<h1>Heading</h1>\n")); + + Assert.That(context.EvaluateTemplate("{{ evalContent | evalTemplate({use:{plugins:'MarkdownTemplatePlugin'}}) | raw }}"), + Is.EqualTo("<h1>Heading</h1>\n")); + } + + [Test] + public void BAK_Can_include_filter_into_new_eval_context() + { + var context = new TemplateContext { + TemplateBlocks = { new EvalScriptBlock() }, + TemplateFilters = { new TemplateInfoFilters() }, + Args = { + ["evalContent"] = "{{envServerUserAgent}}", + } + }.Init(); + + Assert.That(context.EvaluateTemplate("{{#eval}}{{evalContent}}{{/eval}}"), + Does.Not.Contain("ServiceStack")); + Assert.That(context.EvaluateTemplate("{{ evalContent | evalTemplate}}"), + Does.Not.Contain("ServiceStack")); + + Assert.That(context.EvaluateTemplate("{{#eval {use:{filters:'TemplateInfoFilters'}}{{evalContent}}{{/eval}}"), + Does.Contain("ServiceStack")); + + Assert.That(context.EvaluateTemplate("{{ evalContent | evalTemplate({use:{filters:'TemplateInfoFilters'}}) }}"), + Does.Contain("ServiceStack")); + } + + [Test] + public void BAK_Installation() + { + var context = new TemplateContext().Init(); + var dynamicPage = context.OneTimePage("The time is now: {{ now | dateFormat('HH:mm:ss') }}"); + var output = new PageResult(dynamicPage).Result; + Assert.That(output, Does.StartWith("The time is now: ")); + + output = context.EvaluateTemplate("The time is now: {{ now | dateFormat('HH:mm:ss') }}"); + Assert.That(output, Does.StartWith("The time is now: ")); + } + + [Test] + public async Task BAK_Introduction() + { + var context = new TemplateContext().Init(); + var output = context.EvaluateTemplate("{{ 12.34 | currency }}"); + Assert.That(output, Is.EqualTo("$12.34")); + + context.VirtualFiles.WriteFile("_layout.html", "I am the Layout: <b>{{ page }}</b>"); + context.VirtualFiles.WriteFile("page.html", "I am the Page"); + var page = context.GetPage("page"); + output = await new PageResult(page).RenderToStringAsync(); + output = new PageResult(page).Result; + Assert.That(output, Is.EqualTo("I am the Layout: <b>I am the Page</b>")); + } + + [Test] + public void BAK_Arguments() + { + var context = new TemplateContext { + Args = { + ["arg"] = 1 + } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @"<!-- +arg: 2 +arg2: 2 +--> + +layout args: <b>{{ arg }}, {{ arg2 }}</b> +<p>{{ page }}</p>"); + + context.VirtualFiles.WriteFile("page.html", @"<!-- +arg: 3 +--> + +page arg: <b>{{ arg }}</b>"); + + var output = new PageResult(context.GetPage("page")).Result; + output.Print(); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@"layout args: <b>3, 2</b> +<p>page arg: <b>3</b></p>".NormalizeNewLines())); + + var result = new PageResult(context.GetPage("page")) { + Args = { + ["arg"] = 4 + } + }; + output = result.Result; + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@"layout args: <b>4, 2</b> +<p>page arg: <b>4</b></p>".NormalizeNewLines())); + } + + public class TemplateNoopBlock : TemplateBlock + { + public override string Name => "noop"; + + public override Task WriteAsync(TemplateScopeContext scope, PageBlockFragment block, CancellationToken ct) + => Task.CompletedTask; + } + + public class TemplateBoldBlock : TemplateBlock + { + public override string Name => "bold"; + + public override async Task WriteAsync( + TemplateScopeContext scope, PageBlockFragment block, CancellationToken token) + { + await scope.OutputStream.WriteAsync("<b>", token); + await WriteBodyAsync(scope, block, token); + await scope.OutputStream.WriteAsync("</b>", token); + } + } + + [Test] + public void BAK_Blocks() + { + var context = new TemplateContext { + TemplateBlocks = { new TemplateNoopBlock() }, + }.Init(); + + context = new TemplateContext + { + ScanTypes = { typeof(TemplateNoopBlock) } + }; + context.Container.AddSingleton<ICacheClient>(() => new MemoryCacheClient()); + context.Init(); + + context = new TemplateContext + { + ScanAssemblies = { typeof(TemplateNoopBlock).Assembly } + }.Init(); + + var output = context.EvaluateTemplate("BEFORE {{#noop}}BETWEEN{{/noop}} AFTER"); + Assert.That(output, Is.EqualTo("BEFORE AFTER")); + + context = new TemplateContext { + TemplateBlocks = { new TemplateBoldBlock() }, + }.Init(); + + output = context.EvaluateTemplate("{{#bold}}This text will be bold{{/bold}}"); + Assert.That(output, Is.EqualTo("<b>This text will be bold</b>")); + } + + class MyFilter : TemplateFilter + { + public string echo(string text) => $"{text} {text}"; + public double squared(double value) => value * value; + public string greetArg(string key) => $"Hello {Context.Args[key]}"; + + public ICacheClient Cache { get; set; } //injected dependency + public string fromCache(string key) => Cache.Get<string>(key); + + public async Task includeFile(TemplateScopeContext scope, string virtualPath) + { + var file = scope.Context.VirtualFiles.GetFile(virtualPath); + if (file == null) + throw new FileNotFoundException($"includeFile '{virtualPath}' was not found"); + + using (var reader = file.OpenRead()) + { + await reader.CopyToAsync(scope.OutputStream); + } + } + } + + [Test] + public void BAK_Filters() + { + var context = new TemplateContext + { + Args = + { + ["contextArg"] = "foo" + }, + TemplateFilters = { new MyFilter() } + }.Init(); + + var output = context.EvaluateTemplate("<p>{{ 'contextArg' | greetArg }}</p>"); + Assert.That(output, Is.EqualTo("<p>Hello foo</p>")); + + output = new PageResult(context.OneTimePage("<p>{{ 'hello' | echo }}</p>")) + { + TemplateFilters = { new MyFilter() } + }.Result; + Assert.That(output, Is.EqualTo("<p>hello hello</p>")); + + context = new TemplateContext + { + ScanTypes = { typeof(MyFilter) } + }; + context.Container.AddSingleton<ICacheClient>(() => new MemoryCacheClient()); + context.Container.Resolve<ICacheClient>().Set("key", "foo"); + context.Init(); + + output = context.EvaluateTemplate("<p>{{ 'key' | fromCache }}</p>"); + Assert.That(output, Is.EqualTo("<p>foo</p>")); + + context = new TemplateContext + { + Plugins = { new MarkdownTemplatePlugin() }, + ScanAssemblies = { typeof(MyFilter).Assembly } + }.Init(); + context.VirtualFiles.WriteFile("doc.md", "# Hello"); + + output = context.EvaluateTemplate("{{ 'doc.md' | includeFile | markdown }}"); + Assert.That(output.Trim(), Is.EqualTo("<h1>Hello</h1>")); + } + + [Test] + public void BAK_DefaultFilters() + { + var context = new TemplateContext { + Args = { + [TemplateConstants.DefaultDateFormat] = "yyyy-MM-dd HH:mm:ss" + } + }.Init(); + } + + [Test] + public void BAK_ServiceStackFilters() + { + using (new BasicAppHost().Init()) + { + var context = new TemplatePagesFeature + { + TemplateFilters = { new TemplateInfoFilters() } + }.Init(); + + var plugin = new TemplatePagesFeature { + MetadataDebugAdminRole = RoleNames.AllowAnon + }; + + plugin = new TemplatePagesFeature { + MetadataDebugAdminRole = RoleNames.AllowAnyUser, // Allow Authenticated Users + }; + } + } + + [Test] + public void BAK_DatabaseFilters() + { + var context = new TemplateContext { + TemplateFilters = { + new TemplateDbFiltersAsync() + } + }.Init(); + } + + [Test] + public void BAK_RedisFilters() + { + var context = new TemplateContext { + TemplateFilters = { + new TemplateRedisFilters() + } + }.Init(); + } + + [Test] + public void BAK_ErrorHandling() + { + var context = new TemplateContext { + SkipExecutingFiltersIfError = true + }; + + context = new TemplateContext { + RenderExpressionExceptions = true + }.Init(); + } + + public class MarkdownPageFormat : PageFormat + { + private static readonly MarkdownDeep.Markdown markdown = new MarkdownDeep.Markdown(); + + public MarkdownPageFormat() + { + Extension = "md"; + ContentType = MimeTypes.MarkdownText; + } + + public static async Task<Stream> TransformToHtml(Stream markdownStream) + { + using (var reader = new StreamReader(markdownStream)) + { + var md = await reader.ReadToEndAsync(); + var html = markdown.Transform(md); + return MemoryStreamFactory.GetStream(html.ToUtf8Bytes()); + } + } + } + + [Test] + public async Task BAK_Transformers() + { + var context = new TemplateContext { + PageFormats = { new MarkdownPageFormat() } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.md", @" +The Header + +{{ page }}"); + + context.VirtualFiles.WriteFile("page.md", @" +## {{ title }} + +The Content"); + + var result = new PageResult(context.GetPage("page")) + { + Args = { {"title", "The Title"} }, + ContentType = MimeTypes.Html, + OutputTransformers = { MarkdownPageFormat.TransformToHtml }, + }; + + var html = await result.RenderToStringAsync(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo("<p>The Header</p>\n<h2>The Title</h2>\n<p>The Content</p>\n".NormalizeNewLines())); + + + context = new TemplateContext { + PageFormats = { new MarkdownPageFormat() } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> + <title>{{ title }}</title> +</head> +<body> + {{ page }} +</body>"); + + context.VirtualFiles.WriteFile("page.md", @" +## Transformers + +The Content"); + + result = new PageResult(context.GetPage("page")) + { + Args = { {"title", "The Title"} }, + ContentType = MimeTypes.Html, + PageTransformers = { MarkdownPageFormat.TransformToHtml }, + }; + + html = await result.RenderToStringAsync(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@"<html> + <title>The Title</title> +</head> +<body> + <h2>Transformers</h2> +<p>The Content</p> + +</body>".NormalizeNewLines())); + + + context = new TemplateContext + { + TemplateFilters = { new TemplateProtectedFilters() }, + FilterTransformers = + { + ["markdown"] = MarkdownPageFormat.TransformToHtml + } + }.Init(); + + context.VirtualFiles.WriteFile("doc.md", @"## The Heading + +The Content"); + + context.VirtualFiles.WriteFile("page.html", @" +<div id=content> + {{ 'doc.md' | includeFile | markdown }} +</div>"); + + html = new PageResult(context.GetPage("page")).Result; + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@"<div id=content> + <h2>The Heading</h2> +<p>The Content</p> + +</div>".NormalizeNewLines())); + } + + [Route("/BAK_customers/{Id}")] + public class ViewCustomer + { + public string Id { get; set; } + } + + public class CustomerServices : Service + { + public ITemplatePages Pages { get; set; } + + public object Any(ViewCustomer request) => + new PageResult(Pages.GetPage("examples/customer")) { + Model = QueryData.GetCustomer(request.Id) + }; + + public object Get(ViewCustomer request) => + new PageResult(Request.GetPage("examples/customer")) { + Model = QueryData.GetCustomer(request.Id) + }; + } + + [Test] + public void BAK_ModelViewController() + { + using (var appHost = new BasicAppHost { + ConfigureAppHost = host => { + host.Plugins.Add(new TemplatePagesFeature()); + host.Container.AddTransient<CustomerServices>(); + } + }.Init()) + { + var service = appHost.Container.Resolve<CustomerServices>(); + Assert.That(service.Pages, Is.Not.Null); + } + } + + [Page("BAK_products")] + [PageArg("title", "Products")] + public class ProductsPage : TemplateCodePage + { + string render(Product[] products) => $@" + <table class='table table-striped'> + <thead> + <tr> + <th>Category</th> + <th>Name</th> + <th>Price</th> + </tr> + </thead> + {products.OrderBy(x => x.Category).ThenBy(x => x.ProductName).Map(x => $@" + <tr> + <th>{x.Category}</th> + <td>{x.ProductName.HtmlEncode()}</td> + <td>{x.UnitPrice:C}</td> + </tr>").Join("")} + </table>"; + } + + [Route("/BAK_products/view")] + public class ViewProducts + { + public string Id { get; set; } + } + + public class ProductsServices : Service + { + public object Any(ViewProducts request) => + new PageResult(Request.GetCodePage("products")) { + Args = { + ["products"] = QueryData.Products + } + }; + } + + [Page("BAK_navLinks")] + public class NavLinksPartial : TemplateCodePage + { + string render(string PathInfo, Dictionary<string, object> links) => $@" + <ul> + {links.Map(entry => $@"<li class='{GetClass(PathInfo, entry.Key)}'> + <a href='{entry.Key}'>{entry.Value}</a> + </li>").Join("")} + </ul>"; + + string GetClass(string pathInfo, string url) => url == pathInfo ? "active" : ""; + } + + [Test] + public void BAK_CodePages() + { + } + + [Test] + public void BAK_Sandbox() + { + var context = new TemplateContext { + ExcludeFiltersNamed = { "partial", "selectPartial" } + }.Init(); + + context = new TemplateContext { + MaxQuota = 1000 + }.Init(); + } + + public class MarkdownTemplatePlugin : ITemplatePlugin + { + public bool RegisterPageFormat { get; set; } = true; + + public void Register(ScriptContext context) + { + if (RegisterPageFormat) + context.PageFormats.Add(new MarkdownPageFormat()); + + context.FilterTransformers["markdown"] = MarkdownPageFormat.TransformToHtml; + + context.ScriptMethods.Add(new MarkdownTemplateFilter()); + + context.ScriptBlocks.Add(new TemplateMarkdownBlock()); + } + } + + [Test] + public void BAK_APIReference() + { + ScriptContext context = new TemplateContext { + Plugins = { new MarkdownTemplatePlugin { RegisterPageFormat = false } } + }.Init(); + + context = new TemplateContext() + .RemovePlugins(x => x is DefaultScriptBlocks) // Remove default blocks + .RemovePlugins(x => x is HtmlScriptBlocks) // Remove all html blocks + .Init(); + + context = new TemplateContext { + OnAfterPlugins = ctx => ctx.RemoveBlocks(x => x.Name == "capture") + } + .Init(); + + context = new TemplateContext { + MaxQuota = 10000, + Args = { + [TemplateConstants.DefaultCulture] = CultureInfo.CurrentCulture, + [TemplateConstants.DefaultDateFormat] = "yyyy-MM-dd", + [TemplateConstants.DefaultDateTimeFormat] = "u", + [TemplateConstants.DefaultTimeFormat] = "h\\:mm\\:ss", + [TemplateConstants.DefaultFileCacheExpiry] = TimeSpan.FromMinutes(1), + [TemplateConstants.DefaultUrlCacheExpiry] = TimeSpan.FromMinutes(1), + [TemplateConstants.DefaultIndent] = "\t", + [TemplateConstants.DefaultNewLine] = Environment.NewLine, + [TemplateConstants.DefaultJsConfig] = "excludetypeinfo", + [TemplateConstants.DefaultStringComparison] = StringComparison.Ordinal, + [TemplateConstants.DefaultTableClassName] = "table", + [TemplateConstants.DefaultErrorClassName] = "alert alert-danger", + } + }.Init(); + + var page = context.EmptyPage; + new PageResult(page) { Layout = "custom-layout" }; + new PageResult(page) { + TemplateFilters = {new MyFilter()} + }; + new PageResult(page) { + ContentType = MimeTypes.Html, + OutputTransformers = {MarkdownPageFormat.TransformToHtml}, + }; + new PageResult(page) { + ContentType = MimeTypes.Html, + PageTransformers = {MarkdownPageFormat.TransformToHtml}, + }; + new PageResult(page) { + FilterTransformers = { + ["markdown"] = MarkdownPageFormat.TransformToHtml + } + }; + new PageResult(page) { + ExcludeFiltersNamed = {"partial", "selectPartial"} + }; + new PageResult(page) { + Options = { + [HttpHeaders.XPoweredBy] = "ServiceStack Templates" + } + }; + new PageResult(page) { + ContentType = "text/plain" + }; + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/BinaryExpressionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/BinaryExpressionTests.cs new file mode 100644 index 00000000000..2483bf3d10f --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/BinaryExpressionTests.cs @@ -0,0 +1,351 @@ +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class BinaryExpressionTests + { + [Test] + public void Does_parse_basic_binary_expressions() + { + JsToken expr; + + "1 + 2".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, new JsLiteral(2)))); + + "1 - 2".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsSubtraction.Operator, new JsLiteral(2)))); + + "1 * 2".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsMultiplication.Operator, new JsLiteral(2)))); + + "1 / 2".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsDivision.Operator, new JsLiteral(2)))); + + "1 & 2".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsBitwiseAnd.Operator, new JsLiteral(2)))); + + "1 | 2".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsBitwiseOr.Operator, new JsLiteral(2)))); + + "1 ^ 2".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsBitwiseXOr.Operator, new JsLiteral(2)))); + + "1 << 2".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsBitwiseLeftShift.Operator, new JsLiteral(2)))); + + "1 >> 2".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsBitwiseRightShift.Operator, new JsLiteral(2)))); + } + + [Test] + public void Does_parse_composite_binary_expressions() + { + JsToken expr; + + "1 + 2 + 3".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsBinaryExpression( + new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, new JsLiteral(2)), + JsAddition.Operator, + new JsLiteral(3) + ) + )); + + "1 + 2 + 3 + 4".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsBinaryExpression( + new JsBinaryExpression( + new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, new JsLiteral(2)), + JsAddition.Operator, + new JsLiteral(3)), + JsAddition.Operator, + new JsLiteral(4) + ) + )); + } + + [Test] + public void Does_parse_binary_expressions_with_precedence() + { + JsToken expr; + + "1 + 2 * 3".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsBinaryExpression( + new JsLiteral(1), + JsAddition.Operator, + new JsBinaryExpression(new JsLiteral(2), JsMultiplication.Operator, new JsLiteral(3)) + ) + )); + + "1 + 2 * 3 - 4".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsBinaryExpression( + new JsBinaryExpression( + new JsLiteral(1), + JsAddition.Operator, + new JsBinaryExpression(new JsLiteral(2), JsMultiplication.Operator, new JsLiteral(3))), + JsSubtraction.Operator, + new JsLiteral(4) + ) + )); + + "1 + 2 * 3 - 4 / 5".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsBinaryExpression( + new JsBinaryExpression( + new JsLiteral(1), + JsAddition.Operator, + new JsBinaryExpression(new JsLiteral(2), JsMultiplication.Operator, new JsLiteral(3))), + JsSubtraction.Operator, + new JsBinaryExpression(new JsLiteral(4), JsDivision.Operator, new JsLiteral(5))) + ) + ); + } + + [Test] + public void Does_parse_binary_expression_with_brackets() + { + JsToken expr; + + "(1 + 2)".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, new JsLiteral(2)) + )); + + "(1 + 2) * 3".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsBinaryExpression( + new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, new JsLiteral(2)), + JsMultiplication.Operator, + new JsLiteral(3) + ) + )); + + "(1 + 2) * (3 - 4)".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsBinaryExpression( + new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, new JsLiteral(2)), + JsMultiplication.Operator, + new JsBinaryExpression(new JsLiteral(3), JsSubtraction.Operator, new JsLiteral(4)) + ) + )); + + "(1 + 2) * ((3 - 4) / 5)".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsBinaryExpression( + new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, new JsLiteral(2)), + JsMultiplication.Operator, + new JsBinaryExpression( + new JsBinaryExpression(new JsLiteral(3), JsSubtraction.Operator, new JsLiteral(4)), + JsDivision.Operator, + new JsLiteral(5) + ) + ) + )); + } + + [Test] + public void Does_parse_logical_expressions() + { + JsToken expr; + + "!(true || false)".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsUnaryExpression( + JsNot.Operator, + new JsLogicalExpression(new JsLiteral(true), JsOr.Operator, new JsLiteral(false)) + ) + )); + } + + [Test] + public void Does_parse_binary_and_logical_expressions() + { + JsToken expr; + + "[1 + 2 * 3 > one && 1 * 2 < ten]".ParseJsExpression(out expr); + + Assert.That(expr, Is.EqualTo( + new JsArrayExpression( + new JsLogicalExpression( + new JsBinaryExpression( + new JsBinaryExpression( + new JsLiteral(1), + JsAddition.Operator, + new JsBinaryExpression( + new JsLiteral(2), + JsMultiplication.Operator, + new JsLiteral(3) + ) + ), + JsGreaterThan.Operator, + new JsIdentifier("one") + ), + JsAnd.Operator, + new JsBinaryExpression( + new JsBinaryExpression( + new JsLiteral(1), + JsMultiplication.Operator, + new JsLiteral(2) + ), + JsLessThan.Operator, + new JsIdentifier("ten") + ) + ) + )) + ); + } + + [Test] + public void Does_parse_unary_expression() + { + JsToken expr; + + "-1".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsUnaryExpression(JsMinus.Operator, new JsLiteral(1)))); + "+1".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsUnaryExpression(JsPlus.Operator, new JsLiteral(1)))); + "!true".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsUnaryExpression(JsNot.Operator, new JsLiteral(true)))); + } + + [Test] + public void Does_evaluate_templates_with_expressions() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 1 + 2 }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ 1 - 2 }}"), Is.EqualTo("-1")); + Assert.That(context.EvaluateScript("{{ 1 * 2 }}"), Is.EqualTo("2")); + Assert.That(context.EvaluateScript("{{ 1 / 2 }}"), Is.EqualTo("0.5")); + Assert.That(context.EvaluateScript("{{ 1 / 2.0 }}"), Is.EqualTo("0.5")); + Assert.That(context.EvaluateScript("{{ 1 & 2 }}"), Is.EqualTo("0")); + //Needs to be in brackets so it's not considered as different filter expressions + Assert.That(context.EvaluateScript("{{ (1 | 2) }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ 1 ^ 2 }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ 1 << 2 }}"), Is.EqualTo("4")); + Assert.That(context.EvaluateScript("{{ 1 >> 2 }}"), Is.EqualTo("0")); + + Assert.That(context.EvaluateScript("{{ 1 + 2 + 3 }}"), Is.EqualTo("6")); + Assert.That(context.EvaluateScript("{{ 1 + 2 + 3 + 4 }}"), Is.EqualTo("10")); + + Assert.That(context.EvaluateScript("{{ 1 + 2 * 3 }}"), Is.EqualTo("7")); + Assert.That(context.EvaluateScript("{{ 1 + 2 * 3 - 4 }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ 1 + 2 * 3 - 4 / 5 }}"), Is.EqualTo("6.2")); + Assert.That(context.EvaluateScript("{{ 1 + 2 * 3 - 4 / 5.0 }}"), Is.EqualTo("6.2")); + + Assert.That(context.EvaluateScript("{{ (1 + 2) }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ (1 + 2) * 3 }}"), Is.EqualTo("9")); + Assert.That(context.EvaluateScript("{{ (1 + 2) * (3 - 4) }}"), Is.EqualTo("-3")); + Assert.That(context.EvaluateScript("{{ (1 + 2) * ((3 - 4) / 5.0) }}"), Is.EqualTo("-0.6")); + } + + [Test] + public void Does_evaluate_binary_expressions_with_filters() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 1 + 2 * 3 | add(3) }}"), Is.EqualTo("10")); + Assert.That(context.EvaluateScript("{{ (1 | 2) | add(3) }}"), Is.EqualTo("6")); + + Assert.That(context.EvaluateScript("{{ add(1 + 2 * 3, 4) | add(-5) }}"), Is.EqualTo("6")); + + Assert.That(context.EvaluateScript("{{ [1+2,1+2*3] | sum }}"), Is.EqualTo("10")); + Assert.That(context.EvaluateScript("{{ {a:1+2*3} | get('a') }}"), Is.EqualTo("7")); + } + + [Test] + public void Does_evaluate_binary_and_logical_expressions() + { + var context = new ScriptContext { + Args = { + ["one"] = 1, + ["ten"] = 10, + }, + }.Init(); + + Assert.That(context.EvaluateScript("{{ [1 + 2 * 3 > one && 1 * 2 < ten] | get(0) }}"), Is.EqualTo("True")); + } + + private static ScriptContext CreateContext() + { + var context = new ScriptContext { + Args = { + ["a"] = null, + ["b"] = 2, + ["empty"] = "", + ["f"] = false, + ["zero"] = 0, + ["t"] = true, + ["one"] = 1, + ["obj"] = new Dictionary<string, object>(), + ["array"] = new List<object>(), + } + }.Init(); + return context; + } + + [Test] + public void Does_evaluate_Coalescing_expressions() + { + var context = CreateContext(); + + Assert.That(context.EvaluateScript("{{ null ?? 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ a ?? 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ '' ?? 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ empty ?? 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ false ?? 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ f ?? 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 0 ?? 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ zero ?? 1 }}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{ true ?? 1 }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ t ?? 1 }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ b ?? 1 }}"), Is.EqualTo("2")); + Assert.That(context.EvaluateScript("{{ 2 ?? 1 }}"), Is.EqualTo("2")); + Assert.That(context.EvaluateScript("{{ 1 ?? 2 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ one ?? 2 }}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{ 0 ?? 2 > 1 ? 'Y' : 'N' }}"), Is.EqualTo("Y")); + Assert.That(context.EvaluateScript("{{ 2 ?? 0 > 1 ? 'Y' : 'N' }}"), Is.EqualTo("Y")); + } + + [Test] + public void Does_use_truthy_for_logical_expression() + { + var context = CreateContext(); + + Assert.That(context.EvaluateScript("{{#if null}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if a}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if unknown}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if 0}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if ''}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if empty}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if false}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + + Assert.That(context.EvaluateScript("{{#if a && true}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if a && t}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if true && a}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if unknown && true}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if true && unknown}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if empty && true}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if true && empty}}f{{else}}t{{/if}}"), Is.EqualTo("t")); + + Assert.That(context.EvaluateScript("{{#if a || true}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if true || a}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if unknown || true}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if true || unknown}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if empty || true}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if true || empty}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + + Assert.That(context.EvaluateScript("{{#if {} && true}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if obj && true}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if [] && true}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + Assert.That(context.EvaluateScript("{{#if array && true}}t{{else}}f{{/if}}"), Is.EqualTo("t")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CachingTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CachingTests.cs new file mode 100644 index 00000000000..5da37df3949 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CachingTests.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class CachingTests + { + [Test] + public void Can_use_ReadOnlyMemory_as_Dictionary_key() + { + var i = 0; + var map = new ConcurrentDictionary<ReadOnlyMemory<char>,int>(); + var key = "key".AsMemory(); + map.GetOrAdd(key, _ => ++i); + map.GetOrAdd(key, _ => ++i); + + Assert.That(i, Is.EqualTo(1)); + Assert.That(map.Count, Is.EqualTo(1)); + + map.GetOrAdd("key".AsMemory(), _ => ++i); + map.GetOrAdd("key".AsMemory(), _ => ++i); + Assert.That(i, Is.EqualTo(1)); + Assert.That(map.Count, Is.EqualTo(1)); + } + + [Test] + public void Cant_use_ReadOnlyMemory_from_different_string_as_Dictionary_Key() + { + var i = 0; + var map = new ConcurrentDictionary<ReadOnlyMemory<char>, int>(); + var key = "key".AsMemory(); + map.GetOrAdd("1key".AsMemory().Slice(1), _ => ++i); + map.GetOrAdd("2key".AsMemory().Slice(1), _ => ++i); + + Assert.That("1key".AsMemory().Slice(1).ToString(), Is.EqualTo("key")); + Assert.That("2key".AsMemory().Slice(1).ToString(), Is.EqualTo("key")); + + Assert.That(i, Is.EqualTo(2)); + Assert.That(map.Count, Is.EqualTo(2)); + } + + [Test] + public void Unique_Template_Should_Be_Cached_Only_Once() + { + var context = new ScriptContext + { + ScriptBlocks = { new EvalScriptBlock() }, + Args = { + ["templates"] = new List<string> { + "1. {{income ?? 1000}} - {{expenses}}", + "2. {{income ?? 2000}} - {{expenses}}", + "3. {{income ?? 3000}} - {{expenses}}", + } + } + }.Init(); + + 10000.Times(() => + { + var result = context.EvaluateScript(@"{{#each templates}}{{index}}{{/each}}"); + Assert.That(result, Is.EqualTo("012")); + }); + + Assert.That(context.Cache.Count, Is.EqualTo(1)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CallExpressionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CallExpressionTests.cs new file mode 100644 index 00000000000..5e0d23953cd --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CallExpressionTests.cs @@ -0,0 +1,79 @@ +using System; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class CallExpressionTests + { + [Test] + public void Does_parse_call_expression() + { + JsCallExpression expr; + + "a".AsSpan().ParseJsCallExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsCallExpression(new JsIdentifier("a")))); + "a()".AsSpan().ParseJsCallExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsCallExpression(new JsIdentifier("a")))); + } + + [Test] + public void Can_parse_expressions_with_methods() + { + JsToken token; + + "mod(it,3) != 0".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsBinaryExpression( + new JsCallExpression( + new JsIdentifier("mod"), + new JsIdentifier("it"), + new JsLiteral(3) + ), + JsNotEquals.Operator, + new JsLiteral(0) + ) + )); + + "{ a: add(it % add(it + 1, 1 | it)) }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsObjectExpression( + new JsProperty( + new JsIdentifier("a"), + new JsCallExpression( + new JsIdentifier("add"), + new JsBinaryExpression( + new JsIdentifier("it"), + JsMod.Operator, + new JsCallExpression( + new JsIdentifier("add"), + new JsBinaryExpression( + new JsIdentifier("it"), + JsAddition.Operator, + new JsLiteral(1) + ), + new JsBinaryExpression( + new JsLiteral(1), + JsBitwiseOr.Operator, + new JsIdentifier("it") + ) + ) + ) + ) + ) + ))); + } + + [Test] + public void Does_evaluate_nested_call_expressions() + { + var context = new ScriptContext { + Args = { + ["it"] = 10 + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ { a: add(it % 3,1) * 2, b: 2 * 3 + incr(4 + decr(5)) } |> values |> sum |> currency }}"), + Is.EqualTo("$19.00")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CodeTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CodeTests.cs new file mode 100644 index 00000000000..d72e3569fb2 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CodeTests.cs @@ -0,0 +1,228 @@ +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using ServiceStack.Configuration; +using ServiceStack.IO; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + [Page("foreach-code")] + public class ForEachCodeExample : SharpCodePage + { + public string render(string title, string[] items) => $@" +<h1>{title}</h1> +<ul> + {items.Map(x => $"<li>{x}</li>").Join("")} +</ul> +"; + } + + [Page("dir/foreach-code")] + [PageArg("title", "Dir foreach code")] + public class DirForEachCodeExample : SharpCodePage + { + public string render(string title, string[] items) => $@" +<h1>{title}</h1> +<ul> + {items.Map(x => $"<li>{x}</li>").Join("")} +</ul> +"; + } + + [Page("codepage-dep")] + public class CodePageWithDep : SharpCodePage + { + public IAppSettings AppSettings { get; set; } + + public string render(string key, string content) => $@" +<h2>{AppSettings.GetString(key)}</h2> +<p> + {content} +</p> +"; + } + + public class CodeTests + { + [Test] + public void Can_remove_TemplateContext_defaults() + { + var context = new ScriptContext() + .RemoveFilters(x => true) + .RemoveBlocks(x => true) + .RemovePlugins(x => true) + .Init(); + + Assert.That(context.ScriptMethods.Count, Is.EqualTo(0)); + Assert.That(context.ScriptBlocks.Count, Is.EqualTo(0)); + Assert.That(context.Plugins.Count, Is.EqualTo(0)); + } + + [Test] + public void Can_remove_individual_blocks() + { + var context = new ScriptContext { + OnAfterPlugins = ctx => ctx.RemoveBlocks(x => x.Name == "capture") + } + .Init(); + + Assert.That(context.ScriptBlocks.Any(x => x is CaptureScriptBlock), Is.False); + } + + [Test] + public void Can_execute_CodePage() + { + var context = new ScriptContext + { + Args = + { + ["items"] = new[] {"A", "B", "C"} + }, + ScanTypes = {typeof(ForEachCodeExample)} + }.Init(); + + var page = context.GetCodePage("foreach-code"); + var html = new PageResult(page) + { + Args = + { + ["title"] = "For each code" + } + }.Result; + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<h1>For each code</h1> +<ul> + <li>A</li><li>B</li><li>C</li> +</ul> +".NormalizeNewLines())); + } + + private static void WriteLayouts(ScriptContext context) + { + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<body id=root> +{{ page }} +</body> +</html> +"); + + context.VirtualFiles.WriteFile("dir/_layout.html", @" +<html> +<body id=dir> +{{ page }} +</body> +</html> +"); + } + + [Test] + public void Can_execute_CodePage_with_Layout() + { + var context = new ScriptContext + { + Args = + { + ["items"] = new[] {"A", "B", "C"} + }, + ScanTypes = {typeof(ForEachCodeExample)} + }.Init(); + + WriteLayouts(context); + + var page = context.GetCodePage("foreach-code"); + var html = new PageResult(page) + { + Args = + { + ["title"] = "For each code" + } + }.Result; + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> + +<h1>For each code</h1> +<ul> + <li>A</li><li>B</li><li>C</li> +</ul> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Can_execute_nested_CodePage_with_Layout() + { + var context = new ScriptContext + { + Args = + { + ["items"] = new[] {"A", "B", "C"} + }, + ScanTypes = {typeof(DirForEachCodeExample)} + }.Init(); + + WriteLayouts(context); + + var page = context.GetCodePage("dir/foreach-code"); + var html = new PageResult(page).Result; + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=dir> + +<h1>Dir foreach code</h1> +<ul> + <li>A</li><li>B</li><li>C</li> +</ul> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Can_execute_CodePage_with_Dep() + { + var context = new ScriptContext + { + ScanTypes = {typeof(CodePageWithDep)} + }.Init(); + + WriteLayouts(context); + + context.Container.AddSingleton<IAppSettings>(() => new SimpleAppSettings(new Dictionary<string, string> { + ["foo"] = "bar" + })); + + var page = context.GetCodePage("codepage-dep"); + page.Args["content"] = "The Content"; + + var html = new PageResult(page) + { + Args = + { + ["key"] = "foo" + } + }.Result; + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> + +<h2>bar</h2> +<p> + The Content +</p> + +</body> +</html> +".NormalizeNewLines())); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CustomScriptMethodsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CustomScriptMethodsTests.cs new file mode 100644 index 00000000000..22d328f892d --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/CustomScriptMethodsTests.cs @@ -0,0 +1,53 @@ +using System; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class CustomScriptMethodsTests + { + [Flags] + public enum Options + { + None = 0, + Option1 = 1, + Option2 = 1 << 1, + Option4 = 1 << 2, + } + + public class EnumFilter : ScriptMethods + { + public bool hasOptionsFlag(Options source, Options value) => source.HasFlag(value); + } + + [Test] + public void Can_access_flag_enums() + { + var context = new ScriptContext + { + ScriptMethods = {new EnumFilter()}, + Args = + { + ["options0"] = Options.None, + ["options1"] = Options.Option1, + ["options2"] = Options.Option2, + ["options4"] = Options.Option4, + ["options3"] = (Options.Option1 | Options.Option2) + } + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ hasOptionsFlag(options3, 'Option1') }}"), + Is.EqualTo("True")); + + Assert.That(context.EvaluateScript(@"{{ hasFlag(options3, 'Option1') }},{{ hasFlag(options3, 1) }},{{ hasFlag(options3, options1) }}"), + Is.EqualTo("True,True,True")); + Assert.That(context.EvaluateScript(@"{{ hasFlag(options3, 'Option4') }},{{ hasFlag(options3, 4) }},{{ hasFlag(options3, options4) }}"), + Is.EqualTo("False,False,False")); + + Assert.That(context.EvaluateScript(@"{{ isEnum(options1, 'Option1') }},{{ isEnum(options1, 1) }},{{ isEnum(options1, options1) }}"), + Is.EqualTo("True,True,True")); + Assert.That(context.EvaluateScript(@"{{ isEnum(options3, 'Option1') }},{{ isEnum(options3, 1) }},{{ isEnum(options3, options1) }}"), + Is.EqualTo("False,False,False")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/DefaultScriptsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/DefaultScriptsTests.cs new file mode 100644 index 00000000000..6e474859094 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/DefaultScriptsTests.cs @@ -0,0 +1,2121 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Globalization; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Logging; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class DefaultScriptsTests + { + public ScriptContext CreateContext(Dictionary<string, object> args = null) + { + var context = new ScriptContext + { + Args = + { + ["foo"] = "bar", + ["intVal"] = 1, + ["doubleVal"] = 2.2 + } + }.Init(); + + args.Each((key,val) => context.Args[key] = val); + + return context; + } + + [Test] + public async Task Does_default_filter_raw() + { + var context = CreateContext(); + context.VirtualFiles.WriteFile("page.html", "<h1>{{ '<script>' }}</h1>"); + context.VirtualFiles.WriteFile("page-raw.html", "<h1>{{ '<script>' |> raw }}</h1>"); + + var result = await new PageResult(context.GetPage("page")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("<h1>&lt;script&gt;</h1>")); + + result = await new PageResult(context.GetPage("page-raw")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("<h1><script></h1>")); + } + + [Test] + public async Task Does_default_filter_json() + { + var context = CreateContext(); + context.VirtualFiles.WriteFile("page.html", "var model = {{ model |> json }};"); + + var result = await new PageResult(context.GetPage("page")) + { + Model = new Model + { + Id = 1, + Name = "foo" + } + }.RenderToStringAsync(); + + Assert.That(result, Is.EqualTo("var model = {\"Id\":1,\"Name\":\"foo\"};")); + + result = await new PageResult(context.GetPage("page")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("var model = null;")); + + context.VirtualFiles.WriteFile("page-null.html", "var nil = {{ null |> json }};"); + result = await new PageResult(context.GetPage("page-null")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("var nil = null;")); + } + + [Test] + public void Can_quote_strings() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 'single quotes' }} +{{ ""double quotes"" }} +{{ `backticks` }} +{{ ′prime quoutes′ }} +".NormalizeNewLines()), Is.EqualTo(@" +single quotes +double quotes +backticks +prime quoutes +".NormalizeNewLines())); + } + + [Test] + public void Can_escape_strings() + { + var context = new ScriptContext + { + Args = + { + ["json"] = "{\"key\":\"single'back`tick\"}", + ["prime"] = "{\"key\":\"single'prime′quote\"}", + ["hasNewLines"] = "has\nnew\r\nlines" + } + }.Init(); + + Assert.That(context.EvaluateScript("var s = '{{ json |> escapeSingleQuotes |> raw }}'"), Is.EqualTo("var s = '{\"key\":\"single\\'back`tick\"}'")); + Assert.That(context.EvaluateScript("var s = `{{ json |> escapeBackticks |> raw }}`"), Is.EqualTo("var s = `{\"key\":\"single'back\\`tick\"}`")); + Assert.That(context.EvaluateScript("var s = ′{{ prime |> escapePrimeQuotes |> raw }}′"), Is.EqualTo("var s = ′{\"key\":\"single'prime\\′quote\"}′")); + Assert.That(context.EvaluateScript("var s = '{{ json |> jsString }}'"), Is.EqualTo("var s = '{\"key\":\"single\\'back`tick\"}'")); + Assert.That(context.EvaluateScript("var s = {{ json |> jsQuotedString }}"), Is.EqualTo("var s = '{\"key\":\"single\\'back`tick\"}'")); + + Assert.That(context.EvaluateScript("var s = '{{ hasNewLines |> jsString }}'"), Is.EqualTo(@"var s = 'has\nnew\r\nlines'")); + + Assert.That(context.EvaluateScript(@"{{ [{x:1,y:2},{x:3,y:4}] |> json |> assignTo:json }}var s = '{{ json |> jsString }}';"), + Is.EqualTo("var s = '[{\"x\":1,\"y\":2},{\"x\":3,\"y\":4}]';")); + + Assert.That(context.EvaluateScript(@"{{ `[ + {""name"":""Mc Donald's""} +]` |> raw |> assignTo:json }} +var obj = {{ json }}; +var str = '{{ json |> jsString }}'; +var str = {{ json |> jsQuotedString }}; +var escapeSingle = '{{ ""single' quote's"" |> escapeSingleQuotes |> escapeNewLines |> raw }}'; +var escapeDouble = ""{{ 'double"" quote""s' |> escapeDoubleQuotes |> escapeNewLines |> raw }}""; +".NormalizeNewLines()), Is.EqualTo(@" +var obj = [ + {""name"":""Mc Donald's""} +]; +var str = '[\n {""name"":""Mc Donald\'s""}\n]'; +var str = '[\n {""name"":""Mc Donald\'s""}\n]'; +var escapeSingle = 'single\' quote\'s'; +var escapeDouble = ""double\"" quote\""s""; +".NormalizeNewLines())); + + } + + [Test] + public async Task Does_default_filter_appSetting() + { + var context = CreateContext().Init(); + context.AppSettings.Set("copyright", "&copy; 2008-2017 ServiceStack"); + context.VirtualFiles.WriteFile("page.html", "<footer>{{ 'copyright' |> appSetting |> raw }}</footer>"); + + var result = await new PageResult(context.GetPage("page")).RenderToStringAsync(); + + Assert.That(result, Is.EqualTo("<footer>&copy; 2008-2017 ServiceStack</footer>")); + } + + [Test] + public async Task Does_default_filter_arithmetic_using_filter() + { + var context = CreateContext().Init(); + context.VirtualFiles.WriteFile("page.html", @" +1 + 1 = {{ 1 |> add(1) }} +2 x 2 = {{ 2 |> mul(2) }} or {{ 2 |> multiply(2) }} +3 - 3 = {{ 3 |> sub(3) }} or {{ 3 |> subtract(3) }} +4 / 4 = {{ 4 |> div(4) }} or {{ 4 |> divide(4) }}"); + + var result = await new PageResult(context.GetPage("page")).RenderToStringAsync(); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +1 + 1 = 2 +2 x 2 = 4 or 4 +3 - 3 = 0 or 0 +4 / 4 = 1 or 1 +".NormalizeNewLines())); + } + + [Test] + public async Task Does_default_filter_arithmetic_using_pipeline_operator() + { + var context = CreateContext().Init(); + context.VirtualFiles.WriteFile("page.html", @" +1 + 1 = {{ 1 |> add(1) }} +2 x 2 = {{ 2 |> mul(2) }} or {{ 2 |> multiply(2) }} +3 - 3 = {{ 3 |> sub(3) }} or {{ 3 |> subtract(3) }} +4 / 4 = {{ 4 |> div(4) }} or {{ 4 |> divide(4) }}"); + + var result = await new PageResult(context.GetPage("page")).RenderToStringAsync(); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +1 + 1 = 2 +2 x 2 = 4 or 4 +3 - 3 = 0 or 0 +4 / 4 = 1 or 1 +".NormalizeNewLines())); + } + + [Test] + public async Task Does_default_filter_arithmetic_without_filter() + { + var context = CreateContext().Init(); + context.VirtualFiles.WriteFile("page.html", @" +1 + 1 = {{ add(1,1) }} +2 x 2 = {{ mul(2,2) }} or {{ multiply(2,2) }} +3 - 3 = {{ sub(3,3) }} or {{ subtract(3,3) }} +4 / 4 = {{ div(4,4) }} or {{ divide(4,4) }}"); + + var html = await new PageResult(context.GetPage("page")).RenderToStringAsync(); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +1 + 1 = 2 +2 x 2 = 4 or 4 +3 - 3 = 0 or 0 +4 / 4 = 1 or 1 +".NormalizeNewLines())); + } + + [Test] + public void Can_use_default_filter_arithmetic_with_shorthand_notation() + { + var context = new ScriptContext + { + Args = + { + ["num"] = 1 + } + }.Init(); + + context.VirtualFiles.WriteFile("page.html", @" +{{ num |> add(9) |> assignTo('ten') }} +square = {{ 'square-partial' |> partial({ ten }) }} +"); + + context.VirtualFiles.WriteFile("square-partial.html", "{{ ten }} x {{ ten }} = {{ ten |> multiply(ten) }}"); + + Assert.That(new PageResult(context.GetPage("page")).Result.NormalizeNewLines(), Is.EqualTo(@" +square = 10 x 10 = 100".NormalizeNewLines())); + } + + [Test] + public void Can_increment_and_decrement() + { + var context = new ScriptContext + { + Args = + { + ["ten"] = 10 + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 1 |> incr }}")).Result, Is.EqualTo("2")); + Assert.That(new PageResult(context.OneTimePage("{{ ten |> incr }}")).Result, Is.EqualTo("11")); + Assert.That(new PageResult(context.OneTimePage("{{ 1 |> incrBy(2) }}")).Result, Is.EqualTo("3")); + Assert.That(new PageResult(context.OneTimePage("{{ ten |> incrBy(2) }}")).Result, Is.EqualTo("12")); + Assert.That(new PageResult(context.OneTimePage("{{ incr(1) }}")).Result, Is.EqualTo("2")); + Assert.That(new PageResult(context.OneTimePage("{{ incr(ten) }}")).Result, Is.EqualTo("11")); + Assert.That(new PageResult(context.OneTimePage("{{ incrBy(ten,2) }}")).Result, Is.EqualTo("12")); + + Assert.That(new PageResult(context.OneTimePage("{{ 1 |> decr }}")).Result, Is.EqualTo("0")); + Assert.That(new PageResult(context.OneTimePage("{{ ten |> decrBy(2) }}")).Result, Is.EqualTo("8")); + } + + [Test] + public void Can_increment_and_decrement_pipeline_operator() + { + var context = new ScriptContext + { + Args = + { + ["ten"] = 10 + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 1 |> incr }}")).Result, Is.EqualTo("2")); + Assert.That(new PageResult(context.OneTimePage("{{ ten |> incr }}")).Result, Is.EqualTo("11")); + Assert.That(new PageResult(context.OneTimePage("{{ 1 |> incrBy(2) }}")).Result, Is.EqualTo("3")); + Assert.That(new PageResult(context.OneTimePage("{{ ten |> incrBy(2) }}")).Result, Is.EqualTo("12")); + Assert.That(new PageResult(context.OneTimePage("{{ 1 |> decr }}")).Result, Is.EqualTo("0")); + Assert.That(new PageResult(context.OneTimePage("{{ ten |> decrBy(2) }}")).Result, Is.EqualTo("8")); + } + + [Test] + public void Can_compare_numbers() + { + var context = new ScriptContext + { + Args = + { + ["two"] = 2 + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 2 |> greaterThan(1) }}")).Result, Is.EqualTo("True")); + Assert.That(new PageResult(context.OneTimePage("{{ two |> greaterThan(1) }}")).Result, Is.EqualTo("True")); + Assert.That(new PageResult(context.OneTimePage("{{ greaterThan(two,1) }}")).Result, Is.EqualTo("True")); + Assert.That(new PageResult(context.OneTimePage("{{ greaterThan(2,2) }}")).Result, Is.EqualTo("False")); + Assert.That(new PageResult(context.OneTimePage("{{ greaterThan(two,2) }}")).Result, Is.EqualTo("False")); + Assert.That(new PageResult(context.OneTimePage("{{ greaterThan(two,two) }}")).Result, Is.EqualTo("False")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'two > 1' |> if(gt(two,1)) |> raw }}")).Result, Is.EqualTo("two > 1")); + Assert.That(new PageResult(context.OneTimePage("{{ 'two > 2' |> if(greaterThan(two,2)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'two > 3' |> if(greaterThan(two,3)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'two > two' |> if(greaterThan(two,two)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'two >= two' |> if(greaterThanEqual(two,two)) |> raw }}")).Result, Is.EqualTo("two >= two")); + + Assert.That(new PageResult(context.OneTimePage("{{ '1 >= 2' |> if(greaterThanEqual(1,2)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 >= 2' |> if(greaterThanEqual(2,2)) |> raw }}")).Result, Is.EqualTo("2 >= 2")); + Assert.That(new PageResult(context.OneTimePage("{{ '3 >= 2' |> if(greaterThanEqual(3,2)) |> raw }}")).Result, Is.EqualTo("3 >= 2")); + + Assert.That(new PageResult(context.OneTimePage("{{ '1 > 2' |> if(greaterThan(1,2)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 > 2' |> if(greaterThan(2,2)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ '3 > 2' |> if(greaterThan(3,2)) |> raw }}")).Result, Is.EqualTo("3 > 2")); + + Assert.That(new PageResult(context.OneTimePage("{{ '1 <= 2' |> if(lessThanEqual(1,2)) |> raw }}")).Result, Is.EqualTo("1 <= 2")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 <= 2' |> if(lessThanEqual(2,2)) |> raw }}")).Result, Is.EqualTo("2 <= 2")); + Assert.That(new PageResult(context.OneTimePage("{{ '3 <= 2' |> if(lessThanEqual(3,2)) }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ '1 < 2' |> if(lessThan(1,2)) |> raw }}")).Result, Is.EqualTo("1 < 2")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 < 2' |> if(lessThan(2,2)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ '3 < 2' |> if(lessThan(3,2)) }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ '2 > 2' |> if(gt(2,2)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 >= 2' |> if(gte(2,2)) |> raw }}")).Result, Is.EqualTo("2 >= 2")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 <= 2' |> if(lte(2,2)) |> raw }}")).Result, Is.EqualTo("2 <= 2")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 < 2' |> if(lt(2,2)) }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ '2 == 2' |> if(equals(2,2)) }}")).Result, Is.EqualTo("2 == 2")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 == 2' |> if(eq(2,2)) }}")).Result, Is.EqualTo("2 == 2")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 != 2' |> if(notEquals(2,2)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ '2 != 2' |> if(not(2,2)) }}")).Result, Is.EqualTo("")); + } + + [Test] + public void Can_compare_strings() + { + var context = new ScriptContext + { + Args = + { + ["foo"] = "foo", + ["bar"] = "bar" + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 'foo > \"foo\"' |> if(gt(foo,\"foo\")) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'foo >= \"foo\"' |> if(gte(foo,\"foo\")) |> raw }}")).Result, Is.EqualTo("foo >= \"foo\"")); + Assert.That(new PageResult(context.OneTimePage("{{ 'foo <= \"foo\"' |> if(lte(foo,\"foo\")) |> raw }}")).Result, Is.EqualTo("foo <= \"foo\"")); + Assert.That(new PageResult(context.OneTimePage("{{ 'foo < \"foo\"' |> if(lt(foo,\"foo\")) }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'bar > \"foo\"' |> if(gt(bar,\"foo\")) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'bar >= \"foo\"' |> if(gte(bar,\"foo\")) |> raw }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'bar <= \"foo\"' |> if(lte(bar,\"foo\")) |> raw }}")).Result, Is.EqualTo("bar <= \"foo\"")); + Assert.That(new PageResult(context.OneTimePage("{{ 'bar < \"foo\"' |> if(lt(bar,\"foo\")) |> raw }}")).Result, Is.EqualTo("bar < \"foo\"")); + } + + [Test] + public void Can_compare_DateTime() + { + var context = new ScriptContext + { + Args = + { + ["year2000"] = new DateTime(2000,1,1), + ["year2100"] = new DateTime(2100,1,1) + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 'now > year2000' |> if(gt(now,year2000)) |> raw }}")).Result, Is.EqualTo("now > year2000")); + Assert.That(new PageResult(context.OneTimePage("{{ 'now >= year2000' |> if(gte(now,year2000)) |> raw }}")).Result, Is.EqualTo("now >= year2000")); + Assert.That(new PageResult(context.OneTimePage("{{ 'now <= year2000' |> if(lte(now,year2000)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'now < year2000' |> if(lt(now,year2000)) }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'now > year2100' |> if(gt(now,year2100)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'now >= year2100' |> if(gte(now,year2100)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'now <= year2100' |> if(lte(now,year2100)) |> raw }}")).Result, Is.EqualTo("now <= year2100")); + Assert.That(new PageResult(context.OneTimePage("{{ 'now < year2100' |> if(lt(now,year2100)) |> raw }}")).Result, Is.EqualTo("now < year2100")); + + Assert.That(new PageResult(context.OneTimePage("{{ '\"2001-01-01\" > year2100' |> if(gt(\"2001-01-01\",year2100)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ '\"2001-01-01\" >= year2100' |> if(gte(\"2001-01-01\",year2100)) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ '\"2001-01-01\" <= year2100' |> if(lte(\"2001-01-01\",year2100)) |> raw }}")).Result, Is.EqualTo("\"2001-01-01\" <= year2100")); + Assert.That(new PageResult(context.OneTimePage("{{ '\"2001-01-01\" < year2100' |> if(lt(\"2001-01-01\",year2100)) |> raw }}")).Result, Is.EqualTo("\"2001-01-01\" < year2100")); + } + + [Test] + public void Can_use_logical_boolean_operators() + { + var context = new ScriptContext + { + Args = + { + ["foo"] = "foo", + ["bar"] = "bar", + ["year2000"] = new DateTime(2000,1,1), + ["year2100"] = new DateTime(2100,1,1), + ["contextTrue"] = true, + ["contextFalse"] = false + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 'OR(true,true)' |> if(OR(true,true)) |> raw }}")).Result, Is.EqualTo("OR(true,true)")); + Assert.That(new PageResult(context.OneTimePage("{{ 'OR(true,false)' |> if(OR(true,false)) |> raw }}")).Result, Is.EqualTo("OR(true,false)")); + Assert.That(new PageResult(context.OneTimePage("{{ 'OR(false,false)' |> if(OR(false,false)) |> raw }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'AND(true,true)' |> if(AND(true,true)) |> raw }}")).Result, Is.EqualTo("AND(true,true)")); + Assert.That(new PageResult(context.OneTimePage("{{ 'AND(true,false)' |> if(AND(true,false)) |> raw }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'AND(false,false)' |> if(AND(false,false)) |> raw }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'OR(contextTrue,contextTrue)' |> if(OR(contextTrue,contextTrue)) |> raw }}")).Result, Is.EqualTo("OR(contextTrue,contextTrue)")); + Assert.That(new PageResult(context.OneTimePage("{{ 'OR(contextTrue,contextFalse)' |> if(OR(contextTrue,contextFalse)) |> raw }}")).Result, Is.EqualTo("OR(contextTrue,contextFalse)")); + Assert.That(new PageResult(context.OneTimePage("{{ 'OR(contextFalse,contextFalse)' |> if(OR(contextFalse,contextFalse)) |> raw }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'OR(gt(now,year2000),eq(\"foo\",bar))' |> if(OR(gt(now,year2000),eq(\"foo\",bar))) |> raw }}")).Result, + Is.EqualTo("OR(gt(now,year2000),eq(\"foo\",bar))")); + + Assert.That(new PageResult(context.OneTimePage(@"{{ 'OR(gt(now,year2000),eq(""foo"",bar))' |> + if ( + OR ( + gt ( now, year2000 ), + eq ( ""foo"", bar ) + ) + ) |> raw }}")).Result, + Is.EqualTo("OR(gt(now,year2000),eq(\"foo\",bar))")); + + + Assert.That(new PageResult(context.OneTimePage(@"{{ 'OR(AND(gt(now,year2000),eq(""foo"",bar)),AND(gt(now,year2000),eq(""foo"",foo)))' |> + if ( + OR ( + AND ( + gt ( now, year2000 ), + eq ( ""foo"", bar ) + ), + AND ( + gt ( now, year2000 ), + eq ( ""foo"", foo ) + ) + ) + ) |> raw }}")).Result, + Is.EqualTo(@"OR(AND(gt(now,year2000),eq(""foo"",bar)),AND(gt(now,year2000),eq(""foo"",foo)))")); + } + + [Test] + public async Task Does_default_filter_arithmetic_chained_filters() + { + var context = CreateContext().Init(); + + Assert.That((((1 + 2) * 3) / 4) - 5, Is.EqualTo(- 3)); + Assert.That((((1 + 2) * 3) / 4d) - 5, Is.EqualTo(-2.75)); + Assert.That(1 + 2 * 3 / 4 - 5, Is.EqualTo(-3)); + Assert.That(1 + 2 * 3 / 4d - 5, Is.EqualTo(-2.5)); + + context.VirtualFiles.WriteFile("page-chained.html", + @"(((1 + 2) * 3) / 4) - 5 = {{ 1 |> add(2) |> multiply(3) |> divide(4) |> subtract(5) }}"); + var result = await new PageResult(context.GetPage("page-chained")).RenderToStringAsync(); + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@"(((1 + 2) * 3) / 4) - 5 = -2.75".NormalizeNewLines())); + + context.VirtualFiles.WriteFile("page-ordered.html", + @"1 + 2 * 3 / 4 - 5 = {{ 1 |> add( divide(multiply(2,3), 4) ) |> subtract(5) }}"); + result = await new PageResult(context.GetPage("page-ordered")).RenderToStringAsync(); + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@"1 + 2 * 3 / 4 - 5 = -2.5".NormalizeNewLines())); + } + + [Test] + public async Task Does_default_filter_currency() + { + var context = CreateContext().Init(); + context.Args[nameof(ScriptConfig.DefaultCulture)] = new CultureInfo("en-US"); + + context.VirtualFiles.WriteFile("page-default.html", "Cost: {{ 99.99 |> currency }}"); + context.VirtualFiles.WriteFile("page-culture.html", "Cost: {{ 99.99 |> currency(culture) |> raw }}"); + + var result = await new PageResult(context.GetPage("page-default")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("Cost: $99.99")); + + result = await new PageResult(context.GetPage("page-culture")) {Args = {["culture"] = "en-AU"}}.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("Cost: $99.99")); + + result = await new PageResult(context.GetPage("page-culture")) {Args = {["culture"] = "en-GB"}}.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("Cost: £99.99")); + + result = await new PageResult(context.GetPage("page-culture")) {Args = {["culture"] = "fr-FR"}}.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("Cost: 99,99 €")); + } + + [Test] + public async Task Does_default_filter_format() + { + var context = CreateContext().Init(); + context.VirtualFiles.WriteFile("page.html", "{{ 3.14159 |> format('N2') }}"); + + var result = await new PageResult(context.GetPage("page")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("3.14")); + } + + [Test] + public async Task Does_default_filter_dateFormat() + { + var context = CreateContext().Init(); + context.VirtualFiles.WriteFile("dateFormat-default.html", "{{ date |> dateFormat }}"); + context.VirtualFiles.WriteFile("dateFormat-custom.html", "{{ date |> dateFormat(format) }}"); + + var result = await new PageResult(context.GetPage("dateFormat-default")) + { + Args = { ["date"] = new DateTime(2001,01,01,1,1,1,1, DateTimeKind.Utc) } + }.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("2001-01-01")); + + context.Args[ScriptConstants.DefaultDateFormat] = "dd/MM/yyyy"; + result = await new PageResult(context.GetPage("dateFormat-default")) + { + Args = { ["date"] = new DateTime(2001,01,01,1,1,1,1, DateTimeKind.Utc) } + }.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("01/01/2001")); + + result = await new PageResult(context.GetPage("dateFormat-custom")) + { + Args = + { + ["date"] = new DateTime(2001,01,01,1,1,1,1, DateTimeKind.Utc), + ["format"] = "dd.MM.yyyy" + } + }.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("01.01.2001")); + } + + [Test] + public void Does_default_time_format() + { + var context = new ScriptContext + { + Args = + { + ["time"] = new TimeSpan(1,2,3,4,5), + ["date"] = new DateTime(2001,2,3,4,5,6,7) + } + }.Init(); + + var result = context.EvaluateScript("Time: {{ time |> timeFormat }}"); + Assert.That(result, Is.EqualTo("Time: 2:03:04")); + + result = context.EvaluateScript("Time: {{ time |> timeFormat('g') }}"); + Assert.That(result, Is.EqualTo("Time: 1:2:03:04.005")); + + result = context.EvaluateScript("Time: {{ date.TimeOfDay |> timeFormat('g') }}"); + Assert.That(result, Is.EqualTo("Time: 4:05:06.007")); + + // Normal quoted strings pass string verbatim + result = context.EvaluateScript(@"Time: {{ date.TimeOfDay |> timeFormat(′h\:mm\:ss′) }}"); + Assert.That(result, Is.EqualTo("Time: 4:05:06")); + + // Template literals unescapes strings + result = context.EvaluateScript(@"Time: {{ date.TimeOfDay |> timeFormat(`h\\:mm\\:ss`) }}"); + Assert.That(result, Is.EqualTo("Time: 4:05:06")); + } + + [Test] + public void Does_unescape_string() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{′′}}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{``}}"), Is.EqualTo("")); + + // `backticks` unescape strings, all other quoted strings use verbatim strings + Assert.That(context.EvaluateScript(@"{{′\ ′[0] |> toCharCode}}"), Is.EqualTo("92")); //= [\] + Assert.That(context.EvaluateScript(@"{{`\ `[0] |> toCharCode}}"), Is.EqualTo("32")); //= [ ] + Assert.That(context.EvaluateScript(@"{{`\\` |> toCharCode}}"), Is.EqualTo("92")); //= [/] + + Assert.That(context.EvaluateScript("{{′\n′}}"), Is.EqualTo("\n")); + Assert.That(context.EvaluateScript("{{`a\nb`}}"), Is.EqualTo("a\nb")); + Assert.That(context.EvaluateScript("{{′\"′|raw}}"), Is.EqualTo("\"")); + Assert.That(context.EvaluateScript("{{`\"`|raw}}"), Is.EqualTo("\"")); + } + + [Test] + public async Task Does_default_filter_dateTimeFormat() + { + var context = CreateContext().Init(); + context.VirtualFiles.WriteFile("dateTimeFormat-default.html", "{{ date |> dateTimeFormat }}"); + context.VirtualFiles.WriteFile("dateTimeFormat-custom.html", "{{ date |> dateFormat(format) }}"); + + var result = await new PageResult(context.GetPage("dateTimeFormat-default")) + { + Args = { ["date"] = new DateTime(2001,01,01,1,1,1,1, DateTimeKind.Utc) } + }.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("2001-01-01 01:01:01Z")); + + context.Args[ScriptConstants.DefaultDateTimeFormat] = "dd/MM/yyyy hh:mm"; + result = await new PageResult(context.GetPage("dateTimeFormat-default")) + { + Args = { ["date"] = new DateTime(2001,01,01,1,1,1,1, DateTimeKind.Utc) } + }.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("01/01/2001 01:01")); + + result = await new PageResult(context.GetPage("dateTimeFormat-custom")) + { + Args = + { + ["date"] = new DateTime(2001,01,01,1,1,1,1, DateTimeKind.Utc), + ["format"] = "dd.MM.yyyy hh.mm.ss" + } + }.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("01.01.2001 01.01.01")); + } + + [Test] + public void Does_default_spaces_and_indents() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ indent }}"), Is.EqualTo("\t")); + Assert.That(context.EvaluateScript("{{ 4 |> indents }}"), Is.EqualTo("\t\t\t\t")); + + Assert.That(context.EvaluateScript("{{ space }}"), Is.EqualTo(" ")); + Assert.That(context.EvaluateScript("{{ 4 |> spaces }}"), Is.EqualTo(" ")); + + Assert.That(context.EvaluateScript("{{ 4 |> repeating(' ') }}"), Is.EqualTo(" ")); + Assert.That(context.EvaluateScript("{{ ' ' |> repeat(4) }}"), Is.EqualTo(" ")); + Assert.That(context.EvaluateScript("{{ '.' |> repeat(3) }}"), Is.EqualTo("...")); + + var newLine = Environment.NewLine; + Assert.That(context.EvaluateScript("{{ newLine }}"), Is.EqualTo(newLine)); + Assert.That(context.EvaluateScript("{{ 4 |> newLines }}"), Is.EqualTo(newLine + newLine + newLine + newLine)); + + context = new ScriptContext + { + Args = + { + [ScriptConstants.DefaultIndent] = " ", + [ScriptConstants.DefaultNewLine] = "\n" + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ indent }}"), Is.EqualTo(" ")); + Assert.That(context.EvaluateScript("{{ 4 |> newLines }}"), Is.EqualTo("\n\n\n\n")); + } + + [Test] + public async Task Does_default_filter_string_filters() + { + var context = CreateContext().Init(); + + context.VirtualFiles.WriteFile("page-humanize.html", "{{ 'a_varName' |> humanize }}"); + var result = await new PageResult(context.GetPage("page-humanize")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("A Var Name")); + + context.VirtualFiles.WriteFile("page-titleCase.html", "{{ 'war and peace' |> titleCase }}"); + result = await new PageResult(context.GetPage("page-titleCase")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("War And Peace")); + + context.VirtualFiles.WriteFile("page-lower.html", "{{ 'Title Case' |> lower }}"); + result = await new PageResult(context.GetPage("page-lower")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("title case")); + + context.VirtualFiles.WriteFile("page-upper.html", "{{ 'Title Case' |> upper }}"); + result = await new PageResult(context.GetPage("page-upper")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("TITLE CASE")); + + context.VirtualFiles.WriteFile("page-pascalCase.html", "{{ 'camelCase' |> pascalCase }}"); + result = await new PageResult(context.GetPage("page-pascalCase")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("CamelCase")); + + context.VirtualFiles.WriteFile("page-camelCase.html", "{{ 'PascalCase' |> camelCase }}"); + result = await new PageResult(context.GetPage("page-camelCase")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("pascalCase")); + + context.VirtualFiles.WriteFile("page-substring.html", "{{ 'This is a short sentence' |> substring(8) }}... {{ 'These three words' |> substring(6,5) }}"); + result = await new PageResult(context.GetPage("page-substring")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("a short sentence... three")); + + context.VirtualFiles.WriteFile("page-pad.html", "<h1>{{ '7' |> padLeft(3) }}</h1><h2>{{ 'tired' |> padRight(10) }}</h2>"); + result = await new PageResult(context.GetPage("page-pad")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("<h1> 7</h1><h2>tired </h2>")); + + context.VirtualFiles.WriteFile("page-padchar.html", "<h1>{{ '7' |> padLeft(3,'0') }}</h1><h2>{{ 'tired' |> padRight(10,'z') }}</h2>"); + result = await new PageResult(context.GetPage("page-padchar")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("<h1>007</h1><h2>tiredzzzzz</h2>")); + + context.VirtualFiles.WriteFile("page-repeat.html", "<h1>long time ago{{ ' ...' |> repeat(3) }}</h1>"); + result = await new PageResult(context.GetPage("page-repeat")).RenderToStringAsync(); + Assert.That(result, Is.EqualTo("<h1>long time ago ... ... ...</h1>")); + } + + [Test] + public void Does_default_filter_with_no_args() + { + var context = CreateContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ now |> dateFormat('yyyy-MM-dd') }}")).Result, Is.EqualTo(DateTime.Now.ToString("yyyy-MM-dd"))); + Assert.That(new PageResult(context.OneTimePage("{{ utcNow |> dateFormat('yyyy-MM-dd') }}")).Result, Is.EqualTo(DateTime.UtcNow.ToString("yyyy-MM-dd"))); + } + + [Test] + public void Can_build_urls_using_filters() + { + var context = CreateContext(new Dictionary<string, object>{ {"baseUrl", "http://example.org" }}).Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ baseUrl |> addPaths(['customers',1,'orders']) |> raw }}")).Result, + Is.EqualTo("http://example.org/customers/1/orders")); + + Assert.That(new PageResult(context.OneTimePage("{{ baseUrl |> addQueryString({ id: 1, foo: 'bar' }) |> raw }}")).Result, + Is.EqualTo("http://example.org?id=1&foo=bar")); + + Assert.That(new PageResult(context.OneTimePage("{{ baseUrl |> addQueryString({ id: 1, foo: 'bar' }) |> addHashParams({ hash: 'value' }) |> raw }}")).Result, + Is.EqualTo("http://example.org?id=1&foo=bar#hash=value")); + } + + [Test] + public void Can_build_urls_using_empty_strings() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ '' |> addQueryString({ redirect:null }) }}"), + Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ '/' |> addQueryString({ redirect:null }) }}"), + Is.EqualTo("/")); + } + + [Test] + public void Can_assign_result_to_variable() + { + string result; + var context = new ScriptContext + { + Args = + { + ["num"] = 1, + ["items"] = new[]{ "foo", "bar", "qux" } + }, + FilterTransformers = + { + ["markdown"] = MarkdownPageFormat.TransformToHtml + } + }.Init(); + + result = new PageResult(context.OneTimePage(@" +{{ num |> incr |> assignTo('result') }} +result={{ result }} +")).Result; + Assert.That(result.NormalizeNewLines(), Is.EqualTo("result=2")); + + result = new PageResult(context.OneTimePage(@" +{{ '<li> {{it}} </li>' |> selectEach(items) |> assignTo('result') }} +<ul>{{ result |> raw }}</ul> +")).Result; + Assert.That(result.NormalizeNewLines(), Is.EqualTo("<ul><li> foo </li><li> bar </li><li> qux </li></ul>")); + + result = new PageResult(context.OneTimePage(@" +{{ ' - {{it}}' |> appendLine |> selectEach(items) |> markdown |> assignTo('result') }} +<div>{{ result |> raw }}</div> +")).Result; + Assert.That(result.NormalizeNewLines(), Is.EqualTo("<div><ul>\n<li>foo</li>\n<li>bar</li>\n<li>qux</li>\n</ul>\n</div>")); + + ConsoleLogFactory.Configure(); + result = new PageResult(context.OneTimePage(@" +{{ ' - {{it}}' |> appendLine |> selectEach(items) |> markdown |> assignTo('result') }} +<div>{{ result |> raw }}</div> +")).Result; + Assert.That(result.NormalizeNewLines(), Is.EqualTo("<div><ul>\n<li>foo</li>\n<li>bar</li>\n<li>qux</li>\n</ul>\n</div>")); + } + + [Test] + public void Can_assign_to_array_index() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ [1,2,3,4,5] |> assignTo: numbers }} +{{ numbers |> do: assign('numbers[index]', multiply(numbers[index], numbers[index])) }} +{{ numbers |> join }}").Trim(), Is.EqualTo("1,4,9,16,25")); + + Assert.That(context.EvaluateScript(@" +{{ [1,2,3,4,5] |> assignTo: numbers }} +{{ numbers |> do: assign('numbers[index]', numbers[index] * numbers[index]) }} +{{ numbers |> join }}").Trim(), Is.EqualTo("1,4,9,16,25")); + } + + [Test] + public void Can_assign_to_array_index_with_arrow_function() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ [1,2,3,4,5] |> assignTo => numbers }} +{{ numbers |> do => assign('numbers[index]', numbers[index] * numbers[index]) }} +{{ numbers |> join }}").Trim(), Is.EqualTo("1,4,9,16,25")); + + Assert.That(context.EvaluateScript(@" +{{ [1,2,3,4,5] |> assignTo => numbers }} +{{ numbers |> do => assign(`num${index}`, it * it) }} +{{ num0 }},{{ num1 }},{{ num2 }},{{ num3 }},{{ num4 }}").Trim(), Is.EqualTo("1,4,9,16,25")); + } + + [Test] + public void Can_assign_to_variables_in_partials() + { + var context = new ScriptContext + { + Args = + { + ["num"] = 1 + } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<body> +<header> +layout num = {{ num }} +pageMetaTitle = {{ pageMetaTitle }} +inlinePageTitle = {{ inlinePageTitle }} +pageResultTitle = {{ pageResultTitle }} +</header> +{{ 'add-partial' |> partial({ num: 100 }) }} +{{ page }} +{{ 'add-partial' |> partial({ num: 400 }) }} +<footer> +layout num = {{ num }} +inlinePageTitle = {{ inlinePageTitle }} +</footer> +</body> +</html> +"); + + context.VirtualFiles.WriteFile("page.html", @" +<!-- +pageMetaTitle: page meta title +--> +<section> +{{ 'page inline title' |> upper |> assignTo('inlinePageTitle') }} +{{ 'add-partial' |> partial({ num: 200 }) }} +{{ num |> add(1) |> assignTo('num') }} +<h2>page num = {{ num }}</h2> +{{ 'add-partial' |> partial({ num: 300 }) }} +</section>"); + + context.VirtualFiles.WriteFile("add-partial.html", @" +{{ num |> add(10) |> assignTo('num') }} +<h3>partial num = {{ num }}</h3>"); + + var result = new PageResult(context.GetPage("page")) + { + Args = + { + ["pageResultTitle"] = "page result title" + } + }.Result; + + /* NOTES: + 1. Page Args and Page Result Args are *always* visible to Layout as they're known before page is executed + 2. Args created during Page execution are *only* visible in Layout after page is rendered (i.e. executed) + 3. Args assigned in partials are retained within their scope + */ + + Assert.That(result.RemoveNewLines(), Is.EqualTo(@" +<html> +<body> +<header> +layout num = 1 +pageMetaTitle = page meta title +inlinePageTitle = +pageResultTitle = page result title +</header> +<h3>partial num = 110</h3> +<section> +<h3>partial num = 210</h3> +<h2>page num = 2</h2> +<h3>partial num = 310</h3> +</section> +<h3>partial num = 410</h3> +<footer> +layout num = 2 +inlinePageTitle = PAGE INLINE TITLE +</footer> +</body> +</html> +".RemoveNewLines())); + } + + [Test] + public void Does_not_select_template_with_null_target() + { + var context = new ScriptContext().Init(); + + var result = context.EvaluateScript("{{ null |> select: was called }}"); + + Assert.That(result, Is.EqualTo(string.Empty)); + } + + [Test] + public void Can_parseKeyValueText() + { + var context = new ScriptContext + { + ScriptMethods = { new ProtectedScripts() } + }.Init(); + + context.VirtualFiles.WriteFile("expenses.txt", @" +Rent 1000 +TV 50 +Internet 50 +Mobile 50 +Food 400 +"); + + var output = context.EvaluateScript(@" +{{ 'expenses.txt' |> includeFile |> assignTo: expensesText }} +{{ expensesText |> parseKeyValueText |> assignTo: expenses }} +Expenses: +{{ expenses |> toList |> select: { it.Key |> padRight(10) }{ it.Value }\n }} +{{ '-' |> repeat(15) }} +Total {{ expenses |> values |> sum }} +"); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +Expenses: +Rent 1000 +TV 50 +Internet 50 +Mobile 50 +Food 400 + +--------------- +Total 1550 +".NormalizeNewLines())); + + } + + public class ModelValues + { + public int Id { get; set; } + public TimeSpan TimeSpan { get; set; } + public DateTime DateTime { get; set; } + } + + [Test] + public void Can_order_by_different_data_types() + { + var items = new[] + { + new ModelValues { Id = 1, DateTime = new DateTime(2001,01,01), TimeSpan = TimeSpan.FromSeconds(1) }, + new ModelValues { Id = 2, DateTime = new DateTime(2001,01,02), TimeSpan = TimeSpan.FromSeconds(2) } + }; + + var context = new ScriptContext + { + Args = + { + ["items"] = items + } + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ items + |> orderByDescending: it.DateTime + |> first |> property: Id }}"), Is.EqualTo("2")); + + Assert.That(context.EvaluateScript(@"{{ items + |> orderByDescending: it.TimeSpan + |> first |> property: Id }}"), Is.EqualTo("2")); + } + + [Test] + public void Can_use_not_operator_in_boolean_expression() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ var items = ['A','B','C'] }} +{{ !items.contains('A') |> iif('Y','N') }}").Trim(), Is.EqualTo("N")); + + Assert.That(context.EvaluateScript(@" +{{ var items = ['A','B','C'] }} +{{ 'Y' |> ifElse(!items.contains('D'), 'N') }}").Trim(), Is.EqualTo("Y")); + + Assert.That(context.EvaluateScript(@" +{{ var items = ['A','B','C'] }} +{{ 'Y' |> ifElse(not(items.contains('D')),'N') }}").Trim(), Is.EqualTo("Y")); + + Assert.That(context.EvaluateScript(@" +{{ var items = ['A','B','C'] }} +{{ ['B','C','D'] |> where => !items.contains(it) |> first }}").Trim(), Is.EqualTo("D")); + } + + [Test] + public void Does_fmt() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 'in {0} middle' |> fmt('the') }}"), + Is.EqualTo("in the middle")); + Assert.That(context.EvaluateScript("{{ 'in {0} middle of the {1}' |> fmt('the', 'night') }}"), + Is.EqualTo("in the middle of the night")); + Assert.That(context.EvaluateScript("{{ 'in {0} middle of the {1} I go {2}' |> fmt('the', 'night', 'walking') }}"), + Is.EqualTo("in the middle of the night I go walking")); + Assert.That(context.EvaluateScript("{{ 'in {0} middle of the {1} I go {2} in my {3}' |> fmt(['the', 'night', 'walking', 'sleep']) }}"), + Is.EqualTo("in the middle of the night I go walking in my sleep")); + + Assert.That(context.EvaluateScript("{{ 'I owe {0:c}' |> fmt(123.45) }}"), + Is.EqualTo("I owe $123.45")); + } + + [Test] + public void Does_appendFmt() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 'in ' |> appendFmt('{0} middle','the') }}"), + Is.EqualTo("in the middle")); + Assert.That(context.EvaluateScript("{{ 'in ' |> appendFmt('{0} middle of the {1}', 'the', 'night') }}"), + Is.EqualTo("in the middle of the night")); + Assert.That(context.EvaluateScript("{{ 'in ' |> appendFmt('{0} middle of the {1} I go {2}', 'the', 'night', 'walking') }}"), + Is.EqualTo("in the middle of the night I go walking")); + Assert.That(context.EvaluateScript("{{ 'in ' |> appendFmt('{0} middle of the {1} I go {2} in my {3}', ['the', 'night', 'walking', 'sleep']) }}"), + Is.EqualTo("in the middle of the night I go walking in my sleep")); + + Assert.That(context.EvaluateScript("{{ 'I ' |> appendFmt('owe {0:c}', 123.45) }}"), + Is.EqualTo("I owe $123.45")); + } + + [Test] + public void Can_use_exist_tests_on_non_existing_arguments() + { + var context = new ScriptContext + { + Args = + { + ["arg"] = "value", + ["list"] = new[]{ 1, 2, 3 }, + ["emptyList"] = new int[0], + ["map"] = new Dictionary<string, object> { {"a", 1}, {"b", 2} }, + ["emptyMap"] = new Dictionary<string, object>() + } + }.Init(); + + context.VirtualFiles.WriteFile("h1.html", "<h1>{{ it }}</h1>"); + + + Assert.That(context.EvaluateScript("{{ arg |> ifExists }}"), Is.EqualTo("value")); + Assert.That(context.EvaluateScript("{{ noArg |> ifExists }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ 1 |> ifExists(arg) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> ifExists(noArg) }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ 1 |> ifNotExists(arg) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> ifNotExists(noArg) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> ifNo(arg) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> ifNo(noArg) }}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{ arg |> selectPartial: h1 }}"), Is.EqualTo("<h1>value</h1>")); + Assert.That(context.EvaluateScript("{{ noArg |> selectPartial: h1 }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ list |> ifNotEmpty |> join }}"), Is.EqualTo("1,2,3")); + Assert.That(context.EvaluateScript("{{ noList |> ifNotEmpty }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ 1 |> ifNotEmpty(list) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> ifNotEmpty(emptyList) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> ifNotEmpty(noList) }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ 1 |> ifEmpty(list) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> ifEmpty(emptyList) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> ifEmpty(noList) }}"), Is.EqualTo("1")); + } + + [Test] + public void Does_not_emit_binding_on_empty_Key_Value() + { + var context = new ScriptContext + { + Args = + { + ["row"] = new List<KeyValuePair<string,object>> + { + new KeyValuePair<string, object>("arg", "value"), + new KeyValuePair<string, object>("enmptyArg", ""), + new KeyValuePair<string, object>("nullArg", null) + } + } + }.Init(); + + var output = context.EvaluateScript("{{ row |> select: <i>{ it.Key }</i><b>{ it.Value }</b> }}"); + Assert.That(output, Is.EqualTo("<i>arg</i><b>value</b><i>enmptyArg</i><b></b><i>nullArg</i><b></b>")); + } + + [Test] + public void Does_resolve_partials_and_files_using_cascading_resolution() + { + var context = new ScriptContext + { + ScriptMethods = { new ProtectedScripts() } + }.Init(); + + context.VirtualFiles.WriteFile("root-partial.html", @"root-partial.html"); + context.VirtualFiles.WriteFile("root-file.txt", @"root-file.txt"); + context.VirtualFiles.WriteFile("partial.html", @"partial.html"); + context.VirtualFiles.WriteFile("file.txt", @"file.txt"); + + context.VirtualFiles.WriteFile("dir/partial.html", @"dir/partial.html"); + context.VirtualFiles.WriteFile("dir/file.txt", @"dir/file.txt"); + + context.VirtualFiles.WriteFile("dir/dir-partial.html", @"dir/dir-partial.html"); + context.VirtualFiles.WriteFile("dir/dir-file.txt", @"dir/dir-file.txt"); + + context.VirtualFiles.WriteFile("dir/sub/partial.html", @"dir/sub/partial.html"); + context.VirtualFiles.WriteFile("dir/sub/file.txt", @"dir/sub/file.txt"); + + context.VirtualFiles.WriteFile("page.html", @"partial: {{ 'partial' |> partial }} +file: {{ 'file.txt' |> includeFile }} +root-partial: {{ 'root-partial' |> partial }} +root-file: {{ 'root-file.txt' |> includeFile }}"); + + context.VirtualFiles.WriteFile("dir/page.html", @"partial: {{ 'partial' |> partial }} +file: {{ 'file.txt' |> includeFile }} +root-partial: {{ 'root-partial' |> partial }} +root-file: {{ 'root-file.txt' |> includeFile }}"); + + context.VirtualFiles.WriteFile("dir/sub/page.html", @"partial: {{ 'partial' |> partial }} +file: {{ 'file.txt' |> includeFile }} +root-partial: {{ 'root-partial' |> partial }} +root-file: {{ 'root-file.txt' |> includeFile }} +dir-partial: {{ 'dir-partial' |> partial }} +dir-file: {{ 'dir-file.txt' |> includeFile }}"); + + Assert.That(new PageResult(context.GetPage("page")).Result.NormalizeNewLines(), + Is.EqualTo(@" +partial: partial.html +file: file.txt +root-partial: root-partial.html +root-file: root-file.txt".NormalizeNewLines())); + + Assert.That(new PageResult(context.GetPage("dir/page")).Result.NormalizeNewLines(), + Is.EqualTo(@" +partial: dir/partial.html +file: dir/file.txt +root-partial: root-partial.html +root-file: root-file.txt".NormalizeNewLines())); + + Assert.That(new PageResult(context.GetPage("dir/sub/page")).Result.NormalizeNewLines(), + Is.EqualTo(@" +partial: dir/sub/partial.html +file: dir/sub/file.txt +root-partial: root-partial.html +root-file: root-file.txt +dir-partial: dir/dir-partial.html +dir-file: dir/dir-file.txt +".NormalizeNewLines())); + } + + [Test] + public void Can_use_end_to_discard_return_value() + { + var context = new ScriptContext().Init(); + + context.VirtualFiles.WriteFile("partial.html", "partial"); + + Assert.That(context.EvaluateScript("{{ 1 |> end }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ add(1,1) |> end }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 'partial' |> partial |> end }}"), Is.EqualTo("")); + } + + [Test] + public void Can_use_split_with_different_delimiters() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 'a,b,c' |> split |> join('|') }}"), Is.EqualTo("a|b|c")); + Assert.That(context.EvaluateScript("{{ 'a:b:c' |> split(':') |> join('|') }}"), Is.EqualTo("a|b|c")); + Assert.That(context.EvaluateScript("{{ 'a::b::c' |> split('::') |> join('|') }}"), Is.EqualTo("a|b|c")); + Assert.That(context.EvaluateScript("{{ 'a:b/c' |> split([':','/']) |> join('|') }}"), Is.EqualTo("a|b|c")); + Assert.That(context.EvaluateScript("{{ 'a::b//c' |> split(['::','//']) |> join('|') }}"), Is.EqualTo("a|b|c")); + } + + [Test] + public void Can_use_length_filters() + { + var context = new ScriptContext + { + Args = + { + ["items"] = new[]{1,2,3} + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ items |> length }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ items |> hasMinCount(0) |> iif(1,0) }}:{{ items |> hasMinCount(3) |> iif(1,0) }}:{{ items |> hasMinCount(4) |> iif(1,0) }}"), Is.EqualTo("1:1:0")); + Assert.That(context.EvaluateScript("{{ items |> hasMaxCount(0) |> iif(1,0) }}:{{ items |> hasMaxCount(3) |> iif(1,0) }}:{{ items |> hasMaxCount(4) |> iif(1,0) }}"), Is.EqualTo("0:1:1")); + + Assert.That(context.EvaluateScript("{{ null |> hasMinCount(0) |> iif(1,0) }}:{{ 1 |> hasMinCount(1) |> iif(1,0) }}:{{ 'a' |> hasMinCount(0) |> iif(1,0) }}"), Is.EqualTo("0:0:1")); + Assert.That(context.EvaluateScript("{{ null |> length }}:{{ 1 |> length }}:{{ 'a' |> length }}"), Is.EqualTo("0:0:1")); + + Assert.That(context.EvaluateScript("{{ [1,2] |> hasMinCount(0) |> iif(1,0) }}:{{ 1 |> hasMinCount(1) |> iif(1,0) }}:{{ 'a' |> hasMinCount(0) |> iif(1,0) }}"), Is.EqualTo("1:0:1")); + Assert.That(context.EvaluateScript("{{ noArg |> hasMinCount(0) |> iif(1,0) }}:{{ items |> hasMinCount(1) |> ifUse(length(items)) }}"), Is.EqualTo("0:3")); + } + + [Test] + public void Can_use_test_isTest_filters() + { + var context = new ScriptContext + { + Args = + { + ["string"] = "foo", + ["int"] = 1, + ["long"] = (long)1, + ["byte"] = (byte)1, + ["double"] = 1.1, + ["float"] = (float)1.1, + ["decimal"] = (decimal)1.1, + ["bool"] = true, + ["char"] = 'c', + ["chars"] = new[]{ 'a','b','c' }, + ["bytes"] = new byte[]{ 1, 2, 3 }, + ["intDictionary"] = new Dictionary<int, int>(), + ["stringDictionary"] = new Dictionary<string, string>(), + ["objectDictionary"] = new Dictionary<string, object>(), + ["objectList"] = new List<object>(), + ["objectArray"] = new object[]{ 1, "a" }, + ["anonObject"] = new { id = 1 }, + ["context"] = new ScriptContext(), + ["tuple"] = Tuple.Create(1, "a"), + ["keyValuePair"] = new KeyValuePair<int,string>(1,"a") + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ 'a' |> isString |> iif(1,0) }}:{{ 1 |> isString |> iif(1,0) }}"), Is.EqualTo("1:0")); + Assert.That(context.EvaluateScript("{{ 'a' |> isInt |> iif(1,0) }}:{{ 1 |> isInt |> iif(1,0) }}"), Is.EqualTo("0:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isLong |> iif(1,0) }}:{{ 1 |> toLong |> isLong |> iif(1,0) }}"), Is.EqualTo("0:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isDouble |> iif(1,0) }}:{{ 1.1 |> isDouble |> iif(1,0) }}"), Is.EqualTo("0:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isFloat |> iif(1,0) }}:{{ 1.1 |> toFloat |> isFloat |> iif(1,0) }}"), Is.EqualTo("0:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isDecimal |> iif(1,0) }}:{{ 1.1 |> toDecimal |> isDecimal |> iif(1,0) }}"), Is.EqualTo("0:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isBool |> iif(1,0) }}:{{ false |> isBool |> iif(1,0) }}"), Is.EqualTo("0:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isChar |> iif(1,0) }}:{{ 'a' |> toChar |> isChar |> iif(1,0) }}"), Is.EqualTo("0:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isChars |> iif(1,0) }}:{{ 'a' |> toChars |> isChars |> iif(1,0) }}:{{ ['a','b'] |> toChars |> isChars |> iif(1,0) }}"), Is.EqualTo("0:1:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isByte |> iif(1,0) }}:{{ 1 |> toByte |> isByte |> iif(1,0) }}"), Is.EqualTo("0:1")); + Assert.That(context.EvaluateScript("{{ bytes |> isBytes |> iif(1,0) }}:{{ 'a' |> isBytes |> iif(1,0) }}:{{ 'a' |> toUtf8Bytes |> isBytes |> iif(1,0) }}"), Is.EqualTo("1:0:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isList |> iif(1,0) }}:{{ {a:1} |> isList |> iif(1,0) }}:{{ ['a'] |> isList |> iif(1,0) }}"), Is.EqualTo("0:0:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isEnumerable |> iif(1,0) }}:{{ 1 |> isEnumerable |> iif(1,0) }}:{{ ['a'] |> isEnumerable |> iif(1,0) }}:{{ {a:1} |> isEnumerable |> iif(1,0) }}"), Is.EqualTo("1:0:1:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isDictionary |> iif(1,0) }}:{{ {a:1} |> isDictionary |> iif(1,0) }}:{{ ['a'] |> isDictionary |> iif(1,0) }}"), Is.EqualTo("0:1:0")); + Assert.That(context.EvaluateScript("{{ {a:'a'} |> isStringDictionary |> iif(1,0) }}:{{ {a:1} |> isStringDictionary |> iif(1,0) }}:{{ stringDictionary |> isStringDictionary |> iif(1,0) }}"), Is.EqualTo("0:0:1")); + Assert.That(context.EvaluateScript("{{ {a:'a'} |> isObjectDictionary |> iif(1,0) }}:{{ {a:1} |> isObjectDictionary |> iif(1,0) }}:{{ stringDictionary |> isObjectDictionary |> iif(1,0) }}"), Is.EqualTo("1:1:0")); + Assert.That(context.EvaluateScript("{{ 'a' |> isNumber |> iif(1,0) }}:{{ 1 |> isNumber |> iif(1,0) }}:{{ 1.1 |> isNumber |> iif(1,0) }}"), Is.EqualTo("0:1:1")); + Assert.That(context.EvaluateScript("{{ 'a' |> isRealNumber |> iif(1,0) }}:{{ 1 |> isRealNumber |> iif(1,0) }}:{{ 1.1 |> isRealNumber |> iif(1,0) }}"), Is.EqualTo("0:0:1")); + Assert.That(context.EvaluateScript("{{ objectList |> isArray |> iif(1,0) }}:{{ objectArray |> isArray |> iif(1,0) }}:{{ [1,'a'] |> isArray |> iif(1,0) }}"), Is.EqualTo("0:1:0")); + Assert.That(context.EvaluateScript("{{ anonObject |> isAnonObject |> iif(1,0) }}:{{ context |> isAnonObject |> iif(1,0) }}:{{ {a:1} |> isAnonObject |> iif(1,0) }}"), Is.EqualTo("1:0:0")); + Assert.That(context.EvaluateScript("{{ context |> isClass |> iif(1,0) }}:{{ 1 |> isClass |> iif(1,0) }}"), Is.EqualTo("1:0")); + Assert.That(context.EvaluateScript("{{ context |> isValueType |> iif(1,0) }}:{{ 1 |> isValueType |> iif(1,0) }}"), Is.EqualTo("0:1")); + Assert.That(context.EvaluateScript("{{ {a:1} |> isKeyValuePair |> iif(1,0) }}:{{ keyValuePair |> isKeyValuePair |> iif(1,0) }}:{{ {a:1} |> toList |> get(0) |> isKeyValuePair |> iif(1,0) }}"), Is.EqualTo("0:1:1")); + + Assert.That(context.EvaluateScript("{{ 'a' |> isType('string') |> iif(1,0) }}:{{ string |> isType('String') |> iif(1,0) }}:{{ 1 |> isString |> iif(1,0) }}"), Is.EqualTo("1:1:0")); + } + + [Test] + public void Can_use_eval() + { + var context = new ScriptContext + { + Args = + { + ["arg"] = "value" + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ '1' |> eval |> typeName }}"), Is.EqualTo("Int32")); + Assert.That(context.EvaluateScript("{{ 'arg' |> eval }}"), Is.EqualTo("value")); + Assert.That(context.EvaluateScript("{{ `'arg'` |> eval }}"), Is.EqualTo("arg")); + Assert.That(context.EvaluateScript("{{ '{a:1}' |> eval |> get: a }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ '{a:arg}' |> eval |> get: a }}"), Is.EqualTo("value")); + Assert.That(context.EvaluateScript("{{ '[1]' |> eval |> get(0) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ '[{a:arg}]' |> eval |> get(0) |> get:a }}"), Is.EqualTo("value")); + + Assert.That(context.EvaluateScript("{{ 'incr(1)' |> eval }}"), Is.EqualTo("2")); + Assert.That(context.EvaluateScript("{{ '{a:incr(1)}' |> eval |> get: a }}"), Is.EqualTo("2")); + } + + [Test] + public void Can_parse_JSON() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ '1' |> parseJson |> typeName }}"), Is.EqualTo("Int32")); + Assert.That(context.EvaluateScript("{{ 'arg' |> parseJson }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ `'arg'` |> parseJson }}"), Is.EqualTo("arg")); + Assert.That(context.EvaluateScript("{{ '{a:1}' |> parseJson |> get: a }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ '{a:arg}' |> parseJson |> get: a }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ '[1]' |> parseJson |> get(0) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ '[{a:arg}]' |> parseJson |> get(0) |> get:a }}"), Is.EqualTo("")); + } + + [Test] + public void Can_stop_filter_execution_with_end() + { + var context = new ScriptContext + { + Args = + { + ["arg"] = "foo", + ["items"] = new[]{1,2,3} + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ 1 |> end }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> endIfNull }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ null |> endIfNull |> default('unreachable') }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ arg |> endIfNull |> useFmt('{0} + {1} = {2}',1,2,3) }}"), Is.EqualTo("1 + 2 = 3")); + Assert.That(context.EvaluateScript("{{ arg |> endIfNotNull |> use('bar') |> assignTo: arg }}{{ arg }}"), Is.EqualTo("foo")); + Assert.That(context.EvaluateScript("{{ noArg |> endIfExists |> use('bar') |> assignTo: noArg }}{{ noArg }}"), Is.EqualTo("bar")); + Assert.That(context.EvaluateScript("{{ [] |> endIfEmpty |> default('unreachable') }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ items |> endIfNotEmpty |> use([4,5,6]) |> assignTo: items }}{{ items |> join }}"), Is.EqualTo("1,2,3")); + Assert.That(context.EvaluateScript("{{ nums |> endIfNotEmpty |> use([4,5,6]) |> assignTo: nums }}{{ nums |> join }}"), Is.EqualTo("4,5,6")); + Assert.That(context.EvaluateScript("{{ 1 |> endIfFalsy |> default('unreachable') }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 0 |> endIfFalsy |> default('unreachable') }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ arg |> endIfTruthy |> use('bar') }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ one |> endIfTruthy |> use(1) |> assignTo: one }}{{ one }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> endIf(true) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> endIf(false) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 5 |> times |> endIfAny: it == 4\n |> join }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 5 |> times |> endIfAny: it == 5\n |> join }}"), Is.EqualTo("0,1,2,3,4")); + Assert.That(context.EvaluateScript("{{ 5 |> times |> endIfAll: lt(it,4)\n |> join }}"), Is.EqualTo("0,1,2,3,4")); + Assert.That(context.EvaluateScript("{{ 5 |> times |> endIfAll: lt(it,5)\n |> join }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ 1 |> endWhere: isString(it) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 'a' |> endWhere: isString(it) }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ endIf(true) |> use(1) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ endIf(false) |> use(1) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ true |> ifEnd |> use(1) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ false |> ifEnd |> use(1) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ true |> ifNotEnd |> use(1) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ false |> ifNotEnd |> use(1) }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ doIf(true) |> use(1) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ doIf(false) |> use(1) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ true |> ifDo |> use(1) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ false |> ifDo |> use(1) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ true |> ifDo |> select: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ false |> ifDo |> select: 1 }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ true |> ifUse(1) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ false |> ifUse(1) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> useIf(true) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> useIf(false) }}"), Is.EqualTo("")); + } + + [Test] + public void Can_chain_end_filters_together() + { + var context = new ScriptContext + { + Args = + { + ["arg"] = "foo", + ["empty"] = "", + ["nil"] = null, + ["items"] = new[]{1,2,3}, + ["none"] = new int[]{} + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ arg |> endIfNull |> endIfNotNull(noArg) |> select: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ noArg |> endIfExists |> endIfExists(noArg2) |> select: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ empty |> endIfNull |> endIfNotNull(nil) |> select: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ empty |> endIfNull |> endIfNull(nil) |> select: 1 }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ items |> endIfEmpty |> endIfNotEmpty(none) |> select: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ items |> endIfNotEmpty |> select: 1 }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ none |> endIfEmpty |> select: 1 }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ endIf(isEmpty(items)) |> endIf(!isEmpty(none)) |> select: 1 }}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{ noArg |> endIfExists |> endIfNull(none) |> use(1) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ arg |> endIfEmpty |> endIfEmpty(items) |> join }}"), Is.EqualTo("1,2,3")); + } + + [Test] + public void Can_continue_filter_execution_with_only() + { + var context = new ScriptContext + { + Args = + { + ["arg"] = "foo", + ["items"] = new[]{1,2,3} + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ 1 |> onlyIfNotNull }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ null |> onlyIfNotNull |> default('unreachable') }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ arg |> onlyIfNotNull |> useFmt('{0} + {1} = {2}',1,2,3) }}"), Is.EqualTo("1 + 2 = 3")); + Assert.That(context.EvaluateScript("{{ arg |> onlyIfNull |> use('bar') |> assignTo: arg }}{{ arg }}"), Is.EqualTo("foo")); + Assert.That(context.EvaluateScript("{{ noArg |> onlyIfNull |> use('bar') |> assignTo: noArg }}{{ noArg }}"), Is.EqualTo("bar")); + Assert.That(context.EvaluateScript("{{ [] |> onlyIfNotEmpty |> default('unreachable') }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ items |> onlyIfEmpty |> use([4,5,6]) |> assignTo: items }}{{ items |> join }}"), Is.EqualTo("1,2,3")); + Assert.That(context.EvaluateScript("{{ nums |> onlyIfEmpty |> use([4,5,6]) |> assignTo: nums }}{{ nums |> join }}"), Is.EqualTo("4,5,6")); + Assert.That(context.EvaluateScript("{{ 1 |> onlyIfTruthy |> default('unreachable') }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 0 |> onlyIfTruthy |> default('unreachable') }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ arg |> onlyIfFalsy |> show: 1 }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ one |> onlyIfFalsy |> use(1) |> assignTo: one }}{{ one }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> onlyIf(false) }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> onlyIf(true) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 5 |> times |> onlyIfAll: lt(it,4)\n |> join }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 5 |> times |> onlyIfAll: lt(it,5)\n |> join }}"), Is.EqualTo("0,1,2,3,4")); + Assert.That(context.EvaluateScript("{{ 5 |> times |> onlyIfAny: it == 4\n |> join }}"), Is.EqualTo("0,1,2,3,4")); + Assert.That(context.EvaluateScript("{{ 5 |> times |> onlyIfAny: it == 5\n |> join }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ 1 |> onlyWhere: !isString(it) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 'a' |> onlyWhere: !isString(it) }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ onlyIf(false) |> show: 1 }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ onlyIf(true) |> show: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ true |> ifOnly |> show: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ false |> ifOnly |> show: 1 }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ true |> ifNotOnly |> show: 1 }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ false |> ifNotOnly |> show: 1 }}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{ doIf(true) |> show: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ doIf(false) |> show: 1 }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ true |> ifDo |> show: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ false |> ifDo |> show: 1 }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ true |> ifShow: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ false |> ifShow: 1 }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> showIf(true) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> showIf(false) }}"), Is.EqualTo("")); + } + + [Test] + public void Can_chain_only_filters_together() + { + var context = new ScriptContext + { + Args = + { + ["arg"] = "foo", + ["empty"] = "", + ["nil"] = null, + ["items"] = new[]{1,2,3}, + ["none"] = new int[]{} + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ arg |> onlyIfNotNull |> onlyIfNull(noArg) |> show: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ noArg |> onlyIfNull |> onlyIfNull(noArg2) |> show: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ empty |> onlyIfNotNull |> onlyIfNull(nil) |> show: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ empty |> onlyIfNotNull |> onlyIfNotNull(nil) |> show: 1 }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ items |> onlyIfNotEmpty |> onlyIfEmpty(none) |> show: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ items |> onlyIfEmpty |> show: 1 }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ none |> onlyIfNotEmpty |> show: 1 }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ onlyIf(!isEmpty(items)) |> onlyIf(isEmpty(none)) |> show: 1 }}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{ noArg |> onlyIfNull |> onlyIfNotNull(none) |> show: 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ arg |> onlyIfNotEmpty |> onlyIfNotEmpty(items) |> join }}"), Is.EqualTo("1,2,3")); + } + + [Test] + public void Can_flatten() + { + var context = new ScriptContext { + Args = { + ["nestedInts"] = new [] { new[]{1,2,3},new[]{4,5,6} }, + ["nestedInts2"] = new [] { new[]{new[]{1,2},new[]{3}},new[]{new[]{4},new[]{5,6}} }, + ["nestedStrings"] = new [] { new[]{"A","B","C"},new[]{"D","E","F"} }, + ["nestedStrings2"] = new [] { new[]{new[]{"A","B"},new[]{"C"}},new[]{new[]{"D"},new[]{"E","F"}} }, + } + }.Init(); + + Assert.That(context.Evaluate<List<object>>("{{ nestedInts |> flat |> return }}"), + Is.EquivalentTo(new[]{ 1,2,3,4,5,6 })); + Assert.That(context.Evaluate<List<object>>("{{ nestedInts2 |> flatten |> return }}"), + Is.EquivalentTo(new[]{ 1,2,3,4,5,6 })); + + Assert.That(context.Evaluate<List<object>>("{{ nestedStrings |> flat |> return }}"), + Is.EquivalentTo(new[]{ "A","B","C","D","E","F" })); + Assert.That(context.Evaluate<List<object>>("{{ nestedStrings2 |> flatten |> return }}"), + Is.EquivalentTo(new[]{ "A","B","C","D","E","F" })); + + Assert.That(context.Evaluate<List<object>>("{{ [ [1,2,[3], [4,[5,6]] ] ] |> flatten |> return }}"), + Is.EquivalentTo(new[]{ 1,2,3,4,5,6 })); + } + + + [Test] + public void Does_show() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 1 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> show: 2 }}"), Is.EqualTo("2")); + Assert.That(context.EvaluateScript("{{ 1 |> use('({0})') |> fmt: 2 }}"), Is.EqualTo("(2)")); + Assert.That(context.EvaluateScript("{{ 1 |> showFmt('({0})',2) }}"), Is.EqualTo("(2)")); + Assert.That(context.EvaluateScript("{{ 1 |> use(2) |> format('0.00') }}"), Is.EqualTo("2.00")); + Assert.That(context.EvaluateScript("{{ 1 |> showFormat(2,'0.00') }}"), Is.EqualTo("2.00")); + + Assert.That(context.EvaluateScript("{{ 1 |> show: <h1>title</h1> }}"), Is.EqualTo("&lt;h1&gt;title&lt;/h1&gt;")); + Assert.That(context.EvaluateScript("{{ 1 |> showRaw: <h1>title</h1> }}"), Is.EqualTo("<h1>title</h1>")); + Assert.That(context.EvaluateScript("{{ 1 |> showFmtRaw('<h1>{0}</h1>',2) }}"), Is.EqualTo("<h1>2</h1>")); + + Assert.That(context.EvaluateScript("{{ 2 |> formatRaw: <h1>{0}</h1> }}"), Is.EqualTo("<h1>2</h1>")); + } + + [Test] + public void Does_conditional_error_handling() + { + var context = new ScriptContext + { + Args = + { + ["invalid"] = true + } + }.Init(); + + Assert.That(context.EvaluateScript( + @"{{ invalid |> ifDo |> select: <div class=""alert alert-danger"">Argument is invalid.</div> }}"), + Is.EqualTo(@"<div class=""alert alert-danger"">Argument is invalid.</div>")); + + } + + [Test] + public void Does_match_pathInfo() + { + var context = new ScriptContext + { + Args = + { + ["PathInfo"] = "/dir/sub" + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ '/dir/sub' |> matchesPathInfo }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ 1 |> ifMatchesPathInfo('/dir/sub/') }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> ifMatchesPathInfo('/dir/su') |> otherwise: 0 }}"), Is.EqualTo("0")); + } + + [Test] + public void Can_addTo_existing_collection() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 1 |> addTo: nums }} +{{ 2 |> addTo: nums }} +{{ 3 |> addTo: nums }} +{{ nums |> join }} +".NormalizeNewLines()), Is.EqualTo("1,2,3")); + + Assert.That(context.EvaluateScript(@" +{{ [1] |> addTo: nums }} +{{ [2] |> addTo: nums }} +{{ [3] |> addTo: nums }} +{{ nums |> join }} +".NormalizeNewLines()), Is.EqualTo("1,2,3")); + } + + [Test] + public void Can_addToGlobal_existing_collection() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 1 |> addToGlobal: nums }} +{{ 2 |> addToGlobal: nums }} +{{ 3 |> addToGlobal: nums }} +{{ nums |> join }} +".NormalizeNewLines()), Is.EqualTo("1,2,3")); + + Assert.That(context.EvaluateScript(@" +{{ [1] |> addToGlobal: nums }} +{{ [2] |> addToGlobal: nums }} +{{ [3] |> addToGlobal: nums }} +{{ nums |> join }} +".NormalizeNewLines()), Is.EqualTo("1,2,3")); + } + + [Test] + public void Can_addToStart_of_an_existing_collection() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 1 |> addToStart: nums }} +{{ 2 |> addToStart: nums }} +{{ 3 |> addToStart: nums }} +{{ nums |> join }} +".NormalizeNewLines()), Is.EqualTo("3,2,1")); + } + + [Test] + public void Can_addToStartGlobal_of_an_existing_collection() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 1 |> addToStartGlobal: nums }} +{{ 2 |> addToStartGlobal: nums }} +{{ 3 |> addToStartGlobal: nums }} +{{ nums |> join }} +".NormalizeNewLines()), Is.EqualTo("3,2,1")); + } + + [Test] + public void Can_appendTo_existing_string() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 'a' |> appendTo: string }} +{{ 'b' |> appendTo: string }} +{{ 'c' |> appendTo: string }} +{{ string }} +".NormalizeNewLines()), Is.EqualTo("abc")); + } + + [Test] + public void Can_appendToGlobal_existing_string() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 'a' |> appendToGlobal: string }} +{{ 'b' |> appendToGlobal: string }} +{{ 'c' |> appendToGlobal: string }} +{{ string }} +".NormalizeNewLines()), Is.EqualTo("abc")); + } + + [Test] + public void Can_prependTo_existing_string() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 'a' |> prependTo: string }} +{{ 'b' |> prependTo: string }} +{{ 'c' |> prependTo: string }} +{{ string }} +".NormalizeNewLines()), Is.EqualTo("cba")); + } + + [Test] + public void Can_prependToGlobal_existing_string() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 'a' |> prependToGlobal: string }} +{{ 'b' |> prependToGlobal: string }} +{{ 'c' |> prependToGlobal: string }} +{{ string }} +".NormalizeNewLines()), Is.EqualTo("cba")); + } + + [Test] + public void Can_addItem_and_toQueryString() + { + var context = new ScriptContext + { + Args = + { + ["nvc"] = new NameValueCollection {["a"] = "1"}, + ["obj"] = new Dictionary<string, object> { ["a"] = "1" }, + ["str"] = new Dictionary<string, string> { ["a"] = "1" } + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ nvc |> addItem({b:2}) |> toQueryString |> raw }}"), + Is.EqualTo("?a=1&b=2")); + + Assert.That(context.EvaluateScript("{{ obj |> addItem({b:2}) |> toQueryString |> raw }}"), + Is.EqualTo("?a=1&b=2")); + Assert.That(context.EvaluateScript("{{ obj |> addItem(pair('b',2)) |> toQueryString |> raw }}"), + Is.EqualTo("?a=1&b=2")); + + Assert.That(context.EvaluateScript("{{ str |> addItem({b:'2'}) |> toQueryString |> raw }}"), + Is.EqualTo("?a=1&b=2")); + Assert.That(context.EvaluateScript("{{ str |> addItem(pair('b','2')) |> toQueryString |> raw }}"), + Is.EqualTo("?a=1&b=2")); + } + + [Test] + public void Return_does_stop_all_execution() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@"A{{ return }}B"), Is.EqualTo("A")); + + var pageResult = new PageResult(context.OneTimePage("A{{ 1 |> return }}B")); + Assert.That(pageResult.Result, Is.EqualTo("A")); + Assert.That(pageResult.ReturnValue.Result, Is.EqualTo(1)); + + pageResult = new PageResult(context.OneTimePage("A{{ 1 |> return({ a: 1 }) }}B")); + Assert.That(pageResult.Result, Is.EqualTo("A")); + Assert.That(pageResult.ReturnValue.Result, Is.EqualTo(1)); + Assert.That(pageResult.ReturnValue.Args, Is.EquivalentTo(new Dictionary<string,object> + { + { "a", 1 } + })); + } + + [Test] + public void Can_use_resolveAsset_to_resolve_external_paths() + { + var context = new ScriptContext + { + Args = + { + [ScriptConstants.AssetsBase] = "http://example.com/assets/" + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ 'img/logo.png' |> resolveAsset }}"), Is.EqualTo("http://example.com/assets/img/logo.png")); + Assert.That(context.EvaluateScript("{{ '/img/logo.png' |> resolveAsset }}"), Is.EqualTo("http://example.com/assets/img/logo.png")); + } + + [Test] + public void Returns_path_when_no_assetsBase_exists() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 'img/logo.png' |> resolveAsset }}"), Is.EqualTo("img/logo.png")); + Assert.That(context.EvaluateScript("{{ '/img/logo.png' |> resolveAsset }}"), Is.EqualTo("/img/logo.png")); + } + + [Test] + public void Can_use_isNull_on_nested_properties() + { + var sampleModel = new + { + StringProperty = "Hello", + NullStringProperty = (string)null + }; + + var context = new ScriptContext().Init(); + + var args = new Dictionary<string, object> { { "sampleArg", sampleModel } }; + Assert.That(context.EvaluateScript("{{ sampleArg |> isNull }}", args), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ sampleArg.StringProperty |> isNull }}", args), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ sampleArg.NullStringProperty |> isNull }}", args), Is.EqualTo("True")); + } + + [Test] + public void Can_detect_empty_values() + { + var context = new ScriptContext { + Args = { + ["nullArg"] = null, + ["emptyArg"] = "", + ["whitespace"] = " ", + ["foo"] = "foo" + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ unknown |> isNull }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ nullArg |> isNull }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ '' |> isNull }}"), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ `` |> isNull }}"), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ emptyArg |> isNull }}"), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ null |> isEmpty }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ '' |> isEmpty }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ `` |> isEmpty }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ emptyArg |> isEmpty }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ ' ' |> isEmpty }}"), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ ` ` |> isEmpty }}"), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ whitespace |> isEmpty }}"), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ ' ' |> IsNullOrWhiteSpace }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ ` ` |> IsNullOrWhiteSpace }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ whitespace |> IsNullOrWhiteSpace }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ 'foo' |> IsNullOrWhiteSpace }}"), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ foo |> IsNullOrWhiteSpace }}"), Is.EqualTo("False")); + } + + public class ShadowScripts : ScriptMethods + { + public int add(int x, int y) => x * y; + } + + [Test] + public void Can_shadow_default_ScriptMethods_with_InsertScriptMethods() + { + var context = new ScriptContext { + InsertScriptMethods = { new ShadowScripts() } + }.Init(); + + var result = context.Evaluate<int>("{{ add(4,4) |> return }}"); + Assert.That(result, Is.EqualTo(16)); + } + + [Test] + public void Arguments_can_shadow_existing_filters() + { + var context = new ScriptContext { + Args = { + ["min"] = -1 + } + }.Init(); + + var output = context.EvaluateScript("{{ 1 |> assignTo: max}}{{min}}:{{max}}", new ObjectDictionary { + ["max"] = 1 + }); + Assert.That(output, Is.EqualTo("-1:1")); + } + + class A + { + public int a { get; set; } + public A(int a) => this.a = a; + } + + class B + { + public int a { get; set; } + public string b { get; set; } + public B(int a, string b) + { + this.a = a; + this.b = b; + } + } + + [Test] + public void Can_use_textDump() + { + var context = new ScriptContext().Init(); + + var kvpA1 = new KeyValuePair<string,object>("a",1); + var kvpA2 = new KeyValuePair<string,object>("a",2); + var kvpBx = new KeyValuePair<string,object>("b","x"); + var kvpBy = new KeyValuePair<string,object>("b","y"); + + + Assert.That(context.EvaluateScript("{{ {a:1} |> textDump }}").NormalizeNewLines(), + Is.EqualTo("|||\n|-|-|\n| a | 1 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump }}", new ObjectDictionary { ["o"] = new A(1) }).NormalizeNewLines(), + Is.EqualTo("|||\n|-|-|\n| a | 1 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump }}", new ObjectDictionary { ["o"] = kvpA1 }).NormalizeNewLines(), + Is.EqualTo("|||\n|-|-|\n| a | 1 |".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ {a:1,b:'x'} |> textDump }}").NormalizeNewLines(), + Is.EqualTo("|||\n|-|-|\n| a | 1 |\n| b | x |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump }}", new ObjectDictionary { ["o"] = new B(1, "x") }).NormalizeNewLines(), + Is.EqualTo("|||\n|-|-|\n| a | 1 |\n| b | x |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump }}", new ObjectDictionary { ["o"] = new[]{ kvpA1, kvpBx } }).NormalizeNewLines(), + Is.EqualTo("|||\n|-|-|\n| a | 1 |\n| b | x |".NormalizeNewLines())); + + + Assert.That(context.EvaluateScript("{{ {a:1} |> textDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("| C ||\n|---|---|\n| a | 1 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new A(1) }).NormalizeNewLines(), + Is.EqualTo("| C ||\n|---|---|\n| a | 1 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = kvpA1 }).NormalizeNewLines(), + Is.EqualTo("| C ||\n|---|---|\n| a | 1 |".NormalizeNewLines())); + + + Assert.That(context.EvaluateScript("{{ [{a:1},{a:2}] |> textDump({ caption: 'C', rowNumbers:false }) }}").NormalizeNewLines(), + Is.EqualTo("C\n\n| a |\n|---|\n| 1 |\n| 2 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C', rowNumbers:false }) }}", new ObjectDictionary { ["o"] = new[]{ new A(1), new A(2) } }).NormalizeNewLines(), + Is.EqualTo("C\n\n| a |\n|---|\n| 1 |\n| 2 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C', rowNumbers:false }) }}", new ObjectDictionary { ["o"] = new[]{ kvpA1, kvpA2 } }).NormalizeNewLines(), + Is.EqualTo("C\n\n| a |\n|---|\n| 1 |\n| 2 |".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ [{a:1,b:'x'},{a:2,b:'y'}] |> textDump({ caption: 'C', rowNumbers:false }) }}").NormalizeNewLines(), + Is.EqualTo("C\n\n| a | b |\n|---|---|\n| 1 | x |\n| 2 | y |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C', rowNumbers:false }) }}", new ObjectDictionary { ["o"] = new[]{ new B(1, "x"), new B(2, "y") } }).NormalizeNewLines(), + Is.EqualTo("C\n\n| a | b |\n|---|---|\n| 1 | x |\n| 2 | y |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C', rowNumbers:false }) }}", new ObjectDictionary { ["o"] = new[]{ new[]{ kvpA1, kvpBx }, new[]{ kvpA2, kvpBy } } }).NormalizeNewLines(), + Is.EqualTo("C\n\n| a | b |\n|---|---|\n| 1 | x |\n| 2 | y |".NormalizeNewLines())); + + + Assert.That(context.EvaluateScript("{{ [{a:1},{a:2}] |> textDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("C\n\n| # | a |\n|---|---|\n| 1 | 1 |\n| 2 | 2 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new[]{ new A(1), new A(2) } }).NormalizeNewLines(), + Is.EqualTo("C\n\n| # | a |\n|---|---|\n| 1 | 1 |\n| 2 | 2 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new[]{ kvpA1, kvpA2 } }).NormalizeNewLines(), + Is.EqualTo("C\n\n| # | a |\n|---|---|\n| 1 | 1 |\n| 2 | 2 |".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ [{a:1,b:'x'},{a:2,b:'y'}] |> textDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("C\n\n| # | a | b |\n|---|---|---|\n| 1 | 1 | x |\n| 2 | 2 | y |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new[]{ new B(1, "x"), new B(2, "y") } }).NormalizeNewLines(), + Is.EqualTo("C\n\n| # | a | b |\n|---|---|---|\n| 1 | 1 | x |\n| 2 | 2 | y |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> textDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new[]{ new[]{ kvpA1, kvpBx }, new[]{ kvpA2, kvpBy } } }).NormalizeNewLines(), + Is.EqualTo("C\n\n| # | a | b |\n|---|---|---|\n| 1 | 1 | x |\n| 2 | 2 | y |".NormalizeNewLines())); + + + Assert.That(context.EvaluateScript("{{ [1,2] |> textDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("| C |\n|---|\n| 1 |\n| 2 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ ['a','b'] |> textDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("| C |\n|---|\n| a |\n| b |".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ [1,2] |> textDump }}").NormalizeNewLines(), + Is.EqualTo("||\n|-|\n| 1 |\n| 2 |".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ ['a','b'] |> textDump }}").NormalizeNewLines(), + Is.EqualTo("||\n|-|\n| a |\n| b |".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ [] |> textDump({ caption: 'C', captionIfEmpty: 'E' }) }}").NormalizeNewLines(), + Is.EqualTo("E".NormalizeNewLines())); + } + + [Test] + public void Can_use_htmlDump() + { + var context = new ScriptContext().Init(); + + var kvpA1 = new KeyValuePair<string,object>("a",1); + var kvpA2 = new KeyValuePair<string,object>("a",2); + var kvpBx = new KeyValuePair<string,object>("b","x"); + var kvpBy = new KeyValuePair<string,object>("b","y"); + + + Assert.That(context.EvaluateScript("{{ {a:1} |> htmlDump }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><tbody><tr><th>a</th><td>1</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> htmlDump }}", new ObjectDictionary { ["o"] = new A(1) }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><tbody><tr><th>a</th><td>1</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> htmlDump }}", new ObjectDictionary { ["o"] = kvpA1 }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><tbody><tr><th>a</th><td>1</td></tr></tbody></table>".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ {a:1,b:'x'} |> htmlDump }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><tbody><tr><th>a</th><td>1</td></tr><tr><th>b</th><td>x</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ {a:1,b:'x'} |> htmlDump }}", new ObjectDictionary { ["o"] = new B(1, "x") }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><tbody><tr><th>a</th><td>1</td></tr><tr><th>b</th><td>x</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ {a:1,b:'x'} |> htmlDump }}", new ObjectDictionary { ["o"] = new[]{ kvpA1, kvpBx } }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><tbody><tr><th>a</th><td>1</td></tr><tr><th>b</th><td>x</td></tr></tbody></table>".NormalizeNewLines())); + + + Assert.That(context.EvaluateScript("{{ {a:1} |> htmlDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><tbody><tr><th>a</th><td>1</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> htmlDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new A(1) }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><tbody><tr><th>a</th><td>1</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> htmlDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = kvpA1 }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><tbody><tr><th>a</th><td>1</td></tr></tbody></table>".NormalizeNewLines())); + + + Assert.That(context.EvaluateScript("{{ [{a:1},{a:2}] |> htmlDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><thead><tr><th>a</th></tr></thead><tbody><tr><td>1</td></tr><tr><td>2</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> htmlDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new[]{ new A(1), new A(2) } }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><thead><tr><th>a</th></tr></thead><tbody><tr><td>1</td></tr><tr><td>2</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> htmlDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new[]{ kvpA1, kvpA2 } }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><thead><tr><th>a</th></tr></thead><tbody><tr><td>1</td></tr><tr><td>2</td></tr></tbody></table>".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ [{a:1,b:'x'},{a:2,b:'y'}] |> htmlDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><thead><tr><th>a</th><th>b</th></tr></thead><tbody><tr><td>1</td><td>x</td></tr><tr><td>2</td><td>y</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> htmlDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new[]{ new B(1, "x"), new B(2, "y") } }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><thead><tr><th>a</th><th>b</th></tr></thead><tbody><tr><td>1</td><td>x</td></tr><tr><td>2</td><td>y</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ o |> htmlDump({ caption: 'C' }) }}", new ObjectDictionary { ["o"] = new[]{ new[]{ kvpA1, kvpBx }, new[]{ kvpA2, kvpBy } } }).NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><thead><tr><th>a</th><th>b</th></tr></thead><tbody><tr><td>1</td><td>x</td></tr><tr><td>2</td><td>y</td></tr></tbody></table>".NormalizeNewLines())); + + + Assert.That(context.EvaluateScript("{{ [1,2] |> htmlDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><tbody><tr><td>1</td></tr><tr><td>2</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ ['a','b'] |> htmlDump({ caption: 'C' }) }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><caption>C</caption><tbody><tr><td>a</td></tr><tr><td>b</td></tr></tbody></table>".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ [1,2] |> htmlDump }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><tbody><tr><td>1</td></tr><tr><td>2</td></tr></tbody></table>".NormalizeNewLines())); + Assert.That(context.EvaluateScript("{{ ['a','b'] |> htmlDump }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table\"><tbody><tr><td>a</td></tr><tr><td>b</td></tr></tbody></table>".NormalizeNewLines())); + + + Assert.That(context.EvaluateScript("{{ [] |> htmlDump({ caption: 'C', captionIfEmpty: 'E', className:'table-bordered' }) }}").NormalizeNewLines(), + Is.EqualTo("<table class=\"table-bordered\"><caption>E</caption></table>".NormalizeNewLines())); + } + + [Test] + public void Can_use_array_methods() + { + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array + var context = new ScriptContext { + Args = { + ["fruits"] = new List<object> { "Apple", "Banana" } + } + }.Init(); + + Assert.That(context.EvaluateScript("{{fruits[0]}}"), Is.EqualTo("Apple")); + Assert.That(context.EvaluateScript("{{fruits[fruits.Count - 1]}}"), Is.EqualTo("Banana")); + Assert.That(context.EvaluateScript("{{ [] |> to => result}}{{fruits.forEach((item,index) => result.push(`${item} ${index}`))}}{{result |> join}}"), + Is.EqualTo("Apple 0,Banana 1")); + Assert.That(context.EvaluateScript("{{#each fruits}}{{`${it} ${index},`}}{{/each}}"), + Is.EqualTo("Apple 0,Banana 1,")); + Assert.That(context.EvaluateScript("{{fruits.push('Orange')}} => {{fruits |> join}}"), + Is.EqualTo("3 => Apple,Banana,Orange")); + Assert.That(context.EvaluateScript("{{fruits.pop()}}"), + Is.EqualTo("Orange")); + Assert.That(context.EvaluateScript("{{fruits.shift()}}"), + Is.EqualTo("Apple")); + Assert.That(context.EvaluateScript("{{fruits.unshift('Strawberry')}} => {{fruits |> join}}"), + Is.EqualTo("2 => Strawberry,Banana")); + Assert.That(context.EvaluateScript("{{fruits.push('Mango')}} : {{fruits.indexOf('Banana')}}"), + Is.EqualTo("3 : 1")); + Assert.That(context.EvaluateScript("{{fruits.indexOf('Banana')}}"), + Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{fruits.splice(fruits.indexOf('Banana'),1) |> join}} : {{fruits |> join}}"), + Is.EqualTo("Banana : Strawberry,Mango")); + Assert.That(context.EvaluateScript("{{fruits.Count}} : {{fruits.slice().push('Pear')}} : {{fruits.Count}}"), + Is.EqualTo("2 : 3 : 2")); + } + + [Test] + public void Can_use_array_splice() + { + var context = new ScriptContext { + Args = { + ["vegetables"] = new List<object> { "Cabbage", "Turnip", "Radish", "Carrot" } + } + }.Init(); + + + Assert.That(context.EvaluateScript("{{vegetables.splice(1,2) |> join}} : {{ vegetables |> join }}"), + Is.EqualTo("Turnip,Radish : Cabbage,Carrot")); + } + + [Test] + public void Can_use_other_array_methods() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{['a', 'b', 'c'].concat(['d', 'e', 'f']) |> join}}"), + Is.EqualTo("a,b,c,d,e,f")); + + Assert.That(context.EvaluateScript("{{[1, 30, 39, 29, 10, 13].every(x => x < 40)}}"), + Is.EqualTo("True")); + + Assert.That(context.EvaluateScript("{{['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'].filter(word => word.Length > 6) |> join}}"), + Is.EqualTo("exuberant,destruction,present")); + + Assert.That(context.EvaluateScript("{{[5, 12, 8, 130, 44].find(x => x > 10) |> join}}"), + Is.EqualTo("12")); + + Assert.That(context.EvaluateScript("{{[5, 12, 8, 130, 44].findIndex(x => x > 13) |> join}}"), + Is.EqualTo("3")); + + Assert.That(context.EvaluateScript("{{[1, 2, [3, 4, [5, 6]]].flat(2) |> join}}"), + Is.EqualTo("1,2,3,4,5,6")); + + Assert.That(context.EvaluateScript("{{[1, 2, 3, 4].flatMap(x => [x * 2]) |> join}}"), + Is.EqualTo("2,4,6,8")); + + Assert.That(context.EvaluateScript("{{[1, 2, 3].includes(2)}}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{['cat', 'dog', 'bat'].includes('cat')}}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{['cat', 'dog', 'bat'].includes('at')}}"), Is.EqualTo("False")); + + Assert.That(context.EvaluateScript("{{['ant', 'bison', 'camel', 'duck', 'bison'].indexOf('bison')}}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{['ant', 'bison', 'camel', 'duck', 'bison'].indexOf('bison',2)}}"), Is.EqualTo("4")); + Assert.That(context.EvaluateScript("{{['ant', 'bison', 'camel', 'duck', 'bison'].indexOf('giraffe')}}"), Is.EqualTo("-1")); + + Assert.That(context.EvaluateScript("{{['Fire', 'Air', 'Water'].join()}}"), Is.EqualTo("Fire,Air,Water")); + Assert.That(context.EvaluateScript("{{['Fire', 'Air', 'Water'].join('')}}"), Is.EqualTo("FireAirWater")); + Assert.That(context.EvaluateScript("{{['Fire', 'Air', 'Water'].join('-')}}"), Is.EqualTo("Fire-Air-Water")); + + Assert.That(context.EvaluateScript("{{['a', 'b', 'c'].keys() |> join}}"), Is.EqualTo("0,1,2")); + + Assert.That(context.EvaluateScript("{{['Dodo', 'Tiger', 'Penguin', 'Dodo'].lastIndexOf('Dodo')}}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{['Dodo', 'Tiger', 'Penguin', 'Dodo'].lastIndexOf('Tiger')}}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{[1, 4, 9, 16].map(x => x * 2) |> join}}"), Is.EqualTo("2,8,18,32")); + + Assert.That(context.EvaluateScript("{{['broccoli', 'cauliflower', 'cabbage', 'kale', 'tomato'].pop()}}"), Is.EqualTo("tomato")); + + Assert.That(context.EvaluateScript("{{['pigs', 'goats', 'sheep'].push('cows')}}"), Is.EqualTo("4")); + + Assert.That(context.EvaluateScript("{{[1, 2, 3, 4].reduce((accumulator, currentValue) => accumulator + currentValue)}}"), Is.EqualTo("10")); + Assert.That(context.EvaluateScript("{{[1, 2, 3, 4].reduce((accumulator, currentValue) => accumulator + currentValue, 5)}}"), Is.EqualTo("15")); + + Assert.That(context.EvaluateScript("{{['one', 'two', 'three'].reverse() |> join}}"), Is.EqualTo("three,two,one")); + + Assert.That(context.EvaluateScript("{{[1, 2, 3].shift()}}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{['ant', 'bison', 'camel', 'duck', 'elephant'] |> to => animals}}{{animals.slice(2) |> join}}"), Is.EqualTo("camel,duck,elephant")); + Assert.That(context.EvaluateScript("{{['ant', 'bison', 'camel', 'duck', 'elephant'] |> to => animals}}{{animals.slice(2,4) |> join}}"), Is.EqualTo("camel,duck")); + Assert.That(context.EvaluateScript("{{['ant', 'bison', 'camel', 'duck', 'elephant'] |> to => animals}}{{animals.slice(1,5) |> join}}"), Is.EqualTo("bison,camel,duck,elephant")); + + Assert.That(context.EvaluateScript("{{[1, 2, 3, 4, 5].some(x => x % 2 == 0)}}"), Is.EqualTo("True")); + + Assert.That(context.EvaluateScript("{{['March', 'Jan', 'Feb', 'Dec'].sort() |> join}}"), Is.EqualTo("Dec,Feb,Jan,March")); + Assert.That(context.EvaluateScript("{{[1, 30, 4, 21, 100000].sort() |> join}}"), Is.EqualTo("1,4,21,30,100000")); + + Assert.That(context.EvaluateScript( + "{{['Jan', 'March', 'April', 'June'] |> to => months}}{{months.splice(1,0,['Feb']) |> end}}{{months |> join}}"), + Is.EqualTo("Jan,Feb,March,April,June")); + + Assert.That(context.EvaluateScript("{{[1, 2, 3] |> to => array}}{{array.unshift([4,5])}} : {{array |> join}}"), Is.EqualTo("5 : 4,5,1,2,3")); + + Assert.That(context.EvaluateScript("{{['a', 'b', 'c'].values() |> join}}"), Is.EqualTo("a,b,c")); + } + + [Test] + public void Can_use_forEach_on_dictionaries() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript( + "{{ {a:1,b:2,c:3} |> to => d }}{{ [] |> to => values}}{{d.forEach((key,val) => values.push(val))}}{{values |> join}}"), + Is.EqualTo("1,2,3")); + + } + + [Test] + public void Can_flatMap() + { + var context = new ScriptContext().Init(); + Assert.That(context.Evaluate("{{ flatten([[1,2],[3,4]]) |> return }}"), Is.EqualTo(new[]{ 1, 2, 3, 4 })); + } + + [Test] + public void Can_removeKeyFromDictionary() + { + var context = new ScriptContext().Init(); + var output = context.RenderScript(@"```code|q +sample = {} +sample.myKey1 = 1 +sample.myKey2 = 2 +sample |> remove('myKey1') +sample |> removeKeyFromDictionary('myKey2') +``` +{{ sample.myKey }}".NormalizeNewLines()); + + Assert.That(output, Is.EqualTo("")); + } + + [Test] + public void Can_use_ownProps() + { + var context = new ScriptContext().Init(); + + var output = context.RenderScript(@" +{{#partial test}} +{{ it |> ownProps |> map => it.Key |> jsv }}|{{ it.ownProps().map(x => x.Key).jsv() }} +{{/partial}} +{{ 'test' | partial({ A:1, B:2 }) }}".NormalizeNewLines()); + + output.Print(); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo("[A,B]|[A,B]")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/DslTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/DslTests.cs new file mode 100644 index 00000000000..b7ca2f059fe --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/DslTests.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.Serialization; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ProtoBufMethods : ScriptMethods + { + public ReadOnlyMemory<byte> serialize(object target) + { + var ms = new MemoryStream(); + global::ProtoBuf.Serializer.NonGeneric.Serialize(ms, target); + return ms.GetBufferAsMemory(); + } + } + + [DataContract] + public class PersonContract + { + [DataMember(Order = 1)] + public string Name { get; set; } + + [DataMember(Order = 2)] + public int Age { get; set; } + } + + public class DslTests + { + private static ScriptContext CreateContext() => new ScriptContext { + InsertScriptMethods = { + new ProtoBufMethods() + } + }.Init(); + + [Test] + public void Can_use_injected_binary_serializer_with_EvaluateScript() + { + var context = CreateContext(); + + var person = new PersonContract { Name = "Kurt", Age = 27 }; + var result = (ReadOnlyMemory<byte>)context.Evaluate("{{ serialize(target) |> return }}", new Dictionary<string, object> { + ["target"] = person + }); + + var ms = new MemoryStream(result.ToArray()); + var fromScript = (PersonContract)global::ProtoBuf.Serializer.NonGeneric.Deserialize(typeof(PersonContract), ms); + + Assert.That(fromScript.Name, Is.EqualTo(person.Name)); + Assert.That(fromScript.Age, Is.EqualTo(person.Age)); + } + + [Test] + public void Can_use_injected_binary_serializer_via_eval_and_custom_Scope() + { + var context = CreateContext(); + + var person = new PersonContract { Name = "Kurt", Age = 27 }; + var scope = context.CreateScope(new Dictionary<string, object> { + ["target"] = person + }); + var result = (ReadOnlyMemory<byte>)JS.eval("serialize(target)", scope); + + var ms = new MemoryStream(result.ToArray()); + var fromScript = (PersonContract)global::ProtoBuf.Serializer.NonGeneric.Deserialize(typeof(PersonContract), ms); + + Assert.That(fromScript.Name, Is.EqualTo(person.Name)); + Assert.That(fromScript.Age, Is.EqualTo(person.Age)); + } + + [Test] + public void Can_use_injected_binary_serializer_via_eval_and_custom_ScriptScopeContext() + { + var context = CreateContext(); + + var person = new PersonContract { Name = "Kurt", Age = 27 }; + var scope = new ScriptScopeContext(context, new Dictionary<string, object> { + ["target"] = person + }); + + var result = (ReadOnlyMemory<byte>)JS.eval("serialize(target)", scope); + + var ms = new MemoryStream(result.ToArray()); + var fromScript = (PersonContract)global::ProtoBuf.Serializer.NonGeneric.Deserialize(typeof(PersonContract), ms); + + Assert.That(fromScript.Name, Is.EqualTo(person.Name)); + Assert.That(fromScript.Age, Is.EqualTo(person.Age)); + } + + [Test] + public void Can_use_injected_binary_serializer_via_page_result() + { + var context = CreateContext(); + + var person = new PersonContract { Name = "Kurt", Age = 27 }; + + var evalContext = new PageResult(context.OneTimePage("{{ serialize(target) |> return }}")) { + Args = { + ["target"] = person + } + }; + evalContext.RenderToStringAsync().Wait(); + + var result = (ReadOnlyMemory<byte>) evalContext.ReturnValue.Result; + + var ms = new MemoryStream(result.ToArray()); + var fromScript = (PersonContract)global::ProtoBuf.Serializer.NonGeneric.Deserialize(typeof(PersonContract), ms); + + Assert.That(fromScript.Name, Is.EqualTo(person.Name)); + Assert.That(fromScript.Age, Is.EqualTo(person.Age)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ErrorHandlingTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ErrorHandlingTests.cs new file mode 100644 index 00000000000..c37337e3eec --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ErrorHandlingTests.cs @@ -0,0 +1,581 @@ +using System; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ErrorHandlingTests + { + [Test] + public void Exceptions_in_filter_bubble_by_default() + { + var context = new ScriptContext().Init(); + + try + { + context.EvaluateScript("{{ 'in filter' |> throw }}"); + Assert.Fail("Should throw"); + } + catch (Exception ex) + { + Assert.That(ex.Message, Is.EqualTo("in filter")); + } + } + + [Test] + public void Exceptions_in_filter_bubble_by_default_async() + { + var context = new ScriptContext + { + }.Init(); + + try + { + context.EvaluateScript("{{ 'in filter' |> throwAsync }}"); + } + catch (Exception ex) + { + Assert.That(ex.Message, Is.EqualTo("in filter")); + } + } + + [Test] + public void Can_capture_exception_using_AssignException() + { + var context = new ScriptContext + { + AssignExceptionsTo = "error" + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throw }} +<var>{{ error.Message }}</var>", out _), + Is.EqualTo("<var>in filter</var>")); + } + + [Test] + public void Can_capture_exception_using_assignError() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throw({ assignError: 'myError' }) }} +<var>{{ myError.Message }}</var>", out _), + Is.EqualTo("<var>in filter</var>")); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throw({ assignError: 'myError' }) }} +<var>{{ myError.Message }}</var><pre>{{ lastErrorStackTrace }}</pre>", out _), + Does.StartWith("<var>in filter</var><pre> at ")); + } + + [Test] + public void Can_capture_and_suppress_exception_using_catchError() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throw({ catchError: 'myError' }) }} +<var>{{ myError.Message }}</var>"), + Is.EqualTo("<var>in filter</var>")); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throw({ catchError: 'myError' }) }} +<var>{{ myError.Message }}</var><pre>{{ myErrorStackTrace }}</pre>"), + Does.StartWith("<var>in filter</var><pre> at ")); + } + + [Test] + public void Can_use_conditional_filters_with_filter_errors() + { + var context = new ScriptContext + { + AssignExceptionsTo = "error" + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throw }}{{ ifError |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throw }}{{ lastError |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throw }}{{ lastErrorMessage |> format('<h1>FAIL! {0}</h1>') |> raw }}", out _), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throw }}<h1>{{ lastError |> ifExists |> map: it.Message }}</h1>", out _), + Is.EqualTo("<h1>in filter</h1>")); + + + Assert.That(context.EvaluateScript(@"{{ ifNoError |> select: <h1>SUCCESS!</h1> }}"), + Is.EqualTo("<h1>SUCCESS!</h1>")); + Assert.That(context.EvaluateScript(@"<h1>{{ ifNoError |> show: SUCCESS! }}</h1>"), + Is.EqualTo("<h1>SUCCESS!</h1>")); + Assert.That(context.EvaluateScript(@"{{ '<h1>SUCCESS!</h1>' |> ifNoError |> raw }}"), + Is.EqualTo("<h1>SUCCESS!</h1>")); + Assert.That(context.EvaluateScript(@"{{ lastError | endIfExists |> select: <h1>SUCCESS!</h1> }}"), + Is.EqualTo("<h1>SUCCESS!</h1>")); + Assert.That(context.EvaluateScript(@"<h1>{{ 'SUCCESS!' |> ifNotExists(lastError) }}</h1>"), + Is.EqualTo("<h1>SUCCESS!</h1>")); + } + + [Test] + public void Can_throw_on_conditions() + { + var context = new ScriptContext + { + AssignExceptionsTo = "error" + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throwIf(true) }}{{ ifError |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throwIf(true) }}{{ error |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + Assert.That(context.EvaluateScript(@"{{ true |> ifThrow('in filter') }}{{ ifError |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + Assert.That(context.EvaluateScript(@"{{ true |> ifThrow('in filter') }}{{ error |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throwIf(false) }}{{ ifError |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("")); + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throwIf(false) }}{{ error |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("")); + Assert.That(context.EvaluateScript(@"{{ false |> ifThrow('in filter') }}{{ ifError |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("")); + Assert.That(context.EvaluateScript(@"{{ false |> ifThrow('in filter') }}{{ error |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("")); + } + + [Test] + public void Can_throw_on_conditions_with_assignError() + { + var context = new ScriptContext + { + AssignExceptionsTo = "error" + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throwIf(true, { assignError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + Assert.That(context.EvaluateScript(@"{{ true |> ifThrow('in filter', { assignError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throwIf(false, { assignError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("")); + Assert.That(context.EvaluateScript(@"{{ false |> ifThrow('in filter', { assignError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}", out _), + Is.EqualTo("")); + } + + [Test] + public void Can_throw_on_conditions_and_suppresses_with_catchError() + { + var context = new ScriptContext + { + AssignExceptionsTo = "error" + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throwIf(true, { catchError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}"), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + Assert.That(context.EvaluateScript(@"{{ true |> ifThrow('in filter', { catchError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}"), + Is.EqualTo("<h1>FAIL! in filter</h1>")); + + Assert.That(context.EvaluateScript(@"{{ 'in filter' |> throwIf(false, { catchError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}"), + Is.EqualTo("")); + Assert.That(context.EvaluateScript(@"{{ false |> ifThrow('in filter', { catchError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>FAIL! { it.Message }</h1> }}"), + Is.EqualTo("")); + } + + [Test] + public void Can_throw_different_exception_types() + { + var context = new ScriptContext + { + AssignExceptionsTo = "error" + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ true |> ifThrowArgumentNullException('p') }}{{ ifError |> select: <h1>{ it |> typeName }! { it.Message }</h1> }}", out _).NormalizeNewLines(), + Is.EqualTo("<h1>ArgumentNullException! Value cannot be null.\nParameter name: p</h1>")); + Assert.That(context.EvaluateScript(@"{{ true |> ifThrowArgumentNullException('p', { assignError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>{ it |> typeName }! { it.Message }</h1> }}", out _).NormalizeNewLines(), + Is.EqualTo("<h1>ArgumentNullException! Value cannot be null.\nParameter name: p</h1>")); + + Assert.That(context.EvaluateScript(@"{{ true |> ifThrowArgumentException('bad arg', 'p') }}{{ ifError |> select: <h1>{ it |> typeName }! { it.Message }</h1> }}", out _).NormalizeNewLines(), + Is.EqualTo("<h1>ArgumentException! bad arg\nParameter name: p</h1>")); + Assert.That(context.EvaluateScript(@"{{ true |> ifThrowArgumentException('bad arg', 'p', { assignError: 'ex' }) }}{{ ex |> ifExists |> select: <h1>{ it |> typeName }! { it.Message }</h1> }}", out _).NormalizeNewLines(), + Is.EqualTo("<h1>ArgumentException! bad arg\nParameter name: p</h1>")); + } + + [Test] + public void Does_skipExecutingPageFiltersIfError() + { + var context = new ScriptContext + { + AssignExceptionsTo = "error" + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<body> +{{ page }} +</body> +</html>"); + + context.VirtualFiles.WriteFile("page.html", @" +{{ skipExecutingFiltersOnError }} +<h1>Before Error</h1> +{{ 'in filter' |> throw }} +{{ ifError |> select: <h1>FAIL! { it.Message }</h1> }} + +<b>{{ 'never executed' }}</b> + +<h1>After Error</h1> +"); + + var page = context.GetPage("page"); + var output = new PageResult(page).Result; + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@"<html> +<body> + +<h1>Before Error</h1> +<h1>FAIL! in filter</h1> + +<b></b> + +<h1>After Error</h1> + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Does_SkipExecutingPageFiltersIfError_in_Context() + { + var context = new ScriptContext + { + SkipExecutingFiltersIfError = true, + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<body> +{{ page }} +</body> +</html>"); + + context.VirtualFiles.WriteFile("page.html", @" +<h1>Before Error</h1> +{{ 'in filter' |> throw }} +{{ ifError |> select: <h1>FAIL! { it.Message }</h1> }} + +<b>{{ 'never executed' }}</b> + +<h1>After Error</h1> +"); + + var page = context.GetPage("page"); + var output = new PageResult(page).Result; + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@"<html> +<body> + +<h1>Before Error</h1> +<h1>FAIL! in filter</h1> + +<b></b> + +<h1>After Error</h1> + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Does_render_htmlErrorDebug_in_DebugMode() + { + var context = new ScriptContext + { + SkipExecutingFiltersIfError = true, + DebugMode = true, + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<body> +{{ page }} +</body> +</html>"); + + context.VirtualFiles.WriteFile("page.html", @" +<h1>Before Error</h1> +{{ 'in filter' |> throw }} +{{ htmlError }} + +<b>{{ 'never executed' }}</b> + +<h1>After Error</h1> +"); + + var page = context.GetPage("page"); + var output = new PageResult(page).Result; + + Assert.That(output.NormalizeNewLines(), Does.StartWith(@"<html> +<body> + +<h1>Before Error</h1> +<pre class=""alert alert-danger"">Exception: in filter +".NormalizeNewLines())); + } + + [Test] + public void Does_render_htmlErrorMessage_when_not_DebugMode() + { + var context = new ScriptContext + { + SkipExecutingFiltersIfError = true, + DebugMode = false, + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<body> +{{ page }} +</body> +</html>"); + + context.VirtualFiles.WriteFile("page.html", @" +<h1>Before Error</h1> +{{ 'in filter' |> throw }} +{{ htmlError }} + +<b>{{ 'never executed' }}</b> + +<h1>After Error</h1> +"); + + var page = context.GetPage("page"); + var output = new PageResult(page).Result; + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@"<html> +<body> + +<h1>Before Error</h1> +<div class=""alert alert-danger"">in filter</div> + +<b></b> + +<h1>After Error</h1> + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Does_render_htmlErrorDebug_with_StackTraces() + { + var context = new ScriptContext + { + SkipExecutingFiltersIfError = true, + }.Init(); + + context.VirtualFiles.WriteFile("page.html", @" +<h1>Before Error</h1> +{{ 'in filter' |> throw }} +{{ htmlErrorDebug }} + +<b>{{ 'never executed' }}</b> + +<h1>After Error</h1> +"); + + var page = context.GetPage("page"); + var output = new PageResult(page).Result; + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +<h1>Before Error</h1> +<pre class=""alert alert-danger"">Exception: in filter + +StackTrace: + at Expression (String): ""in filter"" + at Page: page.html +</pre> + + +<b></b> + +<h1>After Error</h1>".NormalizeNewLines())); + } + + [Test] + public void Can_continue_executing_filters_with_continueExecutingFiltersOnError() + { + var context = new ScriptContext + { + SkipExecutingFiltersIfError = true, + }.Init(); + + context.VirtualFiles.WriteFile("page.html", @" +{{ continueExecutingFiltersOnError }} +<h1>Before Error</h1> +{{ 'in filter' |> throw }} +{{ htmlErrorDebug }} + +<b>{{ 'is evaluated' }}</b> + +<h1>After Error</h1> +"); + + var page = context.GetPage("page"); + var output = new PageResult(page).Result; + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +<h1>Before Error</h1> +<pre class=""alert alert-danger"">Exception: in filter + +StackTrace: + at Expression (String): ""in filter"" + at Page: page.html +</pre> + + +<b>is evaluated</b> + +<h1>After Error</h1>".NormalizeNewLines())); + } + + [Test] + public void Can_continue_executing_filters_with_continueExecutingFiltersOnError_in_filterError() + { + var context = new ScriptContext().Init(); + + context.VirtualFiles.WriteFile("page.html", @" +{{ continueExecutingFiltersOnError }} +{{ 'A' |> to => someVariable }} +{{ someVariable |> toInt |> to => myInt }} +myInt {{ myInt }} +"); + + var page = context.GetPage("page"); + var output = new PageResult(page).Result; + + Assert.That(output.Trim(), Is.EqualTo("myInt")); + } + + [Test] + public void Can_continue_executing_filters_with_catchError() + { + var template = @"{{ 'ex' |> catchError }} +Result = +```code +'h1' |> lower |> to => elemType +elemType |> toInt |> raw +```"; + + var context = new ScriptContext().Init(); + var dynamicPage = context.OneTimePage(template); + var pageResult = new PageResult(dynamicPage); + var output = pageResult.RenderScript(); + Assert.That(output.Trim(), Is.EqualTo("Result =")); + } + + [Test] + public void Calling_ensureAllArgsNotNull_throws_if_any_args_are_null() + { + var context = new ScriptContext + { + SkipExecutingFiltersIfError = true, + DebugMode = false, + Args = + { + ["arg"] = "value", + ["empty"] = "", + } + }.Init(); + + context.VirtualFiles.WriteFile("page-arg.html", @"{{ { arg } |> ensureAllArgsNotNull |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-empty.html", @"{{ { empty } |> ensureAllArgsNotNull |> select: { it.empty } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-noarg.html", @"{{ { noArg } |> ensureAllArgsNotNull |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-msg.html", @"{{ { noArg } |> ensureAllArgsNotNull({ message: '{0} required' }) |> select: { it.arg } }}{{ htmlError }}"); + + Assert.That(new PageResult(context.GetPage("page-arg")).Result, Is.EqualTo(@"value")); + Assert.That(new PageResult(context.GetPage("page-empty")).Result, Is.EqualTo(@"")); + Assert.That(new PageResult(context.GetPage("page-noarg")).Result.NormalizeNewLines(), + Is.EqualTo("<div class=\"alert alert-danger\">Value cannot be null.\nParameter name: noArg</div>")); + Assert.That(new PageResult(context.GetPage("page-msg")).Result.NormalizeNewLines(), + Is.EqualTo("<div class=\"alert alert-danger\">noArg required</div>")); + } + + [Test] + public void Calling_ensureAllArgsNotEmpty_throws_if_any_args_are_empty() + { + var context = new ScriptContext + { + SkipExecutingFiltersIfError = true, + DebugMode = false, + Args = + { + ["arg"] = "value", + ["empty"] = "", + } + }.Init(); + + context.VirtualFiles.WriteFile("page-arg.html", @"{{ { arg } |> ensureAllArgsNotEmpty |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-empty.html", @"{{ { empty } |> ensureAllArgsNotEmpty |> select: { it.empty } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-noarg.html", @"{{ { noArg } |> ensureAllArgsNotEmpty |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-msg.html", @"{{ { noArg } |> ensureAllArgsNotEmpty({ message: '{0} required' }) |> select: { it.arg } }}{{ htmlError }}"); + + Assert.That(new PageResult(context.GetPage("page-arg")).Result, Is.EqualTo(@"value")); + Assert.That(new PageResult(context.GetPage("page-empty")).Result.NormalizeNewLines(), + Is.EqualTo("<div class=\"alert alert-danger\">Value cannot be null.\nParameter name: empty</div>")); + Assert.That(new PageResult(context.GetPage("page-noarg")).Result.NormalizeNewLines(), + Is.EqualTo("<div class=\"alert alert-danger\">Value cannot be null.\nParameter name: noArg</div>")); + Assert.That(new PageResult(context.GetPage("page-msg")).Result.NormalizeNewLines(), + Is.EqualTo("<div class=\"alert alert-danger\">noArg required</div>")); + } + + [Test] + public void Calling_ensureAnyArgsNotNull_throws_if_all_args_are_null() + { + var context = new ScriptContext + { + SkipExecutingFiltersIfError = true, + DebugMode = false, + Args = + { + ["arg"] = "value", + ["empty"] = "", + } + }.Init(); + + context.VirtualFiles.WriteFile("page-arg.html", @"{{ { arg } |> ensureAnyArgsNotNull |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-empty.html", @"{{ { arg, noArg } |> ensureAnyArgsNotNull |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-noarg.html", @"{{ { noArg } |> ensureAnyArgsNotNull |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-msg.html", @"{{ { noArg, empty } |> ensureAnyArgsNotNull({ message: '{0} required' }) |> select: { it.empty } }}{{ htmlError }}"); + + Assert.That(new PageResult(context.GetPage("page-arg")).Result, Is.EqualTo(@"value")); + Assert.That(new PageResult(context.GetPage("page-empty")).Result, Is.EqualTo(@"value")); + Assert.That(new PageResult(context.GetPage("page-noarg")).Result.NormalizeNewLines(), + Is.EqualTo("<div class=\"alert alert-danger\">Value cannot be null.\nParameter name: noArg</div>")); + Assert.That(new PageResult(context.GetPage("page-msg")).Result.NormalizeNewLines(), + Is.EqualTo("")); + } + + [Test] + public void Calling_ensureAnyArgsNotEmpty_throws_if_all_args_are_empty() + { + var context = new ScriptContext + { + SkipExecutingFiltersIfError = true, + DebugMode = false, + Args = + { + ["arg"] = "value", + ["empty"] = "", + } + }.Init(); + + context.VirtualFiles.WriteFile("page-arg.html", @"{{ { arg } |> ensureAnyArgsNotEmpty |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-empty.html", @"{{ { arg, noArg } |> ensureAnyArgsNotEmpty |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-noarg.html", @"{{ { noArg } |> ensureAnyArgsNotEmpty |> select: { it.arg } }}{{ htmlError }}"); + context.VirtualFiles.WriteFile("page-msg.html", @"{{ { noArg, empty } |> ensureAnyArgsNotEmpty({ message: '{0} required' }) |> select: { it.empty } }}{{ htmlError }}"); + + Assert.That(new PageResult(context.GetPage("page-arg")).Result, Is.EqualTo(@"value")); + Assert.That(new PageResult(context.GetPage("page-empty")).Result, Is.EqualTo(@"value")); + Assert.That(new PageResult(context.GetPage("page-noarg")).Result.NormalizeNewLines(), + Is.EqualTo("<div class=\"alert alert-danger\">Value cannot be null.\nParameter name: noArg</div>")); + Assert.That(new PageResult(context.GetPage("page-msg")).Result.NormalizeNewLines(), + Is.EqualTo("<div class=\"alert alert-danger\">empty required</div>")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/EvaluateScriptTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/EvaluateScriptTests.cs new file mode 100644 index 00000000000..dc9bc064c53 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/EvaluateScriptTests.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class EvaluateScriptTests + { + [Test] + public void Evaluate_does_return_ReturnValue() + { + var identity = new object(); + var context = new ScriptContext { + Args = { + ["identity"] = identity + } + }.Init(); + + Assert.That(context.Evaluate("{{ identity |> return }}"), Is.EqualTo(identity)); + Assert.That(context.Evaluate("{{ id |> return }}", new ObjectDictionary { + ["id"] = identity, + }), Is.EqualTo(identity)); + + Assert.That(context.Evaluate("{{ 1 + 1 |> return }}"), Is.EqualTo(2)); + Assert.That(context.Evaluate("{{ return(1 + 1) }}"), Is.EqualTo(2)); + } + + [Test] + public async Task Evaluate_does_return_ReturnValue_Async() + { + var identity = new object(); + var context = new ScriptContext { + Args = { + ["identity"] = identity + } + }.Init(); + + Assert.That(await context.EvaluateAsync("{{ identity |> return }}"), Is.EqualTo(identity)); + Assert.That(await context.EvaluateAsync("{{ id |> return }}", new ObjectDictionary { + ["id"] = identity, + }), Is.EqualTo(identity)); + + Assert.That(await context.EvaluateAsync("{{ 1 + 1 |> return }}"), Is.EqualTo(2)); + Assert.That(await context.EvaluateAsync("{{ return(1 + 1) }}"), Is.EqualTo(2)); + } + + [Test] + public void Evaluate_does_throw_ScriptException() + { + var context = new ScriptContext().Init(); + + try + { + context.Evaluate("{{ 'fail' |> throw }} {{ 1 |> return }}"); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + Assert.That(e.Message, Is.EqualTo("fail")); + Assert.That(e.InnerException.Message, Is.EqualTo("fail")); + Assert.That(e.PageStackTrace, Is.Not.Null); + } + + try + { + context.EvaluateScript("{{ 'fail' |> throw }} {{ 1 |> return }}"); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + Assert.That(e.Message, Is.EqualTo("fail")); + Assert.That(e.InnerException.Message, Is.EqualTo("fail")); + Assert.That(e.PageStackTrace, Is.Not.Null); + } + } + + [Test] + public async Task Evaluate_does_throw_ScriptException_Async() + { + var context = new ScriptContext().Init(); + + try + { + await context.EvaluateAsync("{{ 'fail' |> throw }} {{ 1 |> return }}"); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + Assert.That(e.Message, Is.EqualTo("fail")); + Assert.That(e.InnerException.Message, Is.EqualTo("fail")); + Assert.That(e.PageStackTrace, Is.Not.Null); + } + + try + { + await context.EvaluateScriptAsync("{{ 'fail' |> throw }} {{ 1 |> return }}"); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + Assert.That(e.Message, Is.EqualTo("fail")); + Assert.That(e.InnerException.Message, Is.EqualTo("fail")); + Assert.That(e.PageStackTrace, Is.Not.Null); + } + } + + [Test] + public void Evaluate_script_without_return_throws_NotSupportedException() + { + var context = new ScriptContext().Init(); + try + { + Assert.That(context.EvaluateScript("{{1 + 1}}"), Is.EqualTo("2")); + + context.Evaluate("{{ 1 + 1 }}"); + Assert.Fail("Should throw"); + } + catch (NotSupportedException) {} + } + + [Test] + public void Evaluate_does_convert_return_Value() + { + var context = new ScriptContext().Init(); + + Assert.That(context.Evaluate<string>("{{ return(1 + 1) }}"), Is.EqualTo("2")); + Assert.That(context.Evaluate<int>("{{ return(1 + 1) }}"), Is.EqualTo(2)); + Assert.That(context.Evaluate<long>("{{ return(1 + 1) }}"), Is.EqualTo(2)); + Assert.That(context.Evaluate<double>("{{ return(1 + 1) }}"), Is.EqualTo(2)); + Assert.That(context.Evaluate<double>("{{ return('2') }}"), Is.EqualTo(2)); + + Assert.That(context.Evaluate("{{ return({Age:1,Name:'foo'}) }}"), Is.EqualTo(new Dictionary<string, object> { + {"Age", 1}, + {"Name", "foo"}, + })); + + var person = context.Evaluate<Person>("{{ return({Age:1,Name:'foo'}) }}"); + Assert.That(person.Age, Is.EqualTo(1)); + Assert.That(person.Name, Is.EqualTo("foo")); + + Assert.That(context.Evaluate<Dictionary<string, object>>("{{ return(person) }}", new ObjectDictionary { + ["person"] = new Person { Age = 1, Name = "foo" } + }), Is.EqualTo(new Dictionary<string, object> { + {"Age", 1}, + {"Name", "foo"}, + })); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ExpressionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ExpressionTests.cs new file mode 100644 index 00000000000..f390cc91c5a --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ExpressionTests.cs @@ -0,0 +1,91 @@ +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ExpressionTests + { + [Test] + public void Can_assign_list_numbers() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ [1,2,3] |> assignTo: numArray }} +{{ do: assign('numArray[1]', 4) }} +{{ numArray[1] }} +").Trim(), Is.EqualTo("4")); + } + + [Test] + public void Does_not_execute_do_on_null_or_none_existing_value() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ 1 |> assignTo: arg }} +{{ arg |> do: assign('doArg', incr(it)) }} +{{ doArg }} +").Trim(), Is.EqualTo("2")); + + Assert.That(context.EvaluateScript(@" +{{ null |> assignTo: arg }} +{{ arg |> do: assign('doArg', 2) }} +{{ doArg }} +").Trim(), Is.EqualTo("")); + + Assert.That(context.EvaluateScript(@" +{{ noArg |> do: assign('doArg', 2) }} +{{ doArg }} +").Trim(), Is.EqualTo("")); + } + + [Test] + public void Can_assign_array_numbers() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ [1,2,3] |> toArray |> assignTo: numArray }} +{{ do: assign('numArray[1]', 4) }} +{{ numArray[1] }} +").Trim(), Is.EqualTo("4")); + } + + [Test] + public void Can_assign_list_strings() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ ['a','b','c'] |> assignTo: stringArray }} +{{ do: assign('stringArray[1]', 'd') }} +{{ stringArray[1] }} +").Trim(), Is.EqualTo("d")); + } + + [Test] + public void Can_assign_array_strings() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ ['a','b','c'] |> toArray |> assignTo: stringArray }} +{{ do: assign('stringArray[1]', 'd') }} +{{ stringArray[1] }} +").Trim(), Is.EqualTo("d")); + } + + [Test] + public void Can_assign_dictionary_strings() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@" +{{ { a: 'foo', b: 'bar' } |> assignTo: map }} +{{ do: assign('map[`b`]', 'qux') }} +{{ map['b'] }} +").Trim(), Is.EqualTo("qux")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/GithubScriptTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/GithubScriptTests.cs new file mode 100644 index 00000000000..9b1d6369a4b --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/GithubScriptTests.cs @@ -0,0 +1,69 @@ +using System.IO; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + [Ignore("Integration Tests")] + public class GithubScriptTests + { + public ScriptContext CreateScriptContext() + { + return new ScriptContext { + Plugins = { new GitHubPlugin() }, + ScriptMethods = { new InfoScripts(), new ProtectedScripts(), }, + }; + } + + [Test] + public void Can_write_and_read_gist_files() + { + var context = CreateScriptContext().Init(); + + var output = context.EvaluateScript(@" +```code +githubGateway('GITHUB_GIST_TOKEN'.envVariable()) |> to => gateway + +{{ gateway.githubCreateGist('Hello World Examples', { + 'hello_world_ruby.txt': 'Run `ruby hello_world.rb` to print Hello World', + 'hello_world_python.txt': 'Run `python hello_world.py` to print Hello World', + }) + |> to => newGist }} + +{ ...newGist, Files: null, Owner: null } |> textDump({ caption: 'new gist' }) +newGist.Owner |> textDump({ caption: 'new gist owner' }) +newGist.Files |> toList |> map(x => x.Value.textDump({ caption: x.Key })) |> join('\n') + +gateway.githubGist(newGist.Id) |> to => gist +{ ...gist, Files: null, Owner: null } |> textDump({ caption: 'gist' }) +gist.Files |> toList |> map(x => x.Value.textDump({ caption: x.Key })) |> join('\n') +```"); + + output.Print(); + } + + [Test] + public void Display_Gist() + { + var context = CreateScriptContext().Init(); + context.Args["gistId"] = "4c5d95ec4b2594b4cdd238987fe7a15a"; + + var output = context.EvaluateScript(@" +```code +githubGateway('GITHUB_GIST_TOKEN'.envVariable()) |> to => gateway + +gateway.githubGist(gistId) |> to => gist + +{ ...gist, Files: null, Owner: null } |> textDump({ caption: 'gist' }) + +`### Gist Files` +#each file in gist.Files.Keys + gist.Files[file] |> textDump({ caption: file }) +/each +```"); + + output.Print(); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsArrowFunctionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsArrowFunctionTests.cs new file mode 100644 index 00000000000..ac276be3a3b --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsArrowFunctionTests.cs @@ -0,0 +1,233 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + [TestFixture] + public class JsArrowFunctionTests + { + [Test] + public void Does_parse_Arrow_Expressions() + { + JsToken token; + + "a => 1".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrowFunctionExpression( + new JsIdentifier("a"), + new JsLiteral(1) + ))); + + "a => a + 1".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrowFunctionExpression( + new JsIdentifier("a"), + new JsBinaryExpression( + new JsIdentifier("a"), + JsAddition.Operator, + new JsLiteral(1) + ) + ))); + + "a=>a+1".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrowFunctionExpression( + new JsIdentifier("a"), + new JsBinaryExpression( + new JsIdentifier("a"), + JsAddition.Operator, + new JsLiteral(1) + ) + ))); + + "(a,b) => a + b".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrowFunctionExpression( + new[] + { + new JsIdentifier("a"), + new JsIdentifier("b"), + }, + new JsBinaryExpression( + new JsIdentifier("a"), + JsAddition.Operator, + new JsIdentifier("b") + ) + ))); + + "fn(a => a + b)".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression(new JsIdentifier("fn"), + new JsArrowFunctionExpression( + new[] + { + new JsIdentifier("a"), + }, + new JsBinaryExpression( + new JsIdentifier("a"), + JsAddition.Operator, + new JsIdentifier("b") + ) + )))); + + "fn((a,b) => a + b)".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression(new JsIdentifier("fn"), + new JsArrowFunctionExpression( + new[] + { + new JsIdentifier("a"), + new JsIdentifier("b"), + }, + new JsBinaryExpression( + new JsIdentifier("a"), + JsAddition.Operator, + new JsIdentifier("b") + ) + )))); + + "{ k: a => 1 }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsObjectExpression( + new JsProperty( + new JsIdentifier("k"), + new JsArrowFunctionExpression( + new JsIdentifier("a"), + new JsLiteral(1) + ) + )))); + } + + [Test] + public void Does_evaluate_shorthand_Arrow_Expressions() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ [1,2,3] |> map(it => it * it) |> sum }}"), Is.EqualTo("14")); + + Assert.That(context.EvaluateScript("{{ [1,2,3] |> map(n => n * n) |> sum }}"), Is.EqualTo("14")); + + Assert.That(context.EvaluateScript("{{ [1,2,3] |> map => it * it |> sum }}"), Is.EqualTo("14")); + + Assert.That(context.EvaluateScript("{{ [1,2,3] |> where => it % 2 == 1 |> map => it * it |> sum }}"), Is.EqualTo("10")); + + Assert.That(context.EvaluateScript("{{ [1,2,3] |> all => it > 2 |> lower }}"), Is.EqualTo("false")); + + Assert.That(context.EvaluateScript("{{ [1,2,3] |> any => it > 2 |> show: Y }}"), Is.EqualTo("Y")); + + Assert.That(context.EvaluateScript("{{ [1,2,3] |> orderByDesc => it |> join }}"), Is.EqualTo("3,2,1")); + + Assert.That(context.EvaluateScript("{{ [3,2,1] |> orderBy => it |> join }}"), Is.EqualTo("1,2,3")); + + Assert.That(context.EvaluateScript("{{ [1,2,3] |> map => it * it |> assignTo => values }}{{ values |> sum }}"), Is.EqualTo("14")); + + Assert.That(context.EvaluateScript("{{ ['A','B','C'] |> map => lower(it) |> map => `${it}` |> join('') }}"), Is.EqualTo("abc")); + + Assert.That(context.EvaluateScript("{{ ['A','B','C'] |> map => lower(it) |> map => `${it}` |> concat }}"), Is.EqualTo("abc")); + } + + [Test] + public void Does_evaluate_let_bindings_Arrow_Expressions() + { + var context = new ScriptContext + { + Args = + { + ["people"] = new[] { new Person("name1", 1), new Person("name2", 2), new Person("name3", 3), } + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ [1,2,3] |> let => { a: it * it, b: isOdd(it) } |> select: ({a},{b}), }}"), + Is.EqualTo("(1,True),(4,False),(9,True),")); + + Assert.That(context.EvaluateScript("{{ people |> let => { a: it.Name, b: it.Age * 2 } |> select: ({a},{b}), }}"), + Is.EqualTo("(name1,2),(name2,4),(name3,6),")); + + Assert.That(context.EvaluateScript("{{ people |> let => { it.Name, it.Age } |> select: ({Name},{Age}), }}"), + Is.EqualTo("(name1,1),(name2,2),(name3,3),")); + + Assert.That(context.EvaluateScript("{{ people |> map => { it.Name, it.Age } |> select: ({it.Name},{it.Age}), }}"), + Is.EqualTo("(name1,1),(name2,2),(name3,3),")); + } + + [Test] + public void Does_evaluate_toDictionary_Arrow_Expressions() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@"{{ [{name:'Alice',score:50},{name:'Bob',score:40},{name:'Cathy',score:45}] |> assignTo=>scoreRecords }} +Bob's score: {{ scoreRecords + |> toDictionary => it.name + |> map => it.Bob + |> select: { it.name } = { it.score } +}}"), Is.EqualTo("Bob's score: Bob = 40")); + } + + [Test] + public void Does_evaluate_reduce_Arrow_Expressions() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@"{{ [20, 10, 40, 50, 10, 70, 30] |> assignTo: attemptedWithdrawals }} +{{ attemptedWithdrawals + |> reduce((balance, nextWithdrawal) => ((nextWithdrawal <= balance) ? (balance - nextWithdrawal) : balance), + { initialValue: 100.0, }) + |> select: Ending balance: { it }. }}"), + Is.EqualTo("Ending balance: 20.")); + } + + public class AnagramEqualityComparer : IEqualityComparer<string> + { + public bool Equals(string x, string y) => GetCanonicalString(x) == GetCanonicalString(y); + public int GetHashCode(string obj) => GetCanonicalString(obj).GetHashCode(); + private string GetCanonicalString(string word) + { + var wordChars = word.ToCharArray(); + Array.Sort(wordChars); + return new string(wordChars); + } + } + + [Test] + public void Does_evaluate_groupBy_Arrow_Expressions() + { + var context = new ScriptContext + { + Args = + { + ["anagramComparer"] = new AnagramEqualityComparer() + } + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ ['from ', ' salt', ' earn ', ' last ', ' near ', ' form '] |> assignTo: anagrams }} +{{#each groupBy(anagrams, w => trim(w), { map: x => upper(x), comparer: anagramComparer }) }}{{it |> json}}{{/each}}"), + Is.EqualTo(@"[""FROM "","" FORM ""]["" SALT"","" LAST ""]["" EARN "","" NEAR ""]")); + } + + class MyFilters : ScriptMethods + { + public double pow(double arg1, double arg2) => arg1 / arg2; + } + + [Test] + public void Can_Invoke_Arrow_Expressions() + { + var context = new ScriptContext().Init(); + + var expr = JS.expression("pow(2,2) + pow(4,2)"); + Assert.That(expr.Evaluate(), Is.EqualTo(20)); + + Assert.That(JS.eval("pow(2,2) + pow(4,2)"), Is.EqualTo(20)); + + var scope = JS.CreateScope(args: new Dictionary<string, object> { + ["a"] = 2, + ["b"] = 4, + }); + Assert.That(JS.eval("pow(a,2) + pow(b,2)", scope), Is.EqualTo(20)); + + var customPow = JS.CreateScope(functions: new MyFilters()); + Assert.That(JS.eval("pow(2,2) + pow(4,2)", customPow), Is.EqualTo(3)); + + var arrowExpr = (JsArrowFunctionExpression)JS.expression("(a,b) => pow(a,2) + pow(b,2)"); + + Assert.That(arrowExpr.Invoke(2,4), Is.EqualTo(20)); + + Assert.That(arrowExpr.Invoke(customPow, 2,4), Is.EqualTo(3)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsAssignmentTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsAssignmentTests.cs new file mode 100644 index 00000000000..ef337ab1f9b --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsAssignmentTests.cs @@ -0,0 +1,253 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class JsAssignmentTests + { + [Test] + public void Does_parse_assignment_expressions() + { + JsToken token; + + "a = 1 == 2 ? 3 : 4".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsAssignmentExpression( + new JsIdentifier("a"), + JsAssignment.Operator, + new JsConditionalExpression( + new JsBinaryExpression(new JsLiteral(1), JsEquals.Operator, new JsLiteral(2)), + new JsLiteral(3), + new JsLiteral(4)) + ))); + } + + + [Test] + public void Can_assign_local_Variables() + { + var context = new ScriptContext().Init(); + + var pageResult = new PageResult(context.OneTimePage("{{ var a = 1 }}a == {{a}}")); + var output = pageResult.RenderScript(); + Assert.That(output, Is.EqualTo("a == 1")); + + pageResult = new PageResult(context.OneTimePage("{{ var a = 1, b = 1 + 1 }}b == {{b}}")); + output = pageResult.RenderScript(); + Assert.That(output, Is.EqualTo("b == 2")); + + pageResult = new PageResult(context.OneTimePage("{{ var a = 1 }}:{{ a = 2 }}:a == {{a}}")); + output = pageResult.RenderScript(); + Assert.That(output, Is.EqualTo(":2:a == 2")); + Assert.That(!pageResult.Args.ContainsKey("a")); + } + + [Test] + public void Can_assign_global_Variables() + { + var context = new ScriptContext().Init(); + + var pageResult = new PageResult(context.OneTimePage("a == {{a = 1}}")); + var output = pageResult.RenderScript(); + Assert.That(output, Is.EqualTo("a == 1")); + Assert.That(pageResult.Args["a"], Is.EqualTo(1)); + + pageResult = new PageResult(context.OneTimePage("g == {{global.g = 1}}")); + output = pageResult.RenderScript(); + Assert.That(pageResult.Args["g"], Is.EqualTo(1)); + Assert.That(output, Is.EqualTo("g == 1")); + + pageResult = new PageResult(context.OneTimePage("g == {{global['g'] = 2}}")); + output = pageResult.RenderScript(); + Assert.That(pageResult.Args["g"], Is.EqualTo(2)); + Assert.That(output, Is.EqualTo("g == 2")); + } + + public class GrandNestedPerson + { + public NestedPerson Nested { get; set; } + } + + public class NestedPerson + { + public Person A { get; set; } + } + + [Test] + public void Can_assign_collections_and_pocos() + { + void populateArgs(Dictionary<string, object> args) + { + args["intList"] = new List<int> { 1, 2, 3 }; + args["intArray"] = new[] { 1, 2, 3 }; + args["stringList"] = new List<string> { "a", "b", "c" }; + args["stringArray"] = new [] { "a", "b", "c" }; + args["intMap"] = new Dictionary<string, int> { + ["a"] = 1, + ["b"] = 2, + ["c"] = 3, + }; + args["stringMap"] = new Dictionary<string, string> { + ["a"] = "A", + ["b"] = "B", + ["c"] = "C", + }; + args["person"] = new Person { + Age = 27, + Name = "Kurt", + }; + args["nestedObjectMap"] = new Dictionary<string, object> { + ["person"] = new Person { + Age = 27, + Name = "Kurt", + }, + ["nestedPerson"] = new NestedPerson { + A = new Person + { + Age = 27, + Name = "Kurt", + } + }, + ["grandNestedPerson"] = new GrandNestedPerson + { + Nested = new NestedPerson { + A = new Person + { + Age = 27, + Name = "Kurt", + } + } + } + }; + args["grandNestedPerson"] = new GrandNestedPerson { + Nested = new NestedPerson { + A = new Person { + Age = 27, + Name = "Kurt", + } + } + }; + } + + var context = new ScriptContext(); + populateArgs(context.Args); + context.Init(); + + void assert<T>(string src, string expectedOutput, Func<Dictionary<string,object>, T> actual, T expected) + { + var pageResult = new PageResult(context.OneTimePage(src)); + var output = pageResult.RenderScript(); + Assert.That(output, Is.EqualTo(expectedOutput)); + Assert.That(actual(context.Args), Is.EqualTo(expected)); + + var local = new ScriptContext().Init(); + pageResult = new PageResult(local.OneTimePage(src)); + populateArgs(pageResult.Args); + output = pageResult.RenderScript(); + Assert.That(output, Is.EqualTo(expectedOutput)); + Assert.That(actual(pageResult.Args), Is.EqualTo(expected)); + } + + assert("intList[1] == {{ intList[1] = 4 }}", "intList[1] == 4", + args => ((List<int>)args["intList"])[1], 4); + + assert("intArray[1] == {{ intArray[1] = 4 }}", "intArray[1] == 4", + args => ((int[])args["intArray"])[1], 4); + + assert("stringList[1] == {{ stringList[1] = 'D' }}", "stringList[1] == D", + args => ((List<string>)args["stringList"])[1], "D"); + + assert("stringArray[1] == {{ stringArray[1] = 'D' }}", "stringArray[1] == D", + args => ((string[])args["stringArray"])[1], "D"); + + assert("intMap['b'] == {{ intMap['b'] = 4 }}", "intMap['b'] == 4", + args => ((Dictionary<string, int>)args["intMap"])["b"], 4); + + assert("stringMap['b'] == {{ stringMap['b'] = 'D' }}", "stringMap['b'] == D", + args => ((Dictionary<string, string>)args["stringMap"])["b"], "D"); + + assert("intMap.b == {{ intMap.b = 4 }}", "intMap.b == 4", + args => ((Dictionary<string, int>)args["intMap"])["b"], 4); + + assert("stringMap.b == {{ stringMap.b = 'D' }}", "stringMap.b == D", + args => ((Dictionary<string, string>)args["stringMap"])["b"], "D"); + + assert("person.Age == {{ person.Age = 30 }}", "person.Age == 30", + args => ((Person)args["person"]).Age, 30); + assert("person.Name == {{ person.Name = 'Eddie' }}", "person.Name == Eddie", + args => ((Person)args["person"]).Name, "Eddie"); + + assert("nestedObjectMap['person'].Age == {{ nestedObjectMap['person'].Age = 30 }}", "nestedObjectMap['person'].Age == 30", + args => ((Person)((Dictionary<string,object>)args["nestedObjectMap"])["person"]).Age, 30); + assert("nestedObjectMap['per' + 'son'].Name == {{ nestedObjectMap['per' + 'son'].Name = 'Eddie' }}", "nestedObjectMap['per' + 'son'].Name == Eddie", + args => ((Person)((Dictionary<string,object>)args["nestedObjectMap"])["person"]).Name, "Eddie"); + + assert("nestedObjectMap.person.Age == {{ nestedObjectMap.person.Age = 30 }}", "nestedObjectMap.person.Age == 30", + args => ((Person)((Dictionary<string,object>)args["nestedObjectMap"])["person"]).Age, 30); + assert("nestedObjectMap.person.Name == {{ nestedObjectMap.person.Name = 'Eddie' }}", "nestedObjectMap.person.Name == Eddie", + args => ((Person)((Dictionary<string,object>)args["nestedObjectMap"])["person"]).Name, "Eddie"); + + assert("nestedObjectMap['nestedPerson'].A.Age == {{ nestedObjectMap['nestedPerson'].A.Age = 30 }}", "nestedObjectMap['nestedPerson'].A.Age == 30", + args => ((NestedPerson)((Dictionary<string,object>)args["nestedObjectMap"])["nestedPerson"]).A.Age, 30); + assert("nestedObjectMap['nestedPerson'].A.Name == {{ nestedObjectMap['nestedPerson'].A.Name = 'Eddie' }}", "nestedObjectMap['nestedPerson'].A.Name == Eddie", + args => ((NestedPerson)((Dictionary<string,object>)args["nestedObjectMap"])["nestedPerson"]).A.Name, "Eddie"); + + assert("nestedObjectMap['grandNestedPerson'].Nested.A.Age == {{ nestedObjectMap['grandNestedPerson'].Nested.A.Age = 30 }}", "nestedObjectMap['grandNestedPerson'].Nested.A.Age == 30", + args => ((GrandNestedPerson)((Dictionary<string,object>)args["nestedObjectMap"])["grandNestedPerson"]).Nested.A.Age, 30); + assert("nestedObjectMap['grandNestedPerson'].Nested.A.Name == {{ nestedObjectMap['grandNestedPerson'].Nested.A.Name = 'Eddie' }}", "nestedObjectMap['grandNestedPerson'].Nested.A.Name == Eddie", + args => ((GrandNestedPerson)((Dictionary<string,object>)args["nestedObjectMap"])["grandNestedPerson"]).Nested.A.Name, "Eddie"); + + assert("grandNestedPerson.Nested.A.Age == {{ grandNestedPerson.Nested.A.Age = 30 }}", "grandNestedPerson.Nested.A.Age == 30", + args => ((GrandNestedPerson)args["grandNestedPerson"]).Nested.A.Age, 30); + assert("grandNestedPerson.Nested.A.Name == {{ grandNestedPerson.Nested.A.Name = 'Eddie' }}", "grandNestedPerson.Nested.A.Name == Eddie", + args => ((GrandNestedPerson)args["grandNestedPerson"]).Nested.A.Name, "Eddie"); + + + assert("intList[1.isOdd() ? 2 : 3] == {{ intList[1.isOdd() ? 2 : 3] = 4 }}", "intList[1.isOdd() ? 2 : 3] == 4", + args => ((List<int>)args["intList"])[1+1], 4); + + assert("stringMap[1.isEven() ? 'a' : 'b'] == {{ stringMap[1.isEven() ? 'a' : 'b'] = 'D' }}", "stringMap[1.isEven() ? 'a' : 'b'] == D", + args => ((Dictionary<string, string>)args["stringMap"])["b"], "D"); + } + + [Test] + public void Variable_declarations_truncate_their_whitespace() + { + var context = new ScriptContext().Init(); + + var output = context.RenderScript(@"{{ var a = 1 }} +{{ var b = 2 }} +{{ var c = 3 }} +a + b + c = {{ a + b + c }}"); + + Assert.That(output, Is.EqualTo("a + b + c = 6")); + } + + [Test] + public void Variable_declarations_does_return_an_null_value() + { + var context = new ScriptContext().Init(); + + var output = context.RenderScript(@"{{ isNull(var a = 1) }}:{{a}}"); + + Assert.That(output, Is.EqualTo("True:1")); + } + + [Test] + public void Does_assign_entire_expression() + { + var context = new ScriptContext().Init(); + var output = context.RenderScript(@" +```code|q +var optional = [] +var key = 'a' +key = optional.contains(key) ? `${key}?` : key +``` +{{key}}"); + output.Print(); + Assert.That(output.Trim(), Is.EqualTo("a")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsAstTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsAstTests.cs new file mode 100644 index 00000000000..4f768ab2708 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsAstTests.cs @@ -0,0 +1,133 @@ +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class JsAstTests + { + [Test] + public void Can_use_ToJsAst_to_generate_Esprima_AST() + { + JsToken token = JS.expression("{ key: a.prop == 1 ? b < 2 : c > 3 }"); + +// "{ key: a.prop == 1 ? b < 2 : c > 3 }".ParseJsExpression(out token); + + Dictionary<string, object> ast = token.ToJsAst(); + + ast.ToJson().IndentJson().Print(); + + var expected = new Dictionary<string, object> { + ["type"] = "ObjectExpression", + ["properties"] = new List<object> { + new Dictionary<string, object> { + ["type"] = "Property", + ["key"] = new Dictionary<string, object> { + ["type"] = "Identifier", + ["name"] = "key", + }, + ["computed"] = false, + ["value"] = new Dictionary<string, object> { + ["type"] = "ConditionalExpression", + ["test"] = new Dictionary<string, object> { + ["type"] = "BinaryExpression", + ["operator"] = "==", + ["left"] = new Dictionary<string, object> { + ["type"] = "MemberExpression", + ["computed"] = false, + ["object"] = new Dictionary<string, object> { + ["type"] = "Identifier", + ["name"] = "a", + }, + ["property"] = new Dictionary<string, object> { + ["type"] = "Identifier", + ["name"] = "prop", + } + }, + ["right"] = new Dictionary<string, object> { + ["type"] = "Literal", + ["value"] = 1, + ["raw"] = "1", + }, + }, + ["consequent"] = new Dictionary<string, object> { + ["type"] = "BinaryExpression", + ["operator"] = "<", + ["left"] = new Dictionary<string, object> { + ["type"] = "Identifier", + ["name"] = "b", + }, + ["right"] = new Dictionary<string, object> { + ["type"] = "Literal", + ["value"] = 2, + ["raw"] = "2", + }, + }, + ["alternate"] = new Dictionary<string, object> { + ["type"] = "BinaryExpression", + ["operator"] = ">", + ["left"] = new Dictionary<string, object> { + ["type"] = "Identifier", + ["name"] = "c", + }, + ["right"] = new Dictionary<string, object> { + ["type"] = "Literal", + ["value"] = 3, + ["raw"] = "3", + }, + }, + }, + ["kind"] = "init", + ["method"] = false, + ["shorthand"] = false, + } + } + }; + + "Expected: ".Print(); + expected.ToJson().IndentJson().Print(); + + Assert.That(ast, Is.EqualTo(expected)); + } + + [Test] + public void Does_support_ast_with_null() + { + JsToken token; + + "a > b ? a : null".ParseJsExpression(out token); + + var ast = token.ToJsAst(); + + token.ToJsAstString().Print(); + + var expected = new Dictionary<string, object> { + ["type"] = "ConditionalExpression", + ["test"] = new Dictionary<string, object> { + ["type"] = "BinaryExpression", + ["operator"] = ">", + ["left"] = new Dictionary<string, object> { + ["type"] = "Identifier", + ["name"] = "a", + }, + ["right"] = new Dictionary<string, object> { + ["type"] = "Identifier", + ["name"] = "b", + }, + }, + ["consequent"] = new Dictionary<string, object> { + ["type"] = "Identifier", + ["name"] = "a", + }, + ["alternate"] = new Dictionary<string, object> { + ["type"] = "Literal", + ["value"] = null, + ["raw"] = "null", + }, + }; + + Assert.That(ast, Is.EqualTo(expected)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsLiteralTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsLiteralTests.cs new file mode 100644 index 00000000000..4a1710c40f6 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsLiteralTests.cs @@ -0,0 +1,198 @@ +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class JsLiteralTests + { + [Test] + public void Can_parse_simple_TemplateLiterals() + { + JsToken token; + + "``".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { new JsTemplateElement("","", tail:true) }))); + + "`a`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { new JsTemplateElement("a","a", tail:true) }))); + + "1.0".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral(1.0))); + + var hold = ScriptConfig.ParseRealNumber; + ScriptConfig.ParseRealNumber = numLiteral => numLiteral.ParseDecimal(); + + "1.0".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral(1.0m))); + + ScriptConfig.ParseRealNumber = hold; + + "`a${b}`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement("a","a"), + new JsTemplateElement("","", tail:true), + }, + new[] { new JsIdentifier("b") }))); + + "`a ${b} c`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement("a ","a "), + new JsTemplateElement(" c"," c", tail:true), + }, + new[] { new JsIdentifier("b") }))); + + "`a ${b + 1} c ${incr(d + 1)}`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement("a ","a "), + new JsTemplateElement(" c "," c "), + new JsTemplateElement("","", tail:true) + }, + new JsToken[] { + new JsBinaryExpression( + new JsIdentifier("b"), + JsAddition.Operator, + new JsLiteral(1) + ), + new JsCallExpression( + new JsIdentifier("incr"), + new JsBinaryExpression( + new JsIdentifier("d"), + JsAddition.Operator, + new JsLiteral(1) + ) + ), + }))); + + "`\"\"`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement("\"\"", "\"\"", tail:true), + } + ))); + + "`''`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement("''", "''", tail:true), + } + ))); + + @"`""#key"".replace(/\\s+/g,'')`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement( + "\"#key\".replace(/\\\\s+/g,'')", + "\"#key\".replace(/\\s+/g,'')", + tail:true), + } + ))); + + "`${a}${b}`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement("",""), + new JsTemplateElement("",""), + new JsTemplateElement("","", tail:true), + }, + new[] { new JsIdentifier("a"), new JsIdentifier("b") }))); + + } + + [Test] + public void Can_parse_strings_with_escape_chars() + { + JsToken token; + + @"′\\′".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral(@"\\"))); + } + + [Test] + public void Can_parse_TemplateLiterals_with_escape_chars() + { + JsToken token; + + @"`${a}\${b}`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement("",""), + new JsTemplateElement(@"\${b}","${b}", tail:true), + }, + new[] { new JsIdentifier("a") }))); + + @"`${a}\\${b}`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement("",""), + new JsTemplateElement(@"\\",@"\"), + new JsTemplateElement("","", tail:true), + }, + new[] { new JsIdentifier("a"), new JsIdentifier("b") }))); + + @"`${a}\\\${b}`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { + new JsTemplateElement("",""), + new JsTemplateElement(@"\\\${b}",@"\${b}", tail:true), + }, + new[] { new JsIdentifier("a") }))); + + @"`\\`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { new JsTemplateElement("\\\\","\\", tail:true) }))); + + @"`\\ \n`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral( + new[] { new JsTemplateElement(@"\\ \n","\\ \n", tail:true) }))); + } + + [Test] + public void Can_evaluate_TemplateLiterals_with_escape_chars() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript(@"{{ `\\` }}"), + Is.EqualTo(@"\")); + + Assert.That(context.EvaluateScript(@"{{ `\\ \n` }}"), + Is.EqualTo("\\ \n")); + + Assert.That(context.EvaluateScript(@"{{ `""#key"".replace(/\\s+/g,'')` |> raw }}"), + Is.EqualTo(@"""#key"".replace(/\s+/g,'')")); + } + + [Test] + public void Does_evaluate_TemplateLiteral() + { + var context = new ScriptContext { + Args = { + ["a"] = 1, + ["b"] = 2, + ["c"] = 3, + ["d"] = 4, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{``}}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{`a`}}"), Is.EqualTo("a")); + Assert.That(context.EvaluateScript("{{`a${b}`}}"), Is.EqualTo("a2")); + Assert.That(context.EvaluateScript("{{`a ${b} c`}}"), Is.EqualTo("a 2 c")); + Assert.That(context.EvaluateScript("{{`a ${b + 1} c ${incr(d + 1)}`}}"), Is.EqualTo("a 3 c 6")); + Assert.That(context.EvaluateScript("{{`\n`}}"), Is.EqualTo("\n")); + Assert.That(context.EvaluateScript("{{`a\n${b}`}}"), Is.EqualTo("a\n2")); + Assert.That(context.EvaluateScript("{{`\"\"` |> raw}}"), Is.EqualTo("\"\"")); + Assert.That(context.EvaluateScript("{{`''` |> raw}}"), Is.EqualTo("''")); + Assert.That(context.EvaluateScript("{{`a\"b\"c` |> raw}}"), Is.EqualTo("a\"b\"c")); + Assert.That(context.EvaluateScript("{{`a'b'c` |> raw}}"), Is.EqualTo("a'b'c")); + + Assert.That(context.EvaluateScript("{{`a\"b\"c` |> appendTo: a}}{{ a |> raw }}"), Is.EqualTo("a\"b\"c")); + Assert.That(context.EvaluateScript("{{`${a}\\\\${b}`}}"), Is.EqualTo("1\\2")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsLogicalExpressionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsLogicalExpressionTests.cs new file mode 100644 index 00000000000..fabd7aeb701 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsLogicalExpressionTests.cs @@ -0,0 +1,186 @@ +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class JsLogicalExpressionTests + { + [Test] + public void Does_parse_logical_expressions() + { + JsToken token; + + "a && b".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLogicalExpression( + new JsIdentifier("a"), + JsAnd.Operator, + new JsIdentifier("b") + ))); + + "a || b".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLogicalExpression( + new JsIdentifier("a"), + JsOr.Operator, + new JsIdentifier("b") + ))); + + "a || b && c || d".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLogicalExpression( + new JsLogicalExpression( + new JsIdentifier("a"), + JsOr.Operator, + new JsLogicalExpression( + new JsIdentifier("b"), + JsAnd.Operator, + new JsIdentifier("c") + ) + ), + JsOr.Operator, + new JsIdentifier("d") + ))); + + "(a || b) && (c || d)".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLogicalExpression( + new JsLogicalExpression( + new JsIdentifier("a"), + JsOr.Operator, + new JsIdentifier("b") + ), + JsAnd.Operator, + new JsLogicalExpression( + new JsIdentifier("c"), + JsOr.Operator, + new JsIdentifier("d") + ) + ) + )); + } + + [Test] + public void Does_parse_logical_expressions_using_keyword_operators() + { + JsToken token; + + "a and b".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLogicalExpression( + new JsIdentifier("a"), + JsAnd.Operator, + new JsIdentifier("b") + ))); + + "a or b".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLogicalExpression( + new JsIdentifier("a"), + JsOr.Operator, + new JsIdentifier("b") + ))); + + "a or b and c or d".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLogicalExpression( + new JsLogicalExpression( + new JsIdentifier("a"), + JsOr.Operator, + new JsLogicalExpression( + new JsIdentifier("b"), + JsAnd.Operator, + new JsIdentifier("c") + ) + ), + JsOr.Operator, + new JsIdentifier("d") + ))); + + "(a or b) and (c or d)".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLogicalExpression( + new JsLogicalExpression( + new JsIdentifier("a"), + JsOr.Operator, + new JsIdentifier("b") + ), + JsAnd.Operator, + new JsLogicalExpression( + new JsIdentifier("c"), + JsOr.Operator, + new JsIdentifier("d") + ) + ) + )); + } + + [Test] + public void Does_parse_ConditionalExpression() + { + JsToken token; + + "a ? b : c".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsConditionalExpression( + new JsIdentifier("a"), + new JsIdentifier("b"), + new JsIdentifier("c") + ))); + + "(1 < 2) ? 3 + 4 : -5 + (add(6,a) + 7)".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsConditionalExpression( + new JsBinaryExpression( + new JsLiteral(1), + JsLessThan.Operator, + new JsLiteral(2) + ), + new JsBinaryExpression( + new JsLiteral(3), + JsAddition.Operator, + new JsLiteral(4) + ), + new JsBinaryExpression( + new JsUnaryExpression(JsMinus.Operator, new JsLiteral(5)), + JsAddition.Operator, + new JsBinaryExpression( + new JsCallExpression( + new JsIdentifier("add"), + new JsLiteral(6), + new JsIdentifier("a") + ), + JsAddition.Operator, + new JsLiteral(7) + ) + ) + ))); + + "1 + 2 > subtract(3, 4) ? 'YES' : 'NO'".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsConditionalExpression( + new JsBinaryExpression( + new JsBinaryExpression( + new JsLiteral(1), + JsAddition.Operator, + new JsLiteral(2) + ), + JsGreaterThan.Operator, + new JsCallExpression( + new JsIdentifier("subtract"), + new JsLiteral(3), + new JsLiteral(4) + ) + ), + new JsLiteral("YES"), + new JsLiteral("NO") + ))); + } + + [Test] + public void Does_evaluate_ConditionalExpression() + { + var context = new ScriptContext { + Args = { + ["varTrue"] = true, + ["varFalse"] = false, + ["a"] = 1, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ true ? 1 : 0 }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ false ? 1 : 0 }}"), Is.EqualTo("0")); + Assert.That(context.EvaluateScript("{{ (1 < 2) ? 3 + 4 : -5 + (add(6,a) + 7) }}"), Is.EqualTo("7")); + Assert.That(context.EvaluateScript("{{ 1 + 2 > subtract(3, 4) ? 'YES' : 'NO' }}"), Is.EqualTo("YES")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsMemberCallExpressionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsMemberCallExpressionTests.cs new file mode 100644 index 00000000000..c3e01c6f4ca --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsMemberCallExpressionTests.cs @@ -0,0 +1,383 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class JsMemberCallExpressionTests + { + [Test] + public void Does_parse_member_call_expressions() + { + JsToken token; + + "a.b()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsIdentifier("a"), + new JsIdentifier("b") + ) + ))); + + "a[key]()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsIdentifier("a"), + new JsIdentifier("key"), + computed:true + ) + ))); + + "a['key']()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsIdentifier("a"), + new JsLiteral("key"), + computed:true + ) + ))); + + "a.b.c[key]()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsMemberExpression( + new JsMemberExpression( + new JsIdentifier("a"), + new JsIdentifier("b") + ), + new JsIdentifier("c") + ), + new JsIdentifier("key"), + computed:true + )))); + + "toDateTime('2001-01-01').Day()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsCallExpression( + new JsIdentifier("toDateTime"), + new JsLiteral("2001-01-01") + ), + new JsIdentifier("Day") + ) + ))); + + "[toDateTime('2001-01-01')][0].Day()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsMemberExpression( + new JsArrayExpression( + new JsCallExpression( + new JsIdentifier("toDateTime"), + new JsLiteral("2001-01-01") + ) + ), + new JsLiteral(0), + computed:true + ), + new JsIdentifier("Day") + ) + ))); + } + + [Test] + public void Does_parse_member_call_expressions_on_literals() + { + JsToken token; + + "1.a()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsLiteral(1), + new JsIdentifier("a") + ) + ))); + + "1.2.a()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsLiteral(1.2), + new JsIdentifier("a") + ) + ))); + + "'a'.a()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsLiteral("a"), + new JsIdentifier("a") + ) + ))); + + "[1].a()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsArrayExpression(new JsLiteral(1)), + new JsIdentifier("a") + ) + ))); + + "{k:1}.a()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsObjectExpression( + new JsProperty(new JsIdentifier("k"), new JsLiteral(1)) + ), + new JsIdentifier("a") + ) + ))); + + "''.a()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsLiteral(""), + new JsIdentifier("a") + ) + ))); + + "[].a()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsArrayExpression(), + new JsIdentifier("a") + ) + ))); + } + + [Test] + public void Does_parse_member_call_expressions_on_literals_chained() + { + JsToken token; + + "1.a().b()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsCallExpression( + new JsMemberExpression( + new JsLiteral(1), + new JsIdentifier("a") + ) + ), + new JsIdentifier("b") + ) + ))); + + "1.2.a().b()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsCallExpression( + new JsMemberExpression( + new JsLiteral(1.2), + new JsIdentifier("a") + ) + ), + new JsIdentifier("b") + ) + ))); + + "'a'.a().b()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsCallExpression( + new JsMemberExpression( + new JsLiteral("a"), + new JsIdentifier("a") + ) + ), + new JsIdentifier("b") + ) + ))); + + "[1].a().b()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsCallExpression( + new JsMemberExpression( + new JsArrayExpression(new JsLiteral(1)), + new JsIdentifier("a") + ) + ), + new JsIdentifier("b") + ) + ))); + + "{k:1}.a().b()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsCallExpression( + new JsMemberExpression( + new JsObjectExpression( + new JsProperty(new JsIdentifier("k"), new JsLiteral(1)) + ), + new JsIdentifier("a") + ) + ), + new JsIdentifier("b") + ) + ))); + } + + [Test] + public void Does_parse_member_call_expressions_with_arrow_expression_args() + { + JsToken token; + + "a.b(x => x * 2)".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsIdentifier("a"), + new JsIdentifier("b") + ), + new JsArrowFunctionExpression( + new JsIdentifier("x"), + new JsBinaryExpression( + new JsIdentifier("x"), + JsMultiplication.Operator, + new JsLiteral(2) + ) + ) + ))); + } + + public class MyMethods : ScriptMethods + { + public object count(object target) => target == null + ? 0 + : target is string s + ? s.Length + : target is ICollection c + ? c.Count + : target is IEnumerable e + ? e.Cast<object>().Count() + : throw new NotSupportedException($"Cannot count '{target.GetType().Name}'"); + + public List<object> reverse(object target) => target == null + ? new List<object>() + : target is string s + ? s.Reverse().Cast<object>().ToList() + : target is IEnumerable e + ? e.Cast<object>().Reverse().ToList() + : throw new NotSupportedException($"Cannot count '{target.GetType().Name}'"); + + public double square(double target) => target * target; + } + + class TestTarget + { + public string String { get; set; } + + public int Int { get; set; } + public double Double { get; set; } + + public int[] Nums { get; set; } + } + + private static ScriptContext CreateScriptContext() + { + return new ScriptContext { + ScriptMethods = { new MyMethods() }, + Args = { + ["a"] = new TestTarget { + Int = 2, + String = "test", + Nums = new[] { 1,2,3 }, + }, + ["c"] = "count", + ["two"] = 2, + } + }; + } + + [Test] + public void Calling_method_with_no_args_on_members_calls_script_methods() + { + var context = CreateScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ a.String.count() }}"), Is.EqualTo("4")); + Assert.That(context.EvaluateScript("{{ a.String['count']() }}"), Is.EqualTo("4")); + Assert.That(context.EvaluateScript("{{ a.String[c]() }}"), Is.EqualTo("4")); + + Assert.That(context.EvaluateScript("{{ [1,2,3].count() }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ {a:1,b:2}.count() }}"), Is.EqualTo("2")); + + Assert.That(context.EvaluateScript("{{ [1,2,3].reverse().reverse().count() }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ a.Nums.reverse().reverse().count() }}"), Is.EqualTo("3")); + + Assert.That(context.EvaluateScript("{{ 2.square() }}"), Is.EqualTo("4")); + Assert.That(context.EvaluateScript("{{ 2.square().square() }}"), Is.EqualTo("16")); + Assert.That(context.EvaluateScript("{{ two.square() }}"), Is.EqualTo("4")); + Assert.That(context.EvaluateScript("{{ two.square().square() }}"), Is.EqualTo("16")); + + Assert.That(context.EvaluateScript("{{ a.String.count().square() }}"), Is.EqualTo("16")); + } + + [Test] + public void Can_call_methods_with_multiple_args() + { + var context = CreateScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 2.add(2) }}"), Is.EqualTo("4")); + Assert.That(context.EvaluateScript("{{ two.add(two) }}"), Is.EqualTo("4")); + Assert.That(context.EvaluateScript("{{ a.Int.add(two) }}"), Is.EqualTo("4")); + + Assert.That(context.EvaluateScript("{{ 2.add(2).add(2) }}"), Is.EqualTo("6")); + Assert.That(context.EvaluateScript("{{ two.add(two).add(two) }}"), Is.EqualTo("6")); + Assert.That(context.EvaluateScript("{{ a.Int.add(two).add(two) }}"), Is.EqualTo("6")); + Assert.That(context.EvaluateScript("{{ a.Int.add(a.Int.add(two)) }}"), Is.EqualTo("6")); + + Assert.That(context.EvaluateScript("{{ 'fmt {0} {1}'.fmt('a',2.add(2)) }}"), Is.EqualTo("fmt a 4")); + Assert.That(context.EvaluateScript("{{ 'fmt {0} {1} {2}'.fmt('a',2.add(2),a.Int.add(two).add(two)) }}"), Is.EqualTo("fmt a 4 6")); + } + + [Test] + public void Can_call_methods_with_multiple_args_and_scope() + { + var context = CreateScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 'foo'.assign(2).add(foo) }}"), Is.EqualTo("4")); + } + + [Test] + public void Can_call_methods_with_spread_args() + { + var context = CreateScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 'foo'.assign(...[2]).add(foo) }}"), Is.EqualTo("4")); + Assert.That(context.EvaluateScript("{{ 'fmt {0} {1}'.fmt(...['a',2.add(2)]) }}"), Is.EqualTo("fmt a 4")); + Assert.That(context.EvaluateScript("{{ 'fmt {0} {1} {2}'.fmt(...['a',2.add(2),a.Int.add(two).add(two)]) }}"), Is.EqualTo("fmt a 4 6")); + Assert.That(context.EvaluateScript("{{ 'fmt {0} {1} {2}'.fmt(...range(3)) }}"), Is.EqualTo("fmt 0 1 2")); + Assert.That(context.EvaluateScript("{{ 'fmt {0}'.fmt([...range(3)].count()) }}"), Is.EqualTo("fmt 3")); + } + + [Test] + public void Can_call_methods_with_arrow_expression_args() + { + var context = CreateScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ a.Nums.map(x => x * 2) |> join }}"), Is.EqualTo("2,4,6")); + Assert.That(context.EvaluateScript("{{ a.Nums.map(x => x * 2).count() }}"), Is.EqualTo("3")); + Assert.That(context.EvaluateScript("{{ a.Nums.map(x => x * 2).map(x => x.square()) |> join }}"), Is.EqualTo("4,16,36")); + + Assert.That(context.EvaluateScript("{{ a.Int.times().map(x => x + 2) |> join }}"), Is.EqualTo("2,3")); + Assert.That(context.EvaluateScript("{{ 'ABC'.repeat(3).count().divide(3).times().map(x => x + 2) |> join }}"), Is.EqualTo("2,3,4")); + + Assert.That(context.EvaluateScript("{{ 3.times().map(x => x[x.isEven() ? 'decr' : 'incr']()) |> join }}"), Is.EqualTo("-1,2,1")); + } + + [Test] + public void Does_stop_execution() + { + var context = CreateScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ a.Nums.map(x => x * 2).use('A') }}"), Is.EqualTo("A")); + Assert.That(context.EvaluateScript("{{ a.Nums.map(x => x * 2).end().use('A') }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ a.Nums.map(x => x * 2).end().use('A') }}{{ 1 + 1 }}"), Is.EqualTo("2")); + Assert.That(context.EvaluateScript("{{ a.Nums.map(x => x * 2).return().use('A') }}{{ 1 + 1 }}"), Is.EqualTo("")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsMemberExpressionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsMemberExpressionTests.cs new file mode 100644 index 00000000000..b8b33bcd1bc --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsMemberExpressionTests.cs @@ -0,0 +1,231 @@ +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class JsMemberExpressionTests + { + [Test] + public void Does_parse_member_expressions() + { + JsToken token; + + "a".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsIdentifier("a"))); + "a.b".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsMemberExpression( + new JsIdentifier("a"), + new JsIdentifier("b") + ))); + "a[key]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsMemberExpression( + new JsIdentifier("a"), + new JsIdentifier("key"), + computed:true + ))); + "a['key']".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsMemberExpression( + new JsIdentifier("a"), + new JsLiteral("key"), + computed:true + ))); + "a.b.c[key]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsMemberExpression( + new JsMemberExpression( + new JsMemberExpression( + new JsIdentifier("a"), + new JsIdentifier("b") + ), + new JsIdentifier("c") + ), + new JsIdentifier("key"), + computed:true + ))); + + "a[1+1]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsMemberExpression( + new JsIdentifier("a"), + new JsBinaryExpression( + new JsLiteral(1), + JsAddition.Operator, + new JsLiteral(1) + ), + computed:true + ))); + + "toDateTime('2001-01-01').Day".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsMemberExpression( + new JsCallExpression( + new JsIdentifier("toDateTime"), + new JsLiteral("2001-01-01") + ), + new JsIdentifier("Day") + ))); + + "[toDateTime('2001-01-01')][0].Day".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsMemberExpression( + new JsMemberExpression( + new JsArrayExpression( + new JsCallExpression( + new JsIdentifier("toDateTime"), + new JsLiteral("2001-01-01") + ) + ), + new JsLiteral(0), + computed:true + ), + new JsIdentifier("Day") + ))); + } + + class A + { + public string Name { get; set; } + public A Prop { get; set; } + public Dictionary<string, object> StringDictionary { get; set; } + public A[] Array { get; set; } + public List<A> List { get; set; } + public IEnumerable<A> Enumerable { get; set; } + public string[] ArrayStrings { get; set; } + public int[] ArrayInts { get; set; } + public List<string> ListStrings { get; set; } + public List<int> ListInts { get; set; } + public Indexer Indexer { get; set; } + public IntIndexer IntIndexer { get; set; } + public StringIndexer StringIndexer { get; set; } + } + + class Indexer + { + public A this[string index] => new A { Name = index }; + } + class IntIndexer + { + public int this[int index] => index; + } + class StringIndexer + { + public string this[string index] => index; + } + + [Test] + public void Does_Evaluate_property_binding_expression() + { + var a = new A { Name = "foo", Prop = new A { Name = "bar", Prop = new A { Name = "qux" }}}; + var context = new ScriptContext { + Args = { + ["a"] = a + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ a.Name }}"), Is.EqualTo("foo")); + Assert.That(context.EvaluateScript("{{ a.Prop.Name }}"), Is.EqualTo("bar")); + Assert.That(context.EvaluateScript("{{ a.Prop.Prop.Name }}"), Is.EqualTo("qux")); + } + + [Test] + public void Does_Evaluate_property_collection_binding_expression() + { + var queue = new Queue<A>(); + queue.Enqueue(new A { Name = "enumerable[0]" }); + + var a = new A { + Prop = new A { Name = "prop" }, + Array = new []{ new A { Name = "array[0]" } }, + List = new List<A> { new A { Name = "list[0]" } }, + ArrayStrings = new[] { "A", "B", "C" }, + ArrayInts = new []{ 1 }, + ListStrings = new[] { "A", "B", "C" }.ToList(), + ListInts = new []{ 1 }.ToList(), + Enumerable = queue, + StringDictionary = new Dictionary<string, object> { + {"key", new A { Name = "StringDictionary[key]" }} + }, + Indexer = new Indexer(), + StringIndexer = new StringIndexer(), + IntIndexer = new IntIndexer(), + }; + var context = new ScriptContext { + Args = { + ["a"] = a, + ["keyName"] = "key", + ["propName"] = "Prop", + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ a.ArrayStrings[0] }}"), Is.EqualTo("A")); + Assert.That(context.EvaluateScript("{{ a.ArrayInts[0] }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ a.ListStrings[0] }}"), Is.EqualTo("A")); + Assert.That(context.EvaluateScript("{{ a.ListInts[0] }}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{ a.Array[0].Name }}"), Is.EqualTo("array[0]")); + Assert.That(context.EvaluateScript("{{ a.List[0].Name }}"), Is.EqualTo("list[0]")); + + Assert.That(context.EvaluateScript("{{ a.Enumerable[0].Name }}"), Is.EqualTo("enumerable[0]")); + Assert.That(context.EvaluateScript("{{ a.StringDictionary['key'].Name }}"), Is.EqualTo("StringDictionary[key]")); + Assert.That(context.EvaluateScript("{{ a.StringDictionary[keyName].Name }}"), Is.EqualTo("StringDictionary[key]")); + Assert.That(context.EvaluateScript("{{ a.StringDictionary.key.Name }}"), Is.EqualTo("StringDictionary[key]")); + + Assert.That(context.EvaluateScript("{{ a[propName].Name }}"), Is.EqualTo("prop")); + Assert.That(context.EvaluateScript("{{ a['Prop'].Name }}"), Is.EqualTo("prop")); + + Assert.That(context.EvaluateScript("{{ a.Indexer.idx.Name }}"), Is.EqualTo("idx")); + Assert.That(context.EvaluateScript("{{ a.Indexer['idx'].Name }}"), Is.EqualTo("idx")); + + Assert.That(context.EvaluateScript("{{ a.ArrayStrings[1+1] }}"), Is.EqualTo("C")); + Assert.That(context.EvaluateScript("{{ a.ListStrings[1+1] }}"), Is.EqualTo("C")); + Assert.That(context.EvaluateScript("{{ a['Pr' + 'op'].Name }}"), Is.EqualTo("prop")); + } + + [Test] + public void Can_evaluate_MemberExpression_of_Method() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ toDateTime('2001-01-01').Day }}"), Is.EqualTo("1")); + } + + [Test] + public void Can_evaluate_MemberExpression_of_Array() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ [toDateTime('2001-01-01')][0].Day }}"), Is.EqualTo("1")); + } + + [Test] + public void Index_access_to_non_existent_key_returns_null() + { + var a = new A { + StringDictionary = new Dictionary<string, object>() + }; + var context = new ScriptContext { + Args = { + ["a"] = a, + ["keyName"] = "key", + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ a.StringDictionary['notfound'] }}"), Is.EqualTo("")); + } + + [Test] + public void Index_access_to_non_existent_property_throws_ArgumentException() + { + var a = new A { + StringDictionary = new Dictionary<string, object>() + }; + var context = new ScriptContext { + Args = { + ["a"] = a, + ["keyName"] = "key", + } + }.Init(); + + Assert.Throws<ScriptException>(() => + context.EvaluateScript("{{ a.notfound }}")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsSpreadTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsSpreadTests.cs new file mode 100644 index 00000000000..3a21fd281d6 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsSpreadTests.cs @@ -0,0 +1,203 @@ +using System; +using System.Linq; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class JsSpreadTests + { + [Test] + public void Does_parse_ArrayExpression_with_spread_operator() + { + JsToken token; + + "[...a]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrayExpression( + new JsSpreadElement(new JsIdentifier("a")) + ))); + + "[...[1]]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrayExpression( + new JsSpreadElement(new JsArrayExpression( + new JsLiteral(1) + )) + ))); + + "[1, ...[2], 3]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrayExpression( + new JsLiteral(1), + new JsSpreadElement(new JsArrayExpression( + new JsLiteral(2) + )), + new JsLiteral(3) + ))); + } + + [Test] + public void Does_parse_ObjectExpression_with_spread_operator() + { + JsToken token; + + "{...a}".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsObjectExpression( + new JsProperty(null, new JsSpreadElement(new JsIdentifier("a"))) + ))); + + "{...{b:2}}".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsObjectExpression( + new JsProperty( + null, + new JsSpreadElement( + new JsObjectExpression( + new JsProperty(new JsIdentifier("b"), new JsLiteral(2)) + ) + ) + ) + ))); + + "{a:1, ...{b:2}, c:3}".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsObjectExpression( + new JsProperty(new JsIdentifier("a"), new JsLiteral(1)), + new JsProperty( + null, + new JsSpreadElement( + new JsObjectExpression( + new JsProperty(new JsIdentifier("b"), new JsLiteral(2)) + ) + ) + ), + new JsProperty(new JsIdentifier("c"), new JsLiteral(3)) + ))); + } + + [Test] + public void Does_parse_CallExpression_with_spread_operator() + { + JsToken token; + + "fn(...a)".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsIdentifier("fn"), + new JsSpreadElement(new JsIdentifier("a")) + ))); + + "fn(...[1])".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsIdentifier("fn"), + new JsSpreadElement(new JsArrayExpression( + new JsLiteral(1) + )) + ))); + + "fn(1, ...[2], 3)".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsIdentifier("fn"), + new JsLiteral(1), + new JsSpreadElement(new JsArrayExpression( + new JsLiteral(2) + )), + new JsLiteral(3) + ))); + + "fn(...range(3))".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsIdentifier("fn"), + new JsSpreadElement( + new JsCallExpression( + new JsIdentifier("range"), + new JsLiteral(3) + ) + ) + ))); + } + + [Test] + public void Does_evaluate_ArrayExpression_with_spread_operator() + { + var context = new ScriptContext { + Args = { + ["a"] = new[]{ 2, 1 }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ [...a] |> sum }}"), Is.EqualTo("3")); + + Assert.That(context.EvaluateScript("{{ [...[2,1]] |> sum }}"), Is.EqualTo("3")); + + Assert.That(context.EvaluateScript("{{ [1, ...a, 4] |> sum }}"), Is.EqualTo("8")); + } + + [Test] + public void Does_evaluate_ObjectExpression_with_spread_operator() + { + var context = new ScriptContext { + Args = { + ["a"] = new{ b = 2, c = 3 }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ {...a}.b }}"), Is.EqualTo("2")); + Assert.That(context.EvaluateScript("{{ {...{b:2,c:3}}.b }}"), Is.EqualTo("2")); + + Assert.That(context.EvaluateScript("{{ {...a} |> values |> sum }}"), Is.EqualTo("5")); + Assert.That(context.EvaluateScript("{{ {...{b:2,c:3}} |> values |> sum }}"), Is.EqualTo("5")); + + Assert.That(context.EvaluateScript("{{ { a:1, ...a, d:4} |> values |> sum }}"), Is.EqualTo("10")); + Assert.That(context.EvaluateScript("{{ { a:1, ...{b:2,c:3}, d:4} |> values |> sum }}"), Is.EqualTo("10")); + + Assert.That(context.EvaluateScript("{{ { b:4, ...a, c:6} |> values |> sum }}"), Is.EqualTo("8")); + Assert.That(context.EvaluateScript("{{ { b:4, ...{b:2,c:3}, c:6} |> values |> sum }}"), Is.EqualTo("8")); + } + + [Test] + public void Spread_operator_does_cascade_object_properties() + { + var context = new ScriptContext { + Args = { + ["poco"] = new Person("foo", 1), + ["anon"] = new { Name = "bar", Age = 2 }, + ["foo"] = new Person("foo", 3), + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ {...poco}.Age }}"), Is.EqualTo("1")); + + Assert.That(context.EvaluateScript("{{ {...poco, ...anon}.Name }}"), Is.EqualTo("bar")); + Assert.That(context.EvaluateScript("{{ {...poco, ...anon}.Age }}"), Is.EqualTo("2")); + Assert.That(context.EvaluateScript("{{ {...poco, ...foo}.Age }}"), Is.EqualTo("3")); + } + + class MyFilters : ScriptMethods + { + public double Min2(double a, double b) => Math.Min(a, b); + public double Min3(double a, double b, double c) => new[]{ a,b,c }.Min(); + } + + [Test] + public void Does_evaluate_CallExpression_with_spread_operator() + { + var context = new ScriptContext { + Args = { + ["nums2"] = new[]{ 20,10 }, + ["nums3"] = new[]{ 20,10,1 }, + }, + ScriptMethods = { + new MyFilters() + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ Min2(...[20,10]) }}"), Is.EqualTo("10")); + Assert.That(context.EvaluateScript("{{ Min2(...nums2) }}"), Is.EqualTo("10")); + Assert.That(context.EvaluateScript("{{ Min3(...nums3) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> Min3(...[20,10]) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 30 |> Min3(...[20,10]) }}"), Is.EqualTo("10")); + + Assert.That(context.EvaluateScript("{{ Min3(30,...[20,10]) }}"), Is.EqualTo("10")); + Assert.That(context.EvaluateScript("{{ Min3(30,...nums2) }}"), Is.EqualTo("10")); + Assert.That(context.EvaluateScript("{{ Min3(...[20,10],1) }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ Min3(...nums2,1) }}"), Is.EqualTo("1")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsTests.cs new file mode 100644 index 00000000000..2bb8b6dd7a4 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsTests.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class JsTests + { + public class HasObject + { + public object Value { get; set; } + } + + [Test] + public void Does_deserialize_late_bound_object_with_quotes() + { + var dto = new HasObject { + Value = "<bla fasel=\"hurz\" />" + }; + + var json = JSON.stringify(dto); + json.Print(); + + Assert.That(json, Is.EqualTo("{\"Value\":\"<bla fasel=\\\"hurz\\\" />\"}")); + + var obj = (Dictionary<string,object>)JSON.parse(json); + + Assert.That(obj["Value"], Is.EqualTo(dto.Value)); + + JS.Configure(); + + var fromJson = json.FromJson<HasObject>(); + + JS.UnConfigure(); + + Assert.That(fromJson.Value, Is.EqualTo(dto.Value)); + } + + [Test] + public void Can_parse_json_values() + { + Assert.That(JSON.parseSpan("true".AsSpan()), Is.EqualTo(true)); + Assert.That(JSON.parseSpan("false".AsSpan()), Is.EqualTo(false)); + Assert.That(JSON.parseSpan("1".AsSpan()), Is.EqualTo(1)); + Assert.That(JSON.parseSpan("1.1".AsSpan()), Is.EqualTo(1.1)); + Assert.That(JSON.parseSpan("foo".AsSpan()), Is.EqualTo("foo")); + Assert.That(JSON.parseSpan("null".AsSpan()), Is.EqualTo(null)); + Assert.That(JSON.parseSpan("[1]".AsSpan()), Is.EqualTo(new object[]{ 1 })); + Assert.That(JSON.parseSpan("{\"foo\":1}".AsSpan()), Is.EqualTo(new Dictionary<string,object> { ["foo"] = 1 })); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsonTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsonTests.cs new file mode 100644 index 00000000000..e138c1be886 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/JsonTests.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class JsonTests + { + [Test] + public void Does_escape_strings_in_JSON() + { + var json = @"{""app.settings"":""debug true\nname MyApp\n""}"; + var obj = (Dictionary<string,object>)JSON.parse(json); + + Assert.That(obj["app.settings"], Is.EqualTo("debug true\nname MyApp\n")); + } + + [Test] + public void Can_parse_escaped_json() + { + var json = "{\"content\": \"warn(\\n false,\\n \\\"props in \\\\\\\"\\\" + (route.path) + \\\"\\\\\\\" is a \\\" + (typeof config) + \\\", \\\" +\\n \\\"expecting an object, function or boolean.\\\"\\n );\"}"; + var obj = (Dictionary<string,object>)JSON.parse(json); + Assert.That(obj.ContainsKey("content")); + } + + [Test] + public void Does_throw_on_invalid_number() + { + try + { + JSON.parse(@"{""test"":23.34.3333}"); + Assert.Fail("should throw"); + } + catch (FormatException) {} + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/PageBasedRoutingTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/PageBasedRoutingTests.cs new file mode 100644 index 00000000000..cb63bed9762 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/PageBasedRoutingTests.cs @@ -0,0 +1,126 @@ +using System.Collections.Generic; +using Funq; +using NUnit.Framework; +using ServiceStack.IO; +using System.Collections.Generic; +using Funq; +using NUnit.Framework; +using ServiceStack.IO; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class PageBasedRoutingTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(SharpPageTests), typeof(SharpPagesService).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new SharpPagesFeature()); + } + + static readonly Dictionary<string,string> HtmlFiles = new Dictionary<string, string> + { + { "_layout.html", "<html><body>{{ page }}</body></html>" }, + { "_slug/index.html", "_slug/index.html slug: {{slug}}" }, + { "_slug/_category.html", "_slug/_category.html slug: {{slug}}, category: {{category}}" }, + { "comments/_postid/_id.html", "comments/_postid/_id.html postid: {{postid}}, id: {{id}}" }, + { "favorites/index.html", "favorites/index.html" }, + { "login/_provider.html", "login/_provider.html provider: {{provider}}" }, + { "organizations/_slug/index.html", "organizations/_slug/index.html slug: {{slug}}" }, + { "organizations/index.html", "organizations/index.html" }, + { "posts/_id/_postslug.html", "posts/_id/_postslug.html id: {{id}}, postslug: {{postslug}}" }, + { "stacks/index.html", "stacks/index.html" }, + { "stacks/new.html", "stacks/new.html" }, + { "stacks/_slug/index.html", "stacks/_slug/index.html slug: {{slug}}" }, + { "stacks/_slug/edit.html", "stacks/_slug/edit.html slug: {{slug}}" }, + { "tech/index.html", "tech/index.html" }, + { "tech/new.html", "tech/new.html" }, + { "tech/_slug/index.html", "tech/_slug/index.html slug: {{slug}}" }, + { "tech/_slug/edit.html", "tech/_slug/edit.html slug: {{slug}}" }, + { "top/index.html", "top/index.html" }, + { "users/_username.html", "users/_username.html username: {{username}}" }, + { "returnpages/index.html", "returnpages/index.html {{ return }} suffix" }, + { "returnpages/_arg.html", "returnpages/_arg.html {{arg}} {{ return }} suffix" }, + { "returnpages/if.html", "returnpages/if.html {{#if true}}{{ return }}{{/if}} suffix" }, + { "httpresults/index.html", "httpresults/index.html {{ {foo:'bar'} |> return({ format: 'json' }) }} suffix" }, + { "httpresults/explicit.html", "httpresults/explicit.html {{ {response: {foo:'bar'}, format: 'json'} |> httpResult |> return }} suffix" }, + { "httpresults/_arg.html", "httpresults/_arg.html {{ {foo:arg} |> return({ format: 'json' }) }} suffix" }, + { "httpresults/no-response.html", "httpresults/no-response.html {{ httpResult({ format: 'json' }) |> return }} suffix" }, + { "httpresults/redirect.html", "httpresults/redirect.html {{ httpResult({ status:'Found', Location:'/httpresults/redirected' }) |> return }} suffix" }, + { "httpresults/redirect-code.html", "httpresults/redirect.html {{ httpResult({ status:301, Location:'/httpresults/redirected-301' }) |> return }} suffix" }, + }; + + public override List<IVirtualPathProvider> GetVirtualFileSources() + { + var existingProviders = base.GetVirtualFileSources(); + var memFs = new MemoryVirtualFiles(); + + foreach (var entry in HtmlFiles) + { + memFs.AppendFile(entry.Key, entry.Value); + } + + existingProviders.Insert(0, memFs); + return existingProviders; + } + } + + private readonly ServiceStackHost appHost; + public PageBasedRoutingTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + [TestCase("/redis", "<html><body>_slug/index.html slug: redis</body></html>")] + [TestCase("/redis/", "<html><body>_slug/index.html slug: redis</body></html>")] + [TestCase("/redis/clients", "<html><body>_slug/_category.html slug: redis, category: clients</body></html>")] + [TestCase("/comments/1/2", "<html><body>comments/_postid/_id.html postid: 1, id: 2</body></html>")] + [TestCase("/favorites", "<html><body>favorites/index.html</body></html>")] + [TestCase("/login/github", "<html><body>login/_provider.html provider: github</body></html>")] + [TestCase("/organizations/redis", "<html><body>organizations/_slug/index.html slug: redis</body></html>")] + [TestCase("/organizations", "<html><body>organizations/index.html</body></html>")] + [TestCase("/posts/1/the-slug", "<html><body>posts/_id/_postslug.html id: 1, postslug: the-slug</body></html>")] + [TestCase("/stacks", "<html><body>stacks/index.html</body></html>")] + [TestCase("/stacks/new", "<html><body>stacks/new.html</body></html>")] + [TestCase("/stacks/redis", "<html><body>stacks/_slug/index.html slug: redis</body></html>")] + [TestCase("/stacks/redis/edit", "<html><body>stacks/_slug/edit.html slug: redis</body></html>")] + [TestCase("/tech", "<html><body>tech/index.html</body></html>")] + [TestCase("/tech/new", "<html><body>tech/new.html</body></html>")] + [TestCase("/tech/redis", "<html><body>tech/_slug/index.html slug: redis</body></html>")] + [TestCase("/tech/redis/edit", "<html><body>tech/_slug/edit.html slug: redis</body></html>")] + [TestCase("/top", "<html><body>top/index.html</body></html>")] + [TestCase("returnpages", "")] + [TestCase("returnpages/qux", "")] + [TestCase("returnpages/if", "")] + public void Can_use_page_based_routing(string path, string expectedHtml) + { + var html = Config.ListeningOn.CombineWith(path) + .GetStringFromUrl(); + + Assert.That(html, Is.EqualTo(expectedHtml)); + } + + [Test] + [TestCase("/httpresults", "{\"foo\":\"bar\"}")] + [TestCase("/httpresults/explicit", "{\"foo\":\"bar\"}")] + [TestCase("/httpresults/qux", "{\"foo\":\"qux\"}")] + [TestCase("/httpresults/no-response", "")] + [TestCase("/httpresults/redirect", "{\"foo\":\"redirected\"}")] + [TestCase("/httpresults/redirect-code", "{\"foo\":\"redirected-301\"}")] + public void Does_return_custom_result(string path, string expectedJson) + { + var response = Config.ListeningOn.CombineWith(path).GetStringFromUrl( + responseFilter:res => Assert.That(res.ContentType, Does.StartWith(MimeTypes.Json))); + + Assert.That(response, Is.EqualTo(expectedJson)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ProtectedScriptsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ProtectedScriptsTests.cs new file mode 100644 index 00000000000..cca2e28b890 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ProtectedScriptsTests.cs @@ -0,0 +1,281 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using Funq; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + [Route("/includeUrl-echo")] + public class IncludeUrlEcho : IReturn<string> {} + + [Route("/includeUrl-model")] + public class IncludeUrlModel + { + public int Id { get; set; } + public string Name { get; set; } + } + + [Route("/includeUrl-models")] + public class IncludeUrlModels : List<IncludeUrlModel> {} + + [Route("/includeUrl-time")] + public class GetCurrentTime : IReturn<string> {} + + public class TemplatePageServices : Service + { + public object Any(IncludeUrlEcho request) => + $"{Request.Verb} {Request.RawUrl}"; + + public object Any(IncludeUrlModel request) => + request; + + public object Any(IncludeUrlModels request) => + request; + + public object Any(GetCurrentTime request) => + DateTime.Now.ToString("o"); + } + + public class ProtectedScriptsTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(ProtectedScriptsTests), typeof(TemplatePageServices).Assembly) {} + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + UseCamelCase = false, //normalize with .NET Core + }); + + Plugins.Add(new SharpPagesFeature + { + Args = + { + ["baseUrl"] = Tests.Config.ListeningOn + } + }); + } + + private readonly List<IVirtualPathProvider> virtualFiles = new List<IVirtualPathProvider> { new MemoryVirtualFiles() }; + public override List<IVirtualPathProvider> GetVirtualFileSources() => virtualFiles; + } + + private readonly ServiceStackHost appHost; + public ProtectedScriptsTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Does_not_include_protected_filters_by_default() + { + var context = new ScriptContext().Init(); + context.VirtualFiles.WriteFile("index.txt", "file contents"); + + Assert.That(new PageResult(context.OneTimePage("{{ 'index.txt' |> includeFile }}")).Result, + Is.EqualTo("")); + + var feature = new SharpPagesFeature().Init(); + feature.VirtualFiles.WriteFile("index.txt", "file contents"); + + Assert.That(new PageResult(context.OneTimePage("{{ 'index.txt' |> includeFile }}")).Result, + Is.EqualTo("")); + } + + [Test] + public void Can_use_protected_includeFiles_in_context_or_PageResult() + { + var context = new ScriptContext + { + ScriptMethods = { new ProtectedScripts() } + }.Init(); + context.VirtualFiles.WriteFile("index.txt", "file contents"); + + Assert.That(new PageResult(context.OneTimePage("{{ 'index.txt' |> includeFile }}")).Result, + Is.EqualTo("file contents")); + } + + [Test] + public void Can_use_transformers_on_block_filter_outputs() + { + var context = new ScriptContext + { + ScriptMethods = { new ProtectedScripts() }, + FilterTransformers = + { + ["markdown"] = MarkdownPageFormat.TransformToHtml + } + }.Init(); + context.VirtualFiles.WriteFile("index.md", "## Markdown Heading"); + + Assert.That(new PageResult(context.OneTimePage("{{ 'index.md' |> includeFile |> markdown }}")).Result.Trim(), + Is.EqualTo("<h2>Markdown Heading</h2>")); + } + + [Test] + public void Can_use_includeUrl() + { + string urlContents; + var context = appHost.GetPlugin<SharpPagesFeature>(); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-echo') |> addQueryString({ id:1, name:'foo'}) |> includeUrl |> htmlencode }}")).Result; + Assert.That(urlContents, Is.EqualTo("GET /includeUrl-echo?id=1&amp;name=foo")); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-model') |> addQueryString({ id:1, name:'foo'}) |> includeUrl({ accept: 'application/json' }) }}")).Result; + Assert.That(urlContents, Is.EqualTo("{\"Id\":1,\"Name\":\"foo\"}")); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-model') |> addQueryString({ id:1, name:'foo'}) |> includeUrl({ dataType: 'json' }) }}")).Result; + Assert.That(urlContents, Is.EqualTo("{\"Id\":1,\"Name\":\"foo\"}")); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-model') |> includeUrl({ method:'POST', data: { id: 1, name: 'foo' }, accept: 'application/jsv' }) }}")).Result; + Assert.That(urlContents, Is.EqualTo("{Id:1,Name:foo}")); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-model') |> includeUrl({ method:'POST', data: { id: 1, name: 'foo' }, accept: 'application/json', contentType: 'application/json' }) }}")).Result; + Assert.That(urlContents, Is.EqualTo("{\"Id\":1,\"Name\":\"foo\"}")); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-model') |> includeUrl({ method:'POST', data: { id: 1, name: 'foo' }, dataType: 'json' }) }}")).Result; + Assert.That(urlContents, Is.EqualTo("{\"Id\":1,\"Name\":\"foo\"}")); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-model') |> includeUrl({ method:'POST', data: { id: 1, name: 'foo' }, dataType: 'jsv' }) }}")).Result; + Assert.That(urlContents, Is.EqualTo("{Id:1,Name:foo}")); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-models') |> includeUrl({ method:'POST', data: [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }], contentType:'application/json', accept: 'application/jsv' }) }}")).Result; + Assert.That(urlContents, Is.EqualTo("[{Id:1,Name:foo},{Id:2,Name:bar}]")); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-models') |> includeUrl({ method:'POST', data: [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }], contentType:'application/jsv', accept: 'text/csv' }) }}")).Result.NormalizeNewLines(); + Assert.That(urlContents, Is.EqualTo("Id,Name\n1,foo\n2,bar")); + + urlContents = new PageResult(context.OneTimePage( + "{{ baseUrl |> addPath('includeUrl-models') |> includeUrl({ method:'POST', data: [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }], dataType:'csv' }) }}")).Result.NormalizeNewLines(); + Assert.That(urlContents, Is.EqualTo("Id,Name\n1,foo\n2,bar")); + } + + [Test] + public void Filter_includeFile_does_load_modiifed_contents() + { + var context = appHost.GetPlugin<SharpPagesFeature>(); + context.VirtualFiles.WriteFile("page.txt", "Original Content"); + + var includeFilePage = context.OneTimePage("{{ 'page.txt' |> includeFile }}"); + var fileContents = new PageResult(includeFilePage).Result; + Assert.That(fileContents, Is.EqualTo("Original Content")); + + context.VirtualFiles.WriteFile("page.txt", "Modified Content"); + fileContents = new PageResult(includeFilePage).Result; + Assert.That(fileContents, Is.EqualTo("Modified Content")); + } + + [Test] + public void Can_cache_contents_with_includeUrlWithCache_and_includeFileWithCache() + { + var context = appHost.GetPlugin<SharpPagesFeature>(); + context.VirtualFiles.WriteFile("page.txt", "Original Content"); + + var urlWithDefaultCache = context.OneTimePage("{{ baseUrl |> addPath('includeUrl-time') |> includeUrlWithCache }}"); + + var urlContents1 = new PageResult(urlWithDefaultCache).Result; + var urlContents2 = new PageResult(urlWithDefaultCache).Result; + Assert.That(urlContents1, Is.EqualTo(urlContents2)); + + Assert.That(new PageResult(context.OneTimePage("{{ 'page.txt' |> includeFileWithCache }}")).Result, Is.EqualTo("Original Content")); + context.VirtualFiles.WriteFile("page.txt", "Modified Content"); + + var fileWithCachePage = context.OneTimePage("{{ 'page.txt' |> includeFileWithCache({ expiresInSecs: 1 }) }}"); + var urlWithCache1Sec = context.OneTimePage("{{ baseUrl |> addPath('includeUrl-time') |> includeUrlWithCache({ expireInSecs: 1 }) }}"); + + urlContents1 = new PageResult(urlWithCache1Sec).Result; + + Thread.Sleep(TimeSpan.FromMilliseconds(1001)); + + urlContents2 = new PageResult(urlWithCache1Sec).Result; + Assert.That(urlContents1, Is.Not.EqualTo(urlContents2)); + + Assert.That(new PageResult(fileWithCachePage).Result, Is.EqualTo("Modified Content")); + } + + [Test] + public void Can_exclude_individual_filters() + { + var context = new ScriptContext + { + ExcludeFiltersNamed = { "includeUrl" }, + ScriptMethods = { new ProtectedScripts() }, + }.Init(); + + context.VirtualFiles.WriteFile("file.txt", "File Contents"); + + context.VirtualFiles.WriteFile("page.html", @" +includeUrl = {{ baseUrl |> addPath('includeUrl-time') |> includeUrl }} +includeFile = {{ 'file.txt' |> includeFile }} +"); + + Assert.Throws<NotSupportedException>(() => { + var ignore = new PageResult(context.GetPage("page")).Result; }); + } + + [Test] + public void Can_write_and_read_Contents_API() + { + var text = "abcdef"; + var bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + var context = new ScriptContext + { + ScriptMethods = { new ProtectedScripts() }, + Args = { + [nameof(text)] = text, + [nameof(bytes)] = bytes, + } + }.Init(); + + var textContents = (ReadOnlyMemory<char>) context.Evaluate(@" +{{ vfsMemory |> to => memFs }} +{{ memFs.writeFile('/dir/file.txt', text) }} +{{ memFs.fileContents('/dir/file.txt') |> return }}"); + Assert.That(textContents.Span.SequenceEqual(text.AsSpan())); + + var byteContents = (ReadOnlyMemory<byte>) context.Evaluate(@" +{{ vfsMemory |> to => memFs }} +{{ memFs.writeFile('/dir/file.bin', bytes) }} +{{ memFs.fileContents('/dir/file.bin') |> return }}"); + Assert.That(byteContents.Span.SequenceEqual(bytes)); + } + + #if NET45 + [Test] + public void Does_use_dollar_as_currency_symbol_when_InvariantCulture() + { + var hold = Thread.CurrentThread.CurrentCulture; + Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + + var context = new ScriptContext().Init(); + + var output = context.EvaluateScript("{{ 12.345 |> currency }}"); + Assert.That(output, Is.EqualTo("$12.35")); + + Thread.CurrentThread.CurrentCulture = hold; + } + #endif + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryData.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryData.cs new file mode 100644 index 00000000000..f614e639159 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryData.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class Customer + { + public string CustomerId { get; set; } + public string CompanyName { get; set; } + public string Address { get; set; } + public string City { get; set; } + public string Region { get; set; } + public string PostalCode { get; set; } + public string Country { get; set; } + public string Phone { get; set; } + public string Fax { get; set; } + public List<Order> Orders { get; set; } + + public override string ToString() => + $"Customer(customerId='{CustomerId}', companyName='{CompanyName}', orders='{Orders.Count}')"; + } + + public class Order + { + public int OrderId { get; set; } + public DateTime OrderDate { get; set; } + public double Total { get; set; } + } + + public class Product + { + public int ProductId { get; set; } + public string ProductName { get; set; } + public string Category { get; set; } + public double UnitPrice { get; set; } + public int UnitsInStock { get; set; } + + public Product() {} + public Product(int productId, string productName, string category, double unitPrice, int unitsInStock) + { + ProductId = productId; + ProductName = productName; + Category = category; + UnitPrice = unitPrice; + UnitsInStock = unitsInStock; + } + } + + public class QueryData + { + public static Product[] Products = + { + new Product(1, "Chai", "Beverages", 18.000, 39), + new Product(2, "Chang", "Beverages", 19.000, 17), + new Product(3, "Aniseed Syrup", "Condiments", 10.000, 13), + new Product(4, "Chef Anton's Cajun Seasoning", "Condiments", 22.000, 53), + new Product(5, "Chef Anton's Gumbo Mix", "Condiments", 21.350, 0), + new Product(6, "Grandma's Boysenberry Spread", "Condiments", 25.000, 120), + new Product(7, "Uncle Bob's Organic Dried Pears", "Produce", 30.000, 15), + new Product(8, "Northwoods Cranberry Sauce", "Condiments", 40.000, 6), + new Product(9, "Mishi Kobe Niku", "Meat/Poultry", 97.000, 29), + new Product(10, "Ikura", "Seafood", 31.000, 31), + new Product(11, "Queso Cabrales", "Dairy Products", 21.000, 22), + new Product(12, "Queso Manchego La Pastora", "Dairy Products", 38.000, 86), + new Product(13, "Konbu", "Seafood", 6.000, 24), + new Product(14, "Tofu", "Produce", 23.250, 35), + new Product(15, "Genen Shouyu", "Condiments", 15.500, 39), + new Product(16, "Pavlova", "Confections", 17.450, 29), + new Product(17, "Alice Mutton", "Meat/Poultry", 39.000, 0), + new Product(18, "Carnarvon Tigers", "Seafood", 62.500, 42), + new Product(19, "Teatime Chocolate Biscuits", "Confections", 9.200, 25), + new Product(20, "Sir Rodney's Marmalade", "Confections", 81.000, 40), + new Product(21, "Sir Rodney's Scones", "Confections", 10.000, 3), + new Product(22, "Gustaf's Kn\u00e4ckebr\u00f6d", "Grains/Cereals", 21.000, 104), + new Product(23, "Tunnbr\u00f6d", "Grains/Cereals", 9.000, 61), + new Product(24, "Guaran\u00e1 Fant\u00e1stica", "Beverages", 4.500, 20), + new Product(25, "NuNuCa Nu\u00df-Nougat-Creme", "Confections", 14.000, 76), + new Product(26, "Gumb\u00e4r Gummib\u00e4rchen", "Confections", 31.230, 15), + new Product(27, "Schoggi Schokolade", "Confections", 43.900, 49), + new Product(28, "R\u00f6ssle Sauerkraut", "Produce", 45.600, 26), + new Product(29, "Th\u00fcringer Rostbratwurst", "Meat/Poultry", 123.790, 0), + new Product(30, "Nord-Ost Matjeshering", "Seafood", 25.890, 10), + new Product(31, "Gorgonzola Telino", "Dairy Products", 12.500, 0), + new Product(32, "Mascarpone Fabioli", "Dairy Products", 32.000, 9), + new Product(33, "Geitost", "Dairy Products", 2.500, 112), + new Product(34, "Sasquatch Ale", "Beverages", 14.000, 111), + new Product(35, "Steeleye Stout", "Beverages", 18.000, 20), + new Product(36, "Inlagd Sill", "Seafood", 19.000, 112), + new Product(37, "Gravad lax", "Seafood", 26.000, 11), + new Product(38, "C\u00f4te de Blaye", "Beverages", 263.500, 17), + new Product(39, "Chartreuse verte", "Beverages", 18.000, 69), + new Product(40, "Boston Crab Meat", "Seafood", 18.400, 123), + new Product(41, "Jack's New England Clam Chowder", "Seafood", 9.650, 85), + new Product(42, "Singaporean Hokkien Fried Mee", "Grains/Cereals", 14.000, 26), + new Product(43, "Ipoh Coffee", "Beverages", 46.000, 17), + new Product(44, "Gula Malacca", "Condiments", 19.450, 27), + new Product(45, "Rogede sild", "Seafood", 9.500, 5), + new Product(46, "Spegesild", "Seafood", 12.000, 95), + new Product(47, "Zaanse koeken", "Confections", 9.500, 36), + new Product(48, "Chocolade", "Confections", 12.750, 15), + new Product(49, "Maxilaku", "Confections", 20.000, 10), + new Product(50, "Valkoinen suklaa", "Confections", 16.250, 65), + new Product(51, "Manjimup Dried Apples", "Produce", 53.000, 20), + new Product(52, "Filo Mix", "Grains/Cereals", 7.000, 38), + new Product(53, "Perth Pasties", "Meat/Poultry", 32.800, 0), + new Product(54, "Tourti\u00e8re", "Meat/Poultry", 7.450, 21), + new Product(55, "P\u00e2t\u00e9 chinois", "Meat/Poultry", 24.000, 115), + new Product(56, "Gnocchi di nonna Alice", "Grains/Cereals", 38.000, 21), + new Product(57, "Ravioli Angelo", "Grains/Cereals", 19.500, 36), + new Product(58, "Escargots de Bourgogne", "Seafood", 13.250, 62), + new Product(59, "Raclette Courdavault", "Dairy Products", 55.000, 79), + new Product(60, "Camembert Pierrot", "Dairy Products", 34.000, 19), + new Product(61, "Sirop d'\u00e9rable", "Condiments", 28.500, 113), + new Product(62, "Tarte au sucre", "Confections", 49.300, 17), + new Product(63, "Vegie-spread", "Condiments", 43.900, 24), + new Product(64, "Wimmers gute Semmelkn\u00f6del", "Grains/Cereals", 33.250, 22), + new Product(65, "Louisiana Fiery Hot Pepper Sauce", "Condiments", 21.050, 76), + new Product(66, "Louisiana Hot Spiced Okra", "Condiments", 17.000, 4), + new Product(67, "Laughing Lumberjack Lager", "Beverages", 14.000, 52), + new Product(68, "Scottish Longbreads", "Confections", 12.500, 6), + new Product(69, "Gudbrandsdalsost", "Dairy Products", 36.000, 26), + new Product(70, "Outback Lager", "Beverages", 15.000, 15), + new Product(71, "Flotemysost", "Dairy Products", 21.500, 26), + new Product(72, "Mozzarella di Giovanni", "Dairy Products", 34.800, 14), + new Product(73, "R\u00f6d Kaviar", "Seafood", 15.000, 101), + new Product(74, "Longlife Tofu", "Produce", 10.000, 4), + new Product(75, "Rh\u00f6nbr\u00e4u Klosterbier", "Beverages", 7.750, 125), + new Product(76, "Lakkalik\u00f6\u00f6ri", "Beverages", 18.000, 57), + new Product(77, "Original Frankfurter gr\u00fcne So\u00dfe", "Condiments", 13.000, 32) + }; + + private static List<Customer> customers; + public static List<Customer> Customers + { + get + { + if (customers != null) + return customers; + + var path = "~/App_Data/customers.json".MapAbsolutePath(); + var json = File.ReadAllText(path); + customers = json.FromJson<List<Customer>>(); + return customers; + } + } + + public static Customer GetCustomer(string id) => Customers.FirstOrDefault(x => x.CustomerId == id); + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryExpressionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryExpressionTests.cs new file mode 100644 index 00000000000..0a65b4344f8 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryExpressionTests.cs @@ -0,0 +1,118 @@ +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class QueryExpressionTests + { + [Test] + public void Does_parse_basic_QueryExpressions() + { + JsToken expr; + + "1".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsLiteral(1))); + + "1 > 2".ParseJsExpression(out expr); + Assert.That(expr, + Is.EqualTo(new JsBinaryExpression(new JsLiteral(1), JsGreaterThan.Operator, new JsLiteral(2)))); + + "1 > 2 && 3 > 4".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsLogicalExpression( + new JsBinaryExpression(new JsLiteral(1), JsGreaterThan.Operator, new JsLiteral(2)), + JsAnd.Operator, + new JsBinaryExpression(new JsLiteral(3), JsGreaterThan.Operator, new JsLiteral(4)) + ) + )); + + "1 > 2 and 3 > 4".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsLogicalExpression( + new JsBinaryExpression(new JsLiteral(1), JsGreaterThan.Operator, new JsLiteral(2)), + JsAnd.Operator, + new JsBinaryExpression(new JsLiteral(3), JsGreaterThan.Operator, new JsLiteral(4)) + ) + )); + } + + [Test] + public void Does_parse_linq_examples() + { + var it = new JsIdentifier("it"); + + "it < 5".ParseJsExpression(out var expr); + Assert.That(expr, + Is.EqualTo(new JsBinaryExpression(it, JsLessThan.Operator, new JsLiteral(5)))); + + "it.UnitsInStock > 0 and it.UnitPrice > 3".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo( + new JsLogicalExpression( + new JsBinaryExpression( + new JsMemberExpression(new JsIdentifier("it"), new JsIdentifier("UnitsInStock")), + JsGreaterThan.Operator, + new JsLiteral(0) + ), + JsAnd.Operator, + new JsBinaryExpression( + new JsMemberExpression(new JsIdentifier("it"), new JsIdentifier("UnitPrice")), + JsGreaterThan.Operator, + new JsLiteral(3) + ) + ) + )); + } + + [Test] + public void Does_parse_not_unary_expression() + { + var it = new JsIdentifier("it"); + + "!it".ParseJsExpression(out var expr); + Assert.That(expr, + Is.EqualTo(new JsUnaryExpression(JsNot.Operator, it))); + + "!contains(items, it)".ParseJsExpression(out expr); + Assert.That(expr, Is.EqualTo(new JsUnaryExpression(JsNot.Operator, + new JsCallExpression( + new JsIdentifier("contains"), + new JsIdentifier("items"), + new JsIdentifier("it") + )))); + } + + [Test] + public void Can_customize_and_evaluate_custom_AST_expressions() + { + JsToken expr; + + var expected = new JsLogicalExpression( + new JsBinaryExpression(new JsIdentifier("a"), JsGreaterThan.Operator, new JsLiteral(1)), + JsAnd.Operator, + new JsBinaryExpression(new JsIdentifier("b"), JsLessThan.Operator, new JsLiteral(2)) + ); + + expr = JS.expression("a > 1 && b < 2"); + Assert.That(expr, Is.EqualTo(expected)); + Assert.That(expr.Equals(expected)); + + Assert.That(new JsLogicalExpression( + JS.expression("a > 1"), + JsAnd.Operator, + JS.expression("b < 2")), + Is.EqualTo(expected)); + + Assert.That((bool)expr.Evaluate(JS.CreateScope(args:new Dictionary<string, object> { + ["a"] = 2, + ["b"] = 1 + }))); + + Assert.That((bool)expr.Evaluate(JS.CreateScope(args:new Dictionary<string, object> { + ["a"] = 1, + ["b"] = 2 + })), Is.False); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryLinqAlternativeTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryLinqAlternativeTests.cs new file mode 100644 index 00000000000..aef9d26e052 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryLinqAlternativeTests.cs @@ -0,0 +1,343 @@ +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class QueryFilterAlternativeTests + { + private static ScriptContext CreateContext(Dictionary<string, object> optionalArgs = null) + { + var context = new ScriptContext + { + Args = + { + ["numbers"] = new[] {5, 4, 1, 3, 9, 8, 6, 7, 2, 0}, + ["products"] = QueryData.Products, + ["customers"] = QueryData.Customers, + } + }; + optionalArgs.Each((key, val) => context.Args[key] = val); + return context.Init(); + } + + [Test] + public void linq1_original() + { + var context = CreateContext(); + + Assert.That(context.EvaluateScript(@" +Numbers < 5: +{{ numbers |> where('it < 5') |> select('{{ it }}\n') }}").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers < 5: +4 +1 +3 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void linq2_original() + { + var context = CreateContext(); + + Assert.That(context.EvaluateScript(@" +Sold out products: +{{ products + |> where('it.UnitsInStock == 0') + |> select('{{ it.productName |> raw }} is sold out!\n') +}} +").NormalizeNewLines(), + + Is.EqualTo(@" +Sold out products: +Chef Anton's Gumbo Mix is sold out! +Alice Mutton is sold out! +Thüringer Rostbratwurst is sold out! +Gorgonzola Telino is sold out! +Perth Pasties is sold out! +".NormalizeNewLines())); + } + + [Test] + public void linq2_original_with_custom_item_binding() + { + var context = CreateContext(); + + Assert.That(context.EvaluateScript(@" +Sold out products: +{{ products + |> where('product.UnitsInStock == 0', { it: 'product' }) + |> select('{{ product.productName |> raw }} is sold out!\n', { it: 'product' }) +}} +").NormalizeNewLines(), + + Is.EqualTo(@" +Sold out products: +Chef Anton's Gumbo Mix is sold out! +Alice Mutton is sold out! +Thüringer Rostbratwurst is sold out! +Gorgonzola Telino is sold out! +Perth Pasties is sold out! +".NormalizeNewLines())); + } + + [Test] + public void linq4_selectPartial() + { + var context = CreateContext(new Dictionary<string, object> + { + {ScriptConstants.DefaultDateFormat, "yyyy/MM/dd"} + }); + + context.VirtualFiles.WriteFile("page.html", @"{{ + customers + |> where: it.Region == 'WA' + |> assignTo: waCustomers +}} +Customers from Washington and their orders: +{{ waCustomers |> selectPartial('customer') }}"); + + context.VirtualFiles.WriteFile("customer.html", @"Customer {{ it.CustomerId }} {{ it.CompanyName |> raw }} +{{ it.Orders |> select("" Order {{ it.OrderId }}: {{ it.OrderDate |> dateFormat |> newLine }}"") }}"); + + Assert.That(new PageResult(context.GetPage("page")).Result.NormalizeNewLines(), + Does.StartWith(@" +Customers from Washington and their orders: +Customer LAZYK Lazy K Kountry Store + Order 10482: 1997/03/21 + Order 10545: 1997/05/22 +Customer TRAIH Trail's Head Gourmet Provisioners + Order 10574: 1997/06/19 + Order 10577: 1997/06/23 + Order 10822: 1998/01/08 +".NormalizeNewLines())); + } + + [Test] + public void linq4_selectPartial_nested() + { + var context = CreateContext(new Dictionary<string, object> + { + {ScriptConstants.DefaultDateFormat, "yyyy/MM/dd"} + }); + + context.VirtualFiles.WriteFile("page.html", @"{{ + customers + |> where: it.Region == 'WA' + |> assignTo: waCustomers +}} +Customers from Washington and their orders: +{{ waCustomers |> selectPartial: customer }}"); + + context.VirtualFiles.WriteFile("customer.html", + @"Customer {{ it.CustomerId }} {{ it.CompanyName |> raw }} +{{ it.Orders |> selectPartial: order }}"); + + context.VirtualFiles.WriteFile("order.html", @" Order {{ it.OrderId }}: {{ it.OrderDate |> dateFormat}} +"); + + Assert.That(new PageResult(context.GetPage("page")).Result.NormalizeNewLines(), + Does.StartWith(@" +Customers from Washington and their orders: +Customer LAZYK Lazy K Kountry Store + Order 10482: 1997/03/21 + Order 10545: 1997/05/22 +Customer TRAIH Trail's Head Gourmet Provisioners + Order 10574: 1997/06/19 + Order 10577: 1997/06/23 + Order 10822: 1998/01/08 +".NormalizeNewLines())); + } + + [Test] + public void linq4_selectPartial_nested_with_custom_item_binding() + { + var context = CreateContext(new Dictionary<string, object> + { + {ScriptConstants.DefaultDateFormat, "yyyy/MM/dd"} + }); + + context.VirtualFiles.WriteFile("page.html", @"{{ + customers + |> where: it.Region == 'WA' + |> assignTo: waCustomers +}} +Customers from Washington and their orders: +{{ waCustomers |> selectPartial: customer }}"); + + context.VirtualFiles.WriteFile("customer.html", + @" +<!-- +it: cust +--> + +Customer {{ cust.CustomerId }} {{ cust.CompanyName |> raw }} +{{ cust.Orders |> selectPartial('order', { it: 'order' }) }}"); + + context.VirtualFiles.WriteFile("order.html", + " Order {{ order.OrderId }}: {{ order.OrderDate |> dateFormat}}\n"); + + Assert.That(new PageResult(context.GetPage("page")).Result.NormalizeNewLines(), + Does.StartWith(@" +Customers from Washington and their orders: +Customer LAZYK Lazy K Kountry Store + Order 10482: 1997/03/21 + Order 10545: 1997/05/22 +Customer TRAIH Trail's Head Gourmet Provisioners + Order 10574: 1997/06/19 + Order 10577: 1997/06/23 + Order 10822: 1998/01/08 +".NormalizeNewLines())); + } + + [Test] + public void Linq14_original() + { + var context = CreateContext(new Dictionary<string, object> + { + {"numbersA", new[] {0, 2, 4, 5, 6, 8, 9}}, + {"numbersB", new[] {1, 3, 5, 7, 8}}, + }); + + Assert.That(context.EvaluateScript(@" +Pairs where a < b: +{{ numbersA |> zip(numbersB) + |> where: it[0] < it[1] + |> select: { it[0] } is less than { it[1] }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +Pairs where a < b: +0 is less than 1 +0 is less than 3 +0 is less than 5 +0 is less than 7 +0 is less than 8 +2 is less than 3 +2 is less than 5 +2 is less than 7 +2 is less than 8 +4 is less than 5 +4 is less than 7 +4 is less than 8 +5 is less than 7 +5 is less than 8 +6 is less than 7 +6 is less than 8 +".NormalizeNewLines())); + } + + [Test] + public void Linq14_bindings() + { + var context = CreateContext(new Dictionary<string, object> + { + {"numbersA", new[] {0, 2, 4, 5, 6, 8, 9}}, + {"numbersB", new[] {1, 3, 5, 7, 8}}, + }); + + Assert.That(context.EvaluateScript(@" +Pairs where a < b: +{{ numbersA |> zip(numbersB) + |> let({ a: 'it[0]', b: 'it[1]' }) + |> where: a < b + |> select: { a } is less than { b }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +Pairs where a < b: +0 is less than 1 +0 is less than 3 +0 is less than 5 +0 is less than 7 +0 is less than 8 +2 is less than 3 +2 is less than 5 +2 is less than 7 +2 is less than 8 +4 is less than 5 +4 is less than 7 +4 is less than 8 +5 is less than 7 +5 is less than 8 +6 is less than 7 +6 is less than 8 +".NormalizeNewLines())); + } + + [Test] + public void Linq18_whitespace_test() + { + var context = CreateContext(); + + var template = @" +{{ '1997-01-01' |> assignTo: cutoffDate }} +{{ customers + |> where: it.Region == 'WA' + |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where: o.OrderDate >= cutoffDate + |> select: ({ c.CustomerId }, { o.OrderId })\n }} +".NormalizeNewLines(); + Assert.That(context.EvaluateScript(template).NormalizeNewLines(), + + Does.StartWith(@" +(LAZYK, 10482) +(LAZYK, 10545) +(TRAIH, 10574) +".NormalizeNewLines())); + } + + [Test] + public void Linq21_jsv() + { + var context = CreateContext(); + + Assert.That(context.EvaluateScript(@" +First 3 orders in WA: +{{ customers |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where: c.Region == 'WA' + |> select: { [c.CustomerId, o.OrderId, o.OrderDate] |> jsv }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +First 3 orders in WA: +[LAZYK,10482,1997-03-21] +[LAZYK,10545,1997-05-22] +[TRAIH,10574,1997-06-19] +".NormalizeNewLines())); + } + + [Test] + public void Linq21_json_with_config() + { + var context = CreateContext(); + + Assert.That(context.EvaluateScript(@" +First 3 orders in WA: +{{ customers |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where: c.Region == 'WA' + |> select: { [c.CustomerId, o.OrderId, o.OrderDate] |> json('DateHandler:ISO8601DateOnly') }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +First 3 orders in WA: +[""LAZYK"",10482,""1997-03-21""] +[""LAZYK"",10545,""1997-05-22""] +[""TRAIH"",10574,""1997-06-19""] +".NormalizeNewLines())); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryLinqPipelineOperatorTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryLinqPipelineOperatorTests.cs new file mode 100644 index 00000000000..efb35915921 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryLinqPipelineOperatorTests.cs @@ -0,0 +1,2098 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Logging; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class QueryLinqPipelineOperatorTests + { + private static ScriptContext CreateContext() + { + var context = new ScriptContext + { + Args = + { + [ScriptConstants.DefaultDateFormat] = "yyyy/MM/dd", + ["products"] = QueryData.Products, + ["customers"] = QueryData.Customers, + ["comparer"] = new CaseInsensitiveComparer(), + ["anagramComparer"] = new AnagramEqualityComparer(), + } + }; + return context.Init(); + } + + [SetUp] + public void Setup() => context = CreateContext(); + private ScriptContext context; + + [Test] + public void Can_use_pipeline_operator_in_code_blocks() + { + ConsoleLogFactory.Configure(); + Assert.That(context.EvaluateScript(@" +```code +`Numbers < 5:` |> raw +[5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers +numbers |> where => it < 5 |> joinln |> raw +```").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers < 5: +4 +1 +3 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq01() // alternative with clean whitespace sensitive string argument syntax: + { + Assert.That(context.EvaluateScript(@" +Numbers < 5: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers + |> where => it < 5 + |> joinln +}}").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers < 5: +4 +1 +3 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq02() // alternative with clean whitespace sensitive string argument syntax: + { + Assert.That(context.EvaluateScript(@" +Sold out products: +{{ products + |> where => it.UnitsInStock == 0 + |> select: { it.productName |> raw } is sold out!\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Sold out products: +Chef Anton's Gumbo Mix is sold out! +Alice Mutton is sold out! +Thüringer Rostbratwurst is sold out! +Gorgonzola Telino is sold out! +Perth Pasties is sold out! +".NormalizeNewLines())); + } + + [Test] + public void Linq03() + { + Assert.That(context.EvaluateScript(@" +In-stock products that cost more than 3.00: +{{ products + |> where => it.UnitsInStock > 0 and it.UnitPrice > 3 + |> select: { it.productName |> raw } is in stock and costs more than 3.00.\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +In-stock products that cost more than 3.00: +Chai is in stock and costs more than 3.00. +Chang is in stock and costs more than 3.00. +Aniseed Syrup is in stock and costs more than 3.00. +".NormalizeNewLines())); + } + + [Test] + public void Linq04() + { + context.VirtualFiles.WriteFile("customer.html", @" +Customer {{ it.CustomerId }} {{ it.CompanyName |> raw }} +{{ it.Orders |> selectPartial: order }}"); + + context.VirtualFiles.WriteFile("order.html", " Order {{ it.OrderId }}: {{ it.OrderDate |> dateFormat }}\n"); + + Assert.That(context.EvaluateScript(@" +{{ customers + |> where => it.Region == 'WA' + |> to => waCustomers +}} +Customers from Washington and their orders: +{{ waCustomers |> selectPartial: customer }} +").NormalizeNewLines(), + + Does.StartWith(@" +Customers from Washington and their orders: + +Customer LAZYK Lazy K Kountry Store + Order 10482: 1997/03/21 + Order 10545: 1997/05/22 + +Customer TRAIH Trail's Head Gourmet Provisioners + Order 10574: 1997/06/19 + Order 10577: 1997/06/23 + Order 10822: 1998/01/08 +".NormalizeNewLines())); + } + + [Test] + public void Linq05() + { + Assert.That(context.EvaluateScript(@" +Short digits: +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> to => digits }} +{{ digits + |> where => it.Length < index + |> select: The word {it} is shorter than its value.\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Short digits: +The word five is shorter than its value. +The word six is shorter than its value. +The word seven is shorter than its value. +The word eight is shorter than its value. +The word nine is shorter than its value. +".NormalizeNewLines())); + } + + [Test] + public void Linq06() + { + Assert.That(context.EvaluateScript(@" +Numbers + 1: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers |> select: { it |> incr }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Numbers + 1: +6 +5 +2 +4 +10 +9 +7 +8 +3 +1 +".NormalizeNewLines())); + } + + [Test] + public void Linq07() + { + Assert.That(context.EvaluateScript(@" +Product Names: +{{ products |> select: { it.ProductName |> raw }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Product Names: +Chai +Chang +Aniseed Syrup +Chef Anton's Cajun Seasoning +Chef Anton's Gumbo Mix +".NormalizeNewLines())); + } + + [Test] + public void Linq08() + { + Assert.That(context.EvaluateScript(@" +Number strings: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> to => strings }} +{{ numbers |> select: { strings[it] }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Number strings: +five +four +one +three +nine +eight +six +seven +two +zero +".NormalizeNewLines())); + } + + [Test] + public void Linq09() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'BlUeBeRrY', 'cHeRry'] |> to => words }} +{{ words |> select: Uppercase: { it |> upper }, Lowercase: { it |> lower }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Uppercase: APPLE, Lowercase: apple +Uppercase: BLUEBERRY, Lowercase: blueberry +Uppercase: CHERRY, Lowercase: cherry +".NormalizeNewLines())); + } + + [Test] + public void Linq10() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> to => strings }} +{{ numbers |> select: The digit { strings[it] } is { it.isEven() ? 'even' : 'odd' }.\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +The digit five is odd. +The digit four is even. +The digit one is odd. +The digit three is odd. +The digit nine is odd. +The digit eight is even. +The digit six is even. +The digit seven is odd. +The digit two is even. +The digit zero is even. +".NormalizeNewLines())); + } + + [Test] + public void Linq11() + { + Assert.That(context.EvaluateScript(@" +Product Info: +{{ products |> select: { it.ProductName |> raw } is in the category { it.Category } and costs { it.UnitPrice |> currency } per unit.\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Product Info: +Chai is in the category Beverages and costs $18.00 per unit. +Chang is in the category Beverages and costs $19.00 per unit. +Aniseed Syrup is in the category Condiments and costs $10.00 per unit. +".NormalizeNewLines())); + } + + [Test] + public void Linq12() + { + Assert.That(context.EvaluateScript(@" +Number: In-place? +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers |> select: { it }: { it |> equals(index) |> lower }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Number: In-place? +5: false +4: false +1: false +3: true +9: false +8: false +6: true +7: true +2: false +0: false +".NormalizeNewLines())); + } + + [Test] + public void Linq13() + { + Assert.That(context.EvaluateScript(@" +Numbers < 5: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> to => digits }} +{{ numbers + |> where => it < 5 + |> select: { digits[it] }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +Numbers < 5: +four +one +three +two +zero +".NormalizeNewLines())); + } + + [Test] + public void Linq14() + { + Assert.That(context.EvaluateScript(@" +{{ [0, 2, 4, 5, 6, 8, 9] |> to => numbersA }} +{{ [1, 3, 5, 7, 8] |> to => numbersB }} +Pairs where a < b: +{{ numbersA |> zip(numbersB) + |> let({ a: 'it[0]', b: 'it[1]' }) + |> where => a < b + |> select: { a } is less than { b }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +Pairs where a < b: +0 is less than 1 +0 is less than 3 +0 is less than 5 +0 is less than 7 +0 is less than 8 +2 is less than 3 +2 is less than 5 +2 is less than 7 +2 is less than 8 +4 is less than 5 +4 is less than 7 +4 is less than 8 +5 is less than 7 +5 is less than 8 +6 is less than 7 +6 is less than 8 +".NormalizeNewLines())); + } + + [Test] + public void Linq15() + { + Assert.That(context.EvaluateScript(@" +{{ customers |> zip => it.Orders + |> let => { c: it[0], o: it[1] } + |> where => o.Total < 500 + |> select: ({ c.CustomerId }, { o.OrderId }, { o.Total |> format('0.0#') })\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +(ALFKI, 10702, 330.0) +(ALFKI, 10952, 471.2) +(ANATR, 10308, 88.8) +(ANATR, 10625, 479.75) +".NormalizeNewLines())); + } + + [Test] + public void Linq16() + { + Assert.That(context.EvaluateScript(@" +{{ customers |> zip => it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where => o.OrderDate >= '1998-01-01' + |> select: ({ c.CustomerId }, { o.OrderId }, { o.OrderDate })\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +(ALFKI, 10835, 1/15/1998 12:00:00 AM) +(ALFKI, 10952, 3/16/1998 12:00:00 AM) +(ALFKI, 11011, 4/9/1998 12:00:00 AM) +(ANATR, 10926, 3/4/1998 12:00:00 AM) +(ANTON, 10856, 1/28/1998 12:00:00 AM) +".NormalizeNewLines())); + } + + [Test] + public void Linq17() + { + Assert.That(context.EvaluateScript(@" +{{ customers |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where => o.Total >= 2000 + |> select: ({ c.CustomerId }, { o.OrderId }, { o.Total |> format('0.0#') })\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +(ANTON, 10573, 2082.0) +(AROUT, 10558, 2142.9) +(AROUT, 10953, 4441.25) +(BERGS, 10384, 2222.4) +(BERGS, 10524, 3192.65) +".NormalizeNewLines())); + } + + [Test] + public void Linq18() + { + var template = @" +{{ '1997-01-01' |> to => cutoffDate }} +{{ customers + |> where => it.Region == 'WA' + |> zip => it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where => o.OrderDate >= cutoffDate + |> select: ({ c.CustomerId }, { o.OrderId })\n }} +"; + Assert.That(context.EvaluateScript(template.NormalizeNewLines()).NormalizeNewLines(), + + Does.StartWith(@" +(LAZYK, 10482) +(LAZYK, 10545) +(TRAIH, 10574) +(TRAIH, 10577) +(TRAIH, 10822) +(WHITC, 10469) +(WHITC, 10483) +(WHITC, 10504) +(WHITC, 10596) +(WHITC, 10693) +(WHITC, 10696) +(WHITC, 10723) +(WHITC, 10740) +(WHITC, 10861) +(WHITC, 10904) +(WHITC, 11032) +(WHITC, 11066) +".NormalizeNewLines())); + } + + [Test] + public void Linq19() + { + Assert.That(context.EvaluateScript(@" +{{ customers + |> let({ cust: 'it', custIndex: 'index' }) + |> zip => cust.Orders + |> let({ o: 'it[1]' }) + |> select: Customer #{ custIndex |> incr } has an order with OrderID { o.OrderId }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Customer #1 has an order with OrderID 10643 +Customer #1 has an order with OrderID 10692 +Customer #1 has an order with OrderID 10702 +Customer #1 has an order with OrderID 10835 +Customer #1 has an order with OrderID 10952 +Customer #1 has an order with OrderID 11011 +Customer #2 has an order with OrderID 10308 +Customer #2 has an order with OrderID 10625 +Customer #2 has an order with OrderID 10759 +Customer #2 has an order with OrderID 10926 +".NormalizeNewLines())); + } + + [Test] + public void Linq20() + { + Assert.That(context.EvaluateScript(@" +First 3 numbers: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers |> take(3) |> select: { it }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +First 3 numbers: +5 +4 +1 +".NormalizeNewLines())); + } + + [Test] + public void Linq21() + { + Assert.That(context.EvaluateScript(@" +First 3 orders in WA: +{{ customers |> zip => it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where => c.Region == 'WA' + |> select: { [c.CustomerId, o.OrderId, o.OrderDate] |> jsv }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +First 3 orders in WA: +[LAZYK,10482,1997-03-21] +[LAZYK,10545,1997-05-22] +[TRAIH,10574,1997-06-19] +".NormalizeNewLines())); + } + + [Test] + public void Linq22() + { + Assert.That(context.EvaluateScript(@" +All but first 4 numbers: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers |> skip(4) |> select: { it }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +All but first 4 numbers: +9 +8 +6 +7 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq23() + { + Assert.That(context.EvaluateScript(@" +All but first 2 orders in WA: +{{ customers |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where => c.Region == 'WA' + |> skip(2) + |> select: { [c.CustomerId, o.OrderId, o.OrderDate] |> jsv }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +All but first 2 orders in WA: +[TRAIH,10574,1997-06-19] +[TRAIH,10577,1997-06-23] +[TRAIH,10822,1998-01-08] +[WHITC,10269,1996-07-31] +[WHITC,10344,1996-11-01] +[WHITC,10469,1997-03-10] +[WHITC,10483,1997-03-24] +[WHITC,10504,1997-04-11] +[WHITC,10596,1997-07-11] +[WHITC,10693,1997-10-06] +[WHITC,10696,1997-10-08] +[WHITC,10723,1997-10-30] +[WHITC,10740,1997-11-13] +[WHITC,10861,1998-01-30] +[WHITC,10904,1998-02-24] +[WHITC,11032,1998-04-17] +[WHITC,11066,1998-05-01] +".NormalizeNewLines())); + } + + [Test] + public void Linq24() + { + Assert.That(context.EvaluateScript(@" +First numbers less than 6: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers + |> takeWhile => it < 6 + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +First numbers less than 6: +5 +4 +1 +3 +".NormalizeNewLines())); + } + + [Test] + public void Linq25() + { + Assert.That(context.EvaluateScript(@" +First numbers not less than their position: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers + |> takeWhile => it >= index + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +First numbers not less than their position: +5 +4 +".NormalizeNewLines())); + } + + [Test] + public void Linq26() + { + Assert.That(context.EvaluateScript(@" +All elements starting from first element divisible by 3: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers + |> skipWhile => mod(it,3) != 0 + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +All elements starting from first element divisible by 3: +3 +9 +8 +6 +7 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq27() + { + Assert.That(context.EvaluateScript(@" +All elements starting from first element less than its position: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers + |> skipWhile: it >= index + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +All elements starting from first element less than its position: +1 +3 +9 +8 +6 +7 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq28() + { + Assert.That(context.EvaluateScript(@" +The sorted list of words: +{{ ['cherry', 'apple', 'blueberry'] |> to => words }} +{{ words + |> orderBy => it + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +The sorted list of words: +apple +blueberry +cherry +".NormalizeNewLines())); + } + + [Test] + public void Linq29() + { + Assert.That(context.EvaluateScript(@" +The sorted list of words (by length): +{{ ['cherry', 'apple', 'blueberry'] |> to => words }} +{{ words + |> orderBy => it.Length + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +The sorted list of words (by length): +apple +cherry +blueberry +".NormalizeNewLines())); + } + + [Test] + public void Linq30() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> orderBy => it.ProductName + |> select: { it |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +{ProductId:17,ProductName:Alice Mutton,Category:Meat/Poultry,UnitPrice:39,UnitsInStock:0} +{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13} +{ProductId:40,ProductName:Boston Crab Meat,Category:Seafood,UnitPrice:18.4,UnitsInStock:123} +{ProductId:60,ProductName:Camembert Pierrot,Category:Dairy Products,UnitPrice:34,UnitsInStock:19} +{ProductId:18,ProductName:Carnarvon Tigers,Category:Seafood,UnitPrice:62.5,UnitsInStock:42} +".NormalizeNewLines())); + } + + [Test] + public void Linq31() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'AbAcUs', 'bRaNcH', 'BlUeBeRrY', 'ClOvEr', 'cHeRry'] |> to => words }} +{{ words + |> orderBy('it', { comparer }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +AbAcUs +aPPLE +BlUeBeRrY +bRaNcH +cHeRry +ClOvEr +".NormalizeNewLines())); + } + + [Test] + public void Linq32() + { + Assert.That(context.EvaluateScript(@" +The doubles from highest to lowest: +{{ [1.7, 2.3, 1.9, 4.1, 2.9] |> to => doubles }} +{{ doubles + |> orderByDescending => it + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +The doubles from highest to lowest: +4.1 +2.9 +2.3 +1.9 +1.7 +".NormalizeNewLines())); + } + + [Test] + public void Linq33() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> orderByDescending => it.UnitsInStock + |> select: { it |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +{ProductId:75,ProductName:Rhönbräu Klosterbier,Category:Beverages,UnitPrice:7.75,UnitsInStock:125} +{ProductId:40,ProductName:Boston Crab Meat,Category:Seafood,UnitPrice:18.4,UnitsInStock:123} +{ProductId:6,ProductName:Grandma's Boysenberry Spread,Category:Condiments,UnitPrice:25,UnitsInStock:120} +{ProductId:55,ProductName:Pâté chinois,Category:Meat/Poultry,UnitPrice:24,UnitsInStock:115} +{ProductId:61,ProductName:Sirop d'érable,Category:Condiments,UnitPrice:28.5,UnitsInStock:113} +".NormalizeNewLines())); + } + + [Test] + public void Linq34() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'AbAcUs', 'bRaNcH', 'BlUeBeRrY', 'ClOvEr', 'cHeRry'] |> to => words }} +{{ words + |> orderByDescending('it', { comparer }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +ClOvEr +cHeRry +bRaNcH +BlUeBeRrY +aPPLE +AbAcUs +".NormalizeNewLines())); + } + + [Test] + public void Linq35() + { + Assert.That(context.EvaluateScript(@" +Sorted digits: +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> to => digits }} +{{ digits + |> orderBy => it.length + |> thenBy => it + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Sorted digits: +one +six +two +five +four +nine +zero +eight +seven +three +".NormalizeNewLines())); + } + + [Test] + public void Linq36() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'AbAcUs', 'bRaNcH', 'BlUeBeRrY', 'ClOvEr', 'cHeRry'] |> to => words }} +{{ words + |> orderBy => it.length + |> thenBy('it', { comparer }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +aPPLE +AbAcUs +bRaNcH +cHeRry +ClOvEr +BlUeBeRrY +".NormalizeNewLines())); + } + + [Test] + public void Linq37() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> orderBy => it.Category + |> thenByDescending => it.UnitPrice + |> select: { it |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +{ProductId:38,ProductName:Côte de Blaye,Category:Beverages,UnitPrice:263.5,UnitsInStock:17} +{ProductId:43,ProductName:Ipoh Coffee,Category:Beverages,UnitPrice:46,UnitsInStock:17} +{ProductId:2,ProductName:Chang,Category:Beverages,UnitPrice:19,UnitsInStock:17} +{ProductId:1,ProductName:Chai,Category:Beverages,UnitPrice:18,UnitsInStock:39} +{ProductId:35,ProductName:Steeleye Stout,Category:Beverages,UnitPrice:18,UnitsInStock:20} +{ProductId:39,ProductName:Chartreuse verte,Category:Beverages,UnitPrice:18,UnitsInStock:69} +{ProductId:76,ProductName:Lakkalikööri,Category:Beverages,UnitPrice:18,UnitsInStock:57} +{ProductId:70,ProductName:Outback Lager,Category:Beverages,UnitPrice:15,UnitsInStock:15} +{ProductId:34,ProductName:Sasquatch Ale,Category:Beverages,UnitPrice:14,UnitsInStock:111} +".NormalizeNewLines())); + } + + [Test] + public void Linq38() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'AbAcUs', 'bRaNcH', 'BlUeBeRrY', 'ClOvEr', 'cHeRry'] |> to => words }} +{{ words + |> orderBy => it.length + |> thenByDescending('it', { comparer }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +aPPLE +ClOvEr +cHeRry +bRaNcH +AbAcUs +BlUeBeRrY +".NormalizeNewLines())); + } + + [Test] + public void Linq39() + { + Assert.That(context.EvaluateScript(@" +A backwards list of the digits with a second character of 'i': +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> to => digits }} +{{ digits + |> where => it[1] == 'i' + |> reverse + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +A backwards list of the digits with a second character of 'i': +nine +eight +six +five +".NormalizeNewLines())); + } + + [Test] + public void Linq40() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers + |> groupBy => mod(it,5) + |> let({ remainder: 'it.Key', numbers: 'it' }) + |> select: Numbers with a remainder of { remainder } when divided by 5:\n{ numbers |> select('{it}\n') } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers with a remainder of 0 when divided by 5: +5 +0 +Numbers with a remainder of 4 when divided by 5: +4 +9 +Numbers with a remainder of 1 when divided by 5: +1 +6 +Numbers with a remainder of 3 when divided by 5: +3 +8 +Numbers with a remainder of 2 when divided by 5: +7 +2 +".NormalizeNewLines())); + } + + [Test] + public void Linq41() + { + Assert.That(context.EvaluateScript(@" +{{ ['blueberry', 'chimpanzee', 'abacus', 'banana', 'apple', 'cheese'] |> to => words }} +{{ words + |> groupBy => it[0] + |> let({ firstLetter: 'it.Key', words: 'it' }) + |> select: Words that start with the letter '{firstLetter}':\n{ words |> select('{it}\n') } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Words that start with the letter 'b': +blueberry +banana +Words that start with the letter 'c': +chimpanzee +cheese +Words that start with the letter 'a': +abacus +apple +".NormalizeNewLines())); + } + + [Test] + public void Linq42() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> let({ category: 'it.Key', products: 'it' }) + |> select: {category}:\n{ products |> select('{it |> jsv}\n') } }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages: +{ProductId:1,ProductName:Chai,Category:Beverages,UnitPrice:18,UnitsInStock:39} +{ProductId:2,ProductName:Chang,Category:Beverages,UnitPrice:19,UnitsInStock:17} +{ProductId:24,ProductName:Guaraná Fantástica,Category:Beverages,UnitPrice:4.5,UnitsInStock:20} +{ProductId:34,ProductName:Sasquatch Ale,Category:Beverages,UnitPrice:14,UnitsInStock:111} +{ProductId:35,ProductName:Steeleye Stout,Category:Beverages,UnitPrice:18,UnitsInStock:20} +{ProductId:38,ProductName:Côte de Blaye,Category:Beverages,UnitPrice:263.5,UnitsInStock:17} +{ProductId:39,ProductName:Chartreuse verte,Category:Beverages,UnitPrice:18,UnitsInStock:69} +{ProductId:43,ProductName:Ipoh Coffee,Category:Beverages,UnitPrice:46,UnitsInStock:17} +{ProductId:67,ProductName:Laughing Lumberjack Lager,Category:Beverages,UnitPrice:14,UnitsInStock:52} +{ProductId:70,ProductName:Outback Lager,Category:Beverages,UnitPrice:15,UnitsInStock:15} +{ProductId:75,ProductName:Rhönbräu Klosterbier,Category:Beverages,UnitPrice:7.75,UnitsInStock:125} +{ProductId:76,ProductName:Lakkalikööri,Category:Beverages,UnitPrice:18,UnitsInStock:57} +Condiments: +{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13} +{ProductId:4,ProductName:Chef Anton's Cajun Seasoning,Category:Condiments,UnitPrice:22,UnitsInStock:53} +".NormalizeNewLines())); + } + + [Test] + public void Linq43() + { + context.VirtualFiles.WriteFile("month-orders.html", @" +{{ year }} +{{ monthGroups |> scopeVars |> select: { indent }{ month }\n{ 2 |> indents }{ orders |> jsv }\n }}"); + + Assert.That(context.EvaluateScript(@" +{{ customers + |> let({ + companyName: 'it.CompanyName', + yearGroups: ""map ( + groupBy(it.Orders, 'it.OrderDate.Year'), + '{ + year: it.Key, + monthGroups: map ( + groupBy(it, `it.OrderDate.Month`), + `{ month: it.Key, orders: it }` + ) + }' + )"" + }) + |> select: \n# { companyName |> raw }{ yearGroups |> scopeVars |> selectPartial('month-orders') } +}} +").NormalizeNewLines(), + + Does.StartWith(@" +# Alfreds Futterkiste +1997 + 8 + [{OrderId:10643,OrderDate:1997-08-25,Total:814.5}] + 10 + [{OrderId:10692,OrderDate:1997-10-03,Total:878},{OrderId:10702,OrderDate:1997-10-13,Total:330}] + +1998 + 1 + [{OrderId:10835,OrderDate:1998-01-15,Total:845.8}] + 3 + [{OrderId:10952,OrderDate:1998-03-16,Total:471.2}] + 4 + [{OrderId:11011,OrderDate:1998-04-09,Total:933.5}] + +# Ana Trujillo Emparedados y helados +1996 + 9 + [{OrderId:10308,OrderDate:1996-09-18,Total:88.8}] +".NormalizeNewLines())); + } + + [Test] + public void Linq43_alt() + { + context.VirtualFiles.WriteFile("month-orders.html", @" +{{ year }} +{{ monthGroups |> scopeVars |> select: { indent }{ month }\n{ 2 |> indents }{ orders |> jsv }\n }}"); + + Assert.That(context.EvaluateScript(@" +{{ customers + |> map => { + companyName: it.CompanyName, + yearGroups: map ( + groupBy(it.Orders, it => it.OrderDate.Year), + yg => { + year: yg.Key, + monthGroups: map ( + groupBy(yg, o => o.OrderDate.Month), + mg => { month: mg.Key, orders: mg } + ) + } + ) + } + |> select: \n# { it.companyName |> raw }{ it.yearGroups |> scopeVars |> selectPartial('month-orders') } +}} +").NormalizeNewLines(), + + Does.StartWith(@" +# Alfreds Futterkiste +1997 + 8 + [{OrderId:10643,OrderDate:1997-08-25,Total:814.5}] + 10 + [{OrderId:10692,OrderDate:1997-10-03,Total:878},{OrderId:10702,OrderDate:1997-10-13,Total:330}] + +1998 + 1 + [{OrderId:10835,OrderDate:1998-01-15,Total:845.8}] + 3 + [{OrderId:10952,OrderDate:1998-03-16,Total:471.2}] + 4 + [{OrderId:11011,OrderDate:1998-04-09,Total:933.5}] + +# Ana Trujillo Emparedados y helados +1996 + 9 + [{OrderId:10308,OrderDate:1996-09-18,Total:88.8}] +".NormalizeNewLines())); + } + + [Test] + public void Linq44() + { + Assert.That(context.EvaluateScript(@" +{{ ['from ', ' salt', ' earn ', ' last ', ' near ', ' form '] |> to => anagrams }} +{{ anagrams + |> groupBy('trim(it)', { comparer: anagramComparer }) + |> select: { it |> json }\n +}} +").NormalizeNewLines(), + + Is.EqualTo(@" +[""from "","" form ""] +["" salt"","" last ""] +["" earn "","" near ""] +".NormalizeNewLines())); + } + + [Test] + public void Linq45() + { + Assert.That(context.EvaluateScript(@" +{{ ['from ', ' salt', ' earn ', ' last ', ' near ', ' form '] |> to => anagrams }} +{{ anagrams + |> groupBy('trim(it)', { map: 'upper(it)', comparer: anagramComparer }) + |> select: { it |> json }\n +}} +").NormalizeNewLines(), + + Is.EqualTo(@" +[""FROM "","" FORM ""] +["" SALT"","" LAST ""] +["" EARN "","" NEAR ""] +".NormalizeNewLines())); + } + + [Test] + public void Linq46() + { + Assert.That(context.EvaluateScript(@" +Prime factors of 300: +{{ [2, 2, 3, 5, 5] |> to => factorsOf300 }} +{{ factorsOf300 |> distinct |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Prime factors of 300: +2 +3 +5 +".NormalizeNewLines())); + } + + [Test] + public void Linq47() + { + Assert.That(context.EvaluateScript(@" +Category names: +{{ products + |> map => it.Category + |> distinct + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Category names: +Beverages +Condiments +Produce +Meat/Poultry +Seafood +Dairy Products +Confections +Grains/Cereals +".NormalizeNewLines())); + } + + [Test] + public void Linq48() + { + Assert.That(context.EvaluateScript(@" +{{ [ 0, 2, 4, 5, 6, 8, 9 ] |> to => numbersA }} +{{ [ 1, 3, 5, 7, 8 ] |> to => numbersB }} +Unique numbers from both arrays: +{{ numbersA |> union(numbersB) |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Unique numbers from both arrays: +0 +2 +4 +5 +6 +8 +9 +1 +3 +7 +".NormalizeNewLines())); + } + + [Test] + public void Linq49() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> map => it.ProductName[0] + |> to => productFirstChars }} +{{ customers + |> map => it.CompanyName[0] + |> to => customerFirstChars }} +Unique first letters from Product names and Customer names: +{{ productFirstChars + |> union(customerFirstChars) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Unique first letters from Product names and Customer names: +C +A +G +U +N +M +I +Q +K +T +P +S +R +B +J +Z +V +F +E +W +L +O +D +H +".NormalizeNewLines())); + } + + [Test] + public void Linq50() + { + Assert.That(context.EvaluateScript(@" +{{ [ 0, 2, 4, 5, 6, 8, 9 ] |> to => numbersA }} +{{ [ 1, 3, 5, 7, 8 ] |> to => numbersB }} +Common numbers shared by both arrays: +{{ numbersA |> intersect(numbersB) |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Common numbers shared by both arrays: +5 +8 +".NormalizeNewLines())); + } + + [Test] + public void Linq51() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> map => it.ProductName[0] + |> to => productFirstChars }} +{{ customers + |> map => it.CompanyName[0] + |> to => customerFirstChars }} +Common first letters from Product names and Customer names: +{{ productFirstChars + |> intersect(customerFirstChars) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Common first letters from Product names and Customer names: +C +A +G +N +M +I +Q +K +T +P +S +R +B +V +F +E +W +L +O +".NormalizeNewLines())); + } + + [Test] + public void Linq52() + { + Assert.That(context.EvaluateScript(@" +{{ [ 0, 2, 4, 5, 6, 8, 9 ] |> to => numbersA }} +{{ [ 1, 3, 5, 7, 8 ] |> to => numbersB }} +Numbers in first array but not second array: +{{ numbersA |> except(numbersB) |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers in first array but not second array: +0 +2 +4 +6 +9 +".NormalizeNewLines())); + } + + [Test] + public void Linq53() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> map => it.ProductName[0] + |> to => productFirstChars }} +{{ customers + |> map => it.CompanyName[0] + |> to => customerFirstChars }} +First letters from Product names, but not from Customer names: +{{ productFirstChars + |> except(customerFirstChars) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +First letters from Product names, but not from Customer names: +U +J +Z +".NormalizeNewLines())); + } + + [Test] + public void Linq54() + { + Assert.That(context.EvaluateScript(@" +{{ [ 1.7, 2.3, 1.9, 4.1, 2.9 ] |> to => doubles }} +Every other double from highest to lowest: +{{ doubles + |> orderByDescending => it + |> step({ by: 2 }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Every other double from highest to lowest: +4.1 +2.3 +1.7 +".NormalizeNewLines())); + } + + [Test] + public void Linq55() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> to => words }} +The sorted word list: +{{ words + |> orderBy => it + |> toList + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +The sorted word list: +apple +blueberry +cherry +".NormalizeNewLines())); + } + + [Test] + public void Linq56() + { + Assert.That(context.EvaluateScript(@" +{{ [{name:'Alice', score:50}, {name: 'Bob', score:40}, {name:'Cathy', score:45}] |> to => scoreRecords }} +Bob's score: +{{ scoreRecords + |> toDictionary => it.name + |> get('Bob') + |> select: { it['name'] } = { it['score'] } +}} +").NormalizeNewLines(), + + Is.EqualTo(@" +Bob's score: +Bob = 40 +".NormalizeNewLines())); + } + + [Test] + public void Linq57() + { + Assert.That(context.EvaluateScript(@" +{{ [null, 1.0, 'two', 3, 'four', 5, 'six', 7.0] |> to => numbers }} +Numbers stored as doubles: +{{ numbers + |> of({ type: 'Double' }) + |> select: { it |> format('#.0') }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers stored as doubles: +1.0 +7.0 +".NormalizeNewLines())); + } + + [Test] + public void Linq58() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> where => it.ProductId == 12 + |> first + |> select: { it |> jsv } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +{ProductId:12,ProductName:Queso Manchego La Pastora,Category:Dairy Products,UnitPrice:38,UnitsInStock:86} +".NormalizeNewLines())); + } + + [Test] + public void Linq59() + { + Assert.That(context.EvaluateScript(@" +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> to => strings }} +{{ strings + |> first => it[0] == 'o' + |> select: A string starting with 'o': { it } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +A string starting with 'o': one +".NormalizeNewLines())); + } + + [Test] + public void Linq61() + { + Assert.That(context.EvaluateScript(@" +{{ [] |> to => numbers }} +{{ numbers |> first |> otherwise('null') }} +").NormalizeNewLines(), + + Is.EqualTo(@" +null +".NormalizeNewLines())); + } + + [Test] + public void Linq62() + { + Assert.That(context.EvaluateScript(@" +Product 789 exists: {{ products + |> first => it.ProductId == 789 + |> isNotNull }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Product 789 exists: False +".NormalizeNewLines())); + } + + [Test] + public void Linq64() + { + Assert.That(context.EvaluateScript(@" +{{ [ 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 ] |> to => numbers }} +{{ numbers + |> where => it > 5 + |> elementAt(1) + |> select: Second number > 5: { it } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Second number > 5: 8 +".NormalizeNewLines())); + } + + [Test] + public void Linq65() + { + Assert.That(context.EvaluateScript(@" +{{ range(100,50) + |> select: The number {it} is { it.isEven() ? 'even' : 'odd' }.\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +The number 100 is even. +The number 101 is odd. +The number 102 is even. +The number 103 is odd. +The number 104 is even. +The number 105 is odd. +The number 106 is even. +The number 107 is odd. +The number 108 is even. +The number 109 is odd. +The number 110 is even. +".NormalizeNewLines())); + } + + [Test] + public void Linq66() + { + Assert.That(context.EvaluateScript(@" +{{ 10 |> itemsOf(7) |> select: {it}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +7 +7 +7 +7 +7 +7 +7 +7 +7 +7 +".NormalizeNewLines())); + } + + [Test] + public void Linq67() + { + Assert.That(context.EvaluateScript(@" +{{ ['believe', 'relief', 'receipt', 'field'] |> to => words }} +{{ words + |> any => contains(it, 'ei') + |> select: There is a word that contains in the list that contains 'ei': { it |> lower } }} +").NormalizeNewLines(), + + Does.StartWith(@" +There is a word that contains in the list that contains 'ei': true".NormalizeNewLines())); + } + + [Test] + public void Linq69() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> where => any(it, 'it.UnitsInStock == 0') + |> let({ category: 'it.Key', products: 'it' }) + |> select: { category }\n{ products |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Condiments +[{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13},{ProductId:4,ProductName:Chef Anton's Cajun Seasoning,Category:Condiments,UnitPrice:22,UnitsInStock:53} +".NormalizeNewLines())); + } + + [Test] + public void Linq70() + { + Assert.That(context.EvaluateScript(@" +{{ [1, 11, 3, 19, 41, 65, 19] |> to => numbers }} +{{ numbers + |> all => isOdd(it) + |> select: The list contains only odd numbers: { it |> lower } }} +").NormalizeNewLines(), + + Does.StartWith(@" +The list contains only odd numbers: true".NormalizeNewLines())); + } + + [Test] + public void Linq72() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> where => all(it, 'it.UnitsInStock > 0') + |> let({ category: 'it.Key', products: 'it' }) + |> select: { category }\n{ products |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages +[{ProductId:1,ProductName:Chai,Category:Beverages,UnitPrice:18,UnitsInStock:39},{ProductId:2,ProductName:Chang,Category:Beverages,UnitPrice:19,UnitsInStock:17} +".NormalizeNewLines())); + } + + [Test] + public void Linq73() + { + Assert.That(context.EvaluateScript(@" +{{ [2, 2, 3, 5, 5] |> to => factorsOf300 }} +{{ factorsOf300 |> distinct |> count |> select: There are {it} unique factors of 300. }} +").NormalizeNewLines(), + + Does.StartWith(@" +There are 3 unique factors of 300.".NormalizeNewLines())); + } + + [Test] + public void Linq74() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers + |> count => isOdd(it) + |> select: There are {it} odd numbers in the list. }} +").NormalizeNewLines(), + + Does.StartWith(@" +There are 5 odd numbers in the list.".NormalizeNewLines())); + } + + [Test] + public void Linq76() + { + Assert.That(context.EvaluateScript(@" +{{ customers + |> let({ customerId: 'it.CustomerId', ordersCount: 'count(it.Orders)' }) + |> select: {customerId}, {ordersCount}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +ALFKI, 6 +ANATR, 4 +ANTON, 7 +AROUT, 13 +BERGS, 18 +BLAUS, 7 +BLONP, 11 +".NormalizeNewLines())); + } + + [Test] + public void Linq77() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> let({ category: 'it.Key', productCount: 'count(it)' }) + |> select: {category}, {productCount}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages, 12 +Condiments, 12 +Produce, 5 +Meat/Poultry, 6 +Seafood, 12 +Dairy Products, 10 +Confections, 13 +Grains/Cereals, 7 +".NormalizeNewLines())); + } + + [Test] + public void Linq78() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers |> sum |> select: The sum of the numbers is {it}. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The sum of the numbers is 45.".NormalizeNewLines())); + } + + [Test] + public void Linq79() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry'] |> to => words }} +{{ words + |> sum => it.Length + |> select: There are a total of {it} characters in these words. }} +").NormalizeNewLines(), + + Does.StartWith(@" +There are a total of 20 characters in these words.".NormalizeNewLines())); + } + + [Test] + public void Linq80() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> let({ category: 'it.Key', totalUnitsInStock: 'sum(it, `it.UnitsInStock`)' }) + |> select: {category}, {totalUnitsInStock}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages, 559 +Condiments, 507 +Produce, 100 +Meat/Poultry, 165 +Seafood, 701 +Dairy Products, 393 +Confections, 386 +Grains/Cereals, 308 +".NormalizeNewLines())); + } + + [Test] + public void Linq81() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers |> min |> select: The minimum number is {it}. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The minimum number is 0.".NormalizeNewLines())); + } + + [Test] + public void Linq82() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> to => words }} +{{ words + |> min => it.Length + |> select: The shortest word is {it} characters long. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The shortest word is 5 characters long.".NormalizeNewLines())); + } + + [Test] + public void Linq83() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> let({ category: 'it.Key', cheapestPrice: 'min(it, `it.UnitPrice`)' }) + |> select: {category}, {cheapestPrice}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages, 4.5 +Condiments, 10 +Produce, 10 +Meat/Poultry, 7.45 +Seafood, 6 +Dairy Products, 2.5 +Confections, 9.2 +Grains/Cereals, 7 +".NormalizeNewLines())); + } + + [Test] + public void Linq84() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> let({ + g: 'it', + minPrice: 'min(g, `it.UnitPrice`)', + category: 'g.Key', + cheapestProducts: 'where(g, `it.UnitPrice == minPrice`)' + }) + |> select: { category }\n{ cheapestProducts |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages +[{ProductId:24,ProductName:Guaraná Fantástica,Category:Beverages,UnitPrice:4.5,UnitsInStock:20}] +Condiments +[{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13}] +Produce +[{ProductId:74,ProductName:Longlife Tofu,Category:Produce,UnitPrice:10,UnitsInStock:4}] +Meat/Poultry +[{ProductId:54,ProductName:Tourtière,Category:Meat/Poultry,UnitPrice:7.45,UnitsInStock:21}] +Seafood +[{ProductId:13,ProductName:Konbu,Category:Seafood,UnitPrice:6,UnitsInStock:24}] +Dairy Products +[{ProductId:33,ProductName:Geitost,Category:Dairy Products,UnitPrice:2.5,UnitsInStock:112}] +Confections +[{ProductId:19,ProductName:Teatime Chocolate Biscuits,Category:Confections,UnitPrice:9.2,UnitsInStock:25}] +Grains/Cereals +[{ProductId:52,ProductName:Filo Mix,Category:Grains/Cereals,UnitPrice:7,UnitsInStock:38}] +".NormalizeNewLines())); + } + + [Test] + public void Linq85() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers |> max |> select: The maximum number is {it}. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The maximum number is 9.".NormalizeNewLines())); + } + + [Test] + public void Linq86() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> to => words }} +{{ words + |> max => it.Length + |> select: The longest word is {it} characters long. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The longest word is 9 characters long.".NormalizeNewLines())); + } + + [Test] + public void Linq87() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> let({ category: 'it.Key', mostExpensivePrice: 'max(it, `it.UnitPrice`)' }) + |> select: Category: {category}, MaximumPrice: {mostExpensivePrice}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Category: Beverages, MaximumPrice: 263.5 +Category: Condiments, MaximumPrice: 43.9 +Category: Produce, MaximumPrice: 53 +Category: Meat/Poultry, MaximumPrice: 123.79 +Category: Seafood, MaximumPrice: 62.5 +Category: Dairy Products, MaximumPrice: 55 +Category: Confections, MaximumPrice: 81 +Category: Grains/Cereals, MaximumPrice: 38 +".NormalizeNewLines())); + } + + [Test] + public void Linq88() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> let({ + g: 'it', + maxPrice: 'max(g, `it.UnitPrice`)', + category: 'g.Key', + mostExpensiveProducts: 'where(g, `it.UnitPrice == maxPrice`)' + }) + |> select: { category }\n{ mostExpensiveProducts |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages +[{ProductId:38,ProductName:Côte de Blaye,Category:Beverages,UnitPrice:263.5,UnitsInStock:17}] +Condiments +[{ProductId:63,ProductName:Vegie-spread,Category:Condiments,UnitPrice:43.9,UnitsInStock:24}] +Produce +[{ProductId:51,ProductName:Manjimup Dried Apples,Category:Produce,UnitPrice:53,UnitsInStock:20}] +Meat/Poultry +[{ProductId:29,ProductName:Thüringer Rostbratwurst,Category:Meat/Poultry,UnitPrice:123.79,UnitsInStock:0}] +Seafood +[{ProductId:18,ProductName:Carnarvon Tigers,Category:Seafood,UnitPrice:62.5,UnitsInStock:42}] +Dairy Products +[{ProductId:59,ProductName:Raclette Courdavault,Category:Dairy Products,UnitPrice:55,UnitsInStock:79}] +Confections +[{ProductId:20,ProductName:Sir Rodney's Marmalade,Category:Confections,UnitPrice:81,UnitsInStock:40}] +Grains/Cereals +[{ProductId:56,ProductName:Gnocchi di nonna Alice,Category:Grains/Cereals,UnitPrice:38,UnitsInStock:21}] +".NormalizeNewLines())); + } + + [Test] + public void Linq89() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers |> average |> select: The average number is {it}. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The average number is 4.5.".NormalizeNewLines())); + } + + [Test] + public void Linq90() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> to => words }} +{{ words + |> average => it.Length + |> select: The average word length is {it} characters. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The average word length is 6.66666666666667 characters.".NormalizeNewLines())); + } + + [Test] + public void Linq91() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy => it.Category + |> let({ category: 'it.Key', averagePrice: 'average(it, `it.UnitPrice`)' }) + |> select: Category: {category}, AveragePrice: {averagePrice}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Category: Beverages, AveragePrice: 37.9791666666667 +Category: Condiments, AveragePrice: 23.0625 +Category: Produce, AveragePrice: 32.37 +Category: Meat/Poultry, AveragePrice: 54.0066666666667 +Category: Seafood, AveragePrice: 20.6825 +Category: Dairy Products, AveragePrice: 28.73 +Category: Confections, AveragePrice: 25.16 +Category: Grains/Cereals, AveragePrice: 20.25 +".NormalizeNewLines())); + } + + [Test] + public void Linq92() + { + Assert.That(context.EvaluateScript(@" +{{ [1.7, 2.3, 1.9, 4.1, 2.9] |> to => doubles }} +{{ doubles + |> reduce((accumulator,it) => accumulator * it,1) + |> select: Total product of all numbers: { it |> format('#.####') }. }} +").NormalizeNewLines(), + + Does.StartWith(@" +Total product of all numbers: 88.3308".NormalizeNewLines())); + } + + [Test] + public void Linq93() + { + Assert.That(context.EvaluateScript(@" +{{ [20, 10, 40, 50, 10, 70, 30] |> to => attemptedWithdrawals }} +{{ attemptedWithdrawals + |> reduce((balance, nextWithdrawal) => ((nextWithdrawal <= balance) ? (balance - nextWithdrawal) : balance), + { initialValue: 100.0, }) + |> select: Ending balance: { it }. }} +").NormalizeNewLines(), + + Does.StartWith(@" +Ending balance: 20".NormalizeNewLines())); + } + + [Test] + public void Linq94() + { + Assert.That(context.EvaluateScript(@" +{{ [0, 2, 4, 5, 6, 8, 9] |> to => numbersA }} +{{ [1, 3, 5, 7, 8] |> to => numbersB }} +All numbers from both arrays: +{{ numbersA |> concat(numbersB) |> select: {it}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +All numbers from both arrays: +0 +2 +4 +5 +6 +8 +9 +1 +3 +5 +7 +8 +".NormalizeNewLines())); + } + + [Test] + public void Linq95() + { + Assert.That(context.EvaluateScript(@" +{{ customers |> map('it.CompanyName') |> to => customerNames }} +{{ products |> map('it.ProductName') |> to => productNames }} +Customer and product names: +{{ customerNames |> concat(productNames) |> select: { it |> raw }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Customer and product names: +Alfreds Futterkiste +Ana Trujillo Emparedados y helados +Antonio Moreno Taquería +Around the Horn +Berglunds snabbköp +Blauer See Delikatessen +".NormalizeNewLines())); + } + + [Test] + public void Linq96() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> to => wordsA }} +{{ [ 'cherry', 'apple', 'blueberry' ] |> to => wordsB }} +{{ wordsA |> equivalentTo(wordsB) |> select: The sequences match: { it |> lower } }} +").NormalizeNewLines(), + + Does.StartWith(@" +The sequences match: true".NormalizeNewLines())); + } + + [Test] + public void linq97() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> to => wordsA }} +{{ [ 'apple', 'blueberry', 'cherry' ] |> to => wordsB }} +{{ wordsA |> equivalentTo(wordsB) |> select: The sequences match: { it |> lower } }} +").NormalizeNewLines(), + + Does.StartWith(@" +The sequences match: false".NormalizeNewLines())); + } + + [Test] + public void Linq99() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ 0 |> to => i }} +{{ numbers |> let({ i: 'incr(i)' }) |> select: v = {index |> incr}, i = {i}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +v = 1, i = 1 +v = 2, i = 2 +v = 3, i = 3 +v = 4, i = 4 +v = 5, i = 5 +v = 6, i = 6 +v = 7, i = 7 +v = 8, i = 8 +v = 9, i = 9 +v = 10, i = 10 +".NormalizeNewLines())); + } + + [Test] + public void Linq100() + { + // lowNumbers is assigned the result not a reusable query + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers + |> where: it <= 3 + |> to => lowNumbers }} +First run numbers <= 3: +{{ lowNumbers |> select: {it}\n }} +{{ 10 |> times |> do: assign('numbers[index]', -numbers[index]) }} +Second run numbers <= 3: +{{ lowNumbers |> select: {it}\n }} +Contents of numbers: +{{ numbers |> select: {it}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +First run numbers <= 3: +1 +3 +2 +0 + +Second run numbers <= 3: +1 +3 +2 +0 + +Contents of numbers: +-5 +-4 +-1 +-3 +-9 +-8 +-6 +-7 +-2 +0 +".NormalizeNewLines())); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryLinqTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryLinqTests.cs new file mode 100644 index 00000000000..3d61bffcef8 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryLinqTests.cs @@ -0,0 +1,2110 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class AnagramEqualityComparer : IEqualityComparer<string>, IEqualityComparer<object> + { + public bool Equals(string x, string y) => GetCanonicalString(x) == GetCanonicalString(y); + public int GetHashCode(string obj) => GetCanonicalString(obj).GetHashCode(); + private string GetCanonicalString(string word) + { + var wordChars = word.ToCharArray(); + Array.Sort(wordChars); + return new string(wordChars); + } + + public bool Equals(object x, object y) => Equals((string) x, (string) y); + + public int GetHashCode(object obj) => GetHashCode((string)obj); + } + + public class QueryFilterTests + { + private static ScriptContext CreateContext() + { + var context = new ScriptContext + { + Args = + { + [ScriptConstants.DefaultDateFormat] = "yyyy/MM/dd", + ["products"] = QueryData.Products, + ["customers"] = QueryData.Customers, + ["comparer"] = new CaseInsensitiveComparer(), + ["anagramComparer"] = new AnagramEqualityComparer(), + } + }; + return context.Init(); + } + + [SetUp] + public void Setup() => context = CreateContext(); + private ScriptContext context; + + [Test] + public void Linq01() // alternative with clean whitespace sensitive string argument syntax: + { + Assert.That(context.EvaluateScript(@" +Numbers < 5: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers + |> where: it < 5 + |> select: { it }\n +}}").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers < 5: +4 +1 +3 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq02() // alternative with clean whitespace sensitive string argument syntax: + { + Assert.That(context.EvaluateScript(@" +Sold out products: +{{ products + |> where: it.UnitsInStock == 0 + |> select: { it.productName |> raw } is sold out!\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Sold out products: +Chef Anton's Gumbo Mix is sold out! +Alice Mutton is sold out! +Thüringer Rostbratwurst is sold out! +Gorgonzola Telino is sold out! +Perth Pasties is sold out! +".NormalizeNewLines())); + } + + [Test] + public void Linq03() + { + Assert.That(context.EvaluateScript(@" +In-stock products that cost more than 3.00: +{{ products + |> where: it.UnitsInStock > 0 and it.UnitPrice > 3 + |> select: { it.productName |> raw } is in stock and costs more than 3.00.\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +In-stock products that cost more than 3.00: +Chai is in stock and costs more than 3.00. +Chang is in stock and costs more than 3.00. +Aniseed Syrup is in stock and costs more than 3.00. +".NormalizeNewLines())); + } + + [Test] + public void Linq04() + { + context.VirtualFiles.WriteFile("customer.html", @" +Customer {{ it.CustomerId }} {{ it.CompanyName |> raw }} +{{ it.Orders |> selectPartial: order }}"); + + context.VirtualFiles.WriteFile("order.html", " Order {{ it.OrderId }}: {{ it.OrderDate |> dateFormat }}\n"); + + Assert.That(context.EvaluateScript(@" +{{ customers + |> where: it.Region == 'WA' + |> assignTo: waCustomers +}} +Customers from Washington and their orders: +{{ waCustomers |> selectPartial: customer }} +").NormalizeNewLines(), + + Does.StartWith(@" +Customers from Washington and their orders: + +Customer LAZYK Lazy K Kountry Store + Order 10482: 1997/03/21 + Order 10545: 1997/05/22 + +Customer TRAIH Trail's Head Gourmet Provisioners + Order 10574: 1997/06/19 + Order 10577: 1997/06/23 + Order 10822: 1998/01/08 +".NormalizeNewLines())); + } + + [Test] + public void Linq05() + { + Assert.That(context.EvaluateScript(@" +Short digits: +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> assignTo: digits }} +{{ digits + |> where: it.Length < index + |> select: The word {it} is shorter than its value.\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Short digits: +The word five is shorter than its value. +The word six is shorter than its value. +The word seven is shorter than its value. +The word eight is shorter than its value. +The word nine is shorter than its value. +".NormalizeNewLines())); + } + + [Test] + public void Linq06() + { + Assert.That(context.EvaluateScript(@" +Numbers + 1: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers |> select: { it |> incr }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Numbers + 1: +6 +5 +2 +4 +10 +9 +7 +8 +3 +1 +".NormalizeNewLines())); + } + + [Test] + public void Linq07() + { + Assert.That(context.EvaluateScript(@" +Product Names: +{{ products |> select: { it.ProductName |> raw }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Product Names: +Chai +Chang +Aniseed Syrup +Chef Anton's Cajun Seasoning +Chef Anton's Gumbo Mix +".NormalizeNewLines())); + } + + [Test] + public void Linq08() + { + Assert.That(context.EvaluateScript(@" +Number strings: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> assignTo: strings }} +{{ numbers |> select: { strings[it] }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Number strings: +five +four +one +three +nine +eight +six +seven +two +zero +".NormalizeNewLines())); + } + + [Test] + public void Linq09() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'BlUeBeRrY', 'cHeRry'] |> assignTo: words }} +{{ words |> select: Uppercase: { it |> upper }, Lowercase: { it |> lower }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Uppercase: APPLE, Lowercase: apple +Uppercase: BLUEBERRY, Lowercase: blueberry +Uppercase: CHERRY, Lowercase: cherry +".NormalizeNewLines())); + } + + [Test] + public void Linq10() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> assignTo: strings }} +{{ numbers |> select: The digit { strings[it] } is { it.isEven() ? 'even' : 'odd' }.\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +The digit five is odd. +The digit four is even. +The digit one is odd. +The digit three is odd. +The digit nine is odd. +The digit eight is even. +The digit six is even. +The digit seven is odd. +The digit two is even. +The digit zero is even. +".NormalizeNewLines())); + } + + [Test] + public void Linq11() + { + Assert.That(context.EvaluateScript(@" +Product Info: +{{ products |> select: { it.ProductName |> raw } is in the category { it.Category } and costs { it.UnitPrice |> currency } per unit.\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Product Info: +Chai is in the category Beverages and costs $18.00 per unit. +Chang is in the category Beverages and costs $19.00 per unit. +Aniseed Syrup is in the category Condiments and costs $10.00 per unit. +".NormalizeNewLines())); + } + + [Test] + public void Linq12() + { + Assert.That(context.EvaluateScript(@" +Number: In-place? +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers |> select: { it }: { it |> equals(index) |> lower }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Number: In-place? +5: false +4: false +1: false +3: true +9: false +8: false +6: true +7: true +2: false +0: false +".NormalizeNewLines())); + } + + [Test] + public void Linq13() + { + Assert.That(context.EvaluateScript(@" +Numbers < 5: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> assignTo: digits }} +{{ numbers + |> where: it < 5 + |> select: { digits[it] }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +Numbers < 5: +four +one +three +two +zero +".NormalizeNewLines())); + } + + [Test] + public void Linq14() + { + Assert.That(context.EvaluateScript(@" +{{ [0, 2, 4, 5, 6, 8, 9] |> assignTo: numbersA }} +{{ [1, 3, 5, 7, 8] |> assignTo: numbersB }} +Pairs where a < b: +{{ numbersA |> zip(numbersB) + |> let({ a: 'it[0]', b: 'it[1]' }) + |> where: a < b + |> select: { a } is less than { b }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +Pairs where a < b: +0 is less than 1 +0 is less than 3 +0 is less than 5 +0 is less than 7 +0 is less than 8 +2 is less than 3 +2 is less than 5 +2 is less than 7 +2 is less than 8 +4 is less than 5 +4 is less than 7 +4 is less than 8 +5 is less than 7 +5 is less than 8 +6 is less than 7 +6 is less than 8 +".NormalizeNewLines())); + } + + [Test] + public void Linq15() + { + Assert.That(context.EvaluateScript(@" +{{ customers |> zip => it.Orders + |> let => { c: it[0], o: it[1] } + |> where => o.Total < 500 + |> select: ({ c.CustomerId }, { o.OrderId }, { o.Total |> format('0.0#') })\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +(ALFKI, 10702, 330.0) +(ALFKI, 10952, 471.2) +(ANATR, 10308, 88.8) +(ANATR, 10625, 479.75) +".NormalizeNewLines())); + } + + [Test] + public void Linq15_literal() + { + Assert.That(context.EvaluateScript(@" +{{ customers |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where: o.Total < 500 + |> select: ({ c.CustomerId }, { o.OrderId }, { o.Total |> format('0.0#') })\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +(ALFKI, 10702, 330.0) +(ALFKI, 10952, 471.2) +(ANATR, 10308, 88.8) +(ANATR, 10625, 479.75) +".NormalizeNewLines())); + } + + [Test] + public void Linq16() + { + Assert.That(context.EvaluateScript(@" +{{ customers |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where: o.OrderDate >= '1998-01-01' + |> select: ({ c.CustomerId }, { o.OrderId }, { o.OrderDate })\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +(ALFKI, 10835, 1/15/1998 12:00:00 AM) +(ALFKI, 10952, 3/16/1998 12:00:00 AM) +(ALFKI, 11011, 4/9/1998 12:00:00 AM) +(ANATR, 10926, 3/4/1998 12:00:00 AM) +(ANTON, 10856, 1/28/1998 12:00:00 AM) +".NormalizeNewLines())); + } + + [Test] + public void Linq17() + { + Assert.That(context.EvaluateScript(@" +{{ customers |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where: o.Total >= 2000 + |> select: ({ c.CustomerId }, { o.OrderId }, { o.Total |> format('0.0#') })\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +(ANTON, 10573, 2082.0) +(AROUT, 10558, 2142.9) +(AROUT, 10953, 4441.25) +(BERGS, 10384, 2222.4) +(BERGS, 10524, 3192.65) +".NormalizeNewLines())); + } + + [Test] + public void Linq18() + { + var template = @" +{{ '1997-01-01' |> assignTo: cutoffDate }} +{{ customers + |> where: it.Region == 'WA' + |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where: o.OrderDate >= cutoffDate + |> select: ({ c.CustomerId }, { o.OrderId })\n }} +"; + Assert.That(context.EvaluateScript(template.NormalizeNewLines()).NormalizeNewLines(), + + Does.StartWith(@" +(LAZYK, 10482) +(LAZYK, 10545) +(TRAIH, 10574) +(TRAIH, 10577) +(TRAIH, 10822) +(WHITC, 10469) +(WHITC, 10483) +(WHITC, 10504) +(WHITC, 10596) +(WHITC, 10693) +(WHITC, 10696) +(WHITC, 10723) +(WHITC, 10740) +(WHITC, 10861) +(WHITC, 10904) +(WHITC, 11032) +(WHITC, 11066) +".NormalizeNewLines())); + } + + [Test] + public void Linq19() + { + Assert.That(context.EvaluateScript(@" +{{ customers + |> let({ cust: 'it', custIndex: 'index' }) + |> zip: cust.Orders + |> let({ o: 'it[1]' }) + |> select: Customer #{ custIndex |> incr } has an order with OrderID { o.OrderId }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Customer #1 has an order with OrderID 10643 +Customer #1 has an order with OrderID 10692 +Customer #1 has an order with OrderID 10702 +Customer #1 has an order with OrderID 10835 +Customer #1 has an order with OrderID 10952 +Customer #1 has an order with OrderID 11011 +Customer #2 has an order with OrderID 10308 +Customer #2 has an order with OrderID 10625 +Customer #2 has an order with OrderID 10759 +Customer #2 has an order with OrderID 10926 +".NormalizeNewLines())); + } + + [Test] + public void Linq20() + { + Assert.That(context.EvaluateScript(@" +First 3 numbers: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers |> take(3) |> select: { it }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +First 3 numbers: +5 +4 +1 +".NormalizeNewLines())); + } + + [Test] + public void Linq21() + { + Assert.That(context.EvaluateScript(@" +First 3 orders in WA: +{{ customers |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where: c.Region == 'WA' + |> select: { [c.CustomerId, o.OrderId, o.OrderDate] |> jsv }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +First 3 orders in WA: +[LAZYK,10482,1997-03-21] +[LAZYK,10545,1997-05-22] +[TRAIH,10574,1997-06-19] +".NormalizeNewLines())); + } + + [Test] + public void Linq22() + { + Assert.That(context.EvaluateScript(@" +All but first 4 numbers: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers |> skip(4) |> select: { it }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +All but first 4 numbers: +9 +8 +6 +7 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq23() + { + Assert.That(context.EvaluateScript(@" +All but first 2 orders in WA: +{{ customers |> zip: it.Orders + |> let({ c: 'it[0]', o: 'it[1]' }) + |> where: c.Region == 'WA' + |> skip(2) + |> select: { [c.CustomerId, o.OrderId, o.OrderDate] |> jsv }\n +}} +").NormalizeNewLines(), + + Does.StartWith(@" +All but first 2 orders in WA: +[TRAIH,10574,1997-06-19] +[TRAIH,10577,1997-06-23] +[TRAIH,10822,1998-01-08] +[WHITC,10269,1996-07-31] +[WHITC,10344,1996-11-01] +[WHITC,10469,1997-03-10] +[WHITC,10483,1997-03-24] +[WHITC,10504,1997-04-11] +[WHITC,10596,1997-07-11] +[WHITC,10693,1997-10-06] +[WHITC,10696,1997-10-08] +[WHITC,10723,1997-10-30] +[WHITC,10740,1997-11-13] +[WHITC,10861,1998-01-30] +[WHITC,10904,1998-02-24] +[WHITC,11032,1998-04-17] +[WHITC,11066,1998-05-01] +".NormalizeNewLines())); + } + + [Test] + public void Linq24() + { + Assert.That(context.EvaluateScript(@" +First numbers less than 6: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> to => numbers }} +{{ numbers + |> takeWhile: it < 6 + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +First numbers less than 6: +5 +4 +1 +3 +".NormalizeNewLines())); + } + + [Test] + public void Linq25() + { + Assert.That(context.EvaluateScript(@" +First numbers not less than their position: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers + |> takeWhile: it >= index + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +First numbers not less than their position: +5 +4 +".NormalizeNewLines())); + } + + [Test] + public void Linq26() + { + Assert.That(context.EvaluateScript(@" +All elements starting from first element divisible by 3: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers + |> skipWhile: mod(it,3) != 0 + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +All elements starting from first element divisible by 3: +3 +9 +8 +6 +7 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq27() + { + Assert.That(context.EvaluateScript(@" +All elements starting from first element less than its position: +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers + |> skipWhile: it >= index + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +All elements starting from first element less than its position: +1 +3 +9 +8 +6 +7 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq28() + { + Assert.That(context.EvaluateScript(@" +The sorted list of words: +{{ ['cherry', 'apple', 'blueberry'] |> assignTo: words }} +{{ words + |> orderBy: it + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +The sorted list of words: +apple +blueberry +cherry +".NormalizeNewLines())); + } + + [Test] + public void Linq29() + { + Assert.That(context.EvaluateScript(@" +The sorted list of words (by length): +{{ ['cherry', 'apple', 'blueberry'] |> assignTo: words }} +{{ words + |> orderBy: it.Length + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +The sorted list of words (by length): +apple +cherry +blueberry +".NormalizeNewLines())); + } + + [Test] + public void Linq30() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> orderBy: it.ProductName + |> select: { it |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +{ProductId:17,ProductName:Alice Mutton,Category:Meat/Poultry,UnitPrice:39,UnitsInStock:0} +{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13} +{ProductId:40,ProductName:Boston Crab Meat,Category:Seafood,UnitPrice:18.4,UnitsInStock:123} +{ProductId:60,ProductName:Camembert Pierrot,Category:Dairy Products,UnitPrice:34,UnitsInStock:19} +{ProductId:18,ProductName:Carnarvon Tigers,Category:Seafood,UnitPrice:62.5,UnitsInStock:42} +".NormalizeNewLines())); + } + + [Test] + public void Linq31() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'AbAcUs', 'bRaNcH', 'BlUeBeRrY', 'ClOvEr', 'cHeRry'] |> assignTo: words }} +{{ words + |> orderBy('it', { comparer }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +AbAcUs +aPPLE +BlUeBeRrY +bRaNcH +cHeRry +ClOvEr +".NormalizeNewLines())); + } + + [Test] + public void Linq32() + { + Assert.That(context.EvaluateScript(@" +The doubles from highest to lowest: +{{ [1.7, 2.3, 1.9, 4.1, 2.9] |> assignTo: doubles }} +{{ doubles + |> orderByDescending: it + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +The doubles from highest to lowest: +4.1 +2.9 +2.3 +1.9 +1.7 +".NormalizeNewLines())); + } + + [Test] + public void Linq33() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> orderByDescending: it.UnitsInStock + |> select: { it |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +{ProductId:75,ProductName:Rhönbräu Klosterbier,Category:Beverages,UnitPrice:7.75,UnitsInStock:125} +{ProductId:40,ProductName:Boston Crab Meat,Category:Seafood,UnitPrice:18.4,UnitsInStock:123} +{ProductId:6,ProductName:Grandma's Boysenberry Spread,Category:Condiments,UnitPrice:25,UnitsInStock:120} +{ProductId:55,ProductName:Pâté chinois,Category:Meat/Poultry,UnitPrice:24,UnitsInStock:115} +{ProductId:61,ProductName:Sirop d'érable,Category:Condiments,UnitPrice:28.5,UnitsInStock:113} +".NormalizeNewLines())); + } + + [Test] + public void Linq34() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'AbAcUs', 'bRaNcH', 'BlUeBeRrY', 'ClOvEr', 'cHeRry'] |> assignTo: words }} +{{ words + |> orderByDescending('it', { comparer }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +ClOvEr +cHeRry +bRaNcH +BlUeBeRrY +aPPLE +AbAcUs +".NormalizeNewLines())); + } + + [Test] + public void Linq35() + { + Assert.That(context.EvaluateScript(@" +Sorted digits: +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> assignTo: digits }} +{{ digits + |> orderBy: it.length + |> thenBy: it + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Sorted digits: +one +six +two +five +four +nine +zero +eight +seven +three +".NormalizeNewLines())); + } + + [Test] + public void Linq36() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'AbAcUs', 'bRaNcH', 'BlUeBeRrY', 'ClOvEr', 'cHeRry'] |> assignTo: words }} +{{ words + |> orderBy: it.length + |> thenBy('it', { comparer }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +aPPLE +AbAcUs +bRaNcH +cHeRry +ClOvEr +BlUeBeRrY +".NormalizeNewLines())); + } + + [Test] + public void Linq37() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> orderBy: it.Category + |> thenByDescending: it.UnitPrice + |> select: { it |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +{ProductId:38,ProductName:Côte de Blaye,Category:Beverages,UnitPrice:263.5,UnitsInStock:17} +{ProductId:43,ProductName:Ipoh Coffee,Category:Beverages,UnitPrice:46,UnitsInStock:17} +{ProductId:2,ProductName:Chang,Category:Beverages,UnitPrice:19,UnitsInStock:17} +{ProductId:1,ProductName:Chai,Category:Beverages,UnitPrice:18,UnitsInStock:39} +{ProductId:35,ProductName:Steeleye Stout,Category:Beverages,UnitPrice:18,UnitsInStock:20} +{ProductId:39,ProductName:Chartreuse verte,Category:Beverages,UnitPrice:18,UnitsInStock:69} +{ProductId:76,ProductName:Lakkalikööri,Category:Beverages,UnitPrice:18,UnitsInStock:57} +{ProductId:70,ProductName:Outback Lager,Category:Beverages,UnitPrice:15,UnitsInStock:15} +{ProductId:34,ProductName:Sasquatch Ale,Category:Beverages,UnitPrice:14,UnitsInStock:111} +".NormalizeNewLines())); + } + + [Test] + public void Linq38() + { + Assert.That(context.EvaluateScript(@" +{{ ['aPPLE', 'AbAcUs', 'bRaNcH', 'BlUeBeRrY', 'ClOvEr', 'cHeRry'] |> assignTo: words }} +{{ words + |> orderBy: it.length + |> thenByDescending('it', { comparer }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +aPPLE +ClOvEr +cHeRry +bRaNcH +AbAcUs +BlUeBeRrY +".NormalizeNewLines())); + } + + [Test] + public void Linq39() + { + Assert.That(context.EvaluateScript(@" +A backwards list of the digits with a second character of 'i': +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> assignTo: digits }} +{{ digits + |> where: it[1] == 'i' + |> reverse + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +A backwards list of the digits with a second character of 'i': +nine +eight +six +five +".NormalizeNewLines())); + } + + [Test] + public void Linq40() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers + |> groupBy: mod(it,5) + |> let({ remainder: 'it.Key', numbers: 'it' }) + |> select: Numbers with a remainder of { remainder } when divided by 5:\n{ numbers |> select('{it}\n') } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers with a remainder of 0 when divided by 5: +5 +0 +Numbers with a remainder of 4 when divided by 5: +4 +9 +Numbers with a remainder of 1 when divided by 5: +1 +6 +Numbers with a remainder of 3 when divided by 5: +3 +8 +Numbers with a remainder of 2 when divided by 5: +7 +2 +".NormalizeNewLines())); + } + + [Test] + public void Linq41() + { + Assert.That(context.EvaluateScript(@" +{{ ['blueberry', 'chimpanzee', 'abacus', 'banana', 'apple', 'cheese'] |> assignTo: words }} +{{ words + |> groupBy: it[0] + |> let({ firstLetter: 'it.Key', words: 'it' }) + |> select: Words that start with the letter '{firstLetter}':\n{ words |> select('{it}\n') } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Words that start with the letter 'b': +blueberry +banana +Words that start with the letter 'c': +chimpanzee +cheese +Words that start with the letter 'a': +abacus +apple +".NormalizeNewLines())); + } + + [Test] + public void Linq42() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> let({ category: 'it.Key', products: 'it' }) + |> select: {category}:\n{ products |> select('{it |> jsv}\n') } }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages: +{ProductId:1,ProductName:Chai,Category:Beverages,UnitPrice:18,UnitsInStock:39} +{ProductId:2,ProductName:Chang,Category:Beverages,UnitPrice:19,UnitsInStock:17} +{ProductId:24,ProductName:Guaraná Fantástica,Category:Beverages,UnitPrice:4.5,UnitsInStock:20} +{ProductId:34,ProductName:Sasquatch Ale,Category:Beverages,UnitPrice:14,UnitsInStock:111} +{ProductId:35,ProductName:Steeleye Stout,Category:Beverages,UnitPrice:18,UnitsInStock:20} +{ProductId:38,ProductName:Côte de Blaye,Category:Beverages,UnitPrice:263.5,UnitsInStock:17} +{ProductId:39,ProductName:Chartreuse verte,Category:Beverages,UnitPrice:18,UnitsInStock:69} +{ProductId:43,ProductName:Ipoh Coffee,Category:Beverages,UnitPrice:46,UnitsInStock:17} +{ProductId:67,ProductName:Laughing Lumberjack Lager,Category:Beverages,UnitPrice:14,UnitsInStock:52} +{ProductId:70,ProductName:Outback Lager,Category:Beverages,UnitPrice:15,UnitsInStock:15} +{ProductId:75,ProductName:Rhönbräu Klosterbier,Category:Beverages,UnitPrice:7.75,UnitsInStock:125} +{ProductId:76,ProductName:Lakkalikööri,Category:Beverages,UnitPrice:18,UnitsInStock:57} +Condiments: +{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13} +{ProductId:4,ProductName:Chef Anton's Cajun Seasoning,Category:Condiments,UnitPrice:22,UnitsInStock:53} +".NormalizeNewLines())); + } + + [Test] + public void Linq43() + { + context.VirtualFiles.WriteFile("month-orders.html", @" +{{ year }} +{{ monthGroups |> scopeVars |> select: { indent }{ month }\n{ 2 |> indents }{ orders |> jsv }\n }}"); + + Assert.That(context.EvaluateScript(@" +{{ customers + |> let({ + companyName: 'it.CompanyName', + yearGroups: ""map ( + groupBy(it.Orders, 'it.OrderDate.Year'), + '{ + year: it.Key, + monthGroups: map ( + groupBy(it, `it.OrderDate.Month`), + `{ month: it.Key, orders: it }` + ) + }' + )"" + }) + |> select: \n# { companyName |> raw }{ yearGroups |> scopeVars |> selectPartial('month-orders') } +}} +").NormalizeNewLines(), + + Does.StartWith(@" +# Alfreds Futterkiste +1997 + 8 + [{OrderId:10643,OrderDate:1997-08-25,Total:814.5}] + 10 + [{OrderId:10692,OrderDate:1997-10-03,Total:878},{OrderId:10702,OrderDate:1997-10-13,Total:330}] + +1998 + 1 + [{OrderId:10835,OrderDate:1998-01-15,Total:845.8}] + 3 + [{OrderId:10952,OrderDate:1998-03-16,Total:471.2}] + 4 + [{OrderId:11011,OrderDate:1998-04-09,Total:933.5}] + +# Ana Trujillo Emparedados y helados +1996 + 9 + [{OrderId:10308,OrderDate:1996-09-18,Total:88.8}] +".NormalizeNewLines())); + } + + [Test] + public void Linq43_alt() + { + context.VirtualFiles.WriteFile("month-orders.html", @" +{{ year }} +{{ monthGroups |> scopeVars |> select: { indent }{ month }\n{ 2 |> indents }{ orders |> jsv }\n }}"); + + Assert.That(context.EvaluateScript(@" +{{ customers + |> map => { + companyName: it.CompanyName, + yearGroups: map ( + groupBy(it.Orders, it => it.OrderDate.Year), + yg => { + year: yg.Key, + monthGroups: map ( + groupBy(yg, o => o.OrderDate.Month), + mg => { month: mg.Key, orders: mg } + ) + } + ) + } + |> select: \n# { it.companyName |> raw }{ it.yearGroups |> scopeVars |> selectPartial('month-orders') } +}} +").NormalizeNewLines(), + + Does.StartWith(@" +# Alfreds Futterkiste +1997 + 8 + [{OrderId:10643,OrderDate:1997-08-25,Total:814.5}] + 10 + [{OrderId:10692,OrderDate:1997-10-03,Total:878},{OrderId:10702,OrderDate:1997-10-13,Total:330}] + +1998 + 1 + [{OrderId:10835,OrderDate:1998-01-15,Total:845.8}] + 3 + [{OrderId:10952,OrderDate:1998-03-16,Total:471.2}] + 4 + [{OrderId:11011,OrderDate:1998-04-09,Total:933.5}] + +# Ana Trujillo Emparedados y helados +1996 + 9 + [{OrderId:10308,OrderDate:1996-09-18,Total:88.8}] +".NormalizeNewLines())); + } + + [Test] + public void Linq44() + { + Assert.That(context.EvaluateScript(@" +{{ ['from ', ' salt', ' earn ', ' last ', ' near ', ' form '] |> assignTo: anagrams }} +{{ anagrams + |> groupBy('trim(it)', { comparer: anagramComparer }) + |> select: { it |> json }\n +}} +").NormalizeNewLines(), + + Is.EqualTo(@" +[""from "","" form ""] +["" salt"","" last ""] +["" earn "","" near ""] +".NormalizeNewLines())); + } + + [Test] + public void Linq45() + { + Assert.That(context.EvaluateScript(@" +{{ ['from ', ' salt', ' earn ', ' last ', ' near ', ' form '] |> assignTo: anagrams }} +{{ anagrams + |> groupBy('trim(it)', { map: 'upper(it)', comparer: anagramComparer }) + |> select: { it |> json }\n +}} +").NormalizeNewLines(), + + Is.EqualTo(@" +[""FROM "","" FORM ""] +["" SALT"","" LAST ""] +["" EARN "","" NEAR ""] +".NormalizeNewLines())); + } + + [Test] + public void Linq46() + { + Assert.That(context.EvaluateScript(@" +Prime factors of 300: +{{ [2, 2, 3, 5, 5] |> assignTo: factorsOf300 }} +{{ factorsOf300 |> distinct |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Prime factors of 300: +2 +3 +5 +".NormalizeNewLines())); + } + + [Test] + public void Linq47() + { + Assert.That(context.EvaluateScript(@" +Category names: +{{ products + |> map: it.Category + |> distinct + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Category names: +Beverages +Condiments +Produce +Meat/Poultry +Seafood +Dairy Products +Confections +Grains/Cereals +".NormalizeNewLines())); + } + + [Test] + public void Linq48() + { + Assert.That(context.EvaluateScript(@" +{{ [ 0, 2, 4, 5, 6, 8, 9 ] |> assignTo: numbersA }} +{{ [ 1, 3, 5, 7, 8 ] |> assignTo: numbersB }} +Unique numbers from both arrays: +{{ numbersA |> union(numbersB) |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Unique numbers from both arrays: +0 +2 +4 +5 +6 +8 +9 +1 +3 +7 +".NormalizeNewLines())); + } + + [Test] + public void Linq49() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> map: it.ProductName[0] + |> assignTo: productFirstChars }} +{{ customers + |> map: it.CompanyName[0] + |> assignTo: customerFirstChars }} +Unique first letters from Product names and Customer names: +{{ productFirstChars + |> union(customerFirstChars) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Unique first letters from Product names and Customer names: +C +A +G +U +N +M +I +Q +K +T +P +S +R +B +J +Z +V +F +E +W +L +O +D +H +".NormalizeNewLines())); + } + + [Test] + public void Linq50() + { + Assert.That(context.EvaluateScript(@" +{{ [ 0, 2, 4, 5, 6, 8, 9 ] |> assignTo: numbersA }} +{{ [ 1, 3, 5, 7, 8 ] |> assignTo: numbersB }} +Common numbers shared by both arrays: +{{ numbersA |> intersect(numbersB) |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Common numbers shared by both arrays: +5 +8 +".NormalizeNewLines())); + } + + [Test] + public void Linq51() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> map: it.ProductName[0] + |> assignTo: productFirstChars }} +{{ customers + |> map: it.CompanyName[0] + |> assignTo: customerFirstChars }} +Common first letters from Product names and Customer names: +{{ productFirstChars + |> intersect(customerFirstChars) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Common first letters from Product names and Customer names: +C +A +G +N +M +I +Q +K +T +P +S +R +B +V +F +E +W +L +O +".NormalizeNewLines())); + } + + [Test] + public void Linq52() + { + Assert.That(context.EvaluateScript(@" +{{ [ 0, 2, 4, 5, 6, 8, 9 ] |> assignTo: numbersA }} +{{ [ 1, 3, 5, 7, 8 ] |> assignTo: numbersB }} +Numbers in first array but not second array: +{{ numbersA |> except(numbersB) |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers in first array but not second array: +0 +2 +4 +6 +9 +".NormalizeNewLines())); + } + + [Test] + public void Linq53() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> map: it.ProductName[0] + |> assignTo: productFirstChars }} +{{ customers + |> map: it.CompanyName[0] + |> assignTo: customerFirstChars }} +First letters from Product names, but not from Customer names: +{{ productFirstChars + |> except(customerFirstChars) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +First letters from Product names, but not from Customer names: +U +J +Z +".NormalizeNewLines())); + } + + [Test] + public void Linq54() + { + Assert.That(context.EvaluateScript(@" +{{ [ 1.7, 2.3, 1.9, 4.1, 2.9 ] |> assignTo: doubles }} +Every other double from highest to lowest: +{{ doubles + |> orderByDescending: it + |> step({ by: 2 }) + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Every other double from highest to lowest: +4.1 +2.3 +1.7 +".NormalizeNewLines())); + } + + [Test] + public void Linq55() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> assignTo: words }} +The sorted word list: +{{ words + |> orderBy: it + |> toList + |> select: { it }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +The sorted word list: +apple +blueberry +cherry +".NormalizeNewLines())); + } + + [Test] + public void Linq56() + { + Assert.That(context.EvaluateScript(@" +{{ [{name:'Alice', score:50}, {name: 'Bob', score:40}, {name:'Cathy', score:45}] |> assignTo: scoreRecords }} +Bob's score: +{{ scoreRecords + |> toDictionary: it.name + |> get: Bob + |> select: { it['name'] } = { it['score'] } +}} +").NormalizeNewLines(), + + Is.EqualTo(@" +Bob's score: +Bob = 40 +".NormalizeNewLines())); + } + + [Test] + public void Linq57() + { + Assert.That(context.EvaluateScript(@" +{{ [null, 1.0, 'two', 3, 'four', 5, 'six', 7.0] |> assignTo: numbers }} +Numbers stored as doubles: +{{ numbers + |> of({ type: 'Double' }) + |> select: { it |> format('#.0') }\n }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Numbers stored as doubles: +1.0 +7.0 +".NormalizeNewLines())); + } + + [Test] + public void Linq58() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> where: it.ProductId == 12 + |> first + |> select: { it |> jsv } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +{ProductId:12,ProductName:Queso Manchego La Pastora,Category:Dairy Products,UnitPrice:38,UnitsInStock:86} +".NormalizeNewLines())); + } + + [Test] + public void Linq59() + { + Assert.That(context.EvaluateScript(@" +{{ ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] |> assignTo: strings }} +{{ strings + |> first: it[0] == 'o' + |> select: A string starting with 'o': { it } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +A string starting with 'o': one +".NormalizeNewLines())); + } + + [Test] + public void Linq61() + { + Assert.That(context.EvaluateScript(@" +{{ [] |> assignTo: numbers }} +{{ numbers |> first |> otherwise('null') }} +").NormalizeNewLines(), + + Is.EqualTo(@" +null +".NormalizeNewLines())); + } + + [Test] + public void Linq62() + { + Assert.That(context.EvaluateScript(@" +Product 789 exists: {{ products + |> first: it.ProductId == 789 + |> isNotNull }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Product 789 exists: False +".NormalizeNewLines())); + } + + [Test] + public void Linq64() + { + Assert.That(context.EvaluateScript(@" +{{ [ 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 ] |> assignTo: numbers }} +{{ numbers + |> where: it > 5 + |> elementAt(1) + |> select: Second number > 5: { it } }} +").NormalizeNewLines(), + + Is.EqualTo(@" +Second number > 5: 8 +".NormalizeNewLines())); + } + + [Test] + public void Linq65() + { + Assert.That(context.EvaluateScript(@" +{{ range(100,50) + |> select: The number {it} is { it.isEven() ? 'even' : 'odd' }.\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +The number 100 is even. +The number 101 is odd. +The number 102 is even. +The number 103 is odd. +The number 104 is even. +The number 105 is odd. +The number 106 is even. +The number 107 is odd. +The number 108 is even. +The number 109 is odd. +The number 110 is even. +".NormalizeNewLines())); + } + + [Test] + public void Linq66() + { + Assert.That(context.EvaluateScript(@" +{{ 10 |> itemsOf(7) |> select: {it}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +7 +7 +7 +7 +7 +7 +7 +7 +7 +7 +".NormalizeNewLines())); + } + + [Test] + public void Linq67() + { + Assert.That(context.EvaluateScript(@" +{{ ['believe', 'relief', 'receipt', 'field'] |> assignTo: words }} +{{ words + |> any: contains(it, 'ei') + |> select: There is a word that contains in the list that contains 'ei': { it |> lower } }} +").NormalizeNewLines(), + + Does.StartWith(@" +There is a word that contains in the list that contains 'ei': true".NormalizeNewLines())); + } + + [Test] + public void Linq69() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> where: any(it, 'it.UnitsInStock == 0') + |> let({ category: 'it.Key', products: 'it' }) + |> select: { category }\n{ products |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Condiments +[{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13},{ProductId:4,ProductName:Chef Anton's Cajun Seasoning,Category:Condiments,UnitPrice:22,UnitsInStock:53} +".NormalizeNewLines())); + } + + [Test] + public void Linq70() + { + Assert.That(context.EvaluateScript(@" +{{ [1, 11, 3, 19, 41, 65, 19] |> assignTo: numbers }} +{{ numbers + |> all: isOdd(it) + |> select: The list contains only odd numbers: { it |> lower } }} +").NormalizeNewLines(), + + Does.StartWith(@" +The list contains only odd numbers: true".NormalizeNewLines())); + } + + [Test] + public void Linq72() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> where: all(it, 'it.UnitsInStock > 0') + |> let({ category: 'it.Key', products: 'it' }) + |> select: { category }\n{ products |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages +[{ProductId:1,ProductName:Chai,Category:Beverages,UnitPrice:18,UnitsInStock:39},{ProductId:2,ProductName:Chang,Category:Beverages,UnitPrice:19,UnitsInStock:17} +".NormalizeNewLines())); + } + + [Test] + public void Linq73() + { + Assert.That(context.EvaluateScript(@" +{{ [2, 2, 3, 5, 5] |> assignTo: factorsOf300 }} +{{ factorsOf300 |> distinct |> count |> select: There are {it} unique factors of 300. }} +").NormalizeNewLines(), + + Does.StartWith(@" +There are 3 unique factors of 300.".NormalizeNewLines())); + } + + [Test] + public void Linq74() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers + |> count: isOdd(it) + |> select: There are {it} odd numbers in the list. }} +").NormalizeNewLines(), + + Does.StartWith(@" +There are 5 odd numbers in the list.".NormalizeNewLines())); + } + + [Test] + public void Linq76() + { + Assert.That(context.EvaluateScript(@" +{{ customers + |> let({ customerId: 'it.CustomerId', ordersCount: 'count(it.Orders)' }) + |> select: {customerId}, {ordersCount}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +ALFKI, 6 +ANATR, 4 +ANTON, 7 +AROUT, 13 +BERGS, 18 +BLAUS, 7 +BLONP, 11 +".NormalizeNewLines())); + } + + [Test] + public void Linq77() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> let({ category: 'it.Key', productCount: 'count(it)' }) + |> select: {category}, {productCount}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages, 12 +Condiments, 12 +Produce, 5 +Meat/Poultry, 6 +Seafood, 12 +Dairy Products, 10 +Confections, 13 +Grains/Cereals, 7 +".NormalizeNewLines())); + } + + [Test] + public void Linq78() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers |> sum |> select: The sum of the numbers is {it}. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The sum of the numbers is 45.".NormalizeNewLines())); + } + + [Test] + public void Linq79() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry'] |> assignTo: words }} +{{ words + |> sum: it.Length + |> select: There are a total of {it} characters in these words. }} +").NormalizeNewLines(), + + Does.StartWith(@" +There are a total of 20 characters in these words.".NormalizeNewLines())); + } + + [Test] + public void Linq80() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> let({ category: 'it.Key', totalUnitsInStock: 'sum(it, `it.UnitsInStock`)' }) + |> select: {category}, {totalUnitsInStock}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages, 559 +Condiments, 507 +Produce, 100 +Meat/Poultry, 165 +Seafood, 701 +Dairy Products, 393 +Confections, 386 +Grains/Cereals, 308 +".NormalizeNewLines())); + } + + [Test] + public void Linq81() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers |> min |> select: The minimum number is {it}. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The minimum number is 0.".NormalizeNewLines())); + } + + [Test] + public void Linq82() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> assignTo: words }} +{{ words + |> min: it.Length + |> select: The shortest word is {it} characters long. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The shortest word is 5 characters long.".NormalizeNewLines())); + } + + [Test] + public void Linq83() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> let({ category: 'it.Key', cheapestPrice: 'min(it, `it.UnitPrice`)' }) + |> select: {category}, {cheapestPrice}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages, 4.5 +Condiments, 10 +Produce, 10 +Meat/Poultry, 7.45 +Seafood, 6 +Dairy Products, 2.5 +Confections, 9.2 +Grains/Cereals, 7 +".NormalizeNewLines())); + } + + [Test] + public void Linq84() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> let({ + g: 'it', + minPrice: 'min(g, `it.UnitPrice`)', + category: 'g.Key', + cheapestProducts: 'where(g, `it.UnitPrice == minPrice`)' + }) + |> select: { category }\n{ cheapestProducts |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages +[{ProductId:24,ProductName:Guaraná Fantástica,Category:Beverages,UnitPrice:4.5,UnitsInStock:20}] +Condiments +[{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13}] +Produce +[{ProductId:74,ProductName:Longlife Tofu,Category:Produce,UnitPrice:10,UnitsInStock:4}] +Meat/Poultry +[{ProductId:54,ProductName:Tourtière,Category:Meat/Poultry,UnitPrice:7.45,UnitsInStock:21}] +Seafood +[{ProductId:13,ProductName:Konbu,Category:Seafood,UnitPrice:6,UnitsInStock:24}] +Dairy Products +[{ProductId:33,ProductName:Geitost,Category:Dairy Products,UnitPrice:2.5,UnitsInStock:112}] +Confections +[{ProductId:19,ProductName:Teatime Chocolate Biscuits,Category:Confections,UnitPrice:9.2,UnitsInStock:25}] +Grains/Cereals +[{ProductId:52,ProductName:Filo Mix,Category:Grains/Cereals,UnitPrice:7,UnitsInStock:38}] +".NormalizeNewLines())); + } + + [Test] + public void Linq85() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers |> max |> select: The maximum number is {it}. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The maximum number is 9.".NormalizeNewLines())); + } + + [Test] + public void Linq86() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> assignTo: words }} +{{ words + |> max: it.Length + |> select: The longest word is {it} characters long. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The longest word is 9 characters long.".NormalizeNewLines())); + } + + [Test] + public void Linq87() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> let({ category: 'it.Key', mostExpensivePrice: 'max(it, `it.UnitPrice`)' }) + |> select: Category: {category}, MaximumPrice: {mostExpensivePrice}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Category: Beverages, MaximumPrice: 263.5 +Category: Condiments, MaximumPrice: 43.9 +Category: Produce, MaximumPrice: 53 +Category: Meat/Poultry, MaximumPrice: 123.79 +Category: Seafood, MaximumPrice: 62.5 +Category: Dairy Products, MaximumPrice: 55 +Category: Confections, MaximumPrice: 81 +Category: Grains/Cereals, MaximumPrice: 38 +".NormalizeNewLines())); + } + + [Test] + public void Linq88() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> let({ + g: 'it', + maxPrice: 'max(g, `it.UnitPrice`)', + category: 'g.Key', + mostExpensiveProducts: 'where(g, `it.UnitPrice == maxPrice`)' + }) + |> select: { category }\n{ mostExpensiveProducts |> jsv }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Beverages +[{ProductId:38,ProductName:Côte de Blaye,Category:Beverages,UnitPrice:263.5,UnitsInStock:17}] +Condiments +[{ProductId:63,ProductName:Vegie-spread,Category:Condiments,UnitPrice:43.9,UnitsInStock:24}] +Produce +[{ProductId:51,ProductName:Manjimup Dried Apples,Category:Produce,UnitPrice:53,UnitsInStock:20}] +Meat/Poultry +[{ProductId:29,ProductName:Thüringer Rostbratwurst,Category:Meat/Poultry,UnitPrice:123.79,UnitsInStock:0}] +Seafood +[{ProductId:18,ProductName:Carnarvon Tigers,Category:Seafood,UnitPrice:62.5,UnitsInStock:42}] +Dairy Products +[{ProductId:59,ProductName:Raclette Courdavault,Category:Dairy Products,UnitPrice:55,UnitsInStock:79}] +Confections +[{ProductId:20,ProductName:Sir Rodney's Marmalade,Category:Confections,UnitPrice:81,UnitsInStock:40}] +Grains/Cereals +[{ProductId:56,ProductName:Gnocchi di nonna Alice,Category:Grains/Cereals,UnitPrice:38,UnitsInStock:21}] +".NormalizeNewLines())); + } + + [Test] + public void Linq89() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers |> average |> select: The average number is {it}. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The average number is 4.5.".NormalizeNewLines())); + } + + [Test] + public void Linq90() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> assignTo: words }} +{{ words + |> average: it.Length + |> select: The average word length is {it} characters. }} +").NormalizeNewLines(), + + Does.StartWith(@" +The average word length is 6.66666666666667 characters.".NormalizeNewLines())); + } + + [Test] + public void Linq91() + { + Assert.That(context.EvaluateScript(@" +{{ products + |> groupBy: it.Category + |> let({ category: 'it.Key', averagePrice: 'average(it, `it.UnitPrice`)' }) + |> select: Category: {category}, AveragePrice: {averagePrice}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Category: Beverages, AveragePrice: 37.9791666666667 +Category: Condiments, AveragePrice: 23.0625 +Category: Produce, AveragePrice: 32.37 +Category: Meat/Poultry, AveragePrice: 54.0066666666667 +Category: Seafood, AveragePrice: 20.6825 +Category: Dairy Products, AveragePrice: 28.73 +Category: Confections, AveragePrice: 25.16 +Category: Grains/Cereals, AveragePrice: 20.25 +".NormalizeNewLines())); + } + + [Test] + public void Linq92() + { + Assert.That(context.EvaluateScript(@" +{{ [1.7, 2.3, 1.9, 4.1, 2.9] |> assignTo: doubles }} +{{ doubles + |> reduce((accumulator,it) => accumulator * it,1) + |> select: Total product of all numbers: { it |> format('#.####') }. }} +").NormalizeNewLines(), + + Does.StartWith(@" +Total product of all numbers: 88.3308".NormalizeNewLines())); + } + + [Test] + public void Linq93() + { + Assert.That(context.EvaluateScript(@" +{{ [20, 10, 40, 50, 10, 70, 30] |> assignTo: attemptedWithdrawals }} +{{ attemptedWithdrawals + |> reduce((balance, nextWithdrawal) => ((nextWithdrawal <= balance) ? (balance - nextWithdrawal) : balance), + { initialValue: 100.0, }) + |> select: Ending balance: { it }. }} +").NormalizeNewLines(), + + Does.StartWith(@" +Ending balance: 20".NormalizeNewLines())); + } + + [Test] + public void Linq94() + { + Assert.That(context.EvaluateScript(@" +{{ [0, 2, 4, 5, 6, 8, 9] |> assignTo: numbersA }} +{{ [1, 3, 5, 7, 8] |> assignTo: numbersB }} +All numbers from both arrays: +{{ numbersA |> concat(numbersB) |> select: {it}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +All numbers from both arrays: +0 +2 +4 +5 +6 +8 +9 +1 +3 +5 +7 +8 +".NormalizeNewLines())); + } + + [Test] + public void Linq95() + { + Assert.That(context.EvaluateScript(@" +{{ customers |> map('it.CompanyName') |> assignTo: customerNames }} +{{ products |> map('it.ProductName') |> assignTo: productNames }} +Customer and product names: +{{ customerNames |> concat(productNames) |> select: { it |> raw }\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +Customer and product names: +Alfreds Futterkiste +Ana Trujillo Emparedados y helados +Antonio Moreno Taquería +Around the Horn +Berglunds snabbköp +Blauer See Delikatessen +".NormalizeNewLines())); + } + + [Test] + public void Linq96() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> assignTo: wordsA }} +{{ [ 'cherry', 'apple', 'blueberry' ] |> assignTo: wordsB }} +{{ wordsA |> equivalentTo(wordsB) |> select: The sequences match: { it |> lower } }} +").NormalizeNewLines(), + + Does.StartWith(@" +The sequences match: true".NormalizeNewLines())); + } + + [Test] + public void linq97() + { + Assert.That(context.EvaluateScript(@" +{{ [ 'cherry', 'apple', 'blueberry' ] |> assignTo: wordsA }} +{{ [ 'apple', 'blueberry', 'cherry' ] |> assignTo: wordsB }} +{{ wordsA |> equivalentTo(wordsB) |> select: The sequences match: { it |> lower } }} +").NormalizeNewLines(), + + Does.StartWith(@" +The sequences match: false".NormalizeNewLines())); + } + + [Test] + public void Linq99() + { + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ 0 |> assignTo: i }} +{{ numbers |> let({ i: 'incr(i)' }) |> select: v = {index |> incr}, i = {i}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +v = 1, i = 1 +v = 2, i = 2 +v = 3, i = 3 +v = 4, i = 4 +v = 5, i = 5 +v = 6, i = 6 +v = 7, i = 7 +v = 8, i = 8 +v = 9, i = 9 +v = 10, i = 10 +".NormalizeNewLines())); + } + + [Test] + public void Linq100() + { + // lowNumbers is assigned the result not a reusable query + Assert.That(context.EvaluateScript(@" +{{ [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] |> assignTo: numbers }} +{{ numbers + |> where: it <= 3 + |> assignTo: lowNumbers }} +First run numbers <= 3: +{{ lowNumbers |> select: {it}\n }} +{{ 10 |> times |> do: assign('numbers[index]', -numbers[index]) }} +Second run numbers <= 3: +{{ lowNumbers |> select: {it}\n }} +Contents of numbers: +{{ numbers |> select: {it}\n }} +").NormalizeNewLines(), + + Does.StartWith(@" +First run numbers <= 3: +1 +3 +2 +0 + +Second run numbers <= 3: +1 +3 +2 +0 + +Contents of numbers: +-5 +-4 +-1 +-3 +-9 +-8 +-6 +-7 +-2 +0 +".NormalizeNewLines())); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryTests.cs new file mode 100644 index 00000000000..5c107dda790 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/QueryTests.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class QueryTests + { + [Test] + public void Take_does_limit_KVP_Objects() + { + var context = new ScriptContext { + Args = { + ["items"] = new List<KeyValuePair<string, object>> { + new KeyValuePair<string, object>("A", 1), + new KeyValuePair<string, object>("B", 2), + new KeyValuePair<string, object>("C", 3), + } + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ items | textDump }}").NormalizeNewLines(), Is.EqualTo(@"||| +|-|-| +| A | 1 | +| B | 2 | +| C | 3 |".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ items | take(2) | textDump }}").NormalizeNewLines(), Is.EqualTo(@"||| +|-|-| +| A | 1 | +| B | 2 |".NormalizeNewLines())); + } + + [Test] + public void Take_does_limit_KVP_longs() + { + var context = new ScriptContext { + Args = { + ["items"] = new List<KeyValuePair<string, long>> { + new KeyValuePair<string, long>("A", 1), + new KeyValuePair<string, long>("B", 2), + new KeyValuePair<string, long>("C", 3), + } + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ items | textDump }}").NormalizeNewLines(), Is.EqualTo(@"||| +|-|-| +| A | 1 | +| B | 2 | +| C | 3 |".NormalizeNewLines())); + + Assert.That(context.EvaluateScript("{{ items | take(2) | textDump }}").NormalizeNewLines(), Is.EqualTo(@"||| +|-|-| +| A | 1 | +| B | 2 |".NormalizeNewLines())); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/RedisScriptsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/RedisScriptsTests.cs new file mode 100644 index 00000000000..bd2fb600a34 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/RedisScriptsTests.cs @@ -0,0 +1,29 @@ +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Redis; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class RedisScriptsTests + { + [Test] + public void Can_pass_filter_by_argument_to_partial() + { + var context = new ScriptContext + { + ScriptMethods = + { + new RedisScripts { RedisManager = new RedisManagerPool() }, + } + }.Init(); + + context.VirtualFiles.WriteFile("page-argument.html", "{{ 'partial-argument' |> partial({ redis: redisConnection }) }}"); + context.VirtualFiles.WriteFile("partial-argument.html", "{{ redis.host }}, {{ redis.port }}"); + + var output = new PageResult(context.GetPage("page-argument")).Result; + + Assert.That(output, Is.EqualTo("localhost, 6379")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptAssembliesTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptAssembliesTests.cs new file mode 100644 index 00000000000..b6b0c00c7b3 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptAssembliesTests.cs @@ -0,0 +1,683 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using Funq; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class Ints + { + public Ints(int a, int b) + { + A = a; + B = b; + } + public int A { get; set; } + public int B { get; set; } + public int C { get; set; } + public int D { get; set; } + public int GetTotal() => A + B + C + D; + + public int AddA(int a) => A += a; + + public string GenericMethod<T>() => typeof(T).Name + " " + GetTotal(); + + public string GenericMethod<T>(T value) => typeof(T).Name + $" {value} " + GetTotal(); + } + + public class Adder + { + public string String { get; set; } + public double Double { get; set; } + + public Adder(string str) => String = str; + public Adder(double num) => Double = num; + + public string Add(string str) => String += str; + public double Add(double num) => Double += num; + + public override string ToString() => String != null ? $"string: {String}" : $"double: {Double}"; + } + + public class StaticLog + { + static StringBuilder sb = new StringBuilder(); + + public static void Log(string message) => sb.Append(message); + + public static void Log<T>(string message) => sb.Append(typeof(T).Name + " " + message); + + public static string AllLogs() => sb.ToString(); + + public static void Clear() => sb.Clear(); + + public static string Prop { get; } = "StaticLog.Prop"; + public static string Field = "StaticLog.Field"; + public const string Const = "StaticLog.Const"; + + public string InstanceProp { get; } = "StaticLog.InstanceProp"; + public string InstanceField = "StaticLog.InstanceField"; + + public class Inner1 + { + public static string Prop1 { get; } = "StaticLog.Inner1.Prop1"; + public static string Field1 = "StaticLog.Inner1.Field1"; + public const string Const1 = "StaticLog.Inner1.Const1"; + + public string InstanceProp1 { get; } = "StaticLog.Inner1.InstanceProp1"; + public string InstanceField1 = "StaticLog.Inner1.InstanceField1"; + + public static class Inner2 + { + public static string Prop2 { get; } = "StaticLog.Inner1.Inner2.Prop2"; + public static string Field2 = "StaticLog.Inner1.Inner2.Field2"; + public const string Const2 = "StaticLog.Inner1.Inner2.Const2"; + } + } + } + + public class GenericStaticLog<T> + { + static StringBuilder sb = new StringBuilder(); + + public static void Log(string message) => sb.Append(typeof(T).Name + " " + message); + + public static void Log<T2>(string message) => sb.Append(typeof(T).Name + " " + typeof(T2).Name + " " + message); + + public static string AllLogs() => sb.ToString(); + + public static void Clear() => sb.Clear(); + } + + public class InstanceLog + { + private readonly string prefix; + public InstanceLog(string prefix) => this.prefix = prefix; + + StringBuilder sb = new StringBuilder(); + + public void Log(string message) => sb.Append(prefix + " " + message); + + public void Log<T2>(string message) => sb.Append(prefix + " " + typeof(T2).Name + " " + message); + + public string AllLogs() => sb.ToString(); + + public void Clear() => sb.Clear(); + } + + internal class InternalType + { + public InternalType() { } + public InternalType(int num) {} + } + + public interface ICursor + { + string AProp { get; set; } + string AMethod(int arg); + } + public class Cursor : ICursor + { + public string AProp { get; set; } + public string BProp { get; set; } + public string AMethod(int arg) => $"AMethod: {arg}"; + public string BMethod(int arg) => $"BMethod: {arg}"; + } + + public class ContentResolver + { + public ICursor Query( + Uri uri, + string[] projection, + string selection, + string[] selectionArgs, + string sortOrder) + { + return new Cursor(); + } + } + + public class ScriptAssembliesTests + { + private static ScriptContext CreateContext() => + new ScriptContext { + ScriptMethods = { + new ProtectedScripts() + }, + ScriptTypes = { + typeof(DynamicInt), + } + }; + + private static ScriptContext CreateContext(Action<ScriptContext> fn) + { + var context = CreateContext(); + fn(context); + return context; + } + + [Test] + public void Does_not_allow_Types_by_default() + { + Assert.Throws<ScriptException>(() => + new ScriptContext().Init().EvaluateScript("{{ 'int'.typeof().Name }}")); + + var context = CreateContext().Init(); + var result = context.EvaluateScript("{{ 'DynamicInt'.typeof().Name }}"); + + Assert.That(result, Is.EqualTo(nameof(DynamicInt))); + + result = context.EvaluateScript("{{ 'ServiceStack.WebHost.Endpoints.Tests.ScriptTests.Ints'.typeof().Name }}"); + Assert.That(result, Is.Empty); + + context = CreateContext(c => c.AllowScriptingOfAllTypes = true).Init(); + result = context.EvaluateScript("{{ 'ServiceStack.WebHost.Endpoints.Tests.ScriptTests.Ints'.typeof().Name }}"); + Assert.That(result, Is.EqualTo(nameof(Ints))); + } + + [Test] + public void Does_not_allow_creating_instances_of_public_types() + { + var context = CreateContext(c => { + c.ScriptTypes.Add(typeof(InternalType)); + }).Init(); + + try + { + context.Evaluate("{{ 'InternalType'.new() |> return }}"); + Assert.Fail("Should throw"); + } + catch (Exception e) + { + Assert.That(e.InnerException.GetType(), Is.EqualTo(typeof(NotSupportedException))); + } + + try + { + context.Evaluate("{{ 'InternalType'.new(1) |> return }}"); + Assert.Fail("Should throw"); + } + catch (Exception e) + { + Assert.That(e.InnerException.GetType(), Is.EqualTo(typeof(NotSupportedException))); + } + + context = CreateContext(c => { + c.ScriptTypes.Add(typeof(InternalType)); + c.AllowScriptingOfAllTypes = true; + }).Init(); + + var result = context.Evaluate("{{ 'InternalType'.new() |> return }}"); + Assert.That(result.GetType(), Is.EqualTo(typeof(InternalType))); + + result = context.Evaluate("{{ 'InternalType'.new(1) |> return }}"); + Assert.That(result.GetType(), Is.EqualTo(typeof(InternalType))); + } + + [Test] + public void typeof_returns_correct_types() + { + var context = CreateContext(c => { + c.AllowScriptingOfAllTypes = true; + c.ScriptNamespaces.Add("System"); + c.ScriptNamespaces.Add("System.Collections.Generic"); + c.ScriptNamespaces.Add(typeof(StaticLog).Namespace); + }).Init(); + + Assert.That(context.Evaluate<Type>("{{ typeof('int') |> return}}"), Is.EqualTo(typeof(int))); + Assert.That(context.Evaluate<Type>("{{ typeof('Int32') |> return}}"), Is.EqualTo(typeof(Int32))); + Assert.That(context.Evaluate<Type>("{{ typeof('List<>') |> return}}"), Is.EqualTo(typeof(List<>))); + Assert.That(context.Evaluate<Type>("{{ typeof('Dictionary<,>') |> return}}"), Is.EqualTo(typeof(Dictionary<,>))); + Assert.That(context.Evaluate<Type>("{{ typeof('List<string>') |> return}}"), Is.EqualTo(typeof(List<string>))); + Assert.That(context.Evaluate<Type>("{{ typeof('Dictionary<string,int>') |> return}}"), Is.EqualTo(typeof(Dictionary<string,int>))); + Assert.That(context.Evaluate<Type>("{{ typeof('Dictionary<String,Int32>') |> return}}"), Is.EqualTo(typeof(Dictionary<string,int>))); + Assert.That(context.Evaluate<Type>("{{ typeof('Dictionary<String,ServiceStack.WebHost.Endpoints.Tests.ScriptTests.Ints>') |> return}}"), Is.EqualTo(typeof(Dictionary<string,Ints>))); + + Assert.That(context.Evaluate<Type>("{{ typeof('StaticLog+Inner1') |> return}}"), Is.EqualTo(typeof(StaticLog.Inner1))); + Assert.That(context.Evaluate<Type>("{{ typeof('StaticLog+Inner1+Inner2') |> return}}"), Is.EqualTo(typeof(StaticLog.Inner1.Inner2))); + Assert.That(context.Evaluate<Type>("{{ typeof('StaticLog.Inner1') |> return}}"), Is.EqualTo(typeof(StaticLog.Inner1))); + Assert.That(context.Evaluate<Type>("{{ typeof('StaticLog.Inner1.Inner2') |> return}}"), Is.EqualTo(typeof(StaticLog.Inner1.Inner2))); + + Assert.That(context.Evaluate<Type>("{{ typeof('string[]') |> return}}"), Is.EqualTo(typeof(string[]))); + Assert.That(context.Evaluate<Type>("{{ typeof('List<string>[]') |> return}}"), Is.EqualTo(typeof(List<string>[]))); + Assert.That(context.Evaluate<Type>("{{ typeof('Dictionary<String, System.Int32>[]') |> return}}"), Is.EqualTo(typeof(Dictionary<String, System.Int32>[]))); + } + + [Test] + public void Can_create_Type_from_registered_Script_Assembly() + { + var context = CreateContext().Init(); + + var result = context.EvaluateScript( + @"{{ 'DynamicInt'.new() |> to => d }}{{ d.call('add', [1, 2]) }}"); + Assert.That(result, Is.EqualTo("3")); + + result = context.EvaluateScript( + @"{{ 'DynamicInt'.new() |> to => d }}{{ d.call('add', [3, 4]) }}"); + Assert.That(result, Is.EqualTo("7")); + + result = context.EvaluateScript( + @"{{ 'ServiceStack.DynamicInt'.new() |> to => d }}{{ d.call('add', [5, 6]) }}"); + Assert.That(result, Is.EqualTo("11")); + + result = context.EvaluateScript( + @"{{ typeof('DynamicInt').createInstance() |> to => d }}{{ d.call('add', [3, 4]) }}"); + Assert.That(result, Is.EqualTo("7")); + } + + [Test] + public void Cant_create_instances_from_ambiguous_constructors() + { + var context = CreateContext(c => c.ScriptTypes.Add(typeof(Adder))).Init(); + + object result = null; + + try + { + result = context.Evaluate("{{ 'Adder'.new([1]) }}"); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + Assert.That(e.InnerException.GetType(), Is.EqualTo(typeof(NotSupportedException))); + } + + result = context.Evaluate("{{ 'Adder'.new([1.toString()]) |> to => o }}{{ o.String |> return }}"); + Assert.That(result, Is.EqualTo("1")); + + result = context.Evaluate("{{ 'Adder'.new([1.toDouble()]) |> to => o }}{{ o.Double |> return }}"); + Assert.That(result, Is.EqualTo(1.0d)); + + result = context.Evaluate("{{ Constructor('Adder(string)')(1) |> to => o }}{{ o.String |> return }}"); + Assert.That(result, Is.EqualTo("1")); + + result = context.Evaluate("{{ Constructor('Adder(double)')(1) |> to => o }}{{ o.Double |> return }}"); + Assert.That(result, Is.EqualTo(1.0d)); + } + + [Test] + public void Can_call_ambiguous_methods() + { + var context = CreateContext(c => c.ScriptTypes.Add(typeof(Adder))).Init(); + + object result = null; + + try + { + result = context.Evaluate("{{ 'Adder'.new(['1']) |> to => o }}{{ o.call('Add',[1]) }}{{ o.String |> return }}"); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + Assert.That(e.InnerException.GetType(), Is.EqualTo(typeof(NotSupportedException))); + } + + result = context.Evaluate("{{ 'Adder'.new(['1']) |> to => o }}{{ o.call('Add',['1']) }}{{ o.String |> return }}"); + Assert.That(result, Is.EqualTo("11")); + + result = context.Evaluate("{{ 'Adder'.new([1.0]) |> to => o }}{{ o.call('Add',[1.0]) }}{{ o.Double |> return }}"); + Assert.That(result, Is.EqualTo(2.0d)); + + result = context.Evaluate("{{ Constructor('Adder(string)')(1) |> to => o }}{{ Function('Adder.Add(string)') |> to => adder }}{{ o.adder(1) |> return }}"); + Assert.That(result, Is.EqualTo("11")); + + result = context.Evaluate("{{ Constructor('Adder(double)')(1) |> to => o }}{{ Function('Adder.Add(double)') |> to => adder }}{{ o.adder(1) |> return }}"); + Assert.That(result, Is.EqualTo(2.0d)); + } + + [Test] + public void Can_create_Type_from_registered_Script_Assembly_from_Constructor_ObjectActivator() + { + var context = CreateContext(c => { + c.AllowScriptingOfAllTypes = true; + c.ScriptNamespaces.Add("System"); + }).Init(); + + var result = context.Evaluate<object>( + @"{{ Constructor('DynamicInt()') |> to => ctor }}{{ ctor() |> return }}"); + Assert.That(result.GetType(), Is.EqualTo(typeof(DynamicInt))); + + result = context.Evaluate<object>( + @"{{ Constructor('DynamicInt()')() |> return }}"); + Assert.That(result.GetType(), Is.EqualTo(typeof(DynamicInt))); + + result = context.Evaluate<object>( + @"{{ Constructor('DateTime(int,int,int)')(2001,1,1) |> return }}"); + Assert.That(result, Is.EqualTo(new DateTime(2001,1,1))); + + result = context.Evaluate<object>( + @"{{ Constructor('DateTime(int,int,int)') |> to => newDate }}{{ newDate(2001,1,1) |> return }}"); + Assert.That(result, Is.EqualTo(new DateTime(2001,1,1))); + + result = context.Evaluate<object>( + @"{{ Constructor('DateTime(int,int,int)') |> to => newDate }}{{ 2001.newDate(1,1) |> return }}"); + Assert.That(result, Is.EqualTo(new DateTime(2001,1,1))); + + result = context.Evaluate<object>( + @"{{ Constructor('Tuple<string,int>(System.String,System.Int32)') |> to => tuple }}{{ tuple('A',1) |> to => pair }}{{ `${pair.Item1}=${pair.Item2}` |> return }}"); + Assert.That(result, Is.EqualTo("A=1")); + + result = context.Evaluate<object>( + @"{{ Constructor('System.Collections.Generic.KeyValuePair<string,int>(System.String,System.Int32)')('A',1) |> to => kvp }}{{ `${kvp.Key}=${kvp.Value}` |> return }}"); + Assert.That(result, Is.EqualTo("A=1")); + + result = context.Evaluate<object>( + @"{{ Constructor('System.Collections.Generic.KeyValuePair<char,double>(char,double)')('A',1) |> to => kvp }}{{ `${kvp.Key}=${kvp.Value}` |> return }}"); + Assert.That(result, Is.EqualTo("A=1")); + } + + [Test] + public void Can_call_generic_methods() + { + var context = CreateContext(c => c.ScriptAssemblies.Add(typeof(Ints).Assembly)).Init(); + + var result = context.Evaluate<string>( + "{{ 'Ints'.new([1,2]).call('GenericMethod<string>') |> return }}"); + Assert.That(result, Is.EqualTo("String 3")); + + result = context.Evaluate<string>( + "{{ 'Ints'.new([1,2]).call('GenericMethod<string>',['arg']) |> return }}"); + Assert.That(result, Is.EqualTo("String arg 3")); + + result = context.Evaluate<string>( + "{{ typeof('Ints').createInstance([1,2]).call('GenericMethod<string>',['arg']) |> return }}"); + Assert.That(result, Is.EqualTo("String arg 3")); + } + + [Test] + public void Can_create_type_with_constructor_arguments() + { + var context = CreateContext(c => c.ScriptAssemblies.Add(typeof(Ints).Assembly)).Init(); + + var result = context.Evaluate<int>( + "{{ 'Ints'.new([1,2]).call('GetTotal') |> return }}"); + Assert.That(result, Is.EqualTo(3)); + + result = context.Evaluate<int>( + "{{ typeof('Ints').createInstance([1,2]).call('GetTotal') |> return }}"); + Assert.That(result, Is.EqualTo(3)); + + result = context.Evaluate<int>( + "{{ 'Ints'.new([1,2]).set({ C:3, D:4.0 }).call('GetTotal') |> return }}"); + Assert.That(result, Is.EqualTo(10)); + + result = context.Evaluate<int>( + "{{ 'Ints'.new([1,2]).set({ C:3 }).set({ D:4.0 }).call('GetTotal') |> return }}"); + Assert.That(result, Is.EqualTo(10)); + + result = context.Evaluate<int>( + "{{ Constructor('Ints(int,int)')(1,2).set({ C:3, D:4 }).call('GetTotal') |> return }}"); + Assert.That(result, Is.EqualTo(10)); + + result = context.Evaluate<int>( + "{{ Function('Ints.GetTotal') |> to => total}}" + + "{{ Constructor('Ints(int,int)') |> to => tuple}}" + + "{{ tuple(1,2).set({ C:3, D:4 }).total() |> return }}"); + Assert.That(result, Is.EqualTo(10)); + } + + [Test] + public void Can_create_generic_type_with_constructor_arguments() + { + var context = CreateContext(c => { + c.AllowScriptingOfAllTypes = true; + c.ScriptNamespaces.Add(typeof(KeyValuePair<,>).Namespace); + }).Init(); + + var result = context.EvaluateScript( + "{{ 'KeyValuePair<string,int>'.new(['A',1]) |> to => kvp }}{{ kvp.Key }}={{ kvp.Value }}"); + Assert.That(result, Is.EqualTo("A=1")); + + result = context.EvaluateScript( + "{{ typeof('KeyValuePair<string,int>').createInstance(['A',1]) |> to => kvp }}{{ kvp.Key }}={{ kvp.Value }}"); + Assert.That(result, Is.EqualTo("A=1")); + } + + [Test] + public void Can_create_Type_from_Loaded_Assembly() + { + var context = CreateContext(c => c.AllowScriptingOfAllTypes = true).Init(); + + var result = context.Evaluate( + "{{ 'ServiceStack.WebHost.Endpoints.Tests.ScriptTests.Ints'.new() |> return}}"); + Assert.That(result as Ints, Is.Not.Null); + } + + [Test] + public void Script_Types_Use_Case() + { + var context = CreateContext(c => { + c.AllowScriptingOfAllTypes = true; + c.ScriptNamespaces.Add(typeof(DateTime).Namespace); + c.ScriptNamespaces.Add(typeof(Adder).Namespace); + }).Init(); + //var url = new Uri(); + + object result = null; + result = context.Evaluate("{{ 'Uri'.new(['http://host.org']) |> return }}"); + Assert.That(result, Is.EqualTo(new Uri("http://host.org"))); + result = context.Evaluate("{{ Constructor('Uri(string)')('http://host.org') |> return }}"); + Assert.That(result, Is.EqualTo(new Uri("http://host.org"))); + result = context.Evaluate("{{ Constructor('Uri(string)') |> to => url }}{{ url('http://host.org') |> return }}"); + Assert.That(result, Is.EqualTo(new Uri("http://host.org"))); + result = context.Evaluate("{{ Constructor('Uri(string)') |> to => url }}{{ 'http://host.org'.url() |> return }}"); + Assert.That(result, Is.EqualTo(new Uri("http://host.org"))); + result = context.Evaluate("{{ Constructor('Uri(string)') |> to => url }}{{ 'http://host.org' |> url |> return }}"); + Assert.That(result, Is.EqualTo(new Uri("http://host.org"))); + + result = context.Evaluate("{{ 'DateTime'.new() |> return }}"); + Assert.That(result.GetType(), Is.EqualTo(typeof(DateTime))); + + result = context.Evaluate("{{ Constructor('Adder(double)') |> to => doubleAdder }}{{ doubleAdder(1) |> return }}"); + Assert.That(((Adder) result).Double, Is.EqualTo(1.0d)); + result = context.Evaluate("{{ Constructor('Adder(double)') |> to => doubleAdder }}{{ 1.doubleAdder() |> return }}"); + Assert.That(((Adder) result).Double, Is.EqualTo(1.0d)); + result = context.Evaluate("{{ Constructor('Adder(double)') |> to => doubleAdder }}{{ 1 |> doubleAdder |> return }}"); + Assert.That(((Adder) result).Double, Is.EqualTo(1.0d)); + + result = context.Evaluate("{{ 'Ints'.new([1,2]) |> to => o }}{{ o.call('GenericMethod<int>') |> return }}"); + Assert.That((string) result, Is.EqualTo("Int32 3")); + result = context.Evaluate("{{ 'Ints'.new([1,2]) |> to => o }}{{ o.call('GenericMethod<int>',[1]) |> return }}"); + Assert.That((string) result, Is.EqualTo("Int32 1 3")); + } + + [Test] + public void Can_create_Function_for_static_Methods() + { + var context = CreateContext(c => { + c.AllowScriptingOfAllTypes = true; + c.ScriptNamespaces.Add(typeof(Console).Namespace); + c.ScriptNamespaces.Add(typeof(StaticLog).Namespace); + }).Init(); + + string result = null; + + result = context.EvaluateScript(@"{{ Function('Console.WriteLine(string)') |> to => writeln }} + {{ writeln('static method') }} + {{ 'ext method'.writeln() }}"); + + result = context.Evaluate<string>(@"{{ Function('StaticLog.Clear')() }} + {{ Function('StaticLog.Log') |> to => log }} + {{ log('arg.') }} + {{ 'ext.'.log() }} + {{ Function('StaticLog.AllLogs') |> to => allLogs }}{{ allLogs() |> return }}"); + Assert.That(result, Is.EqualTo("arg.ext.")); + + result = context.Evaluate<string>(@"{{ Function('StaticLog.Clear')() }} + {{ Function('StaticLog.Log<int>') |> to => log }} + {{ log('arg.') }} + {{ 'ext.'.log() }} + {{ Function('StaticLog.AllLogs') |> to => allLogs }}{{ allLogs() |> return }}"); + Assert.That(result, Is.EqualTo("Int32 arg.Int32 ext.")); + + result = context.Evaluate<string>(@"{{ Function('StaticLog.Clear')() }} + {{ Function('StaticLog.Log')('iife') }} + {{ Function('StaticLog.AllLogs')() |> return }}"); + Assert.That(result, Is.EqualTo("iife")); + } + + [Test] + public void Can_create_Function_for_generic_type_static_Methods() + { + var context = CreateContext(c => { + c.AllowScriptingOfAllTypes = true; + c.ScriptNamespaces.Add(typeof(GenericStaticLog<>).Namespace); + }).Init(); + + string result = null; + + result = context.Evaluate<string>(@"{{ Function('GenericStaticLog<string>.Clear()')() }} + {{ Function('GenericStaticLog<string>.Log(string)') |> to => log }} + {{ log('arg.') }} + {{ 'ext.'.log() }} + {{ Function('GenericStaticLog<string>.AllLogs') |> to => allLogs }}{{ allLogs() |> return }}"); + Assert.That(result, Is.EqualTo("String arg.String ext.")); + + result = context.Evaluate<string>(@"{{ Function('GenericStaticLog<string>.Clear()')() }} + {{ Function('GenericStaticLog<string>.Log(string)')('iife') }} + {{ Function('GenericStaticLog<string>.AllLogs')() |> return }}"); + Assert.That(result, Is.EqualTo("String iife")); + + result = context.Evaluate<string>(@"{{ Function('GenericStaticLog<string>.Clear()')() }} + {{ Function('GenericStaticLog<string>.Log<int>') |> to => log }} + {{ Function('GenericStaticLog<string>.Log<int>(string)') |> to => log }} + {{ log('arg.') }} + {{ 'ext.'.log() }} + {{ Function('GenericStaticLog<string>.AllLogs') |> to => allLogs }}{{ allLogs() |> return }}"); + Assert.That(result, Is.EqualTo("String Int32 arg.String Int32 ext.")); + } + + [Test] + public void Can_create_Function_for_instance_methods() + { + var context = CreateContext(c => { + c.AllowScriptingOfAllTypes = true; + c.ScriptNamespaces.Add(typeof(InstanceLog).Namespace); + }).Init(); + + string result = null; + + result = context.Evaluate<string>(@"{{ 'InstanceLog'.new(['instance']) |> to => o }} + {{ Function('InstanceLog.Log') |> to => log }} + {{ o.log('arg.') }} + {{ log(o,'param.') }} + {{ Function('InstanceLog.AllLogs') |> to => allLogs }}{{ o.allLogs() |> return }}"); + Assert.That(result, Is.EqualTo("instance arg.instance param.")); + + result = context.Evaluate<string>(@"{{ Function('InstanceLog.Log<int>') |> to => log }} + {{ 'InstanceLog'.new(['instance']) |> to => o }} + {{ o.log('arg.') }} + {{ log(o,'param.') }} + {{ Function('InstanceLog.AllLogs') |> to => allLogs }}{{ o.allLogs() |> return }}"); + Assert.That(result, Is.EqualTo("instance Int32 arg.instance Int32 param.")); + } + + [Test] + public void Can_get_inner_class_properties() + { + var context = CreateContext(c => { + c.AllowScriptingOfAllTypes = true; + c.ScriptNamespaces.Add(typeof(StaticLog).Namespace); + }).Init(); + + string result = null; + + result = context.Evaluate<string>(@"{{ Function('StaticLog.Prop')() |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Prop")); + result = context.Evaluate<string>(@"{{ Function('StaticLog.Field')() |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Field")); + result = context.Evaluate<string>(@"{{ Function('StaticLog.Const')() |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Const")); + + result = context.Evaluate<string>(@"{{ Function('StaticLog.Inner1.Prop1')() |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Inner1.Prop1")); + result = context.Evaluate<string>(@"{{ Function('StaticLog.Inner1.Field1')() |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Inner1.Field1")); + result = context.Evaluate<string>(@"{{ Function('StaticLog.Inner1.Const1')() |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Inner1.Const1")); + + result = context.Evaluate<string>(@"{{ Function('StaticLog.Inner1.Inner2.Prop2')() |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Inner1.Inner2.Prop2")); + result = context.Evaluate<string>(@"{{ Function('StaticLog.Inner1.Inner2.Field2')() |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Inner1.Inner2.Field2")); + result = context.Evaluate<string>(@"{{ Function('StaticLog.Inner1.Inner2.Const2')() |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Inner1.Inner2.Const2")); + + context.Args["o"] = new StaticLog(); + context.Args["o1"] = new StaticLog.Inner1(); + result = context.Evaluate<string>(@"{{ Function('StaticLog.InstanceProp')(o) |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.InstanceProp")); + result = context.Evaluate<string>(@"{{ Function('StaticLog.InstanceField')(o) |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.InstanceField")); + + result = context.Evaluate<string>(@"{{ Function('StaticLog.Inner1.InstanceProp1')(o1) |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Inner1.InstanceProp1")); + result = context.Evaluate<string>(@"{{ Function('StaticLog.Inner1.InstanceField1')(o1) |> return }}"); + Assert.That(result, Is.EqualTo("StaticLog.Inner1.InstanceField1")); + } + + [Test] + public void Can_call_ContentResolver_Query_on_instance() + { + var context = CreateContext(c => { + c.AllowScriptingOfAllTypes = true; + c.ScriptNamespaces.Add("System"); + c.ScriptNamespaces.Add(typeof(ContentResolver).Namespace); + }).Init(); + + var result = context.Evaluate(@"{{ F('ContentResolver.Query(Uri,string[],string,string[],string)') |> to => Query }} + {{ MainActivity.Query('http://host.org',['A'],'B',['C'],'D') |> return }}", + new Dictionary<string, object> { + ["MainActivity"] = new ContentResolver() + }); + + Assert.That(result is ICursor); + } + + [Test] + public void Can_Call_registered_IOC_Dependency() + { + var context = CreateContext(c => { + c.ScriptTypes.Add(typeof(InstanceLog)); + }).Init(); + context.Container.AddTransient(() => new InstanceLog("ioc")); + + string result = null; + + result = context.Evaluate<string>(@"{{ resolve('InstanceLog') |> to => o }} + {{ Function('InstanceLog.Log') |> to => log }} + {{ o.log('arg') }} + {{ Function('InstanceLog.AllLogs') |> to => allLogs }}{{ o.allLogs() |> return }}".NormalizeNewLines()); + + Assert.That(result, Is.EqualTo("ioc arg")); + } + + [Test] + public void Can_call_resolve_interface_from_registered_Dependency() + { + var context = CreateContext(c => { + c.ScriptNamespaces.Add(typeof(ICursor).Namespace); + c.AllowScriptingOfAllTypes = true; + }); + context.Container.AddTransient<ICursor>(() => new Cursor()); + context.Init(); + + var output = context.EvaluateCode("'ICursor'.typeof().Name |> return"); + Assert.That(output, Is.EqualTo(nameof(ICursor))); + + output = context.EvaluateCode<List<string>>("resolve('ICursor').methods() |> return"); + Assert.That(output, Is.EqualTo(new[]{ "AMethod", "BMethod"})); + + output = context.EvaluateCode<string>("F('ICursor.AMethod')(resolve('ICursor'), 1) |> return"); + Assert.That(output, Is.EqualTo("AMethod: 1")); + + output = context.EvaluateCode<string>("F('Cursor.BMethod')(resolve('ICursor'), 2) |> return"); + Assert.That(output, Is.EqualTo("BMethod: 2")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptBlockHtmlTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptBlockHtmlTests.cs new file mode 100644 index 00000000000..030b81f2a87 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptBlockHtmlTests.cs @@ -0,0 +1,178 @@ +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptBlockHtmlTests + { + [Test] + public void Does_evaluate_void_img_html_block() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{#img {alt:'image',src:'image.png'} }}{{/img}}"), + Is.EqualTo("<img alt=\"image\" src=\"image.png\">")); + } + + [Test] + public void Does_evaluate_ul_html_block() + { + var context = new ScriptContext { + Args = { + ["numbers"] = new int[]{1, 2, 3}, + ["letters"] = new[]{ "A", "B", "C" }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#ul}}{{/ul}}").RemoveNewLines(), Is.EqualTo("<ul></ul>")); + + Assert.That(context.EvaluateScript("{{#ul {class:'nav'} }} <li>item</li> {{/ul}}").RemoveNewLines(), + Is.EqualTo(@"<ul class=""nav""> <li>item</li> </ul>")); + + Assert.That(context.EvaluateScript("{{#ul {each:letters, class:'nav', id:'menu'} }}<li>{{it}}</li>{{/ul}}").RemoveNewLines(), + Is.EqualTo(@"<ul class=""nav"" id=""menu""><li>A</li><li>B</li><li>C</li></ul>")); + + Assert.That(context.EvaluateScript("{{#ul {each:numbers, it:'num'} }}<li>{{num}}</li>{{/ul}}").RemoveNewLines(), + Is.EqualTo(@"<ul><li>1</li><li>2</li><li>3</li></ul>")); + + Assert.That(context.EvaluateScript("{{#ul {each:none} }}<li>{{it}}</li>{{/ul}}").RemoveNewLines(), Is.EqualTo(@"")); + + Assert.That(context.EvaluateScript("{{#ul {each:none} }}<li>{{it}}</li>{{else}}no items{{/ul}}").RemoveNewLines(), + Is.EqualTo(@"no items")); + } + + private static ScriptContext CreateContext() + { + var context = new ScriptContext { + Args = { + ["items"] = new[] {new Person("foo", 1), new Person("bar", 2), new Person("baz", 3)}, + ["id"] = "menu", + ["disclaimerAccepted"] = false, + ["hasAccess"] = true, + ["highlight"] = "baz", + ["digits"] = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }, + } + }.Init(); + return context; + } + + [Test] + public void Does_evaluate_ul_with_nested_html_blocks() + { + var context = CreateContext(); + + var template = @" +{{#ul {each:items, class:['nav', !disclaimerAccepted?'blur':''], id:`ul-${id}`} }} + {{#li {class: {alt:isOdd(index), active:Name==highlight} }} + {{Name}} + {{/li}} +{{else}} + <div>no items</div> +{{/ul}}"; + + var result = context.EvaluateScript(template); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +<ul class=""nav blur"" id=""ul-menu""> + <li> + foo + </li> + <li class=""alt""> + bar + </li> + <li class=""active""> + baz + </li> +</ul>".NormalizeNewLines())); + + var withoutHtmlBlock = @" +{{#if !isEmpty(items)}} +<ul{{ ['nav', !disclaimerAccepted?'blur':''] |> htmlClass }} id=""ul-{{id}}""> +{{#each items}} + <li{{ {alt:isOdd(index), active:Name==highlight} |> htmlClass }}> + {{Name}} + </li> +{{/each}} +</ul> +{{else}} + <div>no items</div> +{{/if}}"; + + var withoutBlockResult = context.EvaluateScript(withoutHtmlBlock); + + Assert.That(withoutBlockResult.RemoveNewLines(), Is.EqualTo(result.RemoveNewLines())); + } + + [Test] + public void Does_evaluate_if_and_where_in_html_blocks() + { + var context = CreateContext(); + + var template = @" +{{#ul {if:hasAccess, each:items, where:'Age >= 2', class:['nav', !disclaimerAccepted?'blur':''], id:`ul-${id}`} }} + {{#li {class: {alt:isOdd(index), active:Name==highlight} }} + {{Name}} + {{/li}} +{{else}} + <div>no items</div> +{{/ul}}"; + + var result = context.EvaluateScript(template); + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +<ul class=""nav blur"" id=""ul-menu""> + <li> + bar + </li> + <li class=""alt active""> + baz + </li> +</ul>".NormalizeNewLines())); + + var withoutHtmlBlock = @" +{{ items |> where: it.Age >= 2 + |> assignTo: items }} +{{#if !isEmpty(items)}} +{{#if hasAccess}} +<ul{{ ['nav', !disclaimerAccepted?'blur':''] |> htmlClass }} id=""ul-{{id}}""> +{{#each items}} + <li{{ {alt:isOdd(index), active:Name==highlight} |> htmlClass }}> + {{Name}} + </li> +{{/each}} +</ul> +{{/if}} + {{else}} + <div>no items</div> + {{/if}}".NormalizeNewLines(); + + var withoutBlockResult = context.EvaluateScript(withoutHtmlBlock); + withoutBlockResult.Print(); + Assert.That(withoutBlockResult.RemoveNewLines(), Is.EqualTo(result.RemoveNewLines())); + + result = context.EvaluateScript(template.Replace("hasAccess","!hasAccess")); + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@"")); + } + + [Test] + public void Does_evaluate_where_expression_on_strings() + { + var context = CreateContext(); + + var template = @" +{{#each d in digits where d.Length < index}} +The word {{d}} is shorter than its value. +{{/each}}"; + + var result = context.EvaluateScript(template); + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +The word five is shorter than its value. +The word six is shorter than its value. +The word seven is shorter than its value. +The word eight is shorter than its value. +The word nine is shorter than its value.".NormalizeNewLines())); + } + + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptBlockTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptBlockTests.cs new file mode 100644 index 00000000000..50dc3613db9 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptBlockTests.cs @@ -0,0 +1,1142 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptBlockTests + { + [Test] + public void Does_parse_template_with_Block_Statement() + { + var fragments = ScriptTemplateUtils.ParseTemplate("BEFORE {{#bold}} Hi, {{name}}! {{/bold}} AFTER"); + + Assert.That(fragments.Count, Is.EqualTo(3)); + Assert.That(((PageStringFragment)fragments[0]).Value.ToString(), Is.EqualTo("BEFORE ")); + + var statement = fragments[1] as PageBlockFragment; + Assert.That(statement, Is.Not.Null); + Assert.That(statement.Name, Is.EqualTo("bold")); + Assert.That(statement.Argument.ToString(), Is.EqualTo("")); + + Assert.That(((PageStringFragment)statement.Body[0]).Value.ToString(), Is.EqualTo(" Hi, ")); + Assert.That(((PageVariableFragment)statement.Body[1]).Binding, Is.EqualTo("name")); + Assert.That(((PageStringFragment)statement.Body[2]).Value.ToString(), Is.EqualTo("! ")); + + Assert.That(((PageStringFragment)fragments[2]).Value.ToString(), Is.EqualTo(" AFTER")); + } + + [Test] + public void Does_parse_template_with_if_else_statement() + { + var fragments = ScriptTemplateUtils.ParseTemplate("BEFORE {{#if a < b}}YES{{else}}NO{{/if}} AFTER"); + + Assert.That(fragments.Count, Is.EqualTo(3)); + Assert.That(((PageStringFragment)fragments[0]).Value.ToString(), Is.EqualTo("BEFORE ")); + + var statement = fragments[1] as PageBlockFragment; + Assert.That(statement, Is.Not.Null); + Assert.That(statement.Name, Is.EqualTo("if")); + Assert.That(statement.Argument.ToString(), Is.EqualTo("a < b")); + Assert.That(((PageStringFragment)statement.Body[0]).Value.ToString(), Is.EqualTo("YES")); + + Assert.That(statement.ElseBlocks[0].Argument.ToString(), Is.EqualTo("")); + Assert.That(((PageStringFragment)statement.ElseBlocks[0].Body[0]).Value.ToString(), Is.EqualTo("NO")); + + Assert.That(((PageStringFragment)fragments[2]).Value.ToString(), Is.EqualTo(" AFTER")); + } + + [Test] + public void Does_parse_template_with_if_and_else_if_statement() + { + var fragments = ScriptTemplateUtils.ParseTemplate("BEFORE {{#if a < b}}YES{{else if c < d}}NO{{else}}MAYBE{{/if}} AFTER"); + + Assert.That(fragments.Count, Is.EqualTo(3)); + Assert.That(((PageStringFragment)fragments[0]).Value.ToString(), Is.EqualTo("BEFORE ")); + + var statement = fragments[1] as PageBlockFragment; + Assert.That(statement, Is.Not.Null); + Assert.That(statement.Name, Is.EqualTo("if")); + Assert.That(statement.Argument.ToString(), Is.EqualTo("a < b")); + Assert.That(((PageStringFragment)statement.Body[0]).Value.ToString(), Is.EqualTo("YES")); + + Assert.That(statement.ElseBlocks[0].Argument.ToString(), Is.EqualTo("if c < d")); + Assert.That(((PageStringFragment)statement.ElseBlocks[0].Body[0]).Value.ToString(), Is.EqualTo("NO")); + + Assert.That(statement.ElseBlocks[1].Argument.ToString(), Is.EqualTo("")); + Assert.That(((PageStringFragment)statement.ElseBlocks[1].Body[0]).Value.ToString(), Is.EqualTo("MAYBE")); + + Assert.That(((PageStringFragment)fragments[2]).Value.ToString(), Is.EqualTo(" AFTER")); + } + + [Test] + public void Does_parse_template_with_nested_Block_Statement() + { + var fragments = ScriptTemplateUtils.ParseTemplate("BEFORE {{#bold}} Hi, {{#bold}}{{name}}{{/bold}}! {{/bold}} AFTER"); + + Assert.That(fragments.Count, Is.EqualTo(3)); + Assert.That(((PageStringFragment)fragments[0]).Value.ToString(), Is.EqualTo("BEFORE ")); + + var statement = fragments[1] as PageBlockFragment; + Assert.That(statement, Is.Not.Null); + Assert.That(statement.Name, Is.EqualTo("bold")); + Assert.That(statement.Argument.ToString(), Is.EqualTo("")); + + Assert.That(((PageStringFragment)statement.Body[0]).Value.ToString(), Is.EqualTo(" Hi, ")); + + var nested = (PageBlockFragment) statement.Body[1]; + Assert.That(nested.Name, Is.EqualTo("bold")); + Assert.That(((PageVariableFragment)nested.Body[0]).Binding, Is.EqualTo("name")); + + Assert.That(((PageStringFragment)statement.Body[2]).Value.ToString(), Is.EqualTo("! ")); + + Assert.That(((PageStringFragment)fragments[2]).Value.ToString(), Is.EqualTo(" AFTER")); + } + + [Test] + public void Does_parse_Raw_block_body_as_string() + { + var fragments = ScriptTemplateUtils.ParseTemplate("BEFORE {{#raw}} Hi, {{ {{ name }} }} {{/raw}} AFTER"); + + Assert.That(fragments.Count, Is.EqualTo(3)); + Assert.That(((PageStringFragment)fragments[0]).Value.ToString(), Is.EqualTo("BEFORE ")); + + var statement = fragments[1] as PageBlockFragment; + Assert.That(statement, Is.Not.Null); + Assert.That(statement.Name, Is.EqualTo("raw")); + Assert.That(statement.Argument.ToString(), Is.EqualTo("")); + Assert.That(statement.Body.Length, Is.EqualTo(1)); + + Assert.That(((PageStringFragment)statement.Body[0]).Value.ToString(), Is.EqualTo(" Hi, {{ {{ name }} }} ")); + + Assert.That(((PageStringFragment)fragments[2]).Value.ToString(), Is.EqualTo(" AFTER")); + } + + [Test] + public void Does_evaluate_Raw_block_body_as_string() + { + var context = new ScriptContext { + Plugins = { new MarkdownScriptPlugin() } + }.Init(); + + Assert.That(context.EvaluateScript("BEFORE {{#raw}} Hi, {{ {{ name }} }} {{/raw}} AFTER"), + Is.EqualTo("BEFORE Hi, {{ {{ name }} }} AFTER")); + + Assert.That(context.EvaluateScript("BEFORE {{#raw md}}# Heading{{/raw}} AFTER {{ md |> markdown }}").NormalizeNewLines(), + Is.EqualTo("BEFORE AFTER <h1>Heading</h1>")); + } + + [Test] + public void Does_evaluate_Markdown_block_body_as_string() + { + var context = new ScriptContext { + Plugins = { new MarkdownScriptPlugin() } + }.Init(); + + Assert.That(context.EvaluateScript("BEFORE {{#markdown}}# Heading{{/markdown}} AFTER").RemoveNewLines(), + Is.EqualTo("BEFORE <h1>Heading</h1> AFTER")); + + Assert.That(context.EvaluateScript("BEFORE {{#markdown md}}# Heading{{/markdown}} AFTER {{ md }}").NormalizeNewLines(), + Is.EqualTo("BEFORE AFTER <h1>Heading</h1>")); + } + + [Test] + public void Does_evaluate_Raw_block_body_and_appendTo_string() + { + var context = new ScriptContext { + Plugins = { new MarkdownScriptPlugin() } + }.Init(); + + Assert.That(context.EvaluateScript("BEFORE {{#raw appendTo md}}# Heading{{/raw}}{{#raw appendTo md}} Appended{{/raw}} AFTER {{ md |> markdown }}").NormalizeNewLines(), + Is.EqualTo("BEFORE AFTER <h1>Heading Appended</h1>")); + } + + public class ScriptBoldBlock : ScriptBlock + { + public override string Name => "bold"; + + public override async Task WriteAsync(ScriptScopeContext scope, PageBlockFragment block, CancellationToken token) + { + await scope.OutputStream.WriteAsync("<b>", token); + await WriteBodyAsync(scope, block, token); + await scope.OutputStream.WriteAsync("</b>", token); + } + } + + [Test] + public void Does_evaluate_custom_Block_Statement() + { + var context = new ScriptContext { + ScriptBlocks = { new ScriptBoldBlock() }, + Args = { + ["name"] = "World" + } + }.Init(); + + var result = context.EvaluateScript("BEFORE {{#bold}} Hi, {{name}}! {{/bold}} AFTER"); + Assert.That(result, Is.EqualTo("BEFORE <b> Hi, World! </b> AFTER")); + } + + [Test] + public void Does_evaluate_template_with_nested_Block_Statement() + { + var context = new ScriptContext { + ScriptBlocks = { new ScriptBoldBlock() }, + Args = { + ["name"] = "World" + } + }.Init(); + + var result = context.EvaluateScript("BEFORE {{#bold}} Hi, {{#bold}}{{name}}{{/bold}}! {{/bold}} AFTER"); + Assert.That(result, Is.EqualTo("BEFORE <b> Hi, <b>World</b>! </b> AFTER")); + + var template = "BEFORE {{#bold}} Hi, {{#if a == null}}{{#bold}}{{name}}{{/bold}}{{else}}{{a}}{{/if}}! {{/bold}} AFTER"; + + result = context.EvaluateScript(template); + Assert.That(result, Is.EqualTo("BEFORE <b> Hi, <b>World</b>! </b> AFTER")); + + context.Args["a"] = "foo"; + result = context.EvaluateScript(template); + Assert.That(result, Is.EqualTo("BEFORE <b> Hi, foo! </b> AFTER")); + } + + [Test] + public void Does_evaluate_template_with_if_else_statement() + { + var context = new ScriptContext { + Args = { + ["a"] = 1, + ["b"] = 2, + } + }.Init(); + + var template = "BEFORE {{#if a < b}}YES{{else}}NO{{/if}} AFTER"; + + Assert.That(context.EvaluateScript(template), Is.EqualTo("BEFORE YES AFTER")); + + context.Args["a"] = 3; + Assert.That(context.EvaluateScript(template), Is.EqualTo("BEFORE NO AFTER")); + } + + [Test] + public void Does_evaluate_template_with_if_and_else_if_statement() + { + var context = new ScriptContext { + Args = { + ["a"] = 1, + ["b"] = 2, + ["c"] = 3, + ["d"] = 4 + } + }.Init(); + + var template = "BEFORE {{#if a < b}}YES{{else if c < d}}NO{{else}}MAYBE{{/if}} AFTER"; + + Assert.That(context.EvaluateScript(template), Is.EqualTo("BEFORE YES AFTER")); + + context.Args["a"] = 3; + Assert.That(context.EvaluateScript(template), Is.EqualTo("BEFORE NO AFTER")); + + context.Args["c"] = 5; + Assert.That(context.EvaluateScript(template), Is.EqualTo("BEFORE MAYBE AFTER")); + } + + [Test] + public void Does_evaluate_template_containing_with_block() + { + var context = new ScriptContext { + Args = { + ["person"] = new Person { Name = "poco", Age = 27 }, + ["personMap"] = new Dictionary<string, object> { + ["name"] = "map", + ["age"] = 27, + } + } + }.Init(); + + Assert.That(context.EvaluateScript("Person {{#with person}}{{Name}} is {{Age}} years old{{/with}}"), + Is.EqualTo("Person poco is 27 years old")); + + Assert.That(context.EvaluateScript("Person {{#with personMap}}{{name}} is {{age}} years old{{/with}}"), + Is.EqualTo("Person map is 27 years old")); + + Assert.That(context.EvaluateScript("Person {{#with {name:'inline',age:27} }}{{name}} is {{age}} years old{{/with}}"), + Is.EqualTo("Person inline is 27 years old")); + } + + [Test] + public void Does_evaluate_template_containing_with_and_else_block() + { + var context = new ScriptContext { + Args = { + ["person"] = null, + ["personMap"] = new Dictionary<string, object> { + ["name"] = "map", + ["age"] = 27, + } + } + }.Init(); + + Assert.That(context.EvaluateScript("Person {{#with person}}{{Name}} is {{Age}} years old{{else}}does not exist{{/with}}"), + Is.EqualTo("Person does not exist")); + Assert.That(context.EvaluateScript("Person {{#with null}}{{Name}} is {{Age}} years old{{else}}does not exist{{/with}}"), + Is.EqualTo("Person does not exist")); + Assert.That(context.EvaluateScript("Person {{#with person}}{{Name}} is {{Age}} years old{{else if personMap != null}}map does exist{{else}}does not exist{{/with}}"), + Is.EqualTo("Person map does exist")); + } + + public class ScriptSimpleEachBlock : ScriptBlock + { + public override string Name => "each"; + + public override async Task WriteAsync( + ScriptScopeContext scope, PageBlockFragment block, CancellationToken token) + { + var collection = (IEnumerable) block.Argument.GetJsExpressionAndEvaluate(scope, + ifNone: () => throw new NotSupportedException("'each' block does not have a valid expression")); + + var index = 0; + if (collection != null) + { + foreach (var element in collection) + { + var scopeArgs = element.ToObjectDictionary(); + scopeArgs["it"] = element; + scopeArgs[nameof(index)] = index++; + + var itemScope = scope.ScopeWithParams(scopeArgs); + await WriteBodyAsync(itemScope, block, token); + } + } + + if (index == 0) + { + await WriteElseAsync(scope, block.ElseBlocks, token); + } + } + } + + [Test] + public void Does_evaluate_template_with_simple_each_blocks() + { + var context = new ScriptContext { + Args = { + ["numbers"] = new[]{ 1, 2, 3 }, + ["letters"] = new[]{ "A", "B", "C" }, + ["empty"] = new int[]{}, + }, + ScriptBlocks = { + new ScriptSimpleEachBlock(), + new IfScriptBlock(), + } + } + .RemovePlugins(x => x is DefaultScriptBlocks) + .Init(); + + Assert.That(context.EvaluateScript("{{#each numbers}}{{it}} {{/each}}"), Is.EqualTo("1 2 3 ")); + + Assert.That(context.EvaluateScript("{{#each letters}}{{it}} {{/each}}"), Is.EqualTo("A B C ")); + + Assert.That(context.EvaluateScript("{{#each numbers}}{{#if isNumber(it)}}number {{it}} {{else}}letter {{it}} {{/if}}{{/each}}"), + Is.EqualTo("number 1 number 2 number 3 ")); + + Assert.That(context.EvaluateScript("{{#each letters}}{{#if isNumber(it)}}number {{it}} {{else}}letter {{it}} {{/if}}{{/each}}"), + Is.EqualTo("letter A letter B letter C ")); + + Assert.That(context.EvaluateScript("{{#each empty}}{{it}}{{else}}none{{/each}}"), Is.EqualTo("none")); + } + + [Test] + public void Does_evaluate_template_with_each_blocks() + { + var context = new ScriptContext { + Args = { + ["numbers"] = new[]{ 1, 2, 3 }, + ["letters"] = new[]{ "A", "B", "C" }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#each numbers}}{{it}} {{/each}}"), Is.EqualTo("1 2 3 ")); + + Assert.That(context.EvaluateScript("{{#each letters}}{{it}} {{/each}}"), Is.EqualTo("A B C ")); + + Assert.That(context.EvaluateScript("{{#each numbers}}{{#if isNumber(it)}}number {{it}} {{else}}letter {{it}} {{/if}}{{/each}}"), + Is.EqualTo("number 1 number 2 number 3 ")); + + Assert.That(context.EvaluateScript("{{#each letters}}{{#if isNumber(it)}}number {{it}} {{else}}letter {{it}} {{/if}}{{/each}}"), + Is.EqualTo("letter A letter B letter C ")); + } + + [Test] + public void Does_evaluate_template_with_each_else_blocks() + { + var context = new ScriptContext { + Args = { + ["numbers"] = new int[]{}, + ["letters"] = new[]{ "A", "B", "C" }, + ["people"] = new[]{ new Person("name1", 1),new Person("name2", 2),new Person("name3", 3) }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#each numbers}}{{it}} {{else}}no numbers{{/each}}"), + Is.EqualTo("no numbers")); + Assert.That(context.EvaluateScript("{{#each numbers}}{{it}} {{else if !isEmpty(letters)}}has letters{{else}}no numbers{{/each}}"), + Is.EqualTo("has letters")); + Assert.That(context.EvaluateScript("{{#each numbers}}{{it}} {{else if !isEmpty([])}}has letters{{else}}no numbers{{/each}}"), + Is.EqualTo("no numbers")); + } + + [Test] + public void Does_evaluate_template_with_each_where_blocks() + { + var context = new ScriptContext { + Args = { + ["numbers"] = new[]{ 1, 2, 3, 4, 5, }, + ["letters"] = new[]{ "A", "B", "C", "D", "E" }, + ["people"] = new[]{ new Person("name1", 1),new Person("name2", 2),new Person("name3", 3) }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#each numbers where isOdd(it)}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 1, #1 3, #2 5, ")); + Assert.That(context.EvaluateScript("{{#each num in numbers where isOdd(num)}}#{{index}} {{num}}, {{/each}}"), + Is.EqualTo("#0 1, #1 3, #2 5, ")); + Assert.That(context.EvaluateScript("{{#each people where Name == 'name2' and Age == 2 }}#{{index}} {{Name}}, {{Age}}{{/each}}"), + Is.EqualTo("#0 name2, 2")); + Assert.That(context.EvaluateScript("{{#each p in people where p.Name == 'name2' }}#{{index}} {{p.Name}}, {{p.Age}}{{/each}}"), + Is.EqualTo("#0 name2, 2")); + } + + [Test] + public void Does_evaluate_template_with_each_blocks_containing_LINQ_expressions() + { + var context = new ScriptContext { + Args = { + ["numbers"] = new[]{ 4, 5, 1, 3, 2, }, + ["letters"] = new[]{ "C", "D", "B", "E", "A" }, + ["people"] = new[]{ new Person("name3", 3),new Person("name2", 4),new Person("name1", 5),new Person("name5", 1),new Person("name4", 2) }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#each numbers orderby it descending}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 5, #1 4, #2 3, #3 2, #4 1, ")); + Assert.That(context.EvaluateScript("{{#each numbers where isOdd(it) orderby it descending}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 5, #1 3, #2 1, ")); + Assert.That(context.EvaluateScript("{{#each numbers orderby it}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 1, #1 2, #2 3, #3 4, #4 5, ")); + Assert.That(context.EvaluateScript("{{#each numbers where isOdd(it) orderby it}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 1, #1 3, #2 5, ")); + Assert.That(context.EvaluateScript("{{#each n in numbers orderby n}}#{{index}} {{n}}, {{/each}}"), + Is.EqualTo("#0 1, #1 2, #2 3, #3 4, #4 5, ")); + Assert.That(context.EvaluateScript("{{#each n in numbers where isOdd(n) orderby n}}#{{index}} {{n}}, {{/each}}"), + Is.EqualTo("#0 1, #1 3, #2 5, ")); + Assert.That(context.EvaluateScript("{{#each numbers where it % 2 == 1 orderby it skip 1}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 3, #1 5, ")); + Assert.That(context.EvaluateScript("{{#each numbers where it % 2 == 1 orderby it take 2}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 1, #1 3, ")); + Assert.That(context.EvaluateScript("{{#each numbers where it % 2 == 1 orderby it skip 1 take 1}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 3, ")); + + Assert.That(context.EvaluateScript("{{#each letters orderby it}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 A, #1 B, #2 C, #3 D, #4 E, ")); + Assert.That(context.EvaluateScript("{{#each letters where it > 'A' orderby it skip 1 take 2}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 C, #1 D, ")); + Assert.That(context.EvaluateScript("{{#each letters where index > 0 orderby it skip 1 take 2}}#{{index}} {{it}}, {{/each}}"), + Is.EqualTo("#0 B, #1 D, ")); + + Assert.That(context.EvaluateScript("{{#each people where Name > 'name2' orderby Age take 2}}#{{index}} {{Name}}, {{Age}} {{/each}}"), + Is.EqualTo("#0 name5, 1 #1 name4, 2 ")); + Assert.That(context.EvaluateScript("{{#each p in people where p.Name > 'name2' orderby p.Age take 2}}#{{index}} {{p.Name}}, {{p.Age}} {{/each}}"), + Is.EqualTo("#0 name5, 1 #1 name4, 2 ")); + Assert.That(context.EvaluateScript("{{#each p in people where p.Name > 'name2' orderby p.Age descending skip 1 take 2}}#{{index}} {{p.Name}}, {{p.Age}} {{/each}}"), + Is.EqualTo("#0 name4, 2 #1 name5, 1 ")); + } + + [Test] + public void Template_each_blocks_without_in_explodes_ref_type_arguments_into_scope() + { + var context = new ScriptContext { + Args = { + ["people"] = new[]{ new Person("name1", 1),new Person("name2", 2),new Person("name3", 3) }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#each people}}({{Name}},{{Age}}) {{/each}}"), + Is.EqualTo("(name1,1) (name2,2) (name3,3) ")); + } + + [Test] + public void Does_evaluate_template_with_each_in_blocks() + { + var context = new ScriptContext { + Args = { + ["numbers"] = new[]{ 1, 2, 3 }, + ["letters"] = new[]{ "A", "B", "C" }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#each num in numbers}}{{num}} {{/each}}"), Is.EqualTo("1 2 3 ")); + Assert.That(context.EvaluateScript("{{#each num in [1,2,3] }}{{num}} {{/each}}"), Is.EqualTo("1 2 3 ")); + + Assert.That(context.EvaluateScript("{{#each c in letters}}{{c}} {{/each}}"), Is.EqualTo("A B C ")); + Assert.That(context.EvaluateScript("{{#each c in ['A','B','C'] }}{{c}} {{/each}}"), Is.EqualTo("A B C ")); + + Assert.That(context.EvaluateScript("{{#each num in numbers}}{{#if isNumber(num)}}number {{num}} {{else}}letter {{num}} {{/if}}{{/each}}"), + Is.EqualTo("number 1 number 2 number 3 ")); + + Assert.That(context.EvaluateScript("{{#each c in letters}}{{#if isNumber(c)}}number {{c}} {{else}}letter {{c}} {{/if}}{{/each}}"), + Is.EqualTo("letter A letter B letter C ")); + } + + [Test] + public void Does_export_scope_args_of_all_KeyValuePairs() + { + var context = new ScriptContext { + Args = { + ["numbers"] = new Dictionary<string,int> { ["a"] = 1, ["b"] = 2, ["c"] = 3}, + ["letters"] = new Dictionary<string,string> { ["a"] = "A", ["b"] = "B", ["c"] = "C"}, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#each numbers}}{{Key}}={{Value}} {{/each}}"), + Is.EqualTo("a=1 b=2 c=3 ")); + Assert.That(context.EvaluateScript("{{#each {a:1,b:2,c:3} }}{{Key}}={{Value}} {{/each}}"), + Is.EqualTo("a=1 b=2 c=3 ")); + Assert.That(context.EvaluateScript("{{#each letters}}{{Key}}={{Value}} {{/each}}"), + Is.EqualTo("a=A b=B c=C ")); + } + + [Test] + public void Does_export_Key_name_of_all_KeyValuePairs() + { + var context = new ScriptContext { + Args = { + ["posts"] = new List<Dictionary<string, object>> { + new Dictionary<string, object> { + ["title"] = "title1", + ["content"] = "content1", + }, + new Dictionary<string, object> { + ["title"] = "title2", + ["content"] = "content2", + } + }, + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#each posts}}{{title}}={{content}}, {{/each}}"), + Is.EqualTo("title1=content1, title2=content2, ")); + + context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript( + "{{ { title:'title1', content:'content1' } |> addTo: posts}}" + + "{{ { title:'title2', content:'content2' } |> addTo: posts}}" + + "{{#each posts}}{{title}}={{content}}, {{/each}}"), + Is.EqualTo("title1=content1, title2=content2, ")); + } + + [Test] + public void Does_evaluate_template_with_partial_block() + { + var context = new ScriptContext().Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +{{ 'from layout' |> assignTo: layoutArg }} +I am a Layout with page +{{ page }}"); + + context.VirtualFiles.WriteFile("page.html", @" +{{#partial my_partial}} +I am a partial called with the scoped argument <b>{{ arg }}</b> +Who can also access other arguments in scope <b>{{ layoutArg }}</b> +{{/partial}} + +I am a Page with a partial +{{ 'my_partial' |> partial({ arg: 'from page' }) }}".TrimStart()); + + var pageResult = new PageResult(context.GetPage("page")); + + var result = pageResult.Result; + + result.Print(); + + Assert.That(result.Trim(), Is.EqualTo(@"I am a Layout with page + +I am a Page with a partial +I am a partial called with the scoped argument <b>from page</b> +Who can also access other arguments in scope <b>from layout</b>")); + } + + [Test] + public void Does_evaluate_template_with_partial_block_and_args() + { + var context = new ScriptContext().Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +{{ 'from layout' |> assignTo: layoutArg }} +I am a Layout with page +{{ page }}"); + + context.VirtualFiles.WriteFile("page.html", @" +{{#partial my_partial {partialArg: 'from partial'} }} +I am a partial called with the scoped argument <b>{{ arg }}</b> and <b>{{ partialArg }}</b> +Who can also access other arguments in scope <b>{{ layoutArg }}</b> +{{/partial}} + +{{ 'from page' |> assignTo: partialArg }} +I am a Page with a partial +{{ 'my_partial' |> partial({ arg: 'from page' }) }} +partialArg in page scope is <b>{{ partialArg }}</b>".TrimStart()); + + var pageResult = new PageResult(context.GetPage("page")); + + var result = pageResult.Result; + + result.Print(); + + Assert.That(result.Trim(), Is.EqualTo(@"I am a Layout with page + +I am a Page with a partial +I am a partial called with the scoped argument <b>from page</b> and <b>from partial</b> +Who can also access other arguments in scope <b>from layout</b> + +partialArg in page scope is <b>from page</b>")); + } + + [Test] + public void Can_use_partial_to_evaluate_Markdown() + { + var context = new ScriptContext { + Plugins = { new MarkdownScriptPlugin() } + }.Init(); + + var result = context.EvaluateScript(@" +{{#partial content}} + - List Item +{{/partial}} + +<h1>Heading</h1> + +{{ 'content' |> partial |> markdown }} + +<footer>2000</footer>"); + + Assert.That(result.RemoveNewLines(), Is.EqualTo(@" +<h1>Heading</h1> +<ul><li>List Item</li></ul> +<footer>2000</footer>".RemoveNewLines())); + + } + + [Test] + public void Does_evaluate_template_with_noop_block() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("Remove {{#noop}} from{{/noop}}view"), Is.EqualTo("Remove view")); + } + + public class AsyncResultsFilter : ScriptMethods + { + public Task<object> asyncInts(ScriptScopeContext scope) + { + return ((object)new object[]{1, 2, 3}).InTask(); + } + + public Task<object> asyncDictionary(ScriptScopeContext scope) + { + return ((object)new Dictionary<string, object> { {"foo", 1}, {"bar", 2} }).InTask(); + } + + public Task<object> asyncResult(object result) => result.InTask(); + + public Task<object> asyncTrue() => ((object) true).InTask(); + + public Task<object> asyncFalse() => ((object) false).InTask(); + + public Task<object> asyncPerson() => ((object) new Person("foo",1)).InTask(); + } + + [Test] + public void Does_evaluate_async_results_in_blocks() + { + var context = new ScriptContext { + ScriptMethods = { new AsyncResultsFilter() }, + }.Init(); + + Assert.That(context.EvaluateScript("{{#each asyncInts}}{{it}} {{/each}}"), Is.EqualTo("1 2 3 ")); + Assert.That(context.EvaluateScript("{{#each asyncResult([1,2,3])}}{{it}} {{/each}}"), Is.EqualTo("1 2 3 ")); + Assert.That(context.EvaluateScript("{{#each asyncDictionary}}({{Key}},{{Value}}) {{/each}}"), + Is.EqualTo("(foo,1) (bar,2) ")); + + Assert.That(context.EvaluateScript("{{#each []}}{{else if asyncTrue}}does async{{else}}no async{{/each}}"), + Is.EqualTo("does async")); + + Assert.That(context.EvaluateScript("{{#if asyncTrue}}does async{{else}}no async{{/if}}"), + Is.EqualTo("does async")); + + Assert.That(context.EvaluateScript("{{#if asyncFalse}}no async{{else}}does async{{/if}}"), + Is.EqualTo("does async")); + + Assert.That(context.EvaluateScript("{{#with asyncPerson}}({{Name}},{{Age}}) {{/with}}"), + Is.EqualTo("(foo,1) ")); + } + + [Test] + public void Can_capture_output_with_capture_block() + { + var context = new ScriptContext { + Args = { + ["nums"] = new[]{1,2,3} + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#capture output}}{{#each nums}} {{it}}{{/each}}{{/capture}}BEFORE{{output}} AFTER"), + Is.EqualTo("BEFORE 1 2 3 AFTER")); + + Assert.That(context.EvaluateScript("{{#capture output {nums:[4,5,6] }}{{#each nums}} {{it}}{{/each}}{{/capture}}BEFORE{{output}} AFTER"), + Is.EqualTo("BEFORE 4 5 6 AFTER")); + } + + [Test] + public void Can_capture_and_appendTo_output_with_capture_block() + { + var context = new ScriptContext { + Args = { + ["nums"] = new[]{1,2,3} + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#capture appendTo output}} INIT{{/capture}}{{#capture appendTo output}}{{#each nums}} {{it}}{{/each}}{{/capture}}BEFORE{{output}} AFTER"), + Is.EqualTo("BEFORE INIT 1 2 3 AFTER")); + + Assert.That(context.EvaluateScript("{{#capture appendTo output}} INIT{{/capture}}{{#capture appendTo output {nums:[4,5,6] }}{{#each nums}} {{it}}{{/each}}{{/capture}}BEFORE{{output}} AFTER"), + Is.EqualTo("BEFORE INIT 4 5 6 AFTER")); + } + + [Test] + public void Does_evaluate_partial_in_existing_Context() + { + var context = new ScriptContext { + Args = { + ["income"] = 1000 + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#partial p {expenses:100} }} {{income ?? 2000}} - {{expenses}} {{/partial}}{{ 'p' |> partial}}"), + Is.EqualTo(" 1000 - 100 ")); + } + + [Test] + public void Does_evaluate_eval_block_in_new_Context_by_default() + { + var context = new ScriptContext { + ScriptBlocks = { new EvalScriptBlock() }, + Args = { + ["income"] = 1000, + ["incomeExpr"] = "{{income ?? 2000}}", + ["expenseExpr"] = "{{expenses}}", + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#eval {expenses:100} }} {{incomeExpr}} - {{expenses}} {{/eval}}"), + Is.EqualTo(" 2000 - 100 ")); + + Assert.That(context.EvaluateScript("{{ ` ${incomeExpr} - ${expenseExpr} ` |> evalTemplate({expenses:100}) }}"), + Is.EqualTo(" 2000 - 100 ")); + } + + [Test] + public void Does_evaluate_eval_block_in_existing_Context_with_use_context() + { + var context = new ScriptContext { + ScriptBlocks = { new EvalScriptBlock() }, + Args = { + ["income"] = 1000, + ["incomeExpr"] = "{{income ?? 2000}}", + ["expenseExpr"] = "{{expenses}}", + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#eval {use:{context:true},expenses:100} }} {{incomeExpr}} - {{expenses}} {{/eval}}"), + Is.EqualTo(" 1000 - 100 ")); + + Assert.That(context.EvaluateScript("{{ ` ${incomeExpr} - ${expenseExpr} ` |> evalTemplate({use:{context:true},expenses:100}) }}"), + Is.EqualTo(" 1000 - 100 ")); + } + + [Test] + public void Can_include_plugins_into_new_eval_context() + { + var context = new ScriptContext { + ScriptBlocks = { new EvalScriptBlock() }, + Plugins = { new MarkdownScriptPlugin() }, + Args = { + ["evalContent"] = "{{#markdown}}# Heading{{/markdown}}", + } + }.Init(); + + Assert.Throws<ScriptException>(() => + context.EvaluateScript("{{#eval}}{{evalContent}}{{/eval}}")); + Assert.Throws<ScriptException>(() => + context.EvaluateScript("{{ evalContent |> evalTemplate}}")); + + Assert.That(context.EvaluateScript("{{#eval {use:{plugins:'MarkdownScriptPlugin'} }}{{evalContent}}{{/eval}}"), + Is.EqualTo("<h1>Heading</h1>\n")); + + Assert.That(context.EvaluateScript("{{ evalContent |> evalTemplate({use:{plugins:'MarkdownScriptPlugin'}}) |> raw }}"), + Is.EqualTo("<h1>Heading</h1>\n")); + } + + [Test] + public void Can_include_filter_into_new_eval_context() + { + var context = new ScriptContext { + ScriptBlocks = { new EvalScriptBlock() }, + ScriptMethods = { new InfoScripts() }, + Args = { + ["evalContent"] = "{{envServerUserAgent}}", + } + }.Init(); + + Assert.That(context.EvaluateScript("{{#eval}}{{evalContent}}{{/eval}}"), + Does.Not.Contain("ServiceStack")); + Assert.That(context.EvaluateScript("{{ evalContent |> evalTemplate}}"), + Does.Not.Contain("ServiceStack")); + + Assert.That(context.EvaluateScript("{{#eval {use:{filters:'InfoScripts'}}{{evalContent}}{{/eval}}"), + Does.Contain("ServiceStack")); + + Assert.That(context.EvaluateScript("{{ evalContent |> evalTemplate({use:{filters:'InfoScripts'}}) }}"), + Does.Contain("ServiceStack")); + } + + [Test] + public void Can_eval_dynamic_content() + { + var context = new ScriptContext { + ScriptBlocks = { new EvalScriptBlock() }, + Args = { + ["templates"] = new List<string> { + "1. {{income ?? 1000}} - {{expenses}}", + "2. {{income ?? 2000}} - {{expenses}}", + "3. {{income ?? 3000}} - {{expenses}}", + } + } + }.Init(); + + var result = context.EvaluateScript(@"{{#each templates}}{{index}} =>{{#eval {expenses: 100 * index} }} {{it}} {{/eval}}|> {{/each}}"); + Assert.That(result, Is.EqualTo("0 => 1. 1000 - 0 |> 1 => 2. 2000 - 100 |> 2 => 3. 3000 - 200 |> ")); + + result = context.EvaluateScript(@"{{#each templates}}{{index}} =>{{ ` ${it} ` |> evalTemplate({expenses: 100 * index}) }}|> {{/each}}"); + Assert.That(result, Is.EqualTo("0 => 1. 1000 - 0 |> 1 => 2. 2000 - 100 |> 2 => 3. 3000 - 200 |> ")); + } + + [Test] + public void Can_use_minifyjs_script_block() + { + var context = new ScriptContext { + Plugins = { new ServiceStackScriptBlocks() }, + DebugMode = false, + }.Init(); + + var output = context.EvaluateScript("{{#minifyjs}}{{/minifyjs}} {{#minifyjs}} \n{{/minifyjs}}"); + Assert.That(output.Trim(), Is.EqualTo("")); + + output = context.EvaluateScript("{{#minifyjs}}var a = 1; var b = 2;{{/minifyjs}}"); + Assert.That(output.Trim(), Is.EqualTo("var a=1;var b=2;")); + + output = context.EvaluateScript("{{#minifyjs appendTo scripts}}var a = 1; var b = 2;{{/minifyjs}} |> {{#minifyjs appendTo scripts}}function fn ( a ) { }{{/minifyjs}} |> {{scripts}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("|> |> \nvar a=1;var b=2;\nfunction fn(a){}")); + } + + [Test] + public void Can_use_minifycss_script_block() + { + var context = new ScriptContext { + Plugins = { new ServiceStackScriptBlocks() }, + DebugMode = false, + }.Init(); + + var output = context.EvaluateScript("{{#minifycss}} a { width: 1px; } b { height: 1px; } {{/minifycss}}"); + Assert.That(output.Trim(), Is.EqualTo("a{width:1px}b{height:1px}")); + + output = context.EvaluateScript("{{#minifycss appendTo css}} a { width: 1px; } {{/minifycss}} |> {{#minifycss appendTo css}} b { height: 1px; } {{/minifycss}} |> {{css}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("|> |> a{width:1px} b{height:1px}")); + } + + [Test] + public void Can_use_minifyhtml_script_block() + { + var context = new ScriptContext { + Plugins = { new ServiceStackScriptBlocks() }, + DebugMode = false, + }.Init(); + + var output = context.EvaluateScript("{{#minifyhtml}} <h1 > Title </h1> <p > Content </p> {{/minifyhtml}}"); + Assert.That(output.Trim(), Is.EqualTo("<h1> Title </h1> <p> Content </p>")); + + output = context.EvaluateScript("{{#minifyhtml appendTo html}} <h1 > Title </h1> {{/minifyhtml}} |> {{#minifyhtml appendTo html}} <p > Content </p> {{/minifyhtml}} |> {{html |> raw}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("|> |> <h1> Title </h1><p> Content </p>")); + } + + [Test] + public void Can_use_minifyjs_script_block_with_cache() + { + // all js/css/html has same base impl/behavior + + var context = new ScriptContext { + Plugins = { new ServiceStackScriptBlocks() }, + DebugMode = false, + }.Init(); + + var js = "var a = 1; var b = 2;"; + var minified = "var a=1;var b=2;"; + + var output = context.EvaluateScript("{{#minifyjs}}" + js + "{{/minifyjs}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(minified)); + + Assert.That(context.Cache["minifyjs:" + js].ToString().NormalizeNewLines(), Is.EqualTo(minified)); + output = context.EvaluateScript("{{#minifyjs}}" + js + "{{/minifyjs}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(minified)); + + context.Cache.Clear(); + + var js2 = "function fn ( a ) { }"; + var minified2 = "function fn(a){}"; + + output = context.EvaluateScript("{{#minifyjs appendTo scripts}}" + js + "{{/minifyjs}} |> {{#minifyjs appendTo scripts}}" + js2 + "{{/minifyjs}} |> {{scripts}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo($"|> |> \n{minified}\n{minified2}")); + + Assert.That(context.Cache["minifyjs:" + js].ToString().NormalizeNewLines(), Is.EqualTo(minified)); + Assert.That(context.Cache["minifyjs:" + js2].ToString().NormalizeNewLines(), Is.EqualTo(minified2)); + + output = context.EvaluateScript("{{#minifyjs appendTo scripts}}" + js + "{{/minifyjs}} |> {{#minifyjs appendTo scripts}}" + js2 + "{{/minifyjs}} |> {{scripts}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo($"|> |> \n{minified}\n{minified2}")); + } + + [Test] + public void Does_not_minify_or_cache_in_DebugMode() + { + // all js/css/html has same base impl/behavior + + var context = new ScriptContext { + Plugins = { new ServiceStackScriptBlocks() }, + DebugMode = true, + }.Init(); + + var js = "var a = 1; var b = 2;"; + + var output = context.EvaluateScript("{{#minifyjs}}" + js + "{{/minifyjs}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(js)); + + Assert.That(context.Cache.ContainsKey("minifyjs::" + js), Is.False); + output = context.EvaluateScript("{{#minifyjs}}" + js + "{{/minifyjs}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(js)); + } + + [Test] + public void Does_parse_keyvalues() + { + var context = new ScriptContext().Init(); + + var result = context.Evaluate(@" + {{#keyvalues dict}} + Apples 2 + Oranges 3 + {{/keyvalues}}{{dict|return}}"); + + Assert.That(result, Is.EquivalentTo(new Dictionary<string, string> { + {"Apples","2"}, + {"Oranges","3"}, + })); + } + + [Test] + public void Does_parse_keyvalues_with_delimiter() + { + var context = new ScriptContext().Init(); + + var result = context.Evaluate(@" + {{#keyvalues dict ':'}} + Grape Fruit: 2 + Rock Melon: 3 + {{/keyvalues}}{{dict|return}}"); + + Assert.That(result, Is.EquivalentTo(new Dictionary<string, string> { + {"Grape Fruit","2"}, + {"Rock Melon","3"}, + })); + } + + [Test] + public void Does_parse_keyvalues_in_code_blocks() + { + var context = new ScriptContext().Init(); + + var result = context.Evaluate(@" +```code +#keyvalues dict ':' + Apples: 2 + Oranges: 3 + Grape Fruit: 2 + Rock Melon: 3 +/keyvalues +dict |> return +```"); + + Assert.That(result, Is.EquivalentTo(new Dictionary<string, string> { + {"Apples","2"}, + {"Oranges","3"}, + {"Grape Fruit","2"}, + {"Rock Melon","3"}, + })); + } + + [Test] + public void Does_parse_keyvalues_in_code_blocks_with_code_preprocessor() + { + var context = new ScriptContext { + Preprocessors = { ScriptPreprocessors.TransformCodeBlocks } + }.Init(); + + var result = context.Evaluate(@" +```code +#keyvalues dict ':' + * Apples: 2 + * Oranges: 3 + * Grape Fruit: 2 + * Rock Melon: 3 +/keyvalues +dict |> return +```"); + + Assert.That(result, Is.EquivalentTo(new Dictionary<string, string> { + {"Apples","2"}, + {"Oranges","3"}, + {"Grape Fruit","2"}, + {"Rock Melon","3"}, + })); + } + + [Test] + public void Does_parse_csv() + { + var context = new ScriptContext().Init(); + + var result = context.Evaluate(@" + {{#csv list}} + Apples,2,2 + Oranges,3,3 + Grape Fruit,2,2 + Rock Melon,3,3 + {{/csv}}{{list|return}}"); + + Assert.That(result, Is.EquivalentTo(new List<List<string>> { + new List<string> { "Apples", "2", "2" }, + new List<string> { "Oranges", "3", "3" }, + new List<string> { "Grape Fruit", "2", "2" }, + new List<string> { "Rock Melon", "3", "3" }, + })); + } + + [Test] + public void Can_use_while_block() + { + var context = new ScriptContext().Init(); + + var result = context.EvaluateScript(@" +```code +3 |> to => times +#while times > 0 + times + times - 1 |> to => times +/while +```"); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo("3\n2\n1")); + + result = context.EvaluateScript(@" +```code +0 |> to => times +#while times > 0 + times + times - 1 |> to => times +else + `times == 0` +/while +```"); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo("times == 0")); + } + + [Test] + public void Can_use_while_block_single_new_line() + { + var context = new ScriptContext().Init(); + + var result = context.EvaluateScript(@" +```code +3 |> to => times +#while times > 0 + times + times - 1 |> to => times +/while +```".Replace("\r","")); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo("3\n2\n1")); + + result = context.EvaluateScript(@" +```code +0 |> to => times +#while times > 0 + times + times - 1 |> to => times +else + `times == 0` +/while +```".Replace("\r","")); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo("times == 0")); + } + + [Test] + public void Can_use_while_block_with_code_preprocessor() + { + var context = new ScriptContext { + Preprocessors = { ScriptPreprocessors.TransformCodeBlocks } + }.Init(); + + var result = context.EvaluateScript(@" +```code +3 |> to => times +#while times > 0 + times + times - 1 |> to => times +/while +```"); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo("3\n2\n1")); + + result = context.EvaluateScript(@" +```code +0 |> to => times +#while times > 0 + times + times - 1 |> to => times +else + `times == 0` +/while +```"); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo("times == 0")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptCodeTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptCodeTests.cs new file mode 100644 index 00000000000..42e0c152357 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptCodeTests.cs @@ -0,0 +1,1120 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Logging; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptCodeTests + { + static ScriptCodeTests() => LogManager.LogFactory = new ConsoleLogFactory(); + + [OneTimeTearDown] + public void OneTimeTearDown() => LogManager.LogFactory = null; + + [Test] + public void Can_parse_single_and_multi_line_code_statements() + { + var context = new ScriptContext().Init(); + + JsStatement[] ParseCode(string str) + { + var statements = context.ParseCode(str).Statements; + return statements; + } + + JsStatement[] expr; + expr = new[] { + new JsExpressionStatement(new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, + new JsLiteral(2))), + new JsExpressionStatement(new JsBinaryExpression(new JsLiteral(3), JsMultiplication.Operator, + new JsLiteral(4))), + }; + + Assert.That(ParseCode("1 + 2\n3 * 4"), Is.EqualTo(expr)); + Assert.That(ParseCode("1 + 2\n{{ 3 * 4 }}"), Is.EqualTo(expr)); + Assert.That(ParseCode("1 + 2\n {{ 3 * 4 }} "), Is.EqualTo(expr)); + Assert.That(ParseCode("1 + 2\n \n {{ \n 3 * 4 \n }} \n "), Is.EqualTo(expr)); + + expr = new List<JsStatement>(expr) { + new JsExpressionStatement(new JsBinaryExpression(new JsLiteral(5), JsDivision.Operator, + new JsLiteral(6))), + }.ToArray(); + + Assert.That(ParseCode("1 + 2\n \n {{ \n 3 * 4 \n }} \n 5 / 6"), Is.EqualTo(expr)); + Assert.That(ParseCode("1 + 2\n \n {{ \n 3 * 4 \n }} \n {{ 5 / 6 }} "), Is.EqualTo(expr)); + Assert.That(ParseCode("1 + 2\n \n {{ \n 3 * 4 \n }} \n {{ \n 5 / 6 \n }} \n "), Is.EqualTo(expr)); + Assert.That(ParseCode("1 + 2\n \n {{ \n 3\n*\n4 \n }} \n {{ \n 5 \n / \n 6 \n }} \n "), + Is.EqualTo(expr)); + + expr = new[] { + new JsExpressionStatement(new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, + new JsLiteral(2))), + new JsExpressionStatement(new JsLiteral("\n3\n*\n4\n")), + new JsExpressionStatement(new JsLiteral(" 5 \n / \n 6 ")), + }; + Assert.That(ParseCode("1 + 2\n \n {{ \n '\n3\n*\n4\n' \n }} \n {{ \n ' 5 \n / \n 6 ' \n }} \n "), + Is.EqualTo(expr)); + + expr = new[] { + new JsExpressionStatement(new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, + new JsLiteral(2))), + new JsExpressionStatement(new JsTemplateLiteral("\n3\n*\n4\n")), + new JsExpressionStatement(new JsTemplateLiteral(" 5 \n / \n 6 ")), + }; + Assert.That(ParseCode("1 + 2\n \n {{ \n `\n3\n*\n4\n` \n }} \n {{ \n ` 5 \n / \n 6 ` \n }} \n "), + Is.EqualTo(expr)); + + expr = new[] { + new JsExpressionStatement( + new JsConditionalExpression( + new JsBinaryExpression(new JsIdentifier("a"), JsGreaterThan.Operator, new JsLiteral(2)), + new JsConditionalExpression( + new JsCallExpression(new JsMemberExpression(new JsIdentifier("a"), new JsIdentifier("isOdd"))), + new JsLiteral("a > 2 and odd"), + new JsLiteral("a > 2 and even") + ), + new JsConditionalExpression( + new JsCallExpression(new JsMemberExpression(new JsIdentifier("a"), new JsIdentifier("isOdd"))), + new JsLiteral("a <= 2 and odd"), + new JsLiteral("a <= 2 and even") + ) + ) + ), + }; + + Assert.That(ParseCode(@"{{ (a > 2 + ? (a.isOdd() ? 'a > 2 and odd' : 'a > 2 and even') + : (a.isOdd() ? 'a <= 2 and odd' : 'a <= 2 and even')) }}"), Is.EqualTo(expr)); + + Assert.That(ParseCode(@" {{ +(a > 2 + ? +(a.isOdd() ? 'a > 2 and odd' : 'a > 2 and even') + : +(a.isOdd() ? 'a <= 2 and odd' : 'a <= 2 and even')) +}} +"), Is.EqualTo(expr)); + } + + [Test] + public void Can_parse_filter_expressions() + { + var context = new ScriptContext().Init(); + + JsStatement[] ParseCode(string str) + { + var statements = context.ParseCode(str).Statements; + return statements; + } + + + JsStatement[] expr; + + expr = new[] { + new JsFilterExpressionStatement("1 |> add(2)", new JsLiteral(1), + new JsCallExpression(new JsIdentifier("add"), new JsLiteral(2))), + }; + + Assert.That(ParseCode("1 |> add(2)"), Is.EqualTo(expr)); + Assert.That(ParseCode("{{ 1 |> add(2) }}"), Is.EqualTo(expr)); + Assert.That(ParseCode(" \n {{ \n 1 |> add(2) \n }} \n "), Is.EqualTo(expr)); + + expr = new[] { + new JsFilterExpressionStatement("1 \n |> \n add(2)", new JsLiteral(1), + new JsCallExpression(new JsIdentifier("add"), new JsLiteral(2))), + }; + + Assert.That(ParseCode("{{ \n 1 \n |> \n add(2) \n }}"), Is.EqualTo(expr)); + } + + [Test] + public void Can_parse_code_statements_with_blocks() + { + var context = new ScriptContext().Init(); + + JsStatement[] ParseCode(string str) + { + var statements = context.ParseCode(str).Statements; + return statements; + } + + JsStatement[] expr; + expr = new[] { + new JsPageBlockFragmentStatement( + new PageBlockFragment("1", "if", "true", + new JsBlockStatement(new JsExpressionStatement(new JsLiteral(1))) + ) + ) + }; + + Assert.That(ParseCode("#if true\n1\n/if"), Is.EqualTo(expr)); + Assert.That(ParseCode(" #if true \n 1 \n /if "), Is.EqualTo(expr)); + Assert.That(ParseCode(" \n #if true \n \n 1 \n \n /if \n "), Is.EqualTo(expr)); + + expr = new[] { + new JsPageBlockFragmentStatement(new PageBlockFragment("1", "if", "true", + new JsBlockStatement( + new JsPageBlockFragmentStatement( + new PageBlockFragment("1", "if", "a > b", + new JsBlockStatement(new JsExpressionStatement(new JsLiteral(1))) + ) + ) + ) + )) + }; + Assert.That(ParseCode("#if true\n#if a > b\n1\n/if\n/if"), Is.EqualTo(expr)); + Assert.That(ParseCode("#if true \n \n #if a > b \n \n 1 \n \n /if \n \n /if \n \n "), Is.EqualTo(expr)); + + expr = new[] { + new JsPageBlockFragmentStatement(new PageBlockFragment("1", "if", "true", + new JsBlockStatement( + new JsPageBlockFragmentStatement( + new PageBlockFragment("1", "if", "a > b", + new JsBlockStatement(new JsExpressionStatement(new JsLiteral(1))), + new List<PageElseBlock> { + new PageElseBlock("", new JsBlockStatement(new JsExpressionStatement(new JsLiteral(2)))) + } + ) + ) + ), + new List<PageElseBlock> { + new PageElseBlock("", new JsBlockStatement(new JsExpressionStatement(new JsLiteral("3")))) + } + )) + }; + + Assert.That(ParseCode("#if true\n#if a > b\n1\nelse\n2\n/if\nelse\n'3'\n/if"), Is.EqualTo(expr)); + Assert.That(ParseCode("#if true \n \n #if a > b \n \n 1 \n \n else \n \n 2 \n \n /if \n \n else \n \n '3' \n \n /if \n \n "), Is.EqualTo(expr)); + + expr = new[] { + new JsPageBlockFragmentStatement(new PageBlockFragment("", "if", "a > 1", + new JsBlockStatement( + new JsExpressionStatement(new JsLiteral("a > 1")) + ), + new List<PageElseBlock> { + new PageElseBlock("", + new JsBlockStatement( + new JsExpressionStatement(new JsLiteral("a <= 1")) + ) + ) + } + )) + }; + + // Tests \r\n on Windows + Assert.That(ParseCode(@" +#if a > 1 +'a > 1' +else +'a <= 1' +/if +"), Is.EqualTo(expr)); + } + + [Test] + public void Can_parse_verbatim_blocks() + { + var context = new ScriptContext().Init(); + + JsStatement[] ParseCode(string str) + { + var statements = context.ParseCode(str).Statements; + return statements; + } + + JsStatement[] expr; + expr = new[] { + new JsPageBlockFragmentStatement( + new PageBlockFragment("", "raw", "", + new List<PageFragment> { new PageStringFragment("1\n2") } + ) + ) + }; + Assert.That(ParseCode("#raw\n1\n2\n/raw"), Is.EqualTo(expr)); + Assert.That(ParseCode(" \n #raw\n1\n2\n/raw \n "), Is.EqualTo(expr)); + + expr = new[] { + new JsPageBlockFragmentStatement( + new PageBlockFragment("", "raw", "", + new List<PageFragment> { new PageStringFragment(" \n 1\n2 \n ") } + ) + ) + }; + Assert.That(ParseCode("#raw \n \n 1\n2 \n \n /raw"), Is.EqualTo(expr)); + Assert.That(ParseCode(" \n #raw \n \n 1\n2 \n \n /raw \n "), Is.EqualTo(expr)); + + expr = new[] { + new JsPageBlockFragmentStatement( + new PageBlockFragment("", "raw", "a > b", + new List<PageFragment> { new PageStringFragment(" \n 1\n2 \n ") } + ) + ) + }; + Assert.That(ParseCode("#raw a > b\n \n 1\n2 \n \n /raw"), Is.EqualTo(expr)); + Assert.That(ParseCode(" \n #raw a > b \n \n 1\n2 \n \n /raw \n "), Is.EqualTo(expr)); + } + + [Test] + public void Can_Evaluate_code() + { + var context = new ScriptContext().Init(); + + string result = null; + string code = null; + var expected = @"1 <= 2 and odd +2 <= 2 and even +3 > 2 and odd +4 > 2 and even +5 > 2 and odd +".Replace("\r\n","\n"); + + code = @" +#if a > 1 + `${a} > 1` +else + `${a} <= 1` +/if +"; + result = context.RenderCode(code, new Dictionary<string, object> { ["a"] = 2 }); + Assert.That(result.Trim(), Is.EqualTo("2 &gt; 1")); + + code = @" +#if a > 1 + `${a} > 1` |> raw +else + `${a} <= 1` |> raw +/if +"; + + result = context.RenderCode(code, new Dictionary<string, object> { ["a"] = 1 }); + Assert.That(result.Trim(), Is.EqualTo("1 <= 1")); + + code = @" +range(5) |> map => it + 1 |> to => nums +#each a in nums + #if a > 2 + #if a.isOdd() + `${a} > 2 and odd` |> raw + else + `${a} > 2 and even` |> raw + /if + else + #if a.isOdd() + `${a} <= 2 and odd` |> raw + else + `${a} <= 2 and even` |> raw + /if + /if +/each +"; + + result = context.RenderCode(code); + Assert.That(result, Is.EqualTo(expected)); + + code = @" +#function testValue(a) + #if a > 2 + #if a.isOdd() + `${a} > 2 and odd` |> return + else + `${a} > 2 and even` |> return + /if + else + #if a.isOdd() + `${a} <= 2 and odd` |> return + else + `${a} <= 2 and even` |> return + /if + /if +/function + +range(5) |> map => it + 1 |> to => nums +#each nums + it.testValue() |> raw +/each +"; + + result = context.RenderCode(code); + Assert.That(result, Is.EqualTo(expected)); + + code = @" +#function testValue(a) + return (a > 2 ? (a.isOdd() ? `${a} > 2 and odd` : `${a} > 2 and even`) : (a.isOdd() ? `${a} <= 2 and odd` : `${a} <= 2 and even`)) +/function + +range(5) |> map => it + 1 |> to => nums +#each nums + it.testValue() |> raw +/each +"; + + result = context.RenderCode(code); + Assert.That(result, Is.EqualTo(expected)); + + code = @" +#function testValue(a) + {{ return (a > 2 + ? (a.isOdd() ? `${a} > 2 and odd` : `${a} > 2 and even`) + : (a.isOdd() ? `${a} <= 2 and odd` : `${a} <= 2 and even`)) }} +/function + +range(5) |> map => it + 1 |> to => nums +#each nums + it.testValue() |> raw +/each +"; + + result = context.RenderCode(code); + Assert.That(result, Is.EqualTo(expected)); + } + + [Test] + public void Can_evaluate_template_code_in_code_blocks() + { + var context = new ScriptContext().Init(); + + string result = null; + string code = null; + + result = context.RenderCode(@" +{{#if a > 1}} + {{a}} > 1 +{{else}} + {{a}} <= 1 +{{/if}} +", new Dictionary<string, object> { ["a"] = 1 }); + Assert.That(result.Trim(), Is.EqualTo("1 <= 1")); + + result = context.RenderCode(@" + {{#if a > 1}} + {{a}} > 1 + {{else}} + {{a}} <= 1 + {{/if}}", new Dictionary<string, object> { ["a"] = 1 }); + Assert.That(result.Trim(), Is.EqualTo("1 <= 1")); + + result = context.RenderCode(@" +{{#if a > 1}} + {{a}} > 1 +{{else}} + {{a}} <= 1 +{{/if}} + +#if a.isOdd() + ` and is odd` +else + ` and is even` +/if +", new Dictionary<string, object> { ["a"] = 1 }); + Assert.That(result.NormalizeNewLines(), Is.EqualTo("1 <= 1\n and is odd")); + } + + [Test] + public void Can_evaluate_Template_only_blocks_in_code_blocks() + { + var context = new ScriptContext { + Plugins = { new MarkdownScriptPlugin() } + }.Init(); + + var output = context.RenderCode(@" +#capture out +{{#each range(3)}} + - {{it + 1}} +{{/each}} +/capture +out +"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" + - 1 + - 2 + - 3".NormalizeNewLines())); + } + + [Test] + public void Can_execute_existing_Script_Blocks_in_Code_Statements_in_Template_Syntax() + { + var context = new ScriptContext { + DebugMode = true, + Plugins = { + new MarkdownScriptPlugin(), + } + }.Init(); + + string output = null; + object result = null; + + output = context.RenderCode(@" + {{#noop}} + {{#each range(3)}} + - {{it + 1}} + {{/each}} + {{/noop}} + "); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@"")); + + output = context.RenderCode(@" +{{#each range(3)}} + - {{it + 1}} +{{/each}}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" + - 1 + - 2 + - 3".NormalizeNewLines())); + + + output = context.RenderCode(@" +* comment * + +{{#capture text}} +## Title +{{/capture}} + +{{#capture appendTo text}} +{{#each range(3)}} + - {{it + 1}} +{{/each}} +{{/capture}} + +text |> markdown +"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +<h2>Title</h2> +<ul> +<li>1</li> +<li>2</li> +<li>3</li> +</ul>".NormalizeNewLines())); + + result = context.EvaluateCode(@" + {{#keyvalues dict ':'}} + Apples: 2 + Oranges: 3 + Grape Fruit: 2 + Rock Melon: 3 + {{/keyvalues}} + dict |> return + "); + + Assert.That(result, Is.EquivalentTo(new Dictionary<string, string> { + {"Apples","2"}, + {"Oranges","3"}, + {"Grape Fruit","2"}, + {"Rock Melon","3"}, + })); + + result = context.EvaluateCode(@" + {{#csv list}} + Apples,2,2 + Oranges,3,3 + Grape Fruit,2,2 + Rock Melon,3,3 + {{/csv}} + list |> return"); + + Assert.That(result, Is.EquivalentTo(new List<List<string>> { + new List<string> { "Apples", "2", "2" }, + new List<string> { "Oranges", "3", "3" }, + new List<string> { "Grape Fruit", "2", "2" }, + new List<string> { "Rock Melon", "3", "3" }, + })); + + output = context.RenderCode(@" +{{#ul {if:hasAccess, each:items, where:'Age >= 2', class:['nav', !disclaimerAccepted?'blur':''], id:`ul-${id}`} }} + {{#li {class: {alt:isOdd(index), active:Name==highlight} }} + {{Name}} + {{/li}} +{{else}} + <div>no items</div> +{{/ul}}", new Dictionary<string, object> { + ["items"] = new[] {new Person("foo", 1), new Person("bar", 2), new Person("baz", 3)}, + ["id"] = "menu", + ["disclaimerAccepted"] = false, + ["hasAccess"] = true, + ["highlight"] = "baz", + ["digits"] = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }, + }); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +<ul class=""nav blur"" id=""ul-menu""> + <li> + bar + </li> + <li class=""alt active""> + baz + </li> +</ul>".NormalizeNewLines())); + + + output = context.RenderCode(@" +{{#partial content}} + - List Item +{{/partial}} + +'<h1>Title</h1>' |> raw +'content' |> partial |> markdown"); + + Assert.That(output.RemoveNewLines(), Is.EqualTo(@"<h1>Title</h1><ul><li>List Item</li></ul>".RemoveNewLines())); + + output = context.RenderCode(@" +{{#raw content}} +{{ - List Item }} +{{/raw}} + +'# Title' +'{{ - List Item }}'"); + + Assert.That(output.RemoveNewLines(), Is.EqualTo(@"# Title{{ - List Item }}".RemoveNewLines())); + + + output = context.RenderCode(@" +3 |> to => times +{{#while times > 0}} +{{times}} time{{times == 1 ? '' : 's'}} +{{times - 1 |> to => times}} +{{/while}} +"); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo("3 times\n2 times\n1 time")); + + Assert.That(context.RenderCode(@"'Person ' +{{#with person}} +{{Name}} is {{Age}} years old +{{/with}}".NormalizeNewLines(), + new Dictionary<string, object> { + ["person"] = new Person { Name = "poco", Age = 27 }, + }), + Is.EqualTo("Person \npoco is 27 years old\n")); + } + + [Test] + public void Can_execute_existing_Script_Blocks_in_Code_Statements_in_Code_Syntax() + { + var context = new ScriptContext { + DebugMode = true, + Plugins = { + new MarkdownScriptPlugin(), + } + }.Init(); + + string code = null; + string output = null; + object result = null; + + code = @" + #noop + #each range(3) + ` - ${it + 1}` + /each + /noop + "; + Assert.That(context.RenderCode(code).NormalizeNewLines(), Is.EqualTo(@"")); + Assert.That(context.RenderCode(code.Trim()).NormalizeNewLines(), Is.EqualTo(@"")); + + code = @" + #each range(3) + ` - ${it + 1}` + /each"; + Assert.That(context.RenderCode(code).NormalizeNewLines(), Is.EqualTo("- 1\n - 2\n - 3")); + Assert.That(context.RenderCode(code.Trim()).NormalizeNewLines(), Is.EqualTo("- 1\n - 2\n - 3")); + + // Capture requires Template Syntax + + code = @" + #keyvalues dict ':' + Apples: 2 + Oranges: 3 + Grape Fruit: 2 + Rock Melon: 3 + /keyvalues + dict |> return + "; + + result = context.EvaluateCode(code); + Assert.That(result, Is.EquivalentTo(new List<KeyValuePair<string, string>> { + new KeyValuePair<string, string>("Apples","2"), + new KeyValuePair<string, string>("Oranges","3"), + new KeyValuePair<string, string>("Grape Fruit","2"), + new KeyValuePair<string, string>("Rock Melon","3"), + })); + Assert.That(context.EvaluateCode(code.Trim()), Is.EquivalentTo((List<KeyValuePair<string, string>>)result)); + + code = @" + #csv list + Apples,2,2 + Oranges,3,3 + Grape Fruit,2,2 + Rock Melon,3,3 + /csv + list |> return"; + result = context.EvaluateCode(code); + Assert.That(result, Is.EquivalentTo(new List<List<string>> { + new List<string> { "Apples", "2", "2" }, + new List<string> { "Oranges", "3", "3" }, + new List<string> { "Grape Fruit", "2", "2" }, + new List<string> { "Rock Melon", "3", "3" }, + })); + Assert.That(context.EvaluateCode(code.Trim()), Is.EquivalentTo((List<List<string>>)result)); + + // HTML Scripts requires Template Syntax + + // Partial requires Template Syntax + + code = @" +#raw content +{{ - List Item }} +/raw + +'# Title' +'{{ - List Item }}'"; + + Assert.That(context.RenderCode(code).RemoveNewLines(), Is.EqualTo(@"# Title{{ - List Item }}".RemoveNewLines())); + Assert.That(context.RenderCode(code.Trim()).RemoveNewLines(), Is.EqualTo(@"# Title{{ - List Item }}".RemoveNewLines())); + + + code = @" + 3 |> to => times + #while times > 0 + `${times} time${times == 1 ? '' : 's'}` + times - 1 |> to => times + /while"; + + Assert.That(context.RenderCode(code).NormalizeNewLines(), Is.EqualTo("3 times\n2 times\n1 time")); + Assert.That(context.RenderCode(code.Trim()).NormalizeNewLines(), Is.EqualTo("3 times\n2 times\n1 time")); + + code = @"'Person ' + #with person + `${Name} is ${Age} years old` + /with"; +; + Assert.That(context.RenderCode(code, + new Dictionary<string, object> { + ["person"] = new Person {Name = "poco", Age = 27}, + }), + Is.EqualTo("Person \npoco is 27 years old\n")); + Assert.That(context.RenderCode(code.Trim(), + new Dictionary<string, object> { + ["person"] = new Person {Name = "poco", Age = 27}, + }), + Is.EqualTo("Person \npoco is 27 years old\n")); + } + + [Test] + public void Can_execute_existing_Script_Blocks_in_Code_Statements_in_Code_Syntax_only_LF() + { + var context = new ScriptContext { + DebugMode = true, + Plugins = { + new MarkdownScriptPlugin(), + } + }.Init(); + + string code = null; + string output = null; + object result = null; + + code = @" + #noop + #each range(3) + ` - ${it + 1}` + /each + /noop + "; + output = context.RenderCode(code.Replace("\r","")); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@"")); + output = context.RenderCode(code.Trim().Replace("\r","")); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@"")); + + code = @" + #each range(3) + ` - ${it + 1}` + /each".Replace("\r", ""); + Assert.That(context.RenderCode(code).NormalizeNewLines(), Is.EqualTo("- 1\n - 2\n - 3")); + Assert.That(context.RenderCode(code.Trim()).NormalizeNewLines(), Is.EqualTo("- 1\n - 2\n - 3")); + + // Capture requires Template Syntax + + code = @" + #keyvalues dict ':' + Apples: 2 + Oranges: 3 + Grape Fruit: 2 + Rock Melon: 3 + /keyvalues + dict |> return + ".Replace("\r", ""); + var expectedKeyValues = new Dictionary<string, string> { + {"Apples", "2"}, + {"Oranges", "3"}, + {"Grape Fruit", "2"}, + {"Rock Melon", "3"}, + }; + Assert.That(context.EvaluateCode(code), Is.EquivalentTo(expectedKeyValues)); + Assert.That(context.EvaluateCode(code.Trim()), Is.EquivalentTo(expectedKeyValues)); + + result = context.EvaluateCode(@" + #csv list + Apples,2,2 + Oranges,3,3 + Grape Fruit,2,2 + Rock Melon,3,3 + /csv + list |> return".Replace("\r","")); + + Assert.That(result, Is.EquivalentTo(new List<List<string>> { + new List<string> { "Apples", "2", "2" }, + new List<string> { "Oranges", "3", "3" }, + new List<string> { "Grape Fruit", "2", "2" }, + new List<string> { "Rock Melon", "3", "3" }, + })); + + // HTML Scripts requires Template Syntax + + // Partial requires Template Syntax + + code = @" +#raw content +{{ - List Item }} +/raw + +'# Title' +'{{ - List Item }}'".Replace("\r", ""); + Assert.That(context.RenderCode(code).RemoveNewLines(), Is.EqualTo(@"# Title{{ - List Item }}".RemoveNewLines())); + Assert.That(context.RenderCode(code.Trim()).RemoveNewLines(), Is.EqualTo(@"# Title{{ - List Item }}".RemoveNewLines())); + + + code = @" + 3 |> to => times + #while times > 0 + `${times} time${times == 1 ? '' : 's'}` + times - 1 |> to => times + /while".Replace("\r", ""); + Assert.That(context.RenderCode(code).NormalizeNewLines(), Is.EqualTo("3 times\n2 times\n1 time")); + Assert.That(context.RenderCode(code.Trim()).NormalizeNewLines(), Is.EqualTo("3 times\n2 times\n1 time")); + + code = @" + 'Person ' + #with person + `${Name} is ${Age} years old` + /with + ".Replace("\r", ""); + + Assert.That(context.RenderCode(code, + new Dictionary<string, object> { + ["person"] = new Person { Name = "poco", Age = 27 }, + }).NormalizeNewLines(), + Is.EqualTo("Person \npoco is 27 years old")); + Assert.That(context.RenderCode(code.Trim(), + new Dictionary<string, object> { + ["person"] = new Person { Name = "poco", Age = 27 }, + }).NormalizeNewLines(), + Is.EqualTo("Person \npoco is 27 years old")); + } + + [Test] + public void Can_use_multi_line_comments_in_code_statements() + { + var context = new ScriptContext().Init(); + + var output = context.RenderCode(@" +`some` + +{{* this is + a multi-line + comment *}} + +`text`"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("some\ntext")); + + output = context.RenderCode(@" +`some` + + {{* + this is + a multi-line + comment + *}} + +`text`"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("some\ntext")); + + output = context.RenderCode(@" +`some` + + {{* + this is + a {{ multi-line }} +{{ comment }} }} + *}} + +`text`"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("some\ntext")); + + output = context.RenderCode(@" + `some` + {{* this is a single-line comment *}} + `text`"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("some\ntext")); + } + + [Test] + public void Can_execute_code_statements_quietly() + { + var context = new ScriptContext().Init(); + + string template (string block) => "```" + block + @" + 3 |> to => times + #while times > 0 + `${times} time${times == 1 ? '' : 's'}` + times - 1 |> to => times + /while + ``` +remaining={{times}}"; + + Assert.That(context.EvaluateScript(template("code")).NormalizeNewLines(), + Is.EqualTo("3 times\n2 times\n1 time\nremaining=0")); + + Assert.That(context.EvaluateScript(template("code|quiet")).NormalizeNewLines(), + Is.EqualTo("remaining=0")); + Assert.That(context.EvaluateScript(template("code|q")).NormalizeNewLines(), + Is.EqualTo("remaining=0")); + Assert.That(context.EvaluateScript(template("code|mute")).NormalizeNewLines(), + Is.EqualTo("remaining=0")); + } + + void AssertFizzBuzzOutput(string output) + { + Assert.That(output.NormalizeNewLines(), Does.StartWith(@" +1 +2 +Fizz +4 +Buzz +Fizz +7 +8 +Fizz +Buzz +11 +Fizz +13 +14 +FizzBuzz".NormalizeNewLines())); + } + + [Test] + public void Can_eval_FizzBuzz_Script() + { + var context = new ScriptContext().Init(); + + string src = @" +{{#each range(1,100)}} +{{#if it % 3 == 0 && it % 5 == 0}} +FizzBuzz +{{else if it % 3 == 0}} +Fizz +{{else if it % 5 == 0}} +Buzz +{{else}} +{{it}} +{{/if}} +{{/each}} +"; + var output = context.RenderScript(src); + AssertFizzBuzzOutput(output); + } + + [Test] + public void Can_eval_FizzBuzz_Code() + { + var context = new ScriptContext().Init(); + + string src = @" +#each range(1,100) + #if it % 3 == 0 && it % 5 == 0 + 'FizzBuzz' + else if it % 3 == 0 + 'Fizz' + else if it % 5 == 0 + 'Buzz' + else + it + /if +/each +"; + var output = context.RenderCode(src); + AssertFizzBuzzOutput(output); + + src = @" +#function fizzbuzz(it) + #if it % 3 == 0 && it % 5 == 0 + 'FizzBuzz' |> return + else if it % 3 == 0 + 'Fizz' |> return + else if it % 5 == 0 + 'Buzz' |> return + else + it |> return + /if +/function + +#each range(1,100) + fizzbuzz(it) +/each +"; + + output = context.RenderCode(src); + AssertFizzBuzzOutput(output); + } + + [Test] + public void Can_eval_FizzBuzz_Lisp() + { + var context = new ScriptContext { + ScriptLanguages = { ScriptLisp.Language } + }.Init(); + + string src = @" +(doseq (i (range 1 100)) + (println + (cond ((and (zero? (mod i 3)) (zero? (mod i 5))) ""FizzBuzz"") + ((zero? (mod i 3)) ""Fizz"") + ((zero? (mod i 5)) ""Buzz"") + (t i)) + ))"; + var output = context.RenderLisp(src); + AssertFizzBuzzOutput(output); + + src = @" +(defn fizzbuzz [i] + (cond ((and (zero? (mod i 3)) (zero? (mod i 5))) ""FizzBuzz"") + ((zero? (mod i 3)) ""Fizz"") + ((zero? (mod i 5)) ""Buzz"") + (t i))) + +(dorun println (map fizzbuzz (range 1 100))) +"; + + output = context.RenderLisp(src); + AssertFizzBuzzOutput(output); + } + + [Test] + public void Can_eval_FizzBuzz_combined() + { + var context = new ScriptContext { + ScriptLanguages = { ScriptLisp.Language }, + Plugins = { + new MarkdownScriptPlugin() + } + }.Init(); + + string src = @" +{{#defn fizzbuzz [i] }} + (cond ((and (zero? (mod i 3)) (zero? (mod i 5))) ""FizzBuzz"") + ((zero? (mod i 3)) ""Fizz"") + ((zero? (mod i 5)) ""Buzz"") + (t i)) +{{/defn}} + +{{#capture md}} +## FizzBuzz: +{{#each range(1,100) }} + - {{ fizzbuzz(it) }} +{{/each}} +{{/capture}} + +{{ md |> markdown }} +"; + + var output = context.RenderScript(src); + Assert.That(output.NormalizeNewLines(), Does.StartWith(@" +<h2>FizzBuzz:</h2> +<ul> +<li>1</li> +<li>2</li> +<li>Fizz</li> +<li>4</li> +<li>Buzz</li> +<li>Fizz</li> +<li>7</li> +<li>8</li> +<li>Fizz</li> +<li>Buzz</li> +<li>11</li> +<li>Fizz</li> +<li>13</li> +<li>14</li> +<li>FizzBuzz</li>".NormalizeNewLines())); + } + + const string TemplateMix = @" +Template: +{{#each range(1,15) }} +{{#if it % 3 == 0 && it % 5 == 0}} + FizzBuzz +{{else if it % 3 == 0}} + Fizz +{{else if it % 5 == 0}} + Buzz +{{else}} + {{it}} +{{/if}} +{{/each}} + +Code: +```code +#each range(1,15) + #if it % 3 == 0 && it % 5 == 0 + ""FizzBuzz"" + else if it % 3 == 0 + ""Fizz"" + else if it % 5 == 0 + ""Buzz"" + else + it + /if +/each +``` + +Lisp: +```lisp +(defn fizzbuzz [i] + (cond ((and (zero? (mod i 3)) (zero? (mod i 5))) ""FizzBuzz"") + ((zero? (mod i 3)) ""Fizz"") + ((zero? (mod i 5)) ""Buzz"") + (t i))) + +(dorun println (map fizzbuzz (range 1 15))) +``` +"; + [Test] + public void Can_use_multiple_code_blocks() + { + var context = new ScriptContext { + ScriptLanguages = { ScriptLisp.Language } + }; + + context.VirtualFiles.WriteFile("page.html", "{{#raw template}}\n" + + TemplateMix + + @"{{/raw}} + {{template}}"); + context.Init(); + + var output = context.RenderScript(TemplateMix); + Assert.That(output.NormalizeNewLines(), Does.Contain(@"Lisp: +1 +2 +Fizz".NormalizeNewLines())); + + var pageResult = new PageResult(context.GetPage("page")); + output = pageResult.RenderScript(); + Assert.That(output, Does.Contain("#each range(1,15)")); + Assert.That(output, Does.Contain("(defn fizzbuzz [i]")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptDelegateTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptDelegateTests.cs new file mode 100644 index 00000000000..4045e0dd89d --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptDelegateTests.cs @@ -0,0 +1,271 @@ +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Testing; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ClassTypeName + { + private readonly string fullTypeName; + public ClassTypeName(object instance) + { + fullTypeName = ProtectedScripts.Instance.typeQualifiedName(instance.GetType()); + } + + public override string ToString() => fullTypeName; + } + + + public class ScriptDelegateTests + { + static string Hi() => "static fn"; + + [Test] + public void Can_call_delegates_as_function() + { + var context = new ScriptContext().Init(); + + var result = context.EvaluateScript("{{ fn() }}", new ObjectDictionary { + ["fn"] = (Func<string>) Hi + }); + + Assert.That(result, Is.EqualTo("static fn")); + + Func<string> hi = () => "instance fn"; + + result = context.EvaluateScript("{{ fn() }}", new ObjectDictionary { + ["fn"] = hi + }); + + Assert.That(result, Is.EqualTo("instance fn")); + } + + [Test] + public void Can_call_delegates_with_args_as_function() + { + Func<int, int, int> add = (a, b) => a + b; + + var context = new ScriptContext { + Args = { + ["fn"] = add + } + }.Init(); + + var result = context.EvaluateScript("{{ fn(1,2) }}"); + + Assert.That(result, Is.EqualTo("3")); + + result = context.EvaluateScript("{{ 1.fn(2) }}"); + + Assert.That(result, Is.EqualTo("3")); + } + + [Test] + public void Can_call_delegates_with_args_as_ext_methods() + { + var context = new ScriptContext().Init(); + + Func<int, int, int> add = (a, b) => a + b; + + var result = context.EvaluateScript("{{ 1.fn(2) }}", new ObjectDictionary { + ["fn"] = add + }); + + Assert.That(result, Is.EqualTo("3")); + } + + [Test] + public void Can_use_function_block_to_create_delegate_and_invoke_it() + { + var context = new ScriptContext().Init(); + + var result = context.EvaluateScript("{{#function hi}}'hello' |> return{{/function}}{{ hi() }}"); + + Assert.That(result, Is.EqualTo("hello")); + } + + [Test] + public void Can_use_function_block_to_create_delegate_with_multiple_args_and_invoke_it() + { + var context = new ScriptContext().Init(); + + var result = context.Evaluate(@" + {{#function calc(a,b) }} + a * b |> to => c + a + b + c |> return + {{/function}} + {{ calc(1,2) |> return }}"); + + Assert.That(result, Is.EqualTo(5)); + + result = context.Evaluate(@" + {{#function calc(a,b) }} + a * b |> to => c + a + b + c |> return + {{/function}} + {{ 1.calc(2) |> return }}"); + + Assert.That(result, Is.EqualTo(5)); + } + + [Test] + public void Can_use_function_block_to_create_delegate_with_multiple_args_and_invoke_it_LISP() + { + var context = new ScriptContext { + ScriptLanguages = { ScriptLisp.Language }, + }.Init(); + + var result = context.Evaluate(@" + {{#defn calc [a, b] }} + (let ( (c (* a b)) ) + (+ a b c) + ) + {{/defn}} + {{ calc(3,4) }} + {{ calc(1,2) |> return }}"); + + Assert.That(result, Is.EqualTo(5)); + + result = context.Evaluate(@" + {{#defn calc [a, b] }} + (let ( (c (* a b)) ) + (+ a b c) + ) + {{/defn}} + {{ calc(3,4) }} + {{ calc(1,2) |> return }}"); + + Assert.That(result, Is.EqualTo(5)); + + result = context.Evaluate(@" + {{#defn fib [n] }} + (if (<= n 1) + n + (+ (fib (- n 1)) + (fib (- n 2)) )) + {{/defn}} + {{ 10.fib() |> return }}"); + + Assert.That(result, Is.EqualTo(55)); + } + + [Test] + public void Does_not_Exceed_MaxStackDepth() + { + var context = new ScriptContext().Init(); + + string template(int depth) => @" + {{#function fib(num) }} + #if num <= 1 + return(num) + /if + return (fib(num-1) + fib(num-2)) + {{/function}} + {{ fib(" + depth + ") |> return }}"; + + var result = context.Evaluate<int>(template(10)); + + Assert.That(result, Is.EqualTo(55)); + + Assert.That(context.MaxStackDepth, Is.EqualTo(25)); + + result = context.Evaluate<int>(template(context.MaxStackDepth - 1)); + + Assert.That(result, Is.EqualTo(46368)); + + try + { + result = context.Evaluate<int>(template(context.MaxStackDepth + 1)); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + e.GetType().Name.Print(); + e.Message.Print(); + if (!(e.InnerException is StackOverflowException)) + throw; + } + } + + static string staticTypeName(object o) => ProtectedScripts.Instance.typeQualifiedName(o.GetType()); + + [Test] + public void Can_call_Delegates_in_filter_expression() + { + Func<object, string> typeName = o => + ProtectedScripts.Instance.typeQualifiedName(o.GetType()); + + var context = new ScriptContext { + Args = { + ["fn"] = typeName, + ["staticfn"] = (Func<object, string>) staticTypeName, + }, + ScriptMethods = { new ProtectedScripts() }, + AllowScriptingOfAllTypes = true + }.Init(); + + + string result = null; + result = context.Evaluate<string>(@" + {{#function info(o) }} + o |> getType |> typeQualifiedName |> return + {{/function}} + {{ 'System.Text.StringBuilder'.new() |> info |> return }}"); + Assert.That(result, Is.EqualTo("System.Text.StringBuilder")); + + result = context.Evaluate<string>( + "{{ 'System.Text.StringBuilder'.new() |> fn |> return }}"); + Assert.That(result, Is.EqualTo("System.Text.StringBuilder")); + + result = context.Evaluate<string>( + "{{ 'System.Text.StringBuilder'.new() |> staticfn |> return }}"); + Assert.That(result, Is.EqualTo("System.Text.StringBuilder")); + + result = context.Evaluate<string>( + @" + {{ Constructor('ServiceStack.WebHost.Endpoints.Tests.ScriptTests.ClassTypeName(string)') |> to => ctorfn }} + {{ 'System.Text.StringBuilder'.new() |> ctorfn |> toString |> return }}"); + Assert.That(result, Is.EqualTo("System.Text.StringBuilder")); + } + + public class CustomMethods : ScriptMethods + { + public static int Counter = 0; + public string chooseColor(ScriptScopeContext scope) => chooseColor(scope, "#ffffff"); + public string chooseColor(ScriptScopeContext scope, string defaultColor) + { + Counter++; + return defaultColor; + } + } + + [Test] + public async Task Only_call_EvaluateCode_method_once() + { + CustomMethods.Counter = 0; + var context = new ScriptContext { + ScriptMethods = { new CustomMethods() }, + }.Init(); + + var fn = ScriptCodeUtils.EnsureReturn("chooseColor(`#336699`)"); + var ret = await context.EvaluateCodeAsync(fn); + Assert.That(ret, Is.EqualTo("#336699")); + Assert.That(CustomMethods.Counter, Is.EqualTo(1)); + + CustomMethods.Counter = 0; + fn = ScriptCodeUtils.EnsureReturn("chooseColor"); + ret = await context.EvaluateCodeAsync(fn); + Assert.That(ret, Is.EqualTo("#ffffff")); + Assert.That(CustomMethods.Counter, Is.EqualTo(1)); + + CustomMethods.Counter = 0; + fn = ScriptCodeUtils.EnsureReturn("chooseColor()"); + ret = await context.EvaluateCodeAsync(fn); + Assert.That(ret, Is.EqualTo("#ffffff")); + Assert.That(CustomMethods.Counter, Is.EqualTo(1)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptHtmlFilterTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptHtmlFilterTests.cs new file mode 100644 index 00000000000..29ae3f6c2f6 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptHtmlFilterTests.cs @@ -0,0 +1,216 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptHtmlFilterTests + { + [Test] + public void Can_call_htmlList_with_empty_arg() + { + var context = new ScriptContext + { + Args = + { + ["arg"] = new List<Dictionary<string,object>> + { + new Dictionary<string, object>{ { "a", 1 } } + }, + ["emptyArg"] = new List<Dictionary<string,object>>() + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ arg |> htmlList }}"), + Is.EqualTo("<table class=\"table\"><thead><tr><th>a</th></tr></thead><tbody><tr><td>1</td></tr></tbody></table>")); + + Assert.That(context.EvaluateScript("{{ arg |> htmlList() }}"), + Is.EqualTo("<table class=\"table\"><thead><tr><th>a</th></tr></thead><tbody><tr><td>1</td></tr></tbody></table>")); + + Assert.That(context.EvaluateScript("{{ arg |> htmlList({}) }}"), + Is.EqualTo("<table class=\"table\"><thead><tr><th>a</th></tr></thead><tbody><tr><td>1</td></tr></tbody></table>")); + + Assert.That(context.EvaluateScript("{{ arg |> htmlList({ }) }}"), + Is.EqualTo("<table class=\"table\"><thead><tr><th>a</th></tr></thead><tbody><tr><td>1</td></tr></tbody></table>")); + + Assert.That(context.EvaluateScript("{{ emptyArg |> htmlList }}"), Is.EqualTo("")); + + Assert.That(context.EvaluateScript("{{ emptyArg |> htmlList({ captionIfEmpty: 'no rows' }) }}"), + Is.EqualTo("<table class=\"table\"><caption>no rows</caption></table>")); + } + + [Test] + public void Can_render_simple_table() + { + var context = new ScriptContext + { + Args = + { + ["rockstars"] = new List<Dictionary<string,object>> + { + new Dictionary<string, object>{ {"FirstName", "Kurt" }, { "Age", 27 } }, + new Dictionary<string, object>{ {"FirstName", "Jimi" }, { "Age", 27 } }, + } + } + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ rockstars |> htmlDump({ className: ""table table-striped"", caption: ""Rockstars"" }) }}"), + Is.EqualTo(@"<table class=""table table-striped""><caption>Rockstars</caption><thead><tr><th>First Name</th><th>Age</th></tr></thead><tbody><tr><td>Kurt</td><td>27</td></tr><tr><td>Jimi</td><td>27</td></tr></tbody></table>")); + + Assert.That(context.EvaluateScript(@"{{ [] |> htmlDump({ captionIfEmpty: ""No Rocksars""}) }}"), + Is.EqualTo("<table class=\"table\"><caption>No Rocksars</caption></table>")); + } + + [Test] + public void Can_render_complex_object_graph_with_htmldump() + { + var context = new ScriptContext + { + Args = + { + ["customers"] = QueryData.Customers, + ["htmlOptions"] = new Dictionary<string, object> + { + { "className", "table" }, + { "childClass", "table-striped" }, + { "childDepth", 3 }, + } + } + }.Init(); + + "<div id=htmldump>".Print(); + + "<h3>3x Customers:</h3>".Print(); + context.EvaluateScript("{{ customers |> take(3) |> htmlDump(htmlOptions) }}").Print(); + + "<h3>Customer:</h3>".Print(); + context.EvaluateScript("{{ customers |> first |> htmlDump(htmlOptions) }}").Print(); + + "<h3>Orders:</h3>".Print(); + context.EvaluateScript("{{ customers |> first |> property('Orders') |> htmlDump(htmlOptions) }}").Print(); + + "<h3>Order:</h3>".Print(); + context.EvaluateScript("{{ customers |> first |> property('Orders') |> get(0) |> htmlDump(htmlOptions) }}").Print(); + + "<h3>Order Date:</h3>".Print(); + context.EvaluateScript("{{ customers |> first |> property('Orders') |> get(0) |> property('OrderDate') |> htmlDump(htmlOptions) }}").Print(); + + "</div>".Print(); + } + + [Test] + public void Can_execute_custom_html_tags_with_primary_content_usage() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 'http://example.org' |> htmlLink }}"), Is.EqualTo("<a href=\"http://example.org\">http://example.org</a>")); + Assert.That(context.EvaluateScript("{{ 'http://example.org' |> htmlLink({ text:'link' }) }}"), Is.EqualTo("<a href=\"http://example.org\">link</a>")); + Assert.That(context.EvaluateScript("{{ 'logo.png' |> htmlImage }}"), Is.EqualTo("<img src=\"logo.png\">")); + Assert.That(context.EvaluateScript("{{ 'logo.png' |> htmlImage({ alt:'alt text' }) }}"), Is.EqualTo("<img alt=\"alt text\" src=\"logo.png\">")); + } + + [Test] + public void Can_execute_htmlTag_filters() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ '<h1>title</h1>' |> htmlA({ href:'#' }) }}"), Is.EqualTo("<a href=\"#\"><h1>title</h1></a>")); + Assert.That(context.EvaluateScript("{{ { src:'logo.png', alt:'alt text' } |> htmlImg }}"), Is.EqualTo("<img alt=\"alt text\" src=\"logo.png\">")); + } + + [Test] + public void htmlTag_filters_does_convert_reserved_js_keywords() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ '<h1>title</h1>' |> htmlA({ href:'#', className:'cls' }) }}"), Is.EqualTo("<a class=\"cls\" href=\"#\"><h1>title</h1></a>")); + Assert.That(context.EvaluateScript("{{ { src:'logo.png', alt:'alt text', className:'cls' } |> htmlImg }}"), Is.EqualTo("<img alt=\"alt text\" class=\"cls\" src=\"logo.png\">")); + Assert.That(context.EvaluateScript("{{ 'text' |> htmlLabel({ htmlFor:'id' }) }}"), Is.EqualTo("<label for=\"id\">text</label>")); + } + + [Test] + public void Can_send_text_content_to_html_tags_primarily_used_with_text() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ 'text' |> htmlEm }}"), Is.EqualTo("<em>text</em>")); + Assert.That(context.EvaluateScript("{{ 'text' |> htmlB }}"), Is.EqualTo("<b>text</b>")); + Assert.That(context.EvaluateScript("{{ 'text' |> htmlB({ class:'cls' }) }}"), Is.EqualTo("<b class=\"cls\">text</b>")); + Assert.That(context.EvaluateScript("{{ 'text' |> htmlOption }}"), Is.EqualTo("<option>text</option>")); + Assert.That(context.EvaluateScript("{{ 'text' |> htmlOption({ value:'val' }) }}"), Is.EqualTo("<option value=\"val\">text</option>")); + + Assert.That(context.EvaluateScript("{{ ['A','B','C'] |> map('htmlOption(it)') |> join('') |> htmlSelect({ name:'sel' }) }}"), + Is.EqualTo("<select name=\"sel\"><option>A</option><option>B</option><option>C</option></select>")); + } + + [Test] + public void Can_generate_html_with_bindings() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ ['A','B','C'] |> map('htmlOption(it, { value: it })') |> join('') |> htmlSelect({ name:'sel' }) }}"), + Is.EqualTo("<select name=\"sel\"><option value=\"A\">A</option><option value=\"B\">B</option><option value=\"C\">C</option></select>")); + + Assert.That(context.EvaluateScript("{{ ['A','B','C'] |> map('htmlOption(it, { value: it })') |> join('') |> htmlSelect({ name:'sel' }) }}"), + Is.EqualTo("<select name=\"sel\"><option value=\"A\">A</option><option value=\"B\">B</option><option value=\"C\">C</option></select>")); + } + + [Test] + public void Does_generate_class_list_with_htmlClass() + { + var context = new ScriptContext { + Args = { + ["index"] = 1, + ["name"] = "foo", + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ {alt:isOdd(index), active:'foo'==name } |> htmlClass }}"), + Is.EqualTo(" class=\"alt active\"")); + Assert.That(context.EvaluateScript("{{ {alt:isEven(index), active:'bar'==name } |> htmlClass }}"), + Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ [isOdd(index) ? 'odd': 'even', 'foo'==name ? 'active' : ''] |> htmlClass }}"), + Is.EqualTo(" class=\"odd active\"")); + Assert.That(context.EvaluateScript("{{ [isOdd(index+1) ? 'odd': 'even', 'bar'==name ? 'active' : ''] |> htmlClass }}"), + Is.EqualTo(" class=\"even\"")); + + Assert.That(context.EvaluateScript("{{ 'hide' |> if(!disclaimerAccepted) |> htmlClass }}"), + Is.EqualTo(" class=\"hide\"")); + } + + [Test] + public void HtmlAttrs_with_bool_only_emits_name() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("<option {{ {selected:true,test:'val'} |> htmlAttrs }}>"), + Is.EqualTo("<option selected test=\"val\">")); + + Assert.That(context.EvaluateScript("<option {{ {selected:false,test:'val'} |> htmlAttrs }}>"), + Is.EqualTo("<option test=\"val\">")); + } + + [Test] + public void Does_htmlDump_singleRow() + { + var context = new ScriptContext { + Args = { + ["rows"] = new List<Dictionary<string, object>> { + new Dictionary<string, object> { + ["Id"] = 1, + ["Name"] = "foo", + ["None"] = DBNull.Value, + } + } + } + }.Init(); + + var output = context.EvaluateScript("{{ rows |> htmlDump }}"); +// output.Print(); + Assert.That(output, Does.Contain( + "<tr><th>Id</th><td>1</td></tr><tr><th>Name</th><td>foo</td></tr><tr><th>None</th><td></td></tr>")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLangTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLangTests.cs new file mode 100644 index 00000000000..c74d86b3ea1 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLangTests.cs @@ -0,0 +1,42 @@ +using NUnit.Framework; +using ServiceStack.Logging; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptLangTests + { + [Test] + public void Ignores_lang_blocks_that_are_not_languages() + { + var context = new ScriptContext { + ScriptLanguages = { ScriptLisp.Language } + }.Init(); + + string render(string s) => context.RenderScript(s).NormalizeNewLines(); + + Assert.That(render(@" +```code +`test` +``` +{|lisp (+ 1 2) |} +"), Is.EqualTo(@" +test +3 +".NormalizeNewLines())); + + Assert.That(render(@" +```<lang> +test +``` +{|<lang> |} +"), Is.EqualTo(@" +```<lang> +test +``` +{|<lang> |} +".NormalizeNewLines())); + + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLispApiTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLispApiTests.cs new file mode 100644 index 00000000000..402f9d1a959 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLispApiTests.cs @@ -0,0 +1,570 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Xml.Linq; +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.IO; +using ServiceStack.OrmLite; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptLispApiTests + { + private static ScriptContext CreateContext() + { + var context = new ScriptContext { + ScriptLanguages = {ScriptLisp.Language}, + Args = { + ["nums3"] = new[] {0, 1, 2}, + ["nums10"] = new[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, + } + }; + return context.Init(); + } + + [SetUp] + public void Setup() => context = CreateContext(); + + private ScriptContext context; + + string render(string lisp) => context.RenderLisp(lisp).NormalizeNewLines(); + void print(string lisp) => render(lisp).Print(); + object eval(string lisp) => context.EvaluateLisp($"(return (let () {lisp}))"); + + [Test] + public void LISP_fn_shorthand() + { + Assert.That(eval(@"(#(1+ %) 2)"), Is.EqualTo(3)); + Assert.That(eval(@"(#(+ %1 %2) 2 3)"), Is.EqualTo(5)); + } + + [Test] + public void LISP_even() + { + Assert.That(eval(@"(even? 2)"), Is.True); + Assert.That(eval(@"(even? 1)"), Is.Null); + } + + [Test] + public void LISP_odd() + { + Assert.That(eval(@"(odd? 2)"), Is.Null); + Assert.That(eval(@"(odd? 1)"), Is.True); + } + + [Test] + public void LISP_empty() + { + Assert.That(eval(@"(empty? nil)"), Is.True); + Assert.That(eval(@"(empty? ())"), Is.True); + Assert.That(eval(@"(empty? [])"), Is.True); + Assert.That(eval(@"(empty? (to-list []))"), Is.True); + + Assert.That(eval(@"(empty? '(1))"), Is.False); + Assert.That(eval(@"(empty? [1])"), Is.False); + Assert.That(eval(@"(empty? (to-list [1]))"), Is.False); + } + + [Test] + public void LISP_mapcan() + { + Assert.That(eval(@"(mapcan (lambda (x) (and (number? x) (list x))) '(a 1 b c 3 4 d 5))"), + Is.EqualTo(new[] {1, 3, 4, 5})); + } + + [Test] + public void LISP_range() + { + Assert.That(eval(@"(range 5)"), Is.EqualTo(new[] {0, 1, 2, 3, 4})); + Assert.That(eval(@"(range 10 15)"), Is.EqualTo(new[] {10, 11, 12, 13, 14})); + } + + [Test] //filter only works with cons cells + public void LISP_filter() + { + Assert.That(eval(@"(filter #(<= % 3) [5 4 1 3 9 8 6 7 2 0])"), Is.EqualTo(new[] { 1, 3, 2, 0 })); + Assert.That(eval(@"(filter #(<= % 3) [-5 -4 -1 -3 -9 -8 -6 -7 -2 -0])"), Is.EqualTo(new[] { -5, -4, -1, -3, -9, -8, -6, -7, -2, 0 })); + Assert.That(eval(@"(filter #(<= % 3) (to-cons (map #(- %) [5 4 1 3 9 8 6 7 2 0])))"), Is.EqualTo(new[] { -5, -4, -1, -3, -9, -8, -6, -7, -2, 0 })); + Assert.That(eval(@"(filter even? (range 10))"), Is.EqualTo(new[] {0, 2, 4, 6, 8})); + } + + [Test] + public void LISP_filter_index() + { + Assert.That(eval(@" +(setq digits [""zero"" ""one"" ""two"" ""three"" ""four"" ""five"" ""six"" ""seven"" ""eight"" ""nine""]) +(filter-index (fn [x i] (> i (length x))) digits)"), + Is.EqualTo(new[] { "five", "six", "seven", "eight", "nine", })); + } + + [Test] //filter works with both IEnumerable + Cells + public void LISP_where() + { + Assert.That(eval(@"(where #(<= % 3) [5 4 1 3 9 8 6 7 2 0])"), Is.EqualTo(new[] { 1, 3, 2, 0 })); + Assert.That(eval(@"(where #(<= % 3) [-5 -4 -1 -3 -9 -8 -6 -7 -2 -0])"), Is.EqualTo(new[] { -5, -4, -1, -3, -9, -8, -6, -7, -2, 0 })); + Assert.That(eval(@"(where #(<= % 3) (to-cons (map #(- %) [5 4 1 3 9 8 6 7 2 0])))"), Is.EqualTo(new[] { -5, -4, -1, -3, -9, -8, -6, -7, -2, 0 })); + Assert.That(eval(@"(where even? (range 10))"), Is.EqualTo(new[] {0, 2, 4, 6, 8})); + } + + [Test] + public void LISP_where_index() + { + Assert.That(eval(@" +(setq digits [""zero"" ""one"" ""two"" ""three"" ""four"" ""five"" ""six"" ""seven"" ""eight"" ""nine""]) +(where-index (fn [x i] (> i (length x))) digits)"), + Is.EqualTo(new[] { "five", "six", "seven", "eight", "nine", })); + } + + [Test] + public void LISP_add() + { + Assert.That(eval(@"(+ 1)"), Is.EqualTo(1)); + Assert.That(eval(@"(+ 1 2 3 4)"), Is.EqualTo(10)); + } + + [Test] + public void LISP_multiply() + { + Assert.That(eval(@"(* 1)"), Is.EqualTo(1)); + Assert.That(eval(@"(* 1 2 3 4)"), Is.EqualTo(24)); + } + + [Test] + public void LISP_subtract_minus() + { + Assert.That(eval(@"(- 10 1 2 3 4)"), Is.EqualTo(0)); + Assert.That(eval(@"(- 10)"), Is.EqualTo(-10)); + Assert.That(eval(@"-10"), Is.EqualTo(-10)); + } + + [Test] + public void LISP_divide() + { + Assert.That(eval(@"(/ 6 2)"), Is.EqualTo(3)); + Assert.That(eval(@"(/ 5 2)"), Is.EqualTo(2)); + Assert.That(eval(@"(/ 5.0 2)"), Is.EqualTo(2.5)); + Assert.That(eval(@"(/ 5 2.0)"), Is.EqualTo(2.5)); + Assert.That(eval(@"(/ 5.0 2.0)"), Is.EqualTo(2.5)); + Assert.That(eval(@"(/ 4.0)"), Is.EqualTo(0.25)); + Assert.That(eval(@"(/ 4)"), Is.EqualTo(0)); + Assert.That(eval(@"(/ 25 3 2)"), Is.EqualTo(4)); + Assert.That(eval(@"(/ -17 6)"), Is.EqualTo(-2)); + } + + [Test] + public void LISP_reduce() + { + Assert.That(eval(@"(reduce + [1 2 3])"), Is.EqualTo(6)); + Assert.That(eval(@"(reduce + (to-list [1 2 3]))"), Is.EqualTo(6)); + Assert.That(eval(@"(reduce * [2 3 4])"), Is.EqualTo(24)); + Assert.That(eval(@"(reduce * (to-list [2 3 4]))"), Is.EqualTo(24)); + Assert.That(eval(@"(reduce - [10 1 2 3])"), Is.EqualTo(4)); + Assert.That(eval(@"(reduce - (to-list [10 1 2 3]))"), Is.EqualTo(4)); + Assert.That(eval(@"(reduce / [10 1 2])"), Is.EqualTo(5)); + Assert.That(eval(@"(reduce / (to-list [10 1 2]))"), Is.EqualTo(5)); + } + + [Test] + public void LISP_doseq() + { + Assert.That(render(@"(doseq (x nums3) (println x))"), Is.EqualTo("0\n1\n2")); + } + + [Test] + public void LISP_map_literals() + { + var expected = new Dictionary<string, object> { + {"a", 1}, + {"b", 2}, + {"c", 3}, + }; + Assert.That(eval("(new-map '(a 1) '(b 2) '(c 3) )"), Is.EqualTo(expected)); + Assert.That(eval("{ :a 1 :b 2 :c 3 }"), Is.EqualTo(expected)); + Assert.That(eval("{ :a 1, :b 2, :c 3 }"), Is.EqualTo(expected)); + + Assert.That(eval("{ :a 1 :b { :b1 10 :b2 20 } :c 3 }"), Is.EqualTo(new Dictionary<string, object> { + {"a", 1}, + {"b", new Dictionary<string, object> { + {"b1", 10}, + {"b2", 20}, + }}, + {"c", 3}, + })); + } + + [Test] + public void Lisp_data_list() + { + Assert.That(eval(@"(sum [1 2 3 4])"), Is.EqualTo(10)); + Assert.That(eval(@"(sum [1, 2, 3, 4])"), Is.EqualTo(10)); + } + + [Test] + public void LISP_do() //https://clojuredocs.org/clojure.core/dorun + { + var context = new ScriptContext { + ScriptLanguages = { ScriptLisp.Language } + }.Init(); + + Assert.That(context.EvaluateLisp(@"(return (do))"), Is.Null); + Assert.That(context.EvaluateLisp(@"(return (do ()))"), Is.Null); + Assert.That(context.EvaluateLisp(@"(return (do (+ 1 1) (+ 2 2) ))"), Is.EqualTo(4)); + Assert.That(context.EvaluateLisp(@"(return (do (+ 1 1) (+ 2 2) nil ))"), Is.Null); + } + + [Test] + public void LISP_can_clojure_fn_data_list_args() + { + Assert.That(render(@"(defn f [] 0)(f)"), Is.EqualTo("0")); + Assert.That(render(@"(defn f [a] a)(f 1)"), Is.EqualTo("1")); + Assert.That(render(@"(defn f [a b] (+ a b))(f 1 2)"), Is.EqualTo("3")); + Assert.That(render(@"(defn f [a b c] (+ a b c))(f 1 2 3)"), Is.EqualTo("6")); + Assert.That(render(@"((fn [a b c] (+ a b c)) 1 2 3)"), Is.EqualTo("6")); + } + + [Test] + public void LISP_can_call_xml_ContextBlockFilter() + { + var obj = eval(@"(/xml { :a 1 } )"); + Assert.That(obj, Does.Contain("<Key>a</Key>")); + } + + [Test] + public void LISP_test_void_variable() + { + Assert.That(eval(@"(if (bound? id) 1 -1)"), Is.EqualTo(-1)); + Assert.That(eval(@"(setq id 2)(if (bound? id) 1 -1)"), Is.EqualTo(1)); + + Assert.That(eval(@"(if (bound? id id2) 1 -1)"), Is.EqualTo(-1)); + Assert.That(eval(@"(setq id 2)(if (bound? id id2) 1 -1)"), Is.EqualTo(-1)); + Assert.That(eval(@"(setq id 2)(setq id2 3)(if (bound? id id2) 1 -1)"), Is.EqualTo(1)); + } + + [Test] + public void LISP_butlast() + { + Assert.That(eval(@"(butlast [1 2 3 4])"), Is.EqualTo(new[]{ 1, 2, 3 })); + Assert.That(eval(@"(butlast (to-list [1 2 3 4]))"), Is.EqualTo(new[]{ 1, 2, 3 })); + } + + [Test] + public void LISP_reverse() + { + Assert.That(eval(@"(reverse [1 2 3 4])"), Is.EqualTo(new[]{ 4, 3, 2, 1 })); + Assert.That(eval(@"(reverse (to-list [1 2 3 4]))"), Is.EqualTo(new[]{ 4, 3, 2, 1 })); + } + + [Test] + public void LISP_first() + { + Assert.That(eval(@"(first [10 20 30])"), Is.EqualTo(10)); + Assert.That(eval(@"(first (to-list [10 20 30]))"), Is.EqualTo(10)); + Assert.That(eval(@"(1st [10 20 30])"), Is.EqualTo(10)); + } + + [Test] + public void LISP_second() + { + Assert.That(eval(@"(second [10 20 30])"), Is.EqualTo(20)); + Assert.That(eval(@"(second (to-list [10 20 30]))"), Is.EqualTo(20)); + Assert.That(eval(@"(second [10])"), Is.Null); + Assert.That(eval(@"(second (to-list [10]))"), Is.Null); + Assert.That(eval(@"(2nd [10 20 30])"), Is.EqualTo(20)); + } + + [Test] + public void LISP_third() + { + Assert.That(eval(@"(third [10 20 30])"), Is.EqualTo(30)); + Assert.That(eval(@"(third (to-list [10 20 30]))"), Is.EqualTo(30)); + Assert.That(eval(@"(third [10])"), Is.Null); + Assert.That(eval(@"(third (to-list [10]))"), Is.Null); + Assert.That(eval(@"(3rd [10 20 30])"), Is.EqualTo(30)); + } + + [Test] + public void LISP_rest() + { + Assert.That(eval(@"(rest [10 20 30])"), Is.EqualTo(new[]{ 20, 30 })); + Assert.That(eval(@"(rest (to-list [10 20 30]))"), Is.EqualTo(new[]{ 20, 30 })); + Assert.That(eval(@"(rest [10])"), Is.Null); + Assert.That(eval(@"(rest (to-list [10]))"), Is.Null); + Assert.That(eval(@"(next [10 20 30])"), Is.EqualTo(new[]{ 20, 30 })); + } + + [Test] + public void LISP_flatten() + { + Assert.That(eval(@"(flatten [1 2 3])"), Is.EqualTo(new[]{ 1, 2, 3 })); + Assert.That(eval(@"(flatten (to-list [1 2 3]))"), Is.EqualTo(new[]{ 1, 2, 3 })); + Assert.That(eval(@"(flatten [1 2 [3 4] 5 [6 [7 [8 9]]]])"), Is.EqualTo(new[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9 })); + Assert.That(eval(@"(flatten (to-list [1 2 [3 4] 5 [6 [7 [8 9]]]]))"), Is.EqualTo(new[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9 })); + + object reval(string s) => eval(s.Replace("'", "\"")); + Assert.That(reval(@"(flatten ['A' 'B' 'C'])"), Is.EqualTo(new[]{ "A", "B", "C" })); + Assert.That(reval(@"(flatten (to-list ['A' 'B' 'C']))"), Is.EqualTo(new[]{ "A", "B", "C" })); + Assert.That(reval(@"(flatten ['A' 'B' ['C' 'D'] 'E' ['F' ['G' ['H' 'I']]]])"), Is.EqualTo(new[]{ "A", "B", "C", "D", "E", "F", "G", "H", "I" })); + Assert.That(reval(@"(flatten (to-list ['A' 'B' ['C' 'D'] 'E' ['F' ['G' ['H' 'I']]]]))"), Is.EqualTo(new[]{ "A", "B", "C", "D", "E", "F", "G", "H", "I" })); + } + + [Test] + public void LISP_min() + { + Assert.That(eval(@"(min 10 20)"), Is.EqualTo(10)); + Assert.That(eval(@"(min 30 10 20)"), Is.EqualTo(10)); + Assert.That(eval(@"(apply min [5 4 3 9 8 6 7 2])"), Is.EqualTo(2)); + Assert.That(eval(@"(apply min (to-list [5 4 3 9 8 6 7 2]))"), Is.EqualTo(2)); + } + + [Test] + public void LISP_max() + { + Assert.That(eval(@"(max 10 20)"), Is.EqualTo(20)); + Assert.That(eval(@"(max 30 10 20)"), Is.EqualTo(30)); + Assert.That(eval(@"(apply max [5 4 3 9 8 6 7 2])"), Is.EqualTo(9)); + Assert.That(eval(@"(apply max (to-list [5 4 3 9 8 6 7 2]))"), Is.EqualTo(9)); + } + + [Test] + public void LISP_index() + { + Assert.That(eval(@"(:0 ""i"")"), Is.EqualTo('i')); + Assert.That(eval(@"(nth ""i"" 0)"), Is.EqualTo('i')); + } + + [Test] + public void Can_access_page_vars() + { + Assert.That(context.EvaluateLisp(@"<!-- +id 1 +--> + +(return (let () + (if (bound? id) 1 -1) + +))"), Is.EqualTo(1)); + + } + + [Test] + public void Can_access_page_vars_with_line_comment_prefix() + { + Assert.That(context.EvaluateLisp(@";<!-- +; id 1 +;--> + +(return (let () + (if (bound? id) 1 -1) + +))"), Is.EqualTo(1)); + + } + + [Test] + public void LISP_string_format() + { + Assert.That(render(@"(/fmt ""{0} + {1} = {2}"" 1 2 (+ 1 2))"), + Is.EqualTo("1 + 2 = 3")); + } + + [Test] + public void LISP_Instanceof_tests() + { + var context = LoadLispContext(c => c.AllowScriptingOfAllTypes = true); + object eval(string lisp) => context.EvaluateLisp($"(return (let () {lisp}))"); + + Assert.That(eval("(instance? 'IEnumerable [1])"), Is.True); + Assert.That(eval("(instance? \"IEnumerable\" [1])"), Is.True); + Assert.That(eval("(instance? 'System.Collections.IEnumerable [1])"), Is.True); + Assert.That(eval("(instance? 'IEnumerable 1)"), Is.Null); + } + + [Test] + public void Can_access_db() + { + var context = new ScriptContext { + ScriptLanguages = { ScriptLisp.Language }, + ScriptMethods = { + new DbScriptsAsync() + } + }; + context.Container.AddSingleton<IDbConnectionFactory>(() => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + context.Init(); + + using (var db = context.Container.Resolve<IDbConnectionFactory>().Open()) + { + db.CreateTable<Person>(); + + db.InsertAll(new [] { + new Person("A", 1), + new Person("B", 2), + }); + } + + var result = context.EvaluateLisp( + @"(return (map (fn [p] (:Name p)) (/dbSelect ""select Name, Age from Person"")))"); + Assert.That(result, Is.EqualTo(new[] { "A", "B" })); + } + + private static ScriptContext LoadLispContext(Action<ScriptContext> fn=null) + { + var context = new ScriptContext { + ScriptLanguages = {ScriptLisp.Language}, + ScriptMethods = {new ProtectedScripts()}, + ScriptNamespaces = { // same as SharpPagesFeature + "System", + "System.Collections", + "System.Collections.Generic", + "ServiceStack", + } + }; + fn?.Invoke(context); + return context.Init();; + } + + [Test] + public void Can_load_scripts() + { + var context = LoadLispContext(); + + context.VirtualFiles.WriteFile("lib1.l", "(defn lib-calc [a b] (+ a b))"); + context.VirtualFiles.WriteFile("/dir/lib2.l", "(defn lib-calc [a b] (* a b))"); + + object result; + + result = context.EvaluateLisp(@"(load 'lib1)(return (lib-calc 4 5))"); + Assert.That(result, Is.EqualTo(9)); + + result = context.EvaluateLisp(@"(load ""lib1.l"")(return (lib-calc 4 5))"); + Assert.That(result, Is.EqualTo(9)); + + result = context.EvaluateLisp(@"(load ""/dir/lib2.l"")(return (lib-calc 4 5))"); + Assert.That(result, Is.EqualTo(20)); + result = context.EvaluateLisp(@"(load 'lib1)(load ""/dir/lib2.l"")(return (lib-calc 4 5))"); + Assert.That(result, Is.EqualTo(20)); + + // https://gist.github.com/gistlyn/2f14d629ba1852ee55865607f1fa2c3e + } + +// [Test] // skip integration test + public void Can_load_scripts_from_gist_and_url() + { +// Lisp.AllowLoadingRemoteScripts = false; // uncomment to prevent loading remote scripts + + var context = LoadLispContext(); + + LoadLispTests(context); + LoadLispTests(context); // load twice to check it's using cached downloaded assets + } + +// [Test] + public void Can_load_parse_rss_and_evaluate_rss_feed() + { + var context = LoadLispContext(c => { + //c.AllowScriptingOfAllTypes = true; + c.ScriptTypes.Add(typeof(List<>)); + c.ScriptTypes.Add(typeof(ObjectDictionary)); + c.ScriptTypes.Add(typeof(XDocument)); + c.ScriptTypes.Add(typeof(XLinqExtensions)); + }); + + var result = context.EvaluateLisp(@"(load ""index:parse-rss"")(return (parse-rss (/urlContents ""https://news.ycombinator.com/rss"")))"); + result.PrintDump(); + } + + private static void LoadLispTests(ScriptContext context) + { + object result; + + result = context.EvaluateLisp(@"(load ""gist:2f14d629ba1852ee55865607f1fa2c3e/lib1.l"")(return (lib-calc 4 5))"); + Assert.That(result, Is.EqualTo(9)); + + // imports all gist files and overwrites symbols where last symbol wins + result = context.EvaluateLisp(@"(load ""gist:2f14d629ba1852ee55865607f1fa2c3e"")(return (lib-calc 4 5))"); + Assert.That(result, Is.EqualTo(20)); + + result = context.EvaluateLisp( + @"(load ""https://gist.githubusercontent.com/gistlyn/2f14d629ba1852ee55865607f1fa2c3e/raw/95cbc5d071d9db3a96866c1a583056dd87ab5f69/lib1.l"")(return (lib-calc 4 5))"); + Assert.That(result, Is.EqualTo(9)); + + // import single file from index.md + result = context.EvaluateLisp(@"(load ""index:lib-calc/lib1.l"")(return (lib-calc 4 5))"); + Assert.That(result, Is.EqualTo(9)); + + // imports all gist files and overwrites symbols where last symbol wins + result = context.EvaluateLisp(@"(load ""index:lib-calc"")(return (lib-calc 4 5))"); + Assert.That(result, Is.EqualTo(20)); + } + +// [Test] + public void Can_load_src() + { + object result; + + var context = LoadLispContext(); + object eval(string lisp) => context.EvaluateLisp($"(return (let () {lisp}))"); + + result = eval(@"(load-src ""gist:2f14d629ba1852ee55865607f1fa2c3e/lib1.l"")"); + result.ToString().Print(); + + // imports all gist files and overwrites symbols where last symbol wins + result = eval(@"(load-src ""gist:2f14d629ba1852ee55865607f1fa2c3e"")"); + result.ToString().Print(); + + result = eval(@"(load-src ""https://gist.githubusercontent.com/gistlyn/2f14d629ba1852ee55865607f1fa2c3e/raw/95cbc5d071d9db3a96866c1a583056dd87ab5f69/lib1.l"")"); + result.ToString().Print(); + + // import single file from index.md + result = eval(@"(load-src ""index:lib-calc/lib1.l"")"); + result.ToString().Print(); + + // imports all gist files and overwrites symbols where last symbol wins + result = eval(@"(load-src ""index:lib-calc"")"); + result.ToString().Print(); + + result = eval(@"(load-src ""index:parse-rss"")"); + result.ToString().Print(); + } + } + +/* If LISP integration tests are needed in future + public class ScriptListAppHostTests + { + private ServiceStackHost appHost; + + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(ScriptListAppHostTests), typeof(ScriptListAppHostTests).Assembly) { } + public override void Configure(Container container) + { + Plugins.Add(new SharpPagesFeature { + ScriptLanguages = { ScriptLisp.Language }, + }); + } + } + + public ScriptListAppHostTests() + { + appHost = new AppHost().Init(); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + string render(string lisp) => appHost.GetPlugin<SharpPagesFeature>().RenderLisp(lisp).NormalizeNewLines(); + object eval(string lisp) => appHost.GetPlugin<SharpPagesFeature>().EvaluateLisp($"(return {lisp})"); + +// [Test] + public void Can_call_urlContents() + { + var output = render(@"(/urlContents ""https://api.github.com/repos/ServiceStack/ServiceStack"" { :userAgent ""#Script"" } )"); + output.Print(); + } + } +*/ +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLispLinqTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLispLinqTests.cs new file mode 100644 index 00000000000..f3a22188adc --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLispLinqTests.cs @@ -0,0 +1,2700 @@ +using System.Collections; +using System.Collections.Generic; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptLispLinqTests + { + private static ScriptContext CreateContext() + { + var context = new ScriptContext + { + ScriptLanguages = { ScriptLisp.Language }, + AllowScriptingOfAllTypes = true, + ScriptNamespaces = { + "System", + typeof(CaseInsensitiveComparer).Namespace, //System.Collections + typeof(AnagramEqualityComparer).Namespace, + }, + ScriptMethods = { + new ProtectedScripts(), + }, + Args = + { + [ScriptConstants.DefaultDateFormat] = "yyyy/MM/dd", + ["products"] = QueryData.Products, + ["customers"] = QueryData.Customers, + ["comparer"] = new CaseInsensitiveComparer(), + ["anagramComparer"] = new AnagramEqualityComparer(), + } + }; + Lisp.Set("products-list", Lisp.ToCons(QueryData.Products)); + Lisp.Set("customers-list", Lisp.ToCons(QueryData.Customers)); + return context.Init(); + } + + [SetUp] + public void Setup() => context = CreateContext(); + private ScriptContext context; + + string render(string lisp) => context.RenderLisp(lisp).NormalizeNewLines(); + + void print(string lisp) + { + "expr: ".Print(); + Lisp.Parse(lisp).Each(x => Lisp.Str(x).Print()); + "result: ".Print(); + eval(lisp).PrintDump(); + } + + object eval(string lisp) => context.EvaluateLisp($"(return (let () {lisp} ))"); + + [Test] + public void Linq01() + { + Assert.That(render(@" +(defn linq01 [] + (setq numbers [5 4 1 3 9 8 6 7 2 0]) + (let ((low-numbers (where #(< % 5) numbers))) + (println ""Numbers < 5:"") + (doseq (n low-numbers) + (println n)))) +(linq01)"), + + Is.EqualTo(@" +Numbers < 5: +4 +1 +3 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq02() + { + Assert.That(render(@" +(defn linq02 [] + (let ( (sold-out-products + (where #(= 0 (.UnitsInStock %)) products-list)) ) + (println ""Sold out products:"") + (doseq (p sold-out-products) + (println (.ProductName p) "" is sold out"") ) + )) +(linq02)"), + + Is.EqualTo(@" +Sold out products: +Chef Anton's Gumbo Mix is sold out +Alice Mutton is sold out +Thüringer Rostbratwurst is sold out +Gorgonzola Telino is sold out +Perth Pasties is sold out +".NormalizeNewLines())); + } + + [Test] + public void Linq03() + { + Assert.That(render(@" +(defn linq03 [] + (let ( (expensive-in-stock-products + (where #(and + (> (.UnitsInStock %) 0) + (> (.UnitPrice %) 3)) + products-list) + )) + (println ""In-stock products that cost more than 3.00:"") + (doseq (p expensive-in-stock-products) + (println (.ProductName p) "" is in stock and costs more than 3.00"")))) + +(linq03)"), + + Does.StartWith(@" +In-stock products that cost more than 3.00: +Chai is in stock and costs more than 3.00 +Chang is in stock and costs more than 3.00 +Aniseed Syrup is in stock and costs more than 3.00 +Chef Anton's Cajun Seasoning is in stock and costs more than 3.00 +Grandma's Boysenberry Spread is in stock and costs more than 3.00 +".NormalizeNewLines())); + } + + [Test] + public void Linq04() + { + Assert.That(render(@" +(defn linq04 [] + (let ( (wa-customers (where #(= (.Region %) ""WA"") customers-list)) ) + (println ""Customers from Washington and their orders:"") + (doseq (c wa-customers) + (println ""Customer "" (.CustomerId c) "": "" (.CompanyName c) "": "") + (doseq (o (.Orders c)) + (println "" Order "" (.OrderId o) "": "" (.OrderDate o)) ) + ))) +(linq04)"), + + Does.StartWith(@" +Customers from Washington and their orders: +Customer LAZYK: Lazy K Kountry Store: + Order 10482: 3/21/1997 12:00:00 AM + Order 10545: 5/22/1997 12:00:00 AM +Customer TRAIH: Trail's Head Gourmet Provisioners: + Order 10574: 6/19/1997 12:00:00 AM + Order 10577: 6/23/1997 12:00:00 AM + Order 10822: 1/8/1998 12:00:00 AM +".NormalizeNewLines())); + } + + [Test] + public void Linq05() + { + Assert.That(render(@" +(defn linq05 [] + (let ( (digits [""zero"" ""one"" ""two"" ""three"" ""four"" ""five"" ""six"" ""seven"" ""eight"" ""nine""]) + (short-digits) ) + (setq short-digits (where-index (fn [x i] (> i (length x))) digits) ) + (println ""Short digits:"") + (doseq (d short-digits) + (println ""The word "" d "" is shorter than its value"")) + )) +(linq05)"), + + Does.StartWith(@" +Short digits: +The word five is shorter than its value +The word six is shorter than its value +The word seven is shorter than its value +The word eight is shorter than its value +The word nine is shorter than its value +".NormalizeNewLines())); + } + + [Test] + public void Linq06() + { + Assert.That(render(@" +(defn linq06 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) (nums-plus-one) ) + (setq nums-plus-one (map inc numbers)) + (println ""Numbers + 1:"") + (doseq (n nums-plus-one) (println n)))) +(linq06)"), + + Does.StartWith(@" +Numbers + 1: +6 +5 +2 +4 +10 +9 +7 +8 +3 +1 +".NormalizeNewLines())); + } + + [Test] + public void Linq07() + { + Assert.That(render(@" +(defn linq07 [] + (let ( (product-names (map .ProductName products-list)) ) + (println ""Product Names:"") + (doseq (x product-names) (println x)))) +(linq07)"), + + Does.StartWith(@" +Product Names: +Chai +Chang +Aniseed Syrup +Chef Anton's Cajun Seasoning +Chef Anton's Gumbo Mix +".NormalizeNewLines())); + } + + [Test] + public void Linq08() + { + Assert.That(render(@" +(defn linq08 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (strings [""zero"" ""one"" ""two"" ""three"" ""four"" ""five"" ""six"" ""seven"" ""eight"" ""nine""]) + (text-nums) ) + (setq text-nums (map #(nth strings %) numbers)) + (println ""Number strings:"") + (doseq (n text-nums) (println n)) + )) +(linq08)"), + + Does.StartWith(@" +Number strings: +five +four +one +three +nine +eight +six +seven +two +zero +".NormalizeNewLines())); + } + + [Test] + public void Linq09() + { + Assert.That(render(@" +(defn linq09 [] + (let ( (words [""aPPLE"" ""BlUeBeRrY"" ""cHeRry""]) + (upper-lower-words) ) + (setq upper-lower-words + (map (fn [w] { :lower (lower-case w) :upper (upper-case w) } ) words) ) + (doseq (ul upper-lower-words) + (println ""Uppercase: "" (:upper ul) "", Lowercase: "" (:lower ul))) + )) +(linq09)"), + + Does.StartWith(@" +Uppercase: APPLE, Lowercase: apple +Uppercase: BLUEBERRY, Lowercase: blueberry +Uppercase: CHERRY, Lowercase: cherry +".NormalizeNewLines())); + } + + [Test] + public void Linq10() + { + Assert.That(render(@" +(defn linq10 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (strings [""zero"" ""one"" ""two"" ""three"" ""four"" ""five"" ""six"" ""seven"" ""eight"" ""nine""]) + (digit-odd-evens) ) + (setq digit-odd-evens + (map (fn [n] { :digit (nth strings n) :even (even? n) } ) numbers)) + (doseq (d digit-odd-evens) + (println ""The digit "" (:digit d) "" is "" (if (:even d) ""even"" ""odd""))) + )) +(linq10)"), + + Does.StartWith(@" +The digit five is odd +The digit four is even +The digit one is odd +The digit three is odd +The digit nine is odd +The digit eight is even +The digit six is even +The digit seven is odd +The digit two is even +The digit zero is even +".NormalizeNewLines())); + } + + [Test] + public void Linq09_classic_lisp() + { + Assert.That(render(@" +(defn linq09 [] + (let ( (words [""aPPLE"" ""BlUeBeRrY"" ""cHeRry""]) + (upper-lower-words) ) + (setq upper-lower-words + (map (fn [w] `( (lower ,(lower-case w)) (upper ,(upper-case w)) )) words) ) + (doseq (ul upper-lower-words) + (println ""Uppercase: "" (assoc-value 'upper ul) "", Lowercase: "" (assoc-value 'lower ul))) + )) +(linq09)"), + + Does.StartWith(@" +Uppercase: APPLE, Lowercase: apple +Uppercase: BLUEBERRY, Lowercase: blueberry +Uppercase: CHERRY, Lowercase: cherry +".NormalizeNewLines())); + } + + [Test] + public void Linq11() + { + Assert.That(render(@" +(defn linq11 [] + (let ( (product-infos + (map (fn [x] { + :ProductName (.ProductName x) + :Category (.Category x) + :Price (.UnitPrice x) + }) + products-list)) ) + (println ""Product Info:"") + (doseq (p product-infos) + (println (:ProductName p) "" is in the category "" (:Category p) "" and costs "" (:Price p)) ) + )) +(linq11)"), + + Does.StartWith(@" +Product Info: +Chai is in the category Beverages and costs 18 +Chang is in the category Beverages and costs 19 +Aniseed Syrup is in the category Condiments and costs 10 +Chef Anton's Cajun Seasoning is in the category Condiments and costs 22 +Chef Anton's Gumbo Mix is in the category Condiments and costs 21.35 +".NormalizeNewLines())); + } + + [Test] + public void Linq11_expanded_form() + { + Assert.That(render(@" +(defn linq11 [] + (let ( (product-infos + (map (fn [x] (new-map + (list ""ProductName"" (.ProductName x)) + (list ""Category"" (.Category x)) + (list ""Price"" (.UnitPrice x)) + )) + products-list)) ) + (println ""Product Info:"") + (doseq (p product-infos) + (println (:ProductName p) "" is in the category "" (:Category p) "" and costs "" (:Price p))) + )) +(linq11)"), + + Does.StartWith(@" +Product Info: +Chai is in the category Beverages and costs 18 +Chang is in the category Beverages and costs 19 +Aniseed Syrup is in the category Condiments and costs 10 +Chef Anton's Cajun Seasoning is in the category Condiments and costs 22 +Chef Anton's Gumbo Mix is in the category Condiments and costs 21.35 +".NormalizeNewLines())); + } + + [Test] + public void Linq11_classic_lisp() + { + Assert.That(render(@" +(defn linq11 [] + (let ( (product-infos + (map (fn [p] `( + (ProductName ,(.ProductName p)) + (Category ,(.Category p)) + (Price ,(.UnitPrice p)) + )) + products-list)) ) + (println ""Product Info:"") + (doseq (p product-infos) + (println (assoc-value 'ProductName p) "" is in the category "" (assoc-value 'Category p) + "" and costs "" (assoc-value 'Price p))) + )) +(linq11)"), + + Does.StartWith(@" +Product Info: +Chai is in the category Beverages and costs 18 +Chang is in the category Beverages and costs 19 +Aniseed Syrup is in the category Condiments and costs 10 +Chef Anton's Cajun Seasoning is in the category Condiments and costs 22 +Chef Anton's Gumbo Mix is in the category Condiments and costs 21.35 +".NormalizeNewLines())); + } + + [Test] + public void Linq12() + { + Assert.That(render(@" +(defn linq12 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (i 0) (nums-in-place) ) + (setq nums-in-place (map (fn [n] { :num n :in-place (= n (f++ i)) }) numbers)) + (println ""Number: In-place?"") + (doseq (n nums-in-place) + (println (:num n) "": "" (if (:in-place n) 'true 'false)) ) + )) +(linq12)"), + + Does.StartWith(@" +Number: In-place? +5: false +4: false +1: false +3: true +9: false +8: false +6: true +7: true +2: false +0: false +".NormalizeNewLines())); + } + + [Test] + public void Linq13() + { + Assert.That(render(@" +(defn linq13 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (digits [""zero"" ""one"" ""two"" ""three"" ""four"" ""five"" ""six"" ""seven"" ""eight"" ""nine""]) ) + (println ""Numbers < 5:"") + (joinln (map #(nth digits %) (where #(< % 5) numbers))) + )) +(linq13)"), + + Does.StartWith(@" +Numbers < 5: +four +one +three +two +zero +".NormalizeNewLines())); + } + + [Test] + public void Linq14() + { + Assert.That(render(@" +(defn linq14 [] + (let ( (numbers-a [0 2 4 5 6 8 9]) + (numbers-b [1 3 5 7 8]) + (pairs) ) + (setq pairs (where #(< (:a %) (:b %)) + (zip (fn [a b] { :a a, :b b }) numbers-a numbers-b))) + (println ""Pairs where a < b:"") + (doseq (pair pairs) + (println (:a pair) "" is less than "" (:b pair))) + )) +(linq14)"), + + Does.StartWith(@" +Pairs where a < b: +0 is less than 1 +0 is less than 3 +0 is less than 5 +0 is less than 7 +0 is less than 8 +2 is less than 3 +2 is less than 5 +2 is less than 7 +2 is less than 8 +4 is less than 5 +4 is less than 7 +4 is less than 8 +5 is less than 7 +5 is less than 8 +6 is less than 7 +6 is less than 8 +".NormalizeNewLines())); + } + + [Test] + public void Linq14_zip_where() + { + Assert.That(render(@" +(defn linq14 [] + (let ( (numbers-a [0 2 4 5 6 8 9]) + (numbers-b [1 3 5 7 8]) + (pairs) ) + (setq pairs + (zip-where #(< %1 %2) #(it { :a %1, :b %2 }) numbers-a numbers-b)) + (println ""Pairs where a < b:"") + (doseq (pair pairs) + (println (:a pair) "" is less than "" (:b pair))) + )) +(linq14)"), + + Does.StartWith(@" +Pairs where a < b: +0 is less than 1 +0 is less than 3 +0 is less than 5 +0 is less than 7 +0 is less than 8 +2 is less than 3 +2 is less than 5 +2 is less than 7 +2 is less than 8 +4 is less than 5 +4 is less than 7 +4 is less than 8 +5 is less than 7 +5 is less than 8 +6 is less than 7 +6 is less than 8 +".NormalizeNewLines())); + } + + [Test] + public void Linq14_doseq() + { + Assert.That(render(@" +(defn linq14 [] + (let ( (numbers-a [0 2 4 5 6 8 9]) + (numbers-b [1 3 5 7 8]) + (pairs) ) + (doseq (a numbers-a) + (doseq (b numbers-b) + (if (< a b) (push { :a a, :b b } pairs)))) + (println ""Pairs where a < b:"") + (doseq (pair (nreverse pairs)) + (println (:a pair) "" is less than "" (:b pair))) + )) +(linq14)"), + + Does.StartWith(@" +Pairs where a < b: +0 is less than 1 +0 is less than 3 +0 is less than 5 +0 is less than 7 +0 is less than 8 +2 is less than 3 +2 is less than 5 +2 is less than 7 +2 is less than 8 +4 is less than 5 +4 is less than 7 +4 is less than 8 +5 is less than 7 +5 is less than 8 +6 is less than 7 +6 is less than 8 +".NormalizeNewLines())); + } + + [Test] + public void Linq15() + { + Assert.That(render(@" +(defn linq15 [] + (let ( (orders (flatmap (fn [c] + (map (fn [o] { + :customer-id (.CustomerId c) + :order-id (.OrderId o) + :total (.Total o) + }) (where #(< (.Total %) 500) (.Orders c)) )) + customers-list)) ) + (doseq (o orders) (dump-inline o)) + )) +(linq15)"), + + Does.StartWith(@" +{customer-id:ALFKI,order-id:10702,total:330} +{customer-id:ALFKI,order-id:10952,total:471.2} +{customer-id:ANATR,order-id:10308,total:88.8} +{customer-id:ANATR,order-id:10625,total:479.75} +{customer-id:ANATR,order-id:10759,total:320} +{customer-id:ANTON,order-id:10365,total:403.2} +{customer-id:ANTON,order-id:10682,total:375.5} +{customer-id:AROUT,order-id:10355,total:480} +{customer-id:AROUT,order-id:10453,total:407.7} +{customer-id:AROUT,order-id:10741,total:228} +".NormalizeNewLines())); + } + + [Test] + public void Linq16() + { + Assert.That(render(@" +(defn linq16 [] + (let ( + (orders (flatmap (fn [c] + (map-where #(> (.OrderDate %) (DateTime. 1998 1 1)) + #(it { + :customer-id (.CustomerId c) + :order-id (.OrderId %) + :order-date (.OrderDate %) + }) (.Orders c) ) + ) customers-list) )) + (doseq (o orders) (dump-inline o)) + )) +(linq16)"), + + Does.StartWith(@" +{customer-id:ALFKI,order-id:10835,order-date:1998-01-15} +{customer-id:ALFKI,order-id:10952,order-date:1998-03-16} +{customer-id:ALFKI,order-id:11011,order-date:1998-04-09} +{customer-id:ANATR,order-id:10926,order-date:1998-03-04} +{customer-id:ANTON,order-id:10856,order-date:1998-01-28} +".NormalizeNewLines())); + } + + [Test] + public void Linq17() + { + Assert.That(render(@" +(defn linq17 [] + (let ( + (orders (flatmap (fn [c] + (map-where #(>= (:total %) 2000) + #(it { + :customer-id (.CustomerId c) + :order-id (.OrderId %) + :total (.Total %) + }) (.Orders c) ) + ) customers-list) )) + (doseq (o orders) (dump-inline o)) + )) +(linq17)"), + + Does.StartWith(@" +{customer-id:ANTON,order-id:10573,total:2082} +{customer-id:AROUT,order-id:10558,total:2142.9} +{customer-id:AROUT,order-id:10953,total:4441.25} +{customer-id:BERGS,order-id:10384,total:2222.4} +{customer-id:BERGS,order-id:10524,total:3192.65} +".NormalizeNewLines())); + } + + [Test] + public void Linq18() + { + Assert.That(render(@" +(defn linq18 [] + (let ( (cutoff-date (DateTime. 1997 1 1)) + (orders) ) + (setq orders (flatmap (fn [c] + (map-where #(>= (.OrderDate %) cutoff-date) + #(it { + :customer-id (.CustomerId c) + :order-id (.OrderId %) + }) (.Orders c) ) + ) (where #(= (.Region %) ""WA"") customers-list) ) ) + (doseq (o orders) (dump-inline o)) + )) +(linq18)"), + + Does.StartWith(@" +{customer-id:LAZYK,order-id:10482} +{customer-id:LAZYK,order-id:10545} +{customer-id:TRAIH,order-id:10574} +{customer-id:TRAIH,order-id:10577} +{customer-id:TRAIH,order-id:10822} +{customer-id:WHITC,order-id:10469} +{customer-id:WHITC,order-id:10483} +{customer-id:WHITC,order-id:10504} +{customer-id:WHITC,order-id:10596} +{customer-id:WHITC,order-id:10693} +{customer-id:WHITC,order-id:10696} +{customer-id:WHITC,order-id:10723} +{customer-id:WHITC,order-id:10740} +{customer-id:WHITC,order-id:10861} +{customer-id:WHITC,order-id:10904} +{customer-id:WHITC,order-id:11032} +{customer-id:WHITC,order-id:11066} +".NormalizeNewLines())); + } + + [Test] + public void Linq19() + { + Assert.That(render(@" +(defn linq19 [] + (let ( (customer-orders + (map + #(str ""Customer #"" (:i %) "" has an order with OrderID "" (.OrderId (:o %))) + (flatten (map-index (fn (c i) (map #(it { :o % :i (1+ i) }) (.Orders c))) customers-list)) + )) ) + (doseq (x customer-orders) (println x)) + )) +(linq19)"), + + Does.StartWith(@" +Customer #1 has an order with OrderID 10643 +Customer #1 has an order with OrderID 10692 +Customer #1 has an order with OrderID 10702 +Customer #1 has an order with OrderID 10835 +Customer #1 has an order with OrderID 10952 +Customer #1 has an order with OrderID 11011 +Customer #2 has an order with OrderID 10308 +Customer #2 has an order with OrderID 10625 +Customer #2 has an order with OrderID 10759 +Customer #2 has an order with OrderID 10926 +".NormalizeNewLines())); + } + + [Test] + public void Linq20() + { + Assert.That(render(@" +(defn linq20 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (first-3-numbers) ) + (setq first-3-numbers (take 3 numbers)) + (println ""First 3 numbers:"") + (doseq (n first-3-numbers) (println n)) + )) +(linq20)"), + + Does.StartWith(@" +First 3 numbers: +5 +4 +1 +".NormalizeNewLines())); + } + + [Test] + public void Linq21() + { + Assert.That(render(@" +(defn linq21 [] + (let ( (first-3-wa-orders) ) + (setq first-3-wa-orders + (take 3 + (flatmap (fn [c] + (map #(it { + :customer-id (.CustomerId c) + :order-id (.OrderId %) + :order-date (.OrderDate %) }) + (.Orders c) )) + (where #(= (.Region %) ""WA"") customers-list) )) ) + (println ""First 3 orders in WA:"") + (doseq (x first-3-wa-orders) (dump-inline x)) + )) +(linq21)"), + + Does.StartWith(@" +First 3 orders in WA: +{customer-id:LAZYK,order-id:10482,order-date:1997-03-21} +{customer-id:LAZYK,order-id:10545,order-date:1997-05-22} +{customer-id:TRAIH,order-id:10574,order-date:1997-06-19} +".NormalizeNewLines())); + } + + [Test] + public void Linq22() + { + Assert.That(render(@" +(defn linq22 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (all-but-first-4-numbers) ) + (setq all-but-first-4-numbers (skip 4 numbers)) + (println ""All but first 4 numbers:"") + (doseq (n all-but-first-4-numbers) (println n)) + )) +(linq22)"), + + Does.StartWith(@" +All but first 4 numbers: +9 +8 +6 +7 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq23() + { + Assert.That(render(@" +(defn linq23 [] + (let ( (all-but-first-2-orders + (skip 2 + (flatmap (fn [c] + (map #(it { + :customer-id (.CustomerId c) + :order-id (.OrderId %) + :order-date (.OrderDate %) }) + (.Orders c) )) + (where #(= (.Region %) ""WA"") customers-list) )) )) + (println ""All but first 2 orders in WA:"") + (doseq (o all-but-first-2-orders) (dump-inline o)) + )) +(linq23)"), + + Does.StartWith(@" +All but first 2 orders in WA: +{customer-id:TRAIH,order-id:10574,order-date:1997-06-19} +{customer-id:TRAIH,order-id:10577,order-date:1997-06-23} +{customer-id:TRAIH,order-id:10822,order-date:1998-01-08} +{customer-id:WHITC,order-id:10269,order-date:1996-07-31} +{customer-id:WHITC,order-id:10344,order-date:1996-11-01} +{customer-id:WHITC,order-id:10469,order-date:1997-03-10} +{customer-id:WHITC,order-id:10483,order-date:1997-03-24} +{customer-id:WHITC,order-id:10504,order-date:1997-04-11} +{customer-id:WHITC,order-id:10596,order-date:1997-07-11} +{customer-id:WHITC,order-id:10693,order-date:1997-10-06} +{customer-id:WHITC,order-id:10696,order-date:1997-10-08} +{customer-id:WHITC,order-id:10723,order-date:1997-10-30} +{customer-id:WHITC,order-id:10740,order-date:1997-11-13} +{customer-id:WHITC,order-id:10861,order-date:1998-01-30} +{customer-id:WHITC,order-id:10904,order-date:1998-02-24} +{customer-id:WHITC,order-id:11032,order-date:1998-04-17} +{customer-id:WHITC,order-id:11066,order-date:1998-05-01} +".NormalizeNewLines())); + } + + [Test] + public void Linq24() + { + Assert.That(render(@" +(defn linq24 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (first-numbers-less-than-6) ) + (setq first-numbers-less-than-6 (take-while #(< % 6) numbers)) + (println ""First numbers less than 6:"") + (doseq (n first-numbers-less-than-6) (println n)) + )) +(linq24)"), + + Does.StartWith(@" +First numbers less than 6: +5 +4 +1 +3 +".NormalizeNewLines())); + } + + [Test] + public void Linq25() + { + Assert.That(render(@" +(defn linq25 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0] ) + (i 0) (first-small-numbers) ) + (setq first-small-numbers (take-while #(>= % (f++ i)) numbers) ) + (println ""First numbers not less than their position:"") + (doseq (n first-small-numbers) (println n)) + )) +(linq25)"), + + Does.StartWith(@" +First numbers not less than their position: +5 +4 +".NormalizeNewLines())); + } + + [Test] + public void Linq26() + { + Assert.That(render(@" +(defn linq26 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (all-but-first-3-numbers) ) + (setq all-but-first-3-numbers (skip-while #(not= (mod % 3) 0) numbers)) + (println ""All elements starting from first element divisible by 3:"") + (doseq (n all-but-first-3-numbers) (println n)) + )) +(linq26)"), + + Does.StartWith(@" +All elements starting from first element divisible by 3: +3 +9 +8 +6 +7 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq27() + { + Assert.That(render(@" +(defn linq27 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (i 0) (later-numbers) ) + (setq later-numbers (skip-while #(>= % (f++ i)) numbers)) + (println ""All elements starting from first element less than its position:"") + (doseq (n later-numbers) (println n)) + )) +(linq27)"), + + Does.StartWith(@" +All elements starting from first element less than its position: +1 +3 +9 +8 +6 +7 +2 +0 +".NormalizeNewLines())); + } + + [Test] + public void Linq28() + { + Assert.That(render(@" +(defn linq28 [] + (let ( (words [""cherry"" ""apple"" ""blueberry""]) + (sorted-words) ) + (setq sorted-words (sort words)) + (println ""The sorted list of words:"") + (doseq (w sorted-words) (println w)) + )) +(linq28)"), + + Does.StartWith(@" +The sorted list of words: +apple +blueberry +cherry +".NormalizeNewLines())); + } + + [Test] + public void Linq29() + { + Assert.That(render(@" +(defn linq29 [] + (let ( (words [""cherry"" ""apple"" ""blueberry""]) + (sorted-words) ) + (setq sorted-words (sort-by count words)) + (println ""The sorted list of words (by length):"") + (doseq (w sorted-words) (println w)) + )) +(linq29)"), + + Does.StartWith(@" +The sorted list of words (by length): +apple +cherry +blueberry +".NormalizeNewLines())); + } + + [Test] + public void Linq30() + { + Assert.That(render(@" +(defn linq30 [] + (let ( (sorted-products (sort-by .ProductName products-list)) ) + (doseq (p sorted-products) (dump-inline p)) + )) +(linq30)"), + + Does.StartWith(@" +{ProductId:17,ProductName:Alice Mutton,Category:Meat/Poultry,UnitPrice:39,UnitsInStock:0} +{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13} +{ProductId:40,ProductName:Boston Crab Meat,Category:Seafood,UnitPrice:18.4,UnitsInStock:123} +{ProductId:60,ProductName:Camembert Pierrot,Category:Dairy Products,UnitPrice:34,UnitsInStock:19} +{ProductId:18,ProductName:Carnarvon Tigers,Category:Seafood,UnitPrice:62.5,UnitsInStock:42} +".NormalizeNewLines()).Or.StartsWith(@" +{UnitsInStock:0,ProductName:Alice Mutton,UnitPrice:39,Category:Meat/Poultry,ProductId:17} +{UnitsInStock:13,ProductName:Aniseed Syrup,UnitPrice:10,Category:Condiments,ProductId:3} +{UnitsInStock:123,ProductName:Boston Crab Meat,UnitPrice:18.4,Category:Seafood,ProductId:40} +{UnitsInStock:19,ProductName:Camembert Pierrot,UnitPrice:34,Category:Dairy Products,ProductId:60} +{UnitsInStock:42,ProductName:Carnarvon Tigers,UnitPrice:62.5,Category:Seafood,ProductId:18} +".NormalizeNewLines())); // different ordering in .NET Core + } + + [Test] + public void Linq31() + { + Assert.That(render(@" +(defn linq31 [] + (let ( (words [""aPPLE"" ""AbAcUs"" ""bRaNcH"" ""BlUeBeRrY"" ""ClOvEr"" ""cHeRry""]) + (sorted-words) ) + (setq sorted-words (sort-by it (CaseInsensitiveComparer.) words)) + (doseq (w sorted-words) (println w)) + )) +(linq31)"), + + Does.StartWith(@" +AbAcUs +aPPLE +BlUeBeRrY +bRaNcH +cHeRry +ClOvEr +".NormalizeNewLines())); + } + + [Test] + public void Linq32() + { + Assert.That(render(@" +(defn linq32 [] + (let ( (dbls [1.7 2.3 1.9 4.1 2.9]) + (sorted-doubles) ) + (setq sorted-doubles (reverse (sort dbls))) + (println ""The doubles from highest to lowest:"") + (doseq (d sorted-doubles) (println d)) + )) +(linq32)"), + + Does.StartWith(@" +The doubles from highest to lowest: +4.1 +2.9 +2.3 +1.9 +1.7 +".NormalizeNewLines())); + } + + [Test] + public void linq33() + { + Assert.That(render(@" +(defn linq33 [] + (let ( (sorted-products (reverse (sort-by .UnitsInStock products-list))) ) + (doseq (p sorted-products) (dump-inline p)) + )) +(linq33)"), + + Does.StartWith(@" +{ProductId:75,ProductName:Rhönbräu Klosterbier,Category:Beverages,UnitPrice:7.75,UnitsInStock:125} +{ProductId:40,ProductName:Boston Crab Meat,Category:Seafood,UnitPrice:18.4,UnitsInStock:123} +{ProductId:6,ProductName:Grandma's Boysenberry Spread,Category:Condiments,UnitPrice:25,UnitsInStock:120} +{ProductId:55,ProductName:Pâté chinois,Category:Meat/Poultry,UnitPrice:24,UnitsInStock:115} +{ProductId:61,ProductName:Sirop d'érable,Category:Condiments,UnitPrice:28.5,UnitsInStock:113} +".NormalizeNewLines()).Or.StartsWith(@" +{UnitsInStock:125,ProductName:Rhönbräu Klosterbier,UnitPrice:7.75,Category:Beverages,ProductId:75} +{UnitsInStock:123,ProductName:Boston Crab Meat,UnitPrice:18.4,Category:Seafood,ProductId:40} +{UnitsInStock:120,ProductName:Grandma's Boysenberry Spread,UnitPrice:25,Category:Condiments,ProductId:6} +{UnitsInStock:115,ProductName:Pâté chinois,UnitPrice:24,Category:Meat/Poultry,ProductId:55} +{UnitsInStock:113,ProductName:Sirop d'érable,UnitPrice:28.5,Category:Condiments,ProductId:61} +".NormalizeNewLines()).Or.StartsWith(@" +{UnitsInStock:125,ProductId:75,ProductName:Rhönbräu Klosterbier,Category:Beverages,UnitPrice:7.75} +{UnitsInStock:123,ProductId:40,ProductName:Boston Crab Meat,Category:Seafood,UnitPrice:18.4} +{UnitsInStock:120,ProductId:6,ProductName:Grandma's Boysenberry Spread,Category:Condiments,UnitPrice:25} +{UnitsInStock:115,ProductId:55,ProductName:Pâté chinois,Category:Meat/Poultry,UnitPrice:24} +{UnitsInStock:113,ProductId:61,ProductName:Sirop d'érable,Category:Condiments,UnitPrice:28.5} +".NormalizeNewLines())); + } + + [Test] + public void linq34() + { + Assert.That(render(@" +(defn linq34 [] + (let ( (words [""aPPLE"" ""AbAcUs"" ""bRaNcH"" ""BlUeBeRrY"" ""ClOvEr"" ""cHeRry""]) + (sorted-words) ) + (setq sorted-words (order-by [{ :comparer (CaseInsensitiveComparer.) :desc true }] words)) + (doseq (w sorted-words) (println w)) + )) +(linq34)"), + + Does.StartWith(@" +ClOvEr +cHeRry +bRaNcH +BlUeBeRrY +aPPLE +AbAcUs +".NormalizeNewLines())); + } + + [Test] + public void linq35() + { + Assert.That(render(@" +(defn linq35 [] + (let ( (digits [""zero"" ""one"" ""two"" ""three"" ""four"" ""five"" ""six"" ""seven"" ""eight"" ""nine""]) + (i 0) (sorted-digits) ) + (setq sorted-digits (order-by [#(count %) it] digits )) + (println ""Sorted digits:"") + (doseq (d sorted-digits) (println d)) + )) +(linq35)"), + + Does.StartWith(@" +Sorted digits: +one +six +two +five +four +nine +zero +eight +seven +three +".NormalizeNewLines())); + } + + [Test] + public void linq36() + { + Assert.That(render(@" +(defn linq36 [] + (let ( (words [""aPPLE"" ""AbAcUs"" ""bRaNcH"" ""BlUeBeRrY"" ""ClOvEr"" ""cHeRry""]) + (sorted-words) ) + (setq sorted-words (order-by [#(count %) { :comparer (CaseInsensitiveComparer.) }] words)) + (doseq (w sorted-words) (println w)) + )) +(linq36)"), + + Does.StartWith(@" +aPPLE +AbAcUs +bRaNcH +cHeRry +ClOvEr +BlUeBeRrY +".NormalizeNewLines())); + } + + [Test] + public void linq37() + { + Assert.That(render(@" +(defn linq37 [] + (let ( (sorted-products (order-by [ #(.Category %) { :key #(.UnitPrice %) :desc true } ] products-list)) ) + (doseq (p sorted-products) (dump-inline p)) + )) +(linq37)"), + + Does.StartWith(@" +{ProductId:38,ProductName:Côte de Blaye,Category:Beverages,UnitPrice:263.5,UnitsInStock:17} +{ProductId:43,ProductName:Ipoh Coffee,Category:Beverages,UnitPrice:46,UnitsInStock:17} +{ProductId:2,ProductName:Chang,Category:Beverages,UnitPrice:19,UnitsInStock:17} +{ProductId:1,ProductName:Chai,Category:Beverages,UnitPrice:18,UnitsInStock:39} +{ProductId:35,ProductName:Steeleye Stout,Category:Beverages,UnitPrice:18,UnitsInStock:20} +{ProductId:39,ProductName:Chartreuse verte,Category:Beverages,UnitPrice:18,UnitsInStock:69} +{ProductId:76,ProductName:Lakkalikööri,Category:Beverages,UnitPrice:18,UnitsInStock:57} +{ProductId:70,ProductName:Outback Lager,Category:Beverages,UnitPrice:15,UnitsInStock:15} +{ProductId:34,ProductName:Sasquatch Ale,Category:Beverages,UnitPrice:14,UnitsInStock:111} +".NormalizeNewLines()).Or.StartsWith(@" +{UnitsInStock:17,ProductName:Côte de Blaye,UnitPrice:263.5,Category:Beverages,ProductId:38} +{UnitsInStock:17,ProductName:Ipoh Coffee,UnitPrice:46,Category:Beverages,ProductId:43} +{UnitsInStock:17,ProductName:Chang,UnitPrice:19,Category:Beverages,ProductId:2} +{UnitsInStock:39,ProductName:Chai,UnitPrice:18,Category:Beverages,ProductId:1} +{UnitsInStock:20,ProductName:Steeleye Stout,UnitPrice:18,Category:Beverages,ProductId:35} +{UnitsInStock:69,ProductName:Chartreuse verte,UnitPrice:18,Category:Beverages,ProductId:39} +{UnitsInStock:57,ProductName:Lakkalikööri,UnitPrice:18,Category:Beverages,ProductId:76} +{UnitsInStock:15,ProductName:Outback Lager,UnitPrice:15,Category:Beverages,ProductId:70} +{UnitsInStock:111,ProductName:Sasquatch Ale,UnitPrice:14,Category:Beverages,ProductId:34} +".NormalizeNewLines())); // different ordering in .NET Core + } + + [Test] + public void linq38() + { + Assert.That(render(@" +(defn linq38 [] + (let ( (words [""aPPLE"" ""AbAcUs"" ""bRaNcH"" ""BlUeBeRrY"" ""ClOvEr"" ""cHeRry""]) + (sorted-words) ) + + (setq sorted-words (order-by [ #(count %) { :comparer (CaseInsensitiveComparer.) :desc true } ] words)) + (doseq (w sorted-words) (println w)) + )) +(linq38)"), + + Does.StartWith(@" +aPPLE +ClOvEr +cHeRry +bRaNcH +AbAcUs +BlUeBeRrY +".NormalizeNewLines())); + } + + [Test] + public void linq39() + { + Assert.That(render(@" +(defn linq39 [] + (let ( (digits [""zero"" ""one"" ""two"" ""three"" ""four"" ""five"" ""six"" ""seven"" ""eight"" ""nine""]) + (sorted-digits) ) + (setq sorted-digits (reverse (where #(= (:1 %) (:0 ""i"")) digits)) ) + (println ""A backwards list of the digits with a second character of 'i':"") + (doseq (d sorted-digits) (println d)) + )) +(linq39)"), + + Does.StartWith(@" +A backwards list of the digits with a second character of 'i': +nine +eight +six +five +".NormalizeNewLines())); + } + + [Test] + public void linq40() + { + Assert.That(render(@" +(defn linq40 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (number-groups) ) + (setq number-groups + (map (fn [g] { :remainder (.Key g) :numbers g }) (group-by #(mod % 5) numbers))) + (doseq (g number-groups) + (println ""Numbers with a remainder of "" (:remainder g) "" when divided by 5:"") + (doseq (n (:numbers g)) (println n))) + )) +(linq40)"), + + Does.StartWith(@" +Numbers with a remainder of 0 when divided by 5: +5 +0 +Numbers with a remainder of 4 when divided by 5: +4 +9 +Numbers with a remainder of 1 when divided by 5: +1 +6 +Numbers with a remainder of 3 when divided by 5: +3 +8 +Numbers with a remainder of 2 when divided by 5: +7 +2 +".NormalizeNewLines())); + } + + [Test] + public void linq41() + { + Assert.That(render(@" +(defn linq41 [] + (let ( (words [""blueberry"" ""chimpanzee"" ""abacus"" ""banana"" ""apple"" ""cheese""]) + (word-groups) ) + (setq word-groups + (map (fn [g] {:first-letter (.Key g) :words g}) (group-by #(nth % 0) words) )) + (doseq (g word-groups) + (println ""Words that start with the letter: "" (:first-letter g)) + (doseq (w (:words g)) (println w))) + )) +(linq41)"), + + Does.StartWith(@" +Words that start with the letter: b +blueberry +banana +Words that start with the letter: c +chimpanzee +cheese +Words that start with the letter: a +abacus +apple +".NormalizeNewLines())); + } + + [Test] + public void linq42() + { + Assert.That(render(@" +(defn linq42 [] + (let ( (order-groups + (map (fn [g] {:category (.Key g), :products g}) (group-by :category products-list))) ) + (doseq (x order-groups) (dump-inline x)) + )) +(linq42)"), + + Does.StartWith(@" +{category:Beverages,products:[{ProductId:1,ProductName:Chai,Category:Beverages,UnitPrice:18,UnitsInStock:39},{ProductId:2,ProductName:Chang,Category:Beverages,UnitPrice:19,UnitsInStock:17},{ProductId:24,ProductName:Guaraná Fantástica,Category:Beverages,UnitPrice:4.5,UnitsInStock:20},{ProductId:34,ProductName:Sasquatch Ale,Category:Beverages,UnitPrice:14,UnitsInStock:111},{ProductId:35,ProductName:Steeleye Stout,Category:Beverages,UnitPrice:18,UnitsInStock:20},{ProductId:38,ProductName:Côte de Blaye,Category:Beverages,UnitPrice:263.5,UnitsInStock:17},{ProductId:39,ProductName:Chartreuse verte,Category:Beverages,UnitPrice:18,UnitsInStock:69},{ProductId:43,ProductName:Ipoh Coffee,Category:Beverages,UnitPrice:46,UnitsInStock:17},{ProductId:67,ProductName:Laughing Lumberjack Lager,Category:Beverages,UnitPrice:14,UnitsInStock:52},{ProductId:70,ProductName:Outback Lager,Category:Beverages,UnitPrice:15,UnitsInStock:15},{ProductId:75,ProductName:Rhönbräu Klosterbier,Category:Beverages,UnitPrice:7.75,UnitsInStock:125},{ProductId:76,ProductName:Lakkalikööri,Category:Beverages,UnitPrice:18,UnitsInStock:57}]} +".NormalizeNewLines()).Or.StartsWith(@" +{category:Beverages,products:[{UnitsInStock:39,ProductName:Chai,UnitPrice:18,Category:Beverages,ProductId:1},{UnitsInStock:17,ProductName:Chang,UnitPrice:19,Category:Beverages,ProductId:2},{UnitsInStock:20,ProductName:Guaraná Fantástica,UnitPrice:4.5,Category:Beverages,ProductId:24},{UnitsInStock:111,ProductName:Sasquatch Ale,UnitPrice:14,Category:Beverages,ProductId:34},{UnitsInStock:20,ProductName:Steeleye Stout,UnitPrice:18,Category:Beverages,ProductId:35},{UnitsInStock:17,ProductName:Côte de Blaye,UnitPrice:263.5,Category:Beverages,ProductId:38},{UnitsInStock:69,ProductName:Chartreuse verte,UnitPrice:18,Category:Beverages,ProductId:39},{UnitsInStock:17,ProductName:Ipoh Coffee,UnitPrice:46,Category:Beverages,ProductId:43},{UnitsInStock:52,ProductName:Laughing Lumberjack Lager,UnitPrice:14,Category:Beverages,ProductId:67},{UnitsInStock:15,ProductName:Outback Lager,UnitPrice:15,Category:Beverages,ProductId:70},{UnitsInStock:125,ProductName:Rhönbräu Klosterbier,UnitPrice:7.75,Category:Beverages,ProductId:75},{UnitsInStock:57,ProductName:Lakkalikööri,UnitPrice:18,Category:Beverages,ProductId:76}]} +".NormalizeNewLines())); // different ordering in .NET Core + } + + [Test] + public void linq43() + { + Assert.That(render(@" +(defn linq43 [] + (let ( (customer-order-groups + (map (fn [c] { + :company-name (.CompanyName c) + :year-groups (map (fn [yg] { + :year (.Key yg) + :month-groups (map (fn [mg] { + :month (.Key mg) + :orders mg + }) (group-by #(.Month (.OrderDate %)) yg)) + }) (group-by (fn [o] (.Year (.OrderDate o))) (.Orders c))) + }) customers-list)) ) + (dump customer-order-groups) + )) +(linq43)"), + + Does.StartWith(@" +[ + { + company-name: Alfreds Futterkiste, + year-groups: + [ + { + year: 1997, + month-groups: + [ + { + month: 8, + orders: + [ + { + OrderId: 10643, + OrderDate: 1997-08-25, + Total: 814.5 + } + ] + }, + { + month: 10, + orders: + [ + { + OrderId: 10692, + OrderDate: 1997-10-03, + Total: 878 + }, + { + OrderId: 10702, + OrderDate: 1997-10-13, + Total: 330 + } + ] + } + ] + }, + { + year: 1998, + month-groups: + [ + { + month: 1, + orders: + [ + { + OrderId: 10835, + OrderDate: 1998-01-15, + Total: 845.8 + } + ] + }, + { + month: 3, + orders: + [ + { + OrderId: 10952, + OrderDate: 1998-03-16, + Total: 471.2 + } + ] + }, + { + month: 4, + orders: + [ + { + OrderId: 11011, + OrderDate: 1998-04-09, + Total: 933.5 + } + ] + } + ] + } + ] + }, +".NormalizeNewLines())); + } + + [Test] + public void linq44() + { + Assert.That(render(@" +(defn linq44 [] + (let ( (anagrams [""from "" "" salt"" "" earn "" "" last "" "" near "" "" form ""]) + (order-groups) ) + (setq order-groups (group-by .Trim { :comparer (AnagramEqualityComparer.) } anagrams)) + (doseq (x order-groups) (dump-inline x)) + )) +(linq44)"), + + Does.StartWith(@" +[from , form ] +[ salt, last ] +[ earn , near ] +".NormalizeNewLines())); + } + + [Test] + public void linq44_inline() + { + Assert.That(render(@" +(defn linq44 [] + (let ( (anagrams [""from "" "" salt"" "" earn "" "" last "" "" near "" "" form ""]) + (order-groups) ) + (setq order-groups (group-by #((/C ""String(char[])"") (sort (.ToCharArray (.Trim %)))) anagrams)) + (doseq (x order-groups) (dump-inline x)) + )) +(linq44)"), + + Does.StartWith(@" +[from , form ] +[ salt, last ] +[ earn , near ] +".NormalizeNewLines())); + } + + [Test] + public void linq45() + { + Assert.That(render(@" +(defn linq45 [] + (let ( (anagrams [""from "" "" salt"" "" earn "" "" last "" "" near "" "" form ""]) + (order-groups) ) + (setq order-groups (group-by .Trim { :comparer (AnagramEqualityComparer.) :map upper-case } anagrams)) + (doseq (x order-groups) (dump-inline x)) + )) +(linq45)"), + + Does.StartWith(@" +[FROM , FORM ] +[ SALT, LAST ] +[ EARN , NEAR ] +".NormalizeNewLines())); + } + + [Test] + public void linq46() + { + Assert.That(render(@" +(defn linq46 [] + (let ( (factors-of-300 [2, 2, 3, 5, 5]) + (unique-factors) ) + (setq unique-factors (/distinct factors-of-300)) + (println ""Prime factors of 300:"") + (doseq (n unique-factors) (println n)) + )) +(linq46)"), + + Does.StartWith(@" +Prime factors of 300: +2 +3 +5 +".NormalizeNewLines())); + } + + [Test] + public void linq47() + { + Assert.That(render(@" +(defn linq47 [] + (let ( (category-names (/distinct (map .Category products-list))) ) + (println ""Category names:"") + (doseq (c category-names) (println c)) + )) +(linq47)"), + + Does.StartWith(@" +Category names: +Beverages +Condiments +Produce +Meat/Poultry +Seafood +Dairy Products +Confections +Grains/Cereals +".NormalizeNewLines())); + } + + [Test] + public void linq48() + { + Assert.That(render(@" +(defn linq48 [] + (let ( (numbers-a [0 2 4 5 6 8 9]) + (numbers-b [1 3 5 7 8]) + (unique-numbers) ) + + (setq unique-numbers (/union numbers-a numbers-b)) + (println ""Unique numbers from both arrays:"") + (doseq (n unique-numbers) (println n)) + )) +(linq48)"), + + Does.StartWith(@" +Unique numbers from both arrays: +0 +2 +4 +5 +6 +8 +9 +1 +3 +7 +".NormalizeNewLines())); + } + + [Test] + public void linq49() + { + Assert.That(render(@" +(defn linq49 [] + (let ( (product-first-chars (map #(nth (.ProductName %) 0) products-list)) + (customer-first-chars (map #(nth (.CompanyName %) 0) customers-list)) + (unique-first-chars) ) + + (setq unique-first-chars (/union product-first-chars customer-first-chars)) + (println ""Unique first letters from Product names and Customer names:"") + (doseq (x unique-first-chars) (println x)) + )) +(linq49)"), + + Does.StartWith(@" +Unique first letters from Product names and Customer names: +C +A +G +U +N +M +I +Q +K +T +P +S +R +B +J +Z +V +F +E +W +L +O +D +H +".NormalizeNewLines())); + } + + [Test] + public void linq50() + { + Assert.That(render(@" +(defn linq50 [] + (let ( (numbers-a [0 2 4 5 6 8 9]) + (numbers-b [1 3 5 7 8]) ) + (setq common-numbers (intersect numbers-a numbers-b)) + (println ""Common numbers shared by both arrays:"") + (doseq (n common-numbers) (println n)) + )) +(linq50)"), + + Does.StartWith(@" +Common numbers shared by both arrays: +5 +8 +".NormalizeNewLines())); + } + + [Test] + public void linq51() + { + Assert.That(render(@" +(defn linq51 [] + (let ( (product-first-chars (map #(nth (.ProductName %) 0) products-list)) + (customer-first-chars (map #(nth (.CompanyName %) 0) customers-list)) + (common-first-chars) ) + (setq common-first-chars (intersect product-first-chars customer-first-chars)) + (println ""Common first letters from Product names and Customer names:"") + (doseq (x common-first-chars) (println x)) + )) +(linq51)"), + + Does.StartWith(@" +Common first letters from Product names and Customer names: +C +A +G +N +M +I +Q +K +T +P +S +R +B +V +F +E +W +L +O +".NormalizeNewLines())); + } + + [Test] + public void linq52() + { + Assert.That(render(@" +(defn linq52 [] + (let ( (numbers-a [0 2 4 5 6 8 9]) + (numbers-b [1 3 5 7 8]) + (a-only-numbers) ) + (setq a-only-numbers (/except numbers-a numbers-b)) + (println ""Numbers in first array but not second array:"") + (doseq (n a-only-numbers) (println n)) + )) +(linq52)"), + + Does.StartWith(@" +Numbers in first array but not second array: +0 +2 +4 +6 +9 +".NormalizeNewLines())); + } + + [Test] + public void linq53() + { + Assert.That(render(@" +(defn linq53 [] + (let ( (product-first-chars (map #(nth (.ProductName %) 0) products-list)) + (customer-first-chars (map #(nth (.CompanyName %) 0) customers-list)) + (product-only-first-chars) ) + + (setq product-only-first-chars (/except product-first-chars customer-first-chars)) + (println ""First letters from Product names, but not from Customer names:"") + (doseq (x product-only-first-chars) (println x)) + )) +(linq53)"), + + Does.StartWith(@" +First letters from Product names, but not from Customer names: +U +J +Z +".NormalizeNewLines())); + } + + [Test] + public void linq54() + { + Assert.That(render(@" +(defn linq54 [] + (let ( (dbls [1.7 2.3 1.9 4.1 2.9]) + (sorted-doubles) ) + (setq sorted-doubles (reverse (sort dbls))) + (println ""Every other double from highest to lowest:"") + (doseq (d (/step sorted-doubles { :by 2 })) (println d)) + )) +(linq54)"), + + Does.StartWith(@" +Every other double from highest to lowest: +4.1 +2.3 +1.7 +".NormalizeNewLines())); + } + + [Test] + public void linq55() + { + Assert.That(render(@" +(defn linq55 [] + (let ( (words [""cherry"" ""apple"" ""blueberry""]) + (sorted-words) ) + (setq sorted-words (to-list (sort words))) + (println ""The sorted word list:"") + (doseq (w sorted-words) (println w)) + )) +(linq55)"), + + Does.StartWith(@" +The sorted word list: +apple +blueberry +cherry +".NormalizeNewLines())); + } + + [Test] + public void linq56() + { + Assert.That(render(@" +(defn linq56 [] + (let ( (sorted-records [{:name ""Alice"", :score 50} + {:name ""Bob"", :score 40} + {:name ""Cathy"", :score 45}]) + (sorted-records-dict) ) + (setq sorted-records-dict (to-dictionary :name sorted-records)) + (println ""Bob's score: "" (:score (:""Bob"" sorted-records-dict))) + )) +(linq56)"), + + Does.StartWith(@" +Bob's score: 40 +".NormalizeNewLines())); + } + + [Test] + public void linq57() + { + Assert.That(render(@" +(defn linq57 [] + (let ( (numbers [nil 1.0 ""two"" 3 ""four"" 5 ""six"" 7.0]) + (dbls) ) + (setq dbls (/of numbers { :type ""Double"" })) + (println ""Numbers stored as doubles:"") + (doseq (d dbls) (println d)) + )) +(linq57)"), + + Does.StartWith(@" +Numbers stored as doubles: +1 +7 +".NormalizeNewLines())); + } + + [Test] + public void linq58() + { + Assert.That(render(@" +(defn linq58 [] + (let ( (product-12 (first (where #(= (.ProductId %) 12) products-list)) ) ) + (dump-inline product-12) + )) +(linq58)"), + + Does.StartWith(@" +{ProductId:12,ProductName:Queso Manchego La Pastora,Category:Dairy Products,UnitPrice:38,UnitsInStock:86} +".NormalizeNewLines()).Or.StartsWith(@" +{UnitsInStock:86,ProductName:Queso Manchego La Pastora,UnitPrice:38,Category:Dairy Products,ProductId:12} +".NormalizeNewLines())); // different ordering in .NET Core + } + + [Test] + public void linq59() + { + Assert.That(render(@" +(defn linq59 [] + (let ( (strings [""zero"" ""one"" ""two"" ""three"" ""four"" ""five"" ""six"" ""seven"" ""eight"" ""nine""]) + (starts-with-o) ) + (setq starts-with-o (first (where #(/startsWith % ""o"") strings))) + (println ""A string starting with 'o': "" starts-with-o) + )) +(linq59)"), + + Does.StartWith(@" +A string starting with 'o': one +".NormalizeNewLines())); + } + + [Test] + public void linq61() + { + Assert.That(render(@" +(defn linq61 [] + (let ( (numbers []) (first-num-or-default) ) + (setq first-num-or-default (or (first numbers) 0)) + (println first-num-or-default) + )) +(linq61)"), + + Does.StartWith(@" +0 +".NormalizeNewLines())); + } + + [Test] + public void linq62() + { + Assert.That(render(@" +(defn linq62 [] + (let ( (product-789 (first (where #(= (.ProductId %) 789) products-list) )) ) + (println ""Product 789 exists: "" (not= product-789 nil)) + )) +(linq62)"), + + Does.StartWith(@" +Product 789 exists: False +".NormalizeNewLines())); + } + + [Test] + public void linq64() + { + Assert.That(render(@" +(defn linq64 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) (fourth-low-num) ) + (setq fourth-low-num (nth (where #(> % 5) numbers) 1)) + (println ""Second number > 5: "" fourth-low-num) + )) +(linq64)"), + + Does.StartWith(@" +Second number > 5: 8 +".NormalizeNewLines())); + } + + [Test] + public void linq65() + { + Assert.That(render(@" +(defn linq65 [] + (let ( (numbers (map (fn [n] { + :number n + :odd-even (if (odd? n) ""odd"" ""even"") + }) (range 100 151))) ) + (doseq (n numbers) + (println ""The number "" (:number n) "" is "" (:odd-even n))) + )) +(linq65)"), + + Does.StartWith(@" +The number 100 is even +The number 101 is odd +The number 102 is even +The number 103 is odd +The number 104 is even +The number 105 is odd +The number 106 is even +The number 107 is odd +The number 108 is even +The number 109 is odd +The number 110 is even +".NormalizeNewLines())); + } + + [Test] + public void linq66() + { + Assert.That(render(@" +(defn linq66 [] + (let ( (numbers (/repeat 7 10)) ) + (doseq (n numbers) (println n)))) +(linq66)"), + + Does.StartWith(@" +7 +7 +7 +7 +7 +7 +7 +7 +7 +7 +".NormalizeNewLines())); + } + + [Test] + public void linq67() + { + Assert.That(render(@" +(defn linq67 [] + (let ( (words [""believe"" ""relief"" ""receipt"" ""field""]) + (i-after-e) ) + (setq i-after-e (any? #(.Contains % ""ie"") words)) + (println ""There is a word that contains in the list that contains 'ei': "" i-after-e) + )) +(linq67)"), + + Does.StartWith(@" +There is a word that contains in the list that contains 'ei': True +".NormalizeNewLines())); + } + + [Test] + public void linq69() + { + Assert.That(render(@" +(defn linq69 [] + (let ( (product-groups + (map #(it { :category (.Key %), :products % }) + (where #(any? (fn [p] (= (.UnitsInStock p) 0)) %) + (group-by .Category products-list)))) ) + (dump product-groups) + )) +(linq69)"), + + Does.StartWith(@"[ + { + category: Condiments, + products: + [ + { + ProductId: 3, + ProductName: Aniseed Syrup, + Category: Condiments, + UnitPrice: 10, + UnitsInStock: 13 + }, + { + ProductId: 4, + ProductName: Chef Anton's Cajun Seasoning, + Category: Condiments, + UnitPrice: 22, + UnitsInStock: 53 + }, + { + ProductId: 5, + ProductName: Chef Anton's Gumbo Mix, + Category: Condiments, + UnitPrice: 21.35, + UnitsInStock: 0 + }, +".NormalizeNewLines()).Or.StartsWith(@"[ + { + category: Condiments, + products: + [ + { + UnitsInStock: 13, + ProductName: Aniseed Syrup, + UnitPrice: 10, + Category: Condiments, + ProductId: 3 + },".NormalizeNewLines())); + } + + [Test] + public void linq70() + { + Assert.That(render(@" +(defn linq70 [] + (let ( (numbers [1 11 3 19 41 65 19]) + (only-odd) ) + (setq only-odd (all? odd? numbers)) + (println ""The list contains only odd numbers: "" only-odd) + )) +(linq70)"), + + Does.StartWith(@" +The list contains only odd numbers: True +".NormalizeNewLines())); + } + + [Test] + public void linq72() + { + Assert.That(render(@" +(defn linq72 [] + (let ( (product-groups + (map #(it { :category (.Key %), :products % }) + (where #(all? (fn [p] (> (.UnitsInStock p) 0)) %) + (group-by .Category products-list)))) ) + (dump product-groups) + )) +(linq72)"), + + Does.StartWith(@"[ + { + category: Beverages, + products: + [ + { + ProductId: 1, + ProductName: Chai, + Category: Beverages, + UnitPrice: 18, + UnitsInStock: 39 + }, + { + ProductId: 2, + ProductName: Chang, + Category: Beverages, + UnitPrice: 19, + UnitsInStock: 17 + }, + { + ProductId: 24, + ProductName: Guaraná Fantástica, + Category: Beverages, + UnitPrice: 4.5, + UnitsInStock: 20 + }, +".NormalizeNewLines()).Or.StartsWith(@"[ + { + category: Beverages, + products: + [ + { + UnitsInStock: 39, + ProductName: Chai, + UnitPrice: 18, + Category: Beverages, + ProductId: 1 + },".NormalizeNewLines())); + } + + [Test] + public void linq73() + { + Assert.That(render(@" +(defn linq73 [] + (let ( (factors-of-300 [2 2 3 5 5]) + (unique-factors) ) + (setq unique-factors (count (/distinct factors-of-300))) + (println ""There are "" unique-factors "" unique factors of 300."") + )) +(linq73)"), + + Does.StartWith(@" +There are 3 unique factors of 300. +".NormalizeNewLines())); + } + + [Test] + public void linq74() + { + Assert.That(render(@" +(defn linq74 [] + (let ( (numbers [4 5 1 3 9 0 6 7 2 0]) + (odd-numbers) ) + (setq odd-numbers (count (where odd? numbers)) ) + (println ""There are "" odd-numbers "" odd numbers in the list."") + )) +(linq74)"), + + Does.StartWith(@" +There are 5 odd numbers in the list. +".NormalizeNewLines())); + } + + [Test] + public void linq76() + { + Assert.That(render(@" +(defn linq76 [] + (let ( (order-counts + (map #(it { + :customer-id (.CustomerId %) + :order-count (count (.Orders %)) + }) customers-list)) ) + (doseq (x order-counts) (dump-inline x)) +)) +(linq76)"), + + Does.StartWith(@" +{customer-id:ALFKI,order-count:6} +{customer-id:ANATR,order-count:4} +{customer-id:ANTON,order-count:7} +{customer-id:AROUT,order-count:13} +{customer-id:BERGS,order-count:18} +{customer-id:BLAUS,order-count:7} +{customer-id:BLONP,order-count:11} +".NormalizeNewLines())); + } + + [Test] + public void linq77() + { + Assert.That(render(@" +(defn linq77 [] + (let ( (category-counts + (map #(it { + :category (.Key %) + :product-count (count %) + }) + (group-by .Category products-list))) ) + (doseq (x category-counts) (dump-inline x)) + )) +(linq77)"), + + Does.StartWith(@" +{category:Beverages,product-count:12} +{category:Condiments,product-count:12} +{category:Produce,product-count:5} +{category:Meat/Poultry,product-count:6} +{category:Seafood,product-count:12} +{category:Dairy Products,product-count:10} +{category:Confections,product-count:13} +{category:Grains/Cereals,product-count:7} +".NormalizeNewLines())); + } + + [Test] + public void linq78() + { + Assert.That(render(@" +(defn linq78 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) ) + (setq num-sum (reduce + numbers)) + (println ""The sum of the numbers is "" num-sum) + )) +(linq78)"), + + Does.StartWith(@" +The sum of the numbers is 45 +".NormalizeNewLines())); + } + + [Test] + public void linq79() + { + Assert.That(render(@" +(defn linq79 [] + (let ( (words [""cherry"", ""apple"", ""blueberry""]) + (total-chars) ) + (setq total-chars (reduce + (map count words))) + (println ""There are a total of "" total-chars "" characters in these words."") + )) +(linq79)"), + + Does.StartWith(@" +There are a total of 20 characters in these words. +".NormalizeNewLines())); + } + + [Test] + public void linq80() + { + Assert.That(render(@" +(defn linq80 [] + (let ( (categories + (map #(it { + :category (.Key %) + :total-units-in-stock (sum (map .UnitsInStock %)) + }) + (group-by .Category products-list))) ) + (doseq (x categories) (dump-inline x)) + )) +(linq80)"), + + Does.StartWith(@" +{category:Beverages,total-units-in-stock:559} +{category:Condiments,total-units-in-stock:507} +{category:Produce,total-units-in-stock:100} +{category:Meat/Poultry,total-units-in-stock:165} +{category:Seafood,total-units-in-stock:701} +{category:Dairy Products,total-units-in-stock:393} +{category:Confections,total-units-in-stock:386} +{category:Grains/Cereals,total-units-in-stock:308} +".NormalizeNewLines())); + } + + [Test] + public void linq81() + { + Assert.That(render(@" +(defn linq81 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (min-num) ) + (setq min-num (apply min numbers)) + (println ""The minimum number is "" min-num) + )) +(linq81)"), + + Does.StartWith(@" +The minimum number is 0 +".NormalizeNewLines())); + } + + [Test] + public void linq82() + { + Assert.That(render(@" +(defn linq82 [] + (let ( (words [""cherry"", ""apple"", ""blueberry""]) + (shortest-word) ) + (setq shortest-word (apply min (map count words))) + (println ""The shortest word is "" shortest-word "" characters long."") + )) +(linq82)"), + + Does.StartWith(@" +The shortest word is 5 characters long. +".NormalizeNewLines())); + } + + [Test] + public void linq83() + { + Assert.That(render(@" +(defn linq83 [] + (let ( (categories + (map #(it { + :category (.Key %) + :cheapest-price (apply min (map .UnitPrice %)) + }) + (group-by .Category products-list))) ) + (doseq (x categories) (dump-inline x)) + )) +(linq83)"), + + Does.StartWith(@" +{category:Beverages,cheapest-price:4.5} +{category:Condiments,cheapest-price:10} +{category:Produce,cheapest-price:10} +{category:Meat/Poultry,cheapest-price:7.45} +{category:Seafood,cheapest-price:6} +{category:Dairy Products,cheapest-price:2.5} +{category:Confections,cheapest-price:9.2} +{category:Grains/Cereals,cheapest-price:7} +".NormalizeNewLines())); + } + + [Test] + public void linq84() + { + Assert.That(render(@" +(defn linq84 [] + (let ( (categories + (map (fn [g] ( + let ( (min-price (apply min (map .UnitPrice g))) ) + { + :category (.Key g) + :cheapest-products (where #(= (.UnitPrice %) min-price) g) + })) + (group-by .Category products-list))) ) + (doseq (x categories) (dump-inline x)) + )) +(linq84)"), + + Does.StartWith(@" +{category:Beverages,cheapest-products:[{ProductId:24,ProductName:Guaraná Fantástica,Category:Beverages,UnitPrice:4.5,UnitsInStock:20}]} +{category:Condiments,cheapest-products:[{ProductId:3,ProductName:Aniseed Syrup,Category:Condiments,UnitPrice:10,UnitsInStock:13}]} +{category:Produce,cheapest-products:[{ProductId:74,ProductName:Longlife Tofu,Category:Produce,UnitPrice:10,UnitsInStock:4}]} +{category:Meat/Poultry,cheapest-products:[{ProductId:54,ProductName:Tourtière,Category:Meat/Poultry,UnitPrice:7.45,UnitsInStock:21}]} +{category:Seafood,cheapest-products:[{ProductId:13,ProductName:Konbu,Category:Seafood,UnitPrice:6,UnitsInStock:24}]} +{category:Dairy Products,cheapest-products:[{ProductId:33,ProductName:Geitost,Category:Dairy Products,UnitPrice:2.5,UnitsInStock:112}]} +{category:Confections,cheapest-products:[{ProductId:19,ProductName:Teatime Chocolate Biscuits,Category:Confections,UnitPrice:9.2,UnitsInStock:25}]} +{category:Grains/Cereals,cheapest-products:[{ProductId:52,ProductName:Filo Mix,Category:Grains/Cereals,UnitPrice:7,UnitsInStock:38}]} +".NormalizeNewLines()).Or.StartsWith(@" +{category:Beverages,cheapest-products:[{UnitsInStock:20,ProductName:Guaraná Fantástica,UnitPrice:4.5,Category:Beverages,ProductId:24}]} +{category:Condiments,cheapest-products:[{UnitsInStock:13,ProductName:Aniseed Syrup,UnitPrice:10,Category:Condiments,ProductId:3}]} +{category:Produce,cheapest-products:[{UnitsInStock:4,ProductName:Longlife Tofu,UnitPrice:10,Category:Produce,ProductId:74}]} +{category:Meat/Poultry,cheapest-products:[{UnitsInStock:21,ProductName:Tourtière,UnitPrice:7.45,Category:Meat/Poultry,ProductId:54}]} +{category:Seafood,cheapest-products:[{UnitsInStock:24,ProductName:Konbu,UnitPrice:6,Category:Seafood,ProductId:13}]} +{category:Dairy Products,cheapest-products:[{UnitsInStock:112,ProductName:Geitost,UnitPrice:2.5,Category:Dairy Products,ProductId:33}]} +{category:Confections,cheapest-products:[{UnitsInStock:25,ProductName:Teatime Chocolate Biscuits,UnitPrice:9.2,Category:Confections,ProductId:19}]} +{category:Grains/Cereals,cheapest-products:[{UnitsInStock:38,ProductName:Filo Mix,UnitPrice:7,Category:Grains/Cereals,ProductId:52}]} +".NormalizeNewLines()).Or.StartsWith(@" +{category:Beverages,cheapest-products:[{Category:Beverages,UnitPrice:4.5,ProductId:24,ProductName:Guaraná Fantástica,UnitsInStock:20}]} +{category:Condiments,cheapest-products:[{Category:Condiments,UnitPrice:10,ProductId:3,ProductName:Aniseed Syrup,UnitsInStock:13}]} +{category:Produce,cheapest-products:[{Category:Produce,UnitPrice:10,ProductId:74,ProductName:Longlife Tofu,UnitsInStock:4}]} +{category:Meat/Poultry,cheapest-products:[{Category:Meat/Poultry,UnitPrice:7.45,ProductId:54,ProductName:Tourtière,UnitsInStock:21}]} +{category:Seafood,cheapest-products:[{Category:Seafood,UnitPrice:6,ProductId:13,ProductName:Konbu,UnitsInStock:24}]} +{category:Dairy Products,cheapest-products:[{Category:Dairy Products,UnitPrice:2.5,ProductId:33,ProductName:Geitost,UnitsInStock:112}]} +{category:Confections,cheapest-products:[{Category:Confections,UnitPrice:9.2,ProductId:19,ProductName:Teatime Chocolate Biscuits,UnitsInStock:25}]} +{category:Grains/Cereals,cheapest-products:[{Category:Grains/Cereals,UnitPrice:7,ProductId:52,ProductName:Filo Mix,UnitsInStock:38}]} +".NormalizeNewLines())); + } + + [Test] + public void linq85() + { + Assert.That(render(@" +(defn linq85 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (max-num) ) + (setq max-num (apply max numbers)) + (println ""The maximum number is "" max-num) + )) +(linq85)"), + + Does.StartWith(@" +The maximum number is 9 +".NormalizeNewLines())); + } + + [Test] + public void linq86() + { + Assert.That(render(@" +(defn linq82 [] + (let ( (words [""cherry"", ""apple"", ""blueberry""]) + (shortest-word) ) + (setq longest-word (apply max (map count words))) + (println ""The longest word is "" longest-word "" characters long."") + )) +(linq82)"), + + Does.StartWith(@" +The longest word is 9 characters long. +".NormalizeNewLines())); + } + + [Test] + public void linq87() + { + Assert.That(render(@" +(defn linq87 [] + (let ( (categories + (map #(it { + :category (.Key %) + :most-expensive-price (apply max (map .UnitPrice %)) + }) + (group-by .Category products-list))) ) + (doseq (x categories) (dump-inline x)) + )) +(linq87)"), + + Does.StartWith(@" +{category:Beverages,most-expensive-price:263.5} +{category:Condiments,most-expensive-price:43.9} +{category:Produce,most-expensive-price:53} +{category:Meat/Poultry,most-expensive-price:123.79} +{category:Seafood,most-expensive-price:62.5} +{category:Dairy Products,most-expensive-price:55} +{category:Confections,most-expensive-price:81} +{category:Grains/Cereals,most-expensive-price:38} +".NormalizeNewLines())); + } + + [Test] + public void linq88() + { + Assert.That(render(@" +(defn linq88 [] + (let ( (categories + (map (fn [g] ( + let ( (max-price (apply max (map .UnitPrice g))) ) + { + :category (.Key g) + :most-expensive-products (where #(= (.UnitPrice %) max-price) g) + })) + (group-by .Category products-list))) ) + (doseq (x categories) (dump-inline x)) + )) +(linq88)"), + + Does.StartWith(@" +{category:Beverages,most-expensive-products:[{Category:Beverages,UnitPrice:263.5,ProductId:38,ProductName:Côte de Blaye,UnitsInStock:17}]} +{category:Condiments,most-expensive-products:[{Category:Condiments,UnitPrice:43.9,ProductId:63,ProductName:Vegie-spread,UnitsInStock:24}]} +{category:Produce,most-expensive-products:[{Category:Produce,UnitPrice:53,ProductId:51,ProductName:Manjimup Dried Apples,UnitsInStock:20}]} +{category:Meat/Poultry,most-expensive-products:[{Category:Meat/Poultry,UnitPrice:123.79,ProductId:29,ProductName:Thüringer Rostbratwurst,UnitsInStock:0}]} +{category:Seafood,most-expensive-products:[{Category:Seafood,UnitPrice:62.5,ProductId:18,ProductName:Carnarvon Tigers,UnitsInStock:42}]} +{category:Dairy Products,most-expensive-products:[{Category:Dairy Products,UnitPrice:55,ProductId:59,ProductName:Raclette Courdavault,UnitsInStock:79}]} +{category:Confections,most-expensive-products:[{Category:Confections,UnitPrice:81,ProductId:20,ProductName:Sir Rodney's Marmalade,UnitsInStock:40}]} +{category:Grains/Cereals,most-expensive-products:[{Category:Grains/Cereals,UnitPrice:38,ProductId:56,ProductName:Gnocchi di nonna Alice,UnitsInStock:21}]} +".NormalizeNewLines()).Or.StartsWith(@" +{category:Beverages,most-expensive-products:[{UnitsInStock:17,ProductName:Côte de Blaye,UnitPrice:263.5,Category:Beverages,ProductId:38}]} +{category:Condiments,most-expensive-products:[{UnitsInStock:24,ProductName:Vegie-spread,UnitPrice:43.9,Category:Condiments,ProductId:63}]} +{category:Produce,most-expensive-products:[{UnitsInStock:20,ProductName:Manjimup Dried Apples,UnitPrice:53,Category:Produce,ProductId:51}]} +{category:Meat/Poultry,most-expensive-products:[{UnitsInStock:0,ProductName:Thüringer Rostbratwurst,UnitPrice:123.79,Category:Meat/Poultry,ProductId:29}]} +{category:Seafood,most-expensive-products:[{UnitsInStock:42,ProductName:Carnarvon Tigers,UnitPrice:62.5,Category:Seafood,ProductId:18}]} +{category:Dairy Products,most-expensive-products:[{UnitsInStock:79,ProductName:Raclette Courdavault,UnitPrice:55,Category:Dairy Products,ProductId:59}]} +{category:Confections,most-expensive-products:[{UnitsInStock:40,ProductName:Sir Rodney's Marmalade,UnitPrice:81,Category:Confections,ProductId:20}]} +{category:Grains/Cereals,most-expensive-products:[{UnitsInStock:21,ProductName:Gnocchi di nonna Alice,UnitPrice:38,Category:Grains/Cereals,ProductId:56}]} +".NormalizeNewLines()).Or.StartsWith(@" +{category:Beverages,most-expensive-products:[{ProductId:38,ProductName:Côte de Blaye,Category:Beverages,UnitPrice:263.5,UnitsInStock:17}]} +{category:Condiments,most-expensive-products:[{ProductId:63,ProductName:Vegie-spread,Category:Condiments,UnitPrice:43.9,UnitsInStock:24}]} +{category:Produce,most-expensive-products:[{ProductId:51,ProductName:Manjimup Dried Apples,Category:Produce,UnitPrice:53,UnitsInStock:20}]} +{category:Meat/Poultry,most-expensive-products:[{ProductId:29,ProductName:Thüringer Rostbratwurst,Category:Meat/Poultry,UnitPrice:123.79,UnitsInStock:0}]} +{category:Seafood,most-expensive-products:[{ProductId:18,ProductName:Carnarvon Tigers,Category:Seafood,UnitPrice:62.5,UnitsInStock:42}]} +{category:Dairy Products,most-expensive-products:[{ProductId:59,ProductName:Raclette Courdavault,Category:Dairy Products,UnitPrice:55,UnitsInStock:79}]} +{category:Confections,most-expensive-products:[{ProductId:20,ProductName:Sir Rodney's Marmalade,Category:Confections,UnitPrice:81,UnitsInStock:40}]} +{category:Grains/Cereals,most-expensive-products:[{ProductId:56,ProductName:Gnocchi di nonna Alice,Category:Grains/Cereals,UnitPrice:38,UnitsInStock:21}]} +".NormalizeNewLines())); + } + + [Test] + public void linq89() + { + Assert.That(render(@" +(defn linq89 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (avg) ) + (setq avg (average numbers)) + (println ""The average number is "" avg) + )) +(linq89)"), + + Does.StartWith(@" +The average number is 4.5 +".NormalizeNewLines())); + } + + [Test] + public void linq90() + { + Assert.That(render(@" +(defn linq90 [] + (let ( (words [""cherry"", ""apple"", ""blueberry""]) + (average-length) ) + (setq average-length (apply average (map count words))) + (println ""The average word length is "" average-length "" characters."") + )) +(linq90)"), + + Does.StartWith(@" +The average word length is 6.66666666666667 characters. +".NormalizeNewLines())); + } + + [Test] + public void linq91() + { + Assert.That(render(@" +(defn linq91 [] + (let ( (categories + (map #(it { + :category (.Key %) + :average-price (apply average (map .UnitPrice %)) + }) + (group-by .Category products-list))) ) + (doseq (x categories) (dump-inline x)) + )) +(linq91)"), + + Does.StartWith(@" +{category:Beverages,average-price:37.9791666666667} +{category:Condiments,average-price:23.0625} +{category:Produce,average-price:32.37} +{category:Meat/Poultry,average-price:54.0066666666667} +{category:Seafood,average-price:20.6825} +{category:Dairy Products,average-price:28.73} +{category:Confections,average-price:25.16} +{category:Grains/Cereals,average-price:20.25} +".NormalizeNewLines())); + } + + [Test] + public void linq92() + { + Assert.That(render(@" +(defn linq92 [] + (let ( (dbls [1.7 2.3 1.9 4.1 2.9]) + (product) ) + (setq product (reduce * dbls)) + (println ""Total product of all numbers: "" product) + )) +(linq92)"), + + Does.StartWith(@" +Total product of all numbers: 88.33081 +".NormalizeNewLines())); + } + + [Test] + public void linq93() + { + Assert.That(render(@" +(defn linq93 [] + (let ( (start-balance 100) + (attempted-withdrawls [20 10 40 50 10 70 30]) + (end-balance) ) + (setq end-balance (reduce (fn [balance withdrawl] (if (> balance withdrawl) (- balance withdrawl) balance)) + attempted-withdrawls start-balance)) + (println ""Ending balance: "" end-balance) + )) +(linq93)"), + + Does.StartWith(@" +Ending balance: 20 +".NormalizeNewLines())); + } + + [Test] + public void linq94() + { + Assert.That(render(@" +(defn linq94 [] + (let ( (numbers-a [0 2 4 5 6 8 9]) + (numbers-b [1 3 5 7 8]) ) + (setq all-numbers (flatten [numbers-a numbers-b])) + (println ""All numbers from both arrays:"") + (doseq (n all-numbers) (println n)) + )) +(linq94)"), + + Does.StartWith(@" +All numbers from both arrays: +0 +2 +4 +5 +6 +8 +9 +1 +3 +5 +7 +8 +".NormalizeNewLines())); + } + + [Test] + public void linq95() + { + Assert.That(render(@" +(defn linq95 [] + (let ( (customer-names (map .CompanyName customers-list)) + (product-names (map .ProductName products-list)) + (all-names) ) + (setq all-names (flatten [customer-names product-names])) + (println ""Customer and product names:"") + (doseq (x all-names) (println x)) + )) +(linq95)"), + + Does.StartWith(@" +Customer and product names: +Alfreds Futterkiste +Ana Trujillo Emparedados y helados +Antonio Moreno Taquería +Around the Horn +Berglunds snabbköp +Blauer See Delikatessen +".NormalizeNewLines())); + } + + [Test] + public void linq96() + { + Assert.That(render(@" +(defn linq96 [] + (let ( (words-a [""cherry"" ""apple"" ""blueberry""]) + (words-b [""cherry"" ""apple"" ""blueberry""]) ) + + (setq match (/sequenceEquals words-a words-b)) + (println ""The sequences match: "" match) + )) +(linq96)"), + + Does.StartWith(@" +The sequences match: True +".NormalizeNewLines())); + } + + [Test] + public void linq97() + { + Assert.That(render(@" +(defn linq97 [] + (let ( (words-a [""cherry"" ""apple"" ""blueberry""]) + (words-b [""apple"" ""blueberry"" ""cherry""]) ) + + (setq match (/sequenceEquals words-a words-b)) + (println ""The sequences match: "" match) + )) +(linq97)"), + + Does.StartWith(@" +The sequences match: nil +".NormalizeNewLines())); + } + + [Test] + public void linq99() + { + Assert.That(render(@" +(defn linq99 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (i 0) ) + (setq q (map #(it (fn [] (f++ i))) numbers)) + (doseq (v q) (println ""v = "" (v) "", i = "" i)) + )) +(linq99)"), + + Does.StartWith(@" +v = 0, i = 1 +v = 1, i = 2 +v = 2, i = 3 +v = 3, i = 4 +v = 4, i = 5 +v = 5, i = 6 +v = 6, i = 7 +v = 7, i = 8 +v = 8, i = 9 +v = 9, i = 10 +".NormalizeNewLines())); + } + + [Test] + public void linq100() + { + Assert.That(render(@" +(defn linq100 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) + (i 0) ) + (setq q (map #(it (f++ i)) numbers)) + (doseq (v q) (println ""v = "" v "", i = "" i)) + )) +(linq100)"), + + Does.StartWith(@" +v = 0, i = 10 +v = 1, i = 10 +v = 2, i = 10 +v = 3, i = 10 +v = 4, i = 10 +v = 5, i = 10 +v = 6, i = 10 +v = 7, i = 10 +v = 8, i = 10 +v = 9, i = 10 +".NormalizeNewLines())); + } + + [Test] + public void linq101() + { + Assert.That(render(@" +(defn linq101 [] + (let ( (numbers [5 4 1 3 9 8 6 7 2 0]) ) + + (defn low-numbers [] + (where #(<= % 3) numbers)) + + (println ""First run numbers <= 3:"") + (doseq (n (low-numbers)) (println n)) + + (setq numbers (map #(- %) numbers)) + + (println ""Second run numbers <= 3"") + (doseq (n (low-numbers)) (println n)) + )) +(linq101)"), + + Does.StartWith(@" +First run numbers <= 3: +1 +3 +2 +0 +Second run numbers <= 3 +-5 +-4 +-1 +-3 +-9 +-8 +-6 +-7 +-2 +0 +".NormalizeNewLines())); + } + + [Test] + public void test() + { + print("(where #(<= % 3) [-5 -4 1])"); + print(@"(setq numbers [5 4 1 3 9 8 6 7 2 0]) + (defn low-numbers [] + (where #(<= % 3) (map #(- %) numbers))) + (low-numbers)"); + +// print(@"(setq numbers '(5 4 1 3 9 8 6 7 2 0)) (take-while (fn (c) (>= (1st c) (2nd c))) (mapcar-index cons numbers))"); + +// print("(setq numbers-a '(1 2 3)) (setq numbers-b '(3 4 5)) (zip (fn (a b) { :a a :b b }) numbers-a numbers-b)"); +// print("(map #(* 2 %) (range 10))"); +// print("(fn (x) (.ProductName x))"); +// print(@"(fn (x) (new-map (list ""ProductName"" (.ProductName x)) ))"); + } + + } +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLispTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLispTests.cs new file mode 100644 index 00000000000..83b04d0f7cd --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptLispTests.cs @@ -0,0 +1,1024 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Linq; +using NUnit.Framework; +using ServiceStack.Logging; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptLispTests + { + [Test] + public void Can_eval_fib_lisp() + { + var lisp = @" +(defun fib (n) + (if (< n 2) + 1 + (+ (fib (- n 1)) + (fib (- n 2)) ) + )) +"; + + try + { + var lispCtx = Lisp.CreateInterpreter(); + + var sExpressions = Lisp.Parse(lisp); + var x = lispCtx.Eval(sExpressions); + $"{x}".Print(); + + sExpressions = Lisp.Parse("(fib 15)"); + x = lispCtx.Eval(sExpressions); + + $"{x}".Print(); + Assert.That((int)x, Is.EqualTo(987)); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + + [Test] + public void Can_eval_lisp_in_lisp() + { + var lisp = @" +;;; A circular Lisp interpreter in Common/Emacs/Nukata Lisp +;;; by SUZUKI Hisao on H28.8/10, H29.3/13 +;;; cf. Zick Standard Lisp (https://github.com/zick/ZickStandardLisp) + +(progn + ;; Expr: (EXPR environment (symbol...) expression...) + ;; Subr: (SUBR . function) + ;; Environment: ((symbol . value)...) + ;; N.B. Expr has its own environment since this Lisp is lexically scoped. + + ;; Language-specific Hacks + (setq funcall (lambda (f x) (f x))) ; for Nukata Lisp and this Lisp + (setq max-lisp-eval-depth 10000) ; for Emacs Lisp + (setq max-specpdl-size 7000) ; for Emacs Lisp + + ;; The global environment of this Lisp + (setq global-env + (list '(*version* . (1.2 ""Lisp"" ""circlisp"")) + (cons 'car + (cons 'SUBR (lambda (x) (car (car x))))) + (cons 'cdr + (cons 'SUBR (lambda (x) (cdr (car x))))) + (cons 'cons + (cons 'SUBR (lambda (x) (cons (car x) (cadr% x))))) + (cons 'eq + (cons 'SUBR (lambda (x) (eq (car x) (cadr% x))))) + (cons 'atom + (cons 'SUBR (lambda (x) (atom (car x))))) + (cons 'rplaca + (cons 'SUBR (lambda (x) (rplaca (car x) (cadr% x))))) + (cons 'rplacd + (cons 'SUBR (lambda (x) (rplacd (car x) (cadr% x))))) + (cons 'list + (cons 'SUBR (lambda (x) x))) + (cons '+ + (cons 'SUBR (lambda (x) (+ (car x) (cadr% x))))) + (cons '* + (cons 'SUBR (lambda (x) (* (car x) (cadr% x))))) + (cons '- + (cons 'SUBR (lambda (x) (- (car x) (cadr% x))))) + (cons 'truncate + (cons 'SUBR (lambda (x) (truncate (car x) (cadr% x))))) + (cons 'mod + (cons 'SUBR (lambda (x) (mod (car x) (cadr% x))))) + (cons '= + (cons 'SUBR (lambda (x) (= (car x) (cadr% x))))) + (cons '< + (cons 'SUBR (lambda (x) (< (car x) (cadr% x))))) + (cons 'print + (cons 'SUBR (lambda (x) (print (car x))))) + (cons 'apply + (cons 'SUBR (lambda (x) (apply% (car x) (cadr% x))))) + (cons 'eval + (cons 'SUBR (lambda (x) (eval% (car x) global-env)))))) + + (defun caar% (x) (car (car x))) + (defun cadr% (x) (car (cdr x))) + (defun cddr% (x) (cdr (cdr x))) + (defun caddr% (x) (car (cdr (cdr x)))) + (defun cdddr% (x) (cdr (cdr (cdr x)))) + (defun cadddr% (x) (car (cdr (cdr (cdr x))))) + + (defun assq% (key alist) ; cf. Emacs/Nukata Lisp + (if alist + (if (eq key (caar% alist)) + (car alist) + (assq% key (cdr alist))) + nil)) + + (defun pairlis% (keys data alist) ; cf. Common Lisp + (if keys + (cons (cons (car keys) (car data)) + (pairlis% (cdr keys) (cdr data) alist)) + alist)) + + ;; Define symbol as value in the global environment. + (defun global-def (sym val) + (rplacd global-env + (cons (car global-env) + (cdr global-env))) + (rplaca global-env + (cons sym val))) + + (defun eval% (e env) + (if (atom e) + ((lambda (var) + (if var + (cdr var) + e)) + (assq% e env)) + (if (eq (car e) 'quote) ; (quote e) + (cadr% e) + (if (eq (car e) 'if) ; (if e e e) + (if (eval% (cadr% e) env) + (eval% (caddr% e) env) + (eval% (cadddr% e) env)) + (if (eq (car e) 'progn) ; (progn e...) + (eval-progn (cdr e) env nil) + (if (eq (car e) 'lambda) ; (lambda (v...) e...) + (make-closure env (cdr e)) + (if (eq (car e) 'defun) ; (defun f (v...) e...) + (global-def (cadr% e) + (make-closure env (cddr% e))) + (if (eq (car e) 'setq) ; (setq v e) + ((lambda (var value) + (if var + (rplacd var value) + (global-def (cadr% e) value)) + value) + (assq% (cadr% e) env) + (eval% (caddr% e) env)) + (apply% (eval% (car e) env) ; (f e...) + (evlis (cdr e) env)))))))))) + + ;; (make-closure env '((v...) e...)) => (EXPR env (v...) e...) + (defun make-closure (env ve) + (cons 'EXPR + (cons env ve))) + + ;; (eval-progn '((+ 1 2) 3 (+ 4 5)) global-env nil) => 9 + (defun eval-progn (x env result) + (if x + (if (cdr x) + (eval-progn (cdr x) + env + (eval% (car x) env)) + (eval% (car x) env)) + result)) + + ;; (evlis '((+ 1 2) 3 (+ 4 5)) global-env) => (3 3 9) + (defun evlis (x env) + (if x + (cons (eval% (car x) env) + (evlis (cdr x) env)) + nil)) + + (defun apply% (fun arg) + (if (eq (car fun) 'EXPR) ; (EXPR env (v...) e...) + (eval-progn (cdddr% fun) + (pairlis% (caddr% fun) + arg + (cadr% fun)) + nil) + (if (eq (car fun) 'SUBR) ; (SUBR . f) + (funcall (cdr fun) arg) + fun))) + + (defun global-eval (e) + (eval% e global-env)) + + (global-eval (quote + +;; -- WRITE YOUR EXPRESSION HERE -- +(progn + (defun fib (n) + (if (< n 2) + 1 + (+ (fib (- n 1)) + (fib (- n 2))))) + (print (fib 10))) +;; -------------------------------- +))) +"; + + try + { + var lispCtx = Lisp.CreateInterpreter(); + + var sExpressions = Lisp.Parse(lisp); + var x = lispCtx.Eval(sExpressions); + Assert.That((int)x, Is.EqualTo(89)); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + + [Test] + public void Can_min_max_int_long_double_values() + { + var lispCtx = Lisp.CreateInterpreter(); + + Assert.That((int)lispCtx.Eval(Lisp.Parse("(min 1 2)")), Is.EqualTo(1)); + Assert.That((int)lispCtx.Eval(Lisp.Parse("(max 1 2)")), Is.EqualTo(2)); + + Assert.That((double)lispCtx.Eval(Lisp.Parse("(min 1.0 2.0)")), Is.EqualTo(1.0)); + Assert.That((double)lispCtx.Eval(Lisp.Parse("(max 1.0 2.0)")), Is.EqualTo(2.0)); + + Assert.That((long)lispCtx.Eval(Lisp.Parse($"(min {int.MaxValue + 1L} {int.MaxValue + 2L})")), Is.EqualTo(int.MaxValue + 1L)); + Assert.That((long)lispCtx.Eval(Lisp.Parse($"(max {int.MaxValue + 1L} {int.MaxValue + 2L})")), Is.EqualTo(int.MaxValue + 2L)); + } + + private static ScriptContext LispScriptContext(Dictionary<string, object> args = null) + { + var context = new ScriptContext { + ScriptLanguages = {ScriptLisp.Language} + }.Init(); + args?.Each((k,v) => context.Args[k] = v); + return context; + } + + [Test] + public void Can_eval_lisp_in_ScriptPage() + { + var context = LispScriptContext(); + + var script = @" +BEGIN LISP + +```lisp +(defun fib (n) + (if (< n 2) + 1 + (+ (fib (- n 1)) + (fib (- n 2)) ) + )) + +(fib 15) +``` + +AFTER LISP +"; + + var output = context.EvaluateScript(script); + var expected = @" +BEGIN LISP + +987 + +AFTER LISP".NormalizeNewLines(); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(expected)); + + // Can run twice with identical results + output = context.EvaluateScript(script); + Assert.That(output.NormalizeNewLines(), Is.EqualTo(expected)); + } + + [Test] + public void Can_get_and_export_script_value() + { + var context = LispScriptContext(new ObjectDictionary { ["contextArg"] = 1 }); + + var output = context.EvaluateScript(@" +{{ 2 | assignToGlobal => pageResultArg }} +{{ 3 | to => scopeArg }} +```lisp +(+ contextArg pageResultArg scopeArg) +```"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("6")); + + output = context.EvaluateScript(@" +{{ 2 | assignToGlobal => pageResultArg }} +{{ 3 | to => scopeArg }} +```lisp +(export retVal (+ contextArg pageResultArg scopeArg) + newVal 2) +``` +Global: {{ retVal + newVal }} +"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("Global: 8")); + } + + [Test] + public void Can_call_exported_delegate() + { + var context = LispScriptContext(); + + string output; + output = context.EvaluateScript(@" +{{ 1 | to => scopeArg }} +```lisp|q +(setq lispArg 2) +(setq localArg 3) +(defn lispAdd [a b] (+ a b localArg)) +(export exportedArg lispArg + lispAdd (to-delegate lispAdd)) +``` +Global: {{ lispAdd(scopeArg, exportedArg) }} +"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("Global: 6")); + + // def returns null output + output = context.EvaluateScript(@" +{{ 1 | to => scopeArg }} +```lisp +(def lispArg 2) +(def localArg 3) +(def lispAdd #(+ %1 %2 localArg)) +(export exportedArg lispArg + lispAdd (to-delegate lispAdd)) +``` +Global: {{ lispAdd(scopeArg, exportedArg) }} +"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("Global: 6")); + + } + + + [Test] + public void Does_support_quiet_blocks() + { + var context = LispScriptContext(new ObjectDictionary { ["contextArg"] = 1 }); + + var output = context.EvaluateScript(@" +{{ 2 | assignToGlobal => pageResultArg }} +{{ 3 | to => scopeArg }} +```lisp +(setq retVal (+ contextArg pageResultArg scopeArg)) +(setq newVal 2) +(export retVal retVal + newVal newVal) +``` +Global: {{ retVal + newVal }} +"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("6\n2\nGlobal: 8")); + + output = context.EvaluateScript(@" +{{ 2 | assignToGlobal => pageResultArg }} +{{ 3 | to => scopeArg }} +```lisp|quiet +(setq retVal (+ contextArg pageResultArg scopeArg)) +(setq newVal 2) +(export retVal retVal + newVal newVal) +``` +Global: {{ retVal + newVal }} +"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("Global: 8")); + } + + [Test] + public void Can_convert_IEnumerable_to_and_from_cons() + { + var context = LispScriptContext(new ObjectDictionary { + ["numArray"] = new[] { 1, 2, 3 }, + ["numList"] = new[] { 1, 2, 3 }.ToList(), + ["numSet"] = new[] { 1, 2, 3 }.ToHashSet(), + }); + + string render(string lisp) => context.EvaluateScript(lisp).NormalizeNewLines(); + + Assert.That(render(@" +```lisp +(export array1 (map 1+ '(1 2 3)) ) +``` +SUM: {{ array1.sum() }} +"), Is.EqualTo("SUM: 9")); + + Assert.That(render(@" +```lisp +(export array1 (map 1+ '(1 2 3)) ) +``` +SUM: {{ array1.toList().sum() }} +"), Is.EqualTo("SUM: 9")); + + Assert.That(render(@" +```lisp +(export + sum (reduce + (mapcar 1+ (to-cons numArray))) +) +``` +SUM: {{ sum }} +"), Is.EqualTo("SUM: 9")); + + } + + private static ScriptContext LispNetContext(Dictionary<string, object> args = null) + { + var context = new ScriptContext { + ScriptLanguages = { + ScriptLisp.Language + }, + ScriptMethods = { + new ProtectedScripts(), + }, + AllowScriptingOfAllTypes = true, + ScriptNamespaces = { + "System", + "System.Collections.Generic", + "ServiceStack", + typeof(StaticLog).Namespace, + }, + ScriptTypes = { + typeof(DynamicInt), + } + }; + args?.Each((k,v) => context.Args[k] = v); + return context.Init(); + } + + [Test] + public void Can_call_delegates_LISP() + { + var context = LispNetContext(new ObjectDictionary { + ["stringNums"] = "1 2 3", + ["strings"] = new List<string> { " A ", " B ", " C " }, + ["argIncr"] = (Func<int,int>)(x => x + 1), + }); + + string render(string lisp) => context.RenderLisp(lisp).NormalizeNewLines(); + + Assert.That(render(@"(/join (map 1+ '(1 2 3)))"), Is.EqualTo("2,3,4")); + Assert.That(render(@"(/join (map 1+ '(1 2 3)) "", "")"), Is.EqualTo("2, 3, 4")); + Assert.That(render(@"(String/Join "","" (to-array (map 1+ '(1 2 3))))"), Is.EqualTo("2,3,4")); + Assert.That(render(@"((/F ""String.Join(string,object[])"") "","" (to-array (map 1+ '(1 2 3))))"), Is.EqualTo("2,3,4")); + Assert.That(render(@"(F ""String.Join(string,object[])"" "","" (map 1+ '(1 2 3)))"), Is.EqualTo("2,3,4")); + Assert.That(render(@"(F ""String.Join"" "","" (to-array (map 1+ '(1 2 3))))"), Is.EqualTo("2,3,4")); + + Assert.That(render(@"(/sum (map 1+ '(1 2 3)))"), Is.EqualTo("9")); + Assert.That(render(@"(/sum (map argIncr '(1 2 3)))"), Is.EqualTo("9")); + Assert.That(render(@"(/sum (map /incr '(1 2 3)))"), Is.EqualTo("9")); + + Assert.That(render(@"(/sum (map Math/Sqrt '(1 4 9)))"), Is.EqualTo("6")); + Assert.That(render(@"(/sum (map (/F ""Math.Sqrt"") '(1 4 9)))"), Is.EqualTo("6")); + + Assert.That(render(@"(/concat (map .Trim strings))"), Is.EqualTo("ABC")); + Assert.That(render(@"(/join (map .Trim strings))"), Is.EqualTo("A,B,C")); + Assert.That(render(@"(.Replace stringNums "" "" "", "")"), Is.EqualTo("1, 2, 3")); + Assert.That(render(@"(.Name (/typeof ""int""))"), Is.EqualTo("Int32")); + + Assert.That(context.RenderScript(@" +{{#function templateIncr(i) }} + i | incr | return +{{/function}} + +```lisp +(/sum (map templateIncr '(1 2 3))) +``` +").NormalizeNewLines(), Is.EqualTo("9")); + + Assert.That(context.RenderScript(@" +```code +#function codeIncr(i) + return (i.incr()) +/function +``` + +```lisp +(/sum (map codeIncr '(1 2 3))) +``` +").NormalizeNewLines(), Is.EqualTo("9")); + + Assert.That(context.RenderScript(@" +A + +```code +#function codeIncr(i) + return (i.incr()) +/function +``` + +B + +```lisp +(/sum (map codeIncr '(1 2 3))) +``` + +C +").NormalizeNewLines(), Is.EqualTo("A\n\n\nB\n\n9\nC")); + } + + [Test] + public void Can_create_Function_for_static_Methods_LISP() + { + var context = LispNetContext(new ObjectDictionary { + ["msg"] = "msg string" + }); + + string eval(string lisp) => context.EvaluateLisp<string>(lisp); + + context.RenderLisp(@"(setq writeln (/F ""Console.WriteLine(string)"")) (writeln msg)"); + + Assert.That(eval(@"(StaticLog/Clear) (StaticLog/Log msg) (return (StaticLog/AllLogs))"), + Is.EqualTo("msg string")); + Assert.That(eval(@"(StaticLog/Clear) (StaticLog/Log<int> msg) (return (StaticLog/AllLogs))"), + Is.EqualTo("Int32 msg string")); + Assert.That(eval(@"(StaticLog/Clear) ((/F ""StaticLog.Log"") msg) (return (StaticLog/AllLogs))"), + Is.EqualTo("msg string")); + } + + [Test] + public void Can_create_Function_for_generic_type_static_Methods_LISP() + { + var context = LispNetContext(new ObjectDictionary { + ["msg"] = "msg string" + }); + + string eval(string lisp) => context.EvaluateLisp<string>(lisp); + + Assert.That(eval(@"(GenericStaticLog<string>/Clear) (setq log (/F ""GenericStaticLog<string>.Log(string)"")) (log msg) (return (GenericStaticLog<string>/AllLogs))"), + Is.EqualTo("String msg string")); + Assert.That(eval(@"(GenericStaticLog<string>/Clear) (setq log (/F ""GenericStaticLog<string>.Log<int>(string)"")) (log msg) (return (GenericStaticLog<string>/AllLogs))"), + Is.EqualTo("String Int32 msg string")); + } + + + [Test] + public void Can_create_Function_for_instance_methods_LISP() + { + var context = LispNetContext(new ObjectDictionary { + ["msg"] = "msg string" + }); + + string eval(string lisp) => context.EvaluateLisp<string>(lisp); + + Assert.That(eval(@"(setq o (InstanceLog. ""instance"")) (.Log o msg) (return (.AllLogs o))"), + Is.EqualTo("instance msg string")); + } + + [Test] + public void Can_create_Type_from_registered_Script_Assembly_LISP() + { + var context = LispNetContext(); + + string render(string lisp) => context.RenderLisp(lisp).NormalizeNewLines(); + string eval(string lisp) => context.EvaluateLisp<string>(lisp); + + Assert.That(render("(.add (DynamicInt.) 1 2)"), Is.EqualTo("3")); + Assert.That(render(@"(.add (new ""DynamicInt"") 1 2)"), Is.EqualTo("3")); + Assert.That(render(@"(.add (new (/typeof ""DynamicInt"")) 1 2)"), Is.EqualTo("3")); + Assert.That(render(@"(.add (C ""DynamicInt()"") 1 2)"), Is.EqualTo("3")); + Assert.That(render(@"(.add ((/C ""DynamicInt()"")) 1 2)"), Is.EqualTo("3")); + + Assert.That(render("(.GetTotal (Ints. 1 2))"), Is.EqualTo("3")); + + Assert.That(render(@"(.ToString (new ""Adder"" ""A""))"), Is.EqualTo($"string: A")); + Assert.That(render(@"(.ToString (C ""Adder(string)"" ""A""))"), Is.EqualTo($"string: A")); + Assert.That(render(@"(.ToString ((/C ""Adder(string)"") ""A""))"), Is.EqualTo($"string: A")); + + Assert.That(eval("(setq ints (Ints. 1 2)) (.AddA ints 3) (.AddA ints 4) (return (.GetTotal ints))"), Is.EqualTo("10")); + + //Assert.That(render("(.GetTotal (doto (Ints. 1 2) (.C 3) (.D 4)) )"), Is.EqualTo("10")); + } + + [Test] + public void Can_create_generic_types_LISP() + { + var context = LispNetContext(); + + object eval(string lisp) => context.EvaluateLisp($"(return (let () {lisp}))"); + + Assert.That(eval(@"((/C ""Tuple<String,int>(String,int)"") ""A"" 1)"), + Is.EqualTo(new Tuple<string, int>("A", 1))); + Assert.That(eval(@"(C ""Tuple<String,int>(String,int)"" ""A"" 1)"), + Is.EqualTo(new Tuple<string, int>("A", 1))); + + Assert.That(eval(@"((/C ""Tuple< String, int >( String, int )"") ""A"" 1)"), + Is.EqualTo(new Tuple<string, int>("A", 1))); + Assert.That(eval(@"(C ""Tuple< String, int >( String, int )"" ""A"" 1)"), + Is.EqualTo(new Tuple<string, int>("A", 1))); + } + + [Test] + public void Can_call_generic_methods_LISP() + { + + var context = LispNetContext(); + + object eval(string lisp) => context.EvaluateLisp($"(return (let () {lisp}))"); + + Assert.That(eval(@"((/F ""Tuple.Create<String,int>(String,int)"") ""A"" 1)"), + Is.EqualTo(new Tuple<string, int>("A", 1))); + Assert.That(eval(@"(F ""Tuple.Create<String,int>(String,int)"" ""A"" 1)"), + Is.EqualTo(new Tuple<string, int>("A", 1))); + + Assert.That(eval(@"((/F ""Tuple.Create< String , int >( String , int )"") ""A"" 1)"), + Is.EqualTo(new Tuple<string, int>("A", 1))); + Assert.That(eval(@"(F ""Tuple.Create< String , int >( String , int )"" ""A"" 1)"), + Is.EqualTo(new Tuple<string, int>("A", 1))); + } + + [Test] + public void Can_create_type_with_constructor_arguments_LISP() + { + var context = LispNetContext(); + object eval(string lisp) => context.EvaluateLisp($"(return (let () {lisp}))"); + + Assert.That(eval("(.GetTotal (Ints. 1 2))"), Is.EqualTo(3)); + Assert.That(eval("(.GetTotal (/set (Ints. 1 2) { :C 3 :D 4 }))"), Is.EqualTo(10)); + Assert.That(eval("(.GetTotal (set (Ints. 1 2) { :C 3 :D 4 }))"), Is.EqualTo(10)); + } + + [Test] + public void Can_call_inner_class_properties_LISP() + { + var context = LispNetContext(new ObjectDictionary { + ["o"] = new StaticLog(), + ["o1"] = new StaticLog.Inner1(), + }); + + string result = null; + + Assert.That(context.EvaluateLisp<string>("(return (StaticLog/Prop))"), Is.EqualTo("StaticLog.Prop")); + Assert.That(context.EvaluateLisp<string>("(return (StaticLog/Field))"), Is.EqualTo("StaticLog.Field")); + Assert.That(context.EvaluateLisp<string>("(return (StaticLog/Const))"), Is.EqualTo("StaticLog.Const")); + + Assert.That(context.EvaluateLisp<string>("(return (StaticLog.Inner1/Prop1))"), Is.EqualTo("StaticLog.Inner1.Prop1")); + Assert.That(context.EvaluateLisp<string>("(return (StaticLog.Inner1/Field1))"), Is.EqualTo("StaticLog.Inner1.Field1")); + Assert.That(context.EvaluateLisp<string>("(return (StaticLog.Inner1/Const1))"), Is.EqualTo("StaticLog.Inner1.Const1")); + + Assert.That(context.EvaluateLisp<string>("(return (StaticLog.Inner1.Inner2/Prop2))"), Is.EqualTo("StaticLog.Inner1.Inner2.Prop2")); + Assert.That(context.EvaluateLisp<string>("(return (StaticLog.Inner1.Inner2/Field2))"), Is.EqualTo("StaticLog.Inner1.Inner2.Field2")); + Assert.That(context.EvaluateLisp<string>("(return (StaticLog.Inner1.Inner2/Const2))"), Is.EqualTo("StaticLog.Inner1.Inner2.Const2")); + + Assert.That(context.EvaluateLisp<string>("(return (.InstanceProp o))"), Is.EqualTo("StaticLog.InstanceProp")); + Assert.That(context.EvaluateLisp<string>("(return (.InstanceField o))"), Is.EqualTo("StaticLog.InstanceField")); + + Assert.That(context.EvaluateLisp<string>("(return (.InstanceProp1 o1))"), Is.EqualTo("StaticLog.Inner1.InstanceProp1")); + Assert.That(context.EvaluateLisp<string>("(return (.InstanceField1 o1))"), Is.EqualTo("StaticLog.Inner1.InstanceField1")); + } + + [Test] + public void Can_Call_registered_IOC_Dependency_LISP() + { + var context = LispNetContext(); + context.ScriptTypes.Add(typeof(InstanceLog)); + context.Container.AddTransient(() => new InstanceLog("ioc")); + context.Init(); + + object eval(string lisp) => context.EvaluateLisp($"(return (let () {lisp}))"); + + var result = eval(@" + (def o (/resolve ""InstanceLog"")) + (.Log o ""arg"") + (.AllLogs o)".NormalizeNewLines()); + + Assert.That(result, Is.EqualTo("ioc arg")); + } + + [Test] + public void Can_map_on_IEnumerables() + { + var context = LispScriptContext(new ObjectDictionary { + ["numArray"] = new[] { 1, 2, 3 }, + ["numList"] = new[] { 1, 2, 3 }.ToList(), + ["numSet"] = new[] { 1, 2, 3 }.ToHashSet(), + }); + + string render(string lisp) => context.RenderLisp(lisp).NormalizeNewLines(); + + Assert.That(render(@"(reduce + (mapcar 1+ '(1 2 3)))"), Is.EqualTo("9")); + + // sum can do mapcar + all num's + Assert.That(render(@"(sum (mapcar 1+ '(1 2 3)))"), Is.EqualTo("9")); + Assert.That(render(@"(sum (mapcar 1+ '(1.1 2 3)))"), Is.EqualTo("9.1")); + Assert.That(render(@"(sum (mapcar 1+ '(1 2 3.1)))"), Is.EqualTo("9.1")); + + Assert.That(render(@"(sum (map 1+ '(1 2 3)))"), Is.EqualTo("9")); + Assert.That(render(@"(sum (map 1+ numArray))"), Is.EqualTo("9")); + Assert.That(render(@"(sum (map 1+ numList))"), Is.EqualTo("9")); + Assert.That(render(@"(sum (map 1+ numSet))"), Is.EqualTo("9")); + + Assert.That(render(@"(defmacro 2+ (n) `(+ ,n 2)) (sum (map 2+ '(1 2 3)))"), Is.EqualTo("12")); + } + + [Test] + public void Does_print_to_Output_Stream() + { + var context = LispScriptContext(); + + Assert.That(context.RenderLisp(@"10 (let () (println ""A"")(print '(1 2 3)) (terpri) nil) 20").NormalizeNewLines(), + Is.EqualTo("10\nA\n(1 2 3)\n20")); + + Assert.That(context.RenderLisp(@"10 (/write ""A"") 20").Replace("\r",""), + Is.EqualTo("10\nA20\n")); + } + + [Test] + public void Does_limit_max_iterations() + { + var context = LispScriptContext(); + + // Context.MaxIterations = 1000000 but LISP Eval can be called 10x+ for evaluating 1 op + context.RenderLisp(@"(dotimes (i 90000) (print i))"); + + // Count resets per LISP Statement Block + context.EvaluateScript(@" +```lisp +(dotimes (i 90000) (print i)) +``` + +```lisp +(dotimes (i 90000) (print i)) +``` +"); + + try + { + context.RenderLisp("(dotimes (i 100001) (print i))"); + Assert.Fail("Should Throw"); + } + catch (ScriptException e) + { + Assert.That(e.InnerException is NotSupportedException); + } + + try + { + context.EvaluateScript(@" + ```lisp + (dotimes (i 100001) (print i)) + ``` + "); + Assert.Fail("Should Throw"); + } + catch (ScriptException e) + { + Assert.That(e.InnerException is NotSupportedException); + } + + try + { + context.RenderLisp(@" + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 10000) (print i)) + (dotimes (i 1) (print i)) + "); + Assert.Fail("Should Throw"); + } + catch (ScriptException e) + { + Assert.That(e.InnerException is NotSupportedException); + } + + // 23 Max =~ 92735 iterations + context.RenderLisp(@" + (defun fib (n) + (if (< n 2) + 1 + (+ (fib (- n 1)) + (fib (- n 2)) ) + )) + (fib 23) + "); + + try + { + // 24 Max =~ 150049 iterations + context.RenderLisp(@" + (defun fib (n) + (if (< n 2) + 1 + (+ (fib (- n 1)) + (fib (- n 2)) ) + )) + (fib 24) + "); + Assert.Fail("Should Throw"); + } + catch (Exception e) + { + Console.WriteLine(e); + Assert.That(e.InnerException is NotSupportedException); + } + } + + [Test] + public void Can_embed_lisp_expressions_in_Script() + { + var context = LispScriptContext(); + + Assert.That(context.RenderScript(@"1 + 1 = {|lisp (+ 1 1) |}.").NormalizeNewLines(), + Is.EqualTo("1 + 1 = 2.")); + Assert.That(context.RenderScript(@"1 + 1 = {|lisp (+ 1 1) |}, 3 + 4 = {|lisp (+ 3 4) |}.").NormalizeNewLines(), + Is.EqualTo("1 + 1 = 2, 3 + 4 = 7.")); + Assert.That(context.RenderScript(@"1 + 1 = {|lisp (+ 1 1) |}, 3 + 4 = {{ 3 + 4 }}.").NormalizeNewLines(), + Is.EqualTo("1 + 1 = 2, 3 + 4 = 7.")); + + Assert.That(context.RenderScript(@"1 + 1 = {|code 1 + 1 |}.").NormalizeNewLines(), + Is.EqualTo("1 + 1 = 2\n.")); //every code expression statement is printed with a new line + Assert.That(context.RenderScript(@"1 + 1 = {{ 1 + 1 }}.").NormalizeNewLines(), + Is.EqualTo("1 + 1 = 2.")); // but not for template expressions + + Assert.That(context.RenderScript(@"fib(10) = +{|lisp + +(defun fib (n) + (if (< n 2) + 1 + (+ (fib (- n 1)) + (fib (- n 2)) ) + )) + +(fib 10) + +|}.").NormalizeNewLines(), + Is.EqualTo("fib(10) = \n89\n.")); + + // no LISP configured + context = new ScriptContext().Init(); + + Assert.That(context.RenderScript(@"1 + 1 = {|lisp (+ 1 1) |}.").NormalizeNewLines(), + Is.EqualTo("1 + 1 = {|lisp (+ 1 1) |}.")); + Assert.That(context.RenderScript(@"1 + 1 = {|lisp (+ 1 1) |}, 3 + 4 = {|lisp (+ 3 4) |}.").NormalizeNewLines(), + Is.EqualTo("1 + 1 = {|lisp (+ 1 1) |}, 3 + 4 = {|lisp (+ 3 4) |}.")); + Assert.That(context.RenderScript(@"1 + 1 = {|lisp (+ 1 1) |}, 3 + 4 = {{ 3 + 4 }}.").NormalizeNewLines(), + Is.EqualTo("1 + 1 = {|lisp (+ 1 1) |}, 3 + 4 = 7.")); + } + + [Test] + public void Can_import_into_global_symbols() + { + var SExprs = Lisp.Parse("(fib 10)"); + + var lispCtx = Lisp.CreateInterpreter(); + + try + { + lispCtx.Eval(SExprs); + Assert.Fail("should throw"); + } + catch (LispEvalException e) {} + + Lisp.Import(@" +(defun fib (n) + (if (< n 2) + 1 + (+ (fib (- n 1)) + (fib (- n 2)) ) + )) +"); + lispCtx = Lisp.CreateInterpreter(); + + Assert.That(lispCtx.Eval(SExprs), Is.EqualTo(89)); + + Lisp.Reset(); + + lispCtx = Lisp.CreateInterpreter(); + try + { + lispCtx.Eval(SExprs); + Assert.Fail("should throw"); + } + catch (LispEvalException e) {} + } + + // https://news.ycombinator.com/rss + private const string rss = @"<rss version=""2.0""> + <channel> + <title>Hacker News</title> + <link>https://news.ycombinator.com/</link> + <description>Links for the intellectually curious, ranked by readers.</description> + <item> + <title>Breaking Pills</title> + <link>https://blog.plover.com/math/breaking-pills.html</link> + <pubDate>Fri, 20 Sep 2019 07:57:54 +0000</pubDate> + <comments>https://news.ycombinator.com/item?id=21024224</comments> + </item> + <item> + <title>A Gentle introduction to Kubernetes with more than just the basics</title> + <link>https://github.com/eon01/kubernetes-workshop</link> + <pubDate>Thu, 19 Sep 2019 22:04:14 +0000</pubDate> + <comments>https://news.ycombinator.com/item?id=21021184</comments> + </item> + <item> + <title>EasyOS: An experimental Linux distribution designed from scratch for containers</title> + <link>https://easyos.org</link> + <pubDate>Fri, 20 Sep 2019 07:17:07 +0000</pubDate> + <comments>https://news.ycombinator.com/item?id=21023989</comments> + </item> + </channel> +</rss>"; + + private ObjectDictionary expected = new ObjectDictionary { + ["title"] = "Hacker News", + ["link"] = "https://news.ycombinator.com/", + ["description"] = "Links for the intellectually curious, ranked by readers.", + ["items"] = new List<ObjectDictionary> { + new ObjectDictionary { + ["title"] = "Breaking Pills", + ["link"] = "https://blog.plover.com/math/breaking-pills.html", + ["pubDate"] = "Fri, 20 Sep 2019 07:57:54 +0000", + ["comments"] = "https://news.ycombinator.com/item?id=21024224", + }, + new ObjectDictionary { + ["title"] = "A Gentle introduction to Kubernetes with more than just the basics", + ["link"] = "https://github.com/eon01/kubernetes-workshop", + ["pubDate"] = "Thu, 19 Sep 2019 22:04:14 +0000", + ["comments"] = "https://news.ycombinator.com/item?id=21021184", + }, + new ObjectDictionary { + ["title"] = "EasyOS: An experimental Linux distribution designed from scratch for containers", + ["link"] = "https://easyos.org", + ["pubDate"] = "Fri, 20 Sep 2019 07:17:07 +0000", + ["comments"] = "https://news.ycombinator.com/item?id=21023989", + }, + }, + }; + + [Test] + public void Can_parse_rss_LISP() + { + ConsoleLogFactory.Configure(); + var context = LispNetContext(new Dictionary<string, object> { + ["rss"] = rss + }).Init(); + + object eval(string lisp) => context.EvaluateLisp($"(return (let () {lisp}))"); + + var result = eval(@" +(defn parse-rss [xml] + (let ( (to) (doc) (channel) (items) (el) ) + (def doc (System.Xml.Linq.XDocument/Parse xml)) + (def to (ObjectDictionary.)) + (def items (List<ObjectDictionary>.)) + (def channel (first (.Descendants doc ""channel""))) + (def el (XLinqExtensions/FirstElement channel)) + + (while (not= (.LocalName (.Name el)) ""item"") + (.Add to (.LocalName (.Name el)) (.Value el)) + (def el (XLinqExtensions/NextElement el))) + + (doseq (elItem (.Descendants channel ""item"")) + (def item (ObjectDictionary.)) + (def el (XLinqExtensions/FirstElement elItem)) + + (while el + (.Add item (.LocalName (.Name el)) (.Value el)) + (def el (XLinqExtensions/NextElement el))) + + (.Add items item)) + + (.Add to ""items"" (to-list items)) + to + ) +) +(parse-rss rss) +"); + Assert.That(result, Is.EqualTo(expected)); + + var to = new ObjectDictionary(); + var items = new List<ObjectDictionary>(); + + var doc = XDocument.Parse(rss); + var channel = doc.Descendants("channel").First(); + var el = channel.FirstElement(); + while (el.Name != "item") + { + to[el.Name.LocalName] = el.Value; + el = el.NextElement(); + } + + var elItems = channel.Descendants("item"); + foreach (var elItem in elItems) + { + var item = new ObjectDictionary(); + el = elItem.FirstElement(); + while (el != null) + { + item[el.Name.LocalName] = el.Value; + el = el.NextElement(); + } + items.Add(item); + } + + to["items"] = items; + Assert.That(to, Is.EqualTo(expected)); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptMethodsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptMethodsTests.cs new file mode 100644 index 00000000000..cfff0399c40 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptMethodsTests.cs @@ -0,0 +1,309 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Configuration; +using ServiceStack.Data; +using ServiceStack.DataAnnotations; +using ServiceStack.IO; +using ServiceStack.OrmLite; +using ServiceStack.OrmLite.Sqlite; +using ServiceStack.Script; +using ServiceStack.Testing; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public interface IDep + { + string Greeting { get; set; } + + string SayHi(string name); + } + + public class Dep : IDep + { + public string Greeting { get; set; } = "Hello "; + + public string SayHi(string name) => Greeting + name; + } + + public class FilterExamples : ScriptMethods + { + public IDep Dep { get; set; } + + public IAppSettings AppSettings { get; set; } + + public string greet(string name) => Dep.SayHi(name); + + public int addInt(int target, int value) => + target + value; + } + + public class ScriptMethodsTests + { + [Test] + public void Can_Scan_FilterExamples_TemplateFilter() + { + var contexts = new[] + { + new ScriptContext + { + ScanTypes = {typeof(FilterExamples)} + }, + new ScriptContext + { + ScanAssemblies = {typeof(FilterExamples).Assembly} + }, + new ScriptContext + { + ScriptMethods = {new FilterExamples { Dep = new Dep()} } + }, + }; + + foreach (var context in contexts) + { + context.Container.AddSingleton<IDep>(() => new Dep()); + + context.Init(); + Assert.That(context.ScriptMethods.Count, Is.GreaterThanOrEqualTo(2)); + var filter = (FilterExamples)context.ScriptMethods.First(x => x is FilterExamples); + Assert.That(filter.Pages, Is.EqualTo(context.Pages)); + Assert.That(filter.Dep, Is.Not.Null); + } + } + + class AppHost : BasicAppHost + { + public AppHost() : base(typeof(AppHost).Assembly) {} + } + + [Test] + public void Does_scan_AppHost_Service_Assemblies_in_SharpPagesFeature() + { + using (new AppHost().Init()) + { + var context = new SharpPagesFeature().Init(); + + Assert.That(context.ScriptMethods.Count, Is.GreaterThanOrEqualTo(2)); + var filter = (FilterExamples)context.ScriptMethods.First(x => x is FilterExamples); + Assert.That(filter.Pages, Is.EqualTo(context.Pages)); + Assert.That(filter.AppSettings, Is.Not.Null); + } + } + + public ScriptContext CreateContext() + { + var context = new ScriptContext + { + ScanAssemblies = {typeof(FilterExamples).Assembly} + }; + + context.Container.AddSingleton<IDep>(() => new Dep { Greeting = "hi " }); + + return context; + } + + [Test] + public async Task Does_call_simple_filter() + { + var context = CreateContext().Init(); + + context.VirtualFiles.WriteFile("page.html", "<h1>{{ 'foo' |> greet }}, {{ \"bar\" |> greet }}</h1>"); + + var result = new PageResult(context.GetPage("page")); + + var html = await result.RenderToStringAsync(); + + Assert.That(html, Is.EqualTo("<h1>hi foo, hi bar</h1>")); + } + + [Test] + public async Task Does_call_addInt_filter_with_args() + { + var context = CreateContext().Init(); + + context.VirtualFiles.WriteFile("page.html", "<h1>{{ 1 |> addInt(2) }}</h1>"); + + var result = new PageResult(context.GetPage("page")); + + var html = await result.RenderToStringAsync(); + + Assert.That(html, Is.EqualTo("<h1>3</h1>")); + } + + [Test] + public async Task Does_call_multiple_addInt_filters_with_args() + { + var context = CreateContext().Init(); + + context.VirtualFiles.WriteFile("page.html", "<h1>{{ 1 |> addInt(2) |> addInt(3) }}</h1>"); + + var result = new PageResult(context.GetPage("page")); + + var html = await result.RenderToStringAsync(); + + Assert.That(html, Is.EqualTo("<h1>6</h1>")); + } + + [Test] + public async Task Can_use_addInt_filter_with_page_and_result_args() + { + var context = CreateContext().Init(); + + context.VirtualFiles.WriteFile("page.html", @" +<!-- +pageArg: 2 +--> + +<h1>{{ 1 |> addInt(pageArg) |> addInt(resultArg) }}</h1>"); + + var result = new PageResult(context.GetPage("page")) + { + Args = + { + { "resultArg", "3" }, + } + }; + + var html = await result.RenderToStringAsync(); + + Assert.That(html, Is.EqualTo("<h1>6</h1>")); + } + + [Test] + public async Task Does_call_recursive_addInt_filter_with_args() + { + var context = CreateContext().Init(); + + context.VirtualFiles.WriteFile("page.html", "<h1>{{ 1 |> addInt(addInt(2,3)) }}</h1>"); + + var result = new PageResult(context.GetPage("page")); + + var html = await result.RenderToStringAsync(); + + Assert.That(html, Is.EqualTo("<h1>6</h1>")); + } + + [Test] + public async Task Can_use_nested_addInt_filter_with_page_and_result_args() + { + var context = CreateContext().Init(); + + context.Args["contextArg"] = 10; + + context.VirtualFiles.WriteFile("page.html", @" +<!-- +pageArg: 2 +--> + +<h1>{{ 1 |> addInt(pageArg) |> addInt( addInt(addInt(2,resultArg),contextArg) ) }}</h1>"); + + var result = new PageResult(context.GetPage("page")) + { + Args = + { + { "resultArg", "3" }, + } + }; + + var html = await result.RenderToStringAsync(); + + Assert.That(html, Is.EqualTo("<h1>18</h1>")); + } + + [Test] + public void Can_disable_disable_filters() + { + var context = new ScriptContext + { + ExcludeFiltersNamed = { "repeat" } + }.Init(); + + var page = context.OneTimePage("{{ '.' |> repeat(3) }}{{ 3 |> repeating('-') }}"); + + Assert.That(new PageResult(page).Result, Is.EqualTo("---")); + + Assert.That(new PageResult(page){ ExcludeFiltersNamed = {"repeating"} }.Result, + Is.EqualTo("")); + } + + [Test] + public void Caches_are_kept_isolated_in_each_Context_Filter_instance() + { + var context = new ScriptContext + { + ScriptMethods = { new ProtectedScripts() } + }.Init(); + context.VirtualFiles.WriteFile("file.txt", "foo"); + context.VirtualFiles.WriteFile("page.html", "{{ 'file.txt' |> includeFileWithCache |> assignTo: contents }}" + + "{{ contents |> append('bar') |> upper |> repeat(2) }}"); + + Assert.That(new PageResult(context.GetPage("page")).Result, Is.EqualTo("FOOBARFOOBAR")); + Assert.That(context.ExpiringCache.Count, Is.EqualTo(1)); + Assert.That(context.ScriptMethods.First(x => x is DefaultScripts).InvokerCache.Count, Is.EqualTo(4)); + + /* TEMP START */ + var tempContext = new ScriptContext + { + ScriptMethods = { new ProtectedScripts() } + }.Init(); + tempContext.VirtualFiles.WriteFile("file.txt", "..."); + + var tmpPage = tempContext.OneTimePage("{{ 'file.txt' |> includeFileWithCache |> assignTo: contents }}" + + "{{ contents |> append('bar') |> repeat(3) }}"); + Assert.That(new PageResult(tmpPage).Result, Is.EqualTo("...bar...bar...bar")); + Assert.That(new PageResult(tmpPage).Result, Is.EqualTo("...bar...bar...bar")); + + Assert.That(tempContext.ExpiringCache.Count, Is.EqualTo(1)); + Assert.That(tempContext.ScriptMethods.First(x => x is DefaultScripts).InvokerCache.Count, Is.EqualTo(3)); + /* TEMP END */ + + Assert.That(new PageResult(context.GetPage("page")).Result, Is.EqualTo("FOOBARFOOBAR")); + Assert.That(context.ExpiringCache.Count, Is.EqualTo(1)); + Assert.That(context.ScriptMethods.First(x => x is DefaultScripts).InvokerCache.Count, Is.EqualTo(4)); + } + + class Post + { + [AutoIncrement] + public int Id { get; set; } + public string Title { get; set; } + public string Content { get; set; } + public DateTime Created { get; set; } + public string CreatedBy { get; set; } + public DateTime Modified { get; set; } + public string ModifiedBy { get; set; } + } + + [Test] + public void Filters_evaluates_async_results() + { + OrmLiteConfig.BeforeExecFilter = cmd => cmd.GetDebugString().Print(); + + var context = new ScriptContext + { + ScriptMethods = { new DbScriptsAsync() }, + Args = { + ["objectCount"] = Task.FromResult((object)1) + } + }; + context.Container.AddSingleton<IDbConnectionFactory>(() => new OrmLiteConnectionFactory(":memory:", SqliteOrmLiteDialectProvider.Instance)); + context.Init(); + + using (var db = context.Container.Resolve<IDbConnectionFactory>().Open()) + { + db.DropAndCreateTable<Post>(); + db.Insert(new Post { Title = "The Title", Content = "The Content", Created = DateTime.Now, Modified = DateTime.Now }); + } + + context.VirtualFiles.WriteFile("objectCount.html", "{{ objectCount |> assignTo: count }}{{ count }}"); + context.VirtualFiles.WriteFile("dbCount.html", "{{ dbScalar(`SELECT COUNT(*) FROM Post`) |> assignTo: count }}{{ count }}"); + + Assert.That(new PageResult(context.GetPage("objectCount")).Result, Is.EqualTo("1")); + Assert.That(new PageResult(context.GetPage("dbCount")).Result, Is.EqualTo("1")); + + OrmLiteConfig.BeforeExecFilter = null; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptPreprocessorTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptPreprocessorTests.cs new file mode 100644 index 00000000000..acf061ef723 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptPreprocessorTests.cs @@ -0,0 +1,113 @@ +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptPreprocessorTests + { + private const string CodeBlock = @" +<!-- +title: The title +--> + +# {{title}} + +{{ 1 + 1 }} + +```code +* Odd numbers < 5 * +#each i in range(1,5) + + #if i.isOdd() + `${i} is odd` + else + `${i} is even` + /if + +/each +``` + +```code +1 + 2 * 3 +``` + +```code + {{ 1 + 1 }} + + {{#if debug}} + {{ range(1,5) + |> where => it.isOdd() + |> map => it * it + |> join(',') + }} + {{/if}} +``` +"; + + [Test] + public void Does_process_code_block() + { + var processed = ScriptPreprocessors.TransformCodeBlocks(CodeBlock); + processed.Print(); + Assert.That(processed.NormalizeNewLines(), Is.EqualTo(@" +<!-- +title: The title +--> + +# {{title}} + +{{ 1 + 1 }} + +{{* Odd numbers < 5 *}} +{{#each i in range(1,5)}} +{{#if i.isOdd()}} +{{`${i} is odd`}} +{{else}} +{{`${i} is even`}} +{{/if}} +{{/each}} + +{{1 + 2 * 3}} + +{{ 1 + 1 }} +{{#if debug}} +{{ range(1,5) +|> where => it.isOdd() +|> map => it * it +|> join(',') +}} +{{/if}} +".NormalizeNewLines())); + } + + [Test] + public void Does_preprocess_code_blocks_by_default() + { + var context = new ScriptContext { + Preprocessors = { ScriptPreprocessors.TransformCodeBlocks } + }.Init(); + + var script = context.OneTimePage(CodeBlock); + + var output = new PageResult(script).Result; + output.Print(); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +# The title + +2 + +1 is odd +2 is even +3 is odd +4 is even +5 is odd + +7 + +2 +1,9,25".NormalizeNewLines())); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptSandboxTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptSandboxTests.cs new file mode 100644 index 00000000000..8e985bb544f --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptSandboxTests.cs @@ -0,0 +1,51 @@ +using System; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptSandboxIssues + { + [Test] + public void Does_not_allow_multiple_page_arguments() + { + var context = new ScriptContext(); + context.VirtualFiles.WriteFile("_layout.html", "The {{page}} layout"); + context.VirtualFiles.WriteFile("page.html", "A {{page}} variable"); + context.Init(); + + var page = context.GetPage("page"); + + try + { + new PageResult(page).RenderScript(); + Assert.Fail("should throw"); + } + catch (ScriptException e) + { + Assert.That(e.InnerException is NotSupportedException); + } + } + + [Test] + public void Does_not_allow_recursive_partials() + { + var context = new ScriptContext(); + context.VirtualFiles.WriteFile("partial.html", "A recursive {{'partial' |> partial}}"); + context.Init(); + + var page = context.GetPage("partial"); + + try + { + new PageResult(page).RenderScript(); + Assert.Fail("should throw"); + } + catch (ScriptException e) + { + Assert.That(e.InnerException is NotSupportedException); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptSyntaxErrorTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptSyntaxErrorTests.cs new file mode 100644 index 00000000000..301d69826a5 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptSyntaxErrorTests.cs @@ -0,0 +1,26 @@ +using System; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptSyntaxErrorTests + { + [Test] + public void Does_handle_unterminated_expression() + { + var context = new ScriptContext().Init(); + + try + { + context.Evaluate("{{"); + Assert.Fail("Should throw"); + } + catch (SyntaxErrorException e) + { + e.Message.Print(); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptTestUtils.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptTestUtils.cs new file mode 100644 index 00000000000..4851db839c5 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptTestUtils.cs @@ -0,0 +1,33 @@ +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class Person + { + public string Name { get; set; } + public int Age { get; set; } + + public Person() { } + public Person(string name, int age) + { + Name = name; + Age = age; + } + + protected bool Equals(Person other) => string.Equals(Name, other.Name) && Age == other.Age; + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == this.GetType() && Equals((Person) obj); + } + + public override int GetHashCode() + { + unchecked + { + return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ Age; + } + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptUseCaseTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptUseCaseTests.cs new file mode 100644 index 00000000000..7a48adeeb53 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptUseCaseTests.cs @@ -0,0 +1,272 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.IO; +using ServiceStack.OrmLite; +using ServiceStack.OrmLite.Sqlite; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ScriptUseCaseTests + { + [Test] + public void Does_execute_live_document() + { + var context = new ScriptContext().Init(); + + var template = @"{{ 11200 |> assignTo: balance }} +{{ 3 |> assignTo: projectedMonths }} +{{' +Salary: 4000 +App Royalties: 200 +'|> trim |> parseKeyValueText(':') |> assignTo: monthlyRevenues }} +{{' +Rent 1000 +Internet 50 +Mobile 50 +Food 400 +Misc 200 +'|> trim |> parseKeyValueText |> assignTo: monthlyExpenses }} +{{ monthlyRevenues |> values |> sum |> assignTo: totalRevenues }} +{{ monthlyExpenses |> values |> sum |> assignTo: totalExpenses }} +{{ subtract(totalRevenues, totalExpenses) |> assignTo: totalSavings }} + +Current Balance: <b>{{ balance |> currency }}</b> + +Monthly Revenues: +{{ monthlyRevenues |> toList |> select: { it.Key |> padRight(17) }{ it.Value |> currency }\n }} +Total <b>{{ totalRevenues |> currency }}</b> + +Monthly Expenses: +{{ monthlyExpenses |> toList |> select: { it.Key |> padRight(17) }{ it.Value |> currency }\n }} +Total <b>{{ totalExpenses |> currency }}</b> + +Monthly Savings: <b>{{ totalSavings |> currency }}</b> +{{ htmlErrorDebug }}"; + + var output = context.EvaluateScript(template); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +Current Balance: <b>$11,200.00</b> + +Monthly Revenues: +Salary $4,000.00 +App Royalties $200.00 + +Total <b>$4,200.00</b> + +Monthly Expenses: +Rent $1,000.00 +Internet $50.00 +Mobile $50.00 +Food $400.00 +Misc $200.00 + +Total <b>$1,700.00</b> + +Monthly Savings: <b>$2,500.00</b>".NormalizeNewLines())); + } + + class FilterInfoFilters : ScriptMethods + { + Type GetFilterType(string name) + { + switch(name) + { + case nameof(DefaultScripts): + return typeof(DefaultScripts); + case nameof(HtmlScripts): + return typeof(HtmlScripts); + case nameof(ProtectedScripts): + return typeof(ProtectedScripts); + case nameof(InfoScripts): + return typeof(InfoScripts); + case nameof(ServiceStackScripts): + return typeof(ServiceStackScripts); + case nameof(AutoQueryScripts): + return typeof(AutoQueryScripts); + } + + throw new NotSupportedException("Unknown Filter: " + name); + } + + public FilterInfo[] filtersAvailable(string name) + { + var filterType = GetFilterType(name); + var filters = filterType.GetMethods(BindingFlags.Instance | BindingFlags.Public); + var to = filters + .OrderBy(x => x.Name) + .ThenBy(x => x.GetParameters().Count()) + .Where(x => x.DeclaringType != typeof(ScriptMethods) && x.DeclaringType != typeof(object)) + .Where(m => !m.IsSpecialName) + .Select(x => FilterInfo.Create(x)); + + return to.ToArray(); + } + } + + public class FilterInfo + { + public string Name { get; set; } + public string FirstParam { get; set; } + public string ReturnType { get; set; } + public int ParamCount { get; set; } + public string[] RemainingParams { get; set; } + + public static FilterInfo Create(MethodInfo mi) + { + var paramNames = mi.GetParameters() + .Where(x => x.ParameterType != typeof(ScriptScopeContext)) + .Select(x => x.Name) + .ToArray(); + + var to = new FilterInfo { + Name = mi.Name, + FirstParam = paramNames.FirstOrDefault(), + ParamCount = paramNames.Length, + RemainingParams = paramNames.Length > 1 ? paramNames.Skip(1).ToArray() : new string[]{}, + ReturnType = mi.ReturnType?.Name, + }; + + return to; + } + + public string Return => ReturnType != null && ReturnType != nameof(StopExecution) ? " -> " + ReturnType : ""; + + public string Body => ParamCount == 0 + ? $"{Name}" + : ParamCount == 1 + ? $"|> {Name}" + : $"|> {Name}(" + string.Join(", ", RemainingParams) + $")"; + + public string Display => ParamCount == 0 + ? $"{Name}{Return}" + : ParamCount == 1 + ? $"{FirstParam} |> {Name}{Return}" + : $"{FirstParam} |> {Name}(" + string.Join(", ", RemainingParams) + $"){Return}"; + } + + [Test] + public void Can_query_filters() + { + var context = new ScriptContext + { + ScriptMethods = { new FilterInfoFilters() } + }.Init(); + + var results = context.EvaluateScript(@"{{ 'DefaultScripts' |> assignTo: filter }} +{{ filter |> filtersAvailable |> where => contains(lower(it.Name), lower(nameContains ?? '')) + |> assignTo: filters }} +{{#each filters}} +{{Body |> raw}} +{{/each}}", new Dictionary<string, object> { ["nameContains"] = "atan" }); + + Assert.That(results.NormalizeNewLines(), Is.EqualTo(@" +|> atan +|> atan2(x)".NormalizeNewLines())); + } + + + [Test] + public void Can_convert_dbScript_Results_to_Customer_Poco() + { + void AssertProduct(Product actual, Product expected) + { + Assert.That(actual.ProductId, Is.EqualTo(expected.ProductId)); + Assert.That(actual.ProductName, Is.EqualTo(expected.ProductName)); + Assert.That(actual.Category, Is.EqualTo(expected.Category)); + Assert.That(actual.UnitPrice, Is.EqualTo(expected.UnitPrice)); + Assert.That(actual.UnitsInStock, Is.EqualTo(expected.UnitsInStock)); + } + + var product1 = QueryData.Products[0]; + var product2 = QueryData.Products[1]; + var context = new ScriptContext + { + ScriptMethods = { new DbScriptsAsync() }, + Args = { + ["id"] = product1.ProductId, + } + }; + + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteOrmLiteDialectProvider.Instance); + context.Container.AddSingleton<IDbConnectionFactory>(() => dbFactory); + context.Init(); + + using (var db = context.Container.Resolve<IDbConnectionFactory>().Open()) + { + db.DropAndCreateTable<Product>(); + db.Insert(product1); + db.Insert(product2); + } + + + var result = context.Evaluate<Product>("{{ `select * from product where productId=@id` |> dbSingle({ id }) |> return }}"); + + result.TextDump().Print(); + + AssertProduct(result, product1); + + var results = context.Evaluate<Product[]>("{{ `select * from product where productId IN (@ids) order by productId` |> dbSelect({ ids }) |> return }}", + new ObjectDictionary { + ["ids"] = new[]{ product1.ProductId, product2.ProductId }, + }); + + results.TextDump().Print(); + + Assert.That(results.Length, Is.EqualTo(2)); + + AssertProduct(results[0], product1); + AssertProduct(results[1], product2); + } + + private static ScriptContext CreateDbContext() + { + var context = new ScriptContext { + ScriptMethods = {new DbScriptsAsync()}, + }; + + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteOrmLiteDialectProvider.Instance); + context.Container.AddSingleton<IDbConnectionFactory>(() => dbFactory); + context.Init(); + return context; + } + + [Test] + public void Can_use_GetTableNames_with_textDump() + { + var context = CreateDbContext(); + + using (var db = context.Container.Resolve<IDbConnectionFactory>().Open()) + { + db.DropAndCreateTable<Customer>(); + db.DropAndCreateTable<Product>(); + + QueryData.Customers.Take(1).Each(x => db.Insert(x)); + QueryData.Products.Take(3).Each(x => db.Insert(x)); + } + + var output = context.EvaluateScript("{{ dbTableNames |> textDump({ caption:'Tables' }) }}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("| Tables |\n|----------|\n| Customer |\n| Product |")); + + output = context.EvaluateScript("{{ dbTableNamesWithRowCounts |> textDump({ caption:'Tables' }) }}"); + Assert.That(output.NormalizeNewLines(), Is.EqualTo("| Tables ||\n|----------|---|\n| Product | 3 |\n| Customer | 1 |")); + } + + [Test] + public void Can_catch_dbSelect_exceptions() + { + var context = CreateDbContext(); + + var output = context.EvaluateScript("{{ `SELECT * FROM Unknown` |> dbSelect(null, { ifErrorReturn: 'No Table' }) }}"); + Assert.That(output, Is.EqualTo("No Table")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptValidationTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptValidationTests.cs new file mode 100644 index 00000000000..0bae121c9b0 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ScriptValidationTests.cs @@ -0,0 +1,110 @@ +using System; +using System.IO; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + /* + public class DynamicValidationServices : Service + { + public override void OnBeforeExecute(object requestDto) + { + try + { + // check if there's a script for this service + var script = TryResolve<IAppSettings>().GetString($"script.{requestDto.GetType().Name}.validation"); + if (script == null) + return; + + var context = HostContext.GetPlugin<SharpPagesFeature>(); + + var pageResult = new PageResult(context.OneTimePage(script)) { + Model = requestDto + }; + pageResult.WriteToAsync(Stream.Null); + } + catch (ScriptException e) + { + throw e.InnerException ?? e; + } + } + } + * + */ + + public class ScriptValidationTests + { + public class Person + { + public string Name { get; set; } + public int? Age { get; set; } + } + + [Test] + public void Can_validate_person_in_code() + { + var context = new ScriptContext().Init(); + + var code = @" +['Name','Age'] |> to => requiredProps +#each requiredProps + #if !model[it] + it.throwArgumentNullException() + /if +/each + +(Age < 13) |> ifThrowArgumentException('Must be 13 or over', 'Age') +"; + + try + { + var pageResult = new PageResult(context.CodeBlock(code)) { + Model = new Person() + }; + pageResult.RenderToStream(Stream.Null); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + if (!(e.InnerException is ArgumentNullException ne)) + throw; + + Assert.That(ne.ParamName, Is.EqualTo(nameof(Person.Name))); + } + + try + { + var pageResult = new PageResult(context.CodeBlock(code)) { + Model = new Person { Name = "A" } + }; + pageResult.RenderToStream(Stream.Null); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + if (!(e.InnerException is ArgumentNullException ne)) + throw; + + Assert.That(ne.ParamName, Is.EqualTo(nameof(Person.Age))); + } + + try + { + var pageResult = new PageResult(context.CodeBlock(code)) { + Model = new Person { Name = "A", Age = 1 } + }; + pageResult.RenderToStream(Stream.Null); + Assert.Fail("Should throw"); + } + catch (ScriptException e) + { + if (!(e.InnerException is ArgumentException ae)) + throw; + + Assert.That(ae.Message.Replace("\r",""), Is.EqualTo("Must be 13 or over\nParameter name: Age")); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ServiceStackScriptTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ServiceStackScriptTests.cs new file mode 100644 index 00000000000..370f48c3ba7 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/ServiceStackScriptTests.cs @@ -0,0 +1,434 @@ +using System.Collections.Generic; +using System.Linq; +using System.Net; +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.Formats; +using ServiceStack.IO; +using ServiceStack.OrmLite; +using ServiceStack.Script; +using ServiceStack.Testing; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class QueryProducts : QueryData<Product> {} + + public class GetAllProducts : IReturn<GetAllProductsResponse> {} + + public class GetAllProductsResponse + { + public Product[] Results { get; set; } + } + + public class TemplateServiceStackFiltersService : Service + { + public object Any(GetAllProducts request) => new GetAllProductsResponse + { + Results = QueryData.Products + }; + } + + public class QueryTemplateRockstars : QueryDb<Rockstar> {} + + public class QueryCustomers : QueryDb<Customer> + { + public string CustomerId { get; set; } + public string CompanyNameContains { get; set; } + public string[] CountryIn { get; set; } + } + + public class ServiceStackScriptTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(SharpPagesIntegrationTests), typeof(MyTemplateServices).Assembly) {} + + public readonly List<IVirtualPathProvider> TemplateFiles = new List<IVirtualPathProvider> + { + new MemoryVirtualFiles(), + new ResourceVirtualFiles(typeof(HtmlFormat).Assembly), + }; + public override List<IVirtualPathProvider> GetVirtualFileSources() => TemplateFiles; + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + DebugMode = true + }); + + container.Register<IDbConnectionFactory>(new OrmLiteConnectionFactory(":memory:", + SqliteDialect.Provider)); + + using (var db = container.Resolve<IDbConnectionFactory>().Open()) + { + db.DropAndCreateTable<Rockstar>(); + db.InsertAll(UnitTestExample.SeedData); + + db.DropAndCreateTable<Customer>(); + db.InsertAll(QueryData.Customers); + } + + Plugins.Add(new SharpPagesFeature + { + ApiPath = "/api", + Args = + { + ["products"] = QueryData.Products, + }, + ScriptMethods = + { + new DbScriptsAsync(), + new AutoQueryScripts(), + }, + }); + + Plugins.Add(new AutoQueryDataFeature { MaxLimit = 100 } + .AddDataSource(ctx => ctx.ServiceSource<Product>(ctx.ConvertTo<GetAllProducts>())) + ); + + Plugins.Add(new AutoQueryFeature { MaxLimit = 100 }); + + var files = TemplateFiles[0]; + + files.WriteFile("_layout.html", @" +<html> +<body id=root> +{{ page }} +{{ htmlErrorDebug }} +</body> +</html> +"); + files.WriteFile("autoquery-data-products.html", @" +{{ 'category,orderBy,take' |> importRequestParams }}{{ { category, orderBy, take } |> withoutNullValues |> sendToAutoQuery('QueryProducts') + |> toResults |> select: { it.ProductName }\n }}"); + + files.WriteFile("autoquery-rockstars.html", @" +{{ { qs.age, qs.orderBy, qs.take } |> withoutNullValues |> sendToAutoQuery('QueryTemplateRockstars') + |> toResults |> select: { it.FirstName } { it.LastName }\n }}"); + + files.WriteFile("autoquery-customer.html", @" +{{ { qs.customerId } |> sendToAutoQuery('QueryCustomers') + |> toResults |> select: { it.CustomerId }: { it.CompanyName }, { it.City }\n }}"); + + files.WriteFile("autoquery-customers.html", @" +{{ { qs.countryIn, qs.orderBy } |> sendToAutoQuery('QueryCustomers') + |> toResults |> select: { it.CustomerId }: { it.CompanyName }, { it.Country }\n }}"); + + files.WriteFile("autoquery-top5-de-uk.html", @" +{{ { countryIn:['UK','Germany'], orderBy:'customerId', take:5 } |> sendToAutoQuery('QueryCustomers') + |> toResults |> select: { it.CustomerId }: { it.CompanyName }, { it.Country }\n }}"); + + files.WriteFile("api/customers.html", @" +{{ 'id,city,country' |> importRequestParams }} +{{ qs.limit ?? 100 |> assignTo: limit }} + +{{ 'select CustomerId, CompanyName, City, Country from Customer' |> assignTo: sql }} + +{{ PathArgs |> endIfEmpty |> useFmt('{0} where CustomerId = @id', sql) |> dbSingle({ id: PathArgs[0] }) + |> return }} + +{{ id |> endIfEmpty |> use('CustomerId = @id') |> addTo: filters }} +{{ city |> endIfEmpty |> use('City = @city') |> addTo: filters }} +{{ country |> endIfEmpty |> use('Country = @country') |> addTo: filters }} +{{ filters |> endIfEmpty |> useFmt('{0} where {1}', sql, join(filters, ' and ')) |> assignTo: sql }} + +{{ sql |> appendFmt(' ORDER BY CompanyName {0}', sqlLimit(limit)) + |> dbSelect({ country, city, id }) + |> return }} +"); + } + } + + public static string BaseUrl = Config.ListeningOn; + + private readonly ServiceStackHost appHost; + public ServiceStackScriptTests() + { + appHost = new AppHost() + .Init() + .Start(BaseUrl); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + public void AssertHtmlContentType(HttpWebResponse res) + { + Assert.That(res.ContentType.MatchesContentType(MimeTypes.Html), $"Expected {MimeTypes.Html} got '{res.ContentType}'"); + } + + public void AssertJsonContentType(HttpWebResponse res) + { + Assert.That(res.ContentType.MatchesContentType(MimeTypes.Json), $"Expected {MimeTypes.Json} got '{res.ContentType}'"); + } + + [Test] + public void Can_call_AutoQuery_Data_services() + { + var html = BaseUrl.CombineWith("autoquery-data-products").GetStringFromUrl(responseFilter:AssertHtmlContentType); + Assert.That(html.NormalizeNewLines(), Does.StartWith(@" +<html> +<body id=root> + +Chai +Chang +Aniseed Syrup".NormalizeNewLines())); + } + + [Test] + public void Can_call_AutoQuery_Data_services_with_limit() + { + var html = BaseUrl.CombineWith("autoquery-data-products?orderBy=ProductName&take=3").GetStringFromUrl(responseFilter: AssertHtmlContentType); + Assert.That(html.NormalizeNewLines(), Does.StartWith(@" +<html> +<body id=root> + +Alice Mutton +Aniseed Syrup +Boston Crab Meat + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_call_AutoQuery_Data_services_with_category() + { + var html = BaseUrl.CombineWith("autoquery-data-products?category=Beverages").GetStringFromUrl(responseFilter: AssertHtmlContentType); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> + +Chai +Chang +Guaran&#225; Fant&#225;stica +Sasquatch Ale +Steeleye Stout +C&#244;te de Blaye +Chartreuse verte +Ipoh Coffee +Laughing Lumberjack Lager +Outback Lager +Rh&#246;nbr&#228;u Klosterbier +Lakkalik&#246;&#246;ri + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_call_AutoQuery_Db_services() + { + var html = BaseUrl.CombineWith("autoquery-rockstars").GetStringFromUrl(responseFilter: AssertHtmlContentType); + Assert.That(html.NormalizeNewLines(), Does.StartWith(@" +<html> +<body id=root> + +Jimi Hendrix +Jim Morrison +Kurt Cobain +Elvis Presley +David Grohl +Eddie Vedder +Michael Jackson + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_call_AutoQuery_Db_services_with_limit() + { + var html = BaseUrl.CombineWith("autoquery-rockstars?orderBy=FirstName&take=3").GetStringFromUrl(responseFilter: AssertHtmlContentType); + Assert.That(html.NormalizeNewLines(), Does.StartWith(@" +<html> +<body id=root> + +David Grohl +Eddie Vedder +Elvis Presley + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_call_AutoQuery_Db_services_by_age() + { + var html = BaseUrl.CombineWith("autoquery-rockstars?age=27&orderBy=LastName").GetStringFromUrl(responseFilter: AssertHtmlContentType); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> + +Kurt Cobain +Jimi Hendrix +Jim Morrison + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_call_AutoQuery_QueryCustomer_service_by_CityIn() + { + var html = BaseUrl.CombineWith("autoquery-customers") + .AddQueryParam("countryIn","UK,Germany") + .AddQueryParam("orderBy","customerId") + .GetStringFromUrl(responseFilter: AssertHtmlContentType); + html.Print(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@"<html> +<body id=root> + +ALFKI: Alfreds Futterkiste, Germany +AROUT: Around the Horn, UK +BLAUS: Blauer See Delikatessen, Germany +BSBEV: B&#39;s Beverages, UK +CONSH: Consolidated Holdings, UK +DRACD: Drachenblut Delikatessen, Germany +EASTC: Eastern Connection, UK +FRANK: Frankenversand, Germany +ISLAT: Island Trading, UK +KOENE: K&#246;niglich Essen, Germany +LEHMS: Lehmanns Marktstand, Germany +MORGK: Morgenstern Gesundkost, Germany +NORTS: North/South, UK +OTTIK: Ottilies K&#228;seladen, Germany +QUICK: QUICK-Stop, Germany +SEVES: Seven Seas Imports, UK +TOMSP: Toms Spezialit&#228;ten, Germany +WANDK: Die Wandernde Kuh, Germany + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_call_AutoQuery_QueryCustomer_top5_UK_Germany() + { + var html = BaseUrl.CombineWith("autoquery-top5-de-uk").GetStringFromUrl(responseFilter: AssertHtmlContentType); + html.Print(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@"<html> +<body id=root> + +ALFKI: Alfreds Futterkiste, Germany +AROUT: Around the Horn, UK +BLAUS: Blauer See Delikatessen, Germany +BSBEV: B&#39;s Beverages, UK +CONSH: Consolidated Holdings, UK + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_call_customers_api_page_without_arguments() + { + var url = BaseUrl.CombineWith("api", "customers"); + + var json = url.GetJsonFromUrl(responseFilter:AssertJsonContentType); + var customers = json.FromJson<List<Customer>>(); + Assert.That(customers.Count, Is.EqualTo(QueryData.Customers.Count)); + } + + [Test] + public void Can_call_customers_api_page_with_all_arguments() + { + var url = BaseUrl.CombineWith("api", "customers") + .AddQueryParam("country", "UK") + .AddQueryParam("city", "London") + .AddQueryParam("limit", 10); + + var json = url.GetJsonFromUrl(responseFilter: AssertJsonContentType); + var customers = json.FromJson<List<Customer>>(); + + Assert.That(customers.Map(x => x.CustomerId), Is.EquivalentTo("AROUT,BSBEV,CONSH,EASTC,NORTS,SEVES".Split(','))); + Assert.That(customers.All(x => x.Country == "UK")); + Assert.That(customers.All(x => x.City == "London")); + } + + [Test] + public void Can_call_single_customer_with_path_args() + { + var json = BaseUrl.CombineWith("api", "customers", "ALFKI").GetJsonFromUrl(responseFilter: AssertJsonContentType); + var customer = json.FromJson<Customer>(); + Assert.That(customer.CustomerId, Is.EqualTo("ALFKI")); + Assert.That(customer.CompanyName, Is.EqualTo("Alfreds Futterkiste")); + Assert.That(customer.City, Is.EqualTo("Berlin")); + Assert.That(customer.Country, Is.EqualTo("Germany")); + } + + [Test] + public void Can_call_customer_with_csv_extension_to_force_ContentType() + { + var json = BaseUrl.CombineWith("api", "customers").AddQueryParam("limit", 1).GetStringFromUrl(responseFilter: AssertJsonContentType); + Assert.That(json, Does.StartWith("[")); + + var html = BaseUrl.CombineWith("api", "customers.html").AddQueryParam("limit", 1).GetStringFromUrl(responseFilter: AssertHtmlContentType); + Assert.That(html, Does.StartWith("<")); + + var csv = BaseUrl.CombineWith("api", "customers.csv").AddQueryParam("limit", 1).GetStringFromUrl(); + Assert.That(csv, Does.StartWith("CustomerId,")); + } + + [Test] + public void Can_call_single_customer_with_json_extension_to_force_ContentType() + { + var json = BaseUrl.CombineWith("api", "customers", "ALFKI.json").GetStringFromUrl(responseFilter: AssertJsonContentType); + var customer = json.FromJson<Customer>(); + Assert.That(customer.CustomerId, Is.EqualTo("ALFKI")); + Assert.That(customer.CompanyName, Is.EqualTo("Alfreds Futterkiste")); + Assert.That(customer.City, Is.EqualTo("Berlin")); + Assert.That(customer.Country, Is.EqualTo("Germany")); + } + + [Test] + public void Can_use_ifAuthenticated_filters_when_authenticated() + { + var context = new ScriptContext + { + ScriptMethods = { new ServiceStackScripts() }, + Args = + { + [ScriptConstants.Request] = new MockHttpRequest + { + Items = + { + [Keywords.Session] = new AuthUserSession { DisplayName = "Auth User", IsAuthenticated = true } + } + } + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ isAuthenticated }}"), Is.EqualTo("True")); + Assert.That(context.EvaluateScript("{{ ifAuthenticated |> show: Y }}"), Is.EqualTo("Y")); + Assert.That(context.EvaluateScript("{{ ifNotAuthenticated |> show: N }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> onlyIfAuthenticated }}"), Is.EqualTo("1")); + Assert.That(context.EvaluateScript("{{ 1 |> endIfAuthenticated }}"), Is.EqualTo("")); + } + + [Test] + public void Can_use_ifAuthenticated_filters_when_not_authenticated() + { + var context = new ScriptContext + { + ScriptMethods = { new ServiceStackScripts() }, + }.Init(); + + Assert.That(context.EvaluateScript("{{ isAuthenticated }}"), Is.EqualTo("False")); + Assert.That(context.EvaluateScript("{{ ifAuthenticated |> show: Y }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ ifNotAuthenticated |> show: N }}"), Is.EqualTo("N")); + Assert.That(context.EvaluateScript("{{ 1 |> onlyIfAuthenticated }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ 1 |> endIfAuthenticated }}"), Is.EqualTo("1")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpApiTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpApiTests.cs new file mode 100644 index 00000000000..722be9d1a52 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpApiTests.cs @@ -0,0 +1,73 @@ +using System.Collections.Generic; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class SharpApiTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(SharpPageTests), typeof(SharpPagesService).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new SharpPagesFeature()); + + AfterInitCallbacks.Add(host => { + var memFs = VirtualFileSources.GetMemoryVirtualFiles(); + foreach (var entry in HtmlFiles) + { + memFs.AppendFile(entry.Key, entry.Value); + } + }); + } + + private static readonly Dictionary<string, string> HtmlFiles = new Dictionary<string, string> { + { + "_layout.html", + "<html><head><title>{{ title }}</title></head><body id='layout'>{{ page }}</body></html>" + }, { + "preview.html", + @"API /preview +* content : string - #Script to evaluate + +{{ qs.content |> evalTemplate({use:{plugins:'MarkdownScriptPlugin'}}) |> assignTo:response }} +{{ response |> return({ contentType:'text/plain' }) }}" + }, + }; + } + + private readonly ServiceStackHost appHost; + public SharpApiTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Does_evaluate_SharpAPi() + { + var output = Config.ListeningOn.CombineWith("preview.html") + .AddQueryParam("content", "{{10|times|select:{pow(index,2)},}}") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo("0,1,4,9,16,25,36,49,64,81,")); + } + + [Test] + public void Does_evaluateTemplate_with_no_content_returns_empty() + { + var output = Config.ListeningOn.CombineWith("preview.html") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.That(output.NormalizeNewLines(), Is.Empty); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageContextScriptMethodsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageContextScriptMethodsTests.cs new file mode 100644 index 00000000000..4f92e5bcdbd --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageContextScriptMethodsTests.cs @@ -0,0 +1,364 @@ +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Script; +using ServiceStack.Testing; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class SharpPageContextScriptMethodsTests + { + [Test] + public void Can_pass_variables_into_partials() + { + var context = new ScriptContext + { + Args = { ["defaultMessage"] = "this is the default message" } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> + <title>{{ title }}</title> +</head> +<body> +{{ 'header' |> partial({ id: 'the-page', message: 'in your header' }) }} +{{ page }} +</body>"); + + context.VirtualFiles.WriteFile("header.html", @" +<header id='{{ id |> otherwise('header') }}'> + {{ message |> otherwise(defaultMessage) }} +</header>"); + + context.VirtualFiles.WriteFile("page.html", @"<h1>{{ title }}</h1>"); + + var result = new PageResult(context.GetPage("page")) + { + Args = { ["title"] = "The title" } + }.Result; + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +<html> + <title>The title</title> +</head> +<body> + +<header id='the-page'> + in your header +</header> +<h1>The title</h1> +</body> +".NormalizeNewLines())); + } + + [Test] + public void Can_load_page_with_partial_and_scoped_variables() + { + var context = new ScriptContext + { + Args = + { + ["myPartial"] = "my-partial" + } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> + <title>{{ title }}</title> +</head> +<body> +{{ 'my-partial' |> partial({ title: 'with-partial', tag: 'h2' }) }} +{{ myPartial |> partial({ title: 'with-partial-binding', tag: 'h2' }) }} +<footer>{{ title }}</footer> +</body>"); + + context.VirtualFiles.WriteFile("my-partial.html", "<{{ tag }}>{{ title }}</{{ tag }}>"); + + var result = new PageResult(context.GetPage("my-partial")) + { + Args = { ["title"] = "The title" } + }.Result; + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +<html> + <title>The title</title> +</head> +<body> +<h2>with-partial</h2> +<h2>with-partial-binding</h2> +<footer>The title</footer> +</body> +".NormalizeNewLines())); + } + + [Test] + public void Can_load_page_with_page_or_partial_with_scoped_variables_containing_bindings() + { + var context = new ScriptContext + { + Args = + { + ["myPartial"] = "my-partial", + ["headingTag"] = "h2", + } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> + <title>{{ title }}</title> +</head> +<body> +{{ 'my-partial' |> partial({ title: title, tag: headingTag }) }} +{{ myPartial |> partial({ title: partialTitle, tag: headingTag }) }} +</body>"); + + context.VirtualFiles.WriteFile("my-partial.html", "<{{ tag }}>{{ title }}</{{ tag }}>"); + + var result = new PageResult(context.GetPage("my-partial")) + { + Args = + { + ["title"] = "The title", + ["partialTitle"] = "Partial Title", + } + }.Result; + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +<html> + <title>The title</title> +</head> +<body> +<h2>The title</h2> +<h2>Partial Title</h2> +</body> +".NormalizeNewLines())); + } + + [Test] + public void Does_replace_bindings() + { + var context = new ScriptContext + { + Args = + { + ["contextTitle"] = "The title", + ["contextPartial"] = "bind-partial", + ["contextTag"] = "h2", + ["a"] = "foo", + ["b"] = "bar", + } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> + <title>{{ title }}</title> +</head> +<body> +{{ contextPartial |> partial({ title: contextTitle, tag: contextTag, items: [a,b] }) }} +{{ page }} +</body>"); + + context.VirtualFiles.WriteFile("bind-partial.html", @" +<{{ tag }}>{{ title |> upper }}</{{ tag }}> +<p>{{ items |> join(', ') }}</p>"); + + context.VirtualFiles.WriteFile("bind-page.html", @" +<section> +{{ pagePartial |> partial({ tag: pageTag, items: items }) }} +</section> +"); + + var result = new PageResult(context.GetPage("bind-page")) + { + Args = + { + ["title"] = "Page title", + ["pagePartial"] = "bind-partial", + ["pageTag"] = "h3", + ["items"] = new[] { 1, 2, 3 }, + } + }.Result; + + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +<html> + <title>Page title</title> +</head> +<body> + +<h2>THE TITLE</h2> +<p>foo, bar</p> + +<section> + +<h3>PAGE TITLE</h3> +<p>1, 2, 3</p> +</section> + +</body> +".NormalizeNewLines())); + + } + + [Test] + public void Can_repeat_templates_using_selectEach() + { + var context = new ScriptContext + { + Args = + { + ["letters"] = new[]{ "A", "B", "C" }, + ["numbers"] = new[]{ 1, 2, 3 }, + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("<ul> {{ '<li> {{it}} </li>' |> selectEach(letters) }} </ul>")).Result, + Is.EqualTo("<ul> <li> A </li><li> B </li><li> C </li> </ul>")); + + Assert.That(new PageResult(context.OneTimePage("<ul> {{ '<li> {{it}} </li>' |> selectEach(numbers) }} </ul>")).Result, + Is.EqualTo("<ul> <li> 1 </li><li> 2 </li><li> 3 </li> </ul>")); + } + + [Test] + public void Can_use_escaped_chars_in_selectEach() + { + var context = new ScriptContext + { + Args = + { + ["letters"] = new[]{ "A", "B", "C" }, + } + }.Init(); + + var result = context.EvaluateScript("<ul>\n{{ '<li> {{it}} </li>\n' |> selectEach(letters) }}</ul>"); + Assert.That(result.NormalizeNewLines(), + Is.EqualTo(@"<ul> +<li> A </li> +<li> B </li> +<li> C </li> +</ul>".NormalizeNewLines())); + } + + [Test] + public void Can_repeat_templates_using_forEach_in_page_and_layouts() + { + var context = new ScriptContext + { + Args = + { + ["numbers"] = new[]{ 1, 2, 3 }, + } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<body> +<header> +<ul> {{ '<li> {{it}} </li>' |> selectEach(numbers) }} </ul> +</header> +<section> +{{ page }} +</section> +</body> +</html> +"); + context.VirtualFiles.WriteFile("page.html", "<ul> {{ '<li> {{it}} </li>' |> selectEach(letters) }} </ul>"); + + var result = new PageResult(context.GetPage("page")) + { + Args = + { + ["letters"] = new[]{ "A", "B", "C" }, + } + }.Result; + + Assert.That(result.NormalizeNewLines(), + Is.EqualTo(@" +<html> +<body> +<header> +<ul> <li> 1 </li><li> 2 </li><li> 3 </li> </ul> +</header> +<section> +<ul> <li> A </li><li> B </li><li> C </li> </ul> +</section> +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_repeat_templates_with_bindings_using_selectEach() + { + var context = new ScriptContext + { + Args = + { + ["items"] = new[] + { + new ModelBinding { Object = new NestedModelBinding { Prop = "A" }}, + new ModelBinding { Object = new NestedModelBinding { Prop = "B" }}, + new ModelBinding { Object = new NestedModelBinding { Prop = "C" }}, + }, + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("<ul> {{ '<li> {{ it.Object.Prop }} </li>' |> selectEach(items) }} </ul>")).Result, + Is.EqualTo("<ul> <li> A </li><li> B </li><li> C </li> </ul>")); + } + + [Test] + public void Can_repeat_templates_with_bindings_and_custom_scope_using_selectEach() + { + var context = new ScriptContext + { + Args = + { + ["items"] = new[] + { + new ModelBinding { Object = new NestedModelBinding { Prop = "A" }}, + new ModelBinding { Object = new NestedModelBinding { Prop = "B" }}, + new ModelBinding { Object = new NestedModelBinding { Prop = "C" }}, + }, + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("<ul> {{ '<li> {{ item.Object.Prop }} </li>' |> selectEach(items, { it: 'item' } ) }} </ul>")).Result, + Is.EqualTo("<ul> <li> A </li><li> B </li><li> C </li> </ul>")); + + // Equivalent with select: + Assert.That(new PageResult(context.OneTimePage("<ul> {{ items |> select: <li> { it.Object.Prop } </li> }} </ul>")).Result, + Is.EqualTo("<ul> <li> A </li><li> B </li><li> C </li> </ul>")); + } + + [Test] + public void Can_use_forEach_with_markdown() + { + using (new BasicAppHost().Init()) + { + var context = new SharpPagesFeature + { + Args = + { + ["items"] = new[]{ "foo", "bar", "qux" } + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ ' - {{it}}\n' |> selectEach(items) |> markdown }}")).Result.RemoveAllWhitespace(), + Is.EqualTo("<ul><li>foo</li><li>bar</li><li>qux</li></ul>".RemoveAllWhitespace())); + } + } + + [Test] + public void Can_access_partial_arguments() + { + var context = new ScriptContext().Init(); + + context.VirtualFiles.WriteFile("component.html", @"{{ files |> toList |> select: { it.Key }: { it.Value }\n }}"); + + context.VirtualFiles.WriteFile("page.html", "{{ 'component' |> partial({ files: { 'a': 'foo', 'b': 'bar' } }) }}"); + + var output = new PageResult(context.GetPage("page")).Result; + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +a: foo +b: bar +".NormalizeNewLines())); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageRawTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageRawTests.cs new file mode 100644 index 00000000000..f0f6e3328bd --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageRawTests.cs @@ -0,0 +1,963 @@ +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Caching; +using ServiceStack.IO; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class ModelBinding + { + public int Int { get; set; } + + public string Prop { get; set; } + + public NestedModelBinding Object { get; set; } + + public Dictionary<string, ModelBinding> Dictionary { get; set; } + + public List<ModelBinding> List { get; set; } + + public ModelBinding this[int i] + { + get => List[i]; + set => List[i] = value; + } + } + + public class NestedModelBinding + { + public int Int { get; set; } + + public string Prop { get; set; } + + public ModelBinding Object { get; set; } + + public AltNested AltNested { get; set; } + + public Dictionary<string, ModelBinding> Dictionary { get; set; } + + public List<ModelBinding> List { get; set; } + } + + public class AltNested + { + public string Field { get; set; } + } + + + public class SharpPageRawTests + { + [Test] + public async Task Can_generate_html_template_with_layout_in_memory() + { + var context = new ScriptContext().Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> + <title>{{ title }}</title> +</head> +<body> + {{ page }} +</body>"); + + context.VirtualFiles.WriteFile("page.html", @"<h1>{{ title }}</h1>"); + + var page = context.GetPage("page"); + var result = new PageResult(page) + { + Args = + { + {"title", "The Title"}, + } + }; + + var html = await result.RenderToStringAsync(); + + Assert.That(html, Is.EqualTo(@" +<html> + <title>The Title</title> +</head> +<body> + <h1>The Title</h1> +</body>")); + } + + [Test] + public async Task Can_generate_markdown_template_with_layout_in_memory() + { + var context = new ScriptContext + { + PageFormats = + { + new MarkdownPageFormat() + } + }.Init();; + + context.VirtualFiles.WriteFile("_layout.md", @" +# {{ title }} + +Brackets in Layout < & > + +{{ page }}"); + + context.VirtualFiles.WriteFile("page.md", @"## {{ title }}"); + + var page = context.GetPage("page"); + var result = new PageResult(page) + { + Args = + { + {"title", "The Title"}, + }, + ContentType = MimeTypes.Html, + OutputTransformers = { MarkdownPageFormat.TransformToHtml }, + }; + + var html = await result.RenderToStringAsync(); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@"<h1>The Title</h1> +<p>Brackets in Layout &lt; &amp; &gt; </p> +<h2>The Title</h2>".NormalizeNewLines())); + + } + + [Test] + public async Task Can_generate_markdown_template_with_html_layout_in_memory() + { + var context = new ScriptContext + { + PageFormats = + { + new MarkdownPageFormat() + } + }.Init();; + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> + <title>{{ title }}</title> +</head> +<body> + {{ page }} +</body>"); + + context.VirtualFiles.WriteFile("page.md", @"### {{ title }}"); + + var page = context.GetPage("page"); + var result = new PageResult(page) + { + Args = + { + {"title", "The Title"}, + }, + ContentType = MimeTypes.Html, + PageTransformers = { MarkdownPageFormat.TransformToHtml }, + }; + + var html = await result.RenderToStringAsync(); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@"<html> + <title>The Title</title> +</head> +<body> + <h3>The Title</h3> + +</body>".NormalizeNewLines())); + } + + [Test] + public async Task Does_explode_Model_properties_into_scope() + { + var context = new ScriptContext().Init(); + + context.VirtualFiles.WriteFile("page.html", @"Id: {{ Id }}, Name: {{ Name }}"); + + var result = await new PageResult(context.GetPage("page")) + { + Model = new Model { Id = 1, Name = "<foo>" } + }.RenderToStringAsync(); + + Assert.That(result, Is.EqualTo("Id: 1, Name: &lt;foo&gt;")); + } + + [Test] + public async Task Does_explode_Model_properties_of_anon_object_into_scope() + { + var context = new ScriptContext().Init(); + + context.VirtualFiles.WriteFile("page.html", @"Id: {{ Id }}, Name: {{ Name }}"); + + var result = await new PageResult(context.GetPage("page")) + { + Model = new { Id = 1, Name = "<foo>" } + }.RenderToStringAsync(); + + Assert.That(result, Is.EqualTo("Id: 1, Name: &lt;foo&gt;")); + } + + [Test] + public async Task Does_reload_modified_page_contents_in_DebugMode() + { + var context = new ScriptContext + { + DebugMode = true, //default + }.Init(); + + context.VirtualFiles.WriteFile("page.html", "<h1>Original</h1>"); + Assert.That(await new PageResult(context.GetPage("page")).RenderToStringAsync(), Is.EqualTo("<h1>Original</h1>")); + + await Task.Delay(1); //Memory VFS is too fast! + + context.VirtualFiles.WriteFile("page.html", "<h1>Updated</h1>"); + Assert.That(await new PageResult(context.GetPage("page")).RenderToStringAsync(), Is.EqualTo("<h1>Updated</h1>")); + } + + [Test] + public void Context_Throws_FileNotFoundException_when_page_does_not_exist() + { + var context = new ScriptContext(); + + Assert.That(context.Pages.GetPage("not-exists.html"), Is.Null); + + try + { + var page = context.GetPage("not-exists.html"); + Assert.Fail("Should throw"); + } + catch (FileNotFoundException e) + { + e.ToString().Print(); + } + } + + class MyFilter : ScriptMethods + { + public string echo(string text) => $"{text} {text}"; + public double squared(double value) => value * value; + public string greetArg(string key) => $"Hello {Context.Args[key]}"; + + public ICacheClient Cache { get; set; } + public string fromCache(string key) => Cache.Get<string>(key); + } + + [Test] + public void Does_use_custom_filter() + { + var context = new ScriptContext + { + Args = + { + ["contextArg"] = "foo" + }, + ScriptMethods = { new MyFilter() } + }.Init(); + + var output = context.EvaluateScript("<p>{{ 'contextArg' |> greetArg }}</p>"); + Assert.That(output, Is.EqualTo("<p>Hello foo</p>")); + + output = context.EvaluateScript("<p>{{ 10 |> squared }}</p>"); + Assert.That(output, Is.EqualTo("<p>100</p>")); + + output = new PageResult(context.OneTimePage("<p>{{ 'hello' |> echo }}</p>")) + { + ScriptMethods = { new MyFilter() } + }.Result; + Assert.That(output, Is.EqualTo("<p>hello hello</p>")); + + context = new ScriptContext + { + ScanTypes = { typeof(MyFilter) }, + }; + context.Container.AddSingleton<ICacheClient>(() => new MemoryCacheClient()); + context.Container.Resolve<ICacheClient>().Set("key", "foo"); + context.Init(); + + output = context.EvaluateScript("<p>{{ 'key' |> fromCache }}</p>"); + Assert.That(output, Is.EqualTo("<p>foo</p>")); + } + + [Test] + public async Task Does_embed_partials() + { + var context = new ScriptContext + { + Args = + { + ["copyright"] = "Copyright &copy; ServiceStack 2008-2017", + ["footer"] = "global-footer" + } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<head><title>{{ title }}</title></head> +<body> +{{ 'header' |> partial }} +<div id='content'>{{ page }}</div> +{{ footer |> partial }} +</body> +</html> +"); + context.VirtualFiles.WriteFile("header.html", "<header>{{ pageTitle |> titleCase }}</header>"); + context.VirtualFiles.WriteFile("page.html", "<h2>{{ contentTitle }}</h2><section>{{ 'page-content' |> partial }}</section>"); + context.VirtualFiles.WriteFile("page-content.html", "<p>{{ contentBody |> padRight(20,'.') }}</p>"); + context.VirtualFiles.WriteFile("global-footer.html", "<footer>{{ copyright |> raw }}</footer>"); + + var result = await new PageResult(context.GetPage("page")) + { + Args = + { + ["pageTitle"] = "I'm in your header", + ["contentTitle"] = "Content is King!", + ["contentBody"] = "About this page", + } + }.RenderToStringAsync(); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +<html> +<head><title></title></head> +<body> +<header>I&#39;m In Your Header</header> +<div id='content'><h2>Content is King!</h2><section><p>About this page.....</p></section></div> +<footer>Copyright &copy; ServiceStack 2008-2017</footer> +</body> +</html> +".NormalizeNewLines())); + } + + private static ModelBinding CreateModelBinding() + { + var model = new ModelBinding + { + Int = 1, + Prop = "The Prop", + Object = new NestedModelBinding + { + Int = 2, + Prop = "Nested Prop", + Object = new ModelBinding + { + Int = 21, + Prop = "Nested Nested Prop", + }, + AltNested = new AltNested + { + Field = "Object AltNested Field" + } + }, + Dictionary = new Dictionary<string, ModelBinding> + { + { + "map-key", + new ModelBinding + { + Int = 3, + Prop = "Dictionary Prop", + Object = new NestedModelBinding + { + Int = 5, + Prop = "Nested Dictionary Prop", + AltNested = new AltNested + { + Field = "Dictionary AltNested Field" + } + } + } + }, + }, + List = new List<ModelBinding> + { + new ModelBinding + { + Int = 4, + Prop = "List Prop", + Object = new NestedModelBinding {Int = 5, Prop = "Nested List Prop"} + } + } + }; + return model; + } + + [Test] + public async Task Does_evaluate_variable_binding_expressions() + { + var context = new ScriptContext + { + Args = + { + ["key"] = "the-key", + } + }.Init(); + + context.VirtualFiles.WriteFile("page.html", @"Prop = {{ Prop }}"); + + var model = CreateModelBinding(); + + var pageResultArg = new NestedModelBinding + { + Int = 2, + Prop = "Nested Prop", + Object = new ModelBinding + { + Int = 21, + Prop = "Nested Nested Prop", + }, + AltNested = new AltNested + { + Field = "Object AltNested Field" + } + }; + + var result = await new PageResult(context.GetPage("page")) + { + Model = model, + Args = { ["pageResultArg"] = pageResultArg } + }.Init(); + + var scope = result.CreateScope(); + + object value; + + value = scope.EvaluateExpression("key"); + Assert.That(value, Is.EqualTo("the-key")); + value = scope.EvaluateExpression("Prop"); + Assert.That(value, Is.EqualTo(model.Prop)); + + value = scope.EvaluateExpression("model.Prop"); + Assert.That(value, Is.EqualTo(model.Prop)); + value = scope.EvaluateExpression("model.Object.Prop"); + Assert.That(value, Is.EqualTo(model.Object.Prop)); + value = scope.EvaluateExpression("model.Object.Object.Prop"); + Assert.That(value, Is.EqualTo(model.Object.Object.Prop)); + value = scope.EvaluateExpression("model.Object.AltNested.Field"); + Assert.That(value, Is.EqualTo(model.Object.AltNested.Field)); + value = scope.EvaluateExpression("model[0].Prop"); + Assert.That(value, Is.EqualTo(model[0].Prop)); + value = scope.EvaluateExpression("model[0].Object.Prop"); + Assert.That(value, Is.EqualTo(model[0].Object.Prop)); + value = scope.EvaluateExpression("model.List[0]"); + Assert.That(value, Is.EqualTo(model.List[0])); + value = scope.EvaluateExpression("model.List[0].Prop"); + Assert.That(value, Is.EqualTo(model.List[0].Prop)); + value = scope.EvaluateExpression("model.List[0].Object.Prop"); + Assert.That(value, Is.EqualTo(model.List[0].Object.Prop)); + value = scope.EvaluateExpression("model.Dictionary[\"map-key\"].Prop"); + Assert.That(value, Is.EqualTo(model.Dictionary["map-key"].Prop)); + value = scope.EvaluateExpression("model.Dictionary['map-key'].Object.Prop"); + Assert.That(value, Is.EqualTo(model.Dictionary["map-key"].Object.Prop)); + value = scope.EvaluateExpression("model.Dictionary['map-key'].Object.AltNested.Field"); + Assert.That(value, Is.EqualTo(model.Dictionary["map-key"].Object.AltNested.Field)); + value = scope.EvaluateExpression("Object.AltNested.Field"); + Assert.That(value, Is.EqualTo(model.Object.AltNested.Field)); + + value = scope.EvaluateExpression("pageResultArg.Object.Prop"); + Assert.That(value, Is.EqualTo(pageResultArg.Object.Prop)); + value = scope.EvaluateExpression("pageResultArg.AltNested.Field"); + Assert.That(value, Is.EqualTo(pageResultArg.AltNested.Field)); + } + + [Test] + public async Task Does_evaluate_variable_binding_expressions_in_template() + { + var context = new ScriptContext + { + Args = + { + ["key"] = "the-key", + } + }.Init(); + + context.VirtualFiles.WriteFile("page.html", @" +Object.Object.Prop = '{{ Object.Object.Prop }}' +model.Object.Object.Prop = '{{ model.Object.Object.Prop }}' +model.Dictionary['map-key'].Object.AltNested.Field = '{{ model.Dictionary['map-key'].Object.AltNested.Field }}' +model.Dictionary['map-key'].Object.AltNested.Field |> lower = '{{ model.Dictionary['map-key'].Object.AltNested.Field |> lower }}' +"); + + var model = CreateModelBinding(); + + var result = await new PageResult(context.GetPage("page")) { Model = model }.RenderToStringAsync(); + + Assert.That(result.NormalizeNewLines(), Is.EqualTo(@" +Object.Object.Prop = 'Nested Nested Prop' +model.Object.Object.Prop = 'Nested Nested Prop' +model.Dictionary['map-key'].Object.AltNested.Field = 'Dictionary AltNested Field' +model.Dictionary['map-key'].Object.AltNested.Field |> lower = 'dictionary altnested field' +".NormalizeNewLines())); + } + + [Test] + public void Can_render_onetime_page_and_layout() + { + var context = new ScriptContext + { + Args = { ["key"] = "the-key" } + }.Init(); + + var adhocPage = context.OneTimePage("<h1>{{ key }}</h1>", "html"); + var result = new PageResult(adhocPage) { Model = CreateModelBinding() }.Result; + Assert.That(result, Is.EqualTo("<h1>the-key</h1>")); + + adhocPage = context.OneTimePage("<h1>{{ model.Dictionary['map-key'].Object.AltNested.Field |> lower }}</h1>", "html"); + result = new PageResult(adhocPage) { Model = CreateModelBinding() }.Result; + Assert.That(result, Is.EqualTo("<h1>dictionary altnested field</h1>")); + + adhocPage = context.OneTimePage("<h1>{{ key }}</h1>", "html"); + result = new PageResult(adhocPage) + { + LayoutPage = context.OneTimePage("<html><title>{{ model.List[0].Object.Prop |> lower }}</title><body>{{ page }}</body></html>", "html"), + Model = CreateModelBinding() + }.Result; + Assert.That(result, Is.EqualTo("<html><title>nested list prop</title><body><h1>the-key</h1></body></html>")); + } + + [Test] + public async Task Can_render_onetime_page_with_real_layout() + { + var context = new ScriptContext + { + Args = { ["key"] = "the-key" } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", "<html><title>{{ model.List[0].Object.Prop |> lower }}</title><body>{{ page }}</body></html>"); + + var adhocPage = context.OneTimePage(@"<h1>{{ key }}</h1>", "html"); + var result = await new PageResult(adhocPage) + { + LayoutPage = context.GetPage("_layout"), + Model = CreateModelBinding() + }.RenderToStringAsync(); + Assert.That(result, Is.EqualTo("<html><title>nested list prop</title><body><h1>the-key</h1></body></html>")); + } + + public class ModelWithMethods + { + public string Name { get; set; } + + public string GetName() => Name; + + public ModelWithMethods Nested { get; set; } + } + + [Test] + public void Does_parse_MemberExpression_methods() + { + JsToken token; + + "model.GetName()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression(new JsIdentifier("model"), new JsIdentifier("GetName")) + ))); + + "model.Nested.GetName()".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsCallExpression( + new JsMemberExpression( + new JsMemberExpression( + new JsIdentifier("model"), + new JsIdentifier("Nested") + ), + new JsIdentifier("GetName") + ) + ))); + } + + [Test] + public void Does_not_allow_invoking_method_on_MemberExpression() + { + var context = new ScriptContext().Init(); + + var model = new ModelWithMethods { Nested = new ModelWithMethods { Name = "Nested" } }; + + try + { + var r = new PageResult(context.OneTimePage("{{ model.GetName() }}")){ Model = model }.Result; + Assert.Fail("Should throw"); + } + catch (BindingExpressionException e) + { + e.Message.Print(); + } + + try + { + var r = new PageResult(context.OneTimePage("{{ model.Nested.GetName() }}")){ Model = model }.Result; + Assert.Fail("Should throw"); + } + catch (BindingExpressionException e) + { + e.Message.Print(); + } + } + + [Test] + public void Binding_expressions_with_null_references_evaluate_to_null() + { + var context = new ScriptContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ model.Object.Prop }}")) { Model = new ModelBinding() }.Result, Is.Empty); + Assert.That(new PageResult(context.OneTimePage("{{ Object.Prop }}")) { Model = new ModelBinding() }.Result, Is.Empty); + Assert.That(new PageResult(context.OneTimePage("{{ model.Object.Object.Prop }}")) { Model = new ModelBinding() }.Result, Is.Empty); + Assert.That(new PageResult(context.OneTimePage("{{ model[0].Prop }}")) { Model = new ModelBinding() }.Result, Is.Empty); + Assert.That(new PageResult(context.OneTimePage("{{ model.List[0].Prop }}")) { Model = new ModelBinding() }.Result, Is.Empty); + Assert.That(new PageResult(context.OneTimePage("{{ model.Dictionary['key'].Prop }}")) { Model = new ModelBinding() }.Result, Is.Empty); + } + + [Test] + public void when_only_shows_code_when_true() + { + var context = new ScriptContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 'Is Authenticated' |> when(auth) }}")) + { + Args = {["auth"] = true } + }.Result, Is.EqualTo("Is Authenticated")); + Assert.That(new PageResult(context.OneTimePage("{{ 'Is Authenticated' |> when(auth) }}")) + { + Args = {["auth"] = (bool?)true } + }.Result, Is.EqualTo("Is Authenticated")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'Is Authenticated' |> when(auth) }}")) + { + Args = {["auth"] = null} + }.Result, Is.Empty); + Assert.That(new PageResult(context.OneTimePage("{{ 'Is Authenticated' |> when(auth) }}")) + { + Args = {["auth"] = false} + }.Result, Is.Empty); + Assert.That(new PageResult(context.OneTimePage("{{ 'Is Authenticated' |> when(auth) }}")) + { + Args = {["auth"] = new AuthUserSession().IsAuthenticated} + }.Result, Is.Empty); + Assert.That(new PageResult(context.OneTimePage("{{ 'Is Authenticated' |> when(auth) }}")).Result, Is.Empty); + } + + [Test] + public void unless_shows_code_when_not_true() + { + var context = new ScriptContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> unless(auth) }}")) + { + Args = {["auth"] = true } + }.Result, Is.Empty); + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> unless(auth) }}")) + { + Args = {["auth"] = (bool?)true } + }.Result, Is.Empty); + + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> unless(auth) }}")) + { + Args = {["auth"] = null} + }.Result, Is.EqualTo("Not Authenticated")); + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> unless(auth) }}")) + { + Args = {["auth"] = false} + }.Result, Is.EqualTo("Not Authenticated")); + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> unless(auth) }}")) + { + Args = {["auth"] = new AuthUserSession().IsAuthenticated} + }.Result, Is.EqualTo("Not Authenticated")); + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> unless(auth) }}")) { + }.Result, Is.EqualTo("Not Authenticated")); + } + + [Test] + public void can_use_if_and_ifNot_as_alias_to_when_and_unless() + { + var context = new ScriptContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 'Is Authenticated' |> if(auth) }}")) + { + Args = {["auth"] = true } + }.Result, Is.EqualTo("Is Authenticated")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> ifNot(auth) }}")) + { + Args = {["auth"] = true } + }.Result, Is.Empty); + } + + [Test] + public void Can_use_else_and_otherwise_filter_to_show_alternative_content() + { + var context = new ScriptContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> unlessElse(auth, 'Is Authenticated') }}")) + { + Args = {["auth"] = false } + }.Result, Is.EqualTo("Not Authenticated")); + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> unlessElse(auth, 'Is Authenticated') }}")) + { + Args = {["auth"] = true } + }.Result, Is.EqualTo("Is Authenticated")); + + + Assert.That(new PageResult(context.OneTimePage("{{ 'Is Authenticated' |> ifElse(auth, 'Not Authenticated') }}")) + { + Args = {["auth"] = false } + }.Result, Is.EqualTo("Not Authenticated")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'Not Authenticated' |> ifNotElse(auth, 'Is Authenticated') }}")) + { + Args = {["auth"] = true } + }.Result, Is.EqualTo("Is Authenticated")); + } + + [Test] + public void Returns_original_string_with_unknown_variable() + { + var context = new ScriptContext + { + Args = + { + ["serverArg"] = "defined" + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ undefined }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ serverArg }}")).Result, Is.EqualTo("defined")); + Assert.That(new PageResult(context.OneTimePage("{{ serverArg |> unknownFilter }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ undefined |> titleCase }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ '' }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ null }}")).Result, Is.EqualTo("")); + } + + [Test] + public void Filters_with_HandleUnknownValueAttribute_handles_unkownn_values() + { + var context = new ScriptContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ undefined |> otherwise('undefined serverArg') }}")).Result, Is.EqualTo("undefined serverArg")); + } + + [Test] + public void Handles_truthy_and_falsy_conditions() + { + var context = new ScriptContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ undefined |> falsy('undefined value') }}")).Result, Is.EqualTo("undefined value")); + Assert.That(new PageResult(context.OneTimePage("{{ null |> falsy('null value') }}")).Result, Is.EqualTo("null value")); + Assert.That(new PageResult(context.OneTimePage("{{ '' |> falsy('empty string') }}")).Result, Is.EqualTo("empty string")); + Assert.That(new PageResult(context.OneTimePage("{{ false |> falsy('false value') }}")).Result, Is.EqualTo("false value")); + Assert.That(new PageResult(context.OneTimePage("{{ 0 |> falsy('0') }}")).Result, Is.EqualTo("0")); + + Assert.That(new PageResult(context.OneTimePage("{{ true |> falsy('true value') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ ' ' |> falsy('0') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 1 |> falsy('one value') }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ undefined |> truthy('undefined value') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ true |> truthy('true value') }}")).Result, Is.EqualTo("true value")); + Assert.That(new PageResult(context.OneTimePage("{{ ' ' |> truthy('whitespace') }}")).Result, Is.EqualTo("whitespace")); + Assert.That(new PageResult(context.OneTimePage("{{ 1 |> truthy('one value') }}")).Result, Is.EqualTo("one value")); + + Assert.That(new PageResult(context.OneTimePage("{{ null |> truthy('null value') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ '' |> truthy('empty string') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ false |> truthy('false value') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 0 |> truthy('0') }}")).Result, Is.EqualTo("")); + } + + [Test] + public void Handles_ifTruthy_and_ifFalsy_conditions() + { + var context = new ScriptContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 'undefined value' |> ifFalsy(undefined) }}")).Result, Is.EqualTo("undefined value")); + Assert.That(new PageResult(context.OneTimePage("{{ 'null value' |> ifFalsy(null) }}")).Result, Is.EqualTo("null value")); + Assert.That(new PageResult(context.OneTimePage("{{ 'empty string' |> ifFalsy('') }}")).Result, Is.EqualTo("empty string")); + Assert.That(new PageResult(context.OneTimePage("{{ 'false value' |> ifFalsy(false) }}")).Result, Is.EqualTo("false value")); + Assert.That(new PageResult(context.OneTimePage("{{ 0 |> ifFalsy(0) }}")).Result, Is.EqualTo("0")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'true value' |> ifFalsy(true) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'whitespace' |> ifFalsy(' ') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'one value' |> ifFalsy(1) }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'undefined value' |> ifTruthy(undefined) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'null value' |> ifTruthy(null) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'empty string' |> ifTruthy('') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'false value' |> ifTruthy(false) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 0 |> ifTruthy(0) }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'true value' |> ifTruthy(true) }}")).Result, Is.EqualTo("true value")); + Assert.That(new PageResult(context.OneTimePage("{{ 'whitespace' |> ifTruthy(' ') }}")).Result, Is.EqualTo("whitespace")); + Assert.That(new PageResult(context.OneTimePage("{{ 'one value' |> ifTruthy(1) }}")).Result, Is.EqualTo("one value")); + } + + [Test] + public void Handles_strict_if_and_else_conditions() + { + var context = new ScriptContext().Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ 'undefined value' |> ifNot(undefined) }}")).Result, Is.EqualTo("undefined value")); + Assert.That(new PageResult(context.OneTimePage("{{ 'null value' |> ifNot(null) }}")).Result, Is.EqualTo("null value")); + Assert.That(new PageResult(context.OneTimePage("{{ 'empty string' |> ifNot('') }}")).Result, Is.EqualTo("empty string")); + Assert.That(new PageResult(context.OneTimePage("{{ 'false value' |> ifNot(false) }}")).Result, Is.EqualTo("false value")); + Assert.That(new PageResult(context.OneTimePage("{{ 0 |> ifNot(0) }}")).Result, Is.EqualTo("0")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'true value' |> ifNot(true) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'whitespace' |> ifNot(' ') }}")).Result, Is.EqualTo("whitespace")); + Assert.That(new PageResult(context.OneTimePage("{{ 'one value' |> ifNot(1) }}")).Result, Is.EqualTo("one value")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'undefined value' |> if(undefined) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'null value' |> if(null) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'empty string' |> if('') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'false value' |> if(false) }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 0 |> if(0) }}")).Result, Is.EqualTo("")); + + Assert.That(new PageResult(context.OneTimePage("{{ 'true value' |> if(true) }}")).Result, Is.EqualTo("true value")); + Assert.That(new PageResult(context.OneTimePage("{{ 'whitespace' |> if(' ') }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ 'one value' |> if(1) }}")).Result, Is.EqualTo("")); + } + + [Test] + public void Null_exceptions_render_empty_string() + { + var context = new ScriptContext + { +// RenderExpressionExceptions = true, + Args = + { + ["contextModel"] = new ModelBinding() + } + }.Init(); + + Assert.That(new PageResult(context.OneTimePage("{{ contextModel.Object.Prop }}")).Result, Is.EqualTo("")); + Assert.That(new PageResult(context.OneTimePage("{{ contextModel.Object.Prop |> otherwise('there is nothing') }}")).Result, Is.EqualTo("there is nothing")); + } + + [Test] + public void Can_use_whitespace_for_last_string_arg() + { + var context = new ScriptContext + { + Args = + { + ["ten"] = 10 + } + }.Init(); + + Assert.That(context.EvaluateScript(@"{{ ten |> multiply(ten) |> assignTo: result }} + 10 x 10 = {{ result }}").Trim(), Is.EqualTo("10 x 10 = 100")); + } + + [Test] + public void Can_emit_var_fragment_example() + { + var context = new ScriptContext().Init(); + + var output = context.EvaluateScript("The time is now:{{ pass: now |> dateFormat('HH:mm:ss') }}"); + Assert.That(output, Is.EqualTo("The time is now:{{ now |> dateFormat('HH:mm:ss') }}")); + } + + [Test] + public void Does_escape_quotes_in_strings() + { + var context = new ScriptContext().Init(); + + Assert.That(context.EvaluateScript("{{ \"string \\\"in\\\" quotes\" |> raw }}"), Is.EqualTo("string \"in\" quotes")); + Assert.That(context.EvaluateScript("{{ 'string \\'in\\' quotes' |> raw }}"), Is.EqualTo("string 'in' quotes")); + Assert.That(context.EvaluateScript("{{ `string \\`in\\` quotes` |> raw }}"), Is.EqualTo("string `in` quotes")); + } + + [Test] + public void Does_not_exceed_MaxQuota() + { + //times / range / itemsOf / repeat / repeating / padLeft / padRight + + var context = new ScriptContext().Init(); + + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ 10001 |> times }}")); + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ range(10001) }}")); + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ range(1,10001) }}")); + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ 10001 |> itemsOf(1) }}")); + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ 'text' |> repeat(10001) }}")); + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ 10001 |> repeating('text') }}")); + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ 'text' |> padLeft(10001) }}")); + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ 'text' |> padLeft(10001,'.') }}")); + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ 'text' |> padRight(10001) }}")); + Assert.Throws<ScriptException>(() => context.EvaluateScript("{{ 'text' |> padRight(10001,'.') }}")); + } + + [Test] + public void Can_execute_filters_in_let_binding() + { + var context = new ScriptContext().Init(); + + var output = context.EvaluateScript( + @"{{ [{name:'Alice',score:50},{name:'Bob',score:40}] |> assignTo:scoreRecords }} +{{ scoreRecords + |> let({ name: `it['name']`, score: `it['score']`, i:`incr(index)` }) + |> select: {i}) {name} = {score}\n }}"); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +1) Alice = 50 +2) Bob = 40 +".NormalizeNewLines())); + } + + [Test] + public void Can_use_map_to_transform_lists_into_dictionaries() + { + var context = new ScriptContext().Init(); + + var output = context.EvaluateScript(@"{{ [[1,-1],[2,-2],[3,-3]] |> assignTo:coords }} +{{ coords + |> map('{ x: it[0], y: it[1] }') + |> scopeVars + |> select: {index |> incr}. ({x}, {y})\n +}}"); + + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +1. (1, -1) +2. (2, -2) +3. (3, -3) +".NormalizeNewLines())); + } + + [Test] + public void Can_control_whats_emitted_on_Unhandled_expression() + { + var context = new ScriptContext + { + OnUnhandledExpression = var => var.OriginalTextUtf8 + }.Init(); + + Assert.That(context.EvaluateScript("{{ unknownArg |> lower }}"), Is.EqualTo("{{ unknownArg |> lower }}")); + + context.OnUnhandledExpression = var => null; + Assert.That(context.EvaluateScript("{{ unknownArg |> lower }}"), Is.EqualTo("")); + } + + [Test] + public void null_binding_on_existing_object_renders_empty_string() + { + var c = new Dictionary<string, object> { {"name", "the name"} }; + var context = new ScriptContext + { + Args = + { + ["c"] = c, + ["it"] = new Dictionary<string, object> { {"customer", c} } + } + }.Init(); + + Assert.That(context.EvaluateScript("{{ c.name }}"), Is.EqualTo("the name")); + Assert.That(context.EvaluateScript("{{ c.missing }}"), Is.EqualTo("")); + Assert.That(context.EvaluateScript("{{ it.customer |> assignTo: c }}{{ c.missing }}"), Is.EqualTo("")); + } + + } + + public static class TestUtils + { + public static string NormalizeNewLines(this string text) => text.Trim().Replace("\r", ""); + public static string RemoveNewLines(this string text) => text.Trim().Replace("\r", "").Replace("\n", ""); + + static readonly Regex whitespace = new Regex(@"\s+", RegexOptions.Compiled); + public static string RemoveAllWhitespace(this string text) => whitespace.Replace(text, ""); + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageTests.cs new file mode 100644 index 00000000000..f31029abeeb --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageTests.cs @@ -0,0 +1,527 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + [Route("/products/{Id}")] + public class GetProduct + { + public int Id { get; set; } + } + + [Route("/existing-page")] + public class OverrideExistingPage + { + public string RequestVar { get; set; } + } + + public class SharpPagesService : Service + { + public ISharpPages Pages { get; set; } + + public object AnyHtml(GetProduct request) + { + return new PageResult(Pages.GetPage("product-view")) + { + Model = request, + LayoutPage = Pages.GetPage("product-layout"), + }; + } + + public object Any(OverrideExistingPage request) + { + return new PageResult(Pages.GetPage("override-page")) + { + Model = request, + Args = + { + { "title", "Service Title" } + }, + LayoutPage = Pages.GetPage("override-layout"), + }; + } + } + + class Model + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class SharpPageTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(SharpPageTests), typeof(SharpPagesService).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new SharpPagesFeature()); + + AfterInitCallbacks.Add(host => { + var memFs = VirtualFileSources.GetMemoryVirtualFiles(); + foreach (var entry in HtmlFiles) + { + memFs.AppendFile(entry.Key, entry.Value); + } + }); + } + + static readonly Dictionary<string,string> HtmlFiles = new Dictionary<string, string> + { + { "_layout.html", "<html><head><title>{{ title }}</title></head><body id='layout'>{{ page }}</body></html>" }, + { "alt-layout.html", "<html><head><title>{{ title }}</title></head><body id='alt-layout'>{{ page }}</body></html>" }, + { "override-layout.html", "<html><head><title>{{ title }}</title></head><body id='override-layout'>{{ page }}</body></html>" }, + { "root-static-page.html", "<h1>/root-static page!</h1>" }, + { "full-static-page.html", "<html><head><title>Full Page</title></head><body><h1>Full Page</h1></body></html>" }, + { "existing-page.html", "<h1>Existing Page</h1>" }, + { "override-page.html", @" +<!-- +layout: alt-layout +title: Override Title +--> +<h1>Override Page</h1>" }, + { "noprefix-page.html", @" +<!-- +layout: alt-layout +--> +<h1>/noprefix page!</h1>" }, + { "dir/alt-layout.html", "<html><head><title>{{ title }}</title></head><body id='dir-alt-layout'>{{ page }}</body></html>" }, + { "dir/index.html", @" +<!-- +layout: alt-layout +title: no prefix @ /dir +--> +<h1>/dir/noprefix page!</h1>" }, + { "variable-layout-page.html", @" +<!-- +layout: alt-layout.html +title: Variable Layout +--> + +<h1>Variable Page</h1>" }, + { "variable-layout-page-space-delim.html", @" +<!-- +layout alt-layout.html +title Variable Layout +files.config {AccessKey:$AWS_S3_ACCESS_KEY} +--> + +<h1>Variable Page</h1>" }, + { "htmlencode-layout.html", @" +<!-- +layoutvar: layoutvar(< & > "" ') +--> +<html><head><title>{{ title }}</title></head><body id='htmlencode-layout'>{{ page }}<p>{{ layoutvar }}</p></body></html>" }, + { "htmlencode-page.html", @" +<!-- +layout: htmlencode-layout.html +title: We encode < & > +--> +<h1>/htmlencode-page!</h1>" }, + }; + } + + private readonly ServiceStackHost appHost; + public SharpPageTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] public void OneTimeTearDown() => appHost.Dispose(); + + SharpPage CreatePage(IVirtualFile file) => + new SharpPage(appHost.GetPlugin<SharpPagesFeature>(), file); + + [Test] + public void Request_for_partial_page_returns_complete_page_with_default_layout() + { + var html = Config.ListeningOn.CombineWith("root-static-page.html") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.That(html, Does.StartWith("<html><head><title>")); + Assert.That(html, Does.Contain("id='layout'")); + Assert.That(html, Does.Contain("<h1>/root-static page!</h1>")); + } + + [Test] + public void Request_for_noprefix_page_returns_alt_layout() + { + var html = Config.ListeningOn.CombineWith("noprefix-page") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.That(html, Does.StartWith("<html><head><title>")); + Assert.That(html, Does.Contain("id='alt-layout'")); + Assert.That(html, Does.Contain("<h1>/noprefix page!</h1>")); + } + + [Test] + public void Request_for_variable_page_returns_complete_page_with_alt_layout() + { + var html = Config.ListeningOn.CombineWith("variable-layout-page.html") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.That(html, Does.StartWith("<html><head><title>Variable Layout</title>")); + Assert.That(html, Does.Contain("id='alt-layout'")); + Assert.That(html, Does.Contain("<h1>Variable Page</h1>")); + } + + [Test] + public void Request_for_htmlencode_pages_returns_htmlencoded_variables() + { + var html = Config.ListeningOn.CombineWith("htmlencode-page.html") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.That(html, Does.StartWith("<html><head><title>We encode &lt; &amp; &gt;</title>")); + Assert.That(html, Does.Contain("id='htmlencode-layout'")); + Assert.That(html, Does.Contain("<h1>/htmlencode-page!</h1>")); + Assert.That(html, Does.Contain("<p>layoutvar(&lt; &amp; &gt; &quot; &#39;)</p>")); + } + + [Test] + public void Request_for_dir_index_page_using_supported_conventions() + { + var htmlOrig = Config.ListeningOn.CombineWith("dir/index.html") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.That(htmlOrig, Does.StartWith("<html><head><title>no prefix @ /dir</title>")); + Assert.That(htmlOrig, Does.Contain("id='dir-alt-layout'")); + Assert.That(htmlOrig, Does.Contain("<h1>/dir/noprefix page!</h1>")); + + var html = Config.ListeningOn.CombineWith("dir/index") + .GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html, Is.EqualTo(htmlOrig)); + + html = Config.ListeningOn.CombineWith("dir/") + .GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html, Is.EqualTo(htmlOrig)); + + html = Config.ListeningOn.CombineWith("dir") + .GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html, Is.EqualTo(htmlOrig)); + } + +#if NET45 + [Test] + public void Request_for_dir_index_page_without_trailing_slash_auto_redirects() + { + Config.ListeningOn.CombineWith("dir") + .GetStringFromUrl(accept: MimeTypes.Html, + requestFilter: req => req.AllowAutoRedirect = false, + responseFilter: res => + { + Assert.That(res.StatusCode, Is.EqualTo(HttpStatusCode.Redirect)); + Assert.That(res.Headers[HttpHeaders.Location], Is.EqualTo(Config.ListeningOn.CombineWith("dir/"))); + }); + } +#endif + + [Test] + public void Request_for_page_with_underscore_prefix_is_forbidden() + { + try + { + Config.ListeningOn.CombineWith("_layout.html") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.Fail("Should throw"); + } + catch (WebException ex) + { + Assert.That(((HttpWebResponse)ex.Response).StatusCode, Is.EqualTo(HttpStatusCode.Forbidden)); + } + + try + { + Config.ListeningOn.CombineWith("_layout") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.Fail("Should throw"); + } + catch (WebException ex) + { + Assert.That(((HttpWebResponse)ex.Response).StatusCode, Is.EqualTo(HttpStatusCode.Forbidden)); + } + } + + [Test] + public void Request_for_existing_page_can_be_overridden_by_Service() + { + var html = Config.ListeningOn.CombineWith("existing-page") + .GetStringFromUrl(accept: MimeTypes.Html); + + Assert.That(html, Does.StartWith("<html><head><title>Service Title</title>")); + Assert.That(html, Does.Contain("id='override-layout'")); + Assert.That(html, Does.Contain("<h1>Override Page</h1>")); + } + + [Test] + public async Task Can_parse_page_with_page_variables() + { + var file = HostContext.AppHost.VirtualFileSources.GetFile("variable-layout-page.html"); + + var page = await CreatePage(file).Init(); + + Assert.That(page.Args["layout"], Is.EqualTo("alt-layout.html")); + Assert.That(page.Args["title"], Is.EqualTo("Variable Layout")); + Assert.That(((PageStringFragment)page.PageFragments[0]).Value.ToString(), Is.EqualTo("<h1>Variable Page</h1>")); + } + + [Test] + public async Task Can_parse_page_with_page_variables_without_colon_separators() + { + var file = HostContext.AppHost.VirtualFileSources.GetFile("variable-layout-page-space-delim.html"); + + var page = await CreatePage(file).Init(); + + Assert.That(page.Args["layout"], Is.EqualTo("alt-layout.html")); + Assert.That(page.Args["title"], Is.EqualTo("Variable Layout")); + Assert.That(page.Args["files.config"], Is.EqualTo("{AccessKey:$AWS_S3_ACCESS_KEY}")); + Assert.That(((PageStringFragment)page.PageFragments[0]).Value.ToString(), Is.EqualTo("<h1>Variable Page</h1>")); + } + + [Test] + public async Task Can_parse_template_with_body_variable() + { + var file = HostContext.AppHost.VirtualFileSources.GetFile("_layout.html"); + + var page = await CreatePage(file).Init(); + + Assert.That(page.PageFragments.Length, Is.EqualTo(5)); + var strFragment1 = (PageStringFragment)page.PageFragments[0]; + var varFragment2 = (PageVariableFragment)page.PageFragments[1]; + var strFragment3 = (PageStringFragment)page.PageFragments[2]; + var varFragment4 = (PageVariableFragment)page.PageFragments[3]; + var strFragment5 = (PageStringFragment)page.PageFragments[4]; + + Assert.That(strFragment1.Value.ToString(), Is.EqualTo("<html><head><title>")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(strFragment3.Value.ToString(), Is.EqualTo("</title></head><body id='layout'>")); + Assert.That(varFragment4.Binding, Is.EqualTo("page")); + Assert.That(strFragment5.Value.ToString(), Is.EqualTo("</body></html>")); + } + + [NUnit.Framework.Ignore("Flaky when run in suite on .NET Framework only, passes when run on its own or on .NET Core")] + [Test] + public void Does_limit_file_changes_checks_to_specified_time() + { + var context = new ScriptContext + { + DebugMode = false, + CheckForModifiedPagesAfter = TimeSpan.FromMilliseconds(100) + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<body id=original> +{{ page }} +</body> +</html> +"); + context.VirtualFiles.WriteFile("page.html", "<h1>Original Contents</h1>"); + + var pageResult = new PageResult(context.GetPage("page")); + Assert.That(pageResult.ResultOutput, Is.Null); + + var output = pageResult.Result; + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=original> +<h1>Original Contents</h1> +</body> +</html> +".NormalizeNewLines())); + + context.VirtualFiles.WriteFile("_layout.html", + context.VirtualFiles.GetFile("_layout.html").ReadAllText().Replace("original", "updated")); + context.VirtualFiles.WriteFile("page.html", + context.VirtualFiles.GetFile("page.html").ReadAllText().Replace("Original", "Updated")); + + //Should return same contents when within CheckForModifiedPagesAfter + output = new PageResult(context.GetPage("page")).Result; + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=original> +<h1>Original Contents</h1> +</body> +</html> +".NormalizeNewLines())); + + Thread.Sleep(300); + + //Should render updated content + output = new PageResult(context.GetPage("page")).Result; + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=updated> +<h1>Updated Contents</h1> +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Never_checks_for_changes_if_CheckForModifiedPagesAfter_is_null() + { + var context = new ScriptContext + { + DebugMode = false, + CheckForModifiedPagesAfter = null + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", @" +<html> +<body id=original> +{{ page }} +</body> +</html> +"); + context.VirtualFiles.WriteFile("page.html", "<h1>Original Contents</h1>"); + + var output = new PageResult(context.GetPage("page")).Result; + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=original> +<h1>Original Contents</h1> +</body> +</html> +".NormalizeNewLines())); + + context.VirtualFiles.WriteFile("_layout.html", + context.VirtualFiles.GetFile("_layout.html").ReadAllText().Replace("original", "updated")); + context.VirtualFiles.WriteFile("page.html", + context.VirtualFiles.GetFile("page.html").ReadAllText().Replace("Original", "Updated")); + + Thread.Sleep(150); + + output = new PageResult(context.GetPage("page")).Result; + Assert.That(output.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=original> +<h1>Original Contents</h1> +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_find_last_modified_file_in_page() + { + var context = new ScriptContext + { + ScriptMethods = { new ProtectedScripts() } + }.Init(); + + context.VirtualFiles.WriteFile("_layout.html", "layout {{ page }} {{ 'layout-partial' |> partial }} {{ 'layout-file.txt' |> includeFile }} "); + context.VirtualFiles.WriteFile("page.html", "page: partial {{ 'root-partial' |> partial }}, file {{ 'file.txt' |> includeFile }}, selectParital: {{ true |> selectPartial: select-partial }}"); + context.VirtualFiles.WriteFile("root-partial.html", "root-partial: partial {{ 'inner-partial' |> partial }}, partial-file {{ 'partial-file.txt' |> includeFile }}"); + context.VirtualFiles.WriteFile("file.txt", "file.txt"); + context.VirtualFiles.WriteFile("inner-partial.html", "inner-partial.html"); + context.VirtualFiles.WriteFile("partial-file.txt", "partial-file.txt"); + context.VirtualFiles.WriteFile("select-partial.html", "select-partial.html"); + context.VirtualFiles.WriteFile("layout-partial.html", "layout-partial.html"); + context.VirtualFiles.WriteFile("layout-file.txt", "layout-file.txt"); + + ((InMemoryVirtualFile)context.VirtualFiles.GetFile("page.html")).FileLastModified = new DateTime(2001, 01, 01); + ((InMemoryVirtualFile)context.VirtualFiles.GetFile("_layout.html")).FileLastModified = new DateTime(2001, 01, 02); + ((InMemoryVirtualFile)context.VirtualFiles.GetFile("root-partial.html")).FileLastModified = new DateTime(2001, 01, 03); + ((InMemoryVirtualFile)context.VirtualFiles.GetFile("file.txt")).FileLastModified = new DateTime(2001, 01, 04); + ((InMemoryVirtualFile)context.VirtualFiles.GetFile("inner-partial.html")).FileLastModified = new DateTime(2001, 01, 05); + ((InMemoryVirtualFile)context.VirtualFiles.GetFile("partial-file.txt")).FileLastModified = new DateTime(2001, 01, 06); + ((InMemoryVirtualFile)context.VirtualFiles.GetFile("select-partial.html")).FileLastModified = new DateTime(2001, 01, 07); + ((InMemoryVirtualFile)context.VirtualFiles.GetFile("layout-partial.html")).FileLastModified = new DateTime(2001, 01, 08); + ((InMemoryVirtualFile)context.VirtualFiles.GetFile("layout-file.txt")).FileLastModified = new DateTime(2001, 01, 09); + + var page = context.Pages.GetPage("page").Init().Result; + context.Pages.GetPage("root-partial").Init().Wait(); + + var lastModified = context.Pages.GetLastModified(page); + Assert.That(lastModified, Is.EqualTo(new DateTime(2001, 01, 09))); + } + + public class AsyncFilters : ScriptMethods + { + public async Task<object> reverseString(string text) + { + await Task.Yield(); + var chars = text.ToCharArray(); + Array.Reverse(chars); + return new string(chars); + } + } + + [Test] + public void Can_call_async_filters() + { + var context = new ScriptContext + { + ScriptMethods = { new AsyncFilters() } + }.Init(); + + var output = context.EvaluateScript("{{ 'foo' |> reverseString }}"); + Assert.That(output, Is.EqualTo("oof")); + } + + [Test] + public void Can_ignore_page_template_and_layout_with_Page_args() + { + var context = new ScriptContext().Init(); + + context.VirtualFiles.WriteFile("_layout.html", "<html><body>{{ page }}</body></html>"); + context.VirtualFiles.WriteFile("page.html", "<pre>{{ 12.34 |> currency }}</pre>"); + context.VirtualFiles.WriteFile("page-nolayout.html", "<!--\nlayout: none\n-->\n<pre>{{ 12.34 |> currency }}</pre>"); + context.VirtualFiles.WriteFile("ignore-page.html", "<!--\nignore: page\n-->\n<pre>{{ 12.34 |> currency }}</pre>"); + context.VirtualFiles.WriteFile("ignore-template.html", "<!--\nignore: template\n-->\n<pre>{{ 12.34 |> currency }}</pre>"); + + Assert.That(new PageResult(context.GetPage("page")).Result, Is.EqualTo("<html><body><pre>$12.34</pre></body></html>")); + Assert.That(new PageResult(context.GetPage("page-nolayout")).Result, Is.EqualTo("<pre>$12.34</pre>")); + Assert.That(new PageResult(context.GetPage("ignore-page")).Result, Is.EqualTo("<html><body><pre>{{ 12.34 |> currency }}</pre></body></html>")); + Assert.That(new PageResult(context.GetPage("ignore-template")).Result, Is.EqualTo("<pre>{{ 12.34 |> currency }}</pre>")); + } + + [Test] + public void Can_comment_out_filters() + { + var context = new ScriptContext().Init(); + context.VirtualFiles.WriteFile("page.html", "<pre>currency: {{* 12.34 |> currency *}}, date: {{* now *}}</pre>"); + + Assert.That(new PageResult(context.GetPage("page")).Result, Is.EqualTo("<pre>currency: , date: </pre>")); + } + + [Test] + public void Does_preverve_content_after_html_comments() + { + var context = new ScriptContext().Init(); + context.VirtualFiles.WriteFile("_layout.html", "<html><body><h1>{{title}}</h1>{{ page }}</body></html>"); + context.VirtualFiles.WriteFile("page.html", "<!--\ntitle:The Title\n--><p>para</p>"); + + var html = new PageResult(context.GetPage("page")).Result; + Assert.That(html, Is.EqualTo("<html><body><h1>The Title</h1><p>para</p></body></html>")); + } + + [Test] + public void Can_resolve_hidden_partials_without_prefix() + { + var context = new ScriptContext().Init(); + context.VirtualFiles.WriteFile("page.html", "Page {{ 'menu' |> partial }} {{ '_test-partial' |> partial }}"); + context.VirtualFiles.WriteFile("_menu-partial.html", "MENU"); + context.VirtualFiles.WriteFile("_test-partial.html", "TEST"); + + var result = new PageResult(context.GetPage("page")).Result; + result.Print(); + + Assert.That(result, Is.EqualTo("Page MENU TEST")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageUtilsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageUtilsTests.cs new file mode 100644 index 00000000000..8a8157f3a28 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPageUtilsTests.cs @@ -0,0 +1,797 @@ +using System; +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class SharpPageUtilsTests + { + [Test] + public void Can_parse_template_with_no_vars() + { + Assert.That(ScriptTemplateUtils.ParseTemplate("").Count, Is.EqualTo(0)); + var fragments = ScriptTemplateUtils.ParseTemplate("<h1>title</h1>"); + Assert.That(fragments.Count, Is.EqualTo(1)); + + var strFragment = fragments[0] as PageStringFragment; + Assert.That(strFragment.Value.ToString(), Is.EqualTo("<h1>title</h1>")); + } + + [Test] + public void Can_parse_template_with_variable() + { + var fragments = ScriptTemplateUtils.ParseTemplate("<h1>{{ title }}</h1>"); + Assert.That(fragments.Count, Is.EqualTo(3)); + + var strFragment1 = fragments[0] as PageStringFragment; + var varFragment2 = fragments[1] as PageVariableFragment; + var strFragment3 = fragments[2] as PageStringFragment; + + Assert.That(strFragment1.Value.ToString(), Is.EqualTo("<h1>")); + Assert.That(varFragment2.OriginalText.ToString(), Is.EqualTo("{{ title }}")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(varFragment2.FilterExpressions.Length, Is.EqualTo(0)); + Assert.That(strFragment3.Value.ToString(), Is.EqualTo("</h1>")); + } + + [Test] + public void Can_parse_template_with_filter() + { + var fragments = ScriptTemplateUtils.ParseTemplate("<h1>{{ title |> filter }}</h1>"); + Assert.That(fragments.Count, Is.EqualTo(3)); + + var strFragment1 = fragments[0] as PageStringFragment; + var varFragment2 = fragments[1] as PageVariableFragment; + var strFragment3 = fragments[2] as PageStringFragment; + + Assert.That(strFragment1.Value.ToString(), Is.EqualTo("<h1>")); + Assert.That(varFragment2.OriginalText.ToString(), Is.EqualTo("{{ title |> filter }}")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(varFragment2.FilterExpressions.Length, Is.EqualTo(1)); + Assert.That(varFragment2.FilterExpressions[0].Name, Is.EqualTo("filter")); + Assert.That(varFragment2.FilterExpressions[0].Arguments.Length, Is.EqualTo(0)); + Assert.That(strFragment3.Value.ToString(), Is.EqualTo("</h1>")); + + fragments = ScriptTemplateUtils.ParseTemplate("<h1>{{ title |> filter() }}</h1>"); + + varFragment2 = fragments[1] as PageVariableFragment; + Assert.That(varFragment2.OriginalText.ToString(), Is.EqualTo("{{ title |> filter() }}")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(varFragment2.FilterExpressions.Length, Is.EqualTo(1)); + Assert.That(varFragment2.FilterExpressions[0].Name, Is.EqualTo("filter")); + Assert.That(varFragment2.FilterExpressions[0].Arguments.Length, Is.EqualTo(0)); + } + + [Test] + public void Can_parse_template_with_filter_without_whitespace() + { + var fragments = ScriptTemplateUtils.ParseTemplate("<h1>{{title}}</h1>"); + Assert.That(fragments.Count, Is.EqualTo(3)); + + var strFragment1 = fragments[0] as PageStringFragment; + var varFragment2 = fragments[1] as PageVariableFragment; + var strFragment3 = fragments[2] as PageStringFragment; + + Assert.That(strFragment1.Value.ToString(), Is.EqualTo("<h1>")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(varFragment2.FilterExpressions.Length, Is.EqualTo(0)); + + fragments = ScriptTemplateUtils.ParseTemplate("<h1>{{title|filter}}</h1>"); + Assert.That(fragments.Count, Is.EqualTo(3)); + + strFragment1 = fragments[0] as PageStringFragment; + varFragment2 = fragments[1] as PageVariableFragment; + strFragment3 = fragments[2] as PageStringFragment; + + Assert.That(strFragment1.Value.ToString(), Is.EqualTo("<h1>")); + Assert.That(varFragment2.OriginalText.ToString(), Is.EqualTo("{{title|filter}}")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(varFragment2.FilterExpressions.Length, Is.EqualTo(1)); + Assert.That(varFragment2.FilterExpressions[0].Name, Is.EqualTo("filter")); + Assert.That(varFragment2.FilterExpressions[0].Arguments.Length, Is.EqualTo(0)); + Assert.That(strFragment3.Value.ToString(), Is.EqualTo("</h1>")); + } + + [Test] + public void Can_parse_template_with_filter_with_arg() + { + var fragments = ScriptTemplateUtils.ParseTemplate("<h1>{{ title |> filter(1) }}</h1>"); + Assert.That(fragments.Count, Is.EqualTo(3)); + + var strFragment1 = fragments[0] as PageStringFragment; + var varFragment2 = fragments[1] as PageVariableFragment; + var strFragment3 = fragments[2] as PageStringFragment; + + Assert.That(strFragment1.Value.ToString(), Is.EqualTo("<h1>")); + Assert.That(varFragment2.OriginalText.ToString(), Is.EqualTo("{{ title |> filter(1) }}")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(varFragment2.FilterExpressions.Length, Is.EqualTo(1)); + Assert.That(varFragment2.FilterExpressions[0].Name, Is.EqualTo("filter")); + Assert.That(varFragment2.FilterExpressions[0].Arguments.Length, Is.EqualTo(1)); + Assert.That(varFragment2.FilterExpressions[0].Arguments[0], Is.EqualTo(new JsLiteral(1))); + Assert.That(strFragment3.Value.ToString(), Is.EqualTo("</h1>")); + } + + [Test] + public void Can_parse_template_with_filter_with_multiple_args() + { + var fragments = ScriptTemplateUtils.ParseTemplate("<h1>{{ title |> filter(1,2.2,'a',\"b\",true) }}</h1>"); + Assert.That(fragments.Count, Is.EqualTo(3)); + + var strFragment1 = fragments[0] as PageStringFragment; + var varFragment2 = fragments[1] as PageVariableFragment; + var strFragment3 = fragments[2] as PageStringFragment; + + Assert.That(strFragment1.Value.ToString(), Is.EqualTo("<h1>")); + Assert.That(varFragment2.OriginalText.ToString(), Is.EqualTo("{{ title |> filter(1,2.2,'a',\"b\",true) }}")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(varFragment2.FilterExpressions.Length, Is.EqualTo(1)); + Assert.That(varFragment2.FilterExpressions[0].Name, Is.EqualTo("filter")); + Assert.That(varFragment2.FilterExpressions[0].Arguments.Length, Is.EqualTo(5)); + Assert.That(varFragment2.FilterExpressions[0].Arguments[0], Is.EqualTo(new JsLiteral(1))); + Assert.That(varFragment2.FilterExpressions[0].Arguments[1], Is.EqualTo(new JsLiteral(2.2))); + Assert.That(varFragment2.FilterExpressions[0].Arguments[2], Is.EqualTo(new JsLiteral("a"))); + Assert.That(varFragment2.FilterExpressions[0].Arguments[3], Is.EqualTo(new JsLiteral("b"))); + Assert.That(varFragment2.FilterExpressions[0].Arguments[4], Is.EqualTo(JsLiteral.True)); + Assert.That(strFragment3.Value.ToString(), Is.EqualTo("</h1>")); + } + + [Test] + public void Can_parse_template_with_multiple_filters_and_multiple_args() + { + var fragments = ScriptTemplateUtils.ParseTemplate("<h1>{{ title |> filter1 |> filter2(1) |> filter3(1,2.2,'a',\"b\",true) }}</h1>"); + Assert.That(fragments.Count, Is.EqualTo(3)); + + var strFragment1 = fragments[0] as PageStringFragment; + var varFragment2 = fragments[1] as PageVariableFragment; + var strFragment3 = fragments[2] as PageStringFragment; + + Assert.That(strFragment1.Value.ToString(), Is.EqualTo("<h1>")); + Assert.That(varFragment2.OriginalText.ToString(), Is.EqualTo("{{ title |> filter1 |> filter2(1) |> filter3(1,2.2,'a',\"b\",true) }}")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(varFragment2.FilterExpressions.Length, Is.EqualTo(3)); + + Assert.That(varFragment2.FilterExpressions[0].Name, Is.EqualTo("filter1")); + Assert.That(varFragment2.FilterExpressions[0].Arguments.Length, Is.EqualTo(0)); + + Assert.That(varFragment2.FilterExpressions[1].Name, Is.EqualTo("filter2")); + Assert.That(varFragment2.FilterExpressions[1].Arguments.Length, Is.EqualTo(1)); + Assert.That(varFragment2.FilterExpressions[1].Arguments[0], Is.EqualTo(new JsLiteral(1))); + + Assert.That(varFragment2.FilterExpressions[2].Name, Is.EqualTo("filter3")); + Assert.That(varFragment2.FilterExpressions[2].Arguments.Length, Is.EqualTo(5)); + Assert.That(varFragment2.FilterExpressions[2].Arguments[0], Is.EqualTo(new JsLiteral(1))); + Assert.That(varFragment2.FilterExpressions[2].Arguments[1], Is.EqualTo(new JsLiteral(2.2))); + Assert.That(varFragment2.FilterExpressions[2].Arguments[2], Is.EqualTo(new JsLiteral("a"))); + Assert.That(varFragment2.FilterExpressions[2].Arguments[3], Is.EqualTo(new JsLiteral("b"))); + Assert.That(varFragment2.FilterExpressions[2].Arguments[4], Is.EqualTo(JsLiteral.True)); + + Assert.That(strFragment3.Value.ToString(), Is.EqualTo("</h1>")); + } + + [Test] + public void Can_parse_template_with_multiple_variables_and_filters() + { + var fragments = ScriptTemplateUtils.ParseTemplate("<h1>{{ title |> filter1 }}</h1>\n<p>{{ content |> filter2(a) }}</p>"); + Assert.That(fragments.Count, Is.EqualTo(5)); + + var strFragment1 = fragments[0] as PageStringFragment; + var varFragment2 = fragments[1] as PageVariableFragment; + var strFragment3 = fragments[2] as PageStringFragment; + var varFragment4 = fragments[3] as PageVariableFragment; + var strFragment5 = fragments[4] as PageStringFragment; + + Assert.That(strFragment1.Value.ToString(), Is.EqualTo("<h1>")); + + Assert.That(varFragment2.OriginalText.ToString(), Is.EqualTo("{{ title |> filter1 }}")); + Assert.That(varFragment2.Binding, Is.EqualTo("title")); + Assert.That(varFragment2.FilterExpressions.Length, Is.EqualTo(1)); + Assert.That(varFragment2.FilterExpressions[0].Name, Is.EqualTo("filter1")); + Assert.That(varFragment2.FilterExpressions[0].Arguments.Length, Is.EqualTo(0)); + + Assert.That(strFragment3.Value.ToString(), Is.EqualTo("</h1>\n<p>")); + + Assert.That(varFragment4.OriginalText.ToString(), Is.EqualTo("{{ content |> filter2(a) }}")); + Assert.That(varFragment4.Binding, Is.EqualTo("content")); + Assert.That(varFragment4.FilterExpressions.Length, Is.EqualTo(1)); + Assert.That(varFragment4.FilterExpressions[0].Name, Is.EqualTo("filter2")); + Assert.That(varFragment4.FilterExpressions[0].Arguments.Length, Is.EqualTo(1)); + Assert.That(varFragment4.FilterExpressions[0].Arguments[0], Is.EqualTo(new JsIdentifier("a"))); + + Assert.That(strFragment5.Value.ToString(), Is.EqualTo("</p>")); + } + + [Test] + public void Can_parse_template_with_only_variable() + { + var fragments = ScriptTemplateUtils.ParseTemplate("{{ filter }}"); + Assert.That(fragments.Count, Is.EqualTo(1)); + Assert.That(((PageVariableFragment)fragments[0]).Binding, Is.EqualTo("filter")); + } + + [Test] + public void Can_parse_template_with_arg_and_multiple_filters() + { + var fragments = ScriptTemplateUtils.ParseTemplate("{{ ' - {{it}}' |> forEach(items) |> markdown }}"); + var varFragment = fragments[0] as PageVariableFragment; + + Assert.That(varFragment.OriginalText.ToString(), Is.EqualTo("{{ ' - {{it}}' |> forEach(items) |> markdown }}")); + Assert.That(varFragment.FilterExpressions.Length, Is.EqualTo(2)); + Assert.That(varFragment.FilterExpressions[0].Name, Is.EqualTo("forEach")); + Assert.That(varFragment.FilterExpressions[0].Arguments.Length, Is.EqualTo(1)); + Assert.That(varFragment.FilterExpressions[0].Arguments[0], Is.EqualTo(new JsIdentifier("items"))); + Assert.That(varFragment.FilterExpressions[1].Name, Is.EqualTo("markdown")); + } + + [Test] + public void Can_parse_filter_with_different_arg_types() + { + var fragments = ScriptTemplateUtils.ParseTemplate("{{ array(['a',1,'c']) }}"); + var varFragment = (PageVariableFragment)fragments[0]; + + Assert.That(varFragment.OriginalText.ToString(), Is.EqualTo("{{ array(['a',1,'c']) }}")); + Assert.That(varFragment.InitialExpression.Name, Is.EqualTo("array")); + Assert.That(varFragment.InitialExpression.Arguments.Length, Is.EqualTo(1)); + } + + [Test] + public void Can_parse_next_token() + { + JsToken token; + + "a".ParseJsExpression(out token); + Assert.That(((JsIdentifier)token).Name, Is.EqualTo("a")); + "a2".ParseJsExpression(out token); + Assert.That(((JsIdentifier)token).Name, Is.EqualTo("a2")); + " a2 ".ParseJsExpression(out token); + Assert.That(((JsIdentifier)token).Name, Is.EqualTo("a2")); + "'a'".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral("a"))); + "\"a\"".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral("a"))); + "`a`".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsTemplateLiteral("a"))); + "1".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral(1))); + "100".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral(100))); + "100.0".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral(100d))); + "1.0E+2".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral(100d))); + "1e+2".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral(100d))); + "true".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(JsLiteral.True)); + "false".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(JsLiteral.False)); + "null".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(JsNull.Value)); + "{foo:1}".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression(new JsProperty(new JsIdentifier("foo"), new JsLiteral(1))) + )); + "{ foo : 1 , bar: 'qux', d: 1.1, b:false, n:null }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression( + new JsProperty(new JsIdentifier("foo"), new JsLiteral(1)), + new JsProperty(new JsIdentifier("bar"), new JsLiteral("qux")), + new JsProperty(new JsIdentifier("d"), new JsLiteral(1.1)), + new JsProperty(new JsIdentifier("b"), new JsLiteral(false)), + new JsProperty(new JsIdentifier("n"), JsNull.Value) + ) + )); + "{ map : { bar: 'qux', b: true } }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression( + new JsProperty( + new JsIdentifier("map"), + new JsObjectExpression( + new JsProperty(new JsIdentifier("bar"), new JsLiteral("qux")), + new JsProperty(new JsIdentifier("b"), new JsLiteral(true)) + ) + ) + ) + )); + "{varRef:foo}".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression(new JsProperty(new JsIdentifier("varRef"), new JsIdentifier("foo"))) + )); + "{ \"foo\" : 1 , \"bar\": 'qux', \"d\": 1.1, \"b\":false, \"n\":null }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression( + new JsProperty(new JsLiteral("foo"), new JsLiteral(1)), + new JsProperty(new JsLiteral("bar"), new JsLiteral("qux")), + new JsProperty(new JsLiteral("d"), new JsLiteral(1.1)), + new JsProperty(new JsLiteral("b"), new JsLiteral(false)), + new JsProperty(new JsLiteral("n"), JsNull.Value) + ) + )); + "{ `foo` : 1 , `bar`: 'qux', `d`: 1.1, `b`:false, `n`:null }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression( + new JsProperty(new JsTemplateLiteral("foo"), new JsLiteral(1)), + new JsProperty(new JsTemplateLiteral("bar"), new JsLiteral("qux")), + new JsProperty(new JsTemplateLiteral("d"), new JsLiteral(1.1)), + new JsProperty(new JsTemplateLiteral("b"), new JsLiteral(false)), + new JsProperty(new JsTemplateLiteral("n"), JsNull.Value) + ) + )); + + "[1,2,3]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrayExpression(new JsLiteral(1),new JsLiteral(2),new JsLiteral(3)))); + "[a,b,c]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrayExpression(new JsIdentifier("a"),new JsIdentifier("b"),new JsIdentifier("c")))); + "[a.Id,b.Name]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrayExpression( + new JsMemberExpression(new JsIdentifier("a"), new JsIdentifier("Id")), + new JsMemberExpression(new JsIdentifier("b"), new JsIdentifier("Name")) + ))); + "{ x: a.Id, y: b.Name }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression( + new JsProperty(new JsIdentifier("x"), new JsMemberExpression(new JsIdentifier("a"), new JsIdentifier("Id"))), + new JsProperty(new JsIdentifier("y"), new JsMemberExpression(new JsIdentifier("b"), new JsIdentifier("Name"))) + ) + )); + "['a',\"b\",`c`]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrayExpression(new JsLiteral("a"),new JsLiteral("b"),new JsTemplateLiteral("c")))); + " [ 'a' , \"b\" , 'c' ] ".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsArrayExpression(new JsLiteral("a"),new JsLiteral("b"),new JsLiteral("c")))); + "[ {a: 1}, {b: 2} ]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsArrayExpression( + new JsObjectExpression( + new JsProperty(new JsIdentifier("a"), new JsLiteral(1)) + ), + new JsObjectExpression( + new JsProperty(new JsIdentifier("b"), new JsLiteral(2)) + ) + ) + )); + "[ {a: { 'aa': [1,2,3] } }, { b: [a,b,c] }, 3, true, null ]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsArrayExpression( + new JsObjectExpression( + new JsProperty( + new JsIdentifier("a"), + new JsObjectExpression( + new JsProperty( + new JsLiteral("aa"), + new JsArrayExpression(new JsLiteral(1),new JsLiteral(2),new JsLiteral(3)) + ) + ) + ) + ), + new JsObjectExpression( + new JsProperty( + new JsIdentifier("b"), + new JsArrayExpression(new JsIdentifier("a"),new JsIdentifier("b"),new JsIdentifier("c")) + ) + ), + new JsLiteral(3), + new JsLiteral(true), + JsNull.Value + ) + )); + "{ k:'v', data: { id: 1, name: 'foo' }, k2: 'v2', k3: 'v3' }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression( + new JsProperty(new JsIdentifier("k"), new JsLiteral("v")), + new JsProperty( + new JsIdentifier("data"), + new JsObjectExpression( + new JsProperty(new JsIdentifier("id"), new JsLiteral(1)), + new JsProperty(new JsIdentifier("name"), new JsLiteral("foo")) + ) + ), + new JsProperty(new JsIdentifier("k2"), new JsLiteral("v2")), + new JsProperty(new JsIdentifier("k3"), new JsLiteral("v3")) + ) + )); + "[{name:'Alice', score:50}, {name: 'Bob', score:40}, {name:'Cathy', score:45}]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsArrayExpression( + new JsObjectExpression( + new JsProperty(new JsIdentifier("name"), new JsLiteral("Alice")), + new JsProperty(new JsIdentifier("score"), new JsLiteral(50)) + ), + new JsObjectExpression( + new JsProperty(new JsIdentifier("name"), new JsLiteral("Bob")), + new JsProperty(new JsIdentifier("score"), new JsLiteral(40)) + ), + new JsObjectExpression( + new JsProperty(new JsIdentifier("name"), new JsLiteral("Cathy")), + new JsProperty(new JsIdentifier("score"), new JsLiteral(45)) + ) + ) + )); + } + + [Test] + public void Can_parse_templates_within_literals() + { + JsToken token; + + "'<li>{{it}}</li>'".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral("<li>{{it}}</li>"))); + + var fragments = ScriptTemplateUtils.ParseTemplate("<ul>{{ '<li>{{it}}</li>' }}</ul>"); + Assert.That(fragments.Count, Is.EqualTo(3)); + } + + [Test] + public void Can_parse_method_binding_expressions() + { + JsToken token; + + "if(OR(gt(1,2),lt(3,4)))".ParseJsExpression(out token); + + Assert.That(token, Is.EqualTo( + new JsCallExpression( + new JsIdentifier("if"), + new JsCallExpression( + new JsIdentifier("OR"), + new JsCallExpression( + new JsIdentifier("gt"), + new JsLiteral(1), + new JsLiteral(2) + ), + new JsCallExpression( + new JsIdentifier("lt"), + new JsLiteral(3), + new JsLiteral(4) + ) + ) + ) + )); + + + @" + if ( + OR ( + gt ( 1 , 2 ) , + lt ( 3 , 4 ) + ) + )".ParseJsExpression(out token); + + Assert.That(token, Is.EqualTo( + new JsCallExpression( + new JsIdentifier("if"), + new JsCallExpression( + new JsIdentifier("OR"), + new JsCallExpression( + new JsIdentifier("gt"), + new JsLiteral(1), + new JsLiteral(2) + ), + new JsCallExpression( + new JsIdentifier("lt"), + new JsLiteral(3), + new JsLiteral(4) + ) + ) + ) + )); + } + + [Test] + public void Does_support_shorthand_object_initializers() + { + "{key}".ParseJsExpression(out var token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression( + new JsProperty(new JsIdentifier("key"), new JsIdentifier("key"), shorthand:true) + ) + )); + "{ key }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression( + new JsProperty(new JsIdentifier("key"), new JsIdentifier("key"), shorthand:true) + ) + )); + "{ map : { key , foo: 'bar' , qux } }".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsObjectExpression( + new JsProperty( + new JsIdentifier("map"), + new JsObjectExpression( + new JsProperty(new JsIdentifier("key"), new JsIdentifier("key"), shorthand:true), + new JsProperty(new JsIdentifier("foo"), new JsLiteral("bar")), + new JsProperty(new JsIdentifier("qux"), new JsIdentifier("qux"), shorthand:true) + ) + ) + ) + )); + } + + [Test] + public void Does_preserve_new_lines() + { + JsToken token; + + "'a\n'".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo(new JsLiteral("a\n"))); + } + + [Test] + public void Can_parse_boolean_logic_expressions() + { + JsToken token; + + "it.Id == 0".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsBinaryExpression( + new JsMemberExpression(new JsIdentifier("it"), new JsIdentifier("Id")), + JsEquals.Operator, + new JsLiteral(0) + ) + )); + + var hold = ScriptConfig.AllowAssignmentExpressions; + ScriptConfig.AllowAssignmentExpressions = false; + + "it.Id = 0".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsBinaryExpression( + new JsMemberExpression(new JsIdentifier("it"), new JsIdentifier("Id")), + JsEquals.Operator, + new JsLiteral(0) + ) + )); + + ScriptConfig.AllowAssignmentExpressions = hold; + } + + [Test] + public void Can_parse_assignment_expression() + { + JsToken token; + + "id = 0".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsAssignmentExpression( + new JsIdentifier("id"), + JsAssignment.Operator, + new JsLiteral(0) + ) + )); + + "global.id = 0".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsAssignmentExpression( + new JsMemberExpression(new JsIdentifier("global"), new JsIdentifier("id")), + JsAssignment.Operator, + new JsLiteral(0) + ) + )); + } + + [Test] + public void Can_parse_variable_declarations() + { + JsToken token; + + "var id = 0".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsVariableDeclaration( + JsVariableDeclarationKind.Var, + new JsDeclaration(new JsIdentifier("id"), new JsLiteral(0)) + ) + )); + + "var id = 0;".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsVariableDeclaration( + JsVariableDeclarationKind.Var, + new JsDeclaration(new JsIdentifier("id"), new JsLiteral(0)) + ) + )); + + "let a = 1 + 2, b = 3 * 4, c, d = 'D'".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsVariableDeclaration( + JsVariableDeclarationKind.Let, + new JsDeclaration(new JsIdentifier("a"), + new JsBinaryExpression(new JsLiteral(1), JsAddition.Operator, new JsLiteral(2) )) + ,new JsDeclaration(new JsIdentifier("b"), + new JsBinaryExpression(new JsLiteral(3), JsMultiplication.Operator, new JsLiteral(4) )) + ,new JsDeclaration(new JsIdentifier("c"), null) + ,new JsDeclaration(new JsIdentifier("d"), new JsLiteral("D") )) + ) + ); + + "const c = [1]".ParseJsExpression(out token); + Assert.That(token, Is.EqualTo( + new JsVariableDeclaration( + JsVariableDeclarationKind.Const, + new JsDeclaration(new JsIdentifier("c"), + new JsArrayExpression(new JsLiteral(1))) + ) + )); + } + + [Test] + public void Can_execute_variable_declarations() + { + var context = new ScriptContext().Init(); + Assert.That(context.RenderScript("{{var a = 1}}{{a}}"), Is.EqualTo("1")); + Assert.That(context.RenderScript("{{let a = 1, b = 1 + 2}}{{b}}"), Is.EqualTo("3")); + Assert.That(context.RenderScript("{{const a = 1, b = 1 + 2, c}}{{b}}"), Is.EqualTo("3")); + Assert.That(context.RenderScript("{{var a = 1, b = 1 + 2, c}}{{c}}"), Is.EqualTo("")); + Assert.That(context.RenderScript("{{let a = 1, b = 1 + 2,c,d='A'}}{{d}}"), Is.EqualTo("A")); + Assert.That(context.RenderScript("{{var a=1, b=1+2, c, d='A'}}{{d}}"), Is.EqualTo("A")); + + var expr = JS.expression("var a=1, b = 1 + 2, c, d='A'"); + var str = expr.ToJsAstString(); + } + + [Test] + public void Can_use_cleaner_whitespace_sensitive_syntax_for_string_arguments() + { + var fragments1 = ScriptTemplateUtils.ParseTemplate( + @"{{ +products + |> where: it.UnitsInStock = 0 + |> select: { it.productName |> raw } is sold out!\n +}}"); + + var fragments2 = ScriptTemplateUtils.ParseTemplate( + @"{{ products + |> where: it.UnitsInStock = 0 + |> select: { it.productName |> raw } is sold out!\n }}"); + + // i.e. is rewritten and is equivalent to: + var fragments3 = ScriptTemplateUtils.ParseTemplate( + @"{{ products |> where(′it.UnitsInStock = 0′) |> select(′{{ it.productName |> raw }} is sold out!\n′)}}"); + Assert.That(fragments3.Count, Is.EqualTo(1)); + + Assert.That(fragments1.Count, Is.EqualTo(1)); + var varFragment1 = fragments1[0] as PageVariableFragment; + Assert.That(varFragment1.FilterExpressions[0].Name, Is.EqualTo("where")); + Assert.That(varFragment1.FilterExpressions[0].Arguments.Length, Is.EqualTo(1)); + Assert.That(varFragment1.FilterExpressions[0].Arguments[0], Is.EqualTo( + new JsLiteral("it.UnitsInStock = 0") + )); + Assert.That(varFragment1.FilterExpressions[1].Name, Is.EqualTo("select")); + Assert.That(varFragment1.FilterExpressions[1].Arguments.Length, Is.EqualTo(1)); + Assert.That(varFragment1.FilterExpressions[1].Arguments[0], Is.EqualTo( + new JsLiteral("{{ it.productName |> raw }} is sold out!\\n") + )); + + foreach (var fragments in new[]{ fragments2, fragments3 }) + { + var varFragment = fragments[0] as PageVariableFragment; + Assert.That(varFragment.FilterExpressions[0].Name, Is.EqualTo(varFragment1.FilterExpressions[0].Name)); + Assert.That(varFragment.FilterExpressions[0].Arguments.Length, Is.EqualTo(varFragment1.FilterExpressions[0].Arguments.Length)); + Assert.That(varFragment.FilterExpressions[0].Arguments[0], Is.EqualTo(varFragment1.FilterExpressions[0].Arguments[0])); + Assert.That(varFragment.FilterExpressions[1].Name, Is.EqualTo(varFragment1.FilterExpressions[1].Name)); + Assert.That(varFragment.FilterExpressions[1].Arguments.Length, Is.EqualTo(varFragment1.FilterExpressions[1].Arguments.Length)); + Assert.That(varFragment.FilterExpressions[1].Arguments[0], Is.EqualTo(varFragment1.FilterExpressions[1].Arguments[0])); + } + } + + [Test] + public void Can_parse_pages_starting_with_values() + { + var fragments = ScriptTemplateUtils.ParseTemplate( + @"{{ [c.CustomerId, o.OrderId, o.OrderDate] |> jsv }}\n"); + + var varFragment = (PageVariableFragment) fragments[0]; + Assert.That(varFragment.Expression, Is.EqualTo(new JsArrayExpression( + new JsMemberExpression(new JsIdentifier("c"), new JsIdentifier("CustomerId")), + new JsMemberExpression(new JsIdentifier("o"), new JsIdentifier("OrderId")), + new JsMemberExpression(new JsIdentifier("o"), new JsIdentifier("OrderDate")) + ))); + + Assert.That(varFragment.OriginalText.ToString(), Is.EqualTo("{{ [c.CustomerId, o.OrderId, o.OrderDate] |> jsv }}")); + + var newLine = (PageStringFragment) fragments[1]; + Assert.That(newLine.Value.ToString(), Is.EqualTo("\\n")); + } + + [Test] + public void Can_parse_pages_starting_with_values_newLine() + { + var context = new ScriptContext().Init(); + var page = context.OneTimePage("{{ [c.CustomerId, o.OrderId, o.OrderDate] |> jsv }}\n"); + var fragments = page.PageFragments; + +// var fragments = TemplatePageUtils.ParseTemplatePage( +// "{{ [c.CustomerId, o.OrderId, o.OrderDate] |> jsv }}\n"); + + var varFragment = (PageVariableFragment) fragments[0]; + Assert.That(varFragment.Expression, Is.EqualTo(new JsArrayExpression( + new JsMemberExpression(new JsIdentifier("c"), new JsIdentifier("CustomerId")), + new JsMemberExpression(new JsIdentifier("o"), new JsIdentifier("OrderId")), + new JsMemberExpression(new JsIdentifier("o"), new JsIdentifier("OrderDate")) + ))); + + var newLine = (PageStringFragment) fragments[1]; + Assert.That(newLine.Value.ToString(), Is.EqualTo("\n")); + } + + [Test] + public void Can_detect_invalid_syntax() + { + try + { + var fragments = ScriptTemplateUtils.ParseTemplate("{{ arg |> filter(' 1) }}"); + Assert.Fail("should throw"); + } + catch (ArgumentException e) + { + e.Message.Print(); + } + + try + { + var fragments = ScriptTemplateUtils.ParseTemplate("square = {{ 'square-partial |> partial({ ten }) }}"); + Assert.Fail("should throw"); + } + catch (ArgumentException e) + { + e.Message.Print(); + } + + try + { + var fragments = ScriptTemplateUtils.ParseTemplate("{{ arg |> filter({ unterminated:1) }}"); + Assert.Fail("should throw"); + } + catch (ArgumentException e) + { + e.Message.Print(); + } + + try + { + var fragments = ScriptTemplateUtils.ParseTemplate("{{ arg |> filter([ 1) }}"); + Assert.Fail("should throw"); + } + catch (ArgumentException e) + { + e.Message.Print(); + } + + } + + [Test] + public void Does_remove_new_line_between_var_literals() + { + var fragments = ScriptTemplateUtils.ParseTemplate("{{ 'foo' |> assignTo: bar }}\n{{ bar }}"); + Assert.That(fragments.Count, Is.EqualTo(2)); + fragments = ScriptTemplateUtils.ParseTemplate("{{ 'foo' |> assignTo: bar }}\r\n{{ bar }}"); + Assert.That(fragments.Count, Is.EqualTo(2)); + + fragments = ScriptTemplateUtils.ParseTemplate("{{ ['foo'] |> do: assign('bar', it) }}\n{{ bar }}"); + Assert.That(fragments.Count, Is.EqualTo(2)); + fragments = ScriptTemplateUtils.ParseTemplate("{{ do: assign('bar', 'foo') }}\n{{ bar }}"); + Assert.That(fragments.Count, Is.EqualTo(2)); + fragments = ScriptTemplateUtils.ParseTemplate("{{ 10 |> times |> do: assign('bar', 'foo') }}\n{{ bar }}"); + Assert.That(fragments.Count, Is.EqualTo(2)); + fragments = ScriptTemplateUtils.ParseTemplate("{{ 10 |> times |> do: assign('bar', 'foo') }}\nbar"); + Assert.That(fragments.Count, Is.EqualTo(2)); + var stringFragment = (PageStringFragment) fragments[1]; + Assert.That(stringFragment.Value.ToString(), Is.EqualTo("bar")); + } + + [Test] + public void Can_parse_empty_arguments() + { + JsToken token; + + "fn()".ParseJsExpression(out token); + Assert.That(((JsCallExpression)token).Name, Is.EqualTo("fn")); + "fn({})".ParseJsExpression(out token); + Assert.That(((JsCallExpression)token).Arguments.Length, Is.EqualTo(1)); + "fn({ })".ParseJsExpression(out token); + Assert.That(((JsCallExpression)token).Arguments.Length, Is.EqualTo(1)); + "fn({ })".ParseJsExpression(out token); + Assert.That(((JsCallExpression)token).Arguments.Length, Is.EqualTo(1)); + } + + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPagesIntegrationTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPagesIntegrationTests.cs new file mode 100644 index 00000000000..57916d0252d --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpPagesIntegrationTests.cs @@ -0,0 +1,688 @@ +using System.Collections.Generic; +using System.Linq; +using System.Net; +using Funq; +using NUnit.Framework; +using ServiceStack.Data; +using ServiceStack.IO; +using ServiceStack.OrmLite; +using ServiceStack.Script; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + [Route("/rockstar-pages/{Id}")] + public class RockstarsPage + { + public int Id { get; set; } + public string Layout { get; set; } + } + + public class GetRockstarTemplate : IReturn<Rockstar> + { + public int Id { get; set; } + public string FirstName { get; set; } + } + + public class AddRockstarTemplate : IReturnVoid + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public int Age { get; set; } + } + + public class MyTemplateServices : Service + { + public object Any(RockstarsPage request) => + new PageResult(Request.GetCodePage("rockstar-view")) + { + Layout = request.Layout, + Args = + { + ["rockstar"] = Db.SingleById<Rockstar>(request.Id) + } + }; + + public object Any(GetRockstarTemplate request) => !string.IsNullOrEmpty(request.FirstName) + ? Db.Single<Rockstar>(x => x.FirstName == request.FirstName) + : Db.SingleById<Rockstar>(request.Id); + + public void Any(AddRockstarTemplate request) => + Db.Save(request.ConvertTo<Rockstar>()); + } + + [Page("shadowed-page")] + public class ShadowedPage : SharpCodePage + { + string render() => @"<h1>Shadowed Template Code Page</h1>"; + } + + [Page("shadowed/index")] + public class ShadowedIndexPage : SharpCodePage + { + string render() => @"<h1>Shadowed Index Code Page</h1>"; + } + + [Page("rockstar")] + public class RockstarPage : ServiceStackCodePage + { + string render(int id) => renderRockstar(Db.SingleById<Rockstar>(id)); + + string renderRockstar(Rockstar rockstar) => $@" +<h1>{Request.RawUrl}</h1> +<h2>{rockstar.FirstName} {rockstar.LastName}</h2> +<b>{rockstar.Age}</b> +"; + } + + [Page("rockstar-view")] + public class RockstarPageView : ServiceStackCodePage + { + string render(Rockstar rockstar) => $@" +<h1>{Request.RawUrl}</h1> +<h2>{rockstar.FirstName} {rockstar.LastName}</h2> +<b>{rockstar.Age}</b> +"; + } + + [Page("products")] + [PageArg("title", "Products")] + public class ProductsPage : SharpCodePage + { + string render(Product[] products) => $@" + <table class='table'> + <thead> + <tr> + <th>Category</th> + <td>Name</td> + <td>Price</td> + </tr> + </thead> + {products.OrderBy(x => x.Category).Map(x => + $"<tr><th>{x.Category}</th><td>{x.ProductName}</td><td>{x.UnitPrice:C}</td></tr>\n").Join("")} + </table>"; + } + + [Page("products-sidebar", "layout-with-sidebar")] + [PageArg("title", "Products with Sidebar")] + public class ProductsSidebarPage : SharpCodePage + { + string render(Product[] products) => $@" + <table class='table'> + <thead> + <tr> + <th>Category</th> + <td>Name</td> + <td>Price</td> + </tr> + </thead> + {products.OrderBy(x => x.Category).Map(x => + $"<tr><th>{x.Category}</th><td>{x.ProductName}</td><td>{x.UnitPrice:C}</td></tr>\n").Join("")} + </table>"; + } + + [Page("sidebar")] + public class SidebarPage : SharpCodePage + { + string render(Dictionary<string, object> links) => $@"<ul> + {links.Map(entry => $"<li><a href='{entry.Key}'>{entry.Value}</a></li>\n").Join("")} +</ul>"; + } + + [Page("requestInfo")] + public class RequestInfoPartial : ServiceStackCodePage + { + string render() => $@"PathInfo: {Request.PathInfo}"; + } + + public class SharpPagesIntegrationTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(SharpPagesIntegrationTests), typeof(MyTemplateServices).Assembly) {} + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + DebugMode = true, + ForbiddenPaths = { "/plugins" } + }); + + container.Register<IDbConnectionFactory>(new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + using (var db = container.Resolve<IDbConnectionFactory>().Open()) + { + db.DropAndCreateTable<Rockstar>(); + db.InsertAll(UnitTestExample.SeedData); + } + + Plugins.Add(new SharpPagesFeature + { + Args = + { + ["products"] = QueryData.Products, + } + }); + + var files = TemplateFiles[0]; + + files.WriteFile("_layout.html", @" +<html> +<body id=root> +{{ page }} +</body> +</html> +"); + files.WriteFile("custom_layout.html", @" +<html> +<body id=custom> +{{ page }} +</body> +</html> +"); + files.WriteFile("layout-with-sidebar.html", @" +<html> +<body id=sidebar> +{{ 'sidebar' |> partial({ links: { 'a.html': 'A Page', 'b.html': 'B Page' } }) }} +{{ page }} +</body> +</html> +"); + files.WriteFile("dir/_layout.html", @" +<html> +<body id=dir> +{{ page }} +</body> +</html> +"); + files.WriteFile("alt-layout.html", @" +<html> +<body id=alt-layout> +{{ page }} +</body> +</html> +"); + files.WriteFile("dir/alt-layout.html", @" +<html> +<body id=dir-alt-layout> +{{ page }} +</body> +</html> +"); + files.WriteFile("alt/alt-layout.html", @" +<html> +<body id=alt-alt-layout> +{{ page }} +</body> +</html> +"); + files.WriteFile("dir/dir-page.html", @" +<h1>Dir Page</h1> +"); + + files.WriteFile("dir/alt-dir-page.html", @"<!-- +layout: alt-layout +--> + +<h1>Alt Dir Page</h1> +"); + + files.WriteFile("dir/alt-layout-alt-dir-page.html", @"<!-- +layout: alt/alt-layout +--> + +<h1>Alt Layout Alt Dir Page</h1> +"); + + files.WriteFile("index.html", @" +<h1>The Home Page</h1> +"); + + files.WriteFile("direct-page.html", @" +<h1>Direct Page</h1> +"); + files.WriteFile("shadowed-page.html", @" +<h1>Shadowed Template Page</h1> +"); + + files.WriteFile("shadowed/index.html", @" +<h1>Shadowed Index Page</h1> +"); + files.WriteFile("requestinfo-page.html", @" +<h1>The Request Info Page</h1> +<p>{{ 'requestInfo' |> partial }}</p> +"); + + files.WriteFile("dir/dir-partial.html", @" +<h2>Dir Partial</h2> +"); + files.WriteFile("dir/dir-page-partial.html", @" +<h1>Dir Page Partial</h1> +{{ 'dir-partial' |> partial }} +"); + + files.WriteFile("dir/dir-file.txt", @" +<h2>Dir File</h2> +"); + files.WriteFile("dir/dir-page-file.html", @" +<h1>Dir Page File</h1> +{{ 'dir-file.txt' |> includeFile }} +"); + files.WriteFile("dir/dir-page-file-cache.html", @" +<h1>Dir Page File Cache</h1> +{{ 'dir-file.txt' |> includeFileWithCache }} +"); + + files.WriteFile("rockstar-details.html", @"{{ it.FirstName }} {{ it.LastName }} ({{ it.Age }})"); + + files.WriteFile("rockstar-gateway.html", @" +{{ { qs.id, qs.firstName } |> ensureAnyArgsNotNull |> sendToGateway('GetRockstarTemplate') |> assignTo: rockstar }} +{{ rockstar |> ifExists |> selectPartial: rockstar-details }} +{{ rockstar |> endIfExists |> select: No rockstar with id: { qs.id } }} +{{ htmlError }} +"); + + files.WriteFile("rockstar-gateway-publish.html", @" +{{ 'id,firstName,lastName,age' |> importRequestParams }}{{ { id, firstName, lastName, age } |> ensureAllArgsNotNull |> publishToGateway('AddRockstarTemplate') }} +{{ 'rockstar-gateway' |> partial({ firstName }) }} +{{ htmlError }}"); + + files.WriteFile("plugins/dll.txt", "Forbidden File"); + } + + public readonly List<IVirtualPathProvider> TemplateFiles = new List<IVirtualPathProvider> { new MemoryVirtualFiles() }; + public override List<IVirtualPathProvider> GetVirtualFileSources() => TemplateFiles; + } + + public static string BaseUrl = Config.ListeningOn; + + private readonly ServiceStackHost appHost; + public SharpPagesIntegrationTests() + { + appHost = new AppHost() + .Init() + .Start(BaseUrl); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Can_process_home_page() + { + var html = BaseUrl.GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> + +<h1>The Home Page</h1> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_direct_page_with_layout() + { + var html = BaseUrl.AppendPath("direct-page").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> + +<h1>Direct Page</h1> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_return_dir_page_with_dir_layout_by_default() + { + var html = BaseUrl.AppendPath("dir", "dir-page").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=dir> + +<h1>Dir Page</h1> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_return_alt_dir_page_with_closest_alt_layout() + { + var html = BaseUrl.AppendPath("dir", "alt-dir-page").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=dir-alt-layout> +<h1>Alt Dir Page</h1> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Can_request_alt_layout_within_alt_subdir() + { + var html = BaseUrl.AppendPath("dir", "alt-layout-alt-dir-page").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=alt-alt-layout> +<h1>Alt Layout Alt Dir Page</h1> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_return_shadowed_code_page_with_layout() + { + var html = BaseUrl.AppendPath("shadowed-page").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> +<h1>Shadowed Template Code Page</h1> +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_return_shadowed_index_code_page_with_layout() + { + var html = BaseUrl.AppendPath("shadowed").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> +<h1>Shadowed Index Code Page</h1> +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_execute_ServiceStackCodePage_with_Db_and_Request() + { + var html = BaseUrl.AppendPath("rockstar").AddQueryParam("id", "1").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> + +<h1>/rockstar?id=1</h1> +<h2>Jimi Hendrix</h2> +<b>27</b> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_execute_RockstarPageView() + { + var html = BaseUrl.AppendPath("rockstar-pages", "1").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=root> + +<h1>/rockstar-pages/1</h1> +<h2>Jimi Hendrix</h2> +<b>27</b> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_execute_RockstarPageView_with_custom_layout() + { + var html = BaseUrl.AppendPath("rockstar-pages", "1").AddQueryParam("layout", "custom_layout").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=custom> + +<h1>/rockstar-pages/1?layout=custom_layout</h1> +<h2>Jimi Hendrix</h2> +<b>27</b> + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_execute_ProductsPage_with_default_layout() + { + var html = BaseUrl.AppendPath("products").GetStringFromUrl(); + + Assert.That(html.NormalizeNewLines(), Does.StartWith(@"<html> +<body id=root> + + <table class='table'> + <thead> + <tr> + <th>Category</th> + <td>Name</td> + <td>Price</td> + </tr> + </thead> + <tr><th>Beverages</th><td>Chai</td><td>$18.00</td></tr> +<tr><th>Beverages</th><td>Chang</td><td>$19.00</td></tr>".NormalizeNewLines())); + } + + [Test] + public void Does_execute_ProductsPage_with_Sidebar_CodePage_layout() + { + var html = BaseUrl.AppendPath("products-sidebar").GetStringFromUrl(); + + Assert.That(html.NormalizeNewLines(), Does.StartWith(@"<html> +<body id=sidebar> +<ul> + <li><a href='a.html'>A Page</a></li> +<li><a href='b.html'>B Page</a></li> + +</ul> + + <table class='table'> + <thead> + <tr> + <th>Category</th> + <td>Name</td> + <td>Price</td> + </tr> + </thead> + <tr><th>Beverages</th><td>Chai</td><td>$18.00</td></tr> +<tr><th>Beverages</th><td>Chang</td><td>$19.00</td></tr>".NormalizeNewLines())); + } + + [Test] + public void CodePage_partials_are_injected_with_current_Request() + { + var html = BaseUrl.AppendPath("requestinfo-page").GetStringFromUrl(); + + Assert.That(html.NormalizeNewLines(), Does.StartWith(@" +<html> +<body id=root> + +<h1>The Request Info Page</h1> +<p>PathInfo: /requestinfo-page</p> + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_resolve_closest_partial_starting_from_page_directory() + { + var html = BaseUrl.AppendPath("dir","dir-page-partial").GetStringFromUrl(); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=dir> + +<h1>Dir Page Partial</h1> + +<h2>Dir Partial</h2> + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_resolve_closest_file_starting_from_page_directory() + { + var html = BaseUrl.AppendPath("dir", "dir-page-file").GetStringFromUrl(); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=dir> + +<h1>Dir Page File</h1> + +<h2>Dir File</h2> + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_resolve_closest_file_with_cache_starting_from_page_directory() + { + var html = BaseUrl.AppendPath("dir", "dir-page-file-cache").GetStringFromUrl(); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=dir> + +<h1>Dir Page File Cache</h1> + +<h2>Dir File</h2> + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Can_call_sendToGateway() + { + var html = BaseUrl.AppendPath("rockstar-gateway").AddQueryParam("id","1").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@"<html> +<body id=root> + +Jimi Hendrix (27) + + + +</body> +</html>".NormalizeNewLines())); + + html = BaseUrl.AppendPath("rockstar-gateway").AddQueryParam("firstName","Kurt").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@"<html> +<body id=root> + +Kurt Cobain (27) + + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Does_handle_error_calling_sendToGateway() + { + var html = BaseUrl.AppendPath("rockstar-gateway").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Does.StartWith(@"<html> +<body id=root> + + + +<pre class=""alert alert-danger"">ArgumentNullException: Value cannot be null. +Parameter name: firstName + +StackTrace: + at JsObjectExpression: {:qs.:id,:qs.:firstName}".NormalizeNewLines())); + + html = BaseUrl.AppendPath("rockstar-gateway").AddQueryParam("id","Kurt").GetStringFromUrl(); + Assert.That(html.NormalizeNewLines(), Does.StartWith(@"<html> +<body id=root> + + + +<pre class=""alert alert-danger"">FormatException: Input string was not in a correct format. + +StackTrace: + at JsObjectExpression: {:qs.:id,:qs.:firstName}".NormalizeNewLines())); + } + + [Test] + public void Can_call_publishToGateway() + { + var html = BaseUrl.AppendPath("rockstar-gateway-publish") + .AddQueryParam("id","8") + .AddQueryParam("firstName","Amy") + .AddQueryParam("lastName","Winehouse") + .AddQueryParam("age","27") + .GetStringFromUrl(); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@"<html> +<body id=root> + + +Amy Winehouse (27) + + + + +</body> +</html>".NormalizeNewLines())); + } + + [Test] + public void Does_handle_error_calling_publishToGateway() + { + var html = BaseUrl.AppendPath("rockstar-gateway-publish") + .AddQueryParam("id","8") + .AddQueryParam("firstName","Amy") + .AddQueryParam("age","27") + .GetStringFromUrl(); + + Assert.That(html.NormalizeNewLines(), Does.StartWith(@"<html> +<body id=root> + + +<pre class=""alert alert-danger"">ArgumentNullException: Value cannot be null. +Parameter name: lastName + +StackTrace: + at JsObjectExpression: {:id,".NormalizeNewLines())); + } + + [Test] + public void Should_not_be_allowed_to_access_plugins_folder() + { + + try + { + var contents = BaseUrl.AppendPath("plugins", "dll.txt").GetStringFromUrl(); + Assert.Fail("Should throw"); + } + catch (WebException ex) + { + Assert.That(ex.GetStatus(), Is.EqualTo(HttpStatusCode.Forbidden)); + } + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpViewsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpViewsTests.cs new file mode 100644 index 00000000000..8b4d72f2a17 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/SharpViewsTests.cs @@ -0,0 +1,304 @@ +using System.Collections.Generic; +using System.Net; +using Funq; +using NUnit.Framework; +using ServiceStack.Formats; +using ServiceStack.IO; +using ServiceStack.Script; +using ServiceStack.Testing; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + [Route("/view-pages/{Name}")] + public class TemplateViewPage : IReturn<TemplateViewPageResponse> + { + public string Name { get; set; } + } + public class TemplateViewPageResponse + { + public string Name { get; set; } + } + + [Route("/view-pages-request/{Name}")] + public class TemplateViewPageRequest : IReturn<TemplateViewPageRequest> + { + public string Name { get; set; } + } + + [Route("/view-pages-nested/{Name}")] + public class TemplateViewPageNested : IReturn<TemplateViewPageNested> + { + public string Name { get; set; } + } + + [Route("/view-pages-nested-sub/{Name}")] + public class TemplateViewPageNestedSub : IReturn<TemplateViewPageNested> + { + public string Name { get; set; } + } + + [Route("/view-pages-custom/{Name}")] + public class TemplateViewPageCustom : IReturn<TemplateViewPageCustom> + { + public string Name { get; set; } + public string View { get; set; } + public string Layout { get; set; } + } + + public class TemplateViewPagesServices : Service + { + public object Any(TemplateViewPage request) => new TemplateViewPageResponse { Name = request.Name }; + public object Any(TemplateViewPageRequest request) => request; + public object Any(TemplateViewPageNested request) => request; + public object Any(TemplateViewPageNestedSub request) => request; + public object Any(TemplateViewPageCustom request) => new HttpResult(request) + { + View = request.View, + Template = request.Layout, + }; + } + + public class SharpViewsTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(SharpViewsTests), typeof(TemplateViewPagesServices).Assembly) {} + + public readonly List<IVirtualPathProvider> TemplateFiles = new List<IVirtualPathProvider> + { + new MemoryVirtualFiles(), + new ResourceVirtualFiles(typeof(HtmlFormat).Assembly), + }; + + public override List<IVirtualPathProvider> GetVirtualFileSources() => TemplateFiles; + + public override void Configure(Container container) + { + Plugins.Add(new SharpPagesFeature()); + + var files = TemplateFiles[0]; + + files.WriteFile("_layout.html", @" +<html> +<body id=root> +{{ page }} +{{ htmlErrorDebug }} +</body> +</html> +"); + + files.WriteFile("alt-layout.html", @" +<html> +<body id=alt-root> +{{ page }} +{{ htmlErrorDebug }} +</body> +</html> +"); + + files.WriteFile("Views/_layout.html", @" +<html> +<body id=views> +{{ page }} +{{ htmlErrorDebug }} +</body> +</html> +"); + + files.WriteFile("Views/TemplateViewPageRequest.html", @" +<h1>TemplateViewPageRequest</h1> +<p>Name: {{ Name }}</p> +"); + + files.WriteFile("Views/TemplateViewPageRequest.html", @" +<h1>TemplateViewPageRequest</h1> +<p>Name: {{ Name }}</p> +"); + + files.WriteFile("Views/TemplateViewPageResponse.html", @" +<h1>TemplateViewPageResponse</h1> +<p>Name: {{ Name }}</p> +"); + + files.WriteFile("Views/nested/TemplateViewPageNested.html", @" +<h1>TemplateViewPageNested</h1> +<p>Name: {{ Name }}</p> +"); + + files.WriteFile("Views/nested/sub/TemplateViewPageNestedSub.html", @" +<h1>TemplateViewPageNestedSub</h1> +<p>Name: {{ Name }}</p> +"); + files.WriteFile("Views/nested/sub/_layout.html", @" +<html> +<body id=views-nested-sub> +{{ page }} +{{ htmlErrorDebug }} +</body> +</html> +"); + + } + } + public static string BaseUrl = Config.ListeningOn; + + private readonly ServiceStackHost appHost; + public SharpViewsTests() + { + appHost = new AppHost() + .Init() + .Start(BaseUrl); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + public void AssertHtmlContentType(HttpWebResponse res) + { + Assert.That(res.ContentType.MatchesContentType(MimeTypes.Html), $"Expected {MimeTypes.Html} got {res.ContentType}"); + } + + [Test] + public void Does_render_TemplateViewPageResponse_on_HTML_requests() + { + var html = BaseUrl.CombineWith("view-pages", "test") + .GetStringFromUrl(accept:MimeTypes.Html, responseFilter:AssertHtmlContentType); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=views> + +<h1>TemplateViewPageResponse</h1> +<p>Name: test</p> + + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_render_TemplateViewPageRequest_on_HTML_requests() + { + var html = BaseUrl.CombineWith("view-pages-request", "test") + .GetStringFromUrl(accept: MimeTypes.Html, responseFilter: AssertHtmlContentType); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=views> + +<h1>TemplateViewPageRequest</h1> +<p>Name: test</p> + + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_render_TemplateViewPageNested_on_HTML_requests() + { + var html = BaseUrl.CombineWith("view-pages-nested", "test") + .GetStringFromUrl(accept: MimeTypes.Html, responseFilter: AssertHtmlContentType); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=views> + +<h1>TemplateViewPageNested</h1> +<p>Name: test</p> + + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_render_TemplateViewPageNestedSub_on_HTML_requests() + { + var html = BaseUrl.CombineWith("view-pages-nested-sub", "test") + .GetStringFromUrl(accept: MimeTypes.Html, responseFilter: AssertHtmlContentType); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=views-nested-sub> + +<h1>TemplateViewPageNestedSub</h1> +<p>Name: test</p> + + +</body> +</html> +".NormalizeNewLines())); + } + + [Test] + public void Does_render_TemplateViewPageCustom_with_custom_view() + { + var html = BaseUrl.CombineWith("view-pages-custom", "test") + .AddQueryParam("view", "TemplateViewPageRequest") + .GetStringFromUrl(accept: MimeTypes.Html, responseFilter: AssertHtmlContentType); + + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=views> + +<h1>TemplateViewPageRequest</h1> +<p>Name: test</p> + + +</body> +</html> +".NormalizeNewLines())); + + html = BaseUrl.CombineWith("view-pages-custom", "test") + .AddQueryParam("view", "TemplateViewPageResponse") + .AddQueryParam("layout", "alt-layout") + .GetStringFromUrl(accept: MimeTypes.Html); + Assert.That(html.NormalizeNewLines(), Is.EqualTo(@" +<html> +<body id=alt-root> + +<h1>TemplateViewPageResponse</h1> +<p>Name: test</p> + + +</body> +</html> +".NormalizeNewLines())); + + } + } + + public class TemplatePageFeatureTests + { + class InitFilter : ScriptMethods + { + public static bool HasInit = false; + + public bool initFilter() => HasInit = true; + } + + [Test] + public void Does_evaluate_init_page() + { + using (new BasicAppHost + { + ConfigureAppHost = host => { + var templateFiles = new MemoryVirtualFiles(); + templateFiles.WriteFile("_init.html", "{{ initFilter }}"); + host.AddVirtualFileSources.Add(templateFiles); + host.Plugins.Add(new SharpPagesFeature { + ScriptMethods = { new InitFilter() } + }); + } + }.Init()) + { + Assert.That(InitFilter.HasInit); + } + } + } + +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/TemplatedLiteralsTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/TemplatedLiteralsTests.cs new file mode 100644 index 00000000000..4792f9f3b8b --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ScriptTests/TemplatedLiteralsTests.cs @@ -0,0 +1,47 @@ +using NUnit.Framework; +using ServiceStack.Script; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.ScriptTests +{ + public class TemplateLiteralsTests + { + [Test] + public void Can_embed_escaped_strings_in_template_literals() + { + const string text = @"C:\src\dotnet-app\src\WebApp\bin\Release\netcoreapp3.1\favicon.ico +C:\src\dotnet-app\src\WebApp\bin\Release\netcoreapp3.1\app.exe +C:\src\dotnet-app\src\WebApp\bin\Release\netcoreapp3.1\app.deps.json +C:\src\dotnet-app\src\WebApp\bin\Release\netcoreapp3.1\app.runtimeconfig.json +C:\src\dotnet-app\src\WebApp\bin\Release\netcoreapp3.1\app.runtimeconfig.dev.json +C:\src\dotnet-app\src\WebApp\bin\Release\netcoreapp3.1\app.dll +C:\src\dotnet-app\src\WebApp\bin\Release\netcoreapp3.1\app.pdb"; + + var context = new ScriptContext { + Args = { + ["file"] = text + } + }.Init(); + + var output = context.RenderCode(@" +#each line in file.readLines() where line.contains('\\bin\\') + line.substring(line.indexOf('\\bin\\') + 1) |> to => src + line.lastRightPart('\\') |> to => target + `<file src=""${src}"" target=""tools\\netcoreapp3.1\\any\\${target}"" />`.raw() +/each +"); + // output.Print(); + Assert.That(output.NormalizeNewLines(), + Does.StartWith("<file src=\"bin\\Release\\netcoreapp3.1\\favicon.ico\" target=\"tools\\netcoreapp3.1\\any\\favicon.ico\" />")); + } + + [Test] + public void Does_UnRaw_RawStrings_in_Template_Literals() + { + var context = new ScriptContext().Init(); + var output = context.RenderCode("`type: ${1.typeName()}`"); + Assert.That(output.Trim(), Is.EqualTo("type: Int32")); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/SendOneWayTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/SendOneWayTests.cs index 98608d9f953..46b5d7d8038 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/SendOneWayTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/SendOneWayTests.cs @@ -65,7 +65,7 @@ public override void Configure(Funq.Container container) OneWayServiceAppHostHttpListener appHost; private IRestClient client; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new OneWayServiceAppHostHttpListener(); @@ -76,7 +76,7 @@ public void OnTestFixtureSetUp() OneWayService.LastResult = null; } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); @@ -110,12 +110,11 @@ public static string GetResponse(String url, string json) var webRequest = (HttpWebRequest)WebRequest.Create(url); webRequest.Method = "PUT"; var formDataBytes = Encoding.UTF8.GetBytes(json); - webRequest.ContentLength = formDataBytes.Length; + webRequest.SetContentLength(formDataBytes.Length); webRequest.ContentType = "application/json"; - webRequest.GetRequestStream().Write(formDataBytes, 0, formDataBytes.Length); + PclExport.Instance.GetRequestStream(webRequest).Write(formDataBytes, 0, formDataBytes.Length); var webResponse = webRequest.GetResponse(); - return new StreamReader(webResponse.GetResponseStream()).ReadToEnd(); + return webResponse.GetResponseStream().ReadToEnd(); } - } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventIntegrationTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventIntegrationTests.cs new file mode 100644 index 00000000000..50738a53b43 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventIntegrationTests.cs @@ -0,0 +1,34 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Ignore("Requires SSE AppHost on"), TestFixture] //requires SSE AppHost on + public class ServerEventIntegrationTests + { + [Test] + public async Task Does_reconnect_when_remote_AppServer_restarts() + { + var client = new ServerEventsClient("http://localhost:11001", "home") + { + OnConnect = ctx => "OnConnect: {0}".Print(ctx.Channel), + OnCommand = msg => "OnCommand: {0}".Print(msg.Data), + OnException = ex => "OnException: {0}".Print(ex.Message), + OnMessage = msg => "OnMessage: {0}".Print(msg.Data), + OnHeartbeat = () => "OnHeartbeat".Print() + }; + + client.Handlers["chat"] = (source, msg) => + { + "Received Chat: {0}".Print(msg.Data); + }; + + await client.Connect(); + + await Task.Delay(TimeSpan.FromMinutes(10)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventTests.cs index a3681ba2114..1ec1da2117e 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventTests.cs @@ -5,6 +5,9 @@ using System.Threading; using System.Threading.Tasks; using Funq; +#if !NETCORE_SUPPORT +using MySql.Data.MySqlClient.Memcached; +#endif using NUnit.Framework; using ServiceStack.Auth; using ServiceStack.Configuration; @@ -46,7 +49,7 @@ public class PostRawToChannel : IReturnVoid } [Route("/channels/{Channel}/object")] - public class PostObjectToChannel + public class PostObjectToChannel : IReturnVoid { public string ToUserId { get; set; } public string Channel { get; set; } @@ -74,7 +77,7 @@ public class ServerEventsService : Service public IServerEvents ServerEvents { get; set; } - public object Any(PostChatToChannel request) + public async Task<object> Any(PostChatToChannel request) { var sub = ServerEvents.GetSubscriptionInfo(request.From); if (sub == null) @@ -96,18 +99,24 @@ public object Any(PostChatToChannel request) foreach (var toSub in toSubs) { msg.Message = "@{0}: {1}".Fmt(toSub.DisplayName, msg.Message); - ServerEvents.NotifySubscription(request.From, request.Selector, msg); + if (UseAsync) + await ServerEvents.NotifySubscriptionAsync(request.From, request.Selector, msg); + else + ServerEvents.NotifySubscription(request.From, request.Selector, msg); } } else { - ServerEvents.NotifyChannel(request.Channel, request.Selector, msg); + if (UseAsync) + await ServerEvents.NotifyChannelAsync(request.Channel, request.Selector, msg); + else + ServerEvents.NotifyChannel(request.Channel, request.Selector, msg); } return msg; } - public void Any(PostRawToChannel request) + public async Task Any(PostRawToChannel request) { var sub = ServerEvents.GetSubscriptionInfo(request.From); if (sub == null) @@ -115,29 +124,49 @@ public void Any(PostRawToChannel request) if (request.ToUserId != null) { - ServerEvents.NotifyUserId(request.ToUserId, request.Selector, request.Message); + if (UseAsync) + await ServerEvents.NotifyUserIdAsync(request.ToUserId, request.Selector, request.Message); + else + ServerEvents.NotifyUserId(request.ToUserId, request.Selector, request.Message); } else { - ServerEvents.NotifyChannel(request.Channel, request.Selector, request.Message); + if (UseAsync) + await ServerEvents.NotifyChannelAsync(request.Channel, request.Selector, request.Message); + else + ServerEvents.NotifyChannel(request.Channel, request.Selector, request.Message); } } - public void Any(PostObjectToChannel request) + public bool UseAsync => ((ServerEventsAppHost) HostContext.AppHost).UseAsync; + + public async Task Any(PostObjectToChannel request) { if (request.ToUserId != null) { if (request.CustomType != null) - ServerEvents.NotifyUserId(request.ToUserId, request.Selector ?? Selector.Id<CustomType>(), request.CustomType); + if (UseAsync) + await ServerEvents.NotifyUserIdAsync(request.ToUserId, request.Selector ?? Selector.Id<CustomType>(), request.CustomType); + else + ServerEvents.NotifyUserId(request.ToUserId, request.Selector ?? Selector.Id<CustomType>(), request.CustomType); if (request.SetterType != null) - ServerEvents.NotifyUserId(request.ToUserId, request.Selector ?? Selector.Id<SetterType>(), request.SetterType); + if (UseAsync) + await ServerEvents.NotifyUserIdAsync(request.ToUserId, request.Selector ?? Selector.Id<SetterType>(), request.SetterType); + else + ServerEvents.NotifyUserId(request.ToUserId, request.Selector ?? Selector.Id<SetterType>(), request.SetterType); } else { if (request.CustomType != null) - ServerEvents.NotifyChannel(request.Channel, request.Selector ?? Selector.Id<CustomType>(), request.CustomType); + if (UseAsync) + await ServerEvents.NotifyChannelAsync(request.Channel, request.Selector ?? Selector.Id<CustomType>(), request.CustomType); + else + ServerEvents.NotifyChannel(request.Channel, request.Selector ?? Selector.Id<CustomType>(), request.CustomType); if (request.SetterType != null) - ServerEvents.NotifyChannel(request.Channel, request.Selector ?? Selector.Id<SetterType>(), request.SetterType); + if (UseAsync) + await ServerEvents.NotifyChannelAsync(request.Channel, request.Selector ?? Selector.Id<SetterType>(), request.SetterType); + else + ServerEvents.NotifyChannel(request.Channel, request.Selector ?? Selector.Id<SetterType>(), request.SetterType); } } } @@ -147,14 +176,18 @@ public class ServerEventsAppHost : AppSelfHostBase public ServerEventsAppHost() : base(typeof(ServerEventsAppHost).Name, typeof(ServerEventsAppHost).Assembly) { } + public bool UseAsync { get; set; } public bool UseRedisServerEvents { get; set; } public bool LimitToAuthenticatedUsers { get; set; } + public Action<IEventSubscription, Web.IResponse, string> OnPublish { get; set; } public override void Configure(Container container) { - Plugins.Add(new ServerEventsFeature { + Plugins.Add(new ServerEventsFeature + { HeartbeatInterval = TimeSpan.FromMilliseconds(200), LimitToAuthenticatedUsers = LimitToAuthenticatedUsers, + OnPublish = OnPublish }); if (UseRedisServerEvents) @@ -169,7 +202,7 @@ public override void Configure(Container container) if (LimitToAuthenticatedUsers) { - Plugins.Add(new AuthFeature(() => new AuthUserSession(), + Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new CustomCredentialsAuthProvider(), })); @@ -184,8 +217,10 @@ public override bool TryAuthenticate(IServiceBase authService, string userName, return userName == "user" && password == "pass"; } } - - + +#if DEBUG + +// [Ignore("Can hang builds")] [TestFixture] public class MemoryServerEventsTests : ServerEventsTests { @@ -196,7 +231,20 @@ protected override ServiceStackHost CreateAppHost() .Start(Config.AbsoluteBaseUri); } } + + [Ignore("Can hang builds")] + [TestFixture] + public class MemoryServerEventsTestsAsync : ServerEventsTests + { + protected override ServiceStackHost CreateAppHost() + { + return new ServerEventsAppHost { UseAsync = true } + .Init() + .Start(Config.AbsoluteBaseUri); + } + } + [Ignore("Hangs in new build server")] [TestFixture] public class RedisServerEventsTests : ServerEventsTests { @@ -208,21 +256,36 @@ protected override ServiceStackHost CreateAppHost() } } + [Ignore("Hangs in new build server")] + [TestFixture] + public class RedisServerEventsTestsAsync : ServerEventsTests + { + protected override ServiceStackHost CreateAppHost() + { + return new ServerEventsAppHost { UseRedisServerEvents = true, UseAsync = true } + .Init() + .Start(Config.AbsoluteBaseUri); + } + } + public abstract class ServerEventsTests { private ServiceStackHost appHost; public ServerEventsTests() { - //LogManager.LogFactory = new ConsoleLogFactory(); + //LogManager.LogFactory = new ConsoleLogFactory(debugEnabled: true); appHost = CreateAppHost(); } protected abstract ServiceStackHost CreateAppHost(); - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { + if (appHost.Resolve<IServerEvents>() is RedisServerEvents redisEvents) + redisEvents.Dispose(); + appHost.Dispose(); } @@ -233,36 +296,37 @@ public void SetUp() serverEvents.Reset(); } - private static ServerEventsClient CreateServerEventsClient() + private static ServerEventsClient CreateServerEventsClient(params string[] channels) { - var client = new ServerEventsClient(Config.AbsoluteBaseUri); + var client = new ServerEventsClient(Config.AbsoluteBaseUri, channels); return client; } [Test] - public async void Can_connect_to_ServerEventsStream() + public async Task Can_connect_to_ServerEventsStream() { - using (var client = CreateServerEventsClient().Start()) + using (var client = CreateServerEventsClient()) { var task = client.Connect(); var connectMsg = await task.WaitAsync(); - Assert.That(connectMsg.HeartbeatUrl, Is.StringStarting(Config.AbsoluteBaseUri)); - Assert.That(connectMsg.UnRegisterUrl, Is.StringStarting(Config.AbsoluteBaseUri)); + Assert.That(connectMsg.HeartbeatUrl, Does.StartWith(Config.AbsoluteBaseUri)); + Assert.That(connectMsg.UnRegisterUrl, Does.StartWith(Config.AbsoluteBaseUri)); Assert.That(connectMsg.HeartbeatIntervalMs, Is.GreaterThan(0)); + Assert.That(connectMsg.IdleTimeoutMs, Is.EqualTo(TimeSpan.FromSeconds(30).TotalMilliseconds)); } } [Test] - public async void Does_fire_onJoin_events() + public async Task Does_fire_onJoin_events() { - using (var client = CreateServerEventsClient().Start()) + using (var client = CreateServerEventsClient()) { var taskConnect = client.Connect(); var taskMsg = client.WaitForNextCommand(); var connectMsg = await taskConnect.WaitAsync(); - Assert.That(connectMsg.HeartbeatUrl, Is.StringStarting(Config.AbsoluteBaseUri)); + Assert.That(connectMsg.HeartbeatUrl, Does.StartWith(Config.AbsoluteBaseUri)); var joinMsg = (ServerEventJoin)await taskMsg.WaitAsync(); Assert.That(joinMsg.DisplayName, Is.EqualTo(client.ConnectionInfo.DisplayName)); @@ -270,7 +334,69 @@ public async void Does_fire_onJoin_events() } [Test] - public async void Does_fire_all_callbacks() + public async Task Does_fire_onJoin_events_for_multiple_Channels() + { + var channels = new[] { "A", "B", "C" }; + using (var client = CreateServerEventsClient(channels)) + { + var joinMsgs = new List<ServerEventJoin>(); + var allJoinsReceived = new TaskCompletionSource<bool>(); + + client.OnJoin = msg => + { + joinMsgs.Add(msg); + if (joinMsgs.Count == channels.Length) + allJoinsReceived.SetResult(true); + }; + + var connectMsg = await client.Connect().WaitAsync(2000); + Assert.That(connectMsg.HeartbeatUrl, Does.StartWith(Config.AbsoluteBaseUri)); + + await allJoinsReceived.Task.WaitAsync(3000); + + Assert.That(joinMsgs.Count, Is.EqualTo(channels.Length)); + for (int i = 0; i < channels.Length; i++) + { + var joinMsg = joinMsgs[i]; + Assert.That(joinMsg.Channel, Is.EqualTo(channels[i])); + Assert.That(joinMsg.DisplayName, Is.EqualTo(client.ConnectionInfo.DisplayName)); + } + } + } + + [Test] + public async Task Does_not_fire_UnobservedTaskException() + { + var unobservedTaskException = false; + TaskScheduler.UnobservedTaskException += (s, e) => + { + unobservedTaskException = true; + }; + using (var client1 = CreateServerEventsClient()) + { + using (var connectedEvent = new ManualResetEvent(false)) + { + client1.OnConnect += e => { connectedEvent.Set(); }; + client1.Start(); + Assert.True(connectedEvent.WaitOne(TimeSpan.FromSeconds(10))); + } + + // Ensure that "stream.ReadAsync" is called + await Task.Delay(200); + } + + GC.Collect(); + GC.WaitForPendingFinalizers(); + + // collect finalized objects + GC.Collect(); + GC.WaitForPendingFinalizers(); + + Assert.IsFalse(unobservedTaskException); + } + + [Test] + public async Task Does_fire_all_callbacks() { using (var client1 = CreateServerEventsClient()) { @@ -280,7 +406,7 @@ public async void Does_fire_all_callbacks() var errors = new List<Exception>(); client1.OnConnect = e => connectMsg = e; - client1.OnCommand = commands.Add; + client1.OnCommand = e => commands.Add(e); client1.OnMessage = msgs.Add; client1.OnException = errors.Add; @@ -325,7 +451,7 @@ public async void Does_fire_all_callbacks() Assert.That(joinMsg, Is.Not.Null, "joinMsg == null"); //2nd connection Assert.That(leaveMsg, Is.Not.Null, "leaveMsg == null"); - Assert.That(commands.Count, Is.EqualTo(2)); //join + leave + Assert.That(commands.Count, Is.GreaterThanOrEqualTo(2)); //join + leave Assert.That(errors.Count, Is.EqualTo(0)); } } @@ -345,9 +471,8 @@ public async Task Does_receive_messages() await Task.WhenAll(client1.Connect(), client1.WaitForNextCommand()); //connect1 + join1 "client2.Connect()...".Print(); - await Task.WhenAll( - client2.Connect(), client2.WaitForNextCommand(), //connect2 + join2 - client1.WaitForNextCommand()); //join2 + var join1 = client1.WaitForNextCommand(); + await Task.WhenAll(client2.Connect(), client2.WaitForNextCommand(), join1); //connect2 + join2 + join1 "Waiting for Msg1...".Print(); var taskMsg1 = client1.WaitForNextMessage(); @@ -481,21 +606,20 @@ public async Task Does_reconnect_on_lost_connection() var msg1 = await msgTask.WaitAsync(); - msgTask = client1.WaitForNextMessage(); - serverEvents.Reset(); //Dispose all existing subscriptions using (var client2 = CreateServerEventsClient()) { await client2.Connect(); - await Task.WhenAny(client1.Connect(), Task.Delay(1000)); + await Task.WhenAny(client1.Connect(), Task.Delay(2000)); + msgTask = client1.WaitForNextMessage(); client2.PostChat("msg2 from client2"); } - "Waiting for 30s...".Print(); - var msg2 = await msgTask.WaitAsync(2000); + "Waiting for max 5s...".Print(); + var msg2 = await msgTask.WaitAsync(5000); var chatMsg2 = msg2.Json.FromJson<ChatMessage>(); @@ -598,7 +722,7 @@ public async Task Does_send_message_to_global_receiver() client1.Post(new CustomType { Id = 1, Name = "Foo" }); await msgTask.WaitAsync(); - var foo = TestGlobalReceiver.FooMethodReceived; + var foo = TestGlobalReceiver.CustomTypeReceived; Assert.That(foo, Is.Not.Null); Assert.That(foo.Id, Is.EqualTo(1)); Assert.That(foo.Name, Is.EqualTo("Foo")); @@ -618,7 +742,7 @@ public async Task Does_set_properties_on_global_receiver() client1.Post(new SetterType { Id = 1, Name = "Foo" }); await msgTask.WaitAsync(); - var foo = TestGlobalReceiver.AnyNamedSetterReceived; + var foo = TestGlobalReceiver.SetterTypeReceived; Assert.That(foo, Is.Not.Null); Assert.That(foo.Id, Is.EqualTo(1)); Assert.That(foo.Name, Is.EqualTo("Foo")); @@ -718,7 +842,7 @@ public async Task Can_use_IOC_to_autowire_Receivers() await client1.Connect(); var msgTask = client1.WaitForNextMessage(); - client1.Post(new CustomType { Id = 1, Name = "Foo" }); + client1.Post(new CustomType { Id = 1, Name = "Foo" }, "cmd.Custom"); await msgTask.WaitAsync(); var instance = (Dependency)container.Resolve<IDependency>(); @@ -728,7 +852,7 @@ public async Task Can_use_IOC_to_autowire_Receivers() Assert.That(customType.Name, Is.EqualTo("Foo")); msgTask = client1.WaitForNextMessage(); - client1.Post(new SetterType { Id = 2, Name = "Bar" }); + client1.Post(new SetterType { Id = 2, Name = "Bar" }, "cmd.Setter"); await msgTask.WaitAsync(); var setterType = instance.SetterTypeReceived; @@ -737,38 +861,517 @@ public async Task Can_use_IOC_to_autowire_Receivers() Assert.That(setterType.Name, Is.EqualTo("Bar")); } } + + [Test] + public async Task Does_receive_messages_on_to_clients_subscribed_on_multiple_channels() + { + using (var clientA = CreateServerEventsClient("A")) + using (var clientAB = CreateServerEventsClient("A", "B")) + using (var clientABC = CreateServerEventsClient("A", "B", "C")) + using (var clientABCD = CreateServerEventsClient("A", "B", "C", "D")) + { + var msgsA = new List<ServerEventMessage>(); + var msgsAB = new List<ServerEventMessage>(); + var msgsABC = new List<ServerEventMessage>(); + var msgsABCD = new List<ServerEventMessage>(); + + clientA.OnMessage = msgsA.Add; + clientAB.OnMessage = msgsAB.Add; + clientABC.OnMessage = msgsABC.Add; + clientABCD.OnMessage = msgsABCD.Add; + + await Task.WhenAll( + clientA.Connect(), + clientAB.Connect(), + clientABC.Connect(), + clientABCD.Connect() + ); + + var channelAsubscribers = clientA.GetChannelSubscribers(); + Assert.That(channelAsubscribers.Count, Is.EqualTo(4)); + + var channelABsubscribers = clientA.GetChannelSubscribers(); + Assert.That(channelABsubscribers.Count, Is.EqualTo(4)); + + "Publishing Msg Batch #1 ...".Print(); + clientA.PostChat("#1 hello to A", channel: "A"); + clientA.PostChat("#2 hello to B", channel: "B"); + clientA.PostChat("#3 hello to C", channel: "C"); + clientA.PostChat("#4 hello to D", channel: "D"); + + await Task.Delay(1000); + + "msgsA: {0}".Print(msgsA.Count); + "msgsAB: {0}".Print(msgsAB.Count); + "msgsABC: {0}".Print(msgsABC.Count); + "msgsABCD: {0}".Print(msgsABCD.Count); + + Assert.That(msgsA.Count, Is.EqualTo(1)); + Assert.That(msgsAB.Count, Is.EqualTo(2)); + Assert.That(msgsABC.Count, Is.EqualTo(3)); + Assert.That(msgsABCD.Count, Is.EqualTo(4)); + + await Task.Delay(1000); + + "Publishing Msg Batch #2 ...".Print(); + clientA.PostChat("#5 hello to A", channel: "A"); + clientA.PostChat("#6 hello to B", channel: "B"); + clientA.PostChat("#7 hello to C", channel: "C"); + clientA.PostChat("#8 hello to D", channel: "D"); + + await Task.Delay(1000); + + Assert.That(msgsA.Count, Is.EqualTo(2)); + Assert.That(msgsAB.Count, Is.EqualTo(4)); + Assert.That(msgsABC.Count, Is.EqualTo(6)); + Assert.That(msgsABCD.Count, Is.EqualTo(8)); + } + } + + [Test] + public async Task Does_receive_all_join_and_leave_messages() + { + var joinA = new List<ServerEventJoin>(); + var joinB = new List<ServerEventJoin>(); + var joinAB = new List<ServerEventJoin>(); + + var leaveA = new List<ServerEventLeave>(); + var leaveB = new List<ServerEventLeave>(); + var leaveAB = new List<ServerEventLeave>(); + + using (var clientA = CreateServerEventsClient("A")) + using (var clientB = CreateServerEventsClient("B")) + using (var clientAB = CreateServerEventsClient("A", "B")) + { + var joinARecieved = new TaskCompletionSource<bool>(); + var joinBRecieved = new TaskCompletionSource<bool>(); + var joinABRecieved = new TaskCompletionSource<bool>(); + + clientA.OnCommand = e => + { + if (e is ServerEventJoin) + { + joinA.Add((ServerEventJoin)e); + if (joinA.Count == 2) + joinARecieved.SetResult(true); + } + else if (e is ServerEventLeave) + leaveA.Add((ServerEventLeave)e); + }; + + clientB.OnCommand = e => + { + if (e is ServerEventJoin) + { + joinB.Add((ServerEventJoin)e); + if (joinB.Count == 2) + joinBRecieved.SetResult(true); + } + else if (e is ServerEventLeave) + leaveB.Add((ServerEventLeave)e); + }; + + clientAB.OnCommand = e => + { + if (e is ServerEventJoin) + { + joinAB.Add((ServerEventJoin)e); + if (joinAB.Count == 2) + joinABRecieved.SetResult(true); + } + else if (e is ServerEventLeave) + leaveAB.Add((ServerEventLeave)e); + }; + + await clientA.Connect(); + await clientB.Connect(); + await clientAB.Connect(); + + await Task.WhenAll(joinARecieved.Task, joinBRecieved.Task, joinABRecieved.Task); + + Assert.That(joinA.Count, Is.EqualTo(2)); //A + [(A) B] + Assert.That(joinB.Count, Is.EqualTo(2)); //B + [A (B)] + Assert.That(joinAB.Count, Is.EqualTo(2)); //[(A) B] + [A (B)] + + var channelAsubscribers = clientA.GetChannelSubscribers(); + Assert.That(channelAsubscribers.Count, Is.EqualTo(2)); + + var channelBsubscribers = clientB.GetChannelSubscribers(); + Assert.That(channelBsubscribers.Count, Is.EqualTo(2)); + + var channelABsubscribers = clientAB.GetChannelSubscribers(); + Assert.That(channelABsubscribers.Count, Is.EqualTo(3)); + + + var usersA = clientA.ServiceClient.Get(new GetEventSubscribers { Channels = new[] { "A" } }); + var usersB = clientA.ServiceClient.Get(new GetEventSubscribers { Channels = new[] { "B" } }); + var usersAB = clientA.ServiceClient.Get(new GetEventSubscribers { Channels = new[] { "A", "B" } }); + + Assert.That(usersA.Count, Is.EqualTo(2)); + Assert.That(usersB.Count, Is.EqualTo(2)); + Assert.That(usersAB.Count, Is.EqualTo(3)); + + await clientAB.Stop(); + await Task.Delay(100); + + await clientB.Stop(); + await clientA.Stop(); + + await Task.Delay(100); + + Assert.That(leaveA.Count, Is.EqualTo(1)); + Assert.That(leaveB.Count, Is.EqualTo(1)); + Assert.That(leaveAB.Count, Is.EqualTo(0)); + } + } + + [Test] + public async Task MultiChannel_Does_receive_all_join_and_leave_messages() + { + var joinA = new List<ServerEventJoin>(); + var joinB = new List<ServerEventJoin>(); + var joinAB = new List<ServerEventJoin>(); + + var leaveA = new List<ServerEventLeave>(); + var leaveB = new List<ServerEventLeave>(); + var leaveAB = new List<ServerEventLeave>(); + + using (var clientAB = CreateServerEventsClient("A", "B")) + using (var clientA = CreateServerEventsClient("A")) + using (var clientB = CreateServerEventsClient("B")) + { + var joinARecieved = new TaskCompletionSource<bool>(); + var joinBRecieved = new TaskCompletionSource<bool>(); + var joinABRecieved = new TaskCompletionSource<bool>(); + + clientA.OnCommand = e => + { + if (e is ServerEventJoin) + { + joinA.Add((ServerEventJoin)e); + if (joinA.Count == 1) + joinARecieved.SetResult(true); + } + else if (e is ServerEventLeave) + leaveA.Add((ServerEventLeave)e); + }; + + clientB.OnCommand = e => + { + if (e is ServerEventJoin) + { + joinB.Add((ServerEventJoin)e); + if (joinB.Count == 1) + joinBRecieved.SetResult(true); + } + else if (e is ServerEventLeave) + leaveB.Add((ServerEventLeave)e); + }; + + clientAB.OnCommand = e => + { + if (e is ServerEventJoin) + { + joinAB.Add((ServerEventJoin)e); + if (joinAB.Count == 4) + joinABRecieved.SetResult(true); + } + else if (e is ServerEventLeave) + leaveAB.Add((ServerEventLeave)e); + }; + + await clientAB.Connect(); + await clientA.Connect(); + await clientB.Connect(); + + await Task.WhenAll(joinARecieved.Task, joinBRecieved.Task, joinABRecieved.Task); + + Assert.That(joinAB.Count, Is.EqualTo(4)); //[(A) B] + [A (B)] + A + B + Assert.That(joinA.Count, Is.EqualTo(1)); //A + Assert.That(joinB.Count, Is.EqualTo(1)); //B + + await clientA.Stop(); + await clientB.Stop(); + + await Task.Delay(100); + await clientAB.Stop(); + + Assert.That(leaveAB.Count, Is.EqualTo(2)); + Assert.That(leaveA.Count, Is.EqualTo(0)); + Assert.That(leaveB.Count, Is.EqualTo(0)); + } + } + + [Test] + public async Task Can_subscribe_to_channels_whilst_connected() + { + var msgs1 = new List<ServerEventMessage>(); + var msgs2 = new List<ServerEventMessage>(); + + using (var client1 = CreateServerEventsClient("A")) + using (var client2 = CreateServerEventsClient("B")) + { + client1.OnMessage = msgs1.Add; + client2.OnMessage = msgs2.Add; + + await Task.WhenAll( + client1.Connect(), + client2.Connect() + ); + + Assert.That(client1.Channels, Is.EquivalentTo(new[] {"A" })); + + client2.PostChat("#1 hello to B", channel: "B"); + await Task.Delay(500); + + Assert.That(msgs1.Count, Is.EqualTo(0)); + Assert.That(msgs2.Count, Is.EqualTo(1)); + + await client1.SubscribeToChannelsAsync("B"); + await Task.Delay(500); + + client2.PostChat("#2 hello to B", channel: "B"); + client2.PostChat("#3 hello to C", channel: "C"); + await Task.Delay(500); + + Assert.That(msgs1.Count, Is.EqualTo(1)); + Assert.That(msgs2.Count, Is.EqualTo(2)); + + Assert.That(client1.Channels, Is.EquivalentTo(new[] { "A", "B" })); + Assert.That(client2.Channels, Is.EquivalentTo(new[] { "B" })); + + Assert.That(client1.EventStreamUri, Does.EndWith("?channels=A,B")); + Assert.That(client2.EventStreamUri, Does.EndWith("?channels=B")); + + await client1.SubscribeToChannelsAsync("C"); + await client2.SubscribeToChannelsAsync("C"); + await Task.Delay(500); + + client2.PostChat("#4 hello to C", channel: "C"); + await Task.Delay(500); + + Assert.That(msgs1.Count, Is.EqualTo(2)); + Assert.That(msgs2.Count, Is.EqualTo(3)); + + Assert.That(client1.Channels, Is.EquivalentTo(new[] { "A", "B", "C" })); + Assert.That(client2.Channels, Is.EquivalentTo(new[] { "B", "C" })); + + Assert.That(client1.EventStreamUri, Does.EndWith("?channels=A,B,C")); + Assert.That(client2.EventStreamUri, Does.EndWith("?channels=B,C")); + } + } + + [Test] + public async Task Can_unsubscribe_from_channels_whilst_connected() + { + var msgs1 = new List<ServerEventMessage>(); + var msgs2 = new List<ServerEventMessage>(); + + using (var client1 = CreateServerEventsClient("A","B","C")) + using (var client2 = CreateServerEventsClient("B","C")) + { + client1.OnMessage = msgs1.Add; + client2.OnMessage = msgs2.Add; + + await Task.WhenAll( + client1.Connect(), + client2.Connect() + ); + + Assert.That(client1.Channels, Is.EquivalentTo(new[] { "A","B","C" })); + + client2.PostChat("#1 hello to B", channel: "B"); + await Task.Delay(500); + + Assert.That(msgs1.Count, Is.EqualTo(1)); + Assert.That(msgs2.Count, Is.EqualTo(1)); + + await client1.UnsubscribeFromChannelsAsync("B"); + await Task.Delay(500); + + client2.PostChat("#2 hello to B", channel: "B"); + client2.PostChat("#3 hello to C", channel: "C"); + await Task.Delay(500); + + Assert.That(msgs1.Count, Is.EqualTo(2)); + Assert.That(msgs2.Count, Is.EqualTo(3)); + + Assert.That(client1.Channels, Is.EquivalentTo(new[] { "A", "C" })); + Assert.That(client2.Channels, Is.EquivalentTo(new[] { "B", "C" })); + + Assert.That(client1.EventStreamUri, Does.EndWith("?channels=A,C")); + Assert.That(client2.EventStreamUri, Does.EndWith("?channels=B,C")); + + await client1.UnsubscribeFromChannelsAsync("C"); + await client2.UnsubscribeFromChannelsAsync("C"); + await Task.Delay(500); + + client2.PostChat("#4 hello to C", channel: "C"); + await Task.Delay(500); + + Assert.That(msgs1.Count, Is.EqualTo(2)); + Assert.That(msgs2.Count, Is.EqualTo(3)); + + Assert.That(client1.Channels, Is.EquivalentTo(new[] { "A" })); + Assert.That(client2.Channels, Is.EquivalentTo(new[] { "B" })); + + Assert.That(client1.EventStreamUri, Does.EndWith("?channels=A")); + Assert.That(client2.EventStreamUri, Does.EndWith("?channels=B")); + } + } + + [Test] + public async Task Does_fire_multiple_listeners_for_custom_trigger() + { + var msgs1 = new List<ServerEventMessage>(); + var msgs2 = new List<ServerEventMessage>(); + + using (var client1 = CreateServerEventsClient()) + using (var client2 = CreateServerEventsClient()) + { + Action<ServerEventMessage> handler = msg => { + msgs1.Add(msg); + }; + + client1.AddListener("customEvent", handler); + client1.AddListener("customEvent", msg => { + msgs2.Add(msg); + }); + + await client1.Connect(); + await client2.Connect(); + + client2.PostRaw("trigger.customEvent", "arg"); + await Task.Delay(500); + + Assert.That(msgs1.Count, Is.EqualTo(1)); + Assert.That(msgs2.Count, Is.EqualTo(1)); + + client1.RemoveListener("customEvent", handler); + + client2.PostRaw("trigger.customEvent", "arg"); + await Task.Delay(500); + + Assert.That(msgs1.Count, Is.EqualTo(1)); + Assert.That(msgs2.Count, Is.EqualTo(2)); + + Assert.That(msgs1.All(x => x.Json.FromJson<string>() == "arg")); + Assert.That(msgs2.All(x => x.Json.FromJson<string>() == "arg")); + } + } + + } + + class Conf + { + public const string AbsoluteBaseUri = "http://127.0.0.1:10000/"; } [TestFixture] - public class AuthMemoryServerEventsTests + public class ServerEventConnectionTests { protected virtual ServiceStackHost CreateAppHost() { - return new ServerEventsAppHost { LimitToAuthenticatedUsers = true } + return new ServerEventsAppHost() .Init() - .Start(Config.AbsoluteBaseUri); + .Start(Conf.AbsoluteBaseUri); } private static ServerEventsClient CreateServerEventsClient() { - var client = new ServerEventsClient(Config.AbsoluteBaseUri); + var client = new ServerEventsClient(Conf.AbsoluteBaseUri); return client; } - private ServiceStackHost appHost; - - public AuthMemoryServerEventsTests() + private readonly ServiceStackHost appHost; + public ServerEventConnectionTests() { - //LogManager.LogFactory = new ConsoleLogFactory(); appHost = CreateAppHost(); } - [TestFixtureTearDown] - public void TestFixtureTearDown() + [OneTimeTearDown] + public void TestFixtureTearDown() => appHost.Dispose(); + + [Test] + public void Only_allows_one_Thread_through_at_a_time() { - appHost.Dispose(); + using (var client = CreateServerEventsClient()) + { + 10.Times(i => + { + ThreadPool.QueueUserWorkItem(_ => client.Start()); + }); + + Thread.Sleep(100); + Assert.That(client.TimesStarted, Is.EqualTo(1)); + + 10.Times(i => + { + ThreadPool.QueueUserWorkItem(_ => client.Restart()); + }); + Thread.Sleep(100); + Assert.That(client.TimesStarted, Is.EqualTo(2)); + + 10.Times(i => + { + ThreadPool.QueueUserWorkItem(_ => client.Stop()); + }); + Thread.Sleep(100); + Assert.That(client.TimesStarted, Is.EqualTo(2)); + + // A stopped client doesn't get restarted + 10.Times(i => + { + ThreadPool.QueueUserWorkItem(_ => client.Restart()); + }); + Thread.Sleep(100); + Assert.That(client.TimesStarted, Is.EqualTo(2)); + + // Can restart a stopped client + 10.Times(i => + { + ThreadPool.QueueUserWorkItem(_ => client.Start()); + }); + + //.NET Core can have long delay + var wait = 10; + while (wait++ < 50) + { + if (client.TimesStarted == 3) + break; + Thread.Sleep(100); + } + + Assert.That(client.TimesStarted, Is.EqualTo(3)); + } + } + } + + [TestFixture] + public class AuthMemoryServerEventsTests + { + protected virtual ServiceStackHost CreateAppHost() + { + return new ServerEventsAppHost { LimitToAuthenticatedUsers = true } + .Init() + .Start(Conf.AbsoluteBaseUri); + } + + private static ServerEventsClient CreateServerEventsClient() + { + var client = new ServerEventsClient(Conf.AbsoluteBaseUri); + return client; + } + + private readonly ServiceStackHost appHost; + public AuthMemoryServerEventsTests() + { + appHost = CreateAppHost(); } + [OneTimeTearDown] + public void TestFixtureTearDown() => appHost.Dispose(); + [SetUp] public void SetUp() { @@ -798,7 +1401,8 @@ public async Task Can_send_and_receive_messages_with_Authenticated_user() { using (var client = CreateServerEventsClient()) { - await client.AuthenticateAsync(new Authenticate { + await client.AuthenticateAsync(new Authenticate + { provider = CustomCredentialsAuthProvider.Name, UserName = "user", Password = "pass", @@ -807,7 +1411,7 @@ await client.AuthenticateAsync(new Authenticate { await client.Connect(); ChatMessage chatMsg = null; - client.Handlers["chat"] = (c, msg) => + client.Handlers["chat"] = (c, msg) => { chatMsg = msg.Json.FromJson<ChatMessage>(); }; @@ -827,6 +1431,30 @@ await client.AuthenticateAsync(new Authenticate { Assert.That(chatMsg.Message, Is.EqualTo("msg2")); } } + + [Test] + public async Task Channels_updated_after_Restart() + { + using (var client = new ServerEventsClient(Conf.AbsoluteBaseUri, "home")) + { + Assert.That(client.EventStreamUri.EndsWith("home")); + + await client.AuthenticateAsync(new Authenticate + { + provider = CustomCredentialsAuthProvider.Name, + UserName = "user", + Password = "pass", + }); + + client.Start(); + client.Channels = new[] {"Foo", "Bar"}; + client.Restart(); + + Thread.Sleep(10); // Wait for SleepBackOffMultiplier to continue + + Assert.That(client.EventStreamUri.EndsWith("Foo,Bar")); + } + } } @@ -864,20 +1492,20 @@ public override void NoSuchMethod(string selector, object message) public class TestGlobalReceiver : ServerEventReceiver { - public static CustomType FooMethodReceived; + public static CustomType CustomTypeReceived; public static CustomType NoSuchMethodReceived; public static string NoSuchMethodSelector; - internal static SetterType AnyNamedSetterReceived; + internal static SetterType SetterTypeReceived; - public SetterType AnyNamedSetter + public SetterType SetterType { - set { AnyNamedSetterReceived = value; } + set { SetterTypeReceived = value; } } - public void AnyNamedMethod(CustomType request) + public void CustomType(CustomType request) { - FooMethodReceived = request; + CustomTypeReceived = request; } public override void NoSuchMethod(string selector, object message) @@ -909,9 +1537,9 @@ public void Announce(string message) AnnounceInstance = message; } - public void Toggle(string message) + public void Toggle() { - ToggleReceived = message; + ToggleReceived = ""; ToggleRequestReceived = Request; } @@ -963,12 +1591,12 @@ public class TestContainerReceiver : ServerEventReceiver { public IDependency Dependency { get; set; } - public void AnyNamedMethod(CustomType request) + public void Custom(CustomType request) { Dependency.Record(request); } - public void AnySetter(SetterType request) + public void Setter(SetterType request) { Dependency.Record(request); } @@ -979,11 +1607,17 @@ public static class ServerClientExtensions public static void PostChat(this ServerEventsClient client, string message, string channel = null) { - client.ServiceClient.Post(new PostChatToChannel + client.ServiceClient.PostChat(client.SubscriptionId, message, channel); + } + + public static void PostChat(this IServiceClient client, string subsciptionId, + string message, string channel = null) + { + client.Post(new PostChatToChannel { - From = client.SubscriptionId, + From = subsciptionId, Message = message, - Channel = channel ?? EventSubscription.UnknownChannel, + Channel = channel ?? EventSubscription.UnknownChannel[0], Selector = "cmd.chat", }); } @@ -994,7 +1628,7 @@ public static void PostRaw(this ServerEventsClient client, string selector, stri { From = client.SubscriptionId, Message = message, - Channel = channel ?? EventSubscription.UnknownChannel, + Channel = channel ?? EventSubscription.UnknownChannel[0], Selector = selector, }); } @@ -1005,7 +1639,7 @@ public static void Post(this ServerEventsClient client, client.ServiceClient.Post(new PostObjectToChannel { CustomType = message, - Channel = channel ?? EventSubscription.UnknownChannel, + Channel = channel ?? EventSubscription.UnknownChannel[0], Selector = selector, }); } @@ -1016,7 +1650,7 @@ public static void Post(this ServerEventsClient client, client.ServiceClient.Post(new PostObjectToChannel { SetterType = message, - Channel = channel ?? EventSubscription.UnknownChannel, + Channel = channel ?? EventSubscription.UnknownChannel[0], Selector = selector, }); } @@ -1028,5 +1662,7 @@ public static async Task<T> WaitAsync<T>(this Task<T> task, int timeMs = 1000) return await task; } - } + } +#endif + } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventsErrorHandlingTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventsErrorHandlingTests.cs new file mode 100644 index 00000000000..b083cae23ad --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventsErrorHandlingTests.cs @@ -0,0 +1,44 @@ +using System; +using System.Net; +using System.Threading.Tasks; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class ServerEventsErrorHandlingTests + { + private readonly ServiceStackHost appHost; + + public ServerEventsErrorHandlingTests() + { + appHost = new ServerEventsAppHost() + .Init() + .Start(Config.AbsoluteBaseUri);; + + appHost.GetPlugin<ServerEventsFeature>().OnInit = req => + throw new Exception("Always throws"); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public async Task Does_dispose_SSE_Connection_when_Exception_in_OnInit_handler() + { + ServerEventsClient client = null; + using (client = new ServerEventsClient(Config.AbsoluteBaseUri) { + // OnException = e => client.Dispose() + }) + { + try + { + await client.Connect(); + } + catch (WebException e) + { + Assert.That(e.GetStatus(), Is.EqualTo(HttpStatusCode.InternalServerError)); + } + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientResolverTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientResolverTests.cs new file mode 100644 index 00000000000..0c0e2ae4ef3 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientResolverTests.cs @@ -0,0 +1,128 @@ +using System.Threading.Tasks; +using NUnit.Framework; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Route("/test")] + public class DummyRequest : IReturn<MockResponse> { } + + public class DummyFallback : IReturn<MockResponse> { } + + [Route("/testsend")] + public class DummySendGet : IReturn<MockResponse>, IGet { } + + public class MockResponse + { + public string Url { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class JsonServiceClientResolverTests : ServiceClientResolverTestsBase + { + protected override IServiceClient CreateClient(string baseUrl, UrlResolverDelegate urlResolver = null, + TypedUrlResolverDelegate typedUrlResolver = null) + { + return new JsonServiceClient(baseUrl) + { + UrlResolver = urlResolver, + TypedUrlResolver = typedUrlResolver, + ResultsFilter = (type, method, uri, request) => + new MockResponse { Url = uri } + }; + } + } + + public class JsonHttpClientResolverTests : ServiceClientResolverTestsBase + { + protected override IServiceClient CreateClient(string baseUrl, UrlResolverDelegate urlResolver = null, + TypedUrlResolverDelegate typedUrlResolver = null) + { + return new JsonHttpClient(baseUrl) + { + UrlResolver = urlResolver, + TypedUrlResolver = typedUrlResolver, + ResultsFilter = (type, method, uri, request) => + new MockResponse { Url = uri } + }; + } + } + + public abstract class ServiceClientResolverTestsBase + { + protected abstract IServiceClient CreateClient(string baseUrl, + UrlResolverDelegate urlResolver = null, TypedUrlResolverDelegate typedUrlResolver = null); + + [Test] + public void Can_Change_RawUrls_with_UrlResolver() + { + var client = CreateClient("http://example.org/api", urlResolver: + (meta, httpMethod, url) => meta.BaseUri.Replace("example.org", "111.111.111.111").CombineWith(url)); + + var response = client.Get<MockResponse>("/dummy"); + Assert.That(response.Url, Is.EqualTo("http://111.111.111.111/api/dummy")); + + response = client.Post<MockResponse>("/dummy", new DummyRequest()); + Assert.That(response.Url, Is.EqualTo("http://111.111.111.111/api/dummy")); + + response = client.Send(new DummyRequest()); + Assert.That(response.Url, Is.EqualTo("http://111.111.111.111/api/json/reply/DummyRequest")); + } + + [Test] + public async Task Can_Change_RawUrls_with_UrlResolver_Async() + { + var client = CreateClient("http://example.org/api", urlResolver: + (meta, httpMethod, url) => meta.BaseUri.Replace("example.org", "111.111.111.111").CombineWith(url)); + + var response = await client.DeleteAsync<MockResponse>("/dummy"); + Assert.That(response.Url, Is.EqualTo("http://111.111.111.111/api/dummy")); + + response = await client.PutAsync<MockResponse>("/dummy", new DummyRequest()); + Assert.That(response.Url, Is.EqualTo("http://111.111.111.111/api/dummy")); + + response = await client.SendAsync(new DummyRequest()); + Assert.That(response.Url, Is.EqualTo("http://111.111.111.111/api/json/reply/DummyRequest")); + } + + [Test] + public void Can_Change_Typed_Urls_with_TypedUrlResolver() + { + var client = CreateClient("http://example.org/api", typedUrlResolver: + (meta, httpMethod, dto) => meta.BaseUri.Replace("example.org", dto.GetType().Name.ToLower() + ".example.org") + .CombineWith(dto.ToUrl(httpMethod, meta.Format))); + + var response = client.Get(new DummyRequest()); + Assert.That(response.Url, Is.EqualTo("http://dummyrequest.example.org/api/test")); + + response = client.Send(new DummySendGet()); + Assert.That(response.Url, Is.EqualTo("http://dummysendget.example.org/api/testsend")); + + response = client.Get(new DummyFallback()); + Assert.That(response.Url, Is.EqualTo("http://dummyfallback.example.org/api/json/reply/DummyFallback")); + + response = client.Post(new DummyRequest()); + Assert.That(response.Url, Is.EqualTo("http://dummyrequest.example.org/api/test")); + } + + [Test] + public async Task Can_Change_Typed_Urls_with_TypedUrlResolver_Async() + { + var client = CreateClient("http://example.org/api", typedUrlResolver: + (meta, httpMethod, dto) => meta.BaseUri.Replace("example.org", dto.GetType().Name.ToLower() + ".example.org") + .CombineWith(dto.ToUrl(httpMethod, meta.Format))); + + var response = await client.DeleteAsync(new DummyRequest()); + Assert.That(response.Url, Is.EqualTo("http://dummyrequest.example.org/api/test")); + + response = await client.SendAsync(new DummySendGet()); + Assert.That(response.Url, Is.EqualTo("http://dummysendget.example.org/api/testsend")); + + response = await client.DeleteAsync(new DummyFallback()); + Assert.That(response.Url, Is.EqualTo("http://dummyfallback.example.org/api/json/reply/DummyFallback")); + + response = await client.PutAsync(new DummyRequest()); + Assert.That(response.Url, Is.EqualTo("http://dummyrequest.example.org/api/test")); + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientSendBodyTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientSendBodyTests.cs new file mode 100644 index 00000000000..3299100c66c --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientSendBodyTests.cs @@ -0,0 +1,212 @@ +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Route("/sendjson")] + public class SendJson : IRequiresRequestStream, IReturn<string> + { + public int Id { get; set; } + public string Name { get; set; } + + public Stream RequestStream { get; set; } + } + + [Route("/sendtext")] + public class SendText : IRequiresRequestStream, IReturn<string> + { + public int Id { get; set; } + + public string Name { get; set; } + + public string ContentType { get; set; } + + public Stream RequestStream { get; set; } + } + + [Route("/sendraw")] + public class SendRaw : IRequiresRequestStream, IReturn<byte[]> + { + public int Id { get; set; } + + public string Name { get; set; } + + public string ContentType { get; set; } + + public Stream RequestStream { get; set; } + } + + public class SendRawService : Service + { + [JsonOnly] + public object Any(SendJson request) + { + base.Response.AddHeader("X-Args", $"{request.Id},{request.Name}"); + + return request.RequestStream.ReadFully(); + } + + public object Any(SendText request) + { + base.Response.AddHeader("X-Args", $"{request.Id},{request.Name}"); + + base.Request.ResponseContentType = request.ContentType ?? base.Request.AcceptTypes[0]; + return request.RequestStream.ReadFully(); + } + + public object Any(SendRaw request) + { + base.Response.AddHeader("X-Args", $"{request.Id},{request.Name}"); + + base.Request.ResponseContentType = request.ContentType ?? base.Request.AcceptTypes[0]; + return request.RequestStream.ReadFully(); + } + } + + public class TestBody + { + public string Foo { get; set; } + } + + public class JsonServiceClientSendBodyTests : ServiceClientSendBodyTests + { + public override IServiceClient CreateClient() + { + return new JsonServiceClient(Config.ListeningOn); + } + } + + public class JsonHttpClientSendBodyTests : ServiceClientSendBodyTests + { + public override IServiceClient CreateClient() + { + return new JsonHttpClient(Config.ListeningOn); + } + } + + public abstract class ServiceClientSendBodyTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ServiceClientSendBodyTests), typeof(SendRawService).Assembly) {} + + public override void Configure(Container container) + { + } + } + + private readonly ServiceStackHost appHost; + + protected ServiceClientSendBodyTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + + public abstract IServiceClient CreateClient(); + + public SendJson CreateSendJson(IServiceClient client) + { + if (client is ServiceClientBase scb) + { + scb.ResponseFilter = res => Assert.That(res.Headers["X-Args"], Is.EqualTo("1,name")); + } + else if (client is JsonHttpClient jhc) + { + jhc.ResponseFilter = res => Assert.That(res.Headers.GetValues("X-Args").FirstOrDefault(), Is.EqualTo("1,name")); + } + + return new SendJson + { + Id = 1, + Name = "name", + }; + } + + public SendText CreateSendText(IServiceClient client) + { + if (client is ServiceClientBase scb) + { + scb.ResponseFilter = res => Assert.That(res.Headers["X-Args"], Is.EqualTo("1,name")); + } + else if (client is JsonHttpClient jhc) + { + jhc.ResponseFilter = res => Assert.That(res.Headers.GetValues("X-Args").FirstOrDefault(), Is.EqualTo("1,name")); + } + + return new SendText + { + Id = 1, + Name = "name", + ContentType = "text/plain" + }; + } + + [Test] + public void Can_SendBody() + { + var client = CreateClient(); + var toRequest = CreateSendJson(client); + + var body = new TestBody { Foo = "Bar" }; + + var json = client.PostBody(toRequest, body); + Assert.That(json.FromJson<TestBody>().Foo, Is.EqualTo("Bar")); + + json = client.PutBody(toRequest, body.ToJson()); + Assert.That(json.FromJson<TestBody>().Foo, Is.EqualTo("Bar")); + + json = client.PatchBody(toRequest, MemoryStreamFactory.GetStream(body.ToJson().ToUtf8Bytes())); + Assert.That(json.FromJson<TestBody>().Foo, Is.EqualTo("Bar")); + } + + [Test] + public async Task Can_SendBody_Async() + { + var client = CreateClient(); + var toRequest = CreateSendJson(client); + + var body = new TestBody { Foo = "Bar" }; + + var json = await client.PostBodyAsync(toRequest, body); + Assert.That(json.FromJson<TestBody>().Foo, Is.EqualTo("Bar")); + + json = await client.PutBodyAsync(toRequest, body.ToJson()); + Assert.That(json.FromJson<TestBody>().Foo, Is.EqualTo("Bar")); + + json = await client.PatchBodyAsync(toRequest, MemoryStreamFactory.GetStream(body.ToJson().ToUtf8Bytes())); + Assert.That(json.FromJson<TestBody>().Foo, Is.EqualTo("Bar")); + } + + [Test] + public void Can_SendBody_Raw_String() + { + var client = CreateClient(); + var toRequest = CreateSendText(client); + + var str = client.PutBody(toRequest, "foo"); + Assert.That(str, Is.EqualTo("foo")); + } + + [Test] + public async Task Can_SendBody_Raw_String_Async() + { + var client = CreateClient(); + var toRequest = CreateSendText(client); + + var str = await client.PutBodyAsync(toRequest, "foo"); + Assert.That(str, Is.EqualTo("foo")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientTests.cs index ae7cad3526f..4dc6ca00aa5 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientTests.cs @@ -1,15 +1,181 @@ +using System.Collections.Generic; +using System.IO; using System.Net; +using System.Net.Http; +using System.Threading; using System.Threading.Tasks; using NUnit.Framework; +using ServiceStack.Text; using ServiceStack.WebHost.Endpoints.Tests.Support; using ServiceStack.WebHost.Endpoints.Tests.Support.Host; using ServiceStack.WebHost.Endpoints.Tests.Support.Operations; using ServiceStack.WebHost.Endpoints.Tests.Support.Services; +using ServiceStack.WebHost.Endpoints.Tests.Support.Types; namespace ServiceStack.WebHost.Endpoints.Tests { [TestFixture] - public class ServiceClientTests + public class JsonServiceClientTests : ServiceClientTests + { + public override IServiceClient GetClient() + { + return new JsonServiceClient(BaseUrl); + } + + [Test] + public void Does_allow_sending_Cached_Response() + { + var cache = new Dictionary<string, object>(); + var client = (JsonServiceClient)GetClient(); + + client.ResultsFilter = (type, method, uri, request) => + { + var cacheKey = "{0} {1}".Fmt(method, uri); + Assert.That(cacheKey, Is.EqualTo("GET {0}json/reply/GetCustomer?customerId=5".Fmt(client.BaseUri))); + object entry; + cache.TryGetValue(cacheKey, out entry); + return entry; + }; + client.ResultsFilterResponse = (webRes, res, method, uri, request) => + { + Assert.That(webRes, Is.Not.Null); + var cacheKey = "{0} {1}".Fmt(method, uri); + cache[cacheKey] = res; + }; + + var response1 = client.Get(new GetCustomer { CustomerId = 5 }); + var response2 = client.Get(new GetCustomer { CustomerId = 5 }); + Assert.That(response1.Created, Is.EqualTo(response2.Created)); + } + + [Test] + public async Task Does_allow_sending_Cached_Response_Async() + { + var cache = new Dictionary<string, object>(); + var client = (JsonServiceClient)GetClient(); + + client.ResultsFilter = (type, method, uri, request) => + { + var cacheKey = "{0} {1}".Fmt(method, uri); + Assert.That(cacheKey, Is.EqualTo("GET {0}json/reply/GetCustomer?customerId=5".Fmt(client.BaseUri))); + object entry; + cache.TryGetValue(cacheKey, out entry); + return entry; + }; + client.ResultsFilterResponse = (webRes, res, method, uri, request) => + { + Assert.That(webRes, Is.Not.Null); + var cacheKey = "{0} {1}".Fmt(method, uri); + cache[cacheKey] = res; + }; + + var response1 = await client.GetAsync(new GetCustomer { CustomerId = 5 }); + var response2 = await client.GetAsync(new GetCustomer { CustomerId = 5 }); + Assert.That(response1.Created, Is.EqualTo(response2.Created)); + } + + [Test] + public async Task Does_add_HttpHeaders_in_RequestFilter_for_Get_Async() + { + var client = (JsonServiceClient)GetClient(); + client.RequestFilter = req => req.Headers["Foo"] = "Bar"; + + var response = await client.GetAsync(new EchoRequestInfo()); + + Assert.That(response.Headers["Foo"], Is.EqualTo("Bar")); + } + } + + [TestFixture] + public class JsonHttpClientTests : ServiceClientTests + { + public override IServiceClient GetClient() + { + return new JsonHttpClient(BaseUrl); + } + + [Test] + public void Does_allow_sending_Cached_Response() + { + var cache = new Dictionary<string, object>(); + var client = (JsonHttpClient)GetClient(); + + client.ResultsFilter = (type, method, uri, request) => + { + var cacheKey = "{0} {1}".Fmt(method, uri); + Assert.That(cacheKey, Is.EqualTo("GET {0}json/reply/GetCustomer?customerId=5".Fmt(client.BaseUri))); + object entry; + cache.TryGetValue(cacheKey, out entry); + return entry; + }; + client.ResultsFilterResponse = (webRes, res, method, uri, request) => + { + Assert.That(webRes, Is.Not.Null); + var cacheKey = "{0} {1}".Fmt(method, uri); + cache[cacheKey] = res; + }; + + var response1 = client.Get(new GetCustomer { CustomerId = 5 }); + var response2 = client.Get(new GetCustomer { CustomerId = 5 }); + Assert.That(response1.Created, Is.EqualTo(response2.Created)); + } + + [Test] + public async Task Does_allow_sending_Cached_Response_Async() + { + var cache = new Dictionary<string, object>(); + var client = (JsonHttpClient)GetClient(); + + client.ResultsFilter = (type, method, uri, request) => + { + var cacheKey = "{0} {1}".Fmt(method, uri); + Assert.That(cacheKey, Is.EqualTo("GET {0}json/reply/GetCustomer?customerId=5".Fmt(client.BaseUri))); + object entry; + cache.TryGetValue(cacheKey, out entry); + return entry; + }; + client.ResultsFilterResponse = (webRes, res, method, uri, request) => + { + Assert.That(webRes, Is.Not.Null); + var cacheKey = "{0} {1}".Fmt(method, uri); + cache[cacheKey] = res; + }; + + var response1 = await client.GetAsync(new GetCustomer { CustomerId = 5 }); + var response2 = await client.GetAsync(new GetCustomer { CustomerId = 5 }); + Assert.That(response1.Created, Is.EqualTo(response2.Created)); + } + + [Test] + public async Task Does_add_HttpHeaders_in_RequestFilter_for_Get_Async() + { + var client = (JsonHttpClient)GetClient(); + client.RequestFilter = req => req.Headers.Add("Foo", "Bar"); + + var response = await client.GetAsync(new EchoRequestInfo()); + + Assert.That(response.Headers["Foo"], Is.EqualTo("Bar")); + } + + [Test] + public async Task Doesnt_dispose_injected_handler() + { + var handler = new HttpClientHandler(); + + var client1 = (JsonHttpClient)GetClient(); + client1.HttpMessageHandler = handler; + await client1.GetAsync(new GetCustomer { CustomerId = 5 }); + client1.Dispose(); + + var client2 = (JsonHttpClient)GetClient(); + client2.HttpMessageHandler = handler; + var response = await client2.GetAsync(new GetCustomer { CustomerId = 5 }); + + Assert.That(response, Is.Not.Null); + } + } + + public abstract class ServiceClientTests : ServiceClientTestBase { /// <summary> @@ -21,12 +187,13 @@ public override AppHostHttpListenerBase CreateListener() return new TestAppHostHttpListener(); } - private JsonServiceClient client; + private IServiceClient client; + public abstract IServiceClient GetClient(); [SetUp] public void SetUp() { - client = new JsonServiceClient(BaseUrl); + client = GetClient(); } [Test] @@ -41,7 +208,7 @@ public void Can_GetCustomers() [Test] public void Does_add_HttpHeaders_for_Get_Sync() { - client.Headers.Add("Foo", "Bar"); + client.AddHeader("Foo", "Bar"); var response = client.Get(new EchoRequestInfo()); @@ -51,7 +218,7 @@ public void Does_add_HttpHeaders_for_Get_Sync() [Test] public async Task Does_add_HttpHeaders_for_Get_Async() { - client.Headers.Add("Foo", "Bar"); + client.AddHeader("Foo", "Bar"); var response = await client.GetAsync(new EchoRequestInfo()); @@ -59,11 +226,11 @@ public async Task Does_add_HttpHeaders_for_Get_Async() } [Test] - public async Task Does_add_HttpHeaders_in_RequestFilter_for_Get_Async() + public async Task Does_add_HttpHeaders_for_Post_Async() { - client.RequestFilter = req => req.Headers.Add("Foo", "Bar"); + client.AddHeader("Foo", "Bar"); - var response = await client.GetAsync(new EchoRequestInfo()); + var response = await client.PostAsync(new EchoRequestInfo()); Assert.That(response.Headers["Foo"], Is.EqualTo("Bar")); } @@ -93,6 +260,181 @@ public async Task Can_call_return_HttpWebResponse() using (client.Post<HttpWebResponse>(new ReturnsWebResponse { Message = "Bar" })) { } Assert.That(TestAsyncService.ReturnWebResponseMessage, Is.EqualTo("Bar")); } + + [Test] + public void Can_post_raw_response_as_raw_JSON() + { + var request = new GetCustomer { CustomerId = 5 }; + var response = client.Post(request); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + + var requestPath = request.ToPostUrl(); + + string json = request.ToJson(); + response = client.Post<GetCustomerResponse>(requestPath, json); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + + byte[] bytes = json.ToUtf8Bytes(); + response = client.Put<GetCustomerResponse>(requestPath, bytes); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + + Stream ms = bytes.InMemoryStream(); + response = client.Post<GetCustomerResponse>(requestPath, ms); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + } + + [Test] + public async Task Can_post_raw_response_as_raw_JSON_async() + { + var request = new GetCustomer { CustomerId = 5 }; + var response = client.Post(request); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + + var requestPath = request.ToPostUrl(); + + string json = request.ToJson(); + response = await client.PostAsync<GetCustomerResponse>(requestPath, json); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + + byte[] bytes = json.ToUtf8Bytes(); + response = await client.PutAsync<GetCustomerResponse>(requestPath, bytes); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + + Stream ms = bytes.InMemoryStream(); + response = await client.PostAsync<GetCustomerResponse>(requestPath, ms); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + } + + [Test] + public async Task Can_post_raw_response_as_raw_JSON_HttpClient() + { + var httpClient = new JsonHttpClient(BaseUrl); + var request = new GetCustomer { CustomerId = 5 }; + var response = httpClient.Post(request); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + + var requestPath = request.ToPostUrl(); + + string json = request.ToJson(); + response = await httpClient.PostAsync<GetCustomerResponse>(requestPath, json); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + + byte[] bytes = json.ToUtf8Bytes(); + response = await httpClient.PutAsync<GetCustomerResponse>(requestPath, bytes); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + + Stream ms = bytes.InMemoryStream(); + response = await httpClient.PostAsync<GetCustomerResponse>(requestPath, ms); + Assert.That(response.Customer.Id, Is.EqualTo(5)); + } + + [Test] + public void Can_WaitAsync() + { + var called = 0; + + PclExportClient.Instance.WaitAsync(100) + .ContinueWith(_ => + { + called++; + }); + + Thread.Sleep(200); + Assert.That(called, Is.EqualTo(1)); + } + } + + public class JsonServiceClientSendInterfaceTests : SendInterfaceTests + { + protected override IServiceClient CreateClient() + { + return new JsonServiceClient(BaseUrl); + } + } + + public class JsonHttpClientSendInterfaceTests : SendInterfaceTests + { + protected override IServiceClient CreateClient() + { + return new JsonHttpClient(BaseUrl); + } + } + + public abstract class SendInterfaceTests + : ServiceClientTestBase + { + /// <summary> + /// These tests require admin privillages + /// </summary> + /// <returns></returns> + public override AppHostHttpListenerBase CreateListener() + { + return new TestAppHostHttpListener(); + } + + private IServiceClient client; + + protected abstract IServiceClient CreateClient(); + + [SetUp] + public void SetUp() + { + client = CreateClient(); + } + + [Test] + public void Does_SendDefault_as_POST() + { + var response = client.Send(new SendDefault { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + Assert.That(response.RequestMethod, Is.EqualTo(HttpMethods.Post)); + Assert.That(response.PathInfo, Is.EqualTo("/json/reply/SendDefault")); + } + + [Test] + public void Does_SendRestGet_as_GET() + { + var response = client.Send(new SendRestGet { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + Assert.That(response.RequestMethod, Is.EqualTo(HttpMethods.Get)); + Assert.That(response.PathInfo, Is.EqualTo("/sendrestget/1")); + } + + [Test] + public async Task Does_SendRestGet_as_GET_Async() + { + var response = await client.SendAsync(new SendRestGet { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + Assert.That(response.RequestMethod, Is.EqualTo(HttpMethods.Get)); + Assert.That(response.PathInfo, Is.EqualTo("/sendrestget/1")); + } + + [Test] + public void Does_SendGet_as_GET() + { + var response = client.Send(new SendGet { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + Assert.That(response.RequestMethod, Is.EqualTo(HttpMethods.Get)); + Assert.That(response.PathInfo, Is.EqualTo("/json/reply/SendGet")); + } + + [Test] + public void Does_SendPost_as_POST() + { + var response = client.Send(new SendPost { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + Assert.That(response.RequestMethod, Is.EqualTo(HttpMethods.Post)); + Assert.That(response.PathInfo, Is.EqualTo("/json/reply/SendPost")); + } + + [Test] + public void Does_SendPut_as_PUT() + { + var response = client.Send(new SendPut { Id = 1 }); + Assert.That(response.Id, Is.EqualTo(1)); + Assert.That(response.RequestMethod, Is.EqualTo(HttpMethods.Put)); + Assert.That(response.PathInfo, Is.EqualTo("/json/reply/SendPut")); + } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientsBuiltInResponseTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientsBuiltInResponseTests.cs index bd1f730ebab..6c4fdb8dbfb 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientsBuiltInResponseTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceClientsBuiltInResponseTests.cs @@ -2,6 +2,7 @@ using System.IO; using System.Linq; using System.Net; +using System.Threading; using System.Threading.Tasks; using Funq; using NUnit.Framework; @@ -40,6 +41,12 @@ public class Bytes : IReturn<byte[]> public string Text { get; set; } } + [Route("/bytes-streams/{Text}")] + public class BytesAsStreams : IReturn<Stream> + { + public string Text { get; set; } + } + [Route("/streams/{Text}")] public class Streams : IReturn<Stream> { @@ -74,18 +81,26 @@ public byte[] Any(Bytes request) return new Guid(request.Text).ToByteArray(); } - public byte[] Any(Streams request) + public byte[] Any(BytesAsStreams request) { return new Guid(request.Text).ToByteArray(); } - public IStreamWriter Any(StreamWriters request) + public Stream Any(Streams request) + { + var bytes = new Guid(request.Text).ToByteArray(); + var ms = new MemoryStream(); + ms.Write(bytes, 0, bytes.Length); + return ms; + } + + public IStreamWriterAsync Any(StreamWriters request) { return new StreamWriterResult(new Guid(request.Text).ToByteArray()); } } - public class StreamWriterResult : IStreamWriter + public class StreamWriterResult : IStreamWriterAsync { private byte[] result; @@ -94,18 +109,19 @@ public StreamWriterResult(byte[] result) this.result = result; } - public void WriteTo(Stream responseStream) + public async Task WriteToAsync(Stream responseStream, CancellationToken token = new CancellationToken()) { - responseStream.Write(result, 0, result.Length); + await responseStream.WriteAsync(result, token); } } + public class BuiltInTypesAppHost : AppHostHttpListenerBase { - public BuiltInTypesAppHost() : base(typeof(BuiltInTypesAppHost).Name, typeof(BuiltInTypesService).Assembly) { } + public BuiltInTypesAppHost() : base(nameof(BuiltInTypesAppHost), typeof(BuiltInTypesService).Assembly) { } public string LastRequestBody { get; set; } - public bool UseBufferredStream { get; set; } + public bool UseBufferedStream { get; set; } public bool EnableRequestBodyTracking { get; set; } public override void Configure(Container container) {} @@ -116,7 +132,7 @@ public class ServiceClientsBuiltInResponseTests { private BufferedRequestAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BufferedRequestAppHost { EnableRequestBodyTracking = true }; @@ -124,7 +140,7 @@ public void TestFixtureSetUp() appHost.Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -133,6 +149,7 @@ public void TestFixtureTearDown() protected static IRestClient[] RestClients = { new JsonServiceClient(Config.AbsoluteBaseUri), + new JsonHttpClient(Config.AbsoluteBaseUri), new XmlServiceClient(Config.AbsoluteBaseUri), new JsvServiceClient(Config.AbsoluteBaseUri), }; @@ -153,7 +170,7 @@ public void Can_download_Poco_response_as_string(IRestClient client) { string response = client.Get<string>("/poco/Test"); - Assert.That(response, Is.StringContaining("Hello, Test")); + Assert.That(response, Does.Contain("Hello, Test")); } [Test, TestCaseSource("RestClients")] @@ -161,7 +178,7 @@ public void Can_download_Poco_response_as_bytes(IRestClient client) { byte[] response = client.Get<byte[]>("/poco/Test"); - Assert.That(response.FromUtf8Bytes(), Is.StringContaining("Hello, Test")); + Assert.That(response.FromUtf8Bytes(), Does.Contain("Hello, Test")); } [Test, TestCaseSource("RestClients")] @@ -170,26 +187,28 @@ public void Can_download_Poco_response_as_Stream(IRestClient client) Stream response = client.Get<Stream>("/poco/Test"); using (response) { - var bytes = response.ReadFully(); - Assert.That(bytes.FromUtf8Bytes(), Is.StringContaining("Hello, Test")); + Assert.That(response.ReadToEnd(), Does.Contain("Hello, Test")); } } [Test, TestCaseSource("RestClients")] public void Can_download_Poco_response_as_PocoResponse(IRestClient client) { + if (client is JsonHttpClient) return; + HttpWebResponse response = client.Get<HttpWebResponse>("/poco/Test"); using (var stream = response.GetResponseStream()) - using (var sr = new StreamReader(stream)) { - Assert.That(sr.ReadToEnd(), Is.StringContaining("Hello, Test")); + Assert.That(stream.ReadToEnd(), Does.Contain("Hello, Test")); } } [Test, TestCaseSource("RestClients")] public void Can_download_Headers_response(IRestClient client) { + if (client is JsonHttpClient) return; + HttpWebResponse response = client.Get(new Headers { Text = "Test" }); Assert.That(response.Headers["X-Response"], Is.EqualTo("Test")); } @@ -197,11 +216,14 @@ public void Can_download_Headers_response(IRestClient client) [Test, TestCaseSource("RestClients")] public async Task Can_download_Headers_response_Async(IServiceClient client) { - //Note: HttpWebResponse is returned before any response is read, so it's ideal point for streaming in app code + if (client is JsonHttpClient) return; - var response = await client.GetAsync(new Headers { Text = "Test" }); + //Note: HttpWebResponse is returned before any response is read, so it's ideal point for streaming in app code - Assert.That(response.Headers["X-Response"], Is.EqualTo("Test")); + using (var response = await client.GetAsync(new Headers { Text = "Test" })) + { + Assert.That(response.Headers["X-Response"], Is.EqualTo("Test")); + } } [Test, TestCaseSource("RestClients")] @@ -237,6 +259,18 @@ public async Task Can_download_Bytes_response_Async(IServiceClient client) Assert.That(new Guid(bytes), Is.EqualTo(guid)); } + [Test, TestCaseSource("RestClients")] + public void Can_download_BytesAsStreams_response(IRestClient client) + { + var guid = Guid.NewGuid(); + Stream response = client.Get(new BytesAsStreams { Text = guid.ToString() }); + using (response) + { + var bytes = response.ReadFully(); + Assert.That(new Guid(bytes), Is.EqualTo(guid)); + } + } + [Test, TestCaseSource("RestClients")] public void Can_download_Streams_response(IRestClient client) { @@ -257,7 +291,7 @@ public async Task Can_download_Streams_response_Async(IServiceClient client) byte[] bytes = null; var guid = Guid.NewGuid(); - var stream = await client.GetAsync(new Streams { Text = guid.ToString() }); + var stream = await client.GetAsync(new BytesAsStreams { Text = guid.ToString() }); bytes = stream.ReadFully(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceFilterTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceFilterTests.cs new file mode 100644 index 00000000000..dd7fa81b75b --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceFilterTests.cs @@ -0,0 +1,120 @@ +using System; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + class HelloFilter : IReturn<HelloFilterResponse> + { + public string Name { get; set; } + public bool Throw { get; set; } + } + + class HelloFilterResponse + { + public string Result { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + class FiltersService : Service + { + public override void OnBeforeExecute(object requestDto) + { + Assert.That(Request, Is.Not.Null); + if (requestDto is HelloFilter dto) + dto.Name += $" OnBeforeExecute"; + } + + public object Any(HelloFilter request) => !request.Throw + ? new HelloFilterResponse { Result = $"Hi {request.Name}!" } + : throw new ArgumentException(request.Name); + + public override object OnAfterExecute(object response) + { + Assert.That(Request, Is.Not.Null); + if (response is HelloFilterResponse dto) + dto.Result += $" OnAfterExecute"; + + return new HttpResult(response) { + Headers = { + ["X-Filter"] = nameof(OnAfterExecute) + } + }; + } + + public override Task<object> OnExceptionAsync(object requestDto, Exception ex) + { + Assert.That(Request, Is.Not.Null); + var error = DtoUtils.CreateErrorResponse(requestDto, ex); + if (error is IHttpError httpError) + { + var errorStatus = httpError.Response.GetResponseStatus(); + errorStatus.Message += " OnExceptionAsync"; + } + return Task.FromResult(error); + } + } + + public class ServiceFilterTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ServiceFilterTests), typeof(FiltersService).Assembly) { } + public override void Configure(Container container) + { + } + } + + private ServiceStackHost appHost; + + [OneTimeSetUp] public void OneTimeSetUp() => appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + + [OneTimeTearDown] public void TestFixtureTearDown() => appHost.Dispose(); + + [Test] + public void Does_call_OnBeforeExecute_and_OnAfterExecute() + { + var client = new JsonServiceClient(Config.ListeningOn) { + ResponseFilter = res => { + $"X-Filter: {res.Headers["X-Filter"]}".Print(); + Assert.That(res.Headers["X-Filter"], Is.EqualTo("OnAfterExecute")); + } + }; + + var request = new HelloFilter { Name = nameof(HelloFilter) }; + var response = client.Get(request); + + Assert.That(response.Result, Is.EqualTo($"Hi {request.Name} OnBeforeExecute! OnAfterExecute")); + } + + [Test] + public void Does_call_OnExceptionAsync_on_Error() + { + var client = new JsonServiceClient(Config.ListeningOn); + + var request = new HelloFilter { + Name = nameof(HelloFilter), + Throw = true, + }; + try + { + var response = client.Get(request); + + Assert.Fail("Should throw"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.Message, Is.EqualTo($"{request.Name} OnBeforeExecute OnExceptionAsync")); + } + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceGatewayTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceGatewayTests.cs new file mode 100644 index 00000000000..41e6a02802b --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceGatewayTests.cs @@ -0,0 +1,632 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.FluentValidation; +using ServiceStack.Messaging; +using ServiceStack.Text; +using ServiceStack.Validation; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class SGSendSyncGetInternal : IReturn<SGSendSyncGetInternal> + { + public bool Throw { get; set; } + public string Value { get; set; } + } + + public class SGSendSyncGetExternal : IReturn<SGSendSyncGetExternal> + { + public bool Throw { get; set; } + public string Value { get; set; } + } + + public class SGSendSyncPostInternal : IReturn<SGSendSyncPostInternal> + { + public string Value { get; set; } + } + + public class SGSendSyncPostExternal : IReturn<SGSendSyncPostExternal> + { + public string Value { get; set; } + } + + public class SGSendAllSyncGetAnyInternal : IReturn<List<SGSyncGetAnyInternal>> + { + public string Value { get; set; } + } + + public class SGSendAllSyncPostExternal : IReturn<List<SGSyncPostExternal>> + { + public string Value { get; set; } + } + + public class SGPublishPostInternalVoid : IReturnVoid, IGet + { + public string Value { get; set; } + } + + public class SGPublishPostExternalVoid : IReturnVoid, IPost + { + public string Value { get; set; } + } + + public class SGPublishAllPostInternalVoid : IReturnVoid, IGet + { + public string Value { get; set; } + } + + public class SGPublishAllPostExternalVoid : IReturnVoid, IPost + { + public string Value { get; set; } + } + + public class SGSendSyncGetSyncObjectInternal : IReturn<SGSendSyncGetSyncObjectInternal> + { + public string Value { get; set; } + } + + public class SGSendSyncGetAsyncObjectExternal : IReturn<SGSendSyncGetAsyncObjectExternal> + { + public string Value { get; set; } + } + + public class SGSyncPostValidationExternal : IReturn<SGSyncPostValidationExternal> + { + public string Value { get; set; } + public string Required { get; set; } + } + + public class ServiceGatewayServices : Service + { + public object Any(SGSendSyncGetInternal request) + { + request.Value += "> " + Request.Verb + " " + nameof(SGSendSyncGetInternal); + return Gateway.Send(request.ConvertTo<SGSyncGetInternal>()); + } + + public object Any(SGSendSyncGetExternal request) + { + request.Value += "> " + Request.Verb + " " + nameof(SGSendSyncGetExternal); + return Gateway.Send(request.ConvertTo<SGSyncGetExternal>()); + } + + public object Any(SGSendSyncPostInternal request) + { + request.Value += "> " + Request.Verb + " " + nameof(SGSendSyncPostInternal); + return Gateway.Send(request.ConvertTo<SGSyncPostInternal>()); + } + + public object Any(SGSendSyncPostExternal request) + { + request.Value += "> " + Request.Verb + " " + nameof(SGSendSyncPostExternal); + return Gateway.Send(request.ConvertTo<SGSyncPostExternal>()); + } + + public object Any(SGSendAllSyncGetAnyInternal request) + { + var requests = 3.Times(i => new SGSyncGetAnyInternal + { + Value = request.Value + "> " + Request.Verb + " " + nameof(SGSendAllSyncGetAnyInternal) + i + }); + + return Gateway.SendAll(requests); + } + + public object Any(SGSendAllSyncPostExternal request) + { + var requests = 3.Times(i => new SGSyncPostExternal + { + Value = request.Value + "> " + Request.Verb + " " + nameof(SGSendAllSyncPostExternal) + i + }); + + return Gateway.SendAll(requests); + } + + public void Any(SGPublishPostInternalVoid request) + { + request.Value += "> " + Request.Verb + " " + nameof(SGPublishPostInternalVoid); + Gateway.Publish(request.ConvertTo<SGSyncPostInternalVoid>()); + } + + public void Any(SGPublishPostExternalVoid request) + { + request.Value += "> " + Request.Verb + " " + nameof(SGPublishPostExternalVoid); + Gateway.Publish(request.ConvertTo<SGSyncPostExternalVoid>()); + } + + public void Any(SGPublishAllPostInternalVoid request) + { + var requests = 3.Times(i => new SGSyncPostInternalVoid + { + Value = request.Value + "> " + Request.Verb + " " + nameof(SGPublishAllPostInternalVoid) + i + }); + + Gateway.PublishAll(requests); + } + + public void Any(SGPublishAllPostExternalVoid request) + { + var requests = 3.Times(i => new SGSyncPostExternalVoid + { + Value = request.Value + "> " + Request.Verb + " " + nameof(SGPublishAllPostExternalVoid) + i + }); + + Gateway.PublishAll(requests); + } + + public object Any(SGSendSyncGetSyncObjectInternal request) + { + request.Value += "> " + Request.Verb + " " + nameof(SGSendSyncGetSyncObjectInternal); + return Gateway.Send<object>(request.ConvertTo<SGSyncGetSyncObjectInternal>()); + } + + public object Any(SGSendSyncGetAsyncObjectExternal request) + { + request.Value += "> " + Request.Verb + " " + nameof(SGSendSyncGetAsyncObjectExternal); + return Gateway.SendAsync<object>(request.ConvertTo<SGSyncGetAsyncObjectExternal>()); + } + + public object Any(SGSyncPostValidationExternal request) + { + request.Value += "> " + Request.Verb + " " + nameof(SGSyncPostValidationExternal); + return Gateway.Send(request.ConvertTo<SGSyncPostValidationInternal>()); + } + + } + + public class SGSyncGetInternal : IReturn<SGSyncGetInternal>, IGet + { + public bool Throw { get; set; } + public string Value { get; set; } + } + + public class SGSyncGetExternal : IReturn<SGSyncGetExternal>, IGet + { + public bool Throw { get; set; } + public string Value { get; set; } + } + + public class SGSyncPostInternal : IReturn<SGSyncPostInternal>, IPost + { + public string Value { get; set; } + } + + public class SGSyncPostExternal : IReturn<SGSyncPostExternal>, IPost + { + public string Value { get; set; } + } + + public class SGSyncGetAnyInternal : IReturn<SGSyncGetAnyInternal>, IGet + { + public string Value { get; set; } + } + + public class SGSyncGetAnyExternal : IReturn<SGSyncGetAnyInternal>, IGet + { + public string Value { get; set; } + } + + public class SGSyncPostInternalVoid : IReturnVoid, IPost + { + public string Value { get; set; } + } + + public class SGSyncPostExternalVoid : IReturnVoid, IPost + { + public string Value { get; set; } + } + + public class SGSyncGetSyncObjectInternal : IReturn<SGSyncGetSyncObjectInternal>, IGet + { + public string Value { get; set; } + } + + public class SGSyncGetAsyncObjectExternal : IReturn<SGSyncGetAsyncObjectExternal>, IGet + { + public string Value { get; set; } + } + + public class SGSyncPostValidationInternal : IReturn<SGSyncPostValidationInternal> + { + public string Value { get; set; } + public string Required { get; set; } + } + + public class SGSyncPostValidationInternalValidator : AbstractValidator<SGSyncPostValidationInternal> + { + public SGSyncPostValidationInternalValidator() + { + RuleFor(x => x.Required).NotEmpty(); + } + } + + public class ServiceGatewayInternalServices : Service + { + public object Get(SGSyncGetInternal request) + { + if (request.Throw) + throw new ArgumentException("ERROR " + nameof(SGSendSyncGetInternal)); + + request.Value += "> GET " + nameof(SGSyncGetInternal); + return request; + } + + public object Post(SGSyncPostInternal request) + { + request.Value += "> POST " + nameof(SGSyncPostInternal); + return request; + } + + public object Any(SGSyncGetAnyInternal request) + { + request.Value += "> ANY " + nameof(SGSyncGetAnyInternal); + return request; + } + + public void Post(SGSyncPostInternalVoid request) + { + request.Value += "> POST " + nameof(SGSyncPostInternalVoid); + } + + public object Any(SGSyncGetSyncObjectInternal request) + { + request.Value += "> GET " + nameof(SGSyncGetSyncObjectInternal); + return request; + } + + public object Any(SGSyncPostValidationInternal request) + { + request.Value += "> ANY " + nameof(SGSyncPostValidationInternal); + return request; + } + } + + public class ServiceGatewayExternalServices : Service + { + public object Get(SGSyncGetExternal request) + { + if (request.Throw) + throw new ArgumentException("ERROR " + nameof(SGSyncGetExternal)); + + request.Value += "> GET " + nameof(SGSyncGetExternal); + return request; + } + + public object Post(SGSyncPostExternal request) + { + request.Value += "> POST " + nameof(SGSyncPostExternal); + return request; + } + + public object Any(SGSyncGetAnyExternal request) + { + request.Value += "> ANY " + nameof(SGSyncGetAnyExternal); + return request; + } + + public void Post(SGSyncPostExternalVoid request) + { + request.Value += "> POST " + nameof(SGSyncPostExternalVoid); + } + + public async Task<object> Any(SGSyncGetAsyncObjectExternal request) + { + await Task.Yield(); + request.Value += "> GET " + nameof(SGSyncGetAsyncObjectExternal); + return request; + } + } + + //AppHosts + public class MixedServiceGatewayTests : ServiceGatewayTests + { + class MixedServiceGatewayFactory : IServiceGatewayFactory, IServiceGateway + { + private InProcessServiceGateway localGateway; + + public IServiceGateway GetServiceGateway(IRequest request) + { + localGateway = new InProcessServiceGateway(request); + return this; + } + + public IServiceGateway GetGateway(Type requestType) + { + var gateway = requestType.Name.Contains("External") + ? new JsonServiceClient(Config.ListeningOn) + : (IServiceGateway) localGateway; + return gateway; + } + + public TResponse Send<TResponse>(object requestDto) + { + return GetGateway(requestDto.GetType()).Send<TResponse>(requestDto); + } + + public List<TResponse> SendAll<TResponse>(IEnumerable<object> requestDtos) + { + return GetGateway(requestDtos.GetType().GetCollectionType()).SendAll<TResponse>(requestDtos); + } + + public void Publish(object requestDto) + { + GetGateway(requestDto.GetType()).Publish(requestDto); + } + + public void PublishAll(IEnumerable<object> requestDtos) + { + GetGateway(requestDtos.GetType().GetCollectionType()).PublishAll(requestDtos); + } + } + + class MixedAppHost : AppSelfHostBase + { + public MixedAppHost() : base(nameof(ServiceGatewayTests), typeof(ServiceGatewayServices).Assembly) { } + + public override void Configure(Container container) + { + container.Register<IMessageFactory>(c => new MessageFactory()); + + container.Register<IServiceGatewayFactory>(x => new MixedServiceGatewayFactory()) + .ReusedWithin(ReuseScope.None); + + Plugins.Add(new ValidationFeature()); + container.RegisterValidator(typeof(SGSyncPostValidationInternalValidator)); + } + } + + protected override ServiceStackHost CreateAppHost() + { + return new MixedAppHost(); + } + } + + public class AllExternalServiceGatewayTests : ServiceGatewayTests + { + class AllExternalAppHost : AppSelfHostBase + { + public AllExternalAppHost() : base(nameof(ServiceGatewayTests), typeof(ServiceGatewayServices).Assembly) { } + + public override void Configure(Container container) + { + container.Register<IMessageFactory>(c => new MessageFactory()); + container.Register<IServiceGateway>(c => new JsonServiceClient(Tests.Config.ListeningOn)); + + Plugins.Add(new ValidationFeature()); + container.RegisterValidator(typeof(SGSyncPostValidationInternalValidator)); + } + } + + protected override ServiceStackHost CreateAppHost() + { + return new AllExternalAppHost(); + } + } + + //Tests + public class AllInternalServiceGatewayTests : ServiceGatewayTests + { + class AllInternalAppHost : AppSelfHostBase + { + public AllInternalAppHost() : base(nameof(ServiceGatewayTests), typeof(ServiceGatewayServices).Assembly) { } + + public override void Configure(Container container) + { + container.Register<IMessageFactory>(c => new MessageFactory()); + + Plugins.Add(new ValidationFeature()); + container.RegisterValidator(typeof(SGSyncPostValidationInternalValidator)); + } + } + + protected override ServiceStackHost CreateAppHost() + { + return new AllInternalAppHost(); + } + } + + + public abstract class ServiceGatewayTests + { + public class MessageFactory : IMessageFactory + { + public IMessageProducer CreateMessageProducer() + { + return new MessageProducer(); + } + + public IMessageQueueClient CreateMessageQueueClient() { return null; } + public void Dispose() { } + } + + public class MessageProducer : IMessageProducer + { + public static List<object> Messages = new List<object>(); + + public void Publish<T>(T messageBody) + { + Messages.Add(messageBody); + } + + public void Publish<T>(IMessage<T> message) { } + public void Dispose() { } + } + + protected abstract ServiceStackHost CreateAppHost(); + + readonly IServiceClient client; + private readonly ServiceStackHost appHost; + public ServiceGatewayTests() + { + appHost = CreateAppHost() + .Init() + .Start(Config.ListeningOn); + + client = new JsonServiceClient(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Does_SGSendSyncInternal() + { + var response = client.Get(new SGSendSyncGetInternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendSyncGetInternal> GET SGSyncGetInternal")); + } + + [Test] + public void Does_throw_original_Exception_in_SGSendSyncInternal() + { + try + { + var response = client.Get(new SGSendSyncGetInternal { Value = "GET CLIENT", Throw = true }); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.StatusDescription, Is.EqualTo(nameof(ArgumentException))); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("ERROR " + nameof(SGSendSyncGetInternal))); + } + } + + [Test] + public void Does_SGSendSyncGetExternal() + { + var response = client.Get(new SGSendSyncGetExternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendSyncGetExternal> GET SGSyncGetExternal")); + } + + [Test] + public void Does_throw_original_Exception_in_SGSendSyncGetExternal() + { + try + { + var response = client.Get(new SGSendSyncGetExternal { Value = "GET CLIENT", Throw = true }); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.StatusDescription, Is.EqualTo(nameof(ArgumentException))); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("ERROR " + nameof(SGSyncGetExternal))); + } + } + + [Test] + public void Does_throw_original_ValidationException_in_SGSyncPostValidationExternal() + { + try + { + var response = client.Get(new SGSyncPostValidationExternal { Value = "GET CLIENT" }); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.StatusDescription, Is.EqualTo("NotEmpty")); + Assert.That(ex.ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("'Required' must not be empty.")); + } + } + + [Test] + public void Does_SGSendSyncPostInternal() + { + var response = client.Get(new SGSendSyncPostInternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendSyncPostInternal> POST SGSyncPostInternal")); + } + + [Test] + public void Does_SGSendSyncPostExternal() + { + var response = client.Get(new SGSendSyncPostExternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendSyncPostExternal> POST SGSyncPostExternal")); + } + + [Test] + public void Does_SGSendAllSyncGetAnyInternal() + { + var response = client.Get(new SGSendAllSyncGetAnyInternal { Value = "GET CLIENT" }); + Assert.That(response.Map(x => x.Value), Is.EquivalentTo( + 3.Times(i => "GET CLIENT> GET SGSendAllSyncGetAnyInternal{0}> ANY SGSyncGetAnyInternal".Fmt(i)))); + } + + [Test] + public void Does_SGSendAllSyncPostExternal() + { + var response = client.Get(new SGSendAllSyncPostExternal { Value = "GET CLIENT" }); + Assert.That(response.Map(x => x.Value), Is.EquivalentTo( + 3.Times(i => "GET CLIENT> GET SGSendAllSyncPostExternal{0}> POST SGSyncPostExternal".Fmt(i)))); + } + + [Test] + public void Does_SGPublishPostInternalVoid() + { + MessageProducer.Messages.Clear(); + client.Send(new SGPublishPostInternalVoid { Value = "GET CLIENT" }); + + Assert.That(MessageProducer.Messages.Count, Is.EqualTo(1)); + var response = MessageProducer.Messages[0] as SGSyncPostInternalVoid; + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGPublishPostInternalVoid")); + } + + [Test] + public void Does_SGPublishPostExternalVoid() + { + MessageProducer.Messages.Clear(); + client.Send(new SGPublishPostExternalVoid { Value = "POST CLIENT" }); + + Assert.That(MessageProducer.Messages.Count, Is.EqualTo(1)); + var response = MessageProducer.Messages[0] as SGSyncPostExternalVoid; + Assert.That(response.Value, Is.EqualTo("POST CLIENT> POST SGPublishPostExternalVoid")); + } + + [Test] + public void Does_SGPublishAllPostInternalVoid() + { + MessageProducer.Messages.Clear(); + client.Send(new SGPublishAllPostInternalVoid { Value = "GET CLIENT" }); + + Assert.That(MessageProducer.Messages.Count, Is.EqualTo(3)); + Assert.That(MessageProducer.Messages.Map(x => ((SGSyncPostInternalVoid)x).Value), Is.EquivalentTo( + 3.Times(i => "GET CLIENT> GET SGPublishAllPostInternalVoid{0}".Fmt(i)))); + } + + [Test] + public void Does_SGPublishAllPostExternalVoid() + { + MessageProducer.Messages.Clear(); + client.Send(new SGPublishAllPostExternalVoid { Value = "GET CLIENT" }); + + Assert.That(MessageProducer.Messages.Count, Is.EqualTo(3)); + Assert.That(MessageProducer.Messages.Map(x => ((SGSyncPostExternalVoid)x).Value), Is.EquivalentTo( + 3.Times(i => "GET CLIENT> POST SGPublishAllPostExternalVoid{0}".Fmt(i)))); + } + + [Test] + public void Does_SGSendSyncGetSyncObjectInternal() + { + var response = client.Get(new SGSendSyncGetSyncObjectInternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendSyncGetSyncObjectInternal> GET SGSyncGetSyncObjectInternal")); + } + + [Test] + public void Does_SGSendSyncGetAsyncObjectExternal() + { + var response = client.Get(new SGSendSyncGetAsyncObjectExternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendSyncGetAsyncObjectExternal> GET SGSyncGetAsyncObjectExternal")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceGatewayTestsAsync.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceGatewayTestsAsync.cs new file mode 100644 index 00000000000..7d78f72d25a --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceGatewayTestsAsync.cs @@ -0,0 +1,596 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.FluentValidation; +using ServiceStack.Logging; +using ServiceStack.Messaging; +using ServiceStack.Text; +using ServiceStack.Validation; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class SGSendAsyncGetInternal : IReturn<SGSendAsyncGetInternal> + { + public bool Throw { get; set; } + public string Value { get; set; } + } + + public class SGSendAsyncGetExternal : IReturn<SGSendAsyncGetExternal> + { + public bool Throw { get; set; } + public string Value { get; set; } + } + + public class SGSendAsyncPostInternal : IReturn<SGSendAsyncPostInternal> + { + public string Value { get; set; } + } + + public class SGSendAsyncPostExternal : IReturn<SGSendAsyncPostExternal> + { + public string Value { get; set; } + } + + public class SGSendAllAsyncGetAnyInternal : IReturn<List<SGAsyncGetAnyInternal>> + { + public string Value { get; set; } + } + + public class SGSendAllAsyncPostExternal : IReturn<List<SGAsyncPostExternal>> + { + public string Value { get; set; } + } + + public class SGPublishAsyncPostInternalVoid : IReturnVoid, IGet + { + public string Value { get; set; } + } + + public class SGPublishAsyncPostExternalVoid : IReturnVoid, IPost + { + public string Value { get; set; } + } + + public class SGPublishAllAsyncPostInternalVoid : IReturnVoid, IGet + { + public string Value { get; set; } + } + + public class SGPublishAllAsyncPostExternalVoid : IReturnVoid, IPost + { + public string Value { get; set; } + } + + public class SGMultiGatewayRequests : IReturn<SGMultiGatewayRequests>, IPost + { + public int Times { get; set; } + public int Delay { get; set; } + public string Value { get; set; } + } + + public class SGMInternalMultiGatewayRequests : IReturn<SGMInternalMultiGatewayRequests>, IPost + { + public int Delay { get; set; } + public string Value { get; set; } + } + + public class SGMInternalMultiGatewayRequestsValidator : AbstractValidator<SGMInternalMultiGatewayRequests> + { + public SGMInternalMultiGatewayRequestsValidator() + { + RuleFor(x => x.Value) + .CustomAsync((x,ctx,cancel) => Gateway.SendAsync(new SGAsyncPostInternal())); + } + } + + public class ServiceGatewayAsyncServices : Service + { + public object Any(SGSendAsyncGetInternal request) + { + request.Value += "> " + Request.Verb + " " + typeof(SGSendAsyncGetInternal).Name; + return Gateway.SendAsync(request.ConvertTo<SGAsyncGetInternal>()); + } + + public object Any(SGSendAsyncGetExternal request) + { + request.Value += "> " + Request.Verb + " " + typeof(SGSendAsyncGetExternal).Name; + return Gateway.SendAsync(request.ConvertTo<SGAsyncGetExternal>()); + } + + public object Any(SGSendAsyncPostInternal request) + { + request.Value += "> " + Request.Verb + " " + typeof(SGSendAsyncPostInternal).Name; + return Gateway.SendAsync(request.ConvertTo<SGAsyncPostInternal>()); + } + + public object Any(SGSendAsyncPostExternal request) + { + request.Value += "> " + Request.Verb + " " + typeof(SGSendAsyncPostExternal).Name; + return Gateway.SendAsync(request.ConvertTo<SGAsyncPostExternal>()); + } + + public object Any(SGSendAllAsyncGetAnyInternal request) + { + var requests = 3.Times(i => new SGAsyncGetAnyInternal + { + Value = request.Value + "> " + Request.Verb + " " + typeof(SGSendAllAsyncGetAnyInternal).Name + i + }); + + return Gateway.SendAllAsync(requests); + } + + public object Any(SGSendAllAsyncPostExternal request) + { + var requests = 3.Times(i => new SGAsyncPostExternal + { + Value = request.Value + "> " + Request.Verb + " " + typeof(SGSendAllAsyncPostExternal).Name + i + }); + + return Gateway.SendAllAsync(requests); + } + + public async Task Any(SGPublishAsyncPostInternalVoid request) + { + request.Value += "> " + Request.Verb + " " + typeof(SGPublishAsyncPostInternalVoid).Name; + await Gateway.PublishAsync(request.ConvertTo<SGAsyncPostInternalVoid>()); + } + + public async Task Any(SGPublishAsyncPostExternalVoid request) + { + request.Value += "> " + Request.Verb + " " + typeof(SGPublishAsyncPostExternalVoid).Name; + await Gateway.PublishAsync(request.ConvertTo<SGAsyncPostExternalVoid>()); + } + + public async Task Any(SGPublishAllAsyncPostInternalVoid request) + { + var requests = 3.Times(i => new SGAsyncPostInternalVoid + { + Value = request.Value + "> " + Request.Verb + " " + typeof(SGPublishAllAsyncPostInternalVoid).Name + i + }); + + await Gateway.PublishAllAsync(requests); + } + + public async Task Any(SGPublishAllAsyncPostExternalVoid request) + { + var requests = 3.Times(i => new SGAsyncPostExternalVoid + { + Value = request.Value + "> " + Request.Verb + " " + typeof(SGPublishAllAsyncPostExternalVoid).Name + i + }); + + await Gateway.PublishAllAsync(requests); + } + + public async Task<object> Any(SGMultiGatewayRequests request) + { + for (var i = 0; i < request.Times; i++) + { + await Gateway.SendAsync(new SGMInternalMultiGatewayRequests { + Delay = request.Delay + }); + } + return request; + } + + public async Task<object> Any(SGMInternalMultiGatewayRequests request) + { + if (!Request.IsInProcessRequest()) + throw new Exception("Gateway Request is not in process"); + + await Task.Delay(request.Delay); + return request; + } + } + + public class SGAsyncGetInternal : IReturn<SGAsyncGetInternal>, IGet + { + public bool Throw { get; set; } + public string Value { get; set; } + } + + public class SGAsyncGetExternal : IReturn<SGAsyncGetExternal>, IGet + { + public bool Throw { get; set; } + public string Value { get; set; } + } + + public class SGAsyncPostInternal : IReturn<SGAsyncPostInternal>, IPost + { + public string Value { get; set; } + } + + public class SGAsyncPostExternal : IReturn<SGAsyncPostExternal>, IPost + { + public string Value { get; set; } + } + + public class SGAsyncGetAnyInternal : IReturn<SGAsyncGetAnyInternal>, IGet + { + public string Value { get; set; } + } + + public class SGAsyncGetAnyExternal : IReturn<SGAsyncGetAnyInternal>, IGet + { + public string Value { get; set; } + } + + public class SGAsyncPostInternalVoid : IReturnVoid, IPost + { + public string Value { get; set; } + } + + public class SGAsyncPostExternalVoid : IReturnVoid, IPost + { + public string Value { get; set; } + } + + public class ServiceGatewayInternalAsyncServices : Service + { + public object Get(SGAsyncGetInternal request) + { + if (request.Throw) + throw new ArgumentException("ERROR " + typeof(SGSendAsyncGetInternal).Name); + + request.Value += "> GET " + typeof(SGAsyncGetInternal).Name; + return request; + } + + public object Post(SGAsyncPostInternal request) + { + request.Value += "> POST " + typeof(SGAsyncPostInternal).Name; + return Task.FromResult(request); + } + + public object Any(SGAsyncGetAnyInternal request) + { + request.Value += "> ANY " + typeof(SGAsyncGetAnyInternal).Name; + return request; + } + + public void Post(SGAsyncPostInternalVoid request) + { + request.Value += "> POST " + typeof(SGAsyncPostInternalVoid).Name; + } + } + + public class ServiceGatewayExternalAsyncServices : Service + { + public async Task<object> Get(SGAsyncGetExternal request) + { + await Task.Yield(); + + if (request.Throw) + throw new ArgumentException("ERROR " + typeof(SGAsyncGetExternal).Name); + + request.Value += "> GET " + typeof(SGAsyncGetExternal).Name; + return await Task.FromResult(request); + } + + public async Task<object> Post(SGAsyncPostExternal request) + { + request.Value += "> POST " + typeof(SGAsyncPostExternal).Name; + return await Task.FromResult(request); + } + + public Task Any(SGAsyncGetAnyExternal request) + { + request.Value += "> ANY " + typeof(SGAsyncGetAnyExternal).Name; + return Task.FromResult(request); + } + + public Task Post(SGAsyncPostExternalVoid request) + { + request.Value += "> POST " + typeof(SGAsyncPostExternalVoid).Name; + return Task.FromResult((object)null); + } + } + + //AppHosts + public class MixedServiceGatewayNativeAsyncTests : ServiceGatewayAsyncTests + { + class MixedServiceGatewayFactory : ServiceGatewayFactoryBase + { + public override IServiceGateway GetGateway(Type requestType) + { + var gateway = requestType.Name.Contains("External") + ? new JsonServiceClient(Config.ListeningOn) + : (IServiceGateway)localGateway; + return gateway; + } + } + + class MixedAppHost : AppSelfHostBase + { + public MixedAppHost() : base(typeof(ServiceGatewayTests).Name, typeof(ServiceGatewayServices).Assembly) { } + + public override void Configure(Container container) + { + container.Register<IMessageFactory>(c => new MessageFactory()); + + container.Register<IServiceGatewayFactory>(x => new MixedServiceGatewayFactory()) + .ReusedWithin(ReuseScope.None); + } + } + + protected override ServiceStackHost CreateAppHost() + { + return new MixedAppHost(); + } + } + + public class MixedServiceGatewayAsyncTests : ServiceGatewayAsyncTests + { + class MixedServiceGatewayFactory : IServiceGatewayFactory, IServiceGateway + { + private InProcessServiceGateway localGateway; + + public IServiceGateway GetServiceGateway(IRequest request) + { + localGateway = new InProcessServiceGateway(request); + return this; + } + + public IServiceGateway GetGateway(Type requestType) + { + var gateway = requestType.Name.Contains("External") + ? new JsonServiceClient(Config.ListeningOn) + : (IServiceGateway) localGateway; + return gateway; + } + + public TResponse Send<TResponse>(object requestDto) + { + return GetGateway(requestDto.GetType()).Send<TResponse>(requestDto); + } + + public List<TResponse> SendAll<TResponse>(IEnumerable<object> requestDtos) + { + return GetGateway(requestDtos.GetType().GetCollectionType()).SendAll<TResponse>(requestDtos); + } + + public void Publish(object requestDto) + { + GetGateway(requestDto.GetType()).Publish(requestDto); + } + + public void PublishAll(IEnumerable<object> requestDtos) + { + GetGateway(requestDtos.GetType().GetCollectionType()).PublishAll(requestDtos); + } + } + + class MixedAppHost : AppSelfHostBase + { + public MixedAppHost() : base(typeof(ServiceGatewayTests).Name, typeof(ServiceGatewayServices).Assembly) { } + + public override void Configure(Container container) + { + container.Register<IMessageFactory>(c => new MessageFactory()); + + container.Register<IServiceGatewayFactory>(x => new MixedServiceGatewayFactory()) + .ReusedWithin(ReuseScope.None); + } + } + + protected override ServiceStackHost CreateAppHost() + { + return new MixedAppHost(); + } + } + + public class AllExternalServiceGatewayAsyncTests : ServiceGatewayAsyncTests + { + class AllExternalAppHost : AppSelfHostBase + { + public AllExternalAppHost() : base(typeof(ServiceGatewayTests).Name, typeof(ServiceGatewayServices).Assembly) { } + + public override void Configure(Container container) + { + container.Register<IMessageFactory>(c => new MessageFactory()); + container.Register<IServiceGateway>(c => new JsonServiceClient(Tests.Config.ListeningOn)); + } + } + + protected override ServiceStackHost CreateAppHost() + { + return new AllExternalAppHost(); + } + } + + //Tests + public class AllInternalServiceGatewayAsyncTests : ServiceGatewayAsyncTests + { + class AllInternalAppHost : AppSelfHostBase + { + public AllInternalAppHost() : base(typeof(ServiceGatewayTests).Name, typeof(ServiceGatewayServices).Assembly) { } + + public override void Configure(Container container) + { + container.Register<IMessageFactory>(c => new MessageFactory()); + + Plugins.Add(new ValidationFeature()); + } + } + + protected override ServiceStackHost CreateAppHost() + { + return new AllInternalAppHost(); + } + + [Test] + public async Task Verify_all_internal_gateway_requests_are_marked_as_in_process() + { + await client.GetAsync(new SGMultiGatewayRequests { Times = 3, Delay = 10 }); + } + } + + public abstract class ServiceGatewayAsyncTests + { + public class MessageFactory : IMessageFactory + { + public IMessageProducer CreateMessageProducer() + { + return new MessageProducer(); + } + + public IMessageQueueClient CreateMessageQueueClient() { return null; } + public void Dispose() { } + } + + public class MessageProducer : IMessageProducer + { + public static List<object> Messages = new List<object>(); + + public void Publish<T>(T messageBody) + { + Messages.Add(messageBody); + } + + public void Publish<T>(IMessage<T> message) { } + public void Dispose() { } + } + + protected abstract ServiceStackHost CreateAppHost(); + + protected readonly IServiceClient client; + private readonly ServiceStackHost appHost; + public ServiceGatewayAsyncTests() + { + appHost = CreateAppHost() + .Init() + .Start(Config.ListeningOn); + + client = new JsonServiceClient(Config.ListeningOn); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() => appHost.Dispose(); + + [Test] + public void Does_SGSendAsyncInternal() + { + var response = client.Get(new SGSendAsyncGetInternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendAsyncGetInternal> GET SGAsyncGetInternal")); + } + + [Test] + public void Does_throw_original_Exception_in_SGSendAsyncInternal() + { + try + { + var response = client.Get(new SGSendAsyncGetInternal { Value = "GET CLIENT", Throw = true }); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.StatusDescription, Is.EqualTo(typeof(ArgumentException).Name)); + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(ArgumentException).Name)); + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(typeof(ArgumentException).Name)); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("ERROR " + typeof(SGSendAsyncGetInternal).Name)); + } + } + + [Test] + public async Task Does_SGSendAsyncGetExternal() + { + var response = await client.GetAsync(new SGSendAsyncGetExternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendAsyncGetExternal> GET SGAsyncGetExternal")); + } + + [Test] + public async Task Does_throw_original_Exception_in_SGSendAsyncGetExternal() + { + try + { + var response = await client.GetAsync(new SGSendAsyncGetExternal { Value = "GET CLIENT", Throw = true }); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.StatusDescription, Is.EqualTo(typeof(ArgumentException).Name)); + Assert.That(ex.ErrorCode, Is.EqualTo(typeof(ArgumentException).Name)); + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(typeof(ArgumentException).Name)); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo("ERROR " + typeof(SGAsyncGetExternal).Name)); + } + } + + [Test] + public void Does_SGSendAsyncPostInternal() + { + var response = client.Get(new SGSendAsyncPostInternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendAsyncPostInternal> POST SGAsyncPostInternal")); + } + + [Test] + public async Task Does_SGSendAsyncPostExternal() + { + var response = await client.GetAsync(new SGSendAsyncPostExternal { Value = "GET CLIENT" }); + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendAsyncPostExternal> POST SGAsyncPostExternal")); + } + + [Test] + public void Does_SGSendAllAsyncGetAnyInternal() + { + var response = client.Get(new SGSendAllAsyncGetAnyInternal { Value = "GET CLIENT" }); + Assert.That(response.Map(x => x.Value), Is.EquivalentTo( + 3.Times(i => "GET CLIENT> GET SGSendAllAsyncGetAnyInternal{0}> ANY SGAsyncGetAnyInternal".Fmt(i)))); + } + + [Test] + public async Task Does_SGSendAllAsyncPostExternal() + { + var response = await client.GetAsync(new SGSendAllAsyncPostExternal { Value = "GET CLIENT" }); + Assert.That(response.Map(x => x.Value), Is.EquivalentTo( + 3.Times(i => "GET CLIENT> GET SGSendAllAsyncPostExternal{0}> POST SGAsyncPostExternal".Fmt(i)))); + } + + [Test] + public void Does_SGPublishAsyncPostInternalVoid() + { + MessageProducer.Messages.Clear(); + client.Send(new SGPublishAsyncPostInternalVoid { Value = "GET CLIENT" }); + + Assert.That(MessageProducer.Messages.Count, Is.EqualTo(1)); + var response = MessageProducer.Messages[0] as SGAsyncPostInternalVoid; + Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGPublishAsyncPostInternalVoid")); + } + + [Test] + public async Task Does_SGPublishAsyncPostExternalVoid() + { + MessageProducer.Messages.Clear(); + await client.SendAsync(new SGPublishAsyncPostExternalVoid { Value = "POST CLIENT" }); + + Assert.That(MessageProducer.Messages.Count, Is.EqualTo(1)); + var response = MessageProducer.Messages[0] as SGAsyncPostExternalVoid; + Assert.That(response.Value, Is.EqualTo("POST CLIENT> POST SGPublishAsyncPostExternalVoid")); + } + + [Test] + public void Does_SGPublishAllAsyncPostInternalVoid() + { + MessageProducer.Messages.Clear(); + client.Send(new SGPublishAllAsyncPostInternalVoid { Value = "GET CLIENT" }); + + Assert.That(MessageProducer.Messages.Count, Is.EqualTo(3)); + Assert.That(MessageProducer.Messages.Map(x => ((SGAsyncPostInternalVoid)x).Value), Is.EquivalentTo( + 3.Times(i => "GET CLIENT> GET SGPublishAllAsyncPostInternalVoid{0}".Fmt(i)))); + } + + [Test] + public async Task Does_SGPublishAllAsyncPostExternalVoid() + { + MessageProducer.Messages.Clear(); + await client.SendAsync(new SGPublishAllAsyncPostExternalVoid { Value = "GET CLIENT" }); + + Assert.That(MessageProducer.Messages.Count, Is.EqualTo(3)); + Assert.That(MessageProducer.Messages.Map(x => ((SGAsyncPostExternalVoid)x).Value), Is.EquivalentTo( + 3.Times(i => "GET CLIENT> POST SGPublishAllAsyncPostExternalVoid{0}".Fmt(i)))); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceGatewayUsageTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceGatewayUsageTests.cs new file mode 100644 index 00000000000..02a0465424e --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceGatewayUsageTests.cs @@ -0,0 +1,154 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + class UsageNone { } + class UsageReturn : IReturn<UsageReturn> { } + class UsageVoid : IReturnVoid { } + + /// <summary> + /// Ensure no ambiguous compile errors with normal API Usage + /// </summary> + public class ServiceGatewayUsageTests + { + void ConcreteSyncApiUsage(JsonServiceClient client) + { + UsageNone none = client.Send<UsageNone>(new UsageNone()); + UsageReturn @return = client.Send(new UsageReturn()); + client.Send(new UsageVoid()); + List<UsageReturn> @returnAll = client.SendAll(new[] { new UsageReturn() }); + client.Publish(new UsageNone()); + client.Publish(new UsageReturn()); + client.Publish(new UsageVoid()); + client.PublishAll(new[] { new UsageNone() }); + client.PublishAll(new [] { new UsageReturn() }); + client.PublishAll(new [] { new UsageVoid() }); + } + + async Task ConcreteAsyncApiUsage(JsonServiceClient client) + { + UsageNone none = await client.SendAsync<UsageNone>(new UsageNone()); + UsageNone noneToken = await client.SendAsync<UsageNone>(new UsageNone(), CancellationToken.None); + UsageReturn @return = await client.SendAsync(new UsageReturn()); + UsageReturn returnToken = await client.SendAsync(new UsageReturn(), CancellationToken.None); + await client.SendAsync(new UsageVoid()); + await client.SendAsync(new UsageVoid(), CancellationToken.None); + List<UsageReturn> returnAll = await client.SendAllAsync(new[] { new UsageReturn() }); + List<UsageReturn> returnAllToken = await client.SendAllAsync(new[] { new UsageReturn() }, CancellationToken.None); + await client.PublishAsync(new UsageNone()); + await client.PublishAsync(new UsageNone(), CancellationToken.None); + await client.PublishAsync(new UsageReturn()); + await client.PublishAsync(new UsageReturn(), CancellationToken.None); + await client.PublishAsync(new UsageVoid()); + await client.PublishAsync(new UsageVoid(), CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageNone() }); + await client.PublishAllAsync(new[] { new UsageNone() }, CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageReturn() }); + await client.PublishAllAsync(new[] { new UsageReturn() }, CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageVoid() }); + await client.PublishAllAsync(new[] { new UsageVoid() }, CancellationToken.None); + } + + void IServiceClientSyncApiUsage(IServiceClient client) + { + UsageNone none = client.Send<UsageNone>(new UsageNone()); + UsageReturn @return = client.Send(new UsageReturn()); + client.Send(new UsageVoid()); + List<UsageReturn> @returnAll = client.SendAll(new[] { new UsageReturn() }); + client.Publish(new UsageNone()); + client.Publish(new UsageReturn()); + client.Publish(new UsageVoid()); + client.PublishAll(new[] { new UsageNone() }); + client.PublishAll(new[] { new UsageReturn() }); + client.PublishAll(new[] { new UsageVoid() }); + } + + async Task IServiceClientAsyncApiUsage(IServiceClient client) + { + UsageNone none = await client.SendAsync<UsageNone>(new UsageNone()); + UsageNone noneToken = await client.SendAsync<UsageNone>(new UsageNone(), CancellationToken.None); + UsageReturn @return = await client.SendAsync(new UsageReturn()); + UsageReturn returnToken = await client.SendAsync(new UsageReturn(), CancellationToken.None); + await client.SendAsync(new UsageVoid()); + await client.SendAsync(new UsageVoid(), CancellationToken.None); + List<UsageReturn> returnAll = await client.SendAllAsync(new[] { new UsageReturn() }); + List<UsageReturn> returnAllToken = await client.SendAllAsync(new[] { new UsageReturn() }, CancellationToken.None); + await client.PublishAsync(new UsageNone()); + await client.PublishAsync(new UsageNone(), CancellationToken.None); + await client.PublishAsync(new UsageReturn()); + await client.PublishAsync(new UsageReturn(), CancellationToken.None); + await client.PublishAsync(new UsageVoid()); + await client.PublishAsync(new UsageVoid(), CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageNone() }); + await client.PublishAllAsync(new[] { new UsageNone() }, CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageReturn() }); + await client.PublishAllAsync(new[] { new UsageReturn() }, CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageVoid() }); + await client.PublishAllAsync(new[] { new UsageVoid() }, CancellationToken.None); + } + + void IServiceGatewaySyncApiUsage(IServiceGateway client) + { + UsageNone none = client.Send<UsageNone>(new UsageNone()); + UsageReturn @return = client.Send(new UsageReturn()); + client.Send(new UsageVoid()); + List<UsageReturn> @returnAll = client.SendAll(new[] { new UsageReturn() }); + client.Publish(new UsageNone()); + client.Publish(new UsageReturn()); + client.Publish(new UsageVoid()); + client.PublishAll(new[] { new UsageNone() }); + client.PublishAll(new[] { new UsageReturn() }); + client.PublishAll(new[] { new UsageVoid() }); + } + + async Task IServiceGatewayAsyncApiUsage(IServiceGateway client) + { + UsageNone none = await client.SendAsync<UsageNone>(new UsageNone()); + UsageNone noneToken = await client.SendAsync<UsageNone>(new UsageNone(), CancellationToken.None); + UsageReturn @return = await client.SendAsync(new UsageReturn()); + UsageReturn returnToken = await client.SendAsync(new UsageReturn(), CancellationToken.None); + await client.SendAsync(new UsageVoid()); + await client.SendAsync(new UsageVoid(), CancellationToken.None); + List<UsageReturn> returnAll = await client.SendAllAsync(new[] { new UsageReturn() }); + List<UsageReturn> returnAllToken = await client.SendAllAsync(new[] { new UsageReturn() }, CancellationToken.None); + await client.PublishAsync(new UsageNone()); + await client.PublishAsync(new UsageNone(), CancellationToken.None); + await client.PublishAsync(new UsageReturn()); + await client.PublishAsync(new UsageReturn(), CancellationToken.None); + await client.PublishAsync(new UsageVoid()); + await client.PublishAsync(new UsageVoid(), CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageNone() }); + await client.PublishAllAsync(new[] { new UsageNone() }, CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageReturn() }); + await client.PublishAllAsync(new[] { new UsageReturn() }, CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageVoid() }); + await client.PublishAllAsync(new[] { new UsageVoid() }, CancellationToken.None); + } + + async Task IServiceGatewayAsyncApiUsage(IServiceGatewayAsync client) + { + UsageNone none = await client.SendAsync<UsageNone>(new UsageNone()); + UsageNone noneToken = await client.SendAsync<UsageNone>(new UsageNone(), CancellationToken.None); + UsageReturn @return = await client.SendAsync<UsageReturn>(new UsageReturn()); + UsageReturn returnToken = await client.SendAsync<UsageReturn>(new UsageReturn(), CancellationToken.None); + await client.SendAsync<UsageReturn>(new UsageVoid()); + await client.SendAsync<UsageReturn>(new UsageVoid(), CancellationToken.None); + List<UsageReturn> returnAll = await client.SendAllAsync<UsageReturn>(new[] { new UsageReturn() }); + List<UsageReturn> returnAllToken = await client.SendAllAsync<UsageReturn>(new[] { new UsageReturn() }, CancellationToken.None); + await client.PublishAsync(new UsageNone()); + await client.PublishAsync(new UsageNone(), CancellationToken.None); + await client.PublishAsync(new UsageReturn()); + await client.PublishAsync(new UsageReturn(), CancellationToken.None); + await client.PublishAsync(new UsageVoid()); + await client.PublishAsync(new UsageVoid(), CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageNone() }); + await client.PublishAllAsync(new[] { new UsageNone() }, CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageReturn() }); + await client.PublishAllAsync(new[] { new UsageReturn() }, CancellationToken.None); + await client.PublishAllAsync(new[] { new UsageVoid() }); + await client.PublishAllAsync(new[] { new UsageVoid() }, CancellationToken.None); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceSetupTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceSetupTests.cs index 6b6c6f02247..fa3ba9f6d48 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceSetupTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceSetupTests.cs @@ -34,11 +34,11 @@ public override void Configure(Container container) { } [TestFixture] public class ServiceSetupTests { - private const string BaseUri = "http://localhost:8000/"; + private const string BaseUri = "http://localhost:8001/"; JsonServiceClient client = new JsonServiceClient(BaseUri); private ServiceSetupAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new ServiceSetupAppHost(); @@ -46,7 +46,7 @@ public void TestFixtureSetUp() appHost.Start(BaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStack.WebHost.Endpoints.Tests.csproj b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStack.WebHost.Endpoints.Tests.csproj index 024f2b7ea63..8151403da61 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStack.WebHost.Endpoints.Tests.csproj +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStack.WebHost.Endpoints.Tests.csproj @@ -1,394 +1,100 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> +<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{55C5C6DA-1834-4BA8-8D2F-19C091B6FC81}</ProjectGuid> + <TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks> <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>ServiceStack.WebHost.Endpoints.Tests</RootNamespace> <AssemblyName>ServiceStack.WebHost.Endpoints.Tests</AssemblyName> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <FileUpgradeFlags> - </FileUpgradeFlags> - <OldToolsVersion>3.5</OldToolsVersion> - <UpgradeBackupLocation /> - <PublishUrl>publish\</PublishUrl> - <Install>true</Install> - <InstallFrom>Disk</InstallFrom> - <UpdateEnabled>false</UpdateEnabled> - <UpdateMode>Foreground</UpdateMode> - <UpdateInterval>7</UpdateInterval> - <UpdateIntervalUnits>Days</UpdateIntervalUnits> - <UpdatePeriodically>false</UpdatePeriodically> - <UpdateRequired>false</UpdateRequired> - <MapFileExtensions>true</MapFileExtensions> - <ApplicationRevision>0</ApplicationRevision> - <ApplicationVersion>1.0.0.%2a</ApplicationVersion> - <IsWebBootstrapper>false</IsWebBootstrapper> - <UseApplicationTrust>false</UseApplicationTrust> - <BootstrapperEnabled>true</BootstrapperEnabled> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\src\</SolutionDir> - <RestorePackages>true</RestorePackages> - <TargetFrameworkProfile /> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>True</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>False</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - <PlatformTarget>x86</PlatformTarget> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>True</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <PlatformTarget>x86</PlatformTarget> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'STATIC_ONLY NO_EXPRESSIONS|AnyCPU' "> - <DebugSymbols>True</DebugSymbols> - <OutputPath>bin\STATIC_ONLY NO_EXPRESSIONS\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <DebugType>full</DebugType> - <PlatformTarget>AnyCPU</PlatformTarget> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Optimize>False</Optimize> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'MonoTouch|AnyCPU' "> - <DebugSymbols>True</DebugSymbols> - <OutputPath>bin\MonoTouch\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <DebugType>full</DebugType> - <PlatformTarget>AnyCPU</PlatformTarget> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Optimize>False</Optimize> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Signed|AnyCPU'"> - <OutputPath>bin\Signed\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <Optimize>true</Optimize> - <DebugType>pdbonly</DebugType> - <PlatformTarget>x86</PlatformTarget> - <ErrorReport>prompt</ErrorReport> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + <PackageId>ServiceStack.WebHost.Endpoints.Tests</PackageId> + <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute> + <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> + <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> + <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> + <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> + <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute> + <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute> + <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute> </PropertyGroup> <ItemGroup> - <Reference Include="MySql.Data"> - <HintPath>..\..\lib\MySql.Data.dll</HintPath> - </Reference> - <Reference Include="NHibernate"> - <HintPath>..\..\src\ServiceStack.Authentication.NHibernate\bin\Release\NHibernate.dll</HintPath> - </Reference> - <Reference Include="Npgsql"> - <HintPath>..\..\lib\Npgsql.dll</HintPath> - </Reference> - <Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\src\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> - </Reference> - <Reference Include="protobuf-net"> - <HintPath>..\..\src\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll</HintPath> - </Reference> - <Reference Include="ServiceStack.Interfaces"> - <HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath> - </Reference> - <Reference Include="ServiceStack.OrmLite"> - <HintPath>..\..\lib\ServiceStack.OrmLite.dll</HintPath> - </Reference> - <Reference Include="ServiceStack.OrmLite.MySql"> - <HintPath>..\..\lib\ServiceStack.OrmLite.MySql.dll</HintPath> - </Reference> - <Reference Include="ServiceStack.OrmLite.PostgreSQL"> - <HintPath>..\..\lib\ServiceStack.OrmLite.PostgreSQL.dll</HintPath> - </Reference> - <Reference Include="ServiceStack.OrmLite.Sqlite"> - <HintPath>..\..\lib\ServiceStack.OrmLite.Sqlite.dll</HintPath> - </Reference> - <Reference Include="ServiceStack.OrmLite.SqlServer, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\CheckMvc\Bin\ServiceStack.OrmLite.SqlServer.dll</HintPath> - </Reference> - <Reference Include="ServiceStack.Redis, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\lib\ServiceStack.Redis.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.ComponentModel.DataAnnotations" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Drawing" /> - <Reference Include="System.Net" /> - <Reference Include="System.Runtime.Serialization"> - <RequiredTargetFramework>3.0</RequiredTargetFramework> - </Reference> - <Reference Include="System.ServiceModel"> - <RequiredTargetFramework>3.0</RequiredTargetFramework> - </Reference> - <Reference Include="System.Web" /> - <Reference Include="System.Windows.Forms" /> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> + <ProjectReference Include="..\..\src\ServiceStack.Api.OpenApi\ServiceStack.Api.OpenApi.csproj"> + <Project>{5E258282-86A6-4780-AB25-5E458F2E6F70}</Project> + <Name>ServiceStack.Api.OpenApi</Name> + </ProjectReference> + <ProjectReference Include="..\..\src\ServiceStack.Authentication.MongoDb\ServiceStack.Authentication.MongoDb.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack.Authentication.RavenDb\ServiceStack.Authentication.RavenDb.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack.Interfaces\ServiceStack.Interfaces.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack.Client\ServiceStack.Client.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack.Common\ServiceStack.Common.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack\ServiceStack.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack.Server\ServiceStack.Server.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack.HttpClient\ServiceStack.HttpClient.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack.RabbitMq\ServiceStack.RabbitMq.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack.Api.Swagger\ServiceStack.Api.Swagger.csproj" /> + <ProjectReference Include="..\..\src\ServiceStack.ProtoBuf\ServiceStack.ProtoBuf.csproj" /> + <ProjectReference Include="..\ServiceStack.Common.Tests\ServiceStack.Common.Tests.csproj" /> + + <PackageReference Include="ServiceStack.Text" Version="$(Version)" /> + <PackageReference Include="ServiceStack.Redis" Version="$(Version)" /> + <PackageReference Include="ServiceStack.OrmLite" Version="$(Version)" /> + <PackageReference Include="ServiceStack.OrmLite.Sqlite" Version="$(Version)" /> + <PackageReference Include="ServiceStack.OrmLite.SqlServer" Version="$(Version)" /> + <PackageReference Include="ServiceStack.OrmLite.MySql" Version="$(Version)" /> + <PackageReference Include="ServiceStack.Aws" Version="$(Version)" /> + <PackageReference Include="NUnit3TestAdapter" Version="3.13.0" /> + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" /> + <PackageReference Include="NUnit" Version="3.12.0" /> + <PackageReference Include="System.Memory" Version="4.5.4" /> + <PackageReference Include="System.Reflection.TypeExtensions" Version="4.5.0" /> + <PackageReference Include="MongoDB.Bson" Version="2.10.3" /> + <PackageReference Include="MongoDB.Driver" Version="2.10.3" /> + <PackageReference Include="MongoDB.Driver.Core" Version="2.10.3" /> + <PackageReference Include="RavenDB.Client" Version="4.2.102" /> + </ItemGroup> + <PropertyGroup Condition=" '$(TargetFramework)' == 'net461' "> + <DefineConstants>$(DefineConstants);NET45</DefineConstants> + </PropertyGroup> + <ItemGroup Condition=" '$(TargetFramework)' == 'net461' "> + <ProjectReference Include="..\..\src\ServiceStack.NetFramework\ServiceStack.NetFramework.csproj" /> + <ProjectReference Include="..\ServiceStack.ServiceModel.Tests\ServiceStack.ServiceModel.Tests.csproj" /> + <PackageReference Include="System.Data.SQLite.Core" Version="1.0.113.1" /> + <PackageReference Include="Mysql.Data" Version="8.0.20" /> <Reference Include="System.Xml" /> - <Reference Include="Moq"> - <HintPath>..\..\lib\tests\Moq.dll</HintPath> - </Reference> - <Reference Include="Mono.Data.Sqlite"> - <HintPath>..\..\lib\tests\Mono.Data.Sqlite.dll</HintPath> - </Reference> - <Reference Include="ServiceStack.Text"> - <HintPath>..\..\lib\ServiceStack.Text.dll</HintPath> - </Reference> + <Reference Include="System.Data" /> <Reference Include="System.Configuration" /> + <Reference Include="System.Web" /> + <Reference Include="System.Net" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.ServiceModel" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> </ItemGroup> - <ItemGroup> - <Compile Include="AlwaysThrowsService.cs" /> - <Compile Include="AppHostListenerEchoRequestTests.cs" /> - <Compile Include="AppHostHttpListenerLongRunningBaseTests.cs" /> - <Compile Include="AppHostListenerBaseTests.cs" /> - <Compile Include="AppSelfHostTests.cs" /> - <Compile Include="AsyncProgressTests.cs" /> - <Compile Include="AsyncRestClientTests.cs" /> - <Compile Include="AsyncServiceClientTests.cs" /> - <Compile Include="AsyncTaskTests.cs" /> - <Compile Include="AttributeFiltersTest.cs" /> - <Compile Include="AuthTests.cs" /> - <Compile Include="AutoQueryTests.cs" /> - <Compile Include="BufferedRequestTests.cs" /> - <Compile Include="CachedServiceTests.cs" /> - <Compile Include="CompressionTests.cs" /> - <Compile Include="Config.cs" /> - <Compile Include="CustomFormatTests.cs" /> - <Compile Include="HttpErrorSyncTests.cs" /> - <Compile Include="RequestPipelineTests.cs" /> - <Compile Include="NestedServiceTests.cs" /> - <Compile Include="CorsFeaturePluginTests.cs" /> - <Compile Include="CustomServiceRunnerTests.cs" /> - <Compile Include="LicenseUsageTests.cs" /> - <Compile Include="RequestTypedFilterTests.cs" /> - <Compile Include="RoutePriorityTests.cs" /> - <Compile Include="RouteTests.cs" /> - <Compile Include="CustomValidationErrorTests.cs" /> - <Compile Include="EncodingTests.cs" /> - <Compile Include="ExceptionHandling2Tests.cs" /> - <Compile Include="IntegrationTests\MovieSoap11Tests.cs" /> - <Compile Include="RestHandlerTests.cs" /> - <Compile Include="RouteInferenceTests.cs" /> - <Compile Include="RuntimeAttributeTests.cs" /> - <Compile Include="ServerEventTests.cs" /> - <Compile Include="ServiceClientsBuiltInResponseTests.cs" /> - <Compile Include="SessionTests.cs" /> - <Compile Include="Support\Services\EchoService.cs" /> - <Compile Include="Support\Services\TestRestService.cs" /> - <Compile Include="Support\Types\KeyAttribute.cs" /> - <Compile Include="PartialContentResultTests.cs" /> - <Compile Include="ServiceSetupTests.cs" /> - <Compile Include="Support\Services\FailingService.cs" /> - <Compile Include="GetEncodingFromContentTypeTest.cs" /> - <Compile Include="UniqueRequestTests.cs" /> - <Compile Include="SendOneWayTests.cs" /> - <Compile Include="Support\Services\EndpointAccessService.cs" /> - <Compile Include="SwaggerFeatureTests.cs" /> - <Compile Include="CorsFeatureTest.cs" /> - <Compile Include="IntegrationTests\CachedMoviesService.cs" /> - <Compile Include="IntegrationTests\ErrorRestTests.cs" /> - <Compile Include="NewApiTodos.cs" /> - <Compile Include="ProtoBufServiceTests.cs" /> - <Compile Include="SharedDtoTests.cs" /> - <Compile Include="Support\Operations\CustomRequestBinder.cs" /> - <Compile Include="TodoListTests.cs" /> - <Compile Include="CustomerServiceValidationTests.cs" /> - <Compile Include="ExceptionHandlingTests.cs" /> - <Compile Include="HttpResultContentTypeTests.cs" /> - <Compile Include="RemoteEndDropsConnectionTests.cs" /> - <Compile Include="IocServiceTests.cs" /> - <Compile Include="Support\EndpointHandlerBaseTests.cs" /> - <Compile Include="UnitTestExample.cs" /> - <Compile Include="UserServiceValidationTests.cs" /> - <Compile Include="JsonpTests.cs" /> - <Compile Include="Shared\IocService.cs" /> - <Compile Include="CustomRequestDataTests.cs" /> - <Compile Include="HttpResultTests.cs" /> - <Compile Include="IntegrationTests\ResetMovies.cs" /> - <Compile Include="Support\Host\TestConfigAppHostHttpListener.cs" /> - <Compile Include="Support\Operations\CustomFormData.cs" /> - <Compile Include="Support\Services\CustomFormDataService.cs" /> - <Compile Include="AppHostConfigTests.cs" /> - <Compile Include="SyncRestClientTests.cs" /> - <Compile Include="CsvContentTypeFilterTests.cs" /> - <Compile Include="EndpointRestrictionTests.cs" /> - <Compile Include="FileUploadTests.cs" /> - <Compile Include="HttpErrorAsyncTests.cs" /> - <Compile Include="RequestContextTests.cs" /> - <Compile Include="RequestFiltersTests.cs" /> - <Compile Include="Support\DirectServiceClient.cs" /> - <Compile Include="Support\Host\ExampleAppHostHttpListener.cs" /> - <Compile Include="HtmlResultTests.cs" /> - <Compile Include="IntegrationTests\ConfigureDatabase.cs" /> - <Compile Include="IntegrationTests\ExampleConfig.cs" /> - <Compile Include="IntegrationTests\IntegrationTestBase.cs" /> - <Compile Include="IntegrationTests\RestMovie.cs" /> - <Compile Include="IntegrationTests\RestMovieService.cs" /> - <Compile Include="IntegrationTests\MovieRestTests.cs" /> - <Compile Include="IntegrationTests\ResetMovieDatabase.cs" /> - <Compile Include="IntegrationTests\ResetMovieDatabaseService.cs" /> - <Compile Include="KeyValueDataContractDeserializerTests.cs" /> - <Compile Include="MessageSerializationTests.cs" /> - <Compile Include="ServiceHostTestBase.cs" /> - <Compile Include="Support\ServiceClientTestBase.cs" /> - <Compile Include="ServiceClientTests.cs" /> - <Compile Include="ServiceStackHttpHandlerFactoryTests.cs" /> - <Compile Include="Support\Host\TestAppHostHttpListener.cs" /> - <Compile Include="Support\Operations\RequestOfAllTypes.cs" /> - <Compile Include="Support\Operations\RequestOfComplexTypes.cs" /> - <Compile Include="Support\Services\FileUploadService.cs" /> - <Compile Include="Support\Services\HttpErrorService.cs" /> - <Compile Include="Support\Services\RequestFilter.cs" /> - <Compile Include="Support\Services\HeadersService.cs" /> - <Compile Include="Support\Services\GetCustomerService.cs" /> - <Compile Include="Support\Services\HelloService.cs" /> - <Compile Include="Support\Services\TestAsyncService.cs" /> - <Compile Include="Support\Services\InSecureLiveEnvironmentRestriction.cs" /> - <Compile Include="Support\Services\SecureLiveEnvironmentRestriction.cs" /> - <Compile Include="Support\Services\SecureDevEnvironmentRestrictionService.cs" /> - <Compile Include="Support\Services\InsecureDevEnvironmentRestrictionService.cs" /> - <Compile Include="Support\Services\HttpPostXmlAndSecureLocalSubnetRestrictionService.cs" /> - <Compile Include="Support\Services\HttpPostXmlOrSecureLocalSubnetRestrictionService.cs" /> - <Compile Include="Support\Services\SecureLocalSubnetRestrictionService.cs" /> - <Compile Include="Support\Services\InternalRestrictionService.cs" /> - <Compile Include="Support\Services\LocalhostRestrictionService.cs" /> - <Compile Include="Support\Services\LocalSubnetRestrictionService.cs" /> - <Compile Include="Support\Services\NestedService.cs" /> - <Compile Include="ServiceStackHostTests.cs" /> - <Compile Include="Support\Operations\GetCustomers.cs" /> - <Compile Include="Support\Operations\StoreCustomer.cs" /> - <Compile Include="Support\Services\TestServiceBase.cs" /> - <Compile Include="Support\Host\TestAppHost.cs" /> - <Compile Include="Support\Services\TestService.cs" /> - <Compile Include="WebServiceExceptionTests.cs" /> - <Compile Include="WsdlMetadataTests.cs" /> - <Compile Include="OperationTests.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Support\Operations\GetCustomer.cs" /> - <Compile Include="Support\Types\Customer.cs" /> - <Compile Include="XmlMetaDataHandlerTests.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\src\ServiceStack.Api.Swagger\ServiceStack.Api.Swagger.csproj"> - <Project>{01D3F057-7984-498F-8B0A-EB375701E204}</Project> - <Name>ServiceStack.Api.Swagger</Name> - </ProjectReference> - <ProjectReference Include="..\..\src\ServiceStack.Client\ServiceStack.Client.csproj"> - <Project>{c43f583f-abde-4dd4-bbe3-66322817a6ad}</Project> - <Name>ServiceStack.Client</Name> - </ProjectReference> - <ProjectReference Include="..\..\src\ServiceStack.Common\ServiceStack.Common.csproj"> - <Project>{982416DB-C143-4028-A0C3-CF41892D18D3}</Project> - <Name>ServiceStack.Common</Name> - </ProjectReference> - <ProjectReference Include="..\..\src\ServiceStack.ProtoBuf\ServiceStack.ProtoBuf.csproj"> - <Project>{ef36a253-c53f-4bf3-b0ec-4d29211fa67d}</Project> - <Name>ServiceStack.ProtoBuf</Name> - </ProjectReference> - <ProjectReference Include="..\..\src\ServiceStack.RabbitMq\ServiceStack.RabbitMq.csproj"> - <Project>{E940929C-9E76-41CD-BD09-08029FE9B440}</Project> - <Name>ServiceStack.RabbitMq</Name> - </ProjectReference> - <ProjectReference Include="..\..\src\ServiceStack.Server\ServiceStack.Server.csproj"> - <Project>{5a315f92-80d2-4c60-a5a4-22e027ac7e7e}</Project> - <Name>ServiceStack.Server</Name> - </ProjectReference> - <ProjectReference Include="..\..\src\ServiceStack\ServiceStack.csproj"> - <Project>{680A1709-25EB-4D52-A87F-EE03FFD94BAA}</Project> - <Name>ServiceStack</Name> - </ProjectReference> - <ProjectReference Include="..\ServiceStack.Common.Tests\ServiceStack.Common.Tests.csproj"> - <Project>{3FA9197A-462D-44CC-9AB3-61AF414D0B45}</Project> - <Name>ServiceStack.Common.Tests</Name> - </ProjectReference> - <ProjectReference Include="..\ServiceStack.ServiceModel.Tests\ServiceStack.ServiceModel.Tests.csproj"> - <Project>{A5646013-C243-453F-A2B6-3B6870A9637D}</Project> - <Name>ServiceStack.ServiceModel.Tests</Name> - </ProjectReference> + <PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' "> + <DefineConstants>$(DefineConstants);NETCORE</DefineConstants> + </PropertyGroup> + <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' "> + <ProjectReference Include="..\..\src\ServiceStack.Kestrel\ServiceStack.Kestrel.csproj" /> + <PackageReference Include="System.Reflection.TypeExtensions" Version="4.5.0" /> + <PackageReference Include="System.Threading" Version="4.3.0" /> + <PackageReference Include="Microsoft.Data.Sqlite" Version="3.1.4" /> + <PackageReference Include="System.Data.SqlClient" Version="4.8.1" /> </ItemGroup> <ItemGroup> - <Content Include="..\..\lib\sqlite3.dll"> - <Link>sqlite3.dll</Link> + <Content Update="App_Data\customers.json"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> - <Content Include="TestExistingDir\textfile.txt"> + </ItemGroup> + <ItemGroup> + <None Update="TestExistingDir\default.html"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="webpage.forbidden"> + </None> + <None Update="TestExistingDir\textfile.txt"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="webpage.html"> + </None> + <None Update="TestExistingDir\upload.html"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="TestExistingDir\default.html"> + </None> + <None Update="webpage.forbidden"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="TestExistingDir\upload.html"> + </None> + <None Update="webpage.html"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - </ItemGroup> - <ItemGroup> - <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> - <Visible>False</Visible> - <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> - <Install>false</Install> - </BootstrapperPackage> - <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> - <Visible>False</Visible> - <ProductName>.NET Framework 3.5 SP1</ProductName> - <Install>true</Install> - </BootstrapperPackage> - <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> - <Visible>False</Visible> - <ProductName>Windows Installer 3.1</ProductName> - <Install>true</Install> - </BootstrapperPackage> - </ItemGroup> - <ItemGroup> - <Folder Include="Issues\" /> - <Folder Include="ServiceModel\" /> - </ItemGroup> - <ItemGroup> - <None Include="App.config" /> - <None Include="packages.config" /> - <None Include="README.md" /> + </None> </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <Import Project="$(SolutionDir)\.nuget\NuGet.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. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> </Project> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStack.WebHost.Endpoints.Tests.csproj.user b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStack.WebHost.Endpoints.Tests.csproj.user index 514f85af64e..aa9b7982706 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStack.WebHost.Endpoints.Tests.csproj.user +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStack.WebHost.Endpoints.Tests.csproj.user @@ -1,14 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> - <PublishUrlHistory /> - <InstallUrlHistory /> - <SupportUrlHistory /> - <UpdateUrlHistory /> - <BootstrapperUrlHistory /> - <ErrorReportUrlHistory /> - <FallbackCulture>en-US</FallbackCulture> - <VerifyUploadedFiles>false</VerifyUploadedFiles> - <ProjectView>ProjectFiles</ProjectView> + <ActiveDebugProfile>IIS Express</ActiveDebugProfile> + <ShowAllFiles>false</ShowAllFiles> </PropertyGroup> </Project> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStackHostTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStackHostTests.cs index e1d16686c7c..aa5635a1d8b 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStackHostTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStackHostTests.cs @@ -9,13 +9,13 @@ public class ServiceStackHostTests { ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new TestAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStackHttpHandlerFactoryTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStackHttpHandlerFactoryTests.cs index 8019f7ec3cb..125f5726fb5 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStackHttpHandlerFactoryTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ServiceStackHttpHandlerFactoryTests.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; +using ServiceStack.Host; using ServiceStack.Host.Handlers; using ServiceStack.Metadata; using ServiceStack.Testing; @@ -13,15 +14,24 @@ public class ServiceStackHttpHandlerFactoryTests { ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { - appHost = new BasicAppHost(GetType().Assembly).Init(); - HostContext.CatchAllHandlers.Add(new PredefinedRoutesFeature().ProcessRequest); - HostContext.CatchAllHandlers.Add(new MetadataFeature().ProcessRequest); + appHost = new BasicAppHost(GetType().Assembly) + { + ConfigureAppHost = host => + { + host.Plugins.Add(new PredefinedRoutesFeature()); +#if !NETCORE + host.Plugins.Add(new SoapFormat()); +#endif + host.CatchAllHandlers.Add(new PredefinedRoutesFeature().ProcessRequest); + host.CatchAllHandlers.Add(new MetadataFeature().ProcessRequest); + } + }.Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -30,8 +40,10 @@ public void TestFixtureTearDown() readonly Dictionary<string, Type> pathInfoMap = new Dictionary<string, Type> { {"Metadata", typeof(IndexMetadataHandler)}, +#if !NETCORE {"Soap11", typeof(Soap11MessageReplyHttpHandler)}, {"Soap12", typeof(Soap12MessageReplyHttpHandler)}, +#endif {"Json/Reply", typeof(JsonReplyHandler)}, {"Json/OneWay", typeof(JsonOneWayHandler)}, @@ -45,11 +57,13 @@ public void TestFixtureTearDown() {"Jsv/OneWay", typeof(JsvOneWayHandler)}, {"Jsv/Metadata", typeof(JsvMetadataHandler)}, +#if !NETCORE {"Soap11/Wsdl", typeof(Soap11WsdlMetadataHandler)}, {"Soap11/Metadata", typeof(Soap11MetadataHandler)}, {"Soap12/Wsdl", typeof(Soap12WsdlMetadataHandler)}, {"Soap12/Metadata", typeof(Soap12MetadataHandler)}, +#endif }; [Test] @@ -58,21 +72,29 @@ public void Resolves_the_right_handler_for_expexted_paths() foreach (var item in pathInfoMap) { var expectedType = item.Value; - var handler = HttpHandlerFactory.GetHandlerForPathInfo(null, item.Key, null, null); + var httpReq = new BasicHttpRequest + { + PathInfo = item.Key, + }; + var handler = HttpHandlerFactory.GetHandlerForPathInfo(httpReq, null); Assert.That(handler.GetType(), Is.EqualTo(expectedType)); } } [Test] - public void Resolves_the_right_handler_for_case_insensitive_expexted_paths() + public void Resolves_the_right_handler_for_case_insensitive_expected_paths() { foreach (var item in pathInfoMap) { var expectedType = item.Value; var lowerPathInfo = item.Key.ToLower(); lowerPathInfo.Print(); - var handler = HttpHandlerFactory.GetHandlerForPathInfo(null, lowerPathInfo, null, null); - Assert.That(handler.GetType(), Is.EqualTo(expectedType)); + var httpReq = new BasicHttpRequest + { + PathInfo = lowerPathInfo, + }; + var handler = HttpHandlerFactory.GetHandlerForPathInfo(httpReq, null); + Assert.That(handler?.GetType(), Is.EqualTo(expectedType)); } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/SessionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/SessionTests.cs index a013a5f315f..31ebec32355 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/SessionTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/SessionTests.cs @@ -1,11 +1,17 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt using System; +using System.Net; +using System.Runtime.CompilerServices; using Funq; using NUnit.Framework; -using ServiceStack.Auth; +using ServiceStack.Caching; +using ServiceStack.Data; +using ServiceStack.OrmLite; +using ServiceStack.Testing; +using ServiceStack.Text; namespace ServiceStack.WebHost.Endpoints.Tests { @@ -26,7 +32,7 @@ public class Cart public int Qty { get; set; } } - public class SessionTypedIncr : IReturn<AuthUserSession> {} + public class SessionTypedIncr : IReturn<AuthUserSession> { } public class SessionService : Service { @@ -69,7 +75,7 @@ public class SessionTests { private SessionAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new SessionAppHost(); @@ -77,7 +83,7 @@ public void TestFixtureSetUp() appHost.Start(Config.AbsoluteBaseUri); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -85,11 +91,28 @@ public void TestFixtureTearDown() public class SessionAppHost : AppHostHttpListenerBase { - public SessionAppHost() : base(typeof(SessionTests).Name, typeof(SessionTests).Assembly) {} + public SessionAppHost() : base(typeof(SessionTests).Name, typeof(SessionTests).Assembly) { } + + static bool UseOrmLiteCache = false; public override void Configure(Container container) { Plugins.Add(new SessionFeature()); + + SetConfig(new HostConfig + { + AllowSessionIdsInHttpParams = true, + }); + + if (UseOrmLiteCache) + { + container.Register<IDbConnectionFactory>(c => + new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)); + + container.RegisterAs<OrmLiteCacheClient, ICacheClient>(); + + container.Resolve<ICacheClient>().InitSchema(); + } } } @@ -135,13 +158,19 @@ public void Different_clients_have_different_session_cart_qty() Assert.That(altClient.Get(request).Qty, Is.EqualTo(1)); } + public static T Log<T>(T item, [CallerMemberName] string caller = null) + { + "{0}: {1}".Print(caller, item.Dump()); + return item; + } + [Test] public void Can_increment_typed_session_tag() { var client = new JsonServiceClient(Config.AbsoluteBaseUri); - Assert.That(client.Get(new SessionTypedIncr()).Tag, Is.EqualTo(1)); - Assert.That(client.Get(new SessionTypedIncr()).Tag, Is.EqualTo(2)); + Assert.That(Log(client.Get(new SessionTypedIncr())).Tag, Is.EqualTo(1)); + Assert.That(Log(client.Get(new SessionTypedIncr())).Tag, Is.EqualTo(2)); } [Test] @@ -150,9 +179,92 @@ public void Different_clients_have_different_typed_session_tag() var client = new JsonServiceClient(Config.AbsoluteBaseUri); var altClient = new JsonServiceClient(Config.AbsoluteBaseUri); - Assert.That(client.Get(new SessionTypedIncr()).Tag, Is.EqualTo(1)); - Assert.That(client.Get(new SessionTypedIncr()).Tag, Is.EqualTo(2)); - Assert.That(altClient.Get(new SessionTypedIncr()).Tag, Is.EqualTo(1)); + Assert.That(Log(client.Get(new SessionTypedIncr())).Tag, Is.EqualTo(1)); + Assert.That(Log(client.Get(new SessionTypedIncr())).Tag, Is.EqualTo(2)); + Assert.That(Log(altClient.Get(new SessionTypedIncr())).Tag, Is.EqualTo(1)); + Assert.That(Log(altClient.Get(new SessionTypedIncr())).Tag, Is.EqualTo(2)); + + Assert.That(client.Get(new SessionTypedIncr()).Tag, Is.EqualTo(3)); + Assert.That(altClient.Get(new SessionTypedIncr()).Tag, Is.EqualTo(3)); + } + + [Test] + public void Can_access_session_with_HTTP_Headers() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + Assert.That(Log(client.Get(new SessionTypedIncr())).Tag, Is.EqualTo(1)); + + var cookies = client.GetCookieValues(); + var sessionId = cookies["ss-id"]; + sessionId.Print(); + + var altClient = new JsonServiceClient(Config.AbsoluteBaseUri) + { + Headers = { + { "X-ss-id", sessionId } + } + }; + + Assert.That(Log(altClient.Get(new SessionTypedIncr())).Tag, Is.EqualTo(2)); + } + + [Test] + public void Can_access_session_with_QueryString() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + Assert.That(Log(client.Get(new SessionTypedIncr())).Tag, Is.EqualTo(1)); + + var cookies = client.GetCookieValues(); + var sessionId = cookies["ss-id"]; + + var response = Config.AbsoluteBaseUri + .CombineWith(new SessionTypedIncr().ToGetUrl()) + .AddQueryParam("ss-id", sessionId) + .GetJsonFromUrl() + .FromJson<AuthUserSession>(); + + Assert.That(response.Tag, Is.EqualTo(2)); + } + + [Test] + public void Can_override_existing_session_with_QueryString() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + Assert.That(Log(client.Get(new SessionTypedIncr())).Tag, Is.EqualTo(1)); + + var cookies = client.GetCookieValues(); + var sessionId = cookies["ss-id"]; + + var cookieContainer = new CookieContainer(); + cookieContainer.Add(new Uri(Config.AbsoluteBaseUri), + new Cookie + { + Name = "ss-id", + Value = "some-other-id", + Domain = new Uri(Config.AbsoluteBaseUri).Host, + }); + + var response = Config.AbsoluteBaseUri + .CombineWith(new SessionTypedIncr().ToGetUrl()) + .AddQueryParam("ss-id", sessionId) + .GetJsonFromUrl(req => req.CookieContainer = cookieContainer) + .FromJson<AuthUserSession>(); + + Assert.That(response.Tag, Is.EqualTo(2)); + } + + [Test] + public void Can_mock_IntegrationTest_Session_with_Request() + { + var mockRequest = new MockHttpRequest + { + Items = { [Keywords.Session] = new AuthUserSession { UserName = "Mocked" } } + }; + + using (var service = HostContext.ResolveService<SessionService>(mockRequest)) + { + Assert.That(service.GetSession().UserName, Is.EqualTo("Mocked")); + } } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Shared/IocService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Shared/IocService.cs index 0dc562353cd..2d5761bd35e 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Shared/IocService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Shared/IocService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Funq; using ServiceStack.Configuration; @@ -9,9 +10,9 @@ namespace ServiceStack.Shared.Tests { public static class IocShared { - public static void Configure(ServiceStackHost appHost) - { - var container = appHost.Container; + public static void Configure(ServiceStackHost appHost) + { + var container = appHost.Container; container.Adapter = new IocAdapter(); container.Register(c => new FunqDepCtor()); @@ -21,6 +22,7 @@ public static void Configure(ServiceStackHost appHost) container.Register(c => new FunqSingletonScope()).ReusedWithin(ReuseScope.Default); container.Register(c => new FunqRequestScope()).ReusedWithin(ReuseScope.Request); container.Register(c => new FunqNoneScope()).ReusedWithin(ReuseScope.None); + container.Register(c => new FunqInjectRequest()).ReusedWithin(ReuseScope.None); container.Register(c => new FunqRequestScopeDepDisposableProperty()).ReusedWithin(ReuseScope.Request); container.Register(c => new FunqSingletonScopeDisposable()).ReusedWithin(ReuseScope.Default); @@ -66,30 +68,47 @@ public void Release(object instance) public class FunqRequestScope { public static int Count = 0; - public FunqRequestScope() { Count++; } + public FunqRequestScope() { Interlocked.Increment(ref Count); } } public class FunqSingletonScope { public static int Count = 0; - public FunqSingletonScope() { Count++; } + public FunqSingletonScope() { Interlocked.Increment(ref Count); } } public class FunqNoneScope { public static int Count = 0; - public FunqNoneScope() { Count++; } + public FunqNoneScope() { Interlocked.Increment(ref Count); } + } + + public class FunqInjectRequest : IRequiresRequest + { + public FunqInjectRequest() + { + this.SecondLevel = new FunqInjectRequest2(); + } + + public IRequest Request { get; set; } + + public FunqInjectRequest2 SecondLevel { get; set; } + } + + public class FunqInjectRequest2 : IRequiresRequest + { + public IRequest Request { get; set; } } public class FunqRequestScopeDisposable : IDisposable { public static int Count = 0; public static int DisposeCount = 0; - public FunqRequestScopeDisposable() { Count++; } + public FunqRequestScopeDisposable() { Interlocked.Increment(ref Count); } public void Dispose() { - DisposeCount++; + Interlocked.Increment(ref DisposeCount); } } @@ -97,11 +116,11 @@ public class FunqSingletonScopeDisposable : IDisposable { public static int Count = 0; public static int DisposeCount = 0; - public FunqSingletonScopeDisposable() { Count++; } + public FunqSingletonScopeDisposable() { Interlocked.Increment(ref Count); } public void Dispose() { - DisposeCount++; + Interlocked.Increment(ref DisposeCount); } } @@ -109,11 +128,11 @@ public class FunqNoneScopeDisposable : IDisposable { public static int Count = 0; public static int DisposeCount = 0; - public FunqNoneScopeDisposable() { Count++; } + public FunqNoneScopeDisposable() { Interlocked.Increment(ref Count); } public void Dispose() { - DisposeCount++; + Interlocked.Increment(ref DisposeCount); } } @@ -121,16 +140,16 @@ public class FunqRequestScopeDepDisposableProperty : IDisposable { public static int Count = 0; public static int DisposeCount = 0; - public FunqRequestScopeDepDisposableProperty() { Count++; } - public void Dispose() { DisposeCount++; } + public FunqRequestScopeDepDisposableProperty() { Interlocked.Increment(ref Count); } + public void Dispose() { Interlocked.Increment(ref DisposeCount); } } public class AltRequestScopeDepDisposableProperty : IDisposable { public static int Count = 0; public static int DisposeCount = 0; - public AltRequestScopeDepDisposableProperty() { Count++; } - public void Dispose() { DisposeCount++; } + public AltRequestScopeDepDisposableProperty() { Interlocked.Increment(ref Count); } + public void Dispose() { Interlocked.Increment(ref DisposeCount); } } public class FunqDepCtor { } @@ -142,12 +161,12 @@ public class AltDepProperty { } public class FunqDepDisposableProperty : IDisposable { public static int DisposeCount = 0; - public void Dispose() { DisposeCount++; } + public void Dispose() { Interlocked.Increment(ref DisposeCount); } } public class AltDepDisposableProperty : IDisposable { public static int DisposeCount = 0; - public void Dispose() { DisposeCount++; } + public void Dispose() { Interlocked.Increment(ref DisposeCount); } } [Route("/ioc")] @@ -188,9 +207,9 @@ public override void Execute(IRequest req, IResponse res, object requestDto) var response = new IocResponse(); var deps = new object[] { - FunqDepProperty, FunqDepDisposableProperty, - AltDepProperty, AltDepDisposableProperty - }; + FunqDepProperty, FunqDepDisposableProperty, + AltDepProperty, AltDepDisposableProperty + }; foreach (var dep in deps) { @@ -281,10 +300,10 @@ public object Any(Ioc request) var response = new IocResponse(); var deps = new object[] { - funqDepCtor, altDepCtor, - FunqDepProperty, FunqDepDisposableProperty, - AltDepProperty, AltDepDisposableProperty - }; + funqDepCtor, altDepCtor, + FunqDepProperty, FunqDepDisposableProperty, + AltDepProperty, AltDepDisposableProperty + }; foreach (var dep in deps) { @@ -315,13 +334,13 @@ public async Task<IocResponse> Any(ActionAttrAsync request) await Task.Delay(10); return Request.Items["action-attr"] as IocResponse; } - + public static int DisposeCount = 0; public static bool ThrowErrors = false; public void Dispose() { - DisposeCount++; + Interlocked.Increment(ref DisposeCount); } } @@ -347,6 +366,8 @@ public IocScopeResponse() public Dictionary<string, int> Results { get; set; } + public int InjectsRequest { get; set; } + public ResponseStatus ResponseStatus { get; set; } } @@ -364,10 +385,7 @@ public void RequestFilter(IRequest req, IResponse res, object requestDto) { } - public IHasRequestFilter Copy() - { - return (IHasRequestFilter)this.MemberwiseClone(); - } + public IRequestFilterBase Copy() => (IRequestFilterBase)this.MemberwiseClone(); } [IocRequestFilter] @@ -376,6 +394,7 @@ public class IocScopeService : IService, IDisposable public FunqRequestScope FunqRequestScope { get; set; } public FunqSingletonScope FunqSingletonScope { get; set; } public FunqNoneScope FunqNoneScope { get; set; } + public FunqInjectRequest FunqInjectRequest { get; set; } public FunqRequestScopeDepDisposableProperty FunqRequestScopeDepDisposableProperty { get; set; } public AltRequestScopeDepDisposableProperty AltRequestScopeDepDisposableProperty { get; set; } @@ -384,12 +403,16 @@ public object Any(IocScope request) if (request.Throw) throw new Exception("Exception requested by user"); - var response = new IocScopeResponse { + var response = new IocScopeResponse + { Results = { { typeof(FunqSingletonScope).Name, FunqSingletonScope.Count }, { typeof(FunqRequestScope).Name, FunqRequestScope.Count }, { typeof(FunqNoneScope).Name, FunqNoneScope.Count }, - }, + }, + InjectsRequest = FunqInjectRequest.Request != null + ? 1 + (FunqInjectRequest.SecondLevel.Request != null ? 1 : 0) + : 0, }; return response; @@ -406,8 +429,8 @@ public async Task<object> Any(IocScopeAsync request) public void Dispose() { - DisposedCount++; - } + Interlocked.Increment(ref DisposedCount); + } } public class IocDispose : IReturn<IocDisposeResponse> @@ -470,7 +493,7 @@ public async Task<object> Any(IocDisposeAsync request) public void Dispose() { - DisposeCount++; + Interlocked.Increment(ref DisposeCount); } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/SharedDtoTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/SharedDtoTests.cs index 9a97b30b531..ce0c488998c 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/SharedDtoTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/SharedDtoTests.cs @@ -7,7 +7,7 @@ namespace ServiceStack.WebHost.Endpoints.Tests * Leave commented out - this pollutes and causes many failures in other tests */ - //[Explicit("This isn't supported at the moment.")] + //[Ignore("This isn't supported at the moment.")] //public class SharedDtoTests //{ // [Route("/shareddto")] @@ -49,7 +49,7 @@ namespace ServiceStack.WebHost.Endpoints.Tests // AppHost appHost; - // [TestFixtureSetUp] + // [OneTimeSetUp] // public void OnTestFixtureSetUp() // { // appHost = new AppHost(); @@ -57,7 +57,7 @@ namespace ServiceStack.WebHost.Endpoints.Tests // appHost.Start(ListeningOn); // } - // [TestFixtureTearDown] + // [OneTimeTearDown] // public void OnTestFixtureTearDown() // { // appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/SpanFormatTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/SpanFormatTests.cs new file mode 100644 index 00000000000..49fcdc8e2c8 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/SpanFormatTests.cs @@ -0,0 +1,103 @@ +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Formats; +using ServiceStack.Text; +using ServiceStack.WebHost.Endpoints.Tests.Support.Host; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class CreateMovies : IReturn<CreateMovies> + { + public List<Tests.Support.Host.Movie> Movies { get; set; } + } + + public class CreateMoviesAsync : IReturn<CreateMoviesAsync> + { + public List<Tests.Support.Host.Movie> Movies { get; set; } + } + + public class CreateMoviesService : Service + { + public object Any(CreateMovies request) => request; + + public async Task<object> Any(CreateMoviesAsync request) + { + await Task.Yield(); + return request; + } + } + + public class SpanFormatTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(SpanFormatTests), typeof(SpanFormatTests).Assembly) {} + + public override void Configure(Container container) + { +#if NETCORE + ServiceStack.Memory.NetCoreMemory.Configure(); +#endif + + if (!Plugins.Any(x => x is SpanFormats)) //Registered by default + Plugins.Add(new SpanFormats()); + } + } + + private readonly ServiceStackHost appHost; + + public SpanFormatTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() + { + appHost.Dispose(); + DefaultMemory.Configure(); + } + + [Test] + public void Does_deserialize_json_RequestBody() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + var response = client.Post(new CreateMovies { + Movies = ResetMoviesService.Top5Movies + }); + + Assert.That(response.Movies, Is.EquivalentTo(ResetMoviesService.Top5Movies)); + + var responseAsync = client.Post(new CreateMoviesAsync { + Movies = ResetMoviesService.Top5Movies + }); + + Assert.That(responseAsync.Movies, Is.EquivalentTo(ResetMoviesService.Top5Movies)); + } + + [Test] + public async Task Does_deserialize_json_RequestBody_Async() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + var response = await client.PostAsync(new CreateMovies { + Movies = ResetMoviesService.Top5Movies + }); + + Assert.That(response.Movies, Is.EquivalentTo(ResetMoviesService.Top5Movies)); + + var responseAsync = await client.PostAsync(new CreateMoviesAsync { + Movies = ResetMoviesService.Top5Movies + }); + + Assert.That(responseAsync.Movies, Is.EquivalentTo(ResetMoviesService.Top5Movies)); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/StrictModeTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/StrictModeTests.cs new file mode 100644 index 00000000000..5c0a01357ca --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/StrictModeTests.cs @@ -0,0 +1,116 @@ +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class ReturnsValueType : IReturn<string> { } + + public class BadService : Service + { + public object Any(ReturnsValueType request) => 1; + } + + [TestFixture] + public class StrictModeTests + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(StrictModeTests), typeof(BadService).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig { StrictMode = true }); + } + } + + private readonly ServiceStackHost appHost; + + public StrictModeTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Returning_ValueTime_throws_StrictModeException() + { + var client = new JsonServiceClient(Config.ListeningOn); + + try + { + var response = client.Get(new ReturnsValueType()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(StrictModeException))); + } + } + } + + [TestFixture] + public class StrictModeAppHostTests + { + class BadUserSessionAppHost : AppSelfHostBase + { + public BadUserSessionAppHost() + : base(nameof(StrictModeTests), typeof(BadService).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig + { + StrictMode = true + }); + + Plugins.Add(new AuthFeature( + () => new BadUserSession(), new IAuthProvider[] { + new CredentialsAuthProvider(), + })); + } + } + + public class BadUserSession : AuthUserSession + { + public BadUserSession CyclicalDep { get; set; } + + public BadUserSession() + { + CyclicalDep = this; + } + } + + [Test] + public void Does_recognize_Cyclical_Deps() + { + Assert.That(TypeSerializer.HasCircularReferences(new BadUserSession())); + } + + [Test] + public void Using_UserSession_with_Cyclical_deps_throws_StrictModeException() + { + using (var appHost = new BadUserSessionAppHost()) + { + try + { + appHost + .Init() + .Start(Config.ListeningOn); //.NET Core has delayed initialization + Assert.Fail("Should throw"); + } + catch (StrictModeException ex) + { + Assert.That(ex.ParamName, Is.EqualTo("sessionFactory")); + Assert.That(ex.Code, Is.EqualTo(StrictModeCodes.CyclicalUserSession)); + } + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/DirectServiceClient.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/DirectServiceClient.cs index d616194f9a7..2f07106bc1d 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/DirectServiceClient.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/DirectServiceClient.cs @@ -2,11 +2,10 @@ using System.Collections.Generic; using System.IO; using System.Net; +using System.Threading; using System.Threading.Tasks; using ServiceStack.Host; using ServiceStack.Testing; -using ServiceStack.Text; -using ServiceStack.Web; namespace ServiceStack.WebHost.Endpoints.Tests.Support { @@ -14,12 +13,18 @@ public class DirectServiceClient : IServiceClient, IRestClient { ServiceController ServiceController { get; set; } - readonly MockHttpRequest httpReq = new MockHttpRequest(); - readonly MockHttpResponse httpRes = new MockHttpResponse(); + private readonly MockHttpRequest httpReq; + private readonly MockHttpResponse httpRes; + + public int Version { get; set; } + public string SessionId { get; set; } + public string BearerToken { get; set; } public DirectServiceClient(ServiceController serviceController) { this.ServiceController = serviceController; + httpReq = new MockHttpRequest(); + httpRes = new MockHttpResponse(httpReq); } public void SendOneWay(object requestDto) @@ -32,9 +37,15 @@ public void SendOneWay(string relativeOrAbsoluteUri, object requestDto) ServiceController.Execute(requestDto); } + public void SendAllOneWay(IEnumerable<object> requests) + { + throw new NotImplementedException(); + } + private bool ApplyRequestFilters<TResponse>(object request) { - if (HostContext.ApplyRequestFilters(httpReq, httpRes, request)) + HostContext.ApplyRequestFiltersAsync(httpReq, httpRes, request).Wait(); + if (httpRes.IsClosed) { ThrowIfError<TResponse>(httpRes); return true; @@ -55,7 +66,7 @@ private void ThrowIfError<TResponse>(MockHttpResponse httpRes) try { var deserializer = HostContext.ContentTypes.GetStreamDeserializer(httpReq.ResponseContentType); - webEx.ResponseDto = deserializer(typeof(TResponse), new MemoryStream(httpRes.ReadAsBytes())); + webEx.ResponseDto = deserializer(typeof(TResponse), httpRes.ReadAsBytes().InMemoryStream()); } catch (Exception ex) { @@ -68,7 +79,8 @@ private void ThrowIfError<TResponse>(MockHttpResponse httpRes) private bool ApplyResponseFilters<TResponse>(object response) { - if (HostContext.ApplyResponseFilters(httpReq, httpRes, response)) + HostContext.ApplyResponseFiltersAsync(httpReq, httpRes, response).Wait(); + if (httpRes.IsClosed) { ThrowIfError<TResponse>(httpRes); return true; @@ -76,41 +88,17 @@ private bool ApplyResponseFilters<TResponse>(object response) return false; } - public TResponse Send<TResponse>(object request) - { - httpReq.HttpMethod = HttpMethods.Post; - - if (ApplyRequestFilters<TResponse>(request)) return default(TResponse); - - httpReq.HttpMethod = HttpMethods.Post; - var response = ServiceController.Execute(request, httpReq); - - if (ApplyResponseFilters<TResponse>(response)) return (TResponse)response; - - return (TResponse)response; - } - - public TResponse Send<TResponse>(IReturn<TResponse> request) - { - throw new NotImplementedException(); - } - - public void Send(IReturnVoid request) - { - throw new NotImplementedException(); - } - public TResponse Patch<TResponse>(string relativeOrAbsoluteUrl, object requestDto) { throw new NotImplementedException(); } - public void CustomMethod(string httpVerb, IReturnVoid requestDto) + public TResponse Send<TResponse>(string httpMethod, string relativeOrAbsoluteUrl, object request) { throw new NotImplementedException(); } - public HttpWebResponse CustomMethod(string httpVerb, object requestDto) + public void CustomMethod(string httpVerb, IReturnVoid requestDto) { throw new NotImplementedException(); } @@ -125,48 +113,47 @@ public TResponse CustomMethod<TResponse>(string httpVerb, object requestDto) throw new NotImplementedException(); } - public HttpWebResponse Head(IReturn requestDto) + TResponse PostFile<TResponse>(string relativeOrAbsoluteUrl, FileInfo fileToUpload, string mimeType) { throw new NotImplementedException(); } - public HttpWebResponse Head(object requestDto) + public TResponse PostFile<TResponse>(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, string mimeType) { throw new NotImplementedException(); } - public HttpWebResponse Head(string relativeOrAbsoluteUrl) + public TResponse PostFileWithRequest<TResponse>( + Stream fileToUpload, string fileName, object request, string fieldName = "upload") { throw new NotImplementedException(); } - TResponse PostFile<TResponse>(string relativeOrAbsoluteUrl, FileInfo fileToUpload, string mimeType) + public TResponse Get<TResponse>(IReturn<TResponse> requestDto) { throw new NotImplementedException(); } - public TResponse PostFile<TResponse>(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, string mimeType) + public TResponse Get<TResponse>(object requestDto) { throw new NotImplementedException(); } - public TResponse PostFileWithRequest<TResponse>( - Stream fileToUpload, string fileName, object request, string fieldName = "upload") + public void AddHeader(string name, string value) { throw new NotImplementedException(); } - public HttpWebResponse Get(object request) + public void ClearCookies() { - throw new NotImplementedException(); } - public TResponse Get<TResponse>(IReturn<TResponse> requestDto) + public Dictionary<string, string> GetCookieValues() { - throw new NotImplementedException(); + return new Dictionary<string, string>(); } - public TResponse Get<TResponse>(object requestDto) + public void SetCookie(string name, string value, TimeSpan? expiresIn = null) { throw new NotImplementedException(); } @@ -207,11 +194,6 @@ public void Delete(IReturnVoid requestDto) throw new NotImplementedException(); } - public HttpWebResponse Delete(object requestDto) - { - throw new NotImplementedException(); - } - public TResponse Delete<TResponse>(IReturn<TResponse> request) { throw new NotImplementedException(); @@ -232,11 +214,6 @@ public void Post(IReturnVoid requestDto) throw new NotImplementedException(); } - public HttpWebResponse Post(object requestDto) - { - throw new NotImplementedException(); - } - public TResponse Post<TResponse>(IReturn<TResponse> requestDto) { throw new NotImplementedException(); @@ -257,11 +234,6 @@ public void Put(IReturnVoid requestDto) throw new NotImplementedException(); } - public HttpWebResponse Put(object requestDto) - { - throw new NotImplementedException(); - } - public TResponse Put<TResponse>(IReturn<TResponse> requestDto) { throw new NotImplementedException(); @@ -282,22 +254,80 @@ public void Patch(IReturnVoid requestDto) throw new NotImplementedException(); } - public HttpWebResponse Patch(object requestDto) + public TResponse Patch<TResponse>(IReturn<TResponse> requestDto) { throw new NotImplementedException(); } - public TResponse Patch<TResponse>(IReturn<TResponse> requestDto) + public TResponse Patch<TResponse>(object requestDto) { throw new NotImplementedException(); } - public TResponse Patch<TResponse>(object requestDto) + public void SetCredentials(string userName, string password) + { + throw new NotImplementedException(); + } + + public void CancelAsync() + { + throw new NotImplementedException(); + } + + public void Dispose() { } + public TResponse PostFileWithRequest<TResponse>(string relativeOrAbsoluteUrl, FileInfo fileToUpload, object request, string fieldName = "upload") + { + throw new NotImplementedException(); + } + + public TResponse PostFileWithRequest<TResponse>(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, object request, string fieldName = "upload") + { + throw new NotImplementedException(); + } + + public TResponse PostFilesWithRequest<TResponse>(object request, IEnumerable<UploadFile> files) + { + throw new NotImplementedException(); + } + + public TResponse PostFilesWithRequest<TResponse>(string relativeOrAbsoluteUrl, object request, IEnumerable<UploadFile> files) { throw new NotImplementedException(); } - public Task<TResponse> SendAsync<TResponse>(object requestDto) + public TResponse Send<TResponse>(object request) + { + httpReq.HttpMethod = HttpMethods.Post; + httpReq.Dto = request; + + if (ApplyRequestFilters<TResponse>(request)) return default(TResponse); + + this.PopulateRequestMetadata(request); + + httpReq.HttpMethod = HttpMethods.Post; + var response = ServiceController.Execute(request, httpReq); + + if (ApplyResponseFilters<TResponse>(response)) return (TResponse)response; + + return (TResponse)response; + } + + public List<TResponse> SendAll<TResponse>(IEnumerable<object> requests) + { + throw new NotImplementedException(); + } + + public void Publish(object requestDto) + { + SendOneWay(requestDto); + } + + public void PublishAll(IEnumerable<object> requestDtos) + { + throw new NotImplementedException(); + } + + public Task<TResponse> SendAsync<TResponse>(object requestDto, CancellationToken token = default) { var tcs = new TaskCompletionSource<TResponse>(); var response = default(TResponse); @@ -307,7 +337,7 @@ public Task<TResponse> SendAsync<TResponse>(object requestDto) { if (ApplyRequestFilters<TResponse>(requestDto)) { - tcs.SetResult(default(TResponse)); + tcs.SetResult(default(TResponse)); return tcs.Task; } } @@ -345,123 +375,138 @@ public Task<TResponse> SendAsync<TResponse>(object requestDto) } } - public void SetCredentials(string userName, string password) + public Task<List<TResponse>> SendAllAsync<TResponse>(IEnumerable<object> requests, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> GetAsync<TResponse>(IReturn<TResponse> requestDto) + public Task PublishAsync(object requestDto, CancellationToken token = default) + { + return SendAsync<byte[]>(requestDto, token); + } + + public Task PublishAllAsync(IEnumerable<object> requestDtos, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> GetAsync<TResponse>(object requestDto) + public Task<TResponse> GetAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> GetAsync<TResponse>(string relativeOrAbsoluteUrl) + public Task<TResponse> GetAsync<TResponse>(object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task GetAsync(IReturnVoid requestDto) + public Task GetAsync(IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> DeleteAsync<TResponse>(IReturn<TResponse> requestDto) + public Task<TResponse> DeleteAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> DeleteAsync<TResponse>(object requestDto) + public Task<TResponse> DeleteAsync<TResponse>(object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> DeleteAsync<TResponse>(string relativeOrAbsoluteUrl) + public Task DeleteAsync(IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task DeleteAsync(IReturnVoid requestDto) + public Task<TResponse> PostAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> PostAsync<TResponse>(IReturn<TResponse> requestDto) + public Task<TResponse> PostAsync<TResponse>(object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> PostAsync<TResponse>(object requestDto) + public Task PostAsync(IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> PostAsync<TResponse>(string relativeOrAbsoluteUrl, object request) + public Task<TResponse> PutAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task PostAsync(IReturnVoid requestDto) + public Task<TResponse> PutAsync<TResponse>(object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> PutAsync<TResponse>(IReturn<TResponse> requestDto) + public Task PutAsync(IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> PutAsync<TResponse>(object requestDto) + public Task<TResponse> PatchAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> PutAsync<TResponse>(string relativeOrAbsoluteUrl, object request) + public Task<TResponse> PatchAsync<TResponse>(object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task PutAsync(IReturnVoid requestDto) + public Task PatchAsync(IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, IReturn<TResponse> requestDto) + public Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, IReturn<TResponse> requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, object requestDto) + public Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, object requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public Task CustomMethodAsync(string httpVerb, IReturnVoid requestDto) + public Task CustomMethodAsync(string httpVerb, IReturnVoid requestDto, CancellationToken token = default) { throw new NotImplementedException(); } - public void CancelAsync() + public Task<TResponse> GetAsync<TResponse>(string relativeOrAbsoluteUrl, CancellationToken token = default) { throw new NotImplementedException(); } - public void SendAsync<TResponse>(object requestDto, Action<TResponse> onSuccess, Action<TResponse, Exception> onError) + public Task<TResponse> DeleteAsync<TResponse>(string relativeOrAbsoluteUrl, CancellationToken token = default) { throw new NotImplementedException(); } - public void Dispose() { } - public TResponse PostFileWithRequest<TResponse>(string relativeOrAbsoluteUrl, FileInfo fileToUpload, object request, string fieldName = "upload") + public Task<TResponse> PostAsync<TResponse>(string relativeOrAbsoluteUrl, object request, CancellationToken token = default) { throw new NotImplementedException(); } - public TResponse PostFileWithRequest<TResponse>(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, object request, string fieldName = "upload") + public Task<TResponse> PutAsync<TResponse>(string relativeOrAbsoluteUrl, object request, CancellationToken token = default) + { + throw new NotImplementedException(); + } + + public Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, string relativeOrAbsoluteUrl, object request, + CancellationToken token = default) + { + throw new NotImplementedException(); + } + + public Task<TResponse> SendAsync<TResponse>(string httpMethod, string absoluteUrl, object request, CancellationToken token = default) { throw new NotImplementedException(); } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/EndpointHandlerBaseTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/EndpointHandlerBaseTests.cs index 373b19ad30c..686aec6644b 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/EndpointHandlerBaseTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/EndpointHandlerBaseTests.cs @@ -2,11 +2,10 @@ using System.Collections; using System.Linq; using System.Net.NetworkInformation; -using Moq; using NUnit.Framework; +using ServiceStack.Host; using ServiceStack.Host.Handlers; using ServiceStack.Testing; -using ServiceStack.Text; using ServiceStack.Web; namespace ServiceStack.WebHost.Endpoints.Support.Tests @@ -16,13 +15,13 @@ public class EndpointHandlerBaseTests { private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost().Init(); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -30,27 +29,19 @@ public void TestFixtureTearDown() class TestHandler : ServiceStackHandlerBase { - public override object CreateRequest(IRequest request, string operationName) - { - throw new NotImplementedException(); - } - - public override object GetResponse(IRequest httpReq, object request) - { - throw new NotImplementedException(); - } } [Test, TestCaseSource(typeof(EndpointHandlerBaseTests), "EndpointExpectations")] public void GetEndpointAttributes_AcceptsUserHostAddressFormats(string format, RequestAttributes expected) { var handler = new TestHandler(); - var request = new Mock<IHttpRequest>(); - request.Expect(req => req.UserHostAddress).Returns(format); - request.Expect(req => req.IsSecureConnection).Returns(false); - request.Expect(req => req.Verb).Returns("GET"); + var request = new BasicRequest { + UserHostAddress = format, + IsSecureConnection = false, + Verb = "GET" + }; - Assert.AreEqual(expected | RequestAttributes.HttpGet | RequestAttributes.InSecure, request.Object.GetAttributes()); + Assert.AreEqual(expected | RequestAttributes.HttpGet | RequestAttributes.InSecure, request.GetAttributes()); } public static IEnumerable EndpointExpectations diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/GithubGateway.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/GithubGateway.cs new file mode 100644 index 00000000000..1a08f3bd2c1 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/GithubGateway.cs @@ -0,0 +1,326 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text; +using ServiceStack.DataAnnotations; + +namespace ServiceStack.WebHost.Endpoints.Tests.Support +{ + public class GithubRepo + { + public int Id { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string Homepage { get; set; } + public string Language { get; set; } + public int Watchers_Count { get; set; } + public int Stargazes_Count { get; set; } + public int Forks_Count { get; set; } + public int Open_Issues_Count { get; set; } + public int Size { get; set; } + public string Full_Name { get; set; } + public DateTime Created_at { get; set; } + public DateTime? Pushed_At { get; set; } + public DateTime? Updated_At { get; set; } + + public bool Has_issues { get; set; } + public bool Has_Downloads { get; set; } + public bool Has_Wiki { get; set; } + public bool Has_Pages { get; set; } + public bool Fork { get; set; } + + public GithubUser Owner { get; set; } + public string Svn_Url { get; set; } + public string Mirror_Url { get; set; } + public string Url { get; set; } + public string Ssh_Url { get; set; } + public string Html_Url { get; set; } + public string Clone_Url { get; set; } + public string Git_Url { get; set; } + public bool Private { get; set; } + } + + public abstract class GithubUser + { + public int Id { get; set; } + public string Login { get; set; } + public string Avatar_Url { get; set; } + public string Url { get; set; } + public int? Followers { get; set; } + public int? Following { get; set; } + public string Type { get; set; } + public int? Public_Gists { get; set; } + public string Location { get; set; } + public string Company { get; set; } + public string Html_Url { get; set; } + public int? Public_Repos { get; set; } + public DateTime? Created_At { get; set; } + public string Blog { get; set; } + public string Email { get; set; } + public string Name { get; set; } + public bool? Hireable { get; set; } + public string Gravatar_Id { get; set; } + public string Bio { get; set; } + } + + public class GithubOrg + { + public int Id { get; set; } + public string Avatar_Url { get; set; } + public string Url { get; set; } + public string Login { get; set; } + } + + public class GithubByUser + { + public string Name { get; set; } + public string Email { get; set; } + public DateTime Date { get; set; } + } + + public class GithubCommitResult + { + public string Sha { get; set; } + public GithubCommit Commit { get; set; } + public GithubUser Author { get; set; } + public GithubUser Committer { get; set; } + } + + public class GithubCommit + { + public string Id { get; set; } + public string Message { get; set; } + public DateTime Date { get; set; } + public string Name { get; set; } + public int Comment_Count { get; set; } + public GithubByUser Committer { get; set; } + public GithubByUser Author { get; set; } + + public bool? ShouldSerialize(string fieldName) + { + return fieldName != "Committer" && fieldName != "Author"; + } + } + + public class GithubContent + { + [PrimaryKey] + public string Sha { get; set; } + public string Path { get; set; } + public string Name { get; set; } + public string Type { get; set; } + public int Size { get; set; } + public string Download_Url { get; set; } + } + + public class GithubContributor + { + public int Id { get; set; } + public string Login { get; set; } + public int Contributions { get; set; } + public string Type { get; set; } + + public string Avatar_Url { get; set; } + public string Gravatar_Id { get; set; } + public string Url { get; set; } + public bool? Site_Admin { get; set; } + } + + public class GithubSubscriber + { + public int Id { get; set; } + public string Login { get; set; } + public int Contributions { get; set; } + public string Type { get; set; } + + public string Avatar_Url { get; set; } + public string Gravatar_Id { get; set; } + public string Url { get; set; } + public bool? Site_Admin { get; set; } + } + + public class GithubComment + { + public int Id { get; set; } + public string Body { get; set; } + public DateTime Created_At { get; set; } + public DateTime Updated_At { get; set; } + public GithubUser User { get; set; } + public string Url { get; set; } + public string Commit_Id { get; set; } + + public string Position { get; set; } + public string Line { get; set; } + public string Path { get; set; } + } + + public class GithubRelease + { + public int Id { get; set; } + public string Name { get; set; } + public string Tag_Name { get; set; } + public string Target_Commitish { get; set; } + public string Body { get; set; } + + public bool Draft { get; set; } + public bool PreRelease { get; set; } + + public DateTime Created_At { get; set; } + public DateTime Published_At { get; set; } + public GithubUser Author { get; set; } + public string Url { get; set; } + public string Tarball_Url { get; set; } + public string Zipball_Url { get; set; } + } + + public partial class GithubGateway + { + public const string GithubApiBaseUrl = "https://api.github.com/"; + public static string UserAgent = typeof(GithubGateway).Namespace.SplitOnFirst('.').First(); + + public GithubGateway() + { + ClientConfig.ConfigureTls12(); + } + + public string Username { get; set; } + public string Password { get; set; } + + public List<GithubOrg> GetUserOrgs(string githubUsername) + { + return GetJson<List<GithubOrg>>("users/{0}/orgs", githubUsername); + } + + public List<GithubRepo> GetUserRepos(string githubUsername) + { + return GetJson<List<GithubRepo>>("users/{0}/repos", githubUsername); + } + + public List<GithubRepo> GetOrgRepos(string githubOrgName) + { + return GetJson<List<GithubRepo>>("orgs/{0}/repos", githubOrgName); + } + + public List<GithubRepo> GetAllUserAndOrgsReposFor(string githubUsername) + { + var map = new Dictionary<int, GithubRepo>(); + GetUserRepos(githubUsername).ForEach(x => map[x.Id] = x); + GetUserOrgs(githubUsername).ForEach(org => + GetOrgRepos(org.Login) + .ForEach(repo => map[repo.Id] = repo)); + + return map.Values.ToList(); + } + + public IEnumerable<GithubCommitResult> GetRepoCommits(string githubUser, string githubRepo) + { + return StreamJsonCollection<GithubCommitResult>("repos/{0}/{1}/commits", githubUser, githubRepo); + } + + public List<GithubContent> GetRepoContents(string githubUser, string githubRepo) + { + return GetJson<List<GithubContent>>("repos/{0}/{1}/contents", githubUser, githubRepo); + } + + public List<GithubContributor> GetRepoContributors(string githubUser, string githubRepo) + { + return GetJson<List<GithubContributor>>("repos/{0}/{1}/contributors", githubUser, githubRepo); + } + + public List<GithubSubscriber> GetRepoSubscribers(string githubUser, string githubRepo) + { + return GetJson<List<GithubSubscriber>>("repos/{0}/{1}/subscribers", githubUser, githubRepo); + } + + public List<GithubComment> GetRepoComments(string githubUser, string githubRepo) + { + return GetJson<List<GithubComment>>("repos/{0}/{1}/comments", githubUser, githubRepo); + } + + public List<GithubRelease> GetRepoReleases(string githubUser, string githubRepo) + { + return GetJson<List<GithubRelease>>("repos/{0}/{1}/releases", githubUser, githubRepo); + } + + protected virtual void RequestFilter(HttpWebRequest req) + { + req.SetUserAgent(UserAgent); + + if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password)) + { + req.Headers["Authorization"] = "Basic " + + Convert.ToBase64String(Encoding.ASCII.GetBytes(Username + ":" + Password)); + } + } + + public T GetJson<T>(string route, params object[] routeArgs) + { + return GithubApiBaseUrl.CombineWith(route.Fmt(routeArgs)) + .GetJsonFromUrl(RequestFilter) + .FromJson<T>(); + } + + public IEnumerable<T> StreamJsonCollection<T>(string route, params object[] routeArgs) + { + List<T> results; + var nextUrl = GithubApiBaseUrl.CombineWith(route.Fmt(routeArgs)); + + do + { + results = nextUrl + .GetJsonFromUrl( + RequestFilter, + responseFilter: res => { + var links = ParseLinkUrls(res.Headers["Link"]); + links.TryGetValue("next", out nextUrl); + }) + .FromJson<List<T>>(); + + foreach (var result in results) + { + yield return result; + } + + } while (results.Count > 0 && nextUrl != null); + } + + public static Dictionary<string, string> ParseLinkUrls(string linkHeader) + { + var map = new Dictionary<string, string>(); + var links = linkHeader; + + while (!string.IsNullOrEmpty(links)) + { + var urlStartPos = links.IndexOf('<'); + var urlEndPos = links.IndexOf('>'); + + if (urlStartPos == -1 || urlEndPos == -1) + break; + + var url = links.Substring(urlStartPos + 1, urlEndPos - urlStartPos - 1); + var parts = links.Substring(urlEndPos).SplitOnFirst(','); + + var relParts = parts[0].Split(';'); + foreach (var relPart in relParts) + { + var keyValueParts = relPart.SplitOnFirst('='); + if (keyValueParts.Length < 2) + continue; + + var name = keyValueParts[0].Trim(); + var value = keyValueParts[1].Trim().Trim('"'); + + if (name == "rel") + { + map[value] = url; + } + } + + links = parts.Length > 1 ? parts[1] : null; + } + + return map; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Host/ExampleAppHostHttpListener.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Host/ExampleAppHostHttpListener.cs index 48cf0b62c8b..1a443fda27d 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Host/ExampleAppHostHttpListener.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Host/ExampleAppHostHttpListener.cs @@ -4,6 +4,7 @@ using System.Net; using System.Runtime.Serialization; using System.Threading; +using System.Threading.Tasks; using Funq; using ServiceStack.Configuration; using ServiceStack.Data; @@ -296,7 +297,7 @@ public object Get(MoviesZip request) return Post(request); } - public object Post(MoviesZip request) + public Task<object> Post(MoviesZip request) { using (var db = DbFactory.Open()) { @@ -307,7 +308,7 @@ public object Post(MoviesZip request) : db.Select<Movie>("Genres LIKE {0}", "%" + request.Genre + "%") }; - return Request.ToOptimizedResult(response); + return Request.ToOptimizedResultAsync(response); } } } @@ -462,8 +463,8 @@ public override void Configure(Container container) { "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" }, }, WsdlServiceNamespace = "http://www.servicestack.net/types", - LogFactory = new ConsoleLogFactory(), DebugMode = true, + PreferredContentTypes = { MimeTypes.ProtoBuf }, }); this.RegisterRequestBinder<CustomRequestBinder>( @@ -529,7 +530,6 @@ public override void Configure(Container container) { "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" }, }, WsdlServiceNamespace = "http://www.servicestack.net/types", - LogFactory = new ConsoleLogFactory(), DebugMode = true, }); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Operations/CustomFormData.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Operations/CustomFormData.cs index e3f7cfada4f..4b7be79a992 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Operations/CustomFormData.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Operations/CustomFormData.cs @@ -1,6 +1,8 @@ using System; using System.Runtime.Serialization; +#if !NETCORE_SUPPORT using ServiceStack.ServiceModel; +#endif namespace ServiceStack.WebHost.Endpoints.Tests.Support.Operations { diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Operations/GetCustomer.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Operations/GetCustomer.cs index 5bf30478e97..9a79661013b 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Operations/GetCustomer.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Operations/GetCustomer.cs @@ -1,10 +1,11 @@ +using System; using System.Runtime.Serialization; using ServiceStack.WebHost.Endpoints.Tests.Support.Types; namespace ServiceStack.WebHost.Endpoints.Tests.Support.Operations { [DataContract] - public class GetCustomer + public class GetCustomer : IReturn<GetCustomerResponse> { [DataMember] public long CustomerId { get; set; } @@ -15,5 +16,8 @@ public class GetCustomerResponse { [DataMember] public Customer Customer { get; set; } + + [DataMember] + public DateTime Created { get; set; } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/ServiceClientTestBase.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/ServiceClientTestBase.cs index 723b50d65aa..b8a36ca9192 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/ServiceClientTestBase.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/ServiceClientTestBase.cs @@ -11,7 +11,7 @@ public abstract class ServiceClientTestBase : IDisposable public abstract AppHostHttpListenerBase CreateListener(); - [TestFixtureSetUp] + [OneTimeSetUp] public virtual void TestFixtureSetUp() { appHost = CreateListener(); @@ -19,7 +19,7 @@ public virtual void TestFixtureSetUp() appHost.Start(BaseUrl); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/CustomFormDataService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/CustomFormDataService.cs index 2e8cca3bbea..dff8763b6ee 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/CustomFormDataService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/CustomFormDataService.cs @@ -2,17 +2,17 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - public class CustomFormDataService : Service - { - //Parsing: &first-name=tom&item-0=blah&item-1-delete=1 - public object Post(CustomFormData request) - { - return new CustomFormDataResponse - { - FirstName = Request.FormData["first-name"], + public class CustomFormDataService : Service + { + //Parsing: &first-name=tom&item-0=blah&item-1-delete=1 + public object Post(CustomFormData request) + { + return new CustomFormDataResponse + { + FirstName = Request.FormData["first-name"], Item0 = Request.FormData["item-0"], Item1Delete = Request.FormData["item-1-delete"] - }; - } - } + }; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/EndpointAccessService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/EndpointAccessService.cs index 840de4d9945..cab8a5d6e01 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/EndpointAccessService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/EndpointAccessService.cs @@ -1,6 +1,4 @@ -using ServiceStack.Web; - -namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services +namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { public class GetsOnly { } public class PostsOnly { } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/FileUploadService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/FileUploadService.cs index 836bd1aad81..e6d366e2cd6 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/FileUploadService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/FileUploadService.cs @@ -1,90 +1,110 @@ using System; +using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [DataContract] - [Route("/fileuploads/{RelativePath*}")] - [Route("/fileuploads", HttpMethods.Post)] + [DataContract] + [Route("/fileuploads/{RelativePath*}")] + [Route("/fileuploads", HttpMethods.Post)] public class FileUpload : IReturn<FileUploadResponse> - { - [DataMember] - public string RelativePath { get; set; } + { + [DataMember] + public string RelativePath { get; set; } [DataMember] public string CustomerName { get; set; } [DataMember] - public int CustomerId { get; set; } + public int? CustomerId { get; set; } [DataMember] - public DateTime CreatedDate { get; set; } + public DateTime? CreatedDate { get; set; } } - [DataContract] - public class FileUploadResponse : IHasResponseStatus - { - [DataMember] - public string FileName { get; set; } + [DataContract] + public class FileUploadResponse : IHasResponseStatus + { + [DataMember] + public string Name { get; set; } + + [DataMember] + public string FileName { get; set; } - [DataMember] - public long ContentLength { get; set; } + [DataMember] + public long ContentLength { get; set; } - [DataMember] - public string ContentType { get; set; } + [DataMember] + public string ContentType { get; set; } - [DataMember] - public string Contents { get; set; } + [DataMember] + public string Contents { get; set; } - [DataMember] - public ResponseStatus ResponseStatus { get; set; } + [DataMember] + public ResponseStatus ResponseStatus { get; set; } [DataMember] public string CustomerName { get; set; } [DataMember] - public int CustomerId { get; set; } + public int? CustomerId { get; set; } [DataMember] - public DateTime CreatedDate { get; set; } + public DateTime? CreatedDate { get; set; } } - public class FileUploadService : Service - { - public object Get(FileUpload request) - { - if (request.RelativePath.IsNullOrEmpty()) - throw new ArgumentNullException("RelativePath"); - - var filePath = ("~/" + request.RelativePath).MapProjectPath(); - if (!File.Exists(filePath)) - throw new FileNotFoundException(request.RelativePath); - - var result = new HttpResult(new FileInfo(filePath)); - return result; - } - - public object Post(FileUpload request) - { - if (this.Request.Files.Length == 0) - throw new FileNotFoundException("UploadError", "No such file exists"); - - if (request.RelativePath == "ThrowError") - throw new NotSupportedException("ThrowError"); - - var file = this.Request.Files[0]; - return new FileUploadResponse - { - FileName = file.FileName, - ContentLength = file.ContentLength, - ContentType = file.ContentType, - Contents = new StreamReader(file.InputStream).ReadToEnd(), + [Route("/multi-fileuploads", HttpMethods.Post)] + public class MultipleFileUpload : IReturn<MultipleFileUploadResponse> + { + public string RelativePath { get; set; } + public string CustomerName { get; set; } + public int? CustomerId { get; set; } + public DateTime? CreatedDate { get; set; } + } + + public class MultipleFileUploadResponse : IHasResponseStatus + { + public List<FileUploadResponse> Results { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class FileUploadService : Service + { + public object Get(FileUpload request) + { + if (request.RelativePath.IsNullOrEmpty()) + throw new ArgumentNullException("RelativePath"); + + var filePath = ("~/" + request.RelativePath).MapProjectPlatformPath(); + if (!File.Exists(filePath)) + throw new FileNotFoundException(request.RelativePath); + + var result = new HttpResult(new FileInfo(filePath)); + return result; + } + + public object Post(FileUpload request) + { + if (this.Request.Files.Length == 0) + throw new FileNotFoundException("UploadError", "No such file exists"); + + if (request.RelativePath == "ThrowError") + throw new NotSupportedException("ThrowError"); + + var file = this.Request.Files[0]; + return new FileUploadResponse + { + Name = file.Name, + FileName = file.FileName, + ContentLength = file.ContentLength, + ContentType = file.ContentType, + Contents = file.InputStream.ReadToEnd(), CustomerId = request.CustomerId, CustomerName = request.CustomerName, CreatedDate = request.CreatedDate - }; - } + }; + } public object Put(FileUpload request) { @@ -95,5 +115,24 @@ public object Put(FileUpload request) CreatedDate = request.CreatedDate }; } - } + + public object Post(MultipleFileUpload request) + { + return new MultipleFileUploadResponse + { + Results = this.Request.Files.Map(file => new FileUploadResponse + { + Name = file.Name, + FileName = file.FileName, + ContentLength = file.ContentLength, + ContentType = file.ContentType, + Contents = file.InputStream.ReadToEnd(), + CustomerId = request.CustomerId, + CustomerName = request.CustomerName, + CreatedDate = request.CreatedDate + }) + }; + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/GetCustomerService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/GetCustomerService.cs index 4110e721b4d..4fff72eb12a 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/GetCustomerService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/GetCustomerService.cs @@ -1,21 +1,22 @@ +using System; using ServiceStack.WebHost.Endpoints.Tests.Support.Operations; using ServiceStack.WebHost.Endpoints.Tests.Support.Types; namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - public class GetCustomerService - : TestServiceBase<GetCustomer> - { - protected override object Run(GetCustomer request) - { - return new GetCustomerResponse - { - Customer = new Customer - { - Id = request.CustomerId - } - }; - } - } - + public class GetCustomerService + : TestServiceBase<GetCustomer> + { + protected override object Run(GetCustomer request) + { + return new GetCustomerResponse + { + Customer = new Customer + { + Id = request.CustomerId + }, + Created = DateTime.UtcNow, + }; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HeadersService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HeadersService.cs index 2710182de09..8b52cabd6a3 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HeadersService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HeadersService.cs @@ -4,34 +4,33 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [DataContract] - public class Headers - { - [DataMember] - public string Name { get; set; } - } + [DataContract] + public class Headers + { + [DataMember] + public string Name { get; set; } + } - [DataContract] - public class HeadersResponse - { - [DataMember] - public string Value { get; set; } - } + [DataContract] + public class HeadersResponse + { + [DataMember] + public string Value { get; set; } + } - public class HeadersService - : TestServiceBase<Headers>, IRequiresRequest - { - public IRequest Request { get; set; } + public class HeadersService + : TestServiceBase<Headers>, IRequiresRequest + { + public IRequest Request { get; set; } - protected override object Run(Headers request) - { - var header = Request.GetHeader(request.Name); - - return new HeadersResponse - { - Value = header - }; - } - } + protected override object Run(Headers request) + { + var header = Request.GetHeader(request.Name); + return new HeadersResponse + { + Value = header + }; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HelloService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HelloService.cs index ca07fa085ab..358cf5ec761 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HelloService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HelloService.cs @@ -2,31 +2,27 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - /// Create the name of your Web Service (i.e. the Request DTO) - [DataContract] - [Route("/hello")] //Optional: Define an alternate REST-ful url for this service - [Route("/hello/{Name}")] - public class Hello - { - [DataMember] - public string Name { get; set; } - } + /// Create the name of your Web Service (i.e. the Request DTO) + [DataContract] + [Route("/hello")] //Optional: Define an alternate REST-ful url for this service + [Route("/hello/{Name}")] + public class Hello : IReturn<HelloResponse> + { + [DataMember] + public string Name { get; set; } + } - /// Define your Web Service response (i.e. Response DTO) - [DataContract] - public class HelloResponse - { - [DataMember] - public string Result { get; set; } - } - - /// Create your Web Service implementation - public class HelloService : IService - { - public object Any(Hello request) - { - return new HelloResponse { Result = "Hello, " + request.Name }; - } - } + /// Define your Web Service response (i.e. Response DTO) + [DataContract] + public class HelloResponse + { + [DataMember] + public string Result { get; set; } + } + /// Create your Web Service implementation + public class HelloService : IService + { + public object Any(Hello request) => new HelloResponse { Result = "Hello, " + request.Name }; + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpErrorService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpErrorService.cs index 9a5674a5865..504123c1e19 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpErrorService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpErrorService.cs @@ -1,8 +1,9 @@ using System; +using System.Collections.Generic; using System.IO; using System.Net; using System.Runtime.Serialization; -using ServiceStack.Text; +using ServiceStack.Model; namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { @@ -53,6 +54,58 @@ public ThrowHttpErrorResponse() public ResponseStatus ResponseStatus { get; set; } } + [Route("/throw404")] + public class Throw404 { } + + [Route("/throw404description")] + public class Throw404Description { } + + [Route("/throwcustom404")] + public class ThrowCustom404 { } + + [Route("/return404")] + public class Return404 { } + + [Route("/return404result")] + public class Return404Result { } + + [Route("/throwwebex")] + public class ThrowWebServiceException : IHasResponseStatus + { + public int? StatusCode { get; set; } + public string StatusDescription { get; set; } + public string Message { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class Custom404Exception : Exception, IResponseStatusConvertible, IHasStatusCode + { + public Custom404Exception(string message) : base(message) { } + + public ResponseStatus ToResponseStatus() + { + return new ResponseStatus + { + ErrorCode = GetType().Name, + Message = this.Message, + Errors = new List<ResponseError> + { + new ResponseError + { + ErrorCode = "FieldErrorCode", + Message = "FieldMessage", + FieldName = "FieldName", + } + } + }; + } + + public int StatusCode + { + get { return (int)HttpStatusCode.NotFound; } + } + } + public class HttpErrorService : Service { public object Any(ThrowHttpError request) @@ -72,7 +125,45 @@ public object Any(ThrowHttpError request) throw ex; var httpStatus = (HttpStatusCode)request.StatusCode.Value; - throw new ServiceStack.HttpError(httpStatus, ex); + throw new HttpError(httpStatus, ex); + } + + public object Any(Throw404 request) + { + throw HttpError.NotFound("Custom Status Description"); + } + + public object Any(Throw404Description request) + { + throw new HttpError(HttpStatusCode.NotFound) + { + StatusDescription = "Custom Status Description" + }; + } + + public object Any(ThrowCustom404 request) + { + throw new Custom404Exception("Custom Status Description"); + } + + public object Any(Return404 request) + { + return HttpError.NotFound("Custom Status Description"); + } + + public object Any(Return404Result request) + { + return new HttpResult(HttpStatusCode.NotFound, "Custom Status Description"); + } + + public object Any(ThrowWebServiceException request) + { + throw new WebServiceException(request.Message ?? "Message") + { + StatusCode = request.StatusCode ?? 500, + StatusDescription = request.StatusDescription ?? "StatusDescription", + ResponseDto = request, + }; } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpPostXmlAndSecureLocalSubnetRestrictionService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpPostXmlAndSecureLocalSubnetRestrictionService.cs index 1cb1c8df7f4..3ba4aee6db5 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpPostXmlAndSecureLocalSubnetRestrictionService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpPostXmlAndSecureLocalSubnetRestrictionService.cs @@ -2,20 +2,20 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [Restrict(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Xml)] - [DataContract] - public class HttpPostXmlAndSecureLocalSubnetRestriction { } + [Restrict(RequestAttributes.LocalSubnet | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Xml)] + [DataContract] + public class HttpPostXmlAndSecureLocalSubnetRestriction { } - [DataContract] - public class HttpPostXmlAndSecureLocalSubnetRestrictionResponse { } + [DataContract] + public class HttpPostXmlAndSecureLocalSubnetRestrictionResponse { } - public class HttpPostXmlAndSecureLocalSubnetRestrictionService - : TestServiceBase<HttpPostXmlAndSecureLocalSubnetRestriction> - { - protected override object Run(HttpPostXmlAndSecureLocalSubnetRestriction request) - { - return new HttpPostXmlAndSecureLocalSubnetRestrictionResponse(); - } - } + public class HttpPostXmlAndSecureLocalSubnetRestrictionService + : TestServiceBase<HttpPostXmlAndSecureLocalSubnetRestriction> + { + protected override object Run(HttpPostXmlAndSecureLocalSubnetRestriction request) + { + return new HttpPostXmlAndSecureLocalSubnetRestrictionResponse(); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpPostXmlOrSecureLocalSubnetRestrictionService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpPostXmlOrSecureLocalSubnetRestrictionService.cs index 008df29e513..b47d8f83519 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpPostXmlOrSecureLocalSubnetRestrictionService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/HttpPostXmlOrSecureLocalSubnetRestrictionService.cs @@ -2,19 +2,19 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [Restrict(RequestAttributes.LocalSubnet | RequestAttributes.Secure, RequestAttributes.HttpPost | RequestAttributes.Xml)] - [DataContract] - public class HttpPostXmlOrSecureLocalSubnetRestriction { } + [Restrict(RequestAttributes.LocalSubnet | RequestAttributes.Secure, RequestAttributes.HttpPost | RequestAttributes.Xml)] + [DataContract] + public class HttpPostXmlOrSecureLocalSubnetRestriction { } - [DataContract] - public class HttpPostXmlOrSecureLocalSubnetRestrictionResponse { } + [DataContract] + public class HttpPostXmlOrSecureLocalSubnetRestrictionResponse { } - public class HttpPostXmlOrSecureLocalSubnetRestrictionService - : TestServiceBase<HttpPostXmlOrSecureLocalSubnetRestriction> - { - protected override object Run(HttpPostXmlOrSecureLocalSubnetRestriction request) - { - return new HttpPostXmlOrSecureLocalSubnetRestrictionResponse(); - } - } + public class HttpPostXmlOrSecureLocalSubnetRestrictionService + : TestServiceBase<HttpPostXmlOrSecureLocalSubnetRestriction> + { + protected override object Run(HttpPostXmlOrSecureLocalSubnetRestriction request) + { + return new HttpPostXmlOrSecureLocalSubnetRestrictionResponse(); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InSecureLiveEnvironmentRestriction.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InSecureLiveEnvironmentRestriction.cs index 5bd8e3f8c95..b40de274dbc 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InSecureLiveEnvironmentRestriction.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InSecureLiveEnvironmentRestriction.cs @@ -2,19 +2,19 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [Restrict(RequestAttributes.External | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.Xml)] - [DataContract] - public class InSecureLiveEnvironmentRestriction { } + [Restrict(RequestAttributes.External | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.Xml)] + [DataContract] + public class InSecureLiveEnvironmentRestriction { } - [DataContract] - public class InSecureLiveEnvironmentRestrictionResponse { } + [DataContract] + public class InSecureLiveEnvironmentRestrictionResponse { } - public class InSecureLiveEnvironmentRestrictionService - : TestServiceBase<InSecureLiveEnvironmentRestriction> - { - protected override object Run(InSecureLiveEnvironmentRestriction request) - { - return new InSecureLiveEnvironmentRestrictionResponse(); - } - } + public class InSecureLiveEnvironmentRestrictionService + : TestServiceBase<InSecureLiveEnvironmentRestriction> + { + protected override object Run(InSecureLiveEnvironmentRestriction request) + { + return new InSecureLiveEnvironmentRestrictionResponse(); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InsecureDevEnvironmentRestrictionService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InsecureDevEnvironmentRestrictionService.cs index 0a4108f93e5..8ce96e6f060 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InsecureDevEnvironmentRestrictionService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InsecureDevEnvironmentRestrictionService.cs @@ -2,20 +2,20 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [Restrict(RequestAttributes.InternalNetworkAccess | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.Xml)] - [DataContract] - public class InSecureDevEnvironmentRestriction { } + [Restrict(RequestAttributes.InternalNetworkAccess | RequestAttributes.InSecure | RequestAttributes.HttpPost | RequestAttributes.Xml)] + [DataContract] + public class InSecureDevEnvironmentRestriction { } - [DataContract] - public class InsecureDevEnvironmentRestrictionResponse { } + [DataContract] + public class InsecureDevEnvironmentRestrictionResponse { } - public class InsecureDevEnvironmentRestrictionService - : TestServiceBase<InSecureDevEnvironmentRestriction> - { - protected override object Run(InSecureDevEnvironmentRestriction request) - { - return new InsecureDevEnvironmentRestrictionResponse(); - } - } + public class InsecureDevEnvironmentRestrictionService + : TestServiceBase<InSecureDevEnvironmentRestriction> + { + protected override object Run(InSecureDevEnvironmentRestriction request) + { + return new InsecureDevEnvironmentRestrictionResponse(); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InternalRestrictionService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InternalRestrictionService.cs index b2385149dd7..08154363952 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InternalRestrictionService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/InternalRestrictionService.cs @@ -1,21 +1,30 @@ -using System.Runtime.Serialization; - namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [Restrict(AccessTo = RequestAttributes.InternalNetworkAccess)] - [DataContract] - public class InternalRestriction { } + [Restrict(AccessTo = RequestAttributes.InternalNetworkAccess)] + public class InternalRestriction { } + + [Restrict(RequestAttributes.Localhost)] + public class LocalhostRestriction { } + + [Restrict(RequestAttributes.LocalSubnet)] + public class LocalSubnetRestriction { } + + [Restrict(RequestAttributes.InProcess)] + public class InProcessRestriction { } - [DataContract] - public class IntranetRestrictionResponse { } + public class NetworkRestrictionServices : Service + { + public object Any(InternalRestriction request) => request; + public object Any(InProcessRestriction request) => request; + public object Any(LocalhostRestriction request) => request; + public object Any(LocalSubnetRestriction request) => request; + } - public class InternalRestrictionService - : TestServiceBase<InternalRestriction> - { - protected override object Run(InternalRestriction request) - { - return new IntranetRestrictionResponse(); - } - } + public class LocalhostRestrictionOnService : IReturn<Response> { } + [Restrict(LocalhostOnly = true)] + public class LocalHostOnService : Service + { + public object Any(LocalhostRestrictionOnService request) => request; + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/LocalSubnetRestrictionService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/LocalSubnetRestrictionService.cs deleted file mode 100644 index 6529fd16a12..00000000000 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/LocalSubnetRestrictionService.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.Serialization; - -namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services -{ - [Restrict(RequestAttributes.LocalSubnet)] - [DataContract] - public class LocalSubnetRestriction { } - - [DataContract] - public class LocalSubnetRestrictionResponse { } - - public class LocalSubnetRestrictionService - : TestServiceBase<LocalSubnetRestriction> - { - protected override object Run(LocalSubnetRestriction request) - { - return new LocalSubnetRestrictionResponse(); - } - } - -} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/LocalhostRestrictionService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/LocalhostRestrictionService.cs deleted file mode 100644 index c237af52298..00000000000 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/LocalhostRestrictionService.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Runtime.Serialization; - -namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services -{ - [Restrict(RequestAttributes.Localhost)] - [DataContract] - public class LocalhostRestriction { } - - [DataContract] - public class LocalhostRestrictionResponse { } - - public class LocalhostRestrictionService - : TestServiceBase<LocalhostRestriction> - { - protected override object Run(LocalhostRestriction request) - { - return new LocalhostRestrictionResponse(); - } - } - - - public class LocalhostRestrictionOnService : IReturn<Response> { } - - [Restrict(LocalhostOnly = true)] - public class LocalHostOnService : Service - { - public Response Any(LocalhostRestrictionOnService request) - { - return new Response(); - } - } - -} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/MessageQueueRestriction.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/MessageQueueRestriction.cs new file mode 100644 index 00000000000..68fe848c80c --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/MessageQueueRestriction.cs @@ -0,0 +1,33 @@ +using NUnit.Framework; +using ServiceStack.Messaging; +using ServiceStack.Testing; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services +{ + [Restrict(RequestAttributes.MessageQueue)] + public class MessageQueueRestriction : IReturn<MessageQueueRestriction> + { + public int Id { get; set; } + } + + public class MessageQueueRestrictionService : Service + { + public object Any(MessageQueueRestriction request) => request; + } + + [TestFixture] + public class MessageQueueRestrictionTests + { + [Test] + public void Can_access_MQ_Restriction_when_using_ExecuteMessage() + { + using (var appHost = new BasicAppHost(typeof(MessageQueueRestrictionService).Assembly).Init()) + { + var request = new MessageQueueRestriction { Id = 1 }; + var response = appHost.ExecuteMessage(new Message<MessageQueueRestriction>(request)); + Assert.That(((MessageQueueRestriction)response).Id, Is.EqualTo(1)); + } + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/NestedService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/NestedService.cs index 28e0c0c25a7..b79ccfde3e5 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/NestedService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/NestedService.cs @@ -2,18 +2,18 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [DataContract] - public class Nested { } - [DataContract] - public class NestedResponse { } + [DataContract] + public class Nested { } + [DataContract] + public class NestedResponse { } - public class NestedService - : TestServiceBase<Nested> - { - protected override object Run(Nested request) - { - return new NestedResponse(); - } - } + public class NestedService + : TestServiceBase<Nested> + { + protected override object Run(Nested request) + { + return new NestedResponse(); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/RequestFilter.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/RequestFilter.cs index af58f302af1..dcb05e313a1 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/RequestFilter.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/RequestFilter.cs @@ -4,35 +4,34 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [DataContract] - public class RequestFilter - { - [DataMember] - public int StatusCode { get; set; } + [DataContract] + public class RequestFilter + { + [DataMember] + public int StatusCode { get; set; } - [DataMember] - public string HeaderName { get; set; } + [DataMember] + public string HeaderName { get; set; } - [DataMember] - public string HeaderValue { get; set; } - } + [DataMember] + public string HeaderValue { get; set; } + } - [DataContract] - public class RequestFilterResponse - { - [DataMember] - public string Value { get; set; } - } + [DataContract] + public class RequestFilterResponse + { + [DataMember] + public string Value { get; set; } + } - public class StatusCodeService - : TestServiceBase<RequestFilter>, IRequiresRequest - { - public IRequest Request { get; set; } - - protected override object Run(RequestFilter request) - { - return new RequestFilterResponse(); - } - } + public class StatusCodeService + : TestServiceBase<RequestFilter>, IRequiresRequest + { + public IRequest Request { get; set; } + protected override object Run(RequestFilter request) + { + return new RequestFilterResponse(); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureDevEnvironmentRestrictionService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureDevEnvironmentRestrictionService.cs index f67c2e2fff9..79abd37e46d 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureDevEnvironmentRestrictionService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureDevEnvironmentRestrictionService.cs @@ -2,21 +2,19 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { + [Restrict(RequestAttributes.InternalNetworkAccess | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Xml)] + [DataContract] + public class SecureDevEnvironmentRestriction { } - [Restrict(RequestAttributes.InternalNetworkAccess | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Xml)] - [DataContract] - public class SecureDevEnvironmentRestriction { } - - [DataContract] - public class SecureDevEnvironmentRestrictionResponse { } - - public class SecureDevEnvironmentRestrictionService - : TestServiceBase<SecureDevEnvironmentRestriction> - { - protected override object Run(SecureDevEnvironmentRestriction request) - { - return new SecureDevEnvironmentRestrictionResponse(); - } - } + [DataContract] + public class SecureDevEnvironmentRestrictionResponse { } + public class SecureDevEnvironmentRestrictionService + : TestServiceBase<SecureDevEnvironmentRestriction> + { + protected override object Run(SecureDevEnvironmentRestriction request) + { + return new SecureDevEnvironmentRestrictionResponse(); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureLiveEnvironmentRestriction.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureLiveEnvironmentRestriction.cs index 7c55d9d5c3e..692c56a6d70 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureLiveEnvironmentRestriction.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureLiveEnvironmentRestriction.cs @@ -2,19 +2,19 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [Restrict(RequestAttributes.External | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Xml)] - [DataContract] - public class SecureLiveEnvironmentRestriction { } + [Restrict(RequestAttributes.External | RequestAttributes.Secure | RequestAttributes.HttpPost | RequestAttributes.Xml)] + [DataContract] + public class SecureLiveEnvironmentRestriction { } - [DataContract] - public class SecureLiveEnvironmentRestrictionResponse { } + [DataContract] + public class SecureLiveEnvironmentRestrictionResponse { } - public class SecureLiveEnvironmentRestrictionService - : TestServiceBase<SecureLiveEnvironmentRestriction> - { - protected override object Run(SecureLiveEnvironmentRestriction request) - { - return new SecureLiveEnvironmentRestrictionResponse(); - } - } + public class SecureLiveEnvironmentRestrictionService + : TestServiceBase<SecureLiveEnvironmentRestriction> + { + protected override object Run(SecureLiveEnvironmentRestriction request) + { + return new SecureLiveEnvironmentRestrictionResponse(); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureLocalSubnetRestrictionService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureLocalSubnetRestrictionService.cs index 2ac230ac4e7..8521209a6fb 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureLocalSubnetRestrictionService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SecureLocalSubnetRestrictionService.cs @@ -2,20 +2,20 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [Restrict(RequestAttributes.Secure | RequestAttributes.LocalSubnet)] - [DataContract] - public class SecureLocalSubnetRestriction { } + [Restrict(RequestAttributes.Secure | RequestAttributes.LocalSubnet)] + [DataContract] + public class SecureLocalSubnetRestriction { } - [DataContract] - public class SecureLocalSubnetRestrictionResponse { } + [DataContract] + public class SecureLocalSubnetRestrictionResponse { } - public class SecureLocalSubnetRestrictionService - : TestServiceBase<SecureLocalSubnetRestriction> - { - protected override object Run(SecureLocalSubnetRestriction request) - { - return new SecureLocalSubnetRestrictionResponse(); - } - } + public class SecureLocalSubnetRestrictionService + : TestServiceBase<SecureLocalSubnetRestriction> + { + protected override object Run(SecureLocalSubnetRestriction request) + { + return new SecureLocalSubnetRestrictionResponse(); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SendVerbService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SendVerbService.cs new file mode 100644 index 00000000000..d99a2876cf0 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/SendVerbService.cs @@ -0,0 +1,73 @@ +namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services +{ + public class SendVerbResponse + { + public int Id { get; set; } + public string PathInfo { get; set; } + public string RequestMethod { get; set; } + } + + public class SendDefault : IReturn<SendVerbResponse> + { + public int Id { get; set; } + } + + [Route("/sendrestget/{Id}", "GET")] + public class SendRestGet : IReturn<SendVerbResponse>, IGet + { + public int Id { get; set; } + } + + public class SendGet : IReturn<SendVerbResponse>, IGet + { + public int Id { get; set; } + } + + public class SendPost : IReturn<SendVerbResponse>, IPost + { + public int Id { get; set; } + } + + public class SendPut : IReturn<SendVerbResponse>, IPut + { + public int Id { get; set; } + } + + public class SendVerbService : Service + { + public object Any(SendDefault request) + { + return CreateResponse(request.Id); + } + + public object Get(SendRestGet request) + { + return CreateResponse(request.Id); + } + + public object Any(SendGet request) + { + return CreateResponse(request.Id); + } + + public object Any(SendPost request) + { + return CreateResponse(request.Id); + } + + public object Any(SendPut request) + { + return CreateResponse(request.Id); + } + + private object CreateResponse(int requestId) + { + return new SendVerbResponse + { + Id = requestId, + PathInfo = base.Request.PathInfo, + RequestMethod = base.Request.Verb + }; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestAsyncService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestAsyncService.cs index 4a96b13c1b1..2d511653a32 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestAsyncService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestAsyncService.cs @@ -4,21 +4,21 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [DataContract] - public class TestAsync { } + [DataContract] + public class TestAsync { } - [DataContract] - public class TestAsyncResponse - { - [DataMember] - public IFoo Foo { get; set; } + [DataContract] + public class TestAsyncResponse + { + [DataMember] + public IFoo Foo { get; set; } - [DataMember] - public int ExecuteTimes { get; set; } + [DataMember] + public int ExecuteTimes { get; set; } - [DataMember] - public int ExecuteAsyncTimes { get; set; } - } + [DataMember] + public int ExecuteAsyncTimes { get; set; } + } [Route("/returnsvoid")] [DataContract] @@ -37,29 +37,29 @@ public class ReturnsWebResponse : IReturn<HttpWebResponse> } public class TestAsyncService : IService - { - private readonly IFoo foo; + { + private readonly IFoo foo; - public static int ExecuteTimes { get; private set; } - public static int ExecuteAsyncTimes { get; private set; } + public static int ExecuteTimes { get; private set; } + public static int ExecuteAsyncTimes { get; private set; } public static string ReturnVoidMessage; public static string ReturnWebResponseMessage; - - public static void ResetStats() - { - ExecuteTimes = 0; - ExecuteAsyncTimes = 0; - } - public TestAsyncService(IFoo foo) - { - this.foo = foo; - } + public static void ResetStats() + { + ExecuteTimes = 0; + ExecuteAsyncTimes = 0; + } - public object Any(TestAsync request) - { - return new TestAsyncResponse { Foo = this.foo, ExecuteTimes = ++ExecuteTimes }; - } + public TestAsyncService(IFoo foo) + { + this.foo = foo; + } + + public object Any(TestAsync request) + { + return new TestAsyncResponse { Foo = this.foo, ExecuteTimes = ++ExecuteTimes }; + } public void Any(ReturnsVoid request) { diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestRestService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestRestService.cs index 816bd180743..e711449105f 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestRestService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestRestService.cs @@ -2,54 +2,54 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - public class TestRestService<TRequest> : IService - { - public object Get(TRequest request) - { - return Run(request, ApplyTo.Get); - } - - public object Put(TRequest request) - { - return Run(request, ApplyTo.Put); - } - - public object Post(TRequest request) - { - return Run(request, ApplyTo.Post); - } - - public object Patch(TRequest request) - { - return Run(request, ApplyTo.Patch); - } - - public object Delete(TRequest request) - { - return Run(request, ApplyTo.Delete); - } - - public object Head(TRequest request) - { - return Run(request, ApplyTo.Head); - } - - public object Options(TRequest request) - { - return Run(request, ApplyTo.Options); - } - - protected virtual object Run(TRequest request, ApplyTo method) - { - return request.AsTypeString(); - } - } - - public static class ObjectExtensions - { - public static string AsTypeString(this object request) - { + public class TestRestService<TRequest> : IService + { + public object Get(TRequest request) + { + return Run(request, ApplyTo.Get); + } + + public object Put(TRequest request) + { + return Run(request, ApplyTo.Put); + } + + public object Post(TRequest request) + { + return Run(request, ApplyTo.Post); + } + + public object Patch(TRequest request) + { + return Run(request, ApplyTo.Patch); + } + + public object Delete(TRequest request) + { + return Run(request, ApplyTo.Delete); + } + + public object Head(TRequest request) + { + return Run(request, ApplyTo.Head); + } + + public object Options(TRequest request) + { + return Run(request, ApplyTo.Options); + } + + protected virtual object Run(TRequest request, ApplyTo method) + { + return request.AsTypeString(); + } + } + + public static class ObjectExtensions + { + public static string AsTypeString(this object request) + { return request.GetType().ToTypeString() + "\n" + request.Dump(); } - } + } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestService.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestService.cs index 1aa04d44c27..5ed156e4d54 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestService.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestService.cs @@ -3,38 +3,38 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - [DataContract] - public class Test { } - - [DataContract] - public class TestResponse - { - [DataMember] - public IFoo Foo { get; set; } - - [DataMember] - public int ExecuteTimes { get; set; } - } - - public class TestService : IService - { - private readonly IFoo foo; - - public static int ExecuteTimes { get; private set; } - - public static void ResetStats() - { - ExecuteTimes = 0; - } - - public TestService(IFoo foo) - { - this.foo = foo; - } - - public object Any(Test request) - { - return new TestResponse { Foo = this.foo, ExecuteTimes = ++ExecuteTimes }; - } - } + [DataContract] + public class Test { } + + [DataContract] + public class TestResponse + { + [DataMember] + public IFoo Foo { get; set; } + + [DataMember] + public int ExecuteTimes { get; set; } + } + + public class TestService : IService + { + private readonly IFoo foo; + + public static int ExecuteTimes { get; private set; } + + public static void ResetStats() + { + ExecuteTimes = 0; + } + + public TestService(IFoo foo) + { + this.foo = foo; + } + + public object Any(Test request) + { + return new TestResponse { Foo = this.foo, ExecuteTimes = ++ExecuteTimes }; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestServiceBase.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestServiceBase.cs index e429e5c71ce..ceb95bfbb91 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestServiceBase.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/Support/Services/TestServiceBase.cs @@ -1,13 +1,13 @@ namespace ServiceStack.WebHost.Endpoints.Tests.Support.Services { - public abstract class TestServiceBase<TRequest> - : IService - { - protected abstract object Run(TRequest request); + public abstract class TestServiceBase<TRequest> + : IService + { + protected abstract object Run(TRequest request); - public object Any(TRequest request) - { - return Run(request); - } - } + public object Any(TRequest request) + { + return Run(request); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/SwaggerFeatureTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/SwaggerFeatureTests.cs index 5bab44af166..a9129a50c65 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/SwaggerFeatureTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/SwaggerFeatureTests.cs @@ -45,7 +45,7 @@ public class SwaggerModelsRequest : IReturn<SwaggerFeatureResponse> [ApiMember(Name = "RequestBody", Description = "The request body", ParameterType = "body", DataType = "SwaggerModelsRequest", IsRequired = true)] [System.ComponentModel.Description("Name description")] - public string Name { get; set; } + public string RequestBody { get; set; } [System.ComponentModel.Description("NestedModel description")] public SwaggerNestedModel NestedModel { get; set;} @@ -54,6 +54,8 @@ public class SwaggerModelsRequest : IReturn<SwaggerFeatureResponse> public SwaggerNestedModel3[] ArrayProperty { get; set; } + public string StringProperty { get; set; } + [System.ComponentModel.Description("Byte description")] public byte ByteProperty { get; set; } @@ -138,12 +140,15 @@ public class NullableResponse } [Api] - [Route("/swgnull/", "GET")] + [Route("/swgnull", "GET")] public class NullableInRequest : IReturn<NullableResponse> { - [ApiMember] - public int? Position { get; set; } - } + [ApiMember] + public int? Position { get; set; } + + [ApiMember] + public bool IsRequired { get; set; } + } public class NullableService : Service { @@ -303,7 +308,7 @@ public override void Configure(Funq.Container container) SwaggerFeatureAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new SwaggerFeatureAppHostHttpListener(); @@ -311,7 +316,7 @@ public void TestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -323,7 +328,7 @@ public void TestFixtureTearDown() //new XmlServiceClient(ServiceClientBaseUri), }; - [Test, Explicit] + [Test, Ignore("Debug Test")] public void RunFor5Mins() { appHost.LoadPlugin(new CorsFeature("http://localhost:50000")); @@ -335,7 +340,7 @@ public void RunFor5Mins() [Test, TestCaseSource("RestClients")] public void Should_get_default_name_from_property(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swagger2/NameIsNotSetRequest"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swagger2/NameIsNotSetRequest"); var p = resource.Apis.SelectMany(t => t.Operations).SelectMany(t => t.Parameters); Assert.That(p.Count(), Is.EqualTo(1)); @@ -345,9 +350,7 @@ public void Should_get_default_name_from_property(IRestClient client) [Test, TestCaseSource("RestClients")] public void Should_group_similar_services(IRestClient client) { - var resources = client.Get<ResourcesResponse>("/resources"); - resources.PrintDump(); - + var resources = client.Get<SwaggerResourcesResponse>("/resources"); var swagger = resources.Apis.Where(t => t.Path.Contains("/resource/swg3")); Assert.That(swagger.Count(), Is.EqualTo(1)); } @@ -355,9 +358,7 @@ public void Should_group_similar_services(IRestClient client) [Test, TestCaseSource("RestClients")] public void Should_distinct_base_path(IRestClient client) { - var resources = client.Get<ResourcesResponse>("/resources"); - resources.PrintDump(); - + var resources = client.Get<SwaggerResourcesResponse>("/resources"); var swagger = resources.Apis.Where(t => t.Path.Contains("/resource/swgb3")); Assert.That(swagger.Count(), Is.EqualTo(1)); } @@ -365,9 +366,9 @@ public void Should_distinct_base_path(IRestClient client) [Test, TestCaseSource("RestClients")] public void Should_list_services(IRestClient client) { - var resources = client.Get<ResourcesResponse>("/resources"); + var resources = client.Get<SwaggerResourcesResponse>("/resources"); Assert.That(resources.BasePath, Is.EqualTo(BaseUrl)); - Assert.That(resources.SwaggerVersion, Is.EqualTo("1.1")); + Assert.That(resources.SwaggerVersion, Is.EqualTo("1.2")); Assert.That(resources.Apis, Is.Not.Null); var swagger = resources.Apis.FirstOrDefault(t => t.Path == "/resource/swagger"); @@ -383,9 +384,7 @@ public void Should_use_webhosturl_as_resources_base_path_when_configured(IRestCl { appHost.Config.WebHostUrl = webHostUrl; - var resources = client.Get<ResourcesResponse>("/resources"); - resources.PrintDump(); - + var resources = client.Get<SwaggerResourcesResponse>("/resources"); Assert.That(resources.BasePath, Is.EqualTo(webHostUrl)); } finally @@ -402,9 +401,7 @@ public void Should_use_webhosturl_as_resource_base_path_when_configured(IRestCli { appHost.Config.WebHostUrl = webHostUrl; - var resource = client.Get<ResourceResponse>("/resource/swagger"); - resource.PrintDump(); - + var resource = client.Get<SwaggerApiDeclaration>("/resource/swagger"); Assert.That(resource.BasePath, Is.EqualTo(webHostUrl)); } finally @@ -420,10 +417,8 @@ public void Should_use_https_for_resources_basepath_when_usehttpslinks_config_is { appHost.Config.UseHttpsLinks = true; - var resources = client.Get<ResourcesResponse>("/resources"); - resources.PrintDump(); - - Assert.That(resources.BasePath.ToLowerInvariant(), Is.StringStarting("https")); + var resources = client.Get<SwaggerResourcesResponse>("/resources"); + Assert.That(resources.BasePath.ToLowerInvariant(), Does.StartWith("https")); } finally { @@ -438,10 +433,10 @@ public void Should_use_https_for_resource_basepath_when_usehttpslinks_config_is_ { appHost.Config.UseHttpsLinks = true; - var resource = client.Get<ResourceResponse>("/resource/swagger"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swagger"); resource.PrintDump(); - Assert.That(resource.BasePath.ToLowerInvariant(), Is.StringStarting("https")); + Assert.That(resource.BasePath.ToLowerInvariant(), Does.StartWith("https")); } finally { @@ -452,55 +447,51 @@ public void Should_use_https_for_resource_basepath_when_usehttpslinks_config_is_ [Test, TestCaseSource("RestClients")] public void Should_retrieve_service_parameters(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swagger"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swagger"); Assert.That(resource.BasePath, Is.EqualTo(BaseUrl)); Assert.That(resource.ResourcePath, Is.EqualTo("/swagger")); Assert.That(resource.Apis, Is.Not.Empty); - resource.Apis.PrintDump(); - - var operations = new List<MethodOperation>(); + var operations = new List<SwaggerOperation>(); foreach(var api in resource.Apis) operations.AddRange(api.Operations); - var getOperation = operations.Single(t => t.HttpMethod == "GET"); + var getOperation = operations.Single(t => t.Method == "GET"); Assert.That(getOperation.Summary, Is.EqualTo("GET Summary")); Assert.That(getOperation.Notes, Is.EqualTo("GET Notes")); - Assert.That(getOperation.HttpMethod, Is.EqualTo("GET")); + Assert.That(getOperation.Method, Is.EqualTo("GET")); Assert.That(getOperation.Parameters, Is.Not.Empty); var p1 = getOperation.Parameters[0]; Assert.That(p1.Name, Is.EqualTo("Name")); Assert.That(p1.Description, Is.EqualTo("Name Description")); - Assert.That(p1.DataType, Is.EqualTo("string")); + Assert.That(p1.Type, Is.EqualTo("string")); Assert.That(p1.ParamType, Is.EqualTo("path")); Assert.That(p1.Required, Is.EqualTo(true)); - var postOperation = operations.Single(t => t.HttpMethod == "POST"); + var postOperation = operations.Single(t => t.Method == "POST"); Assert.That(postOperation.Summary, Is.EqualTo("POST Summary")); Assert.That(postOperation.Notes, Is.EqualTo("POST Notes")); - Assert.That(postOperation.HttpMethod, Is.EqualTo("POST")); + Assert.That(postOperation.Method, Is.EqualTo("POST")); } [Test, TestCaseSource("RestClients")] public void Should_retrieve_response_class_name(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swaggerModels"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swaggerModels"); Assert.That(resource.Apis, Is.Not.Empty); - var postOperation = resource.Apis.SelectMany(api => api.Operations).Single(t => t.HttpMethod == "POST"); - postOperation.PrintDump(); + var postOperation = resource.Apis.SelectMany(api => api.Operations).Single(t => t.Method == "POST"); Assert.That(postOperation.ResponseClass, Is.EqualTo(typeof(SwaggerFeatureResponse).Name)); } [Test, TestCaseSource("RestClients")] public void Should_retrieve_list_response_type_info(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swaggerGetList"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swaggerGetList"); Assert.That(resource.Apis, Is.Not.Empty); - var operation = resource.Apis.SelectMany(api => api.Operations).Single(t => t.HttpMethod == "GET"); - operation.PrintDump(); + var operation = resource.Apis.SelectMany(api => api.Operations).Single(t => t.Method == "GET"); Assert.That(operation.ResponseClass, Is.EqualTo("List[SwaggerFeatureResponse]")); Assert.That(resource.Models.ContainsKey("SwaggerFeatureResponse")); } @@ -508,11 +499,10 @@ public void Should_retrieve_list_response_type_info(IRestClient client) [Test, TestCaseSource("RestClients")] public void Should_retrieve_array_response_type_info(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swaggerGetArray"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swaggerGetArray"); Assert.That(resource.Apis, Is.Not.Empty); - var operation = resource.Apis.SelectMany(api => api.Operations).Single(t => t.HttpMethod == "GET"); - operation.PrintDump(); + var operation = resource.Apis.SelectMany(api => api.Operations).Single(t => t.Method == "GET"); Assert.That(operation.ResponseClass, Is.EqualTo("List[SwaggerFeatureResponse]")); Assert.That(resource.Models.ContainsKey("SwaggerFeatureResponse")); } @@ -520,12 +510,11 @@ public void Should_retrieve_array_response_type_info(IRestClient client) [Test, TestCaseSource("RestClients")] public void Should_retrieve_response_model(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swaggerModels"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swaggerModels"); Assert.That(resource.Models, Is.Not.Empty); Assert.That(resource.Models.ContainsKey(typeof(SwaggerFeatureResponse).Name), Is.True); var responseClassModel = resource.Models[typeof(SwaggerFeatureResponse).Name]; - responseClassModel.PrintDump(); Assert.That(responseClassModel.Id, Is.EqualTo(typeof(SwaggerFeatureResponse).Name)); Assert.That(responseClassModel.Properties, Is.Not.Empty); @@ -536,20 +525,22 @@ public void Should_retrieve_response_model(IRestClient client) [Test, TestCaseSource("RestClients")] public void Should_retrieve_request_body_model(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swaggerModels"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swaggerModels"); Assert.That(resource.Models, Is.Not.Empty); - resource.Models.PrintDump(); - var key = "POST_" + typeof(SwaggerModelsRequest).Name + "/swaggerModels/{UrlParam}"; + var key = typeof(SwaggerModelsRequest).Name; Assert.That(resource.Models.ContainsKey(key), Is.True); var requestClassModel = resource.Models[key]; Assert.That(requestClassModel.Id, Is.EqualTo(key)); Assert.That(requestClassModel.Properties, Is.Not.Empty); - Assert.That(requestClassModel.Properties.ContainsKey("Name"), Is.True); - Assert.That(requestClassModel.Properties["Name"].Type, Is.EqualTo(SwaggerType.String)); - Assert.That(requestClassModel.Properties["Name"].Description, Is.EqualTo("The request body")); + Assert.That(requestClassModel.Properties.ContainsKey("RequestBody"), Is.True); + Assert.That(requestClassModel.Properties["RequestBody"].Type, Is.EqualTo("SwaggerModelsRequest")); + Assert.That(requestClassModel.Properties["RequestBody"].Description, Is.EqualTo("The request body")); + + Assert.That(requestClassModel.Properties.ContainsKey("StringProperty"), Is.True); + Assert.That(requestClassModel.Properties["StringProperty"].Type, Is.EqualTo(SwaggerType.String)); Assert.That(requestClassModel.Properties.ContainsKey("ByteProperty")); Assert.That(requestClassModel.Properties["ByteProperty"].Type, Is.EqualTo(SwaggerType.Byte)); @@ -578,7 +569,7 @@ public void Should_retrieve_request_body_model(IRestClient client) Assert.That(requestClassModel.Properties["DateProperty"].Type, Is.EqualTo(SwaggerType.Date)); Assert.That(resource.Models.ContainsKey(typeof(DateTime).Name), Is.False); - key = "POST_" + typeof(SwaggerNestedModel).Name + "/swaggerModels/{UrlParam}"; + key = typeof(SwaggerNestedModel).Name; Assert.That(requestClassModel.Properties.ContainsKey("NestedModel"), Is.True); Assert.That(requestClassModel.Properties["NestedModel"].Type, Is.EqualTo(key)); Assert.That(requestClassModel.Properties["NestedModel"].Description, Is.EqualTo("NestedModel description")); @@ -594,17 +585,16 @@ public void Should_retrieve_request_body_model(IRestClient client) [Test, TestCaseSource("RestClients")] public void Should_retrieve_list_property_model(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swaggerModels"); - resource.PrintDump(); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swaggerModels"); - var key = "POST_" + typeof(SwaggerModelsRequest).Name + "/swaggerModels/{UrlParam}"; + var key = typeof(SwaggerModelsRequest).Name; Assert.That(resource.Models.ContainsKey(key), Is.True); var requestClassModel = resource.Models[key]; Assert.That(requestClassModel.Properties.ContainsKey("ListProperty"), Is.True); Assert.That(requestClassModel.Properties["ListProperty"].Type, Is.EqualTo(SwaggerType.Array)); - key = "POST_" + typeof(SwaggerNestedModel2).Name + "/swaggerModels/{UrlParam}"; + key = typeof(SwaggerNestedModel2).Name; Assert.That(requestClassModel.Properties["ListProperty"].Items["$ref"], Is.EqualTo(key)); Assert.That(resource.Models.ContainsKey(key), Is.True); } @@ -612,16 +602,16 @@ public void Should_retrieve_list_property_model(IRestClient client) [Test, TestCaseSource("RestClients")] public void Should_retrieve_array_property_model(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swaggerModels"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swaggerModels"); - var key = "POST_" + typeof(SwaggerModelsRequest).Name + "/swaggerModels/{UrlParam}"; + var key = typeof(SwaggerModelsRequest).Name; Assert.That(resource.Models.ContainsKey(key), Is.True); var requestClassModel = resource.Models[key]; Assert.That(requestClassModel.Properties.ContainsKey("ArrayProperty"), Is.True); Assert.That(requestClassModel.Properties["ArrayProperty"].Type, Is.EqualTo(SwaggerType.Array)); - key = "POST_" + typeof(SwaggerNestedModel3).Name + "/swaggerModels/{UrlParam}"; + key = typeof(SwaggerNestedModel3).Name; Assert.That(requestClassModel.Properties["ArrayProperty"].Items["$ref"], Is.EqualTo(key)); Assert.That(resource.Models.ContainsKey(key), Is.True); } @@ -629,30 +619,32 @@ public void Should_retrieve_array_property_model(IRestClient client) [Test, TestCaseSource("RestClients")] public void Should_retrieve_valid_nullable_fields(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swgnull"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swgnull"); - var key = "GET_" + typeof(NullableInRequest).Name + "/swgnull/"; + var key = typeof(NullableInRequest).Name; Assert.That(resource.Models.ContainsKey(key), Is.True); var requestClassModel = resource.Models[key]; Assert.That(requestClassModel.Properties.ContainsKey("Position"), Is.True); Assert.That(requestClassModel.Properties["Position"].Type, Is.EqualTo(SwaggerType.Int)); Assert.That(resource.Models.ContainsKey(typeof(NullableResponse).Name), Is.True); + Assert.That(!requestClassModel.Required.Contains("Position")); + Assert.That(requestClassModel.Required.Contains("IsRequired")); - var responseModel = resource.Models[typeof (NullableResponse).Name]; + var responseModel = resource.Models[typeof(NullableResponse).Name]; Assert.That(responseModel.Properties.ContainsKey("Optional"), Is.True); - Assert.That(responseModel.Properties["Optional"].Required, Is.False); + Assert.That(!responseModel.Required.Contains("Optional")); Assert.That(responseModel.Properties["Optional"].Type, Is.EqualTo(SwaggerType.Int)); - Assert.That(responseModel.Properties["NestedProperty2"].Required, Is.True); + Assert.That(responseModel.Required.Contains("NestedProperty2")); } // Ordering defined by: http://msdn.microsoft.com/en-us/library/ms729813.aspx [Test, TestCaseSource("RestClients")] public void Should_order_fields_with_DataMemberAttribute(IRestClient client) { - var resource = client.Get<ResourceResponse>("/resource/swgdatamemberorder"); + var resource = client.Get<SwaggerApiDeclaration>("/resource/swgdatamemberorder"); - var key = "GET_" + typeof(DataContractDerivedTypeRequest).Name + "/swgdatamemberorder"; + var key = typeof(DataContractDerivedTypeRequest).Name; Assert.That(resource.Models.ContainsKey(key), Is.True); var requestClassModel = resource.Models[key]; diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/SyncRestClientTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/SyncRestClientTests.cs index 963beba0bd1..3b34018491f 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/SyncRestClientTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/SyncRestClientTests.cs @@ -23,7 +23,7 @@ protected SyncRestClientTests(int port) ListeningOn += port + "/"; } - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { LogManager.LogFactory = new ConsoleLogFactory(); @@ -33,7 +33,7 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { Dispose(); @@ -187,8 +187,6 @@ public void Does_throw_400_for_Argument_exceptions() { var response = client.Put<InboxPostResponseRequestResponse>("inbox/123/responses", new InboxPostResponseRequest()); - response.PrintDump(); - Assert.Fail("Should throw"); } catch (WebServiceException webEx) @@ -206,8 +204,6 @@ public void Does_throw_400_for_Argument_exceptions_without_response_DTOs() { var response = client.Put<InboxPost>("inbox/123/responses", new InboxPost { Throw = true }); - response.PrintDump(); - Assert.Fail("Should throw"); } catch (WebServiceException webEx) @@ -245,6 +241,35 @@ public void Can_use_response_filters() } } + [TestFixture] + public class JsonSyncRestHttpClientTests : SyncRestClientTests + { + public JsonSyncRestHttpClientTests() + : base(8090) + { + } + + protected override IRestClient CreateRestClient() + { + return new JsonHttpClient(ListeningOn); + } + + [Test] + public void Can_use_response_filters() + { + var isActioncalledGlobal = false; + var isActioncalledLocal = false; + JsonHttpClient.GlobalResponseFilter = r => isActioncalledGlobal = true; + var restClient = (JsonHttpClient)CreateRestClient(); + restClient.ResponseFilter = r => isActioncalledLocal = true; + restClient.Get<MoviesResponse>("all-movies"); + Assert.That(isActioncalledGlobal, Is.True); + Assert.That(isActioncalledLocal, Is.True); + + JsonHttpClient.GlobalResponseFilter = null; + } + } + [TestFixture] public class JsvSyncRestClientTests : SyncRestClientTests { @@ -263,7 +288,7 @@ protected override IRestClient CreateRestClient() public class XmlSyncRestClientTests : SyncRestClientTests { public XmlSyncRestClientTests() - : base(8092) + : base(8094) { } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/TodoListTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/TodoListTests.cs index 5c536490383..edb2da67b50 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/TodoListTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/TodoListTests.cs @@ -101,7 +101,7 @@ public override void Configure(Container container) {} new Todo { Id = 3, Name = "Todo3", Content = "Content3", Done = false}, }; - [TestFixtureSetUp] + [OneTimeSetUp] public void OnTestFixtureSetUp() { appHost = new TodoListAppHostHttpListener(); @@ -109,7 +109,7 @@ public void OnTestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void OnTestFixtureTearDown() { appHost.Dispose(); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/TypedFilterTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/TypedFilterTests.cs new file mode 100644 index 00000000000..a8a83d6ff12 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/TypedFilterTests.cs @@ -0,0 +1,118 @@ +using NUnit.Framework; +using ServiceStack.Host; +using ServiceStack.Testing; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [TestFixture] + public class TypedFilterTests + { + private class Dto : IReturn<Dto> + { + public bool RequestFilter { get; set; } + public bool ResponseFilter { get; set; } + } + + private class DtoService : Service + { + public object Any(Dto r) => r; + } + + private interface IDependency { } + private class Dependency : IDependency { } + + private class TypedRequestFilter : ITypedFilter<Dto> + { + public TypedRequestFilter(IDependency dependency) => Dependency = dependency; + + public IDependency Dependency { get; } + + public void Invoke(IRequest req, IResponse res, Dto dto) => dto.RequestFilter = true; + } + + private class TypedResponseFilter : ITypedFilter<Dto> + { + public TypedResponseFilter(IDependency dependency) => Dependency = dependency; + + public IDependency Dependency { get; } + + public void Invoke(IRequest req, IResponse res, Dto dto) => dto.ResponseFilter = true; + } + + private ServiceStackHost appHost; + + [OneTimeSetUp] + public void OnTestFixtureSetup() + { + appHost = new BasicAppHost(typeof(DtoService).Assembly) + { + ConfigureContainer = c => + { + c.RegisterAutoWiredAs<Dependency, IDependency>(); + c.RegisterAutoWired<TypedRequestFilter>(); + c.RegisterAutoWired<TypedResponseFilter>(); + } + }; + appHost.RegisterTypedRequestFilter(c => c.Resolve<TypedRequestFilter>()); + appHost.RegisterTypedResponseFilter(c => c.Resolve<TypedResponseFilter>()); + appHost.Init(); + } + + [OneTimeTearDown] + public void OnTestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Request_filter_auto_wired() + { + // Arrange + var filter = appHost.GetContainer().Resolve<TypedRequestFilter>(); + + // Assert + Assert.NotNull(filter.Dependency); + } + + [Test] + public void Response_filter_auto_wired() + { + // Arrange + var filter = appHost.GetContainer().Resolve<TypedResponseFilter>(); + + // Assert + Assert.NotNull(filter.Dependency); + } + + [Test] + public void Request_filter_executed() + { + // Arrange + var dto = new Dto(); + var request = new BasicRequest(dto); + + // Act + var response = appHost.ServiceController.Execute(dto, request, true) as Dto; + + // Assert + Assert.NotNull(response); + Assert.IsTrue(response.RequestFilter); + } + + [Test] + public void Response_filter_executed() + { + // Arrange + var dto = new Dto(); + var request = new BasicRequest(dto); + + // Act + var response = appHost.ServiceController.Execute(dto, request, true) as Dto; + + // Assert + Assert.NotNull(response); + Assert.IsTrue(response.ResponseFilter); + } + } +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/UniqueRequestTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/UniqueRequestTests.cs index 0638866a49d..c16dae5bf76 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/UniqueRequestTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/UniqueRequestTests.cs @@ -3,8 +3,10 @@ using Funq; using NUnit.Framework; using ServiceStack.Common; -using ServiceStack.MiniProfiler.UI; using ServiceStack.Text; +#if !NETCORE_SUPPORT +using ServiceStack.MiniProfiler.UI; +#endif namespace ServiceStack.WebHost.Endpoints.Tests { @@ -34,6 +36,21 @@ public object Any(Collections request) } } + [Route("/head-test/{Id}")] + public class HeadTest + { + public string Id { get; set; } + } + + public class HeadTestService : Service + { + public void Any(HeadTest request) + { + Response.AddHeader("Id", request.Id); + Response.EndRequest(); + } + } + public class UniqueRequestAppHost : AppHostHttpListenerBase { public UniqueRequestAppHost() : base("Unique Request Tests", typeof(UniqueRequestService).Assembly) {} @@ -43,10 +60,10 @@ public override void Configure(Container container) {} [TestFixture] public class UniqueRequestTests { - private const string BaseUri = "http://localhost:8000"; + private const string BaseUri = "http://localhost:8001"; private UniqueRequestAppHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new UniqueRequestAppHost(); @@ -54,7 +71,7 @@ public void TestFixtureSetUp() appHost.Start(BaseUri + "/"); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -138,5 +155,16 @@ public void Can_handle_collections_with_HttpClient_on_predefined_route() Assert.That(response.Ids, Is.EquivalentTo(new[] { 1, 2, 3 })); Assert.That(response.Names, Is.EquivalentTo(new List<string> { "A", "B", "C" })); } + + [Test] + public void Does_populate_Head_requests() + { + var json = BaseUri.CombineWith("json", "reply", nameof(HeadTest)) + .AddQueryParam("Id", 1) + .SendStringToUrl(method:HttpMethods.Head, responseFilter: res => { + Assert.That(res.Headers["Id"], Is.EqualTo("1")); + }); + Assert.That(json, Is.Empty); + } } } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/UnitTestExample.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/UnitTestExample.cs index 76d34a58e10..3f2ab0eb435 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/UnitTestExample.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/UnitTestExample.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt @@ -10,6 +10,7 @@ using NUnit.Framework; using ServiceStack.Configuration; using ServiceStack.Data; +using ServiceStack.DataAnnotations; using ServiceStack.OrmLite; using ServiceStack.Testing; using ServiceStack.Text; @@ -29,6 +30,12 @@ public class GetStatus public string LastName { get; set; } } + public enum LivingStatus + { + Alive, + Dead + } + // Types public class Rockstar { @@ -36,6 +43,9 @@ public class Rockstar public string FirstName { get; set; } public string LastName { get; set; } public int? Age { get; set; } + public DateTime DateOfBirth { get; set; } + public DateTime? DateDied { get; set; } + public LivingStatus LivingStatus { get; set; } } public class RockstarStatus @@ -44,6 +54,13 @@ public class RockstarStatus public bool Alive { get; set; } } + public class PagingTest + { + public int Id { get; set; } + public string Name { get; set; } + public int Value { get; set; } + } + // Implementation public class SimpleService : Service { @@ -117,18 +134,18 @@ public void Dispose() public class UnitTestExample { public static List<Rockstar> SeedData = new[] { - new Rockstar { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 }, - new Rockstar { Id = 2, FirstName = "Jim", LastName = "Morrison", Age = 27 }, - new Rockstar { Id = 3, FirstName = "Kurt", LastName = "Cobain", Age = 27 }, - new Rockstar { Id = 4, FirstName = "Elvis", LastName = "Presley", Age = 42 }, - new Rockstar { Id = 5, FirstName = "David", LastName = "Grohl", Age = 44 }, - new Rockstar { Id = 6, FirstName = "Eddie", LastName = "Vedder", Age = 48 }, - new Rockstar { Id = 7, FirstName = "Michael", LastName = "Jackson", Age = 27 }, + new Rockstar { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27, DateOfBirth = new DateTime(1942, 11, 27), DateDied = new DateTime(1970, 09, 18), }, + new Rockstar { Id = 2, FirstName = "Jim", LastName = "Morrison", Age = 27, DateOfBirth = new DateTime(1943, 12, 08), DateDied = new DateTime(1971, 07, 03), }, + new Rockstar { Id = 3, FirstName = "Kurt", LastName = "Cobain", Age = 27, DateOfBirth = new DateTime(1967, 02, 20), DateDied = new DateTime(1994, 04, 05), }, + new Rockstar { Id = 4, FirstName = "Elvis", LastName = "Presley", Age = 42, DateOfBirth = new DateTime(1935, 01, 08), DateDied = new DateTime(1977, 08, 16), }, + new Rockstar { Id = 5, FirstName = "David", LastName = "Grohl", Age = 44, DateOfBirth = new DateTime(1969, 01, 14), }, + new Rockstar { Id = 6, FirstName = "Eddie", LastName = "Vedder", Age = 48, DateOfBirth = new DateTime(1964, 12, 23), }, + new Rockstar { Id = 7, FirstName = "Michael", LastName = "Jackson", Age = 50, DateOfBirth = new DateTime(1958, 08, 29), DateDied = new DateTime(2009, 06, 05), }, }.ToList(); private ServiceStackHost appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new BasicAppHost().Init(); @@ -148,7 +165,7 @@ public void TestFixtureSetUp() } } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -161,8 +178,6 @@ public void Using_in_memory_database() var rockstars = service.Get(new FindRockstars { Aged = 27 }); - rockstars.PrintDump(); //Print results to screen - Assert.That(rockstars.Count, Is.EqualTo(SeedData.Count(x => x.Age == 27))); var status = service.Get(new GetStatus { LastName = "Vedder" }); diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/BasicEncryptedMessagesTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/BasicEncryptedMessagesTests.cs new file mode 100644 index 00000000000..af874caa412 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/BasicEncryptedMessagesTests.cs @@ -0,0 +1,128 @@ +// Copyright (c) ServiceStack, Inc. All Rights Reserved. +// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt + +using System; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.UseCases +{ + public class BasicEncryptedMessagesAppHost : AppSelfHostBase + { + public BasicEncryptedMessagesAppHost() + : base(typeof(BasicEncryptedMessagesAppHost).Name, typeof(BasicEncryptedMessagesService).Assembly) { } + + public override void Configure(Container container) + { + RequestConverters.Add((req, requestDto) => { + if (!(requestDto is BasicEncryptedMessage encRequest)) + return null; + + var requestType = Metadata.GetOperationType(encRequest.OperationName); + var decryptedJson = RsaUtils.Decrypt(encRequest.EncryptedBody, SecureConfig.PrivateKeyXml); + var request = JsonSerializer.DeserializeFromString(decryptedJson, requestType); + + req.Items["_encrypt"] = encRequest; + + return Task.FromResult(request); + }); + + ResponseConverters.Add((req, response) => { + if (!req.Items.ContainsKey("_encrypt")) + return TypeConstants.EmptyTask; + + var encResponse = RsaUtils.Encrypt(response.ToJson(), SecureConfig.PublicKeyXml); + return Task.FromResult((object)new BasicEncryptedMessageResponse + { + OperationName = response.GetType().Name, + EncryptedBody = encResponse + }); + }); + } + } + + public class BasicEncryptedMessage : IReturn<BasicEncryptedMessageResponse> + { + public string OperationName { get; set; } + public string EncryptedBody { get; set; } + } + + public class BasicEncryptedMessageResponse + { + public string OperationName { get; set; } + public string EncryptedBody { get; set; } + + public ResponseStatus ResponseStatus { get; set; } + } + + public class BasicEncryptedMessagesService : Service + { + public object Any(BasicEncryptedMessage request) + { + throw new NotImplementedException("Dummy method so EncryptedMessage is treated as a Service"); + } + } + + [TestFixture] + public class BasicEncryptedMessagesTests + { + private readonly ServiceStackHost appHost; + + public BasicEncryptedMessagesTests() + { + appHost = new BasicEncryptedMessagesAppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Generate_Key_Pair() + { + var keyPair = RsaUtils.CreatePublicAndPrivateKeyPair(); + + "Public Key: {0}\n".Print(keyPair.PublicKey); + "Private Key: {0}\n".Print(keyPair.PrivateKey); + } + + [Test] + public void Can_Encryt_and_Decrypt_String() + { + var request = new HelloSecure { Name = "World" }; + var requestJson = request.ToJson(); + var encRequest = RsaUtils.Encrypt(requestJson, SecureConfig.PublicKeyXml); + + var decJson = RsaUtils.Decrypt(encRequest, SecureConfig.PrivateKeyXml); + + Assert.That(decJson, Is.EqualTo(requestJson)); + } + + [Test] + public void Can_Send_Encrypted_Message() + { + var client = new JsonServiceClient(Config.AbsoluteBaseUri); + + var request = new HelloSecure { Name = "World" }; + var encRequest = RsaUtils.Encrypt(request.ToJson(), SecureConfig.PublicKeyXml); + + var encResponse = client.Post(new BasicEncryptedMessage + { + OperationName = typeof(HelloSecure).Name, + EncryptedBody = encRequest + }); + + var responseJson = RsaUtils.Decrypt(encResponse.EncryptedBody, SecureConfig.PrivateKeyXml); + var response = responseJson.FromJson<HelloSecureResponse>(); + + Assert.That(response.Result, Is.EqualTo("Hello, World!")); + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/EncryptedMessagesTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/EncryptedMessagesTests.cs new file mode 100644 index 00000000000..ecfd91ed36a --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/EncryptedMessagesTests.cs @@ -0,0 +1,689 @@ +// Copyright (c) ServiceStack, Inc. All Rights Reserved. +// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt + +using System; +using System.Net; +using System.Security.Cryptography; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests.UseCases +{ + public class EncryptedMessagesAppHost : AppSelfHostBase + { + public EncryptedMessagesAppHost() + : base(nameof(EncryptedMessagesAppHost), typeof(SecureServices).Assembly) + { } + + public override void Configure(Container container) + { + Plugins.Add(new EncryptedMessagesFeature + { + PrivateKey = SecureConfig.PrivateKeyXml.ToPrivateRSAParameters(), + FallbackPrivateKeys = { + SecureConfig.FallbackPrivateKeyXml.ToPrivateRSAParameters() + }, + }); + + var apiKeyAuth = new ApiKeyAuthProvider(AppSettings); + var jwtAuth = new JwtAuthProvider(AppSettings) { + AuthKey = AesUtils.CreateKey() + }; + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] { + new CredentialsAuthProvider(AppSettings), + apiKeyAuth, + jwtAuth, + })); + + container.Register<IAuthRepository>(c => new InMemoryAuthRepository()); + var authRepo = container.Resolve<IAuthRepository>(); + + var userAuth = authRepo.CreateUserAuth( + new UserAuth { Email = "test@gmail.com" }, "p@55word"); + + var apiKeys = apiKeyAuth.GenerateNewApiKeys(userAuth.Id.ToString(), "live"); + var apiKeyRepo = (IManageApiKeys) authRepo; + apiKeyRepo.StoreAll(apiKeys); + LiveApiKey = apiKeys[0]; + + JwtBearerToken = jwtAuth.CreateJwtBearerToken(new AuthUserSession { + UserAuthId = userAuth.Id.ToString(), + Email = userAuth.Email, + IsAuthenticated = true, + }); + } + + public ApiKey LiveApiKey { get; set; } + + public string JwtBearerToken { get; set; } + } + + public class JsonServiceClientEncryptedMessagesTests : EncryptedMessagesTests + { + protected override IJsonServiceClient CreateClient() + { + return new JsonServiceClient(Config.AbsoluteBaseUri); + } + } + + public class JsonHttpClientEncryptedMessagesTests : EncryptedMessagesTests + { + protected override IJsonServiceClient CreateClient() + { + return new JsonHttpClient(Config.AbsoluteBaseUri); + } + } + + public abstract class EncryptedMessagesTests + { + private readonly ServiceStackHost appHost; + + public ApiKey LiveApiKey => ((EncryptedMessagesAppHost)appHost).LiveApiKey; + public string JwtBearerToken => ((EncryptedMessagesAppHost)appHost).JwtBearerToken; + + protected EncryptedMessagesTests() + { + appHost = new EncryptedMessagesAppHost() + .Init() + .Start(Config.AbsoluteBaseUri); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + ((IClearable)appHost.TryResolve<IAuthRepository>()).Clear(); //Flush InMemoryAuthProvider + appHost.Dispose(); + } + + protected abstract IJsonServiceClient CreateClient(); + + [Test] + public void Can_Send_Encrypted_Message_with_ServiceClients() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get(new GetPublicKey())); + + var response = encryptedClient.Send(new HelloSecure { Name = "World" }); + + Assert.That(response.Result, Is.EqualTo("Hello, World!")); + } + + [Test] + public void Can_Send_Secure_Restricted_Encrypted_Message_with_ServiceClients() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get(new GetPublicKey())); + + var response = encryptedClient.Send(new HelloSecureRestricted { Name = "World" }); + + Assert.That(response.Result, Is.EqualTo("Hello, World!")); + } + + [Test] + public void Can_Send_Encrypted_OneWay_Message_with_ServiceClients() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get(new GetPublicKey())); + + encryptedClient.Send(new HelloOneWay { Name = "World" }); + + Assert.That(HelloOneWay.LastName, Is.EqualTo("World")); + } + + [Test] + public void Can_Send_Encrypted_EmptyRequest_with_ServiceClients() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get(new GetPublicKey())); + + var response = encryptedClient.Delete(new EncryptedDelete()); + + Assert.That(response, Is.Not.Null); + } + + [Test] + public void Can_authenticate_and_call_authenticated_Service() + { + try + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + + var authResponse = encryptedClient.Send(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "test@gmail.com", + Password = "p@55word", + }); + + var encryptedClientCookies = client.GetCookieValues(); + Assert.That(encryptedClientCookies.Count, Is.EqualTo(0)); + + var response = encryptedClient.Send(new HelloAuthenticated + { + SessionId = authResponse.SessionId, + }); + + Assert.That(response.IsAuthenticated); + Assert.That(response.Email, Is.EqualTo("test@gmail.com")); + Assert.That(response.SessionId, Is.EqualTo(authResponse.SessionId)); + + encryptedClientCookies = client.GetCookieValues(); + Assert.That(encryptedClientCookies.Count, Is.EqualTo(0)); + } + catch (Exception ex) + { + throw ex; + } + } + + [Test] + public void Does_populate_Request_metadata() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + + var authResponse = encryptedClient.Send(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "test@gmail.com", + Password = "p@55word", + }); + + var encryptedClientCookies = client.GetCookieValues(); + Assert.That(encryptedClientCookies.Count, Is.EqualTo(0)); + + encryptedClient.Version = 1; + encryptedClient.SessionId = authResponse.SessionId; + + var response = encryptedClient.Send(new HelloAuthenticated()); + Assert.That(response.SessionId, Is.EqualTo(encryptedClient.SessionId)); + Assert.That(response.Version, Is.EqualTo(encryptedClient.Version)); + + encryptedClientCookies = client.GetCookieValues(); + Assert.That(encryptedClientCookies.Count, Is.EqualTo(0)); + + client.SessionId = authResponse.SessionId; + client.Version = 2; + + response = client.Send(new HelloAuthenticated()); + Assert.That(response.SessionId, Is.EqualTo(client.SessionId)); + Assert.That(response.Version, Is.EqualTo(client.Version)); + } + + [Test] + public void Can_Authenticate_then_call_AuthOnly_Services_with_ServiceClients_Temp() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + + var authResponse = encryptedClient.Send(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "test@gmail.com", + Password = "p@55word", + }); + + client.SetCookie("ss-id", authResponse.SessionId); + var response = client.Get(new HelloAuthSecure { Name = "World" }); + } + + [Test] + public void Can_Authenticate_then_call_AuthOnly_Services_with_ServiceClients_Perm() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + + var authResponse = encryptedClient.Send(new Authenticate + { + provider = CredentialsAuthProvider.Name, + UserName = "test@gmail.com", + Password = "p@55word", + RememberMe = true, + }); + + client.SetCookie("ss-pid", authResponse.SessionId); + client.SetCookie("ss-opt", "perm"); + var response = client.Get(new HelloAuthSecure { Name = "World" }); + } + + [Test] + public void Can_Authenticate_with_ApiKey_then_call_AuthOnly_Services_with_ServiceClients() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + encryptedClient.BearerToken = LiveApiKey.Id; + + var response = encryptedClient.Get(new HelloAuthenticated()); + } + + [Test] + public void Can_Authenticate_with_JWT_then_call_AuthOnly_Services_with_ServiceClients() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + encryptedClient.BearerToken = JwtBearerToken; + + var response = encryptedClient.Get(new HelloAuthenticated()); + } + + [Test] + public void Does_handle_Exceptions() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + + try + { + var response = encryptedClient.Send(new HelloSecure()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ResponseStatus.ErrorCode, Is.EqualTo(nameof(ArgumentNullException))); + Assert.That(ex.ResponseStatus.Message, Is.EqualTo($"Value cannot be null.{Environment.NewLine}Parameter name: Name")); + } + + try + { + var response = encryptedClient.Send(new HelloAuthenticated()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + Assert.That(ex.StatusDescription, Is.EqualTo("Unauthorized")); + } + } + + [Test] + public void Can_call_GET_only_Services() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + + var response = encryptedClient.Get(new GetSecure { Name = "World" }); + + Assert.That(response.Result, Is.EqualTo("Hello, World!")); + } + + [Test] + public void Can_send_large_messages() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + + var request = new LargeMessage + { + Messages = 100.Times(i => new HelloSecure { Name = "Name" + i }) + }; + + var response = encryptedClient.Send(request); + + Assert.That(response.Messages.Count, Is.EqualTo(request.Messages.Count)); + } + + [Test] + public void Can_send_auto_batched_requests() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + + var names = new[] { "Foo", "Bar", "Baz" }; + var requests = names.Map(x => new HelloSecure { Name = x }); + + var responses = encryptedClient.SendAll(requests); + var responseNames = responses.Map(x => x.Result); + + Assert.That(responseNames, Is.EqualTo(names.Map(x => "Hello, {0}!".Fmt(x)))); + } + + [Test] + public void Can_send_PublishAll_requests() + { + var client = CreateClient(); + IEncryptedClient encryptedClient = client.GetEncryptedClient(client.Get<string>("/publickey")); + + var names = new[] { "Foo", "Bar", "Baz" }; + var requests = names.Map(x => new HelloSecure { Name = x }); + + encryptedClient.PublishAll(requests); + } + + [Test] + public void Can_Send_Encrypted_Message() + { + var client = CreateClient(); + + var request = new HelloSecure { Name = "World" }; + + AesUtils.CreateCryptAuthKeysAndIv(out var cryptKey, out var authKey, out var iv); + + var cryptAuthKeys = cryptKey.Combine(authKey); + + var rsaEncCryptAuthKeys = RsaUtils.Encrypt(cryptAuthKeys, SecureConfig.PublicKeyXml); + var authRsaEncCryptAuthKeys = HmacUtils.Authenticate(rsaEncCryptAuthKeys, authKey, iv); + + var timestamp = DateTime.UtcNow.ToUnixTime(); + var requestBody = timestamp + " POST " + nameof(HelloSecure) + " " + request.ToJson(); + + var encryptedBytes = AesUtils.Encrypt(requestBody.ToUtf8Bytes(), cryptKey, iv); + var authEncryptedBytes = HmacUtils.Authenticate(encryptedBytes, authKey, iv); + + var encryptedMessage = new EncryptedMessage + { + EncryptedSymmetricKey = Convert.ToBase64String(authRsaEncCryptAuthKeys), + EncryptedBody = Convert.ToBase64String(authEncryptedBytes), + }; + + var encResponse = client.Post(encryptedMessage); + + authEncryptedBytes = Convert.FromBase64String(encResponse.EncryptedBody); + + if (!HmacUtils.Verify(authEncryptedBytes, authKey)) + throw new Exception("Invalid EncryptedBody"); + + var decryptedBytes = HmacUtils.DecryptAuthenticated(authEncryptedBytes, cryptKey); + + var responseJson = decryptedBytes.FromUtf8Bytes(); + var response = responseJson.FromJson<HelloSecureResponse>(); + + Assert.That(response.Result, Is.EqualTo("Hello, World!")); + } + + [Test] + public void Does_throw_on_old_messages() + { + var client = CreateClient(); + + var request = new HelloSecure { Name = "World" }; + + AesUtils.CreateCryptAuthKeysAndIv(out var cryptKey, out var authKey, out var iv); + + var cryptAuthKeys = cryptKey.Combine(authKey); + + var rsaEncCryptAuthKeys = RsaUtils.Encrypt(cryptAuthKeys, SecureConfig.PublicKeyXml); + var authRsaEncCryptAuthKeys = HmacUtils.Authenticate(rsaEncCryptAuthKeys, authKey, iv); + + var timestamp = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(21)).ToUnixTime(); + + var requestBody = timestamp + " POST " + nameof(HelloSecure) + " " + request.ToJson(); + + var encryptedBytes = AesUtils.Encrypt(requestBody.ToUtf8Bytes(), cryptKey, iv); + var authEncryptedBytes = HmacUtils.Authenticate(encryptedBytes, authKey, iv); + + try + { + var encryptedMessage = new EncryptedMessage + { + EncryptedSymmetricKey = Convert.ToBase64String(authRsaEncCryptAuthKeys), + EncryptedBody = Convert.ToBase64String(authEncryptedBytes), + }; + var encResponse = client.Post(encryptedMessage); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.StatusDescription.Print(); + + var errorResponse = (EncryptedMessageResponse)ex.ResponseDto; + + authEncryptedBytes = Convert.FromBase64String(errorResponse.EncryptedBody); + if (!HmacUtils.Verify(authEncryptedBytes, authKey)) + throw new Exception("EncryptedBody is Invalid"); + + var responseBytes = HmacUtils.DecryptAuthenticated(authEncryptedBytes, cryptKey); + var responseJson = responseBytes.FromUtf8Bytes(); + var response = responseJson.FromJson<ErrorResponse>(); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("Request too old")); + } + } + + [Test] + public void Does_throw_on_replayed_messages() + { + var client = CreateClient(); + + var request = new HelloSecure { Name = "World" }; + + AesUtils.CreateKeyAndIv(out var cryptKey, out var iv); + + byte[] authKey = AesUtils.CreateKey(); + + var cryptAuthKeys = cryptKey.Combine(authKey); + + var rsaEncCryptAuthKeys = RsaUtils.Encrypt(cryptAuthKeys, SecureConfig.PublicKeyXml); + var authRsaEncCryptAuthKeys = HmacUtils.Authenticate(rsaEncCryptAuthKeys, authKey, iv); + + var timestamp = DateTime.UtcNow.ToUnixTime(); + var requestBody = timestamp + " POST " + nameof(HelloSecure) + " " + request.ToJson(); + + var encryptedBytes = AesUtils.Encrypt(requestBody.ToUtf8Bytes(), cryptKey, iv); + var authEncryptedBytes = HmacUtils.Authenticate(encryptedBytes, authKey, iv); + + var encryptedMessage = new EncryptedMessage + { + EncryptedSymmetricKey = Convert.ToBase64String(authRsaEncCryptAuthKeys), + EncryptedBody = Convert.ToBase64String(authEncryptedBytes), + }; + + var encResponse = client.Post(encryptedMessage); + + try + { + client.Post(encryptedMessage); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.StatusDescription.Print(); + + var errorResponse = (EncryptedMessageResponse)ex.ResponseDto; + + authEncryptedBytes = Convert.FromBase64String(errorResponse.EncryptedBody); + if (!HmacUtils.Verify(authEncryptedBytes, authKey)) + throw new Exception("EncryptedBody is Invalid"); + + var responseBytes = HmacUtils.DecryptAuthenticated(authEncryptedBytes, cryptKey); + var responseJson = responseBytes.FromUtf8Bytes(); + var response = responseJson.FromJson<ErrorResponse>(); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("Nonce already seen")); + } + } + + [Test] + public void Can_send_encrypted_messages_with_old_registered_PublicKey() + { + var client = CreateClient(); + var encryptedClient = client.GetEncryptedClient(SecureConfig.FallbackPublicKeyXml); + + var response = encryptedClient.Send(new HelloSecure { Name = "Fallback Key" }); + + Assert.That(response.Result, Is.EqualTo("Hello, Fallback Key!")); + } + + [Test] + public void Fails_when_sending_invalid_KeyId() + { + var client = CreateClient(); + var encryptedClient = (EncryptedServiceClient)client.GetEncryptedClient(SecureConfig.FallbackPublicKeyXml); + encryptedClient.KeyId = "AAAAAA"; + + try + { + var response = encryptedClient.Send(new HelloSecure { Name = "Fallback Key" }); + Assert.Fail("Should Throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.NotFound)); + Assert.That(ex.StatusDescription, Is.EqualTo("KeyNotFoundException")); + Assert.That(ex.ResponseStatus.Message, Does.StartWith(EncryptedMessagesFeature.ErrorKeyNotFound.Substring(0,10))); + } + } + } + + public class CryptUtilsTests + { + [Test] + public void Can_Encrypt_and_Decrypt_with_AES() + { + var msg = new HelloSecure { Name = "World" }; + + AesUtils.CreateKeyAndIv(out var cryptKey, out var iv); + + var encryptedText = AesUtils.Encrypt(msg.ToJson(), cryptKey, iv); + + var decryptedJson = AesUtils.Decrypt(encryptedText, cryptKey, iv); + + var decryptedMsg = decryptedJson.FromJson<HelloSecure>(); + + Assert.That(decryptedMsg.Name, Is.EqualTo(msg.Name)); + } + + [Test] + public void Can_Encrypt_and_Decrypt_with_AES_bytes() + { + var msg = new HelloSecure { Name = "World" }; + + AesUtils.CreateKeyAndIv(out var cryptKey, out var iv); + + var encryptedBytes = AesUtils.Encrypt(msg.ToJson().ToUtf8Bytes(), cryptKey, iv); + + var msgBytes = AesUtils.Decrypt(encryptedBytes, cryptKey, iv); + + var decryptedMsg = msgBytes.FromUtf8Bytes().FromJson<HelloSecure>(); + + Assert.That(decryptedMsg.Name, Is.EqualTo(msg.Name)); + } + + [Test] + public void Does_Hybrid_RSA_Crypt_and_Auth_AES_with_HMAC_SHA256() + { + var request = new HelloSecure { Name = "World" }; + var timestamp = DateTime.UtcNow.ToUnixTime(); + var msg = timestamp + " POST " + request.GetType().Name + " " + request.ToJson(); + var msgBytes = msg.ToUtf8Bytes(); + + AesUtils.CreateCryptAuthKeysAndIv(out var cryptKey, out var authKey, out var iv); + + var encryptedBytes = AesUtils.Encrypt(msgBytes, cryptKey, iv); + + var decryptedBytes = AesUtils.Decrypt(encryptedBytes, cryptKey, iv); + Assert.That(decryptedBytes, Is.EquivalentTo(msgBytes)); + + var authEncryptedBytes = HmacUtils.Authenticate(encryptedBytes, authKey, iv); + + var cryptAuthKeys = cryptKey.Combine(authKey); + + var rsaEncCryptAuthKeys = RsaUtils.Encrypt(cryptAuthKeys, SecureConfig.PublicKeyXml); + var authRsaEncCryptAuthKeys = HmacUtils.Authenticate(rsaEncCryptAuthKeys, authKey, iv); + + var decryptedMsg = ValidateAndDecrypt(authRsaEncCryptAuthKeys, authEncryptedBytes); + + var parts = decryptedMsg.SplitOnFirst(' '); + Assert.That(long.Parse(parts[0]), Is.EqualTo(timestamp)); + + parts = parts[1].SplitOnFirst(' '); + Assert.That(parts[0], Is.EqualTo("POST")); + + parts = parts[1].SplitOnFirst(' '); + Assert.That(parts[0], Is.EqualTo(request.GetType().Name)); + + var decryptedJson = parts[1]; + var decryptedRequest = decryptedJson.FromJson<HelloSecure>(); + + Assert.That(decryptedRequest.Name, Is.EqualTo(request.Name)); + } + + private static string ValidateAndDecrypt(byte[] authRsaEncCryptKey, byte[] authEncryptedBytes) + { + byte[] iv = new byte[AesUtils.BlockSizeBytes]; + const int tagLength = HmacUtils.KeySizeBytes; + byte[] rsaEncCryptAuthKeys = new byte[authRsaEncCryptKey.Length - iv.Length - tagLength]; + + Buffer.BlockCopy(authRsaEncCryptKey, 0, iv, 0, iv.Length); + Buffer.BlockCopy(authRsaEncCryptKey, iv.Length, rsaEncCryptAuthKeys, 0, rsaEncCryptAuthKeys.Length); + + var cryptAuthKeys = RsaUtils.Decrypt(rsaEncCryptAuthKeys, SecureConfig.PrivateKeyXml); + + byte[] cryptKey = new byte[AesUtils.KeySizeBytes]; + byte[] authKey = new byte[AesUtils.KeySizeBytes]; + + Buffer.BlockCopy(cryptAuthKeys, 0, cryptKey, 0, cryptKey.Length); + Buffer.BlockCopy(cryptAuthKeys, cryptKey.Length, authKey, 0, authKey.Length); + + if (!HmacUtils.Verify(authRsaEncCryptKey, authKey)) + throw new Exception("authRsaEncCryptKey is Invalid"); + + if (!HmacUtils.Verify(authEncryptedBytes, authKey)) + throw new Exception("authEncryptedBytes is Invalid"); + + var msgBytes = HmacUtils.DecryptAuthenticated(authEncryptedBytes, cryptKey); + + return msgBytes.FromUtf8Bytes(); + } + + //Alternate approach use Master Key with SHA-512 to create Crypt + Auth Keys + + [Test] + public void Does_Hybrid_RSA_SHA512_AES_MasterKey_and_HmacSha256() + { + var request = new HelloSecure { Name = "World" }; + var msgBytes = request.ToJson().ToUtf8Bytes(); + + AesUtils.CreateKeyAndIv(out var masterKey, out var iv); + + var sha512KeyBytes = masterKey.ToSha512HashBytes(); + + var cryptKey = new byte[sha512KeyBytes.Length / 2]; + var authKey = new byte[sha512KeyBytes.Length / 2]; + + Buffer.BlockCopy(sha512KeyBytes, 0, cryptKey, 0, cryptKey.Length); + Buffer.BlockCopy(sha512KeyBytes, cryptKey.Length, authKey, 0, authKey.Length); + + var encryptedBytes = AesUtils.Encrypt(msgBytes, cryptKey, iv); + var authEncryptedBytes = HmacUtils.Authenticate(encryptedBytes, authKey, iv); + + var aesKeyNonceBytes = iv.Combine(masterKey); + var rsaEncAesKeyNonceBytes = RsaUtils.Encrypt(aesKeyNonceBytes, SecureConfig.PublicKeyXml); + + var json = ValidateAndDecryptWithMasterKey(rsaEncAesKeyNonceBytes, authEncryptedBytes); + + var fromJson = json.FromJson<HelloSecure>(); + + Assert.That(fromJson.Name, Is.EqualTo(request.Name)); + } + + private static string ValidateAndDecryptWithMasterKey(byte[] rsaEncAesKeyNonceBytes, byte[] authEncryptedBytes) + { + var aesKeyNonceBytes = RsaUtils.Decrypt(rsaEncAesKeyNonceBytes, SecureConfig.PrivateKeyXml); + + var aesKey = new byte[AesUtils.KeySizeBytes]; + var iv = new byte[AesUtils.BlockSizeBytes]; + + Buffer.BlockCopy(aesKeyNonceBytes, 0, iv, 0, iv.Length); + Buffer.BlockCopy(aesKeyNonceBytes, iv.Length, aesKey, 0, aesKey.Length); + + var sha512HashBytes = aesKey.ToSha512HashBytes(); + var cryptKey = new byte[sha512HashBytes.Length / 2]; + var authKey = new byte[sha512HashBytes.Length / 2]; + + Buffer.BlockCopy(sha512HashBytes, 0, cryptKey, 0, cryptKey.Length); + Buffer.BlockCopy(sha512HashBytes, cryptKey.Length, authKey, 0, authKey.Length); + + if (!HmacUtils.Verify(authEncryptedBytes, authKey)) + throw new Exception("Verification Failed"); + + var msgBytes = HmacUtils.DecryptAuthenticated(authEncryptedBytes, cryptKey); + + var json = msgBytes.FromUtf8Bytes(); + return json; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/JwtAuthProviderTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/JwtAuthProviderTests.cs new file mode 100644 index 00000000000..963692ad7c9 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/JwtAuthProviderTests.cs @@ -0,0 +1,783 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack; +using ServiceStack.Text; +using ServiceStack.Auth; +using ServiceStack.Caching; +using ServiceStack.Data; +using ServiceStack.Host; +using ServiceStack.OrmLite; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests.UseCases +{ + public class HelloJwt : IReturn<HelloJwtResponse>, IHasBearerToken + { + public string Name { get; set; } + public string BearerToken { get; set; } + } + public class HelloJwtResponse + { + public string Result { get; set; } + } + + [Authenticate] + public class JwtServices : Service + { + public object Any(HelloJwt request) + { + return new HelloJwtResponse { Result = $"Hello, {request.Name}" }; + } + } + + public class JwtAuthProviderRsaEncryptedTests : JwtAuthProviderTests + { + protected override JwtAuthProvider CreateJwtAuthProvider() + { + var privateKey = RsaUtils.CreatePrivateKeyParams(RsaKeyLengths.Bit2048); + var publicKey = privateKey.ToPublicRsaParameters(); + var privateKeyXml = privateKey.ToPrivateKeyXml(); + var publicKeyXml = privateKey.ToPublicKeyXml(); + + return new JwtAuthProvider + { + HashAlgorithm = "RS256", + PrivateKeyXml = privateKeyXml, + EncryptPayload = true, + RequireSecureConnection = false, + }; + } + } + + public class JwtAuthProviderRsaTests : JwtAuthProviderTests + { + protected override JwtAuthProvider CreateJwtAuthProvider() + { + var privateKey = RsaUtils.CreatePrivateKeyParams(RsaKeyLengths.Bit2048); + var publicKey = privateKey.ToPublicRsaParameters(); + var privateKeyXml = privateKey.ToPrivateKeyXml(); + var publicKeyXml = privateKey.ToPublicKeyXml(); + + return new JwtAuthProvider + { + HashAlgorithm = "RS256", + PrivateKeyXml = privateKeyXml, + RequireSecureConnection = false, + }; + } + } + + public class JwtAuthProviderHS256Tests : JwtAuthProviderTests + { + private static readonly byte[] AuthKey = AesUtils.CreateKey(); + + protected override JwtAuthProvider CreateJwtAuthProvider() + { + return new JwtAuthProvider + { + AuthKey = AuthKey, + RequireSecureConnection = false, + AllowInQueryString = true, + AllowInFormData = true, + }; + } + + [Test] + public void Can_manually_create_an_authenticated_UserSession_in_Token() + { + var jwtProvider = CreateJwtAuthProvider(); + + var header = JwtAuthProvider.CreateJwtHeader(jwtProvider.HashAlgorithm); + var body = JwtAuthProvider.CreateJwtPayload(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com", + IsAuthenticated = true, + }, + issuer: jwtProvider.Issuer, + expireIn: jwtProvider.ExpireTokensIn, + audiences: jwtProvider.Audiences, + roles: new[] {"TheRole"}, + permissions: new[] {"ThePermission"}); + + var jwtToken = JwtAuthProvider.CreateJwt(header, body, jwtProvider.GetHashAlgorithm()); + + var client = GetClient(); + + try + { + client.Send(new HelloJwt { Name = "no jwt" }); + Assert.Fail("should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + } + + client.SetTokenCookie(jwtToken); + var response = client.Send(new HelloJwt { Name = "from Custom JWT" }); + Assert.That(response.Result, Is.EqualTo("Hello, from Custom JWT")); + } + + [Test] + public void Can_authenticate_using_JWT_with_QueryString() + { + var client = GetClientWithBasicAuthCredentials(); + + var authResponse = client.Post(new Authenticate()); + Assert.That(authResponse.BearerToken, Is.Not.Null); + + var request = new Secured { Name = "test" }; + var url = Config.ListeningOn.CombineWith(request.ToGetUrl()) + .AddQueryParam(Keywords.TokenCookie, authResponse.BearerToken); + + var response = url.PostJsonToUrl("{}") + .FromJson<SecuredResponse>(); + + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Requires_full_Signature_to_Authenticate() + { + var client = GetClientWithBasicAuthCredentials(); + + var authResponse = client.Post(new Authenticate()); + Assert.That(authResponse.BearerToken, Is.Not.Null); + + var jwtProvider = (JwtAuthProvider) AuthenticateService.GetJwtAuthProvider(); + // Ensure minimum signature example + // jwtProvider.ValidateToken = (jsonObj, request) => + // request.GetJwtToken().LastRightPart('.').FromBase64UrlSafe().Length >= 32; + + var req = new BasicHttpRequest { + Headers = {[HttpHeaders.Authorization] = "Bearer " + authResponse.BearerToken} + }; + + Assert.That(jwtProvider.IsJwtValid(req)); + + var startSigPos = authResponse.BearerToken.LastIndexOf('.') + 1; + for (var i = startSigPos; i < authResponse.BearerToken.Length; i++) + { + req.Headers[HttpHeaders.Authorization] = "Bearer " + authResponse.BearerToken.Substring(0, i); + Assert.That(jwtProvider.IsJwtValid(req), Is.False); + } + } + + [Test] + public void Can_authenticate_using_JWT_with_FormData() + { + var client = GetClientWithBasicAuthCredentials(); + + var authResponse = client.Post(new Authenticate()); + Assert.That(authResponse.BearerToken, Is.Not.Null); + + var request = new Secured { Name = "test" }; + var url = Config.ListeningOn.CombineWith(request.ToGetUrl()); + + var response = url.PostToUrl(new Dictionary<string,string> { + { Keywords.TokenCookie, authResponse.BearerToken } + }, accept: MimeTypes.Json) + .FromJson<SecuredResponse>(); + + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Can_authenticate_using_JWT_with_IHasBearerToken() + { + var authClient = GetClientWithBasicAuthCredentials(); + + var authResponse = authClient.Post(new Authenticate()); + Assert.That(authResponse.BearerToken, Is.Not.Null); + + var client = GetClient(); + var request = new HelloJwt { BearerToken = authResponse.BearerToken, Name = "IHasBearerToken" }; + var response = client.Get(request); + + Assert.That(response.Result, Is.EqualTo("Hello, IHasBearerToken")); + } + } + + public class JwtAuthProviderHS256HttpClientTests : JwtAuthProviderHS256Tests + { + protected override IJsonServiceClient GetClient() + { + return new JsonHttpClient(Config.ListeningOn); + } + + protected override IJsonServiceClient GetClientWithBasicAuthCredentials() + { + return new JsonHttpClient(Config.ListeningOn) + { + UserName = Username, + Password = Password, + }; + } + } + + public abstract class JwtAuthProviderTests + { + public const string Username = "mythz"; + public const string Password = "p@55word"; + + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(JwtAuthProviderTests), typeof(JwtServices).Assembly) { } + + public virtual JwtAuthProvider JwtAuthProvider { get; set; } + + public override void Configure(Container container) + { + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); + + container.Register<IDbConnectionFactory>(dbFactory); + container.Register<IAuthRepository>(c => + new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()) + { + UseDistinctRoleTables = true + }); + + //Create UserAuth RDBMS Tables + container.Resolve<IAuthRepository>().InitSchema(); + + //Also store User Sessions in SQL Server + container.RegisterAs<OrmLiteCacheClient, ICacheClient>(); + container.Resolve<ICacheClient>().InitSchema(); + + // just for testing, create a privateKeyXml on every instance + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] + { + new BasicAuthProvider(), + new CredentialsAuthProvider(), + JwtAuthProvider, + })); + + Plugins.Add(new RegistrationFeature()); + + var authRepo = GetAuthRepository(); + authRepo.CreateUserAuth(new UserAuth + { + Id = 1, + UserName = Username, + FirstName = "First", + LastName = "Last", + DisplayName = "Display", + }, Password); + } + } + + protected abstract JwtAuthProvider CreateJwtAuthProvider(); + + protected virtual IJsonServiceClient GetClient() => new JsonServiceClient(Config.ListeningOn); + + protected virtual IJsonServiceClient GetClientWithBasicAuthCredentials() => new JsonServiceClient(Config.ListeningOn) + { + UserName = Username, + Password = Password, + }; + + protected virtual IJsonServiceClient GetClientWithRefreshToken(string refreshToken = null, string accessToken = null, bool useTokenCookie = false) + { + if (refreshToken == null) + { + refreshToken = GetRefreshToken(); + } + + var client = GetClient(); + if (client is JsonServiceClient serviceClient) + { + serviceClient.RefreshToken = refreshToken; + if (useTokenCookie) + serviceClient.UseTokenCookie = true; + else + serviceClient.BearerToken = accessToken; + return serviceClient; + } + + if (client is JsonHttpClient httpClient) + { + httpClient.RefreshToken = refreshToken; + if (useTokenCookie) + httpClient.UseTokenCookie = true; + else + httpClient.BearerToken = accessToken; + return httpClient; + } + + throw new NotSupportedException(client.GetType().Name); + } + + private static string CreateExpiredToken() + { + var jwtProvider = (JwtAuthProvider)AuthenticateService.GetAuthProvider(JwtAuthProviderReader.Name); + jwtProvider.CreatePayloadFilter = (jwtPayload, session) => + jwtPayload["exp"] = DateTime.UtcNow.AddSeconds(-1).ToUnixTime().ToString(); + + var token = jwtProvider.CreateJwtBearerToken(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com" + }); + + jwtProvider.CreatePayloadFilter = null; + return token; + } + + private readonly ServiceStackHost appHost; + + public JwtAuthProviderTests() + { + appHost = new AppHost + { + JwtAuthProvider = CreateJwtAuthProvider() + } + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + private string GetRefreshToken() + { + var authClient = GetClient(); + var refreshToken = authClient.Send(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + }) + .RefreshToken; + return refreshToken; + } + + [Test] + public void Can_get_TokenCookie() + { + var authClient = GetClient(); + var authResponse = authClient.Send(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + UseTokenCookie = true + }); + Assert.That(authResponse.SessionId, Is.Not.Null); + Assert.That(authResponse.UserName, Is.EqualTo(Username)); + + var response = authClient.Send(new HelloJwt { Name = "from auth service" }); + Assert.That(response.Result, Is.EqualTo("Hello, from auth service")); + + var jwtToken = authClient.GetTokenCookie(); //From ss-tok Cookie + Assert.That(jwtToken, Is.Not.Null); + } + + [Test] + public void Can_ConvertSessionToToken() + { + var authClient = GetClient(); + var authResponse = authClient.Send(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + RememberMe = true, + }); + Assert.That(authResponse.SessionId, Is.Not.Null); + Assert.That(authResponse.UserName, Is.EqualTo(Username)); + Assert.That(authResponse.BearerToken, Is.Not.Null); + + var jwtToken = authClient.GetTokenCookie(); //From ss-tok Cookie + Assert.That(jwtToken, Is.Null); + + var response = authClient.Send(new HelloJwt { Name = "from auth service" }); + Assert.That(response.Result, Is.EqualTo("Hello, from auth service")); + + authClient.Send(new ConvertSessionToToken()); + jwtToken = authClient.GetTokenCookie(); //From ss-tok Cookie + Assert.That(jwtToken, Is.Not.Null); + + response = authClient.Send(new HelloJwt { Name = "from auth service" }); + Assert.That(response.Result, Is.EqualTo("Hello, from auth service")); + } + + [Test] + public void Invalid_RefreshToken_throws_RefreshTokenException() + { + var client = GetClientWithRefreshToken("Invalid.Refresh.Token"); + try + { + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.Fail("Should throw"); + } + catch (RefreshTokenException ex) + { + ex.Message.Print(); + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + } + } + + [Test] + public async Task Invalid_RefreshToken_throws_RefreshTokenException_Async() + { + var client = GetClientWithRefreshToken("Invalid.Refresh.Token"); + try + { + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.Fail("Should throw"); + } + catch (RefreshTokenException ex) + { + ex.Message.Print(); + Assert.That(ex.StatusCode, Is.EqualTo(400)); + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(ArgumentException))); + } + } + + [Test] + public void Only_returns_Tokens_on_Requests_that_Authenticate_the_user() + { + var authClient = GetClient(); + var refreshToken = authClient.Send(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + }).RefreshToken; + + Assert.That(refreshToken, Is.Not.Null); //On Auth using non IAuthWithRequest + + var postAuthRefreshToken = authClient.Send(new Authenticate()).RefreshToken; + Assert.That(postAuthRefreshToken, Is.Null); //After Auth + } + + [Test] + public void Can_Auto_reconnect_with_just_RefreshToken() + { + var client = GetClientWithRefreshToken(); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Can_Auto_reconnect_with_just_RefreshToken_with_UseTokenCookie() + { + var client = GetClientWithRefreshToken(useTokenCookie:true); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Can_Auto_reconnect_with_RefreshToken_after_expired_token() + { + var client = GetClientWithRefreshToken(GetRefreshToken(), CreateExpiredToken()); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public async Task Can_Auto_reconnect_with_RefreshToken_after_expired_token_Async() + { + var client = GetClientWithRefreshToken(GetRefreshToken(), CreateExpiredToken()); + + var request = new Secured { Name = "test" }; + var response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = await client.SendAsync(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + } + + [Test] + public void Can_Auto_reconnect_with_RefreshToken_in_OnAuthenticationRequired_after_expired_token() + { + var client = GetClient(); + if (!(client is JsonServiceClient serviceClient)) //OnAuthenticationRequired not implemented in JsonHttpClient + return; + + var called = 0; + serviceClient.BearerToken = CreateExpiredToken(); + + serviceClient.OnAuthenticationRequired = () => + { + called++; + var authClient = GetClient(); + serviceClient.BearerToken = authClient.Send(new GetAccessToken + { + RefreshToken = GetRefreshToken(), + }).AccessToken; + }; + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + Assert.That(called, Is.EqualTo(1)); + } + + [Test] + public void Does_return_token_on_subsequent_BasicAuth_Authentication_requests() + { + var client = GetClientWithBasicAuthCredentials(); + + var response = client.Post(new Authenticate()); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + + response = client.Post(new Authenticate()); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + } + + [Test] + public async Task Does_return_token_on_subsequent_BasicAuth_Authentication_requests_Async() + { + var client = GetClientWithBasicAuthCredentials(); + + var response = await client.PostAsync(new Authenticate()); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + + response = await client.PostAsync(new Authenticate()); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + } + + [Test] + public void Does_return_token_on_subsequent_Credentials_Authentication_requests() + { + var client = GetClient(); + + var response = client.Post(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + RememberMe = true, + }); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + + response = client.Post(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + RememberMe = true, + }); + Assert.That(response.BearerToken, Is.Not.Null); + Assert.That(response.RefreshToken, Is.Not.Null); + + response = client.Post(new Authenticate()); + Assert.That(response.BearerToken, Is.Null); + Assert.That(response.RefreshToken, Is.Null); + } + + [Test] + public void Can_validate_valid_token() + { + var authClient = GetClient(); + var jwt = authClient.Send(new Authenticate + { + provider = "credentials", + UserName = Username, + Password = Password, + }).BearerToken; + + var jwtProvider = AuthenticateService.GetJwtAuthProvider(); + Assert.That(jwtProvider.IsJwtValid(jwt)); + + var jwtPayload = jwtProvider.GetValidJwtPayload(jwt); + Assert.That(jwtPayload, Is.Not.Null); + Assert.That(jwtPayload["preferred_username"], Is.EqualTo(Username)); + } + + [Test] + public void Does_not_validate_invalid_token() + { + var expiredJwt = CreateExpiredToken(); + + var jwtProvider = AuthenticateService.GetJwtAuthProvider(); + Assert.That(jwtProvider.IsJwtValid(expiredJwt), Is.False); + + Assert.That(jwtProvider.GetValidJwtPayload(expiredJwt), Is.Null); + } + + [Test] + public void Does_validate_multiple_audiences() + { + var jwtProvider = (JwtAuthProvider)AuthenticateService.GetAuthProvider(JwtAuthProviderReader.Name); + + string CreateJwtWithAudiences(params string[] audiences) + { + var header = JwtAuthProvider.CreateJwtHeader(jwtProvider.HashAlgorithm); + var body = JwtAuthProvider.CreateJwtPayload(new AuthUserSession + { + UserAuthId = "1", + DisplayName = "Test", + Email = "as@if.com", + IsAuthenticated = true, + }, + issuer: jwtProvider.Issuer, + expireIn: jwtProvider.ExpireTokensIn, + audiences: audiences); + + var jwtToken = JwtAuthProvider.CreateJwt(header, body, jwtProvider.GetHashAlgorithm()); + return jwtToken; + } + + jwtProvider.Audiences = new List<string> { "foo", "bar" }; + var jwtNoAudience = CreateJwtWithAudiences(); + Assert.That(jwtProvider.IsJwtValid(jwtNoAudience)); + + var jwtWrongAudience = CreateJwtWithAudiences("qux"); + Assert.That(!jwtProvider.IsJwtValid(jwtWrongAudience)); + + var jwtPartialAudienceMatch = CreateJwtWithAudiences("bar","qux"); + Assert.That(jwtProvider.IsJwtValid(jwtPartialAudienceMatch)); + + jwtProvider.Audience = "foo"; + Assert.That(!jwtProvider.IsJwtValid(jwtPartialAudienceMatch)); + + jwtProvider.Audience = null; + Assert.That(jwtProvider.IsJwtValid(jwtPartialAudienceMatch)); + } + } + + public class JwtAuthProviderIntegrationTests + { + public const string Username = "mythz"; + public const string Password = "p@55word"; + private static readonly byte[] AuthKey = AesUtils.CreateKey(); + + private readonly ServiceStackHost appHost; + + public JwtAuthProviderIntegrationTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(JwtAuthProviderIntegrationTests), typeof(JwtServices).Assembly) { } + + public override void Configure(Container container) + { + // just for testing, create a privateKeyXml on every instance + Plugins.Add(new AuthFeature(() => new AuthUserSession(), + new IAuthProvider[] + { + new BasicAuthProvider(), + new CredentialsAuthProvider(), + new JwtAuthProvider + { + AuthKey = AuthKey, + RequireSecureConnection = false, + AllowInQueryString = true, + AllowInFormData = true, + }, + })); + + Plugins.Add(new RegistrationFeature()); + + container.Register<IAuthRepository>(c => new InMemoryAuthRepository()); + + var authRepo = GetAuthRepository(); + authRepo.CreateUserAuth(new UserAuth + { + Id = 1, + UserName = Username, + FirstName = "First", + LastName = "Last", + DisplayName = "Display", + }, Password); + + Plugins.Add(new RequestLogsFeature { + EnableSessionTracking = true, + ExcludeRequestDtoTypes = new[] { typeof(Authenticate) }, + }); + } + } + + protected virtual IJsonServiceClient GetClient() => new JsonServiceClient(Config.ListeningOn) { + UserName = Username, + Password = Password, + }; + + protected virtual IJsonServiceClient GetJwtClient() => new JsonServiceClient(Config.ListeningOn) { + BearerToken = GetClient().Post(new Authenticate()).BearerToken + }; + + [Test] + public void Does_track_JWT_Sessions_calling_Authenticate_Services() + { + var client = GetJwtClient(); + + var request = new Secured { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Result, Is.EqualTo(request.Name)); + + var reqLogger = HostContext.TryResolve<IRequestLogger>(); + var lastEntrySession = reqLogger.GetLatestLogs(1)[0]?.Session as AuthUserSession; + Assert.That(lastEntrySession, Is.Not.Null); + Assert.That(lastEntrySession.AuthProvider, Is.EqualTo("jwt")); + Assert.That(lastEntrySession.UserName, Is.EqualTo(Username)); + } + + [Test] + public void Does_track_JWT_Sessions_calling_non_Authenticate_Services() + { + var client = GetJwtClient(); + + var request = new Unsecure { Name = "test" }; + var response = client.Send(request); + Assert.That(response.Name, Is.EqualTo(request.Name)); + + var reqLogger = HostContext.TryResolve<IRequestLogger>(); + var lastEntrySession = reqLogger.GetLatestLogs(1)[0]?.Session as AuthUserSession; + Assert.That(lastEntrySession, Is.Not.Null); + Assert.That(lastEntrySession.AuthProvider, Is.EqualTo("jwt")); + Assert.That(lastEntrySession.UserName, Is.EqualTo(Username)); + } + } + +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/SecureConfig.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/SecureConfig.cs new file mode 100644 index 00000000000..f4787edc3db --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/UseCases/SecureConfig.cs @@ -0,0 +1,164 @@ +// Copyright (c) ServiceStack, Inc. All Rights Reserved. +// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Threading.Tasks; +using ServiceStack.Auth; + +namespace ServiceStack.WebHost.Endpoints.Tests.UseCases +{ + public class SecureConfig + { + public static string PublicKeyXml = "<RSAKeyValue><Modulus>s1/rrg2UxchL5O4yFKCHTaDQgr8Bfkr1kmPf8TCXUFt4WNgAxRFGJ4ap1Kc22rt/k0BRJmgC3xPIh7Z6HpYVzQroXuYI6+q66zyk0DRHG7ytsoMiGWoj46raPBXRH9Gj5hgv+E3W/NRKtMYXqq60hl1DvtGLUs2wLGv15K9NABc=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; + public static string PrivateKeyXml = "<RSAKeyValue><Modulus>s1/rrg2UxchL5O4yFKCHTaDQgr8Bfkr1kmPf8TCXUFt4WNgAxRFGJ4ap1Kc22rt/k0BRJmgC3xPIh7Z6HpYVzQroXuYI6+q66zyk0DRHG7ytsoMiGWoj46raPBXRH9Gj5hgv+E3W/NRKtMYXqq60hl1DvtGLUs2wLGv15K9NABc=</Modulus><Exponent>AQAB</Exponent><P>6CiNjgn8Ov6nodG56rCOXBoSGksYUf/2C8W23sEBfwfLtKyqTbTk3WolBj8sY8QptjwFBF4eaQiFdVLt3jg08w==</P><Q>xcuu4OGTcSOs5oYqyzsQrOAys3stMauM2RYLIWqw7JGEF1IV9LBwbaW/7foq2dG8saEI48jxcskySlDgq5dhTQ==</Q><DP>KqzhsH13ZyTOjblusox37shAEaNCOjiR8wIKJpJWAxLcyD6BI72f4G+VlLtiHoi9nikURwRCFM6jMbjnztSILw==</DP><DQ>H4CvW7XRy+VItnaL/k5r+3zB1oA51H1kM3clUq8xepw6k5RJVu17GpuZlAeSJ5sWGJxzVAQ/IG8XCWsUPYAgyQ==</DQ><InverseQ>vTLuAT3rSsoEdNwZeH2/JDEWmQ1NGa5PUq1ak1UbDD0snhsfJdLo6at3isRqEtPVsSUK6I07Nrfkd6okGhzGDg==</InverseQ><D>M8abO9lVuSVQqtsKf6O6inDB3wuNPcwbSE8l4/O3qY1Nlq96wWd0DZK0UNqXXdnDQFjPU7uwIH4QYwQMCeoejl3dZlllkyvKVa3jihImDD++qgswX2DmHGDqTIkVABf1NF730gqTmt1kqXoVp5Y+VcO7CZPEygIQyTK4WwYlRjk=</D></RSAKeyValue>"; + + public static string FallbackPublicKeyXml = "<RSAKeyValue><Modulus>pj18q4mUIQbF2AT3oQc+ba+vynhg91M+qdpqF2PQ/ud0kdsEbWu5FtP2RvRsuj7blTnBTnZ1yeXUMZKSCLhuKrkqfA1pomGoigiM6stExi/OqZhoKBDJqNt4QZXzNVKrRBPS7GvCYUcm78AmwivSfJN9nF58QunZxHjvmTsnmNcPOOC5+YJDUI0S68v5sYvVhZquvrgmfyhZW1Is8T+AmL32UfOlzktQCFyASfOhYN1gb3/DwGoli41vN5lWoWNbtf/aJFUOwBoTFignE0tey6X5TXcgIZp5HtloIDqgOQBD0xClOpRwYuMwefw6DYP0/fImodq3H/RSTOhtoXspsQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; + public static string FallbackPrivateKeyXml = "<RSAKeyValue><Modulus>pj18q4mUIQbF2AT3oQc+ba+vynhg91M+qdpqF2PQ/ud0kdsEbWu5FtP2RvRsuj7blTnBTnZ1yeXUMZKSCLhuKrkqfA1pomGoigiM6stExi/OqZhoKBDJqNt4QZXzNVKrRBPS7GvCYUcm78AmwivSfJN9nF58QunZxHjvmTsnmNcPOOC5+YJDUI0S68v5sYvVhZquvrgmfyhZW1Is8T+AmL32UfOlzktQCFyASfOhYN1gb3/DwGoli41vN5lWoWNbtf/aJFUOwBoTFignE0tey6X5TXcgIZp5HtloIDqgOQBD0xClOpRwYuMwefw6DYP0/fImodq3H/RSTOhtoXspsQ==</Modulus><Exponent>AQAB</Exponent><P>5zZpGMnXoOeGrG2Z5auY3dcUgly5735TBn+1ot5um1x9umHSPAIrazNuteZQyD4bNs7z+0WPkCcUiuvVGbuTgepw644WPO36SMQ5gSsgjttNedGWnD8esHl/Pm1/F+IzHjuU2MZ/rZlyFsRu3C+tXgA1uQjtFnLHF+n5qmBa8Uk=</P><Q>uA/rxcOmWbvri+yDT7f/6iHB+JQDiHQM8OAcjHl5FsEb+OM/2WgOvwtr7BdTsPaaFa6VyXyEnWIdZ1F43V5tj+vwYGO26e+AwDIQAb7ma/1rb7J9LXJ4SH1kta/AL4mr4QjS39+M/0ae2IaBiG6gpufl9d86nMY5qOY5OZIrXSk=</Q><DP>PBaf6ZlLOL3y+gzh2hZmfADRi6+dguhJm37FLbaw+B9pbW7OvFmz/wA23X8lr2S0neHa9op1bPk7FX+EulNNWo4bGpyqmtseGJsmdrNGmtnToL0fbyvYRfTNZOQAC6z1q/3ACTZNKEigpdoXFZIudCeJzrTLKPJbW5OrFuRDvkE=</DP><DQ>iG38o8Tmi8LX0ApKNo+7GA9XmGoVyFHEudJUNudfEremhS/kRsBzlbXgk8milhvjkEis7ADox0NPaiKghO0WJsSKkte2X+XPuCYjaTfX0ZmwxcU2NbaQY6LWQDl6KYJRLWb970TjXOA6o2Hnp3ngiHaBJGMHLedcG84yAnNOwyk=</DQ><InverseQ>WkDNqDhQH8UhxWFq4HCgag0aHNKg7FJfjSk/+u0HsJvH8Q1uibXWYfqoPonebPlG+7u7+i//RdrwYA9vWMC2Tud9j3hguZoP6si6hoA2NyFNGxvNjv8zKIX/b2wwjxB4fDVmEHwz+JTuKjbWf3PtbtmcUUus7HTg7nhgDE96+Ek=</InverseQ><D>AIId3lbleGvhQTmzqZ8AbHyt5oozbrInFgUcT62/EvZxc2w2YWDD0Dtt7HXdGr0sNfK3IfaoAcnlehDTCDqLIK+P/xDZ7rSKe8COsL2WHF6DTN6xy9SQT0c7gQTUuWgjLKo8Wfty3NIHPxKo861HX5jiWI7r5Zb6Mtj1T5RAGN4nMVhG35fMQpY7Tph4km3wr8peR64RaE4JCagwpe5AK/12hISwiLPKOClg3P4ddvQY6oOYZ93qrBQsR8Yg+MSeyfOdxu8GMRnQIbyQJy2luhWKN7EJb758/vJHzGYJFZh5UY/X6FTZbs4Wg66vNH+3WBO/qjZPR96dBmL2NK4cOQ==</D></RSAKeyValue>"; + } + + public class HelloSecure : IReturn<HelloSecureResponse> + { + public string Name { get; set; } + } + + public class HelloSecureResponse + { + public string Result { get; set; } + } + + public class GetSecure : IReturn<GetSecureResponse> + { + public string Name { get; set; } + } + + public class GetSecureResponse + { + public string Result { get; set; } + } + + public class HelloAuthenticated : IReturn<HelloAuthenticatedResponse>, IHasSessionId, IHasBearerToken, IHasVersion + { + public string SessionId { get; set; } + public string BearerToken { get; set; } + public int Version { get; set; } + } + + public class LargeMessage : IReturn<LargeMessage> + { + public List<HelloSecure> Messages { get; set; } + } + + [Authenticate] + public class HelloAuthSecure : IReturn<HelloAuthSecureResponse> + { + public string Name { get; set; } + } + + public class HelloAuthSecureResponse + { + public string Result { get; set; } + } + + public class HelloAuthenticatedResponse + { + public int Version { get; set; } + public string SessionId { get; set; } + public string UserName { get; set; } + public string Email { get; set; } + public bool IsAuthenticated { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + + public class HelloOneWay : IReturnVoid + { + internal static string LastName; + + public string Name { get; set; } + } + + [Restrict(RequestAttributes.Secure)] + public class HelloSecureRestricted : IReturn<HelloSecureRestrictedResponse> + { + public string Name { get; set; } + } + + public class HelloSecureRestrictedResponse + { + public string Result { get; set; } + } + + [DataContract] + [Route("/encrypted/delete/{Id}", "DELETE")] + public class EncryptedDelete : IReturn<EmptyResponse> + { + [DataMember(Order = 1)] public string Id { get; set; } + } + + public class SecureServices : Service + { + public async Task<object> Delete(EncryptedDelete request) + { + await Task.Yield(); + return new EmptyResponse(); + } + + public object Get(GetSecure request) + { + if (request.Name == null) + throw new ArgumentNullException("Name"); + + return new GetSecureResponse { Result = $"Hello, {request.Name}!" }; + } + + public object Any(HelloSecure request) + { + if (request.Name == null) + throw new ArgumentNullException("Name"); + + return new HelloSecureResponse { Result = $"Hello, {request.Name}!" }; + } + + public object Any(HelloAuthSecure request) + { + if (request.Name == null) + throw new ArgumentNullException("Name"); + + return new HelloAuthSecureResponse { Result = $"Hello, {request.Name}!" }; + } + + public object Any(HelloSecureRestricted request) + { + if (request.Name == null) + throw new ArgumentNullException("Name"); + + return new HelloSecureRestrictedResponse { Result = $"Hello, {request.Name}!" }; + } + + [Authenticate] + public object Any(HelloAuthenticated request) + { + var session = GetSession(); + + return new HelloAuthenticatedResponse + { + Version = request.Version, + SessionId = session.Id, + UserName = session.UserName, + Email = session.Email, + IsAuthenticated = session.IsAuthenticated, + }; + } + + public object Any(LargeMessage request) + { + return request; + } + + public void Any(HelloOneWay request) + { + HelloOneWay.LastName = request.Name; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/UserServiceValidationTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/UserServiceValidationTests.cs index 36c020e1ff5..7f66f6a6df5 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/UserServiceValidationTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/UserServiceValidationTests.cs @@ -11,7 +11,7 @@ namespace ServiceStack.WebHost.Endpoints.Tests { [Route("/uservalidation")] - [Route("/uservalidation/{Id}")] + [Route("/uservalidation/{Id}")] public class UserValidation { public string FirstName { get; set; } @@ -26,24 +26,23 @@ public interface IAddressValidator public class UserValidator : AbstractValidator<UserValidation>, IRequiresRequest { public IAddressValidator AddressValidator { get; set; } - public IRequest Request { get; set; } public UserValidator() { - RuleFor(x => x.FirstName).Must(f => - { - if (Request == null) - Assert.Fail(); - - return true; - }); - RuleFor(x => x.LastName).NotEmpty().WithErrorCode("ShouldNotBeEmpty"); - RuleSet(ApplyTo.Post | ApplyTo.Put, () => + RuleFor(x => x.FirstName).Must(f => + { + if (Request == null) + Assert.Fail(); + + return true; + }); + RuleFor(x => x.LastName).NotEmpty().WithErrorCode("ShouldNotBeEmpty"); + RuleSet(ApplyTo.Post | ApplyTo.Put, () => { RuleFor(x => x.FirstName).NotEmpty().WithMessage("Please specify a first name"); }); } - } + } //Not matching the naming convention ([Request DTO Name] + "Response") public class OperationResponse @@ -73,14 +72,14 @@ public UserAppHostHttpListener() public override void Configure(Container container) { - Plugins.Add(new ValidationFeature()); - container.RegisterValidators(typeof(UserValidator).Assembly); + Plugins.Add(new ValidationFeature()); + container.RegisterValidators(typeof(UserValidator).Assembly); } } static UserAppHostHttpListener appHost; - [TestFixtureSetUp] + [OneTimeSetUp] public void TestFixtureSetUp() { appHost = new UserAppHostHttpListener(); @@ -88,7 +87,7 @@ public void TestFixtureSetUp() appHost.Start(ListeningOn); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { appHost.Dispose(); @@ -109,11 +108,12 @@ public static IEnumerable ServiceClients //be run for all test fixtures, not just this one. return new Func<IServiceClient>[] { - () => UnitTestServiceClient(), - () => new JsonServiceClient(ListeningOn), - () => new JsvServiceClient(ListeningOn), - () => new XmlServiceClient(ListeningOn), - }; + () => UnitTestServiceClient(), + () => new JsonServiceClient(ListeningOn), + () => new JsonHttpClient(ListeningOn), + () => new JsvServiceClient(ListeningOn), + () => new XmlServiceClient(ListeningOn), + }; } } @@ -123,13 +123,13 @@ public void Get_empty_request_throws_validation_exception(Func<IServiceClient> f try { var client = (IRestClient)factory(); - var response = client.Get<OperationResponse>("UserValidation"); + var response = client.Get<OperationResponse>("UserValidation"); Assert.Fail("Should throw Validation Exception"); } catch (WebServiceException ex) { Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.BadRequest)); - Assert.That(ex.StatusDescription, Is.EqualTo(ExpectedErrorCode)); + Assert.That(ex.StatusDescription, Is.EqualTo(ExpectedErrorCode)); } } @@ -141,10 +141,11 @@ public static IEnumerable RestClients //be run for all test fixtures, not just this one. return new Func<IServiceClient>[] { - () => new JsonServiceClient(ListeningOn), - () => new JsvServiceClient(ListeningOn), - () => new XmlServiceClient(ListeningOn), - }; + () => new JsonServiceClient(ListeningOn), + () => new JsonHttpClient(ListeningOn), + () => new JsvServiceClient(ListeningOn), + () => new XmlServiceClient(ListeningOn), + }; } } @@ -153,8 +154,14 @@ public void Throws_validation_exception_even_if_AlwaysSendBasicAuthHeader_is_fal { try { - var client = (ServiceClientBase)factory(); - client.AlwaysSendBasicAuthHeader = false; + var client = factory(); + var serviceClient = client as ServiceClientBase; + if (serviceClient != null) + serviceClient.AlwaysSendBasicAuthHeader = false; + var httpClient = client as JsonHttpClient; + if (httpClient != null) + httpClient.AlwaysSendBasicAuthHeader = false; + var response = client.Get<OperationResponse>("UserValidation"); Assert.Fail("Should throw Validation Exception"); } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ValidationCustomTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ValidationCustomTests.cs new file mode 100644 index 00000000000..de486e1dd67 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ValidationCustomTests.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using NUnit.Framework; +using ServiceStack.FluentValidation; +using ServiceStack.FluentValidation.Results; +using ServiceStack.Text; +using ServiceStack.Validation; +using ServiceStack.WebHost.Endpoints.Tests.Support.Services; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [Route("/validation/custom")] + public class CustomValidation + { + public string Name { get; set; } + } + + public class CustomValidationResponse + { + public string Result { get; set; } + + public ResponseStatus ResponseStatus { get; set; } + } + + public class CustomValidationValidator : AbstractValidator<CustomValidation> + { + public CustomValidationValidator() + { + RuleFor(request => request.Name).NotEmpty(); + RuleFor(request => request) + .Custom((request, context) => { + if (request.Name?.StartsWith("A") != true) + { + var propertyName = context.ParentContext.PropertyChain.BuildPropertyName("Name:0"); + var errorMessage = "Incorrect prefix."; + var failure = new ValidationFailure(propertyName, errorMessage) + { + ErrorCode = "NotFound" + }; + context.AddFailure(failure); + } + var nameLength = request.Name?.Length ?? 0; + var firstLetter = request.Name?.Substring(0, 1) ?? ""; + var lastLetter = request.Name?.Substring(nameLength - 1, 1) ?? ""; + if (firstLetter != lastLetter) + { + var propertyName = context.ParentContext.PropertyChain.BuildPropertyName($"Name:0:1 <> Name:{nameLength - 1}:{nameLength}"); + var errorMessage = $"Name inconsistency: {firstLetter} <> {lastLetter}"; + var failure = new ValidationFailure(propertyName, errorMessage) + { + ErrorCode = "Inconsistency" + }; + context.AddFailure(failure); + } + }); + } + } + + public class CustomValidationService : Service + { + public object Any(CustomValidation request) + { + return new CustomValidationResponse { Result = "Hello, " + request.Name }; + } + } + + public class ValidationCustomTests + { + private readonly ServiceStackHost appHost; + public class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ValidationCustomTests), typeof(HelloService).Assembly) { } + + public override void Configure(Funq.Container container) + { + Plugins.Add(new ValidationFeature()); + } + } + + public ValidationCustomTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + [Test] + public void Does_execute_custom_validators() + { + var client = new JsonServiceClient(Config.ListeningOn); + + try + { + using(var response = client.Get<HttpWebResponse>(new CustomValidation { Name = "Joan" })){} + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + var status = ex.GetResponseStatus(); + + Assert.That(status.ErrorCode, Is.EqualTo("NotFound")); + Assert.That(status.Message, Is.EqualTo("Incorrect prefix.")); + Assert.That(status.Errors.Count, Is.EqualTo(2)); + + Assert.That(status.Errors[0].ErrorCode, Is.EqualTo("NotFound")); + Assert.That(status.Errors[0].FieldName, Is.EqualTo("Name:0")); + Assert.That(status.Errors[0].Message, Is.EqualTo("Incorrect prefix.")); + + Assert.That(status.Errors[1].ErrorCode, Is.EqualTo("Inconsistency")); + Assert.That(status.Errors[1].FieldName, Is.EqualTo("Name:0:1 <> Name:3:4")); + Assert.That(status.Errors[1].Message, Is.EqualTo("Name inconsistency: J <> n")); + } + } + + [Test] + public void Does_execute_custom_validators_combined() + { + var client = new JsonServiceClient(Config.ListeningOn); + + try + { + using (var response = client.Get<HttpWebResponse>(new CustomValidation())) {} + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + var status = ex.GetResponseStatus(); + + Assert.That(status.ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Message, Is.EqualTo("'Name' must not be empty.")); + Assert.That(status.Errors.Count, Is.EqualTo(2)); + + Assert.That(status.Errors[0].ErrorCode, Is.EqualTo("NotEmpty")); + Assert.That(status.Errors[0].FieldName, Is.EqualTo("Name")); + Assert.That(status.Errors[0].Message, Is.EqualTo("'Name' must not be empty.")); + + Assert.That(status.Errors[1].ErrorCode, Is.EqualTo("NotFound")); + Assert.That(status.Errors[1].FieldName, Is.EqualTo("Name:0")); + Assert.That(status.Errors[1].Message, Is.EqualTo("Incorrect prefix.")); + } + } + + } +} diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ValidationExceptionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ValidationExceptionTests.cs new file mode 100644 index 00000000000..1092b3273a3 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ValidationExceptionTests.cs @@ -0,0 +1,174 @@ +using System; +using System.Linq; +using System.Net; +using Funq; +using NUnit.Framework; +using ServiceStack.FluentValidation; +using ServiceStack.FluentValidation.Validators; +using ServiceStack.Text; +using ServiceStack.Validation; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class TriggerValidators : IReturn<TriggerValidators> + { + public string CreditCard { get; set; } + public string Email { get; set; } + public string Empty { get; set; } + public string Equal { get; set; } + public int ExclusiveBetween { get; set; } + public int GreaterThanOrEqual { get; set; } + public int GreaterThan { get; set; } + public int InclusiveBetween { get; set; } + public string Length { get; set; } + public int LessThanOrEqual { get; set; } + public int LessThan { get; set; } + public string NotEmpty { get; set; } + public string NotEqual { get; set; } + public string Null { get; set; } + public string RegularExpression { get; set; } + public decimal ScalePrecision { get; set; } + } + + public class TriggerValidatorsValidator : AbstractValidator<TriggerValidators> + { + public TriggerValidatorsValidator() + { + RuleFor(x => x.CreditCard).CreditCard(); + RuleFor(x => x.Email).EmailAddress(); + RuleFor(x => x.Empty).Empty(); + RuleFor(x => x.Equal).Equal("Equal"); + RuleFor(x => x.ExclusiveBetween).ExclusiveBetween(10, 20); + RuleFor(x => x.GreaterThanOrEqual).GreaterThanOrEqualTo(10); + RuleFor(x => x.GreaterThan).GreaterThan(10); + RuleFor(x => x.InclusiveBetween).InclusiveBetween(10, 20); + RuleFor(x => x.Length).Length(10); + RuleFor(x => x.LessThanOrEqual).LessThanOrEqualTo(10); + RuleFor(x => x.LessThan).LessThan(10); + RuleFor(x => x.NotEmpty).NotEmpty(); + RuleFor(x => x.NotEqual).NotEqual("NotEqual"); + RuleFor(x => x.Null).Null(); + RuleFor(x => x.RegularExpression).Matches(@"^[a-z]*$"); + RuleFor(x => x.ScalePrecision).SetValidator(new ScalePrecisionValidator(1, 1)); + } + } + + public class ValidatorIssues : IReturn<ValidatorIssues> + { + public DateTime ValidTo { get; set; } + } + + public class ValidatorIssuesValidator : AbstractValidator<ValidatorIssues> + { + public ValidatorIssuesValidator() + { + RuleFor(x => x.ValidTo).GreaterThanOrEqualTo(x => DateTime.UtcNow); + } + } + + public class ValidationRulesTest : IReturn<ValidationRulesTest> + { + public string Id { get; set; } + public string AuthSecret { get; set; } + } + + public class ValidationService : Service + { + public object Any(TriggerValidators request) => request; + public object Any(ValidatorIssues request) => request; + + public object Any(ValidationRulesTest request) => request; + } + + public class ValidationExceptionTests + { + class AppHost : AppSelfHostBase + { + public AppHost() : base(nameof(ValidationExceptionTests), typeof(ValidationExceptionTests).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new ValidationFeature()); + + container.RegisterValidator(typeof(TriggerValidatorsValidator)); + container.RegisterValidator(typeof(ValidatorIssuesValidator)); + } + } + + private readonly ServiceStackHost appHost; + public ValidationExceptionTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] public void OneTimeTearDown() => appHost.Dispose(); + + protected virtual JsonServiceClient GetClient() => new JsonServiceClient(Config.ListeningOn); + + [Test] + public void Triggering_all_validators_returns_right_ErrorCode() + { + var client = GetClient(); + var request = CreateTriggerValidators(); + + try + { + var response = client.Post(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + //ex.ResponseStatus.PrintDump(); + ex.AssertTriggerValidators(); + } + } + + public static TriggerValidators CreateTriggerValidators() + { + var request = new TriggerValidators { + CreditCard = "NotCreditCard", + Email = "NotEmail", + Empty = "NotEmpty", + Equal = "NotEqual", + ExclusiveBetween = 1, + GreaterThan = 1, + GreaterThanOrEqual = 1, + InclusiveBetween = 1, + Length = "Length", + LessThan = 20, + LessThanOrEqual = 20, + NotEmpty = "", + NotEqual = "NotEqual", + Null = "NotNull", + RegularExpression = "FOO", + ScalePrecision = 123.456m + }; + return request; + } + + [Test] + public void Does_handle_reported_issues_correctly() + { + var client = GetClient(); + var request = new ValidatorIssues + { + ValidTo = DateTime.UtcNow.AddDays(-1), + }; + + try + { + var response = client.Post(request); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + ex.ResponseStatus.PrintDump(); + var errors = ex.ResponseStatus.Errors; + Assert.That(errors.First(x => x.FieldName == "ValidTo").ErrorCode, Is.EqualTo("GreaterThanOrEqual")); + } + } + } + +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ValidationRulesTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ValidationRulesTests.cs new file mode 100644 index 00000000000..5b9ca7b8d80 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ValidationRulesTests.cs @@ -0,0 +1,316 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using Funq; +using NUnit.Framework; +using ServiceStack.Auth; +using ServiceStack.Caching; +using ServiceStack.Data; +using ServiceStack.OrmLite; +using ServiceStack.Text; +using ServiceStack.Validation; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class OrmLiteValidationRulesTests : ValidationRulesTests + { + protected override ValidationFeature GetValidationFeature(Container container) => + new ValidationFeature { + ValidationSource = new OrmLiteValidationSource(container.Resolve<IDbConnectionFactory>()), + }; + } + + public class OrmLiteWithCacheValidationRulesTests : ValidationRulesTests + { + protected override ValidationFeature GetValidationFeature(Container container) => + new ValidationFeature { + ValidationSource = new OrmLiteValidationSource( + container.Resolve<IDbConnectionFactory>(), + container.Resolve<MemoryCacheClient>()), + }; + } + + public class MemoryValidationRulesTests : ValidationRulesTests + { + protected override ValidationFeature GetValidationFeature(Container container) => + new ValidationFeature { + ValidationSource = new MemoryValidationSource(), + }; + } + + public abstract class ValidationRulesTests + { + private const string AuthSecret = "secretz"; + + protected abstract ValidationFeature GetValidationFeature(Container container); + + class AppHost : AppSelfHostBase + { + public ValidationFeature ValidationFeature { get; set; } + public AppHost() : base(nameof(ValidationExceptionTests), typeof(ValidationExceptionTests).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig { + AdminAuthSecret = AuthSecret, + }); + + Plugins.Add(ValidationFeature); + } + } + + private readonly ServiceStackHost appHost; + public ValidationRulesTests() + { + ValidationExtensions.RegisteredDtoValidators.Clear(); + + appHost = new AppHost(); + var container = appHost.Container; + var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); + container.Register<IDbConnectionFactory>(dbFactory); + container.Register(appHost.GetMemoryCacheClient()); + ((AppHost)appHost).ValidationFeature = GetValidationFeature(container); + + appHost.Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] public void OneTimeTearDown() => appHost.Dispose(); + + protected virtual JsonServiceClient GetClient() => new JsonServiceClient(Config.ListeningOn); + + [Test] + public void Does_only_allow_access_to_Admin_by_Default() + { + var client = new JsonServiceClient(Config.ListeningOn); + try + { + client.Get(new GetValidationRules { Type = nameof(ValidationRulesTest) }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.Unauthorized))); + } + + client.Get(new GetValidationRules { + Type = nameof(ValidationRulesTest), + AuthSecret = AuthSecret + }); + } + + [Test] + public void Does_now_allow_registering_invalid_validators() + { + (appHost.Resolve<IValidationSource>() as IClearable)?.Clear(); + + var client = GetClient(); + + void saveRules(params ValidationRule[] rules) => client.Post(new ModifyValidationRules { + AuthSecret = AuthSecret, + SaveRules = new List<ValidationRule>(rules) + }); + + void assertThrows(Action fn, Action<WebServiceException> onError) + { + try + { + fn(); + Assert.Fail($"Should throw {nameof(WebServiceException)}"); + } + catch (WebServiceException e) + { + onError(e); + } + } + + assertThrows(() => saveRules(new ValidationRule { + Validator = nameof(ValidateScripts.IsAuthenticated), + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Type))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest) + "NotExists", + Validator = nameof(ValidateScripts.IsAuthenticated), + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Type))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest), + Field = "NotExists", + Validator = nameof(ValidateScripts.IsAuthenticated), + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Field))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest), + Validator = nameof(ValidateScripts.IsAuthenticated) + "NotExists", + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Validator))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest), + Field = nameof(ValidationRulesTest.AuthSecret), + Validator = nameof(ValidateScripts.IsAuthenticated), //should be IPropertyValidator + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Validator))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest), + Validator = nameof(ValidateScripts.Null), //should be ITypeValidator + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Validator))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest), + Field = nameof(ValidationRulesTest.AuthSecret), + Validator = $"[{nameof(ValidateScripts.Null)},{nameof(ValidateScripts.IsAuthenticated)}]", //validate all + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Validator))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest), + Validator = $"[{nameof(ValidateScripts.IsAuthenticated)},{nameof(ValidateScripts.Null)}]", //validate all + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Validator))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest), + Validator = nameof(ValidateScripts.IsAuthenticated), + Condition = "true", + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Condition))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest), + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Validator))); + + assertThrows(() => saveRules(new ValidationRule { + Type = nameof(ValidationRulesTest), + Condition = "Invalid (ode" + }), e => Assert.That(e.StatusCode == 400 && + e.GetFieldErrors()[0].FieldName == nameof(ValidationRule.Condition))); + } + + [Test] + public void Can_ModifyValidationRules_suspend_and_delete() + { + (appHost.Resolve<IValidationSource>() as IClearable)?.Clear(); + + var client = GetClient(); + + var noRules = client.Get(new ValidationRulesTest()); + + client.Post(new ModifyValidationRules { + AuthSecret = AuthSecret, + SaveRules = new List<ValidationRule> { + new ValidationRule { Type = nameof(ValidationRulesTest), Validator = nameof(ValidateScripts.IsAuthenticated) }, + } + }); + + static void AssertRule(ValidationRule rule) + { + // Assert.That(rule.CreatedBy, Is.Not.Null); //AuthSecret is null + Assert.That(rule.CreatedDate, Is.Not.Null); + // Assert.That(rule.ModifiedBy, Is.Not.Null); //AuthSecret is null + Assert.That(rule.ModifiedDate, Is.Not.Null); + } + + var typeRules = client.Get(new GetValidationRules { + AuthSecret = AuthSecret, Type = nameof(ValidationRulesTest) + }); + Assert.That(typeRules.Results.Count, Is.EqualTo(1)); + AssertRule(typeRules.Results[0]); + + try + { + var requiresAuth = client.Get(new ValidationRulesTest()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.Unauthorized))); + } + + var requiresAuthAsAdmin = client.Get(new ValidationRulesTest { + AuthSecret = AuthSecret + }); + + client.Post(new ModifyValidationRules { + AuthSecret = AuthSecret, + SaveRules = new List<ValidationRule> { + new ValidationRule { Type = nameof(ValidationRulesTest), Field = nameof(ValidationRulesTest.Id), Validator = nameof(ValidateScripts.NotNull) }, + } + }); + + typeRules = client.Get(new GetValidationRules { + AuthSecret = AuthSecret, Type = nameof(ValidationRulesTest) + }); + Assert.That(typeRules.Results.Count, Is.EqualTo(2)); + AssertRule(typeRules.Results[0]); + AssertRule(typeRules.Results[1]); + + try + { + requiresAuthAsAdmin = client.Get(new ValidationRulesTest { + AuthSecret = AuthSecret + }); + + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.GetFieldErrors()[0].ErrorCode, Is.EqualTo("NotNull")); + } + + requiresAuthAsAdmin = client.Get(new ValidationRulesTest { + AuthSecret = AuthSecret, + Id = "Id" + }); + + client.Post(new ModifyValidationRules { + AuthSecret = AuthSecret, + SuspendRuleIds = new[] { + typeRules.Results.First(x => x.Field == nameof(ValidationRulesTest.Id)).Id + } + }); + + typeRules = client.Get(new GetValidationRules { + AuthSecret = AuthSecret, Type = nameof(ValidationRulesTest) + }); + Assert.That(typeRules.Results.First(x => x.Field == nameof(ValidationRulesTest.Id)).SuspendedDate, + Is.Not.Null); + + // Same as not having last rule + try + { + var requiresAuth = client.Get(new ValidationRulesTest()); + Assert.Fail("Should throw"); + } + catch (WebServiceException ex) + { + Assert.That(ex.ErrorCode, Is.EqualTo(nameof(HttpStatusCode.Unauthorized))); + } + + requiresAuthAsAdmin = client.Get(new ValidationRulesTest { + AuthSecret = AuthSecret + }); + + client.Post(new ModifyValidationRules { + AuthSecret = AuthSecret, + DeleteRuleIds = typeRules.Results.Map(x => x.Id).ToArray() + }); + + typeRules = client.Get(new GetValidationRules { + AuthSecret = AuthSecret, Type = nameof(ValidationRulesTest) + }); + Assert.That(typeRules.Results.Count, Is.EqualTo(0)); + + noRules = client.Get(new ValidationRulesTest()); + } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/VirtualFileSystemMappingTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/VirtualFileSystemMappingTests.cs new file mode 100644 index 00000000000..ebf9e908d6e --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/VirtualFileSystemMappingTests.cs @@ -0,0 +1,205 @@ +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Funq; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Testing; +using ServiceStack.Text; +using ServiceStack.VirtualPath; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class GetMappedFile : IReturn<GetMappedFileResponse> + { + public string VirtualPath { get; set; } + } + + public class GetMappedFileResponse + { + public string VirtualPath { get; set; } + public string FileName { get; set; } + public long FileSize { get; set; } + public string Contents { get; set; } + } + + public class FileSystemMappingService : Service + { + public object Any(GetMappedFile request) + { + var file = base.VirtualFileSources.GetFile(request.VirtualPath); + return new GetMappedFileResponse + { + VirtualPath = request.VirtualPath, + FileName = file.Name, + FileSize = file.Length, + Contents = file.ReadAllText(), + }; + } + } + + public class VirtualFileSystemMappingTests : VirtualFileSystemMappingTestsBase + { + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(VirtualFileSystemMappingTests), typeof(FileSystemMappingService).Assembly) { } + + public override void Configure(Container container) + { + } + + public override List<IVirtualPathProvider> GetVirtualFileSources() + { + var existingSources = base.GetVirtualFileSources(); + existingSources.Add(new FileSystemMapping("vfs1", MapProjectPath("~/App_Data/mount1"))); + existingSources.Add(new FileSystemMapping("vfs2", MapProjectPath("~/App_Data/mount2"))); + return existingSources; + } + } + + protected override ServiceStackHost CreateAppHost() => new AppHost(); + } + + public class VirtualFileSystemMappingPluginTests : VirtualFileSystemMappingTestsBase + { + public class VfsPlugin1 : IPlugin, IPreInitPlugin + { + public void BeforePluginsLoaded(IAppHost appHost) + { + appHost.AddVirtualFileSources.Add(new FileSystemMapping("vfs1", appHost.MapProjectPath("~/App_Data/mount1"))); + } + + public void Register(IAppHost appHost) {} + } + + public class VfsPlugin2 : IPlugin, IPreInitPlugin + { + public void BeforePluginsLoaded(IAppHost appHost) + { + appHost.AddVirtualFileSources.Add(new FileSystemMapping("vfs2", appHost.MapProjectPath("~/App_Data/mount2"))); + } + + public void Register(IAppHost appHost) {} + } + + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(VirtualFileSystemMappingPluginTests), typeof(FileSystemMappingService).Assembly) { } + + public override void Configure(Container container) + { + Plugins.Add(new VfsPlugin1()); + Plugins.Add(new VfsPlugin2()); + } + } + + protected override ServiceStackHost CreateAppHost() => new AppHost(); + } + + [TestFixture] + public abstract class VirtualFileSystemMappingTestsBase + { + protected readonly ServiceStackHost appHost; + protected abstract ServiceStackHost CreateAppHost(); + + public VirtualFileSystemMappingTestsBase() + { + appHost = CreateAppHost(); + var dirPath = ClearFolders(); + + Directory.CreateDirectory(dirPath.AppendPath("mount1", "dir1")); + File.WriteAllText(dirPath.AppendPath("mount1", "file.txt"), "MOUNT1"); + File.WriteAllText(dirPath.AppendPath("mount1", "dir1", "nested-file.txt"), "NESTED MOUNT1"); + + Directory.CreateDirectory(dirPath.AppendPath("mount2", "dir2")); + File.WriteAllText(dirPath.AppendPath("mount2", "file.txt"), "MOUNT2"); + File.WriteAllText(dirPath.AppendPath("mount2", "dir2", "nested-file.txt"), "NESTED MOUNT2"); + + appHost + .Init() + .Start(Config.ListeningOn); + } + + private string ClearFolders() + { + var dirPath = appHost.MapProjectPath("~/App_Data"); + if (Directory.Exists(dirPath.AppendPath("mount1"))) + Directory.Delete(dirPath.AppendPath("mount1"), recursive: true); + if (Directory.Exists(dirPath.AppendPath("mount2"))) + Directory.Delete(dirPath.AppendPath("mount2"), recursive: true); + return dirPath; + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + ClearFolders(); + } + + [Test] + public void Can_resolve_file_from_mapped_path() + { + var file1 = appHost.VirtualFileSources.GetFile("vfs1/file.txt"); + var file2 = appHost.VirtualFileSources.GetFile("vfs2/file.txt"); + + Assert.That(file1.Name, Is.EqualTo("file.txt")); + Assert.That(file1.ReadAllText(), Is.EqualTo("MOUNT1")); + + Assert.That(file2.Name, Is.EqualTo("file.txt")); + Assert.That(file2.ReadAllText(), Is.EqualTo("MOUNT2")); + } + + [Test] + public void Can_resolve_nested_file_from_mapped_path() + { + var file1 = appHost.VirtualFileSources.GetFile("vfs1/dir1/nested-file.txt"); + var file2 = appHost.VirtualFileSources.GetFile("vfs2/dir2/nested-file.txt"); + + Assert.That(file1.Name, Is.EqualTo("nested-file.txt")); + Assert.That(file1.ReadAllText(), Is.EqualTo("NESTED MOUNT1")); + + Assert.That(file2.Name, Is.EqualTo("nested-file.txt")); + Assert.That(file2.ReadAllText(), Is.EqualTo("NESTED MOUNT2")); + } + + [Test] + public void Can_resolve_mapped_files_from_service() + { + var client = new JsonServiceClient(Config.ListeningOn); + var response = client.Get(new GetMappedFile { VirtualPath = "vfs1/file.txt" }); + Assert.That(response.FileName, Is.EqualTo("file.txt")); + Assert.That(response.Contents, Is.EqualTo("MOUNT1")); + Assert.That(response.FileSize, Is.GreaterThan(0)); + + response = client.Get(new GetMappedFile { VirtualPath = "vfs2/dir2/nested-file.txt" }); + Assert.That(response.FileName, Is.EqualTo("nested-file.txt")); + Assert.That(response.Contents, Is.EqualTo("NESTED MOUNT2")); + Assert.That(response.FileSize, Is.GreaterThan(0)); + } + + [Test] + public void Can_resolve_mapped_files_directly() + { + var url = Config.ListeningOn.AppendPath("vfs1", "file.txt"); + var contents = url.GetStringFromUrl(); + Assert.That(contents, Is.EqualTo("MOUNT1")); + + contents = Config.ListeningOn.AppendPath("vfs2", "dir2", "nested-file.txt").GetStringFromUrl(); + Assert.That(contents, Is.EqualTo("NESTED MOUNT2")); + } + + [Test] + public void Can_resolve_mapped_files_directly_case_insenstive() + { + var url = Config.ListeningOn.AppendPath("VFS1", "file.txt"); + var contents = url.GetStringFromUrl(); + Assert.That(contents, Is.EqualTo("MOUNT1")); + + contents = Config.ListeningOn.AppendPath("VFS2", "dir2", "nested-file.txt").GetStringFromUrl(); + Assert.That(contents, Is.EqualTo("NESTED MOUNT2")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/VirtualPathProviderTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/VirtualPathProviderTests.cs new file mode 100644 index 00000000000..85fb0bb6da2 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/VirtualPathProviderTests.cs @@ -0,0 +1,445 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading; +using NUnit.Framework; +using ServiceStack.IO; +using ServiceStack.Testing; +using ServiceStack.Text; +using ServiceStack.VirtualPath; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class FileSystemVirtualPathProviderTests : AppendVirtualFilesTests + { + private static string RootDir = "~/App_Data/files".MapProjectPath(); + + public FileSystemVirtualPathProviderTests() + { + if (Directory.Exists(RootDir)) + Directory.Delete(RootDir, recursive:true); + + Directory.CreateDirectory(RootDir); + } + + public override IVirtualPathProvider GetPathProvider() + { + return new FileSystemVirtualFiles(RootDir); + } + } + + public class MemoryVirtualFilesTests : AppendVirtualFilesTests + { + public override IVirtualPathProvider GetPathProvider() + { + return new MemoryVirtualFiles(); + } + } + + [Ignore("Integration Tests")] + public class GistVirtualFilesTests : VirtualPathProviderTests + { + public static readonly string GistId = "a9cfcdced0002e82be20ea6314fb41d6"; + public static readonly string AccessToken = Environment.GetEnvironmentVariable("GITHUB_GIST_TOKEN"); + + public override IVirtualPathProvider GetPathProvider() + { + return new GistVirtualFiles(GistId, AccessToken); + } + } + + public abstract class AppendVirtualFilesTests : VirtualPathProviderTests + { + [Test] + public void Does_append_to_file() + { + var pathProvider = GetPathProvider(); + + pathProvider.DeleteFile("original.txt"); + pathProvider.WriteFile("original.txt", "original\n"); + + pathProvider.AppendFile("original.txt", "New Line1\n"); + pathProvider.AppendFile("original.txt", "New Line2\n"); + + var contents = pathProvider.GetFile("original.txt").ReadAllText(); + Assert.That(contents, Is.EqualTo("original\nNew Line1\nNew Line2\n")); + + pathProvider.DeleteFile("original.txt"); + } + + [Test] + public void Does_append_to_file_bytes() + { + var pathProvider = GetPathProvider(); + pathProvider.DeleteFile("original.bin"); + pathProvider.WriteFile("original.bin", "original\n".ToUtf8Bytes()); + + pathProvider.AppendFile("original.bin", "New Line1\n".ToUtf8Bytes()); + pathProvider.AppendFile("original.bin", "New Line2\n".ToUtf8Bytes()); + + var contents = pathProvider.GetFile("original.bin").ReadAllBytes(); + Assert.That(contents, Is.EquivalentTo("original\nNew Line1\nNew Line2\n".ToUtf8Bytes())); + + pathProvider.DeleteFile("original.bin"); + } + } + + [TestFixture] + public abstract class VirtualPathProviderTests + { + public abstract IVirtualPathProvider GetPathProvider(); + + protected ServiceStackHost appHost; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { + appHost = new BasicAppHost() + .Init(); + } + + [OneTimeTearDown] + public void TestFixtureTearDown() + { + appHost.Dispose(); + } + + [Test] + public void Can_create_file() + { + var pathProvider = GetPathProvider(); + + var filePath = "dir/file.txt"; + pathProvider.WriteFile(filePath, "file"); + + var file = pathProvider.GetFile(filePath); + + Assert.That(file.ReadAllText(), Is.EqualTo("file")); + Assert.That(file.ReadAllText(), Is.EqualTo("file")); //can read twice + + Assert.That(file.VirtualPath, Is.EqualTo(filePath)); + Assert.That(file.Name, Is.EqualTo("file.txt")); + Assert.That(file.Directory.Name, Is.EqualTo("dir")); + Assert.That(file.Directory.VirtualPath, Is.EqualTo("dir")); + Assert.That(file.Extension, Is.EqualTo("txt")); + + Assert.That(file.Directory.Name, Is.EqualTo("dir")); + + pathProvider.DeleteFolder("dir"); + } + + [Test] + public void Does_refresh_LastModified() + { + var pathProvider = GetPathProvider(); + + var filePath = "dir/file.txt"; + pathProvider.WriteFile(filePath, "file1"); + + var file = pathProvider.GetFile(filePath); + var prevLastModified = file.LastModified; + + file.Refresh(); + Assert.That(file.LastModified, Is.EqualTo(prevLastModified)); + + pathProvider.WriteFile(filePath, "file2"); + file.Refresh(); + + //Can be too quick and share same modified date sometimes, try again with a delay + if (file.LastModified == prevLastModified) + { + Thread.Sleep(1000); + pathProvider.WriteFile(filePath, "file3"); + file.Refresh(); + } + + Assert.That(file.LastModified, Is.Not.EqualTo(prevLastModified)); + + pathProvider.DeleteFolder("dir"); + } + + [Test] + public void Can_create_file_from_root() + { + var pathProvider = GetPathProvider(); + + var filePath = "file.txt"; + pathProvider.WriteFile(filePath, "file"); + + var file = pathProvider.GetFile(filePath); + + Assert.That(file.ReadAllText(), Is.EqualTo("file")); + Assert.That(file.Name, Is.EqualTo(filePath)); + Assert.That(file.Extension, Is.EqualTo("txt")); + + Assert.That(file.Directory.VirtualPath, Is.Null); + Assert.That(file.Directory.Name, Is.Null.Or.EqualTo("files")); + + pathProvider.DeleteFiles(new[] { "file.txt" }); + } + + [Test] + public void Does_override_existing_file() + { + var pathProvider = GetPathProvider(); + + pathProvider.WriteFile("file.txt", "original"); + pathProvider.WriteFile("file.txt", "updated"); + Assert.That(pathProvider.GetFile("file.txt").ReadAllText(), Is.EqualTo("updated")); + + pathProvider.WriteFile("/a/file.txt", "original"); + pathProvider.WriteFile("/a/file.txt", "updated"); + Assert.That(pathProvider.GetFile("/a/file.txt").ReadAllText(), Is.EqualTo("updated")); + + pathProvider.DeleteFiles(new[] { "file.txt", "/a/file.txt" }); + pathProvider.DeleteFolder("a"); + } + + [Test] + public void Can_view_files_in_Directory() + { + var pathProvider = GetPathProvider(); + + var testdirFileNames = new[] + { + "testdir/a.txt", + "testdir/b.txt", + "testdir/c.txt", + }; + + var to = new Dictionary<string, string>(); + testdirFileNames.Each(x => to[x] = "textfile"); + pathProvider.WriteFiles(to); + + var testdir = pathProvider.GetDirectory("testdir"); + var filePaths = testdir.Files.Map(x => x.VirtualPath); + + Assert.That(filePaths, Is.EquivalentTo(testdirFileNames)); + + var fileNames = testdir.Files.Map(x => x.Name); + Assert.That(fileNames, Is.EquivalentTo(testdirFileNames.Map(x => + x.SplitOnLast('/').Last()))); + + pathProvider.DeleteFolder("testdir"); + } + + [Test] + public void Does_resolve_nested_files_and_folders() + { + var pathProvider = GetPathProvider(); + + var allFilePaths = new[] { + "testfile.txt", + "a/testfile-a1.txt", + "a/testfile-a2.txt", + "a/b/testfile-ab1.txt", + "a/b/testfile-ab2.txt", + "a/b/c/testfile-abc1.txt", + "a/b/c/testfile-abc2.txt", + "a/d/testfile-ad1.txt", + "e/testfile-e1.txt", + }; + + var to = new Dictionary<string, string>(); + allFilePaths.Each(x => to[x] = x.SplitOnLast('.').First().SplitOnLast('/').Last()); + pathProvider.WriteFiles(to); + + Assert.That(allFilePaths.All(x => pathProvider.IsFile(x))); + Assert.That(new[] { "a", "a/b", "a/b/c", "a/d", "e" }.All(x => pathProvider.IsDirectory(x))); + + Assert.That(!pathProvider.IsFile("notfound.txt")); + Assert.That(!pathProvider.IsFile("a/notfound.txt")); + Assert.That(!pathProvider.IsDirectory("f")); + Assert.That(!pathProvider.IsDirectory("a/f")); + Assert.That(!pathProvider.IsDirectory("testfile.txt")); + Assert.That(!pathProvider.IsDirectory("a/testfile-a1.txt")); + + AssertContents(pathProvider.RootDirectory, new[] { + "testfile.txt", + }, new[] { + "a", + "e" + }); + + AssertContents(pathProvider.GetDirectory("a"), new[] { + "a/testfile-a1.txt", + "a/testfile-a2.txt", + }, new[] { + "a/b", + "a/d" + }); + + AssertContents(pathProvider.GetDirectory("a/b"), new[] { + "a/b/testfile-ab1.txt", + "a/b/testfile-ab2.txt", + }, new[] { + "a/b/c" + }); + + AssertContents(pathProvider.GetDirectory("a").GetDirectory("b"), new[] { + "a/b/testfile-ab1.txt", + "a/b/testfile-ab2.txt", + }, new[] { + "a/b/c" + }); + + AssertContents(pathProvider.GetDirectory("a/b/c"), new[] { + "a/b/c/testfile-abc1.txt", + "a/b/c/testfile-abc2.txt", + }, new string[0]); + + AssertContents(pathProvider.GetDirectory("a/d"), new[] { + "a/d/testfile-ad1.txt", + }, new string[0]); + + AssertContents(pathProvider.GetDirectory("e"), new[] { + "e/testfile-e1.txt", + }, new string[0]); + + Assert.That(pathProvider.GetFile("a/b/c/testfile-abc1.txt").ReadAllText(), Is.EqualTo("testfile-abc1")); + Assert.That(pathProvider.GetDirectory("a").GetFile("b/c/testfile-abc1.txt").ReadAllText(), Is.EqualTo("testfile-abc1")); + Assert.That(pathProvider.GetDirectory("a/b").GetFile("c/testfile-abc1.txt").ReadAllText(), Is.EqualTo("testfile-abc1")); + Assert.That(pathProvider.GetDirectory("a").GetDirectory("b").GetDirectory("c").GetFile("testfile-abc1.txt").ReadAllText(), Is.EqualTo("testfile-abc1")); + + var dirs = pathProvider.RootDirectory.Directories.Map(x => x.VirtualPath); + Assert.That(dirs, Is.EquivalentTo(new[] { "a", "e" })); + + var rootDirFiles = pathProvider.RootDirectory.GetAllMatchingFiles("*", 1).Map(x => x.VirtualPath); + Assert.That(rootDirFiles, Is.EquivalentTo(new[] { "testfile.txt" })); + + var allFiles = pathProvider.GetAllMatchingFiles("*").Map(x => x.VirtualPath); + Assert.That(allFiles, Is.EquivalentTo(allFilePaths)); + + allFiles = pathProvider.GetAllFiles().Map(x => x.VirtualPath); + Assert.That(allFiles, Is.EquivalentTo(allFilePaths)); + + Assert.That(pathProvider.DirectoryExists("a")); + Assert.That(!pathProvider.DirectoryExists("f")); + Assert.That(!pathProvider.GetDirectory("a/b/c").IsRoot); + Assert.That(!pathProvider.GetDirectory("a/b").IsRoot); + Assert.That(!pathProvider.GetDirectory("a").IsRoot); + Assert.That(pathProvider.GetDirectory("").IsRoot); + + pathProvider.DeleteFile("testfile.txt"); + pathProvider.DeleteFolder("a"); + pathProvider.DeleteFolder("e"); + + Assert.That(pathProvider.GetAllFiles().ToList().Count, Is.EqualTo(0)); + } + + [Test] + public void Can_GetAllMatchingFiles_in_nested_directories() + { + var pathProvider = GetPathProvider(); + + var allFilePaths = new[] { + "a/b/c/testfile-abc1.txt", + "a/b/c/d/e/f/g/testfile-abcdefg1.txt", + }; + + var to = new Dictionary<string, string>(); + allFilePaths.Each(x => to[x] = x.SplitOnLast('.').First().SplitOnLast('/').Last()); + pathProvider.WriteFiles(to); + + Assert.That(pathProvider.GetDirectory("a/b/c").GetAllMatchingFiles("testfile-abc1.txt").Count(), Is.EqualTo(1)); + Assert.That(pathProvider.GetDirectory("a/b").GetAllMatchingFiles("testfile-abc1.txt").Count(), Is.EqualTo(1)); + Assert.That(pathProvider.GetDirectory("a").GetAllMatchingFiles("testfile-abc1.txt").Count(), Is.EqualTo(1)); + + Assert.That(pathProvider.GetDirectory("a/b/c/d/e/f/g").GetAllMatchingFiles("testfile-abcdefg1.txt").Count(), Is.EqualTo(1)); + Assert.That(pathProvider.GetDirectory("a/b/c/d/e/f").GetAllMatchingFiles("testfile-abcdefg1.txt").Count(), Is.EqualTo(1)); + Assert.That(pathProvider.GetDirectory("a/b/c/d/e").GetAllMatchingFiles("testfile-abcdefg1.txt").Count(), Is.EqualTo(1)); + Assert.That(pathProvider.GetDirectory("a/b/c/d").GetAllMatchingFiles("testfile-abcdefg1.txt").Count(), Is.EqualTo(1)); + Assert.That(pathProvider.GetDirectory("a/b/c").GetAllMatchingFiles("testfile-abcdefg1.txt").Count(), Is.EqualTo(1)); + Assert.That(pathProvider.GetDirectory("a/b").GetAllMatchingFiles("testfile-abcdefg1.txt").Count(), Is.EqualTo(1)); + Assert.That(pathProvider.GetDirectory("a").GetAllMatchingFiles("testfile-abcdefg1.txt").Count(), Is.EqualTo(1)); + } + + [Test] + public void Does_create_file_in_nested_folders_with_correct_parent_directories() + { + var vfs = GetPathProvider(); + + vfs.WriteFile("a/b/c/file.txt", "file"); + var file = vfs.GetFile("a/b/c/file.txt"); + Assert.That(file != null); + + Assert.That(file.Directory.VirtualPath, Is.EqualTo("a/b/c")); + Assert.That(file.Directory.Name, Is.EqualTo("c")); + Assert.That(file.Directory.ParentDirectory.VirtualPath, Is.EqualTo("a/b")); + Assert.That(file.Directory.ParentDirectory.Name, Is.EqualTo("b")); + Assert.That(file.Directory.ParentDirectory.ParentDirectory.VirtualPath, Is.EqualTo("a")); + Assert.That(file.Directory.ParentDirectory.ParentDirectory.Name, Is.EqualTo("a")); + Assert.That(file.Directory.ParentDirectory.ParentDirectory.ParentDirectory.IsRoot); + Assert.That(vfs.RootDirectory.GetDirectories().Any(x => x.Name == "a")); + + vfs.DeleteFile("a/b/c/file.txt"); + } + + [Test] + public void Does_write_binary_file() + { + var pathProvider = GetPathProvider(); + + var bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + pathProvider.WriteFile("original.bin", bytes); + pathProvider.WriteFile("a/b/c/original.bin", bytes); + + var contents = pathProvider.GetFile("original.bin").ReadAllBytes(); + Assert.That(contents, Is.EquivalentTo(bytes)); + + contents = pathProvider.GetFile("a/b/c/original.bin").ReadAllBytes(); + Assert.That(contents, Is.EquivalentTo(bytes)); + + pathProvider.DeleteFiles(new[]{ "original.bin", "a/b/c/original.bin" }); + } + + [Test] + public void GetContents_of_Binary_File_returns_ReadOnlyMemory_byte() + { + var pathProvider = GetPathProvider(); + + var bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + pathProvider.WriteFile("original.bin", new ReadOnlyMemory<byte>(bytes)); + + var contents = (ReadOnlyMemory<byte>) pathProvider.GetFile("original.bin").GetContents(); + + Assert.That(contents.Span.SequenceEqual(bytes.AsSpan())); + } + + [Test] + public void GetContents_of_Text_File_returns_ReadOnlyMemory_char() + { + var pathProvider = GetPathProvider(); + + var text = "abcdef"; + + pathProvider.WriteFile("original.txt", text.AsMemory()); + + var contents = (ReadOnlyMemory<char>) pathProvider.GetFile("original.txt").GetContents(); + + Assert.That(contents.Span.SequenceEqual(text.AsSpan())); + } + + public void AssertContents(IVirtualDirectory dir, + string[] expectedFilePaths, string[] expectedDirPaths) + { + var filePaths = dir.Files.Map(x => x.VirtualPath); + Assert.That(filePaths, Is.EquivalentTo(expectedFilePaths)); + + var fileNames = dir.Files.Map(x => x.Name); + Assert.That(fileNames, Is.EquivalentTo(expectedFilePaths.Map(x => + x.SplitOnLast('/').Last()))); + + var dirPaths = dir.Directories.Map(x => x.VirtualPath); + Assert.That(dirPaths, Is.EquivalentTo(expectedDirPaths)); + + var dirNames = dir.Directories.Map(x => x.Name); + Assert.That(dirNames, Is.EquivalentTo(expectedDirPaths.Map(x => + x.SplitOnLast('/').Last()))); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/WebServiceExceptionTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/WebServiceExceptionTests.cs index e55fdfeb768..074edf6452f 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/WebServiceExceptionTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/WebServiceExceptionTests.cs @@ -1,7 +1,9 @@ using System.Collections.Generic; using System.Runtime.Serialization; using NUnit.Framework; +#if !NETCORE_SUPPORT using ServiceStack.ServiceModel; +#endif namespace ServiceStack.WebHost.Endpoints.Tests { @@ -57,15 +59,15 @@ public void Can_retrieve_empty_Errors_from_Dto_NoStatusResponse() [Test] public void Can_Retrieve_Errors_From_ResponseBody_If_ResponseDto_Does_Not_Contain_ResponseStatus() { - var webEx = new WebServiceException - { - ResponseDto = new List<string> {"123"}, - ResponseBody = "{\"ResponseStatus\":" + - "{\"ErrorCode\":\"UnauthorizedAccessException\"," + - "\"Message\":\"Error Message\"," + - "\"StackTrace\":\"Some Stack Trace\",\"Errors\":[]}}" - }; - Assert.That(webEx.ErrorCode, Is.EqualTo("UnauthorizedAccessException")); + var webEx = new WebServiceException { + ResponseDto = new List<string> {"123"}, + ResponseBody = "{\"ResponseStatus\":" + + "{\"ErrorCode\":\"UnauthorizedAccessException\"," + + "\"Message\":\"Error Message\"," + + "\"StackTrace\":\"Some Stack Trace\",\"Errors\":[]}}", + }; + + Assert.That(webEx.ErrorCode, Is.EqualTo("UnauthorizedAccessException")); Assert.That(webEx.ErrorMessage, Is.EqualTo("Error Message")); Assert.That(webEx.ServerStackTrace, Is.EqualTo("Some Stack Trace")); } diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/WsdlMetadataTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/WsdlMetadataTests.cs index 20bb041db15..deaf290c4c5 100644 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/WsdlMetadataTests.cs +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/WsdlMetadataTests.cs @@ -1,3 +1,4 @@ +#if !NETCORE using NUnit.Framework; using ServiceStack.Host; using ServiceStack.Metadata; @@ -22,25 +23,35 @@ public void Wsdl_state_is_correct() appHost.Metadata.Add(dummyServiceType, typeof(GetCustomers), typeof(GetCustomersResponse)); appHost.Metadata.Add(dummyServiceType, typeof(StoreCustomer), null); - var wsdlGenerator = new Soap11WsdlMetadataHandler(); + var wsdlGenerator = new Soap12WsdlMetadataHandler(); var xsdMetadata = new XsdMetadata(appHost.Metadata); var wsdlTemplate = wsdlGenerator.GetWsdlTemplate(xsdMetadata, "http://w3c.org/types", false, "http://w3c.org/types", "Service Name"); - Assert.That(wsdlTemplate.ReplyOperationNames, Is.EquivalentTo(xsdMetadata.GetReplyOperationNames(Format.Soap12))); - Assert.That(wsdlTemplate.OneWayOperationNames, Is.EquivalentTo(xsdMetadata.GetOneWayOperationNames(Format.Soap12))); + var soapTypes = appHost.Metadata.GetAllSoapOperationTypes().ToHashSet(); + Assert.That(wsdlTemplate.ReplyOperationNames, Is.EquivalentTo(xsdMetadata.GetReplyOperationNames(Format.Soap12, soapTypes))); + Assert.That(wsdlTemplate.OneWayOperationNames, Is.EquivalentTo(xsdMetadata.GetOneWayOperationNames(Format.Soap12, soapTypes))); } } [Test] public void Xsd_output_does_not_contain_xml_declaration() { - var xsd = new XsdGenerator { - OperationTypes = new[] { typeof(GetCustomer), typeof(GetCustomerResponse), typeof(GetCustomers), typeof(GetCustomersResponse), typeof(StoreCustomer) }, - OptimizeForFlash = false, - }.ToString(); - - Assert.That(!xsd.StartsWith("<?")); + using (var appHost = new BasicAppHost().Init()) + { + var xsd = new XsdGenerator + { + OperationTypes = new[] + { + typeof (GetCustomer), typeof (GetCustomerResponse), typeof (GetCustomers), + typeof (GetCustomersResponse), typeof (StoreCustomer) + }, + OptimizeForFlash = false, + }.ToString(); + + Assert.That(!xsd.StartsWith("<?")); + } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ZipServiceClientTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ZipServiceClientTests.cs new file mode 100644 index 00000000000..4e3bd059126 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ZipServiceClientTests.cs @@ -0,0 +1,195 @@ +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Threading.Tasks; +using Funq; +using NUnit.Framework; +using ServiceStack; +using ServiceStack.Web; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + [DataContract] + [Route("/hellozip")] + public class HelloZip : IReturn<HelloZipResponse> + { + [DataMember] + public string Name { get; set; } + + [DataMember] + public List<string> Test { get; set; } + } + + [DataContract] + public class HelloZipResponse + { + [DataMember] + public string Result { get; set; } + } + + public class HelloZipService : IService + { + public object Any(HelloZip request) + { + return request.Test == null + ? new HelloZipResponse { Result = $"Hello, {request.Name}" } + : new HelloZipResponse { Result = $"Hello, {request.Name} ({request.Test?.Count})" }; + } + } + + [TestFixture] + public class ZipServiceClientTests + { + private readonly ServiceStackHost appHost; + + public ZipServiceClientTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ZipServiceClientTests), typeof(HelloZipService).Assembly) { } + + public override void Configure(Container container) {} + } + + [Test] + public void Can_send_GZip_client_request_list() + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestCompressionType = CompressionTypes.GZip, + }; + var response = client.Post(new HelloZip + { + Name = "GZIP", + Test = new List<string> { "Test" } + }); + Assert.That(response.Result, Is.EqualTo("Hello, GZIP (1)")); + } + + [Test] + public async Task Can_send_GZip_client_request_list_async() + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestCompressionType = CompressionTypes.GZip, + }; + var response = await client.PostAsync(new HelloZip + { + Name = "GZIP", + Test = new List<string> { "Test" } + }); + Assert.That(response.Result, Is.EqualTo("Hello, GZIP (1)")); + } + + [Test] + public void Can_send_GZip_client_request_list_HttpClient() + { + var client = new JsonHttpClient(Config.ListeningOn) + { + RequestCompressionType = CompressionTypes.GZip, + }; + var response = client.Post(new HelloZip + { + Name = "GZIP", + Test = new List<string> { "Test" } + }); + Assert.That(response.Result, Is.EqualTo("Hello, GZIP (1)")); + } + + [Test] + public async Task Can_send_GZip_client_request_list_HttpClient_async() + { + var client = new JsonHttpClient(Config.ListeningOn) + { + RequestCompressionType = CompressionTypes.GZip, + }; + var response = await client.PostAsync(new HelloZip + { + Name = "GZIP", + Test = new List<string> { "Test" } + }); + Assert.That(response.Result, Is.EqualTo("Hello, GZIP (1)")); + } + + [Test] + public void Can_send_GZip_client_request() + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestCompressionType = CompressionTypes.GZip, + }; + var response = client.Post(new HelloZip { Name = "GZIP" }); + Assert.That(response.Result, Is.EqualTo("Hello, GZIP")); + } + + [Test] + public void Can_send_Deflate_client_request() + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestCompressionType = CompressionTypes.Deflate, + }; + var response = client.Post(new HelloZip { Name = "Deflate" }); + Assert.That(response.Result, Is.EqualTo("Hello, Deflate")); + } + + [Test] + public void Can_send_GZip_client_request_HttpClient() + { + var client = new JsonHttpClient(Config.ListeningOn) + { + RequestCompressionType = CompressionTypes.GZip, + }; + var response = client.Post(new HelloZip { Name = "GZIP" }); + Assert.That(response.Result, Is.EqualTo("Hello, GZIP")); + } + + [Test] + public void Can_send_Deflate_client_request_HttpClient() + { + var client = new JsonHttpClient(Config.ListeningOn) + { + RequestCompressionType = CompressionTypes.Deflate, + }; + var response = client.Post(new HelloZip { Name = "Deflate" }); + Assert.That(response.Result, Is.EqualTo("Hello, Deflate")); + } + + [Ignore("Integration Test"), Test] + public void Can_send_gzip_client_request_ASPNET() + { + var client = new JsonServiceClient(Config.AspNetServiceStackBaseUri) + { + RequestCompressionType = CompressionTypes.GZip, + }; + var response = client.Post(new HelloZip { Name = "GZIP" }); + Assert.That(response.Result, Is.EqualTo("Hello, GZIP")); + } + + + + [TestCase(CompressionTypes.Deflate)] + [TestCase(CompressionTypes.GZip)] + public async Task Can_send_async_compressed_client_request(string compressionType) + { + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestCompressionType = compressionType, + }; + var response = await client.PostAsync(new HelloZip { Name = compressionType }); + Assert.That(response.Result, Is.EqualTo($"Hello, {compressionType}")); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/ZipTests.cs b/tests/ServiceStack.WebHost.Endpoints.Tests/ZipTests.cs new file mode 100644 index 00000000000..6ee7d1c177d --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/ZipTests.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using Funq; +using NUnit.Framework; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.Endpoints.Tests +{ + public class ZipTests + { + private readonly bool hold; + public ZipTests() + { + hold = MemoryStreamFactory.UseRecyclableMemoryStream; + MemoryStreamFactory.UseRecyclableMemoryStream = true; + } + + [OneTimeTearDown] + public void OneTimeTearDown() => MemoryStreamFactory.UseRecyclableMemoryStream = hold; + + [Test] + public void Can_zip_and_unzip_bytes_using_DeflateStream() + { + var text = "hello zip"; + var zipBytes = StreamExt.DeflateProvider.Deflate(text); + var unzip = StreamExt.DeflateProvider.Inflate(zipBytes); + Assert.That(unzip, Is.EqualTo(text)); + } + + [Test] + public void Can_zip_and_unzip_bytes_using_Gzip() + { + var text = "hello zip"; + var zipBytes = StreamExt.GZipProvider.GZip(text); + var unzip = StreamExt.GZipProvider.GUnzip(zipBytes); + Assert.That(unzip, Is.EqualTo(text)); + } + } + + public class ZipRequestLoggerTests + { + private readonly ServiceStackHost appHost; + + public ZipRequestLoggerTests() + { + appHost = new AppHost() + .Init() + .Start(Config.ListeningOn); + } + + [OneTimeTearDown] + public void OneTimeTearDown() => appHost.Dispose(); + + class AppHost : AppSelfHostBase + { + public AppHost() + : base(nameof(ZipRequestLoggerTests), typeof(HelloZipService).Assembly) { } + + public override void Configure(Container container) + { + SetConfig(new HostConfig { + StrictMode = true, + }); + + Plugins.Add(new RequestLogsFeature { + EnableRequestBodyTracking = true, + }); + } + } + + [Test] + public void Does_log_compressed_requests() + { + var hold = JsConfig.UTF8Encoding; + JsConfig.UTF8Encoding = new UTF8Encoding(false, true); + + var client = new JsonServiceClient(Config.ListeningOn) + { + RequestCompressionType = CompressionTypes.GZip, + }; + var response = client.Post(new HelloZip + { + Name = "GZIP", + Test = new List<string> { "Test" } + }); + Assert.That(response.Result, Is.EqualTo("Hello, GZIP (1)")); + + JsConfig.UTF8Encoding = hold; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/dir/index.html b/tests/ServiceStack.WebHost.Endpoints.Tests/dir/index.html new file mode 100644 index 00000000000..31063146576 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/dir/index.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Title</title> +</head> +<body> + + <h1>dir/index.html</h1> + +</body> +</html> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/dir/sub/index.html b/tests/ServiceStack.WebHost.Endpoints.Tests/dir/sub/index.html new file mode 100644 index 00000000000..e9fa3e179b7 --- /dev/null +++ b/tests/ServiceStack.WebHost.Endpoints.Tests/dir/sub/index.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Title</title> +</head> +<body> + + <h1>dir/sub/index.html</h1> + +</body> +</html> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.Endpoints.Tests/packages.config b/tests/ServiceStack.WebHost.Endpoints.Tests/packages.config deleted file mode 100644 index 93ae56876e9..00000000000 --- a/tests/ServiceStack.WebHost.Endpoints.Tests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<packages> - <package id="NUnit" version="2.6.3" targetFramework="net40" /> - <package id="protobuf-net" version="2.0.0.668" targetFramework="net45" /> -</packages> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/App.config b/tests/ServiceStack.WebHost.IntegrationTests/App.config index fad529db893..739906ff1a1 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/App.config +++ b/tests/ServiceStack.WebHost.IntegrationTests/App.config @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> - <add key="servicestack:license" value="1001-e1JlZjoxMDAxLE5hbWU6VGVzdCBCdXNpbmVzcyxUeXBlOkJ1c2luZXNzLEhhc2g6UHVNTVRPclhvT2ZIbjQ5MG5LZE1mUTd5RUMzQnBucTFEbTE3TDczVEF4QUNMT1FhNXJMOWkzVjFGL2ZkVTE3Q2pDNENqTkQyUktRWmhvUVBhYTBiekJGUUZ3ZE5aZHFDYm9hL3lydGlwUHI5K1JsaTBYbzNsUC85cjVJNHE5QVhldDN6QkE4aTlvdldrdTgyTk1relY2eis2dFFqTThYN2lmc0JveHgycFdjPSxFeHBpcnk6MjAxMy0wMS0wMX0="/> </appSettings> </configuration> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.cs b/tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.cs index 714e76d6117..e0e1b15c37d 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.cs @@ -11,7 +11,9 @@ public partial class Default : PageBase { protected void Page_Load(object sender, EventArgs e) { - + var ssTest = base.SessionBag["ss-test"]; + + SessionBag["test"] = "foo"; } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.designer.cs b/tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.designer.cs index a6c31be29d5..db1d453bb5e 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.designer.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Global.asax.cs b/tests/ServiceStack.WebHost.IntegrationTests/Global.asax.cs index 3f094d1f8f1..8cd62811529 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Global.asax.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Global.asax.cs @@ -1,10 +1,16 @@ using System; +using System.Linq; +using System.Net; +using System.Runtime.Serialization; using Funq; +using NUnit.Framework; +using ServiceStack.Admin; +using ServiceStack.Api.OpenApi; using ServiceStack.Auth; -using ServiceStack.Authentication.OpenId; using ServiceStack.Caching; using ServiceStack.Configuration; using ServiceStack.Data; +using ServiceStack.Host; using ServiceStack.Messaging; using ServiceStack.Messaging.Redis; using ServiceStack.MiniProfiler; @@ -12,10 +18,13 @@ using ServiceStack.OrmLite; using ServiceStack.ProtoBuf; using ServiceStack.Redis; -using ServiceStack.Api.Swagger; +using ServiceStack.Common.Tests; +using ServiceStack.DataAnnotations; +using ServiceStack.Formats; using ServiceStack.Shared.Tests; using ServiceStack.Text; using ServiceStack.Validation; +using ServiceStack.Web; using ServiceStack.WebHost.IntegrationTests.Services; using ServiceStack.WebHost.IntegrationTests.Tests; @@ -23,29 +32,45 @@ namespace ServiceStack.WebHost.IntegrationTests { public class Global : System.Web.HttpApplication { - private const bool StartMqHost = false; + private const bool StartMqHost = false; public class AppHost : AppHostBase { public AppHost() - : base("ServiceStack WebHost IntegrationTests", typeof(Reverse).Assembly) {} + : base("ServiceStack WebHost IntegrationTests", typeof(Reverse).Assembly) + { + //typeof(Authenticate) + // .AddAttributes(new ExcludeAttribute(Feature.Metadata)); + + foreach (var pi in typeof(Authenticate).GetPublicProperties()) + { + if (pi.Name != "provider" && pi.Name != "UserName" && pi.Name != "Password") + { + pi.AddAttributes(new IgnoreDataMemberAttribute()); + } + } + } public override void Configure(Container container) { IocShared.Configure(this); - JsConfig.EmitCamelCaseNames = true; + JsConfig.Init(new Text.Config { + TextCase = TextCase.CamelCase, + }); + ServiceStack.Auth.RegisterService.AllowUpdates = true; - this.PreRequestFilters.Add((req, res) => { - req.Items["_DataSetAtPreRequestFilters"] = true; - }); + this.PreRequestFilters.Add((req, res) => + { + req.Items["_DataSetAtPreRequestFilters"] = true; + }); - this.GlobalRequestFilters.Add((req, res, dto) => { + this.GlobalRequestFilters.Add((req, res, dto) => + { req.Items["_DataSetAtRequestFilters"] = true; - var requestFilter = dto as RequestFilter; - if (requestFilter != null) + if (dto is RequestFilter requestFilter) { res.StatusCode = requestFilter.StatusCode; if (!requestFilter.HeaderName.IsNullOrEmpty()) @@ -55,19 +80,22 @@ public override void Configure(Container container) res.Close(); } - var secureRequests = dto as IRequiresSession; - if (secureRequests != null) + if (dto is IRequiresSession secureRequests) { res.ReturnAuthRequired(); } }); + + Plugins.Add(new SoapFormat()); + Plugins.Add(new MiniProfilerFeature()); this.Container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory( "~/App_Data/db.sqlite".MapHostAbsolutePath(), - SqliteDialect.Provider) { - ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current) - }); + SqliteDialect.Provider) + { + ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current) + }); this.Container.Register<ICacheClient>(new MemoryCacheClient()); //this.Container.Register<ICacheClient>(new BasicRedisClientManager()); @@ -94,29 +122,53 @@ public override void Configure(Container container) var resetMovies = this.Container.Resolve<ResetMoviesService>(); resetMovies.Post(null); + container.Register<IRedisClientsManager>(c => new RedisManagerPool()); + + Plugins.Add(new SharpPagesFeature()); + Plugins.Add(new ValidationFeature()); Plugins.Add(new SessionFeature()); Plugins.Add(new ProtoBufFormat()); - Plugins.Add(new RequestLogsFeature()); - Plugins.Add(new SwaggerFeature { UseBootstrapTheme = true }); + Plugins.Add(new RequestLogsFeature + { + //RequestLogger = new RedisRequestLogger(container.Resolve<IRedisClientsManager>()) + RequestLogger = new CsvRequestLogger(), + }); + Plugins.Add(new OpenApiFeature + { + }); Plugins.Add(new PostmanFeature()); Plugins.Add(new CorsFeature()); + Plugins.Add(new AutoQueryFeature { MaxLimit = 100 }); + //Plugins.Add(new AdminFeature()); container.RegisterValidators(typeof(CustomersValidator).Assembly); + typeof(ResponseStatus) + .AddAttributes(new ServiceStack.DataAnnotations.DescriptionAttribute("This is the Response Status!")); + + typeof(ResponseStatus) + .GetProperty("Message") + .AddAttributes(new ServiceStack.DataAnnotations.DescriptionAttribute("A human friendly error message")); //var onlyEnableFeatures = Feature.All.Remove(Feature.Jsv | Feature.Soap); - SetConfig(new HostConfig { + SetConfig(new HostConfig + { AdminAuthSecret = AuthTestsBase.AuthSecret, + ApiVersion = "0.2.0", //EnableFeatures = onlyEnableFeatures, DebugMode = true, //Show StackTraces for easier debugging + RedirectPaths = + { + { "/swagger-ui", "/swagger-ui/" } + } }); if (StartMqHost) { var redisManager = new BasicRedisClientManager(); var mqHost = new RedisMqServer(redisManager); - mqHost.RegisterHandler<Reverse>(ServiceController.ExecuteMessage); + mqHost.RegisterHandler<Reverse>(ExecuteMessage); mqHost.Start(); this.Container.Register((IMessageService)mqHost); } @@ -132,14 +184,13 @@ private void ConfigureAuth(Funq.Container container) Plugins.Add(new AuthFeature(() => new CustomUserSession(), new IAuthProvider[] { - new CredentialsAuthProvider(appSettings), - new FacebookAuthProvider(appSettings), - new TwitterAuthProvider(appSettings), - new GoogleOpenIdOAuthProvider(appSettings), - new OpenIdOAuthProvider(appSettings), + new CredentialsAuthProvider(appSettings), + new FacebookAuthProvider(appSettings), + new TwitterAuthProvider(appSettings), + new GoogleAuthProvider(appSettings), new DigestAuthProvider(appSettings), - new BasicAuthProvider(appSettings), - })); + new BasicAuthProvider(appSettings), + })); Plugins.Add(new RegistrationFeature()); @@ -152,6 +203,13 @@ private void ConfigureAuth(Funq.Container container) else authRepo.InitSchema(); } + + public override object OnPreExecuteServiceFilter(IService service, object request, IRequest httpReq, IResponse httpRes) + { + if (service is IocScopeService) + service.InjectRequestIntoDependencies(httpReq); + return request; + } } protected void Application_Start(object sender, EventArgs e) @@ -174,6 +232,5 @@ protected void Application_EndRequest(object src, EventArgs e) if (mqHost != null) mqHost.Start(); } - } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/PageBase.cs b/tests/ServiceStack.WebHost.IntegrationTests/PageBase.cs index 6b418b437a1..a3a9f85bca2 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/PageBase.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/PageBase.cs @@ -29,41 +29,20 @@ public class PageBase : Page /// Typed UserSession /// </summary> private object userSession; - protected virtual TUserSession SessionAs<TUserSession>() - { - return (TUserSession)(userSession ?? (userSession = Cache.SessionAs<TUserSession>())); - } + protected virtual TUserSession SessionAs<TUserSession>() => (TUserSession)(userSession ?? (userSession = Cache.SessionAs<TUserSession>())); - protected CustomUserSession UserSession - { - get - { - return SessionAs<CustomUserSession>(); - } - } + protected CustomUserSession UserSession => SessionAs<CustomUserSession>(); - public new ICacheClient Cache - { - get { return HostContext.Resolve<ICacheClient>(); } - } + public new ICacheClient Cache => HostContext.AppHost.GetCacheClient(null); private ISessionFactory sessionFactory; - public virtual ISessionFactory SessionFactory - { - get { return sessionFactory ?? (sessionFactory = HostContext.Resolve<ISessionFactory>()) ?? new SessionFactory(Cache); } - } + public virtual ISessionFactory SessionFactory => sessionFactory ?? (sessionFactory = HostContext.Resolve<ISessionFactory>()) ?? new SessionFactory(Cache); /// <summary> /// Dynamic Session Bag /// </summary> private ISession session; - public new ISession Session - { - get - { - return session ?? (session = SessionFactory.GetOrCreateSession()); - } - } + public new ISession SessionBag => session ?? (session = SessionFactory.GetOrCreateSession()); public void ClearSession() { diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Properties/AssemblyInfo.cs b/tests/ServiceStack.WebHost.IntegrationTests/Properties/AssemblyInfo.cs index 01b8bd0229a..88dbfeaa83a 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Properties/AssemblyInfo.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] +[assembly: AssemblyFileVersion("5.0.0.0")] [assembly: ContractNamespace("http://schemas.servicestack.net/types", ClrNamespace = "ServiceStack.WebHost.IntegrationTests.Services")] diff --git a/tests/ServiceStack.WebHost.IntegrationTests/ServiceStack.WebHost.IntegrationTests.csproj b/tests/ServiceStack.WebHost.IntegrationTests/ServiceStack.WebHost.IntegrationTests.csproj index 6d69e2336d3..c31b4ca5d54 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/ServiceStack.WebHost.IntegrationTests.csproj +++ b/tests/ServiceStack.WebHost.IntegrationTests/ServiceStack.WebHost.IntegrationTests.csproj @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\src\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\..\src\packages\NUnit.3.12.0\build\NUnit.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -12,12 +13,12 @@ <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>ServiceStack.WebHost.IntegrationTests</RootNamespace> <AssemblyName>ServiceStack.WebHost.IntegrationTests</AssemblyName> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <FileUpgradeFlags> </FileUpgradeFlags> <OldToolsVersion>4.0</OldToolsVersion> <UpgradeBackupLocation /> - <UseIISExpress>true</UseIISExpress> + <UseIISExpress>false</UseIISExpress> <IISExpressSSLPort /> <IISExpressAnonymousAuthentication /> <IISExpressWindowsAuthentication /> @@ -25,6 +26,10 @@ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\src\</SolutionDir> <RestorePackages>true</RestorePackages> <TargetFrameworkProfile /> + <UseGlobalApplicationHostFile /> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + <Use64BitIISExpress /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>True</DebugSymbols> @@ -35,7 +40,7 @@ <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - <PlatformTarget>x86</PlatformTarget> + <PlatformTarget>AnyCPU</PlatformTarget> <TreatWarningsAsErrors>false</TreatWarningsAsErrors> <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> @@ -69,62 +74,123 @@ <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> <ItemGroup> - <Reference Include="Mono.Data.Sqlite"> - <HintPath>..\..\lib\tests\Mono.Data.Sqlite.dll</HintPath> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="mscorlib" /> + <Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb"> + <HintPath>..\..\src\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67"> + <HintPath>..\..\src\packages\protobuf-net.2.4.6\lib\net40\protobuf-net.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.5.9.0\lib\net45\ServiceStack.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="ServiceStack.Api.OpenApi, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.Api.OpenApi.5.9.0\lib\net45\ServiceStack.Api.OpenApi.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="ServiceStack.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.Client.5.9.0\lib\net45\ServiceStack.Client.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.Common.5.9.0\lib\net45\ServiceStack.Common.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="ServiceStack.HttpClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.HttpClient.5.9.0\lib\net45\ServiceStack.HttpClient.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.Interfaces.5.9.0\lib\net45\ServiceStack.Interfaces.dll</HintPath> + <Private>True</Private> </Reference> - <Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\src\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> + <Reference Include="ServiceStack.NetFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.NetFramework.5.9.0\lib\net45\ServiceStack.NetFramework.dll</HintPath> + <Private>True</Private> </Reference> - <Reference Include="protobuf-net, Version=2.0.0.668, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\src\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll</HintPath> + <Reference Include="ServiceStack.OrmLite, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.OrmLite.5.9.0\lib\net45\ServiceStack.OrmLite.dll</HintPath> + <Private>True</Private> </Reference> - <Reference Include="ServiceStack.Interfaces"> - <HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath> + <Reference Include="ServiceStack.OrmLite.Sqlite, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.OrmLite.Sqlite.5.9.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll</HintPath> + <Private>True</Private> </Reference> - <Reference Include="ServiceStack.OrmLite"> - <HintPath>..\..\lib\ServiceStack.OrmLite.dll</HintPath> + <Reference Include="ServiceStack.ProtoBuf, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.ProtoBuf.5.8.0\lib\net45\ServiceStack.ProtoBuf.dll</HintPath> + <Private>True</Private> </Reference> - <Reference Include="ServiceStack.OrmLite.Sqlite"> - <HintPath>..\..\lib\ServiceStack.OrmLite.Sqlite.dll</HintPath> + <Reference Include="ServiceStack.Redis, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.Redis.5.9.0\lib\net45\ServiceStack.Redis.dll</HintPath> + <Private>True</Private> </Reference> - <Reference Include="ServiceStack.Redis"> - <HintPath>..\..\lib\ServiceStack.Redis.dll</HintPath> + <Reference Include="ServiceStack.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.Server.5.9.0\lib\net45\ServiceStack.Server.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="ServiceStack.Text, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587"> + <HintPath>..\..\src\packages\ServiceStack.Text.5.9.0\lib\net45\ServiceStack.Text.dll</HintPath> + <Private>True</Private> </Reference> <Reference Include="System" /> + <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"> + <HintPath>..\..\src\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <HintPath>..\..\src\packages\System.ComponentModel.Annotations.4.7.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Data.SQLite, Version=1.0.113.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"> + <HintPath>..\..\src\packages\System.Data.SQLite.Core.1.0.113.1\lib\net46\System.Data.SQLite.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"> + <HintPath>..\..\src\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath> + <Private>True</Private> + </Reference> <Reference Include="System.Net" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Numerics" /> + <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\..\src\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath> + </Reference> + <Reference Include="System.Runtime" /> + <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <HintPath>..\..\src\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath> + <Private>True</Private> + </Reference> <Reference Include="System.Runtime.Serialization"> <RequiredTargetFramework>3.0</RequiredTargetFramework> </Reference> + <Reference Include="System.Runtime.Serialization.Primitives, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\..\src\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll</HintPath> + <Private>True</Private> + <Private>True</Private> + </Reference> <Reference Include="System.ServiceModel"> <RequiredTargetFramework>3.0</RequiredTargetFramework> </Reference> - <Reference Include="System.Web.ApplicationServices" /> - <Reference Include="System.Web.DynamicData" /> - <Reference Include="System.Web.Entity" /> <Reference Include="System.Drawing" /> + <Reference Include="System.Threading" /> + <Reference Include="System.Threading.Tasks" /> + <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\..\src\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath> + </Reference> <Reference Include="System.Web" /> <Reference Include="System.Web.Extensions" /> + <Reference Include="System.Web.Services" /> <Reference Include="System.Xml" /> <Reference Include="System.Configuration" /> - <Reference Include="System.Web.Services" /> - <Reference Include="System.EnterpriseServices" /> - <Reference Include="Moq"> - <HintPath>..\..\lib\tests\Moq.dll</HintPath> - </Reference> - <Reference Include="ServiceStack.Text"> - <HintPath>..\..\lib\ServiceStack.Text.dll</HintPath> - </Reference> - <Reference Include="System.Xml.Linq" /> </ItemGroup> <ItemGroup> - <Content Include="..\..\lib\sqlite3.dll"> - <Link>sqlite3.dll</Link> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> <Content Include="Content\bootstrap.css" /> <EmbeddedResource Include="Content\static-sub-embedded.txt" /> <Content Include="Content\default.html" /> @@ -157,6 +223,7 @@ <EmbeddedResource Include="static-root-embedded.txt" /> <Content Include="Default.aspx" /> <Content Include="default.html" /> + <Content Include="start.cmd" /> <Content Include="Subpages\Test.aspx" /> <EmbeddedResource Include="Templates\OperationControl.html" /> <EmbeddedResource Include="Templates\HtmlFormat.html" /> @@ -176,11 +243,13 @@ <Compile Include="Services\AsyncTaskServices.cs" /> <Compile Include="Services\CookiesService.cs" /> <Compile Include="Services\CustomPathServices.cs" /> + <Compile Include="Services\CustomRouteService.cs" /> + <Compile Include="Services\SessionTest.cs" /> + <Compile Include="Services\TemplateService.cs" /> + <Compile Include="Services\VerbOnlyService.cs" /> <Compile Include="Shared\IocService.cs" /> <Compile Include="Tests\AsyncProgressTests.cs" /> - <Compile Include="PageBase.cs"> - <SubType>ASPXCodeBehind</SubType> - </Compile> + <Compile Include="PageBase.cs" /> <Compile Include="Default.aspx.cs"> <DependentUpon>Default.aspx</DependentUpon> <SubType>ASPXCodeBehind</SubType> @@ -228,7 +297,7 @@ <Compile Include="Services\CustomFormDataService.cs" /> <Compile Include="Services\GeoInfoService.cs" /> <Compile Include="Services\ProfilerService.cs" /> - <Compile Include="Services\RouteInfoService.cs" /> + <Compile Include="Services\RouteTokenInfoService.cs" /> <Compile Include="Services\UserAuths.cs" /> <Compile Include="Tests\AppHostBaseTests.cs" /> <Compile Include="Tests\CachedServiceTests.cs" /> @@ -265,23 +334,18 @@ <Compile Include="Tests\MovieServiceTests.cs" /> <Compile Include="Tests\RequestAndPathResolutionTests.cs" /> <Compile Include="Tests\RequestFilterTests.cs" /> + <Compile Include="Tests\RequestInfoTests.cs" /> <Compile Include="Tests\RestPathResolutionUnitTests.cs" /> <Compile Include="Tests\RestsTestBase.cs" /> <Compile Include="Tests\RestWebServiceTests.cs" /> + <Compile Include="Tests\RouteTests.cs" /> <Compile Include="Tests\SessionTests.cs" /> + <Compile Include="Tests\SoapTests.cs" /> <Compile Include="Tests\UniqueRequestTests.cs" /> <Compile Include="Tests\VirtualPathTests.cs" /> <Compile Include="Tests\WebServicesTests.cs" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\src\ServiceStack.Api.Swagger\ServiceStack.Api.Swagger.csproj"> - <Project>{01D3F057-7984-498F-8B0A-EB375701E204}</Project> - <Name>ServiceStack.Api.Swagger</Name> - </ProjectReference> - <ProjectReference Include="..\..\src\ServiceStack.Authentication.OpenId\ServiceStack.Authentication.OpenId.csproj"> - <Project>{6E240294-9D93-4C09-9BB0-38D82A22DEEE}</Project> - <Name>ServiceStack.Authentication.OpenId</Name> - </ProjectReference> <ProjectReference Include="..\..\src\ServiceStack.Client\ServiceStack.Client.csproj"> <Project>{c43f583f-abde-4dd4-bbe3-66322817a6ad}</Project> <Name>ServiceStack.Client</Name> @@ -290,16 +354,16 @@ <Project>{982416DB-C143-4028-A0C3-CF41892D18D3}</Project> <Name>ServiceStack.Common</Name> </ProjectReference> - <ProjectReference Include="..\..\src\ServiceStack.ProtoBuf\ServiceStack.ProtoBuf.csproj"> - <Project>{ef36a253-c53f-4bf3-b0ec-4d29211fa67d}</Project> - <Name>ServiceStack.ProtoBuf</Name> + <ProjectReference Include="..\..\src\ServiceStack.Interfaces\ServiceStack.Interfaces.csproj"> + <Project>{55942102-033a-4da8-a6af-1db7b2f34a2d}</Project> + <Name>ServiceStack.Interfaces</Name> </ProjectReference> <ProjectReference Include="..\..\src\ServiceStack.Server\ServiceStack.Server.csproj"> <Project>{5a315f92-80d2-4c60-a5a4-22e027ac7e7e}</Project> <Name>ServiceStack.Server</Name> </ProjectReference> <ProjectReference Include="..\..\src\ServiceStack\ServiceStack.csproj"> - <Project>{680A1709-25EB-4D52-A87F-EE03FFD94BAA}</Project> + <Project>{680a1709-25eb-4d52-a87f-ee03ffd94baa}</Project> <Name>ServiceStack</Name> </ProjectReference> <ProjectReference Include="..\ServiceStack.Common.Tests\ServiceStack.Common.Tests.csproj"> @@ -308,9 +372,11 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <Content Include="packages.config" /> <Content Include="static-root.txt" /> <Content Include="App.config" /> + <None Include="packages.config"> + <SubType>Designer</SubType> + </None> <None Include="Properties\DataSources\ServiceStack.ServiceInterface.ServiceModel.ResponseStatus.datasource" /> <None Include="README.md" /> <Content Include="sample.pdf" /> @@ -319,6 +385,9 @@ <ItemGroup> <Folder Include="App_Data\" /> </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> <PropertyGroup> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> @@ -335,8 +404,6 @@ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /> - <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> - <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /> <!-- 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. <Target Name="BeforeBuild"> @@ -357,7 +424,7 @@ <AutoAssignPort>False</AutoAssignPort> <DevelopmentServerPort>50000</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> - <IISUrl>http://localhost:50095/</IISUrl> + <IISUrl>http://localhost:50000/</IISUrl> <NTLMAuthentication>False</NTLMAuthentication> <UseCustomServer>False</UseCustomServer> <CustomServerUrl> @@ -368,4 +435,12 @@ </VisualStudio> </ProjectExtensions> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\src\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\src\packages\NUnit.3.12.0\build\NUnit.props'))" /> + <Error Condition="!Exists('..\..\src\packages\System.Data.SQLite.Core.1.0.113.1\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\src\packages\System.Data.SQLite.Core.1.0.113.1\build\net46\System.Data.SQLite.Core.targets'))" /> + </Target> + <Import Project="..\..\src\packages\System.Data.SQLite.Core.1.0.113.1\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\src\packages\System.Data.SQLite.Core.1.0.113.1\build\net46\System.Data.SQLite.Core.targets')" /> </Project> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/CustomRouteService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/CustomRouteService.cs new file mode 100644 index 00000000000..9a00decf3f5 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/CustomRouteService.cs @@ -0,0 +1,29 @@ +namespace ServiceStack.WebHost.IntegrationTests.Services +{ + [Route("/custom")] + [Route("/custom/{Data}")] + public class CustomRoute : IReturn<CustomRoute> + { + public string Data { get; set; } + } + + [Route("/customdot/{Id}.{Data}")] + public class CustomRouteDot : IReturn<CustomRouteDot> + { + public string Id { get; set; } + public string Data { get; set; } + } + + public class CustomRouteService : IService + { + public object Any(CustomRoute request) + { + return request; + } + + public object Any(CustomRouteDot request) + { + return request; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/CustomerService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/CustomerService.cs index d3577f02b00..c872a60d1da 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/CustomerService.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/CustomerService.cs @@ -35,7 +35,7 @@ public CustomersValidator() RuleFor(x => x.FirstName).NotEmpty().WithMessage("Please specify a first name"); RuleFor(x => x.Company).NotNull(); RuleFor(x => x.Discount).NotEqual(0).When(x => x.HasDiscount); - RuleFor(x => x.Address).Length(20, 250); + RuleFor(x => x.Address).NotNull().Length(20, 250); RuleFor(x => x.Postcode).Must(BeAValidPostcode).WithMessage("Please specify a valid postcode"); }); } diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/FileUploadService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/FileUploadService.cs index 6218acf4604..3438b6fbcb5 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/FileUploadService.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/FileUploadService.cs @@ -8,59 +8,100 @@ namespace ServiceStack.WebHost.IntegrationTests.Services { - [DataContract] - [Route("/fileuploads/{RelativePath*}", HttpMethods.Get)] - [Route("/fileuploads", HttpMethods.Post)] - public class FileUpload - { - [DataMember] - public string RelativePath { get; set; } - } - - [DataContract] - public class FileUploadResponse - { - [DataMember] - public string FileName { get; set; } - - [DataMember] - public long ContentLength { get; set; } - - [DataMember] - public string ContentType { get; set; } - - [DataMember] - public string Contents { get; set; } - } - - public class FileUploadService : Service - { - public object Get(FileUpload request) - { - if (request.RelativePath.IsNullOrEmpty()) - throw new ArgumentNullException("RelativePath"); - - var filePath = ("~/" + request.RelativePath).MapHostAbsolutePath(); - if (!File.Exists(filePath)) - throw new FilterInvalidBodyAccessException(request.RelativePath); - - var result = new HttpResult(new FileInfo(filePath)); - return result; - } - - public object Post(FileUpload request) - { - if (this.Request.Files.Length == 0) - throw new ValidationError("UploadError", "No such file exists"); - - var file = this.Request.Files[0]; - return new FileUploadResponse - { - FileName = file.FileName, - ContentLength = file.ContentLength, - ContentType = file.ContentType, - Contents = new StreamReader(file.InputStream).ReadToEnd(), - }; - } - } + [DataContract] + [Route("/fileuploads/{RelativePath*}")] + [Route("/fileuploads", HttpMethods.Post)] + public class FileUpload : IReturn<FileUploadResponse> + { + [DataMember] + public string RelativePath { get; set; } + + [DataMember] + public string CustomerName { get; set; } + + [DataMember] + public int? CustomerId { get; set; } + + [DataMember] + public DateTime CreatedDate { get; set; } + } + + [DataContract] + public class FileUploadResponse : IHasResponseStatus + { + [DataMember] + public string Name { get; set; } + + [DataMember] + public string FileName { get; set; } + + [DataMember] + public long ContentLength { get; set; } + + [DataMember] + public string ContentType { get; set; } + + [DataMember] + public string Contents { get; set; } + + [DataMember] + public ResponseStatus ResponseStatus { get; set; } + + [DataMember] + public string CustomerName { get; set; } + + [DataMember] + public int? CustomerId { get; set; } + + [DataMember] + public DateTime CreatedDate { get; set; } + } + + public class FileUploadService : Service + { + public object Get(FileUpload request) + { + if (request.RelativePath.IsNullOrEmpty()) + throw new ArgumentNullException("RelativePath"); + + var filePath = ("~/" + request.RelativePath).MapHostAbsolutePath(); + if (!File.Exists(filePath)) + throw new FileNotFoundException(request.RelativePath); + + var result = new HttpResult(new FileInfo(filePath)); + return result; + } + + public object Post(FileUpload request) + { + if (this.Request.Files.Length == 0) + throw new FileNotFoundException("UploadError", "No such file exists"); + + if (request.RelativePath == "ThrowError") + throw new NotSupportedException("ThrowError"); + + var file = this.Request.Files[0]; + return new FileUploadResponse + { + Name = file.Name, + FileName = file.FileName, + ContentLength = file.ContentLength, + ContentType = file.ContentType, + Contents = file.InputStream.ReadToEnd(), + CustomerId = request.CustomerId, + CustomerName = request.CustomerName, + CreatedDate = request.CreatedDate + }; + } + + public object Put(FileUpload request) + { + return new FileUploadResponse + { + CustomerId = request.CustomerId, + CustomerName = request.CustomerName, + CreatedDate = request.CreatedDate + }; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/HelloImage.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/HelloImage.cs index 26348e8a758..a53c299a85b 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/HelloImage.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/HelloImage.cs @@ -3,6 +3,9 @@ using System.Drawing; using System.Drawing.Imaging; using System.IO; +using System.Threading; +using System.Threading.Tasks; +using ServiceStack.Text; using ServiceStack.Web; namespace ServiceStack.WebHost.IntegrationTests.Services @@ -54,7 +57,7 @@ public object Any(HelloImage2 request) public class HelloImage3 {} //Your own Custom Result, writes directly to response stream - public class ImageResult : IDisposable, IStreamWriter, IHasOptions + public class ImageResult : IDisposable, IStreamWriterAsync, IHasOptions { private readonly Image image; private readonly ImageFormat imgFormat; @@ -68,17 +71,23 @@ public ImageResult(Image image, ImageFormat imgFormat=null) }; } - public void WriteTo(Stream responseStream) - { - image.Save(responseStream, imgFormat); - } - public void Dispose() { this.image.Dispose(); } public IDictionary<string, string> Options { get; set; } + + public async Task WriteToAsync(Stream responseStream, CancellationToken token = new CancellationToken()) + { + using (var ms = MemoryStreamFactory.GetStream()) + { + image.Save(ms, imgFormat); + + ms.Position = 0; + await ms.WriteToAsync(responseStream, token); + } + } } public class HelloImage3Service : IService diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/MovieService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/MovieService.cs index de6c21ffc15..346d6e8d56e 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/MovieService.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/MovieService.cs @@ -9,6 +9,11 @@ namespace ServiceStack.WebHost.IntegrationTests.Services { + [Route("/movies/query", "GET")] + public class QueryMovies : QueryDb<Movie> + { + public string TitleContains { get; set; } + } [Route("/movies", "POST,PUT,PATCH")] [Route("/movies/{Id}")] diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/MoviesService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/MoviesService.cs index 06d265ee8e3..2fc70884833 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/MoviesService.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/MoviesService.cs @@ -5,39 +5,39 @@ namespace ServiceStack.WebHost.IntegrationTests.Services { - [DataContract] - [Route("/movies", "GET, OPTIONS")] - [Route("/movies/genres/{Genre}")] - public class Movies - { - [DataMember] - public string Genre { get; set; } + [DataContract] + [Route("/movies", "GET, OPTIONS")] + [Route("/movies/genres/{Genre}")] + public class Movies + { + [DataMember] + public string Genre { get; set; } - [DataMember] - public Movie Movie { get; set; } - } + [DataMember] + public Movie Movie { get; set; } + } - [DataContract] - public class MoviesResponse - { - [DataMember(Order = 1)] - public List<Movie> Movies { get; set; } - } + [DataContract] + public class MoviesResponse + { + [DataMember(Order = 1)] + public List<Movie> Movies { get; set; } + } - public class MoviesService : Service - { - /// <summary> - /// GET /movies - /// GET /movies/genres/{Genre} - /// </summary> - public object Get(Movies request) - { - return new MoviesResponse - { - Movies = request.Genre.IsNullOrEmpty() - ? Db.Select<Movie>() - : Db.Select<Movie>("Genres LIKE {0}", "%" + request.Genre + "%") - }; - } - } + public class MoviesService : Service + { + /// <summary> + /// GET /movies + /// GET /movies/genres/{Genre} + /// </summary> + public object Get(Movies request) + { + return new MoviesResponse + { + Movies = request.Genre.IsNullOrEmpty() + ? Db.Select<Movie>() + : Db.Select<Movie>("Genres LIKE {0}", "%" + request.Genre + "%") + }; + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/ProfilerService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/ProfilerService.cs index 40a27b3c286..7d44354a695 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/ProfilerService.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/ProfilerService.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; using System.Linq; using ServiceStack.Data; +using ServiceStack.DataAnnotations; using ServiceStack.MiniProfiler; using ServiceStack.OrmLite; namespace ServiceStack.WebHost.IntegrationTests.Services { + [Exclude(Feature.Soap)] [Route("/profiler", "GET")] [Route("/profiler/{Type}", "GET")] public class MiniProfiler @@ -22,7 +24,7 @@ public object Any(MiniProfiler request) var profiler = Profiler.Current; using (var db = DbFactory.OpenDbConnection()) - using (profiler.Step("MiniProfiler Service")) + using (profiler.Step("MiniProfiler Service")) { if (request.Type == "n1") { diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/ReverseService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/ReverseService.cs index c77812e4fe1..f9644bdff17 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/ReverseService.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/ReverseService.cs @@ -17,6 +17,24 @@ public class ReverseResponse public string Result { get; set; } } + [DataContract] + public class AddInts : IReturn<AddIntsResponse> + { + [DataMember] + public int A { get; set; } + [DataMember] + public int B { get; set; } + } + + [DataContract] + public class AddIntsResponse + { + [DataMember] + public int Result { get; set; } + [DataMember] + public ResponseStatus ResponseStatus { get; set; } + } + public class ReverseService : Service { @@ -31,6 +49,10 @@ public static string Execute(string value) Array.Reverse(valueBytes); return new string(valueBytes); } + + public object Any(AddInts request) => new AddIntsResponse { + Result = request.A + request.B + }; } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/RouteInfoService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/RouteInfoService.cs deleted file mode 100644 index 6606f923469..00000000000 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/RouteInfoService.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using DeliveryService.Model.Types; -using ServiceStack; - -namespace DeliveryService.Model.Operations -{ - [Description("POST the route information based on the Application Token associated to a route and Associate ID")] - [Route("/RouteInfo", "POST")] - [Route("/RouteInfo/{AppToken}")] - [Route("/RouteInfo/{AppToken}/{HasProduct}")] - [DataContract] - public class RouteInfo - { - [DataMember] - public string AppToken { get; set; } - - [DataMember] - public bool? HasProduct { get; set; } - } - - [DataContract] - public class RouteInfoResponse : IHasResponseStatus - { - public RouteInfoResponse() - { - this.ResponseStatus = new ResponseStatus(); - this.Customers = new List<Customer>(); - this.Outcomes = new List<Outcome>(); - this.DD = new Dictionary<string, Dictionary<string, string>>(); - this.Tweak = new Dictionary<string, int>(); - } - - [DataMember] - public List<Customer> Customers { get; set; } - - [DataMember] - public List<Outcome> Outcomes { get; set; } - - [DataMember] - public Dictionary<string, Dictionary<string, string>> DD { get; set; } - - [DataMember] - public Dictionary<string, int> Tweak { get; set; } - - [DataMember] - public ResponseStatus ResponseStatus { get; set; } - } - - public class RouteInfoService : Service - { - public object Any(RouteInfo request) - { - throw new NotImplementedException(); - } - } -} - -namespace DeliveryService.Model.Types -{ - [DataContract] - public class Outcome - { - [DataMember] - public string UID { get; set; } - - [DataMember] - public string Name { get; set; } - - [DataMember] - public List<OutcomeReason> Reasons { get; set; } - } - - - [DataContract] - public class OutcomeReason - { - [DataMember] - public string UID { get; set; } - - [DataMember] - public string Message { get; set; } - - } -} - - -namespace DeliveryService.Model.Types -{ - [DataContract] - public class Customer - { - [DataMember] - public string UID { get; set; } - [DataMember] - public int RoutePos { get; set; } - [DataMember] - public string Invoice { get; set; } - [DataMember] - public string FirstName { get; set; } - [DataMember] - public string LastName { get; set; } - [DataMember] - public string Address { get; set; } - [DataMember] - public string City { get; set; } - [DataMember] - public string State { get; set; } - [DataMember] - public string ZipCode { get; set; } - [DataMember] - public string HmPhone { get; set; } - [DataMember] - public string WkPhone { get; set; } - [DataMember] - public string ClPhone { get; set; } - [DataMember] - public string ArrivalETA { get; set; } - [DataMember] - public string CompletionCode { get; set; } - [DataMember] - public string ConfirmationCode { get; set; } - [DataMember] - public bool IsPosted { get; set; } - [DataMember] - public string Lat { get; set; } - [DataMember] - public string Long { get; set; } - - } -} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/RouteTokenInfoService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/RouteTokenInfoService.cs new file mode 100644 index 00000000000..b7cf7b9729a --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/RouteTokenInfoService.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.Serialization; +using DeliveryService.Model.Types; +using ServiceStack; + +namespace DeliveryService.Model.Operations +{ + [Description("POST the route information based on the Application Token associated to a route and Associate ID")] + [Route("/RouteTokenInfo", "POST")] + [Route("/RouteTokenInfo/{AppToken}")] + [Route("/RouteTokenInfo/{AppToken}/{HasProduct}")] + [DataContract] + public class RouteTokenInfo + { + [DataMember] + public string AppToken { get; set; } + + [DataMember] + public bool? HasProduct { get; set; } + } + + [DataContract] + public class RouteInfoResponse : IHasResponseStatus + { + public RouteInfoResponse() + { + this.ResponseStatus = new ResponseStatus(); + this.Customers = new List<Customer>(); + this.Outcomes = new List<Outcome>(); + this.DD = new Dictionary<string, Dictionary<string, string>>(); + this.Tweak = new Dictionary<string, int>(); + } + + [DataMember] + public List<Customer> Customers { get; set; } + + [DataMember] + public List<Outcome> Outcomes { get; set; } + + [DataMember] + public Dictionary<string, Dictionary<string, string>> DD { get; set; } + + [DataMember] + public Dictionary<string, int> Tweak { get; set; } + + [DataMember] + public ResponseStatus ResponseStatus { get; set; } + } + + public class RouteTokenInfoService : Service + { + public object Any(RouteTokenInfo request) + { + throw new NotImplementedException(); + } + } +} + +namespace DeliveryService.Model.Types +{ + [DataContract] + public class Outcome + { + [DataMember] + public string UID { get; set; } + + [DataMember] + public string Name { get; set; } + + [DataMember] + public List<OutcomeReason> Reasons { get; set; } + } + + + [DataContract] + public class OutcomeReason + { + [DataMember] + public string UID { get; set; } + + [DataMember] + public string Message { get; set; } + + } +} + + +namespace DeliveryService.Model.Types +{ + [DataContract] + public class Customer + { + [DataMember] + public string UID { get; set; } + [DataMember] + public int RoutePos { get; set; } + [DataMember] + public string Invoice { get; set; } + [DataMember] + public string FirstName { get; set; } + [DataMember] + public string LastName { get; set; } + [DataMember] + public string Address { get; set; } + [DataMember] + public string City { get; set; } + [DataMember] + public string State { get; set; } + [DataMember] + public string ZipCode { get; set; } + [DataMember] + public string HmPhone { get; set; } + [DataMember] + public string WkPhone { get; set; } + [DataMember] + public string ClPhone { get; set; } + [DataMember] + public string ArrivalETA { get; set; } + [DataMember] + public string CompletionCode { get; set; } + [DataMember] + public string ConfirmationCode { get; set; } + [DataMember] + public bool IsPosted { get; set; } + [DataMember] + public string Lat { get; set; } + [DataMember] + public string Long { get; set; } + + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/Secure.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/Secure.cs index 301d23eb8b8..c63a8bd92d8 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/Secure.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/Secure.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Runtime.Serialization; using ServiceStack.Configuration; @@ -26,12 +27,113 @@ public class SecureResponse public string Value { get; set; } } + [Authenticate] [Route("/requiresadmin")] - public class RequiresRole + public class RequiresRoleInService { public string Role { get; set; } } + + [Authenticate] + [Route("/testauth")] + public class TestAuth + { + public int Id { get; set; } + public string Name { get; set; } + } + + + [Authenticate] + public class RequiresAuthRequest : IReturn<RequiresAuthRequest> + { + public string Name { get; set; } + } + + public class RequiresAuthAction : IReturn<RequiresAuthAction> + { + public string Name { get; set; } + } + + [RequiredRole("TheRole")] + public class RequiresRoleRequest : IReturn<RequiresRoleRequest> + { + public string Name { get; set; } + } + + public class RequiresRoleAction : IReturn<RequiresRoleAction> + { + public string Name { get; set; } + } + + [RequiresAnyRole("TheRole", "TheRole2")] + public class RequiresAnyRoleRequest : IReturn<RequiresAnyRoleRequest> + { + public List<string> Roles { get; set; } + + public RequiresAnyRoleRequest() + { + Roles = new List<string>(); + } + } + + [RequiredPermission("ThePermission")] + public class RequiresPermissionRequest : IReturn<RequiresPermissionRequest> + { + public string Name { get; set; } + } + + [RequiresAnyPermission("ThePermission", "ThePermission2")] + public class RequiresAnyPermissionRequest : IReturn<RequiresAnyPermissionRequest> + { + public List<string> Permissions { get; set; } + + public RequiresAnyPermissionRequest() + { + Permissions = new List<string>(); + } + } + + public class RequiresRolesAndPermissionsOnRequestService : Service + { + public object Any(RequiresAuthRequest request) + { + return request; + } + + public object Any(RequiresRoleRequest request) + { + return request; + } + + public object Any(RequiresAnyRoleRequest request) + { + return request; + } + + public object Any(RequiresPermissionRequest request) + { + return request; + } + + public object Any(RequiresAnyPermissionRequest request) + { + return request; + } + + [RequiredRole("TheRole")] + public object Any(RequiresRoleAction request) + { + return request; + } + + [Authenticate] + public object Any(RequiresAuthAction request) + { + return request; + } + } + public class SecureService : Service { public object Any(Secure request) @@ -39,11 +141,16 @@ public object Any(Secure request) throw new UnauthorizedAccessException("You shouldn't be able to see this"); } - public object Any(RequiresRole request) + public object Any(RequiresRoleInService request) { RequiredRoleAttribute.AssertRequiredRoles(Request, request.Role ?? RoleNames.Admin); return request; } + + public object Any(TestAuth request) + { + return request; + } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/SessionTest.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/SessionTest.cs new file mode 100644 index 00000000000..4da7efd5fa0 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/SessionTest.cs @@ -0,0 +1,25 @@ +using System.Web; + +namespace ServiceStack.WebHost.IntegrationTests.Services +{ + [Route("/session/test")] + public class SessionTest + { + public string Result { get; set; } + } + + public class SessionTestServices : ServiceStack.Service + { + public object Any(SessionTest request) + { + SessionBag["ss-test"] = "bar"; + + var sessions = HttpContext.Current.Session; + var aspNetReq = base.Request.OriginalRequest as HttpRequestBase; + var test = aspNetReq.RequestContext.HttpContext.Items["test"]; + return new SessionTest { + Result = test as string + }; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/SwaggerTestService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/SwaggerTestService.cs index 7b95f707446..933ce51267b 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/SwaggerTestService.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/SwaggerTestService.cs @@ -1,6 +1,10 @@ -using System.Drawing; +using System; +using System.Collections.Generic; +using System.Drawing; using System.Net; using System.Runtime.Serialization; +using System.Security.Policy; +using ServiceStack.DataAnnotations; namespace ServiceStack.WebHost.IntegrationTests.Services { @@ -11,6 +15,16 @@ public enum MyColor Blue } + public enum MyColorDesc + { + [Description("The color Red")] + Red = 10, + [Description("The color Green")] + Green = 20, + [Description("The color Blue")] + Blue = 30, + } + [Api("SwaggerTest Service Description")] [ApiResponse(HttpStatusCode.BadRequest, "Your request was not understood")] [ApiResponse(HttpStatusCode.InternalServerError, "Oops, something broke")] @@ -22,25 +36,38 @@ public class SwaggerTest { [ApiMember(Description = "Color Description", ParameterType = "path", DataType = "string", IsRequired = true)] - [ApiAllowableValues("ColorName", typeof(MyColor))] //Enum + [ApiAllowableValues("Name", typeof(MyColor))] //Enum [DataMember] - public string ColorName { get; set; } + public string Name { get; set; } [ApiMember] [ApiAllowableValues("Color", typeof(MyColor))] //Enum [DataMember] public MyColor Color { get; set; } + [ApiMember] + [ApiAllowableValues("ColorDesc", typeof(MyColorDesc))] //Enum + [DataMember] + public MyColorDesc ColorDesc { get; set; } + [ApiMember(Description = "Aliased Description", DataType = "string", IsRequired = true)] [DataMember(Name = "Aliased")] - public string Name { get; set; } + public string Original { get; set; } [ApiMember(Description = "Not Aliased Description", DataType = "string", IsRequired = true)] [DataMember] public string NotAliased { get; set; } + [ApiMember(Description = "Format as password", DataType = "password")] + [DataMember] + public string Password { get; set; } + + [DataMember] + [ApiMember(IsRequired = false, AllowMultiple = true)] + public DateTime[] MyDateBetween { get; set; } + [ApiMember(Description = "Nested model 1", DataType = "SwaggerNestedModel")] [DataMember] public SwaggerNestedModel NestedModel1 { get; set; } @@ -70,11 +97,232 @@ public class SwaggerNestedModel2 public int TestRange { get; set; } } + public enum MyEnum { A, B, C } + + [Route("/swaggertest2", "POST")] + public class SwaggerTest2 + { + [ApiMember] + [ApiAllowableValues("MyEnumProperty", typeof(MyEnum))] + public MyEnum MyEnumProperty { get; set; } + + [IgnoreDataMember] + public string Ignored { get; set; } + + [ApiMember( + Name = "Token", + ParameterType = "header", + DataType = "string", + IsRequired = true)] + public string Token { get; set; } + } + + [Route("/swagger-complex", "POST")] + public class SwaggerComplex : IReturn<SwaggerComplexResponse> + { + [ApiMember] + [DataMember] + [Description("IsRequired Description")] + public bool IsRequired { get; set; } + + [ApiMember(IsRequired = true)] + [DataMember] + public string[] ArrayString { get; set; } + + [ApiMember] + [DataMember] + public int[] ArrayInt { get; set; } + + [ApiMember] + [DataMember] + public List<string> ListString { get; set; } + + [ApiMember] + [DataMember] + public List<int> ListInt { get; set; } + + [ApiMember] + [DataMember] + public Dictionary<string, string> DictionaryString { get; set; } + } + + public class SwaggerComplexResponse + { + [ApiMember] + [DataMember] + public bool IsRequired { get; set; } + + [ApiMember(IsRequired = true)] + [DataMember] + public string[] ArrayString { get; set; } + + [ApiMember] + [DataMember] + public int[] ArrayInt { get; set; } + + [ApiMember] + [DataMember] + public List<string> ListString { get; set; } + + [ApiMember] + [DataMember] + public List<int> ListInt { get; set; } + + [ApiMember] + [DataMember] + public Dictionary<string, string> DictionaryString { get; set; } + } + + [Route("/swaggerpost/{Required1}", Verbs = "GET")] + [Route("/swaggerpost/{Required1}/{Optional1}", Verbs = "GET")] + [Route("/swaggerpost", Verbs = "POST")] + public class SwaggerPostTest : IReturn<HelloResponse> + { + [ApiMember(Verb = "POST")] + [ApiMember(Route = "/swaggerpost/{Required1}", Verb = "GET", ParameterType = "path")] + [ApiMember(Route = "/swaggerpost/{Required1}/{Optional1}", Verb = "GET", ParameterType = "path")] + public string Required1 { get; set; } + + [ApiMember(Verb = "POST")] + [ApiMember(Route = "/swaggerpost/{Required1}/{Optional1}", Verb = "GET", ParameterType = "path")] + public string Optional1 { get; set; } + } + + [Route("/swaggerpost2/{Required1}/{Required2}", Verbs = "GET")] + [Route("/swaggerpost2/{Required1}/{Required2}/{Optional1}", Verbs = "GET")] + [Route("/swaggerpost2", Verbs = "POST")] + public class SwaggerPostTest2 : IReturn<HelloResponse> + { + [ApiMember(Route = "/swaggerpost2/{Required1}/{Required2}", Verb = "GET", ParameterType = "path")] + [ApiMember(Route = "/swaggerpost2/{Required1}/{Required2}/{Optional1}", Verb = "GET", ParameterType = "path")] + public string Required1 { get; set; } + + [ApiMember(Route = "/swaggerpost2/{Required1}/{Required2}", Verb = "GET", ParameterType = "path")] + [ApiMember(Route = "/swaggerpost2/{Required1}/{Required2}/{Optional1}", Verb = "GET", ParameterType = "path")] + public string Required2 { get; set; } + + [ApiMember(Route = "/swaggerpost2/{Required1}/{Required2}/{Optional1}", Verb = "GET", ParameterType = "path")] + public string Optional1 { get; set; } + } + + [Api("Api GET All")] + [Route("/swaggerexamples", "GET")] + public class GetSwaggerExamples : IReturn<GetSwaggerExamples> + { + public string Get { get; set; } + } + + [Api("Api POST")] + [Route("/swaggerexamples", "POST")] + public class PostSwaggerExamples : IReturn<PostSwaggerExamples> + { + public string Post { get; set; } + } + + [Api("Api GET Id")] + [Route("/swaggerexamples/{Id}", "GET")] + public class GetSwaggerExample : IReturn<GetSwaggerExample> + { + public int Id { get; set; } + public string Get { get; set; } + } + + [Api("Api PUT Id")] + [Route("/swaggerexamples/{Id}", "PUT")] + public class PutSwaggerExample : IReturn<PutSwaggerExample> + { + public int Id { get; set; } + public string Get { get; set; } + } + + [Route("/lists", "GET")] + public class GetLists : IReturn<GetLists> + { + public string Id { get; set; } + } + + [Route("/lists", "POST")] + [Exclude(Feature.Metadata)] + public class CreateList : IReturn<CreateList> + { + public string Id { get; set; } + } + + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] + public sealed class CustomApiResponseAttribute : ApiResponseAttribute + { + private static int errCode = 402; + + public CustomApiResponseAttribute() + : base(++errCode, Guid.NewGuid().ToString()) {} + } + + [ApiResponse(400, "Code 1")] + [CustomApiResponse()] + [ApiResponse(402, "Code 2")] + [CustomApiResponse()] + [CustomApiResponse()] + [ApiResponse(401, "Code 3")] + [Route("/swagger/multiattrtest", Verbs = "POST", Summary = "Sample request")] + public sealed class SwaggerMultiApiResponseTest : IReturnVoid {} + public class SwaggerTestService : Service { - public object Get(SwaggerTest request) + public object Any(SwaggerTest request) + { + return request; + } + + public object Post(SwaggerTest2 request) { return request; } + + public object Post(SwaggerComplex request) + { + return request.ConvertTo<SwaggerComplexResponse>(); + } + + public object Any(SwaggerPostTest request) + { + return new HelloResponse { Result = request.Required1 }; + } + + public object Any(SwaggerPostTest2 request) + { + return new HelloResponse { Result = request.Required1 }; + } + + public object Any(GetSwaggerExamples request) + { + return request; + } + + public object Any(GetSwaggerExample request) + { + return request; + } + + public object Any(PostSwaggerExamples request) + { + return request; + } + + public object Any(PutSwaggerExample request) + { + return request; + } + + public object Any(GetLists request) + { + return request; + } + + public object Any(CreateList request) + { + return request; + } + + public object Any(SwaggerMultiApiResponseTest request) => request; } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/TemplateService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/TemplateService.cs new file mode 100644 index 00000000000..c584d4f7f00 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/TemplateService.cs @@ -0,0 +1,53 @@ +namespace ServiceStack.WebHost.IntegrationTests.Services +{ + [Route("/templates", "POST")] + public class PostTemplateRequest : IReturn<PostTemplateResponse> + { + public string Template { get; set; } + } + + public class PostTemplateResponse + { + public string PostResult { get; set; } + } + + [Route("/templates", "GET")] + public class GetTemplatesRequest : IReturn<GetTemplatesResponse> + { + public string Name { get; set; } + } + + public class GetTemplatesResponse + { + public string GetResult { get; set; } + } + + [Route("/templates/{Name}", "GET")] + public class GetTemplateRequest : IReturn<GetTemplateResponse> + { + public string Name { get; set; } + } + + public class GetTemplateResponse + { + public string GetSingleResult { get; set; } + } + + public class TemplateService : Service + { + public object Post(PostTemplateRequest request) + { + return new PostTemplateResponse { PostResult = request.Template }; + } + + public object Get(GetTemplatesRequest request) + { + return new GetTemplatesResponse { GetResult = request.Name }; + } + + public object Get(GetTemplateRequest request) + { + return new GetTemplateResponse { GetSingleResult = request.Name }; + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/TestProgressService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/TestProgressService.cs index 011eda9d87b..bc504f5d7e4 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Services/TestProgressService.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/TestProgressService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Services/VerbOnlyService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Services/VerbOnlyService.cs new file mode 100644 index 00000000000..93753c135b0 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/Services/VerbOnlyService.cs @@ -0,0 +1,41 @@ +namespace ServiceStack.WebHost.IntegrationTests.Services +{ + [Route("/verbonly/post", "POST")] + public class PostOnly : IReturn<PostOnly> + { + public string Id { get; set; } + } + + [Route("/verbonly/put", "PUT")] + public class PutOnly : IReturn<PutOnly> + { + public string Id { get; set; } + } + + [Route("/verbonly/patch", "PATCH")] + public class PatchOnly : IReturn<PatchOnly> + { + public string Id { get; set; } + } + + [Route("/verbonly/get", "GET")] + public class GetOnly : IReturn<GetOnly> + { + public string Id { get; set; } + } + + [Route("/verbonly/delete", "DELETE")] + public class DeleteOnly : IReturn<DeleteOnly> + { + public string Id { get; set; } + } + + public class VerbOnlyService : Service + { + public object Any(PostOnly request) => request; + public object Any(PutOnly request) => request; + public object Any(PatchOnly request) => request; + public object Any(GetOnly request) => request; + public object Any(DeleteOnly request) => request; + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Shared/IocService.cs b/tests/ServiceStack.WebHost.IntegrationTests/Shared/IocService.cs index 0dc562353cd..520fd5c0a5d 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Shared/IocService.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Shared/IocService.cs @@ -3,15 +3,16 @@ using System.Threading.Tasks; using Funq; using ServiceStack.Configuration; +using ServiceStack.DataAnnotations; using ServiceStack.Web; namespace ServiceStack.Shared.Tests { public static class IocShared { - public static void Configure(ServiceStackHost appHost) - { - var container = appHost.Container; + public static void Configure(ServiceStackHost appHost) + { + var container = appHost.Container; container.Adapter = new IocAdapter(); container.Register(c => new FunqDepCtor()); @@ -21,6 +22,7 @@ public static void Configure(ServiceStackHost appHost) container.Register(c => new FunqSingletonScope()).ReusedWithin(ReuseScope.Default); container.Register(c => new FunqRequestScope()).ReusedWithin(ReuseScope.Request); container.Register(c => new FunqNoneScope()).ReusedWithin(ReuseScope.None); + container.Register(c => new FunqInjectRequest()).ReusedWithin(ReuseScope.None); container.Register(c => new FunqRequestScopeDepDisposableProperty()).ReusedWithin(ReuseScope.Request); container.Register(c => new FunqSingletonScopeDisposable()).ReusedWithin(ReuseScope.Default); @@ -81,6 +83,23 @@ public class FunqNoneScope public FunqNoneScope() { Count++; } } + public class FunqInjectRequest : IRequiresRequest + { + public FunqInjectRequest() + { + this.SecondLevel = new FunqInjectRequest2(); + } + + public IRequest Request { get; set; } + + public FunqInjectRequest2 SecondLevel { get; set; } + } + + public class FunqInjectRequest2 : IRequiresRequest + { + public IRequest Request { get; set; } + } + public class FunqRequestScopeDisposable : IDisposable { public static int Count = 0; @@ -169,6 +188,7 @@ public IocResponse() } + [Exclude(Feature.Metadata)] [Route("/action-attr")] public class ActionAttr : IReturn<IocResponse> { } @@ -188,9 +208,9 @@ public override void Execute(IRequest req, IResponse res, object requestDto) var response = new IocResponse(); var deps = new object[] { - FunqDepProperty, FunqDepDisposableProperty, - AltDepProperty, AltDepDisposableProperty - }; + FunqDepProperty, FunqDepDisposableProperty, + AltDepProperty, AltDepDisposableProperty + }; foreach (var dep in deps) { @@ -281,10 +301,10 @@ public object Any(Ioc request) var response = new IocResponse(); var deps = new object[] { - funqDepCtor, altDepCtor, - FunqDepProperty, FunqDepDisposableProperty, - AltDepProperty, AltDepDisposableProperty - }; + funqDepCtor, altDepCtor, + FunqDepProperty, FunqDepDisposableProperty, + AltDepProperty, AltDepDisposableProperty + }; foreach (var dep in deps) { @@ -315,7 +335,7 @@ public async Task<IocResponse> Any(ActionAttrAsync request) await Task.Delay(10); return Request.Items["action-attr"] as IocResponse; } - + public static int DisposeCount = 0; public static bool ThrowErrors = false; @@ -347,6 +367,8 @@ public IocScopeResponse() public Dictionary<string, int> Results { get; set; } + public int InjectsRequest { get; set; } + public ResponseStatus ResponseStatus { get; set; } } @@ -364,10 +386,7 @@ public void RequestFilter(IRequest req, IResponse res, object requestDto) { } - public IHasRequestFilter Copy() - { - return (IHasRequestFilter)this.MemberwiseClone(); - } + public IRequestFilterBase Copy() => (IRequestFilterBase)this.MemberwiseClone(); } [IocRequestFilter] @@ -376,6 +395,7 @@ public class IocScopeService : IService, IDisposable public FunqRequestScope FunqRequestScope { get; set; } public FunqSingletonScope FunqSingletonScope { get; set; } public FunqNoneScope FunqNoneScope { get; set; } + public FunqInjectRequest FunqInjectRequest { get; set; } public FunqRequestScopeDepDisposableProperty FunqRequestScopeDepDisposableProperty { get; set; } public AltRequestScopeDepDisposableProperty AltRequestScopeDepDisposableProperty { get; set; } @@ -384,12 +404,16 @@ public object Any(IocScope request) if (request.Throw) throw new Exception("Exception requested by user"); - var response = new IocScopeResponse { + var response = new IocScopeResponse + { Results = { { typeof(FunqSingletonScope).Name, FunqSingletonScope.Count }, { typeof(FunqRequestScope).Name, FunqRequestScope.Count }, { typeof(FunqNoneScope).Name, FunqNoneScope.Count }, - }, + }, + InjectsRequest = FunqInjectRequest.Request != null + ? 1 + (FunqInjectRequest.SecondLevel.Request != null ? 1 : 0) + : 0, }; return response; @@ -407,7 +431,7 @@ public async Task<object> Any(IocScopeAsync request) public void Dispose() { DisposedCount++; - } + } } public class IocDispose : IReturn<IocDisposeResponse> diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Templates/OperationControl.html b/tests/ServiceStack.WebHost.IntegrationTests/Templates/OperationControl.html index 17d50d6cd41..8fac12e2d0c 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Templates/OperationControl.html +++ b/tests/ServiceStack.WebHost.IntegrationTests/Templates/OperationControl.html @@ -6,7 +6,7 @@ body { background-color:white; color:#000000; - font-family: "Helvetica Neue", Helvetica, Verdana, Arial; + font-family: "Helvetica Neue", Helvetica, Verdana, Arial,serif; margin: 0; font-size: 13px; } @@ -19,6 +19,16 @@ background-repeat: no-repeat; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAeCAYAAABe3VzdAAAKQWlDQ1BJQ0MgUHJvZmlsZQAASA2dlndUU9kWh8+9N73QEiIgJfQaegkg0jtIFQRRiUmAUAKGhCZ2RAVGFBEpVmRUwAFHhyJjRRQLg4Ji1wnyEFDGwVFEReXdjGsJ7601896a/cdZ39nnt9fZZ+9917oAUPyCBMJ0WAGANKFYFO7rwVwSE8vE9wIYEAEOWAHA4WZmBEf4RALU/L09mZmoSMaz9u4ugGS72yy/UCZz1v9/kSI3QyQGAApF1TY8fiYX5QKUU7PFGTL/BMr0lSkyhjEyFqEJoqwi48SvbPan5iu7yZiXJuShGlnOGbw0noy7UN6aJeGjjAShXJgl4GejfAdlvVRJmgDl9yjT0/icTAAwFJlfzOcmoWyJMkUUGe6J8gIACJTEObxyDov5OWieAHimZ+SKBIlJYqYR15hp5ejIZvrxs1P5YjErlMNN4Yh4TM/0tAyOMBeAr2+WRQElWW2ZaJHtrRzt7VnW5mj5v9nfHn5T/T3IevtV8Sbsz55BjJ5Z32zsrC+9FgD2JFqbHbO+lVUAtG0GQOXhrE/vIADyBQC03pzzHoZsXpLE4gwnC4vs7GxzAZ9rLivoN/ufgm/Kv4Y595nL7vtWO6YXP4EjSRUzZUXlpqemS0TMzAwOl89k/fcQ/+PAOWnNycMsnJ/AF/GF6FVR6JQJhIlou4U8gViQLmQKhH/V4X8YNicHGX6daxRodV8AfYU5ULhJB8hvPQBDIwMkbj96An3rWxAxCsi+vGitka9zjzJ6/uf6Hwtcim7hTEEiU+b2DI9kciWiLBmj34RswQISkAd0oAo0gS4wAixgDRyAM3AD3iAAhIBIEAOWAy5IAmlABLJBPtgACkEx2AF2g2pwANSBetAEToI2cAZcBFfADXALDIBHQAqGwUswAd6BaQiC8BAVokGqkBakD5lC1hAbWgh5Q0FQOBQDxUOJkBCSQPnQJqgYKoOqoUNQPfQjdBq6CF2D+qAH0CA0Bv0BfYQRmALTYQ3YALaA2bA7HAhHwsvgRHgVnAcXwNvhSrgWPg63whfhG/AALIVfwpMIQMgIA9FGWAgb8URCkFgkAREha5EipAKpRZqQDqQbuY1IkXHkAwaHoWGYGBbGGeOHWYzhYlZh1mJKMNWYY5hWTBfmNmYQM4H5gqVi1bGmWCesP3YJNhGbjS3EVmCPYFuwl7ED2GHsOxwOx8AZ4hxwfrgYXDJuNa4Etw/XjLuA68MN4SbxeLwq3hTvgg/Bc/BifCG+Cn8cfx7fjx/GvyeQCVoEa4IPIZYgJGwkVBAaCOcI/YQRwjRRgahPdCKGEHnEXGIpsY7YQbxJHCZOkxRJhiQXUiQpmbSBVElqIl0mPSa9IZPJOmRHchhZQF5PriSfIF8lD5I/UJQoJhRPShxFQtlOOUq5QHlAeUOlUg2obtRYqpi6nVpPvUR9Sn0vR5Mzl/OX48mtk6uRa5Xrl3slT5TXl3eXXy6fJ18hf0r+pvy4AlHBQMFTgaOwVqFG4bTCPYVJRZqilWKIYppiiWKD4jXFUSW8koGStxJPqUDpsNIlpSEaQtOledK4tE20Otpl2jAdRzek+9OT6cX0H+i99AllJWVb5SjlHOUa5bPKUgbCMGD4M1IZpYyTjLuMj/M05rnP48/bNq9pXv+8KZX5Km4qfJUilWaVAZWPqkxVb9UU1Z2qbapP1DBqJmphatlq+9Uuq43Pp893ns+dXzT/5PyH6rC6iXq4+mr1w+o96pMamhq+GhkaVRqXNMY1GZpumsma5ZrnNMe0aFoLtQRa5VrntV4wlZnuzFRmJbOLOaGtru2nLdE+pN2rPa1jqLNYZ6NOs84TXZIuWzdBt1y3U3dCT0svWC9fr1HvoT5Rn62fpL9Hv1t/ysDQINpgi0GbwaihiqG/YZ5ho+FjI6qRq9Eqo1qjO8Y4Y7ZxivE+41smsImdSZJJjclNU9jU3lRgus+0zwxr5mgmNKs1u8eisNxZWaxG1qA5wzzIfKN5m/krCz2LWIudFt0WXyztLFMt6ywfWSlZBVhttOqw+sPaxJprXWN9x4Zq42Ozzqbd5rWtqS3fdr/tfTuaXbDdFrtOu8/2DvYi+yb7MQc9h3iHvQ732HR2KLuEfdUR6+jhuM7xjOMHJ3snsdNJp9+dWc4pzg3OowsMF/AX1C0YctFx4bgccpEuZC6MX3hwodRV25XjWuv6zE3Xjed2xG3E3dg92f24+ysPSw+RR4vHlKeT5xrPC16Il69XkVevt5L3Yu9q76c+Oj6JPo0+E752vqt9L/hh/QL9dvrd89fw5/rX+08EOASsCegKpARGBFYHPgsyCRIFdQTDwQHBu4IfL9JfJFzUFgJC/EN2hTwJNQxdFfpzGC4sNKwm7Hm4VXh+eHcELWJFREPEu0iPyNLIR4uNFksWd0bJR8VF1UdNRXtFl0VLl1gsWbPkRoxajCCmPRYfGxV7JHZyqffS3UuH4+ziCuPuLjNclrPs2nK15anLz66QX8FZcSoeGx8d3xD/iRPCqeVMrvRfuXflBNeTu4f7kufGK+eN8V34ZfyRBJeEsoTRRJfEXYljSa5JFUnjAk9BteB1sl/ygeSplJCUoykzqdGpzWmEtPi000IlYYqwK10zPSe9L8M0ozBDuspp1e5VE6JA0ZFMKHNZZruYjv5M9UiMJJslg1kLs2qy3mdHZZ/KUcwR5vTkmuRuyx3J88n7fjVmNXd1Z752/ob8wTXuaw6thdauXNu5Tnddwbrh9b7rj20gbUjZ8MtGy41lG99uit7UUaBRsL5gaLPv5sZCuUJR4b0tzlsObMVsFWzt3WazrWrblyJe0fViy+KK4k8l3JLr31l9V/ndzPaE7b2l9qX7d+B2CHfc3em681iZYlle2dCu4F2t5czyovK3u1fsvlZhW3FgD2mPZI+0MqiyvUqvakfVp+qk6oEaj5rmvep7t+2d2sfb17/fbX/TAY0DxQc+HhQcvH/I91BrrUFtxWHc4azDz+ui6rq/Z39ff0TtSPGRz0eFR6XHwo911TvU1zeoN5Q2wo2SxrHjccdv/eD1Q3sTq+lQM6O5+AQ4ITnx4sf4H++eDDzZeYp9qukn/Z/2ttBailqh1tzWibakNml7THvf6YDTnR3OHS0/m/989Iz2mZqzymdLz5HOFZybOZ93fvJCxoXxi4kXhzpXdD66tOTSna6wrt7LgZevXvG5cqnbvfv8VZerZ645XTt9nX297Yb9jdYeu56WX+x+aem172296XCz/ZbjrY6+BX3n+l37L972un3ljv+dGwOLBvruLr57/17cPel93v3RB6kPXj/Mejj9aP1j7OOiJwpPKp6qP6391fjXZqm99Oyg12DPs4hnj4a4Qy//lfmvT8MFz6nPK0a0RupHrUfPjPmM3Xqx9MXwy4yX0+OFvyn+tveV0auffnf7vWdiycTwa9HrmT9K3qi+OfrW9m3nZOjk03dp76anit6rvj/2gf2h+2P0x5Hp7E/4T5WfjT93fAn88ngmbWbm3/eE8/syOll+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAE3mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS4xLjIiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjE8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjU8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjcyPC90aWZmOlhSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj43MjwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjQwPC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6Q29sb3JTcGFjZT4xPC9leGlmOkNvbG9yU3BhY2U+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj4zMDwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgogICAgICAgICA8ZGM6c3ViamVjdD4KICAgICAgICAgICAgPHJkZjpCYWcvPgogICAgICAgICA8L2RjOnN1YmplY3Q+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iPgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxMy0xMC0xMFQxOToxMDo0MzwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAyLjIuMTwveG1wOkNyZWF0b3JUb29sPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KIdC6QgAABLJJREFUWAm9WGtMW2UYfnoZYAsMaMe1UKBQKLeOy0BwEG4DI2FmC2aiWYg/zCQmXpLNzWxRExH8o1vMosbExMw//jH+8Ycxmjnc5uamU5lcOkDAXSy3ljIK0tL6vSdp08I5p6cN8iak3+W9POf9vvfyISupafYAkLE/UUrYHQ/H8kN4PMS+cyRnpkKCIzi7dinxydl+HOvphtGQu1MIvYpkXc5bUqw5nauIjo5C18En0NZUj4baarhcbkzfvce86pWiIhIemWSApN0yMYnWpv1QxcQgPi4W1ZVmbi5jhzA1cxfujY1IQIjKhAWQPBWnVqO40OhXSmDLy4rR3FAH25ID03/f8+9txyAsgGTQOjePzvYWyGTBV1f1SAzq9lXAXGzCxPQM7AzsdlDYAFecTlTtLYUmKZHX/h6tBm2N++F2uTB6Z5KXJ5xFiuKwaWRsXFRGoVCgp7sLb596FUmJu0V5Q21GBHB0XJpnykpM+KD/TRTmR56WIgI4OTUT6sP9+/Hxceg7fRx11ZX+tXAGYd9BUu5yu1BUkIdkrVaSLTryx2oq4Vxdw5hE7/sUiwKMiY4GpWCvNzgRb7B89/3gVQwNW5CTrUNiQuh7RlFfwdJRuCBFASqUCrxz+gRa6uuQnp7KlK9i0Wb3fRxm5xfw7cUfsbBoR2FeLqs00f49oQGBtC0tYfyvaSGWoHVRgOSpoeFRHD1yGKUmI9qbGri7pFTI8cA6i/V1F/MuMDE1je8GryAtJQWZGWlBBvgmVXvLcP8fq6SkLgqQlD9ccSIuNtYfidTVVJpLcfDxVugzM0B50To7j3/X13H52g3MLdpgZtGrVCr5sHFrdNxV5WX45dYfXPURZGQbIQGS8P0HVg5QoCIF86Jel4Hm+loUmwq4I1tyLIMi/PrNW9xHxKpVgSJBYwqcCnMJLl7+iTuJoM2AiSSA5CVKE+Q9PkrZo0V7SwO3b2FROrewiEtXf2aRng+thr/ikB61SoXc7ExcunKdTy23JgkgcRoNOcjVZwoqkrNjI54DrBVbXVvD8Ngd/MC8k5ejR3pqiqBcWkoyq9ssaCb5g0ZyorbZlwSNBG7Ex6rR+9yzOPVyL+TsGgyc+wi/3x4JZNky7nm6S7C2Swa4ORdusbJpoXZfOd594yToHva9fx4jFuH6TZ0QfRQfSQaYlJjAJy+6ZsjOwnt9Z6BLS0X/2Q9ZvrQJ8ldXmEG1ezNJBpit122WlTTXsA8jT1JKGjj3Mdxu4a776FNPbtEpCSD1fgZ91hZhqQv0lnntpRdgdzjw2RdfCooV5Bm4/BjIIAlgx4HGQJmIxhQ8r7/Sy0rjICZEytyRQx1B+kMCpLvX2d4aJBTphO7ksZ5ncP7Tz7Eh8L4uYE/anIB0JgpQyZqFk+xo6Ii2i1rY44ryqVhypmetjwQBRkVF4fiLz8NkNPh4t+23+3Anvvr6my1tnM9AY10NyD4RL8BM1loNnDkRcRfsMyT0q9UksWPMwrWbv/GyqFnuNJcUcnv+lkMul6PImI+m+ke5N66Czf9POtTRhgssoimh81FFWQlu/DrkkbF/HnmpCUhPTYaKFe+dpD9HLOzRX8Rr0rG84rk9Mib/D4GIYiVUxZizAAAAAElFTkSuQmCC); } + .icons { + display: block; + float: right; + } + .auth { + display: block; + width: 17px; + height: 17px; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAIAAAC0D9CtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuNWWFMmUAAADsSURBVDhPY/hPOsCr58Pi/w9s/t/k+X9P5//zjP+/X0OEcet5lvL/BgMKui3z/+d9oAwOPR9Xo6h+VfP/cQCI8dABKIlDD0QFBN0zAIn8eg7l/riNQ88dBYSeGyz/37T/f5YA5X5cjUMP0OkIPajo22lsel4UoKuDo1si//9+x9AD1IBHDzBs0MMAogEt0CDopsD/j8shqpD0IDSwIJS+bgbF7LfTQCdBlSH0oGl4VQ9CMIPRAFgPsgZgSgEGK17AgK4BmMAIAbCj33RDnUTIBggA2wPxLtCSr4ehwngB2D/A1ApEsKROAPz/DwCLE/At7aBI3gAAAABJRU5ErkJggg==); + } h1 { color: #FFF; font-size: 26px; @@ -132,7 +142,7 @@ .example pre { background-color: #E5E5CC; border: 1px solid #F0F0E0; - font-family: Courier New; + font-family: Courier New,monospace; font-size: 15px; padding: 5px; margin-right: 15px; diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AppHostBaseTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AppHostBaseTests.cs index 9696893c9a3..922f67ede89 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AppHostBaseTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AppHostBaseTests.cs @@ -3,38 +3,38 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class AppHostBaseTests - { + [TestFixture] + public class AppHostBaseTests + { private const string BasePath = Config.AbsoluteBaseUri; - [Test] - public void Can_download_metadata_page() - { + [Test] + public void Can_download_metadata_page() + { var html = Config.ServiceStackBaseUri.CombineWith("metadata").GetStringFromUrl(); - Assert.That(html.Contains("The following operations are supported.")); - } + Assert.That(html.Contains("The following operations are supported.")); + } - [Test] - public void Can_download_webpage_html_page() - { + [Test] + public void Can_download_webpage_html_page() + { var html = (BasePath + "webpage.html").GetStringFromUrl(); - Assert.That(html.Contains("Default index ServiceStack.WebHost.Endpoints.Tests page")); - } + Assert.That(html.Contains("Default index ServiceStack.WebHost.Endpoints.Tests page")); + } - [Test] - public void Gets_404_on_non_existant_page() - { - var webRes = (BasePath + "nonexistant.html").GetErrorResponse(); - Assert.That(webRes.StatusCode, Is.EqualTo(HttpStatusCode.NotFound)); - } + [Test] + public void Gets_404_on_non_existent_page() + { + var webRes = (BasePath + "nonexistant.html").GetErrorResponse(); + Assert.That(webRes.StatusCode, Is.EqualTo(HttpStatusCode.NotFound)); + } - [Test] - public void Gets_403_on_page_with_non_whitelisted_extension() - { - var webRes = (BasePath + "api/webpage.forbidden").GetErrorResponse(); - Assert.That(webRes.StatusCode, Is.EqualTo(HttpStatusCode.Forbidden)); - } + [Test] + public void Gets_403_on_page_with_non_whitelisted_extension() + { + var webRes = (BasePath + "api/webpage.forbidden").GetErrorResponse(); + Assert.That(webRes.StatusCode, Is.EqualTo(HttpStatusCode.Forbidden)); + } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AssertValidAccessTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AssertValidAccessTests.cs index fcda1e8ebff..bb409855dfe 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AssertValidAccessTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AssertValidAccessTests.cs @@ -8,246 +8,254 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class AssertValidAccessTests : AuthTestsBase - { - protected Register register; - - [TestFixtureSetUp] - public void TestFixtureSetUp() - { + [TestFixture] + public class AssertValidAccessTests : AuthTestsBase + { + protected Register register; + + [OneTimeSetUp] + public void TestFixtureSetUp() + { Tracer.Instance = new Tracer.ConsoleTracer(); - register = CreateAdminUser(); - } + register = CreateAdminUser(); + } - [TestFixtureTearDown] + [OneTimeTearDown] public void TestFixtureTearDown() { Tracer.Instance = new Tracer.NullTracer(); } - public string RoleName1 = "Role1"; - public string RoleName2 = "Role2"; - public const string ContentManager = "ContentManager"; - public const string ContentPermission = "ContentPermission"; + public string RoleName1 = "Role1"; + public string RoleName2 = "Role2"; + public const string ContentManager = "ContentManager"; + public const string ContentPermission = "ContentPermission"; + + public string Permission1 = "Permission1"; + public string Permission2 = "Permission2"; + + public Register RegisterNewUser(bool? autoLogin = null) + { + var userId = Environment.TickCount % 10000; + + var newUserRegistration = new Register + { + UserName = "UserName" + userId, + DisplayName = "DisplayName" + userId, + Email = "user{0}@sf.com".Fmt(userId), + FirstName = "FirstName" + userId, + LastName = "LastName" + userId, + Password = "Password" + userId, + AutoLogin = autoLogin, + }; + + ServiceClient.Send(newUserRegistration); + + return newUserRegistration; + } + + [Test] + public void Authenticating_does_return_session_cookies() + { + var client = AuthenticateWithAdminUser(); + Assert.That(client.CookieContainer.Count, Is.GreaterThan(0)); + } + + [Test] + public void Cannot_assign_roles_with_normal_user() + { + var newUser = RegisterNewUser(autoLogin: true); + + try + { + var response = ServiceClient.Send( + new AssignRoles + { + UserName = newUser.UserName, + Roles = { RoleName1, RoleName2 }, + Permissions = { Permission1, Permission2 } + }); + + Assert.Fail("Should not be allowed"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + //StatusDescription is ignored in WebDevServer + //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Role")); + } + } + + [Test] + public void Can_Assign_Roles_and_Permissions_to_new_User() + { + var newUser = RegisterNewUser(); + + var client = AuthenticateWithAdminUser(); + + var response = client.Send( + new AssignRoles + { + UserName = newUser.UserName, + Roles = { RoleName1, RoleName2 }, + Permissions = { Permission1, Permission2 } + }); + + Console.WriteLine("Assigned Roles: " + response.Dump()); + + Assert.That(response.AllRoles, Is.EquivalentTo(new[] { RoleName1, RoleName2 })); + Assert.That(response.AllPermissions, Is.EquivalentTo(new[] { Permission1, Permission2 })); + } + + [Test] + public void Can_UnAssign_Roles_and_Permissions_to_new_User() + { + var newUser = RegisterNewUser(); + + var client = AuthenticateWithAdminUser(); + + client.Send( + new AssignRoles + { + UserName = newUser.UserName, + Roles = new List<string> { RoleName1, RoleName2 }, + Permissions = new List<string> { Permission1, Permission2 } + }); + + var response = client.Send( + new UnAssignRoles + { + UserName = newUser.UserName, + Roles = { RoleName1 }, + Permissions = { Permission2 }, + }); + + Console.WriteLine("Remaining Roles: " + response.Dump()); + + Assert.That(response.AllRoles, Is.EquivalentTo(new[] { RoleName2 })); + Assert.That(response.AllPermissions, Is.EquivalentTo(new[] { Permission1 })); + } + + [Test] + public void Can_only_access_ContentManagerOnlyService_service_after_Assigned_Role() + { + var newUser = RegisterNewUser(autoLogin: true); + + try + { + ServiceClient.Send(new ContentManagerOnly()); + Assert.Fail("Should not be allowed - no roles"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + //StatusDescription is ignored in WebDevServer + //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Role")); + } + + var client = AuthenticateWithAdminUser(); - public string Permission1 = "Permission1"; - public string Permission2 = "Permission2"; + client.Send( + new AssignRoles + { + UserName = newUser.UserName, + Roles = new List<string> { RoleName1 }, + }); - public Register RegisterNewUser(bool? autoLogin = null) - { - var userId = Environment.TickCount % 10000; + var newUserClient = Login(newUser.UserName, newUser.Password); - var newUserRegistration = new Register { - UserName = "UserName" + userId, - DisplayName = "DisplayName" + userId, - Email = "user{0}@sf.com".Fmt(userId), - FirstName = "FirstName" + userId, - LastName = "LastName" + userId, - Password = "Password" + userId, - AutoLogin = autoLogin, - }; + try + { + newUserClient.Send(new ContentManagerOnly()); + Assert.Fail("Should not be allowed - wrong roles"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + //StatusDescription is ignored in WebDevServer + //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Role")); + } + + var assignResponse = client.Send( + new AssignRoles + { + UserName = newUser.UserName, + Roles = new List<string> { ContentManager }, + }); - ServiceClient.Send(newUserRegistration); + Assert.That(assignResponse.AllRoles, Is.EquivalentTo(new[] { RoleName1, ContentManager })); - return newUserRegistration; - } + var response = newUserClient.Send(new ContentManagerOnly()); + + Assert.That(response.Result, Is.EqualTo("Haz Access")); + } + + [Test] + public void Can_only_access_ContentPermissionOnlyService_service_after_Assigned_Permission() + { + var newUser = RegisterNewUser(autoLogin: true); + + try + { + ServiceClient.Send(new ContentPermissionOnly()); + Assert.Fail("Should not be allowed - no permissions"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + //StatusDescription is ignored in WebDevServer + //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Permissions")); + } - [Test] - public void Authenticationg_does_return_session_cookies() - { var client = AuthenticateWithAdminUser(); - Assert.That(client.CookieContainer.Count, Is.GreaterThan(0)); - } - - [Test] - public void Cannot_assign_roles_with_normal_user() - { - var newUser = RegisterNewUser(autoLogin: true); - - try - { - var response = ServiceClient.Send( - new AssignRoles { - UserName = newUser.UserName, - Roles = { RoleName1, RoleName2 }, - Permissions = { Permission1, Permission2 } - }); - - response.PrintDump(); - Assert.Fail("Should not be allowed"); - } - catch (WebServiceException webEx) - { - Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); - //StatusDescription is ignored in WebDevServer - //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Role")); - } - } - - [Test] - public void Can_Assign_Roles_and_Permissions_to_new_User() - { - var newUser = RegisterNewUser(); - - var client = AuthenticateWithAdminUser(); - - var response = client.Send( - new AssignRoles { - UserName = newUser.UserName, - Roles = { RoleName1, RoleName2 }, - Permissions = { Permission1, Permission2 } - }); - - Console.WriteLine("Assigned Roles: " + response.Dump()); - - Assert.That(response.AllRoles, Is.EquivalentTo(new[] { RoleName1, RoleName2 })); - Assert.That(response.AllPermissions, Is.EquivalentTo(new[] { Permission1, Permission2 })); - } - - [Test] - public void Can_UnAssign_Roles_and_Permissions_to_new_User() - { - var newUser = RegisterNewUser(); - - var client = AuthenticateWithAdminUser(); - - client.Send( - new AssignRoles { - UserName = newUser.UserName, - Roles = new List<string> { RoleName1, RoleName2 }, - Permissions = new List<string> { Permission1, Permission2 } - }); - - var response = client.Send( - new UnAssignRoles { - UserName = newUser.UserName, - Roles = { RoleName1 }, - Permissions = { Permission2 }, - }); - - Console.WriteLine("Remaining Roles: " + response.Dump()); - - Assert.That(response.AllRoles, Is.EquivalentTo(new[] { RoleName2 })); - Assert.That(response.AllPermissions, Is.EquivalentTo(new[] { Permission1 })); - } - - [Test] - public void Can_only_access_ContentManagerOnlyService_service_after_Assigned_Role() - { - var newUser = RegisterNewUser(autoLogin: true); - - try - { - ServiceClient.Send(new ContentManagerOnly()); - Assert.Fail("Should not be allowed - no roles"); - } - catch (WebServiceException webEx) - { - Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); - //StatusDescription is ignored in WebDevServer - //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Role")); - } - - var client = AuthenticateWithAdminUser(); - - client.Send( - new AssignRoles { - UserName = newUser.UserName, - Roles = new List<string> { RoleName1 }, - }); - - var newUserClient = Login(newUser.UserName, newUser.Password); - - try - { - newUserClient.Send(new ContentManagerOnly()); - Assert.Fail("Should not be allowed - wrong roles"); - } - catch (WebServiceException webEx) - { - Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); - //StatusDescription is ignored in WebDevServer - //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Role")); - } - - var assignResponse = client.Send( - new AssignRoles { - UserName = newUser.UserName, - Roles = new List<string> { ContentManager }, - }); - - Assert.That(assignResponse.AllRoles, Is.EquivalentTo(new[] { RoleName1, ContentManager })); - - var response = newUserClient.Send(new ContentManagerOnly()); - - Assert.That(response.Result, Is.EqualTo("Haz Access")); - } - - [Test] - public void Can_only_access_ContentPermissionOnlyService_service_after_Assigned_Permission() - { - var newUser = RegisterNewUser(autoLogin: true); - - try - { - ServiceClient.Send(new ContentPermissionOnly()); - Assert.Fail("Should not be allowed - no permissions"); - } - catch (WebServiceException webEx) - { - Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); - //StatusDescription is ignored in WebDevServer - //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Permissions")); - } - - var client = AuthenticateWithAdminUser(); - - client.Send( - new AssignRoles { - UserName = newUser.UserName, - Permissions = new List<string> { RoleName1 }, - }); - - var newUserClient = Login(newUser.UserName, newUser.Password); - - try - { - newUserClient.Send(new ContentPermissionOnly()); - Assert.Fail("Should not be allowed - wrong permissions"); - } - catch (WebServiceException webEx) - { - Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); - //StatusDescription is ignored in WebDevServer - //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Permissions")); - } - - var assignResponse = client.Send( - new AssignRoles { - UserName = newUser.UserName, - Permissions = new List<string> { ContentPermission }, - }); - - Assert.That(assignResponse.AllPermissions, Is.EquivalentTo(new[] { RoleName1, ContentPermission })); - - var response = newUserClient.Send(new ContentPermissionOnly()); - - Assert.That(response.Result, Is.EqualTo("Haz Access")); - } + + client.Send( + new AssignRoles + { + UserName = newUser.UserName, + Permissions = new List<string> { RoleName1 }, + }); + + var newUserClient = Login(newUser.UserName, newUser.Password); + + try + { + newUserClient.Send(new ContentPermissionOnly()); + Assert.Fail("Should not be allowed - wrong permissions"); + } + catch (WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden)); + //StatusDescription is ignored in WebDevServer + //Assert.That(webEx.StatusDescription, Is.EqualTo("Invalid Permissions")); + } + + var assignResponse = client.Send( + new AssignRoles + { + UserName = newUser.UserName, + Permissions = new List<string> { ContentPermission }, + }); + + Assert.That(assignResponse.AllPermissions, Is.EquivalentTo(new[] { RoleName1, ContentPermission })); + + var response = newUserClient.Send(new ContentPermissionOnly()); + + Assert.That(response.Result, Is.EqualTo("Haz Access")); + } [Test] public void Cannot_access_Admin_service_by_default() { try { - BaseUri.AppendPath("requiresadmin").GetStringFromUrl(); + var response = BaseUri.AppendPath("requiresadmin").GetJsonFromUrl(); Assert.Fail("Should not allow access to protected resource"); } catch (Exception ex) { - if (ex.IsUnauthorized()) + if (ex.IsUnauthorized() || ex.IsAny400()) //redirect to login return; throw; @@ -257,8 +265,9 @@ public void Cannot_access_Admin_service_by_default() [Test] public void Can_access_Admin_service_with_AuthSecret() { - BaseUri.AppendPath("requiresadmin").AddQueryParam("authsecret", AuthSecret).GetStringFromUrl(); + BaseUri.AppendPath("requiresadmin") + .AddQueryParam("authsecret", AuthSecret).GetJsonFromUrl(); } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncProgressTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncProgressTests.cs index 874b6154c3a..990d120e82e 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncProgressTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncProgressTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt @@ -53,21 +53,21 @@ public async Task Can_report_progress_when_downloading_async_with_Post() } [Test] - [Explicit("Setting Content-Length requires IIS integrated pipeline mode")] + [Ignore("Setting Content-Length requires IIS integrated pipeline mode")] public async Task Can_report_progress_when_downloading_async_with_Post_bytes() { await AsyncDownloadWithProgress(new TestProgressBytes()); } [Test] - [Explicit("Setting Content-Length requires IIS integrated pipeline mode")] + [Ignore("Setting Content-Length requires IIS integrated pipeline mode")] public async Task Can_report_progress_when_downloading_async_with_Post_File_bytes() { await AsyncDownloadWithProgress(new TestProgressBinaryFile()); } [Test] - [Explicit("Setting Content-Length requires IIS integrated pipeline mode")] + [Ignore("Setting Content-Length requires IIS integrated pipeline mode")] public async Task Can_report_progress_when_downloading_async_with_Post_File_text() { await AsyncDownloadWithProgress(new TestProgressTextFile()); diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncRestClientTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncRestClientTests.cs index ebace937840..fff1d77a0aa 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncRestClientTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncRestClientTests.cs @@ -10,7 +10,7 @@ public abstract class AsyncRestClientTests { private const string ListeningOn = Config.ServiceStackBaseUri; - protected abstract IRestClientAsync CreateServiceClient(); + protected abstract IHttpRestClientAsync CreateServiceClient(); [Test] public async Task Can_call_GetAsync_on_GetFactorial_using_RestClientAsync() @@ -104,7 +104,7 @@ public async Task Can_call_DeleteAsync_to_delete_Movie_using_RestClientAsync() [TestFixture] public class JsonAsyncRestServiceClientTests : AsyncRestClientTests { - protected override IRestClientAsync CreateServiceClient() + protected override IHttpRestClientAsync CreateServiceClient() { return new JsonServiceClient(ListeningOn); } @@ -113,7 +113,7 @@ protected override IRestClientAsync CreateServiceClient() [TestFixture] public class JsvAsyncRestServiceClientTests : AsyncRestClientTests { - protected override IRestClientAsync CreateServiceClient() + protected override IHttpRestClientAsync CreateServiceClient() { return new JsvServiceClient(ListeningOn); } @@ -122,7 +122,7 @@ protected override IRestClientAsync CreateServiceClient() [TestFixture] public class XmlAsyncRestServiceClientTests : AsyncRestClientTests { - protected override IRestClientAsync CreateServiceClient() + protected override IHttpRestClientAsync CreateServiceClient() { return new XmlServiceClient(ListeningOn); } diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncTaskTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncTaskTests.cs index 8f18a97b723..3c3b2f96cf0 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncTaskTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AsyncTaskTests.cs @@ -150,7 +150,84 @@ protected override IServiceClient CreateServiceClient() } } - [Explicit, TestFixture] + [TestFixture] + public class Soap12AsyncPostTaskTests : AsyncPostTaskTests + { + protected override IServiceClient CreateServiceClient() + { + return new Soap12ServiceClient(Config.ServiceStackBaseUri); + } + } + + [TestFixture] + public class JsonServiceClientAsyncPostTaskTests : AsyncPostTaskTests + { + protected override IServiceClient CreateServiceClient() + { + return new JsonServiceClient(Config.ServiceStackBaseUri); + } + } + + [TestFixture] + public class JsonHttpClientAsyncPostTaskTests : AsyncPostTaskTests + { + protected override IServiceClient CreateServiceClient() + { + return new JsonHttpClient(Config.ServiceStackBaseUri); + } + } + + public abstract class AsyncPostTaskTests + { + private const int Param = 3; + + protected abstract IServiceClient CreateServiceClient(); + + [Test] + public void PostSync_GetFactorialGenericSync() + { + var response = CreateServiceClient().Post(new GetFactorialSync {ForNumber = Param}); + Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(Param))); + } + + [Test] + public void PostSync_GetFactorialGenericAsync() + { + var response = CreateServiceClient().Post(new GetFactorialGenericAsync {ForNumber = Param}); + Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(Param))); + } + + [Test] + public void PostSync_GetFactorialObjectAsync() + { + var response = CreateServiceClient().Post(new GetFactorialObjectAsync {ForNumber = Param}); + Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(Param))); + } + + [Test] + public void PostSync_GetFactorialAwaitAsync() + { + var response = CreateServiceClient().Post(new GetFactorialAwaitAsync {ForNumber = Param}); + Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(Param))); + } + + [Test] + public void PostSync_GetFactorialDelayAsync() + { + var response = CreateServiceClient().Post(new GetFactorialDelayAsync {ForNumber = Param}); + Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(Param))); + } + + [Test] + public void PostSync_GetFactorialUnmarkedAsync() + { + var response = CreateServiceClient().Post<GetFactorialResponse>( + new GetFactorialUnmarkedAsync {ForNumber = Param}); + Assert.That(response.Result, Is.EqualTo(GetFactorialAsyncService.GetFactorial(Param))); + } + } + + [Ignore("Load Test"), TestFixture] public class AsyncLoadTests { const int NoOfTimes = 1000; diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AuthTestsBase.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AuthTestsBase.cs index 503768e2a92..dea20f7e860 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/AuthTestsBase.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/AuthTestsBase.cs @@ -5,75 +5,77 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - public class AuthTestsBase - { - public const string BaseUri = Config.ServiceStackBaseUri; - public const string AdminEmail = "admin@servicestack.com"; - public const string AuthSecret = "secretz"; - private const string AdminPassword = "E8828A3E26884CE0B345D0D2DFED358A"; + public class AuthTestsBase + { + public const string BaseUri = Config.ServiceStackBaseUri; + public const string AdminEmail = "admin@servicestack.com"; + public const string AuthSecret = "secretz"; + private const string AdminPassword = "E8828A3E26884CE0B345D0D2DFED358A"; - private IServiceClient serviceClient; - public IServiceClient ServiceClient - { - get - { - return serviceClient ?? (serviceClient = new JsonServiceClient(BaseUri)); - } - } + private IServiceClient serviceClient; + public IServiceClient ServiceClient + { + get + { + return serviceClient ?? (serviceClient = new JsonServiceClient(BaseUri)); + } + } - public Register CreateAdminUser() - { - var registration = new Register { - UserName = "Admin", - DisplayName = "The Admin User", - Email = AdminEmail, //this email is automatically assigned as Admin in Web.Config - FirstName = "Admin", - LastName = "User", - Password = AdminPassword, - }; - try - { - ServiceClient.Send(registration); - } - catch (WebServiceException ex) - { - ("Error while creating Admin User: " + ex.Message).Print(); - ex.ResponseDto.PrintDump(); - } - return registration; - } + public Register CreateAdminUser() + { + var registration = new Register + { + UserName = "Admin", + DisplayName = "The Admin User", + Email = AdminEmail, //this email is automatically assigned as Admin in Web.Config + FirstName = "Admin", + LastName = "User", + Password = AdminPassword, + }; + try + { + ServiceClient.Send(registration); + } + catch (WebServiceException ex) + { + ("Error while creating Admin User: " + ex.Message).Print(); + } + return registration; + } - public JsonServiceClient Login(string userName, string password) - { - var client = new JsonServiceClient(BaseUri); - client.Send(new Authenticate { - UserName = userName, - Password = password, - RememberMe = true, - }); + public JsonServiceClient Login(string userName, string password) + { + var client = new JsonServiceClient(BaseUri); + client.Send(new Authenticate + { + UserName = userName, + Password = password, + RememberMe = true, + }); - return client; - } + return client; + } - public JsonServiceClient AuthenticateWithAdminUser() - { - var registration = CreateAdminUser(); - var adminServiceClient = new JsonServiceClient(BaseUri); - adminServiceClient.Send(new Authenticate { - UserName = registration.UserName, - Password = registration.Password, - RememberMe = true, - }); + public JsonServiceClient AuthenticateWithAdminUser() + { + var registration = CreateAdminUser(); + var adminServiceClient = new JsonServiceClient(BaseUri); + adminServiceClient.Send(new Authenticate + { + UserName = registration.UserName, + Password = registration.Password, + RememberMe = true, + }); - return adminServiceClient; - } + return adminServiceClient; + } - protected void AssertUnAuthorized(WebServiceException webEx) - { - Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); - Assert.That(webEx.StatusDescription, Is.EqualTo(HttpStatusCode.Unauthorized.ToString())); - } + protected void AssertUnAuthorized(WebServiceException webEx) + { + Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); + Assert.That(webEx.StatusDescription, Is.EqualTo(HttpStatusCode.Unauthorized.ToString())); + } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/BinarySerializedTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/BinarySerializedTests.cs index 82a17ce2550..61ba99b6bd3 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/BinarySerializedTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/BinarySerializedTests.cs @@ -49,13 +49,10 @@ public void Can_call_cached_WebService_with_Protobuf() FromAddress = fromEmail }); - response.PrintDump(); - Assert.That(response.FromAddress, Is.EqualTo(fromEmail)); } catch (WebServiceException webEx) { - webEx.ResponseDto.PrintDump(); Assert.Fail(webEx.Message); } } @@ -75,13 +72,10 @@ public void Can_call_WebService_with_Protobuf() FromAddress = fromEmail }); - response.PrintDump(); - Assert.That(response.FromAddress, Is.EqualTo(fromEmail)); } catch (WebServiceException webEx) { - webEx.ResponseDto.PrintDump(); Assert.Fail(webEx.Message); } } diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CachedServiceTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CachedServiceTests.cs index 58122d93da2..0b86f46665d 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CachedServiceTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CachedServiceTests.cs @@ -6,10 +6,10 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class CachedServiceTests - { - [TestFixtureSetUp] + [TestFixture] + public class CachedServiceTests + { + [OneTimeSetUp] public void OnBeforeEachTest() { var jsonClient = new JsonServiceClient(Config.ServiceStackBaseUri); @@ -48,11 +48,11 @@ public void Can_call_Cached_WebService_with_ProtoBuf_without_compression() } [Test] - public void Can_call_Cached_WebService_with_JSONP() - { - var url = Config.ServiceStackBaseUri.CombineWith("/cached/movies?callback=cb"); - var jsonp = url.GetJsonFromUrl(); - Assert.That(jsonp.StartsWith("cb(")); - } - } + public void Can_call_Cached_WebService_with_JSONP() + { + var url = Config.ServiceStackBaseUri.CombineWith("/cached/movies?callback=cb"); + var jsonp = url.GetJsonFromUrl(); + Assert.That(jsonp.StartsWith("cb(")); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/Config.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/Config.cs index 1667c31f45a..4c39cc97edb 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/Config.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/Config.cs @@ -1,7 +1,7 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - public class Config - { + public class Config + { public const string AbsoluteBaseUri = "http://localhost:50000/"; public const string ServiceStackBaseUri = AbsoluteBaseUri + "api"; } diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CsvContentTypeFilterTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CsvContentTypeFilterTests.cs index e74eec15f39..9e1ff066d18 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CsvContentTypeFilterTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CsvContentTypeFilterTests.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Net; using System.Threading; +using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.Text; using ServiceStack.Web; @@ -10,16 +11,16 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class CsvContentTypeFilterTests - { - const int HeaderRowCount = 1; - private const string ServiceClientBaseUri = Config.ServiceStackBaseUri + "/"; + [TestFixture] + public class CsvContentTypeFilterTests + { + const int HeaderRowCount = 1; + private const string ServiceClientBaseUri = Config.ServiceStackBaseUri + "/"; - private static void FailOnAsyncError<T>(T response, Exception ex) - { - Assert.Fail(ex.Message); - } + private static void FailOnAsyncError<T>(T response, Exception ex) + { + Assert.Fail(ex.Message); + } [SetUp] public void SetUp() @@ -28,106 +29,96 @@ public void SetUp() RestsTestBase.GetWebResponse(HttpMethods.Post, ServiceClientBaseUri + "reset-movies", MimeTypes.Xml, 0); } - [Test] - [Ignore("Fails because CSV Deserializer is not implemented")] - public void Can_download_movies_in_Csv() - { - var asyncClient = new AsyncServiceClient - { - ContentType = MimeTypes.Csv, - StreamSerializer = (r, o, s) => CsvSerializer.SerializeToStream(o, s), - StreamDeserializer = CsvSerializer.DeserializeFromStream, - }; - - MoviesResponse response = null; - asyncClient.SendAsync<MoviesResponse>(HttpMethods.Get, ServiceClientBaseUri + "/movies", null, - r => response = r, FailOnAsyncError); + [Test] + public async Task Can_download_movies_in_Csv() + { + var client = new CsvServiceClient(ServiceClientBaseUri); - Thread.Sleep(1000); + var response = await client.GetAsync<MoviesResponse>(new Movies()); - Assert.That(response, Is.Not.Null, "No response received"); - } + Assert.That(response, Is.Not.Null, "No response received"); + } - [Test] - public void Can_download_CSV_movies_using_csv_reply_endpoint() - { - var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "csv/reply/Movies"); + [Test] + public void Can_download_CSV_movies_using_csv_reply_endpoint() + { + var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "csv/reply/Movies"); - var res = req.GetResponse(); + var res = req.GetResponse(); Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Movies.csv")); + Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Movies.csv")); var csvRows = res.ReadLines().ToList(); - const int headerRowCount = 1; - Assert.That(csvRows, Has.Count.EqualTo(headerRowCount + ResetMoviesService.Top5Movies.Count)); - //Console.WriteLine(csvRows.Join("\n")); - } + const int headerRowCount = 1; + Assert.That(csvRows, Has.Count.EqualTo(headerRowCount + ResetMoviesService.Top5Movies.Count)); + //Console.WriteLine(csvRows.Join("\n")); + } - [Test] - public void Can_download_CSV_movies_using_csv_reply_Path_and_alternate_XML_Accept_Header() - { - var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "csv/reply/Movies"); - req.Accept = "application/xml"; + [Test] + public void Can_download_CSV_movies_using_csv_reply_Path_and_alternate_XML_Accept_Header() + { + var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "csv/reply/Movies"); + req.Accept = "application/xml"; - var res = req.GetResponse(); + var res = req.GetResponse(); Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Movies.csv")); + Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Movies.csv")); var csvRows = res.ReadLines().ToList(); - Assert.That(csvRows, Has.Count.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); - Console.WriteLine(csvRows.Join("\n")); - } + Assert.That(csvRows, Has.Count.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); + Console.WriteLine(csvRows.Join("\n")); + } - [Test] - public void Can_download_CSV_movies_using_csv_Accept_and_RestPath() - { - var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "movies"); + [Test] + public void Can_download_CSV_movies_using_csv_Accept_and_RestPath() + { + var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "movies"); req.Accept = MimeTypes.Csv; - var res = req.GetResponse(); + var res = req.GetResponse(); Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Movies.csv")); + Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Movies.csv")); var csvRows = res.ReadLines().ToList(); - Assert.That(csvRows, Has.Count.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); - //Console.WriteLine(csvRows.Join("\n")); - } - - [Test] - public void Can_download_CSV_Hello_using_csv_reply_endpoint() - { - var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "csv/reply/Hello?Name=World!"); - - var res = req.GetResponse(); - Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Hello.csv")); - - var csv = res.ReadToEnd(); - var lf = Environment.NewLine; - Assert.That(csv, Is.EqualTo("Result{0}\"Hello, World!\"{0}".Fmt(lf))); - - Console.WriteLine(csv); - } - - [Test] - public void Can_download_CSV_Hello_using_csv_Accept_and_RestPath() - { - var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "hello/World!"); - req.Accept = MimeTypes.Csv; - - var res = req.GetResponse(); - Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); - Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Hello.csv")); - - var csv = res.ReadToEnd(); - var lf = Environment.NewLine; - Assert.That(csv, Is.EqualTo("Result{0}\"Hello, World!\"{0}".Fmt(lf))); - - Console.WriteLine(csv); - } - - } + Assert.That(csvRows, Has.Count.EqualTo(HeaderRowCount + ResetMoviesService.Top5Movies.Count)); + //Console.WriteLine(csvRows.Join("\n")); + } + + [Test] + public void Can_download_CSV_Hello_using_csv_reply_endpoint() + { + var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "csv/reply/Hello?Name=World!"); + + var res = req.GetResponse(); + Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); + Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Hello.csv")); + + var csv = res.ReadToEnd(); + var lf = Environment.NewLine; + Assert.That(csv, Is.EqualTo("Result{0}\"Hello, World!\"{0}".Fmt(lf))); + + Console.WriteLine(csv); + } + + [Test] + public void Can_download_CSV_Hello_using_csv_Accept_and_RestPath() + { + var req = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "hello/World!"); + req.Accept = MimeTypes.Csv; + + var res = req.GetResponse(); + Assert.That(res.ContentType, Is.EqualTo(MimeTypes.Csv)); + Assert.That(res.Headers[HttpHeaders.ContentDisposition], Is.EqualTo("attachment;filename=Hello.csv")); + + var csv = res.ReadToEnd(); + var lf = Environment.NewLine; + Assert.That(csv, Is.EqualTo("Result{0}\"Hello, World!\"{0}".Fmt(lf))); + + Console.WriteLine(csv); + } + + } } diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomHeadersTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomHeadersTests.cs index 88af5c09726..12a8710718e 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomHeadersTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomHeadersTests.cs @@ -11,7 +11,7 @@ public class CustomHeadersTests public void GetRequest() { var client = new JsonServiceClient(Config.ServiceStackBaseUri); - client.Headers.Add("Foo","abc123"); + client.Headers.Add("Foo", "abc123"); var response = client.Get(new CustomHeaders()); Assert.That(response.Foo, Is.EqualTo("abc123")); Assert.That(response.Bar, Is.Null); diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomRequestDataTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomRequestDataTests.cs index b4d0a6257f1..25b8469b3bd 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomRequestDataTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomRequestDataTests.cs @@ -6,37 +6,37 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class CustomRequestDataTests - { - /// <summary> - /// first-name=tom&item-0=blah&item-1-delete=1 - /// </summary> - [Test] - public void Can_parse_custom_form_data() - { - var webReq = (HttpWebRequest)WebRequest.Create(Config.ServiceStackBaseUri + "/customformdata?format=json"); - webReq.Method = HttpMethods.Post; + [TestFixture] + public class CustomRequestDataTests + { + /// <summary> + /// first-name=tom&item-0=blah&item-1-delete=1 + /// </summary> + [Test] + public void Can_parse_custom_form_data() + { + var webReq = (HttpWebRequest)WebRequest.Create(Config.ServiceStackBaseUri + "/customformdata?format=json"); + webReq.Method = HttpMethods.Post; webReq.ContentType = MimeTypes.FormUrlEncoded; - try - { - using (var sw = new StreamWriter(webReq.GetRequestStream())) - { - sw.Write("&first-name=tom&item-0=blah&item-1-delete=1"); - } - var response = webReq.GetResponse().ReadToEnd(); + try + { + using (var sw = new StreamWriter(webReq.GetRequestStream())) + { + sw.Write("&first-name=tom&item-0=blah&item-1-delete=1"); + } + var response = webReq.GetResponse().ReadToEnd(); - Assert.That(response, Is.EqualTo("{\"firstName\":\"tom\",\"item0\":\"blah\",\"item1Delete\":\"1\"}")); - } - catch (WebException webEx) - { - var errorWebResponse = ((HttpWebResponse)webEx.Response); + Assert.That(response, Is.EqualTo("{\"firstName\":\"tom\",\"item0\":\"blah\",\"item1Delete\":\"1\"}")); + } + catch (WebException webEx) + { + var errorWebResponse = ((HttpWebResponse)webEx.Response); var errorResponse = errorWebResponse.ReadToEnd(); - Assert.Fail(errorResponse); - } - } + Assert.Fail(errorResponse); + } + } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomerServiceValidationTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomerServiceValidationTests.cs index 3447e84fdb5..2966f00c770 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomerServiceValidationTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/CustomerServiceValidationTests.cs @@ -13,22 +13,22 @@ public class CustomerServiceValidationTests private const string ListeningOn = Config.ServiceStackBaseUri; private string[] ExpectedPostErrorFields = new[] { - "Id", - "LastName", - "FirstName", - "Company", - "Address", - "Postcode", - }; + "Id", + "LastName", + "FirstName", + "Company", + "Address", + "Postcode", + }; private string[] ExpectedPostErrorCodes = new[] { - "NotEqual", - "ShouldNotBeEmpty", - "NotEmpty", - "NotNull", - "Length", - "Predicate", - }; + "NotEqual", + "ShouldNotBeEmpty", + "NotEmpty", + "NotNull", + "NotNull", //Length returns true if null + "Predicate", + }; Customers validRequest; @@ -53,10 +53,10 @@ public static IEnumerable ServiceClients get { return new IServiceClient[] { - new JsonServiceClient(ListeningOn), - new JsvServiceClient(ListeningOn), - new XmlServiceClient(ListeningOn), - }; + new JsonServiceClient(ListeningOn), + new JsvServiceClient(ListeningOn), + new XmlServiceClient(ListeningOn), + }; } } @@ -67,7 +67,6 @@ public void Post_empty_request_throws_validation_exception(IServiceClient client try { var response = client.Send(new Customers()); - response.PrintDump(); Assert.Fail("Should throw Validation Exception"); } catch (WebServiceException ex) @@ -91,7 +90,6 @@ public void Get_empty_request_throws_validation_exception(IRestClient client) try { var response = client.Get(new Customers()); - response.PrintDump(); Assert.Fail("Should throw Validation Exception"); } catch (WebServiceException ex) @@ -101,11 +99,11 @@ public void Get_empty_request_throws_validation_exception(IRestClient client) var errorFields = response.ResponseStatus.Errors; Assert.That(ex.StatusCode, Is.EqualTo((int)HttpStatusCode.BadRequest)); //Assert.That(ex.StatusDescription, Is.EqualTo("NotEqual")); //BadRequest - Assert.That(response.ResponseStatus.Message, Is.EqualTo("'Id' should not be equal to '0'.")); + Assert.That(response.ResponseStatus.Message, Is.EqualTo("'Id' must not be equal to '0'.")); Assert.That(errorFields.Count, Is.EqualTo(1)); Assert.That(errorFields[0].ErrorCode, Is.EqualTo("NotEqual")); Assert.That(errorFields[0].FieldName, Is.EqualTo("Id")); - Assert.That(errorFields[0].Message, Is.EqualTo("'Id' should not be equal to '0'.")); + Assert.That(errorFields[0].Message, Is.EqualTo("'Id' must not be equal to '0'.")); } } diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/ExceptionHandlingTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/ExceptionHandlingTests.cs index 36555d71572..4c6458ed256 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/ExceptionHandlingTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/ExceptionHandlingTests.cs @@ -73,16 +73,54 @@ public object Any(ExceptionNoResponseDto request) } } + public class CustomHttpError + { + public int StatusCode { get; set; } + public string StatusDescription { get; set; } + } + public class CustomHttpErrorResponse + { + public string Custom { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + public class CustomHttpErrorService : Service + { + public object Any(CustomHttpError request) + { + throw new HttpError(request.StatusCode, request.StatusDescription); + } + } + + public class CustomFieldHttpError { } + public class CustomFieldHttpErrorResponse + { + public string Custom { get; set; } + public ResponseStatus ResponseStatus { get; set; } + } + public class CustomFieldHttpErrorService : Service + { + public object Any(CustomFieldHttpError request) + { + throw new HttpError(new CustomFieldHttpErrorResponse + { + Custom = "Ignored", + ResponseStatus = new ResponseStatus("StatusErrorCode", "StatusErrorMessage") + }, + 500, + "HeaderErrorCode"); + } + } + [TestFixture] public class ExceptionHandlingTests { private const string ListeningOn = Config.ServiceStackBaseUri + "/"; - protected static IRestClient[] ServiceClients = - { - new JsonServiceClient(ListeningOn), - new XmlServiceClient(ListeningOn), - new JsvServiceClient(ListeningOn) + protected static IRestClient[] ServiceClients = + { + new JsonServiceClient(ListeningOn), + new XmlServiceClient(ListeningOn), + new JsvServiceClient(ListeningOn) //SOAP not supported in HttpListener //new Soap11ServiceClient(ServiceClientBaseUri), //new Soap12ServiceClient(ServiceClientBaseUri) @@ -166,14 +204,13 @@ public void Returns_populated_dto_when_has_ResponseStatus() try { var json = PredefinedJsonUrl<ExceptionWithResponseStatus>().GetJsonFromUrl(); - json.PrintDump(); Assert.Fail("Should throw"); } catch (WebException webEx) { var errorResponse = ((HttpWebResponse)webEx.Response); - var body = errorResponse.GetResponseStream().ReadFully().FromUtf8Bytes(); - Assert.That(body, Is.StringStarting( + var body = errorResponse.GetResponseStream().ReadToEnd(); + Assert.That(body, Does.StartWith( "{\"responseStatus\":{\"errorCode\":\"CustomException\",\"message\":\"User Defined Error\"")); //inc stacktrace } } @@ -184,13 +221,13 @@ public void Returns_empty_dto_when_NoResponseStatus() try { var json = PredefinedJsonUrl<ExceptionNoResponseStatus>().GetJsonFromUrl(); - json.PrintDump(); + json.PrintDump(); Assert.Fail("Should throw"); } catch (WebException webEx) { var errorResponse = ((HttpWebResponse)webEx.Response); - var body = errorResponse.GetResponseStream().ReadFully().FromUtf8Bytes(); + var body = errorResponse.GetResponseStream().ReadToEnd(); Assert.That(body, Is.EqualTo("{}")); } } @@ -201,14 +238,57 @@ public void Returns_no_body_when_NoResponseDto() try { var json = PredefinedJsonUrl<ExceptionNoResponseDto>().GetJsonFromUrl(); - json.PrintDump(); Assert.Fail("Should throw"); } catch (WebException webEx) { var errorResponse = ((HttpWebResponse)webEx.Response); - var body = errorResponse.GetResponseStream().ReadFully().FromUtf8Bytes(); - Assert.That(body, Is.StringStarting("{\"responseStatus\":{\"errorCode\":\"CustomException\",\"message\":\"User Defined Error\"")); + var body = errorResponse.GetResponseStream().ReadToEnd(); + Assert.That(body, Does.StartWith("{\"responseStatus\":{\"errorCode\":\"CustomException\",\"message\":\"User Defined Error\"")); + } + } + + [Test] + public void Returns_custom_ResponseStatus_with_CustomFieldHttpError() + { + try + { + var json = PredefinedJsonUrl<CustomFieldHttpError>().GetJsonFromUrl(); + Assert.Fail("Should throw"); + } + catch (WebException webEx) + { + var errorResponse = ((HttpWebResponse)webEx.Response); + Assert.That((int)errorResponse.StatusCode, Is.EqualTo(500)); + //IIS doesn't allow overriding of StatusDescription + //Assert.That(errorResponse.StatusDescription, Is.EqualTo("HeaderErrorCode")); + + var body = errorResponse.GetResponseStream().ReadToEnd(); + var customResponse = body.FromJson<CustomFieldHttpErrorResponse>(); + var errorStatus = customResponse.ResponseStatus; + Assert.That(errorStatus.ErrorCode, Is.EqualTo("StatusErrorCode")); + Assert.That(errorStatus.Message, Is.EqualTo("StatusErrorMessage")); + Assert.That(customResponse.Custom, Is.Null); + } + } + + [Test] + public void Returns_custom_Status_and_Description_with_CustomHttpError() + { + try + { + var json = PredefinedJsonUrl<CustomHttpError>() + .AddQueryParam("StatusCode", 406) + .AddQueryParam("StatusDescription", "CustomDescription") + .GetJsonFromUrl(); + Assert.Fail("Should throw"); + } + catch (WebException webEx) + { + var errorResponse = ((HttpWebResponse)webEx.Response); + Assert.That((int)errorResponse.StatusCode, Is.EqualTo(406)); + //IIS doesn't allow overriding of StatusDescription + //Assert.That(errorResponse.StatusDescription, Is.EqualTo("CustomDescription")); } } } diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/FileUploadTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/FileUploadTests.cs index 1d442c59be0..2a53cbeb917 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/FileUploadTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/FileUploadTests.cs @@ -85,7 +85,8 @@ public void Can_POST_upload_file() AssertResponse<FileUploadResponse>((HttpWebResponse)webResponse, r => { - var expectedContents = new StreamReader(uploadForm.OpenRead()).ReadToEnd(); + var expectedContents = uploadForm.OpenRead().ReadToEnd(); + Assert.That(r.Name, Is.EqualTo("upload")); Assert.That(r.FileName, Is.EqualTo(uploadForm.Name)); Assert.That(r.ContentLength, Is.EqualTo(uploadForm.Length)); Assert.That(r.ContentType, Is.EqualTo(MimeTypes.GetMimeType(uploadForm.Name))); @@ -98,7 +99,7 @@ public void Can_GET_upload_file() { var uploadForm = new FileInfo("~/TestExistingDir/upload.html".MapHostAbsolutePath()); var webRequest = (HttpWebRequest)WebRequest.Create(base.ServiceClientBaseUri + "/fileuploads/TestExistingDir/upload.html"); - var expectedContents = new StreamReader(uploadForm.OpenRead()).ReadToEnd(); + var expectedContents = uploadForm.OpenRead().ReadToEnd(); var webResponse = webRequest.GetResponse(); var actualContents = webResponse.ReadToEnd(); @@ -107,6 +108,45 @@ public void Can_GET_upload_file() Assert.That(actualContents.NormalizeNewLines(), Is.EqualTo(expectedContents.NormalizeNewLines())); } + [Test] + public void Can_POST_upload_file_using_ServiceClient_with_request() + { + IServiceClient client = new JsonServiceClient(Config.ServiceStackBaseUri); + + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapHostAbsolutePath()); + + var request = new FileUpload { CustomerId = 123, CustomerName = "Foo,Bar" }; + var response = client.PostFileWithRequest<FileUploadResponse>(Config.ServiceStackBaseUri + "/fileuploads", uploadFile, request); + + var expectedContents = uploadFile.OpenRead().ReadToEnd(); + Assert.That(response.Name, Is.EqualTo("upload")); + Assert.That(response.FileName, Is.EqualTo(uploadFile.Name)); + Assert.That(response.ContentLength, Is.EqualTo(uploadFile.Length)); + Assert.That(response.Contents, Is.EqualTo(expectedContents)); + Assert.That(response.CustomerName, Is.EqualTo("Foo,Bar")); + Assert.That(response.CustomerId, Is.EqualTo(123)); + } + + [Test] + public void Can_POST_upload_file_using_ServiceClient_with_request_and_QueryString() + { + IServiceClient client = new JsonServiceClient(Config.ServiceStackBaseUri); + + var uploadFile = new FileInfo("~/TestExistingDir/upload.html".MapHostAbsolutePath()); + + var request = new FileUpload(); + var response = client.PostFileWithRequest<FileUploadResponse>( + Config.ServiceStackBaseUri + "/fileuploads?CustomerId=123&CustomerName=Foo,Bar", + uploadFile, request); + + var expectedContents = uploadFile.OpenRead().ReadToEnd(); + Assert.That(response.Name, Is.EqualTo("upload")); + Assert.That(response.FileName, Is.EqualTo(uploadFile.Name)); + Assert.That(response.ContentLength, Is.EqualTo(uploadFile.Length)); + Assert.That(response.Contents, Is.EqualTo(expectedContents)); + Assert.That(response.CustomerName, Is.EqualTo("Foo,Bar")); + Assert.That(response.CustomerId, Is.EqualTo(123)); + } } diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/FilterTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/FilterTests.cs index 7026cdf2081..2c689867cf2 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/FilterTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/FilterTests.cs @@ -4,16 +4,16 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class FilterTests - { - [Test] - public void Can_call_service_returning_string() - { - var response = Config.ServiceStackBaseUri.CombineWith("hello2/world") - .GetJsonFromUrl(); + [TestFixture] + public class FilterTests + { + [Test] + public void Can_call_service_returning_string() + { + var response = Config.ServiceStackBaseUri.CombineWith("hello2/world") + .GetJsonFromUrl(); - Assert.That(response, Is.EqualTo("world")); - } - } + Assert.That(response, Is.EqualTo("world")); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/HelloWorldRawHttpPostTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/HelloWorldRawHttpPostTests.cs index 9e385fc8731..6eb040299c1 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/HelloWorldRawHttpPostTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/HelloWorldRawHttpPostTests.cs @@ -5,49 +5,47 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - public class HelloWorldRawHttpPostTests - { - [Test] - public void Post_JSON_to_HelloWorld() - { - var httpReq = (HttpWebRequest)WebRequest.Create(Config.ServiceStackBaseUri + "/hello"); - httpReq.Method = "POST"; - httpReq.ContentType = httpReq.Accept = "application/json"; + public class HelloWorldRawHttpPostTests + { + [Test] + public void Post_JSON_to_HelloWorld() + { + var httpReq = (HttpWebRequest)WebRequest.Create(Config.ServiceStackBaseUri + "/hello"); + httpReq.Method = "POST"; + httpReq.ContentType = httpReq.Accept = "application/json"; - using (var stream = httpReq.GetRequestStream()) - using (var sw = new StreamWriter(stream)) - { - sw.Write("{\"Name\":\"World!\"}"); - } + using (var stream = httpReq.GetRequestStream()) + using (var sw = new StreamWriter(stream)) + { + sw.Write("{\"Name\":\"World!\"}"); + } - using (var response = httpReq.GetResponse()) - using (var stream = response.GetResponseStream()) - using (var reader = new StreamReader(stream)) - { - Assert.That(reader.ReadToEnd(), Is.EqualTo("{\"result\":\"Hello, World!\"}")); - } - } + using (var response = httpReq.GetResponse()) + using (var stream = response.GetResponseStream()) + { + Assert.That(stream.ReadToEnd(), Is.EqualTo("{\"result\":\"Hello, World!\"}")); + } + } - [Test] - public void Post_XML_to_HelloWorld() - { - var httpReq = (HttpWebRequest)WebRequest.Create(Config.ServiceStackBaseUri + "/hello"); - httpReq.Method = "POST"; - httpReq.ContentType = httpReq.Accept = "application/xml"; + [Test] + public void Post_XML_to_HelloWorld() + { + var httpReq = (HttpWebRequest)WebRequest.Create(Config.ServiceStackBaseUri + "/hello"); + httpReq.Method = "POST"; + httpReq.ContentType = httpReq.Accept = "application/xml"; - using (var stream = httpReq.GetRequestStream()) - using (var sw = new StreamWriter(stream)) - { - sw.Write("<Hello xmlns=\"http://schemas.servicestack.net/types\"><Name>World!</Name></Hello>"); - } + using (var stream = httpReq.GetRequestStream()) + using (var sw = new StreamWriter(stream)) + { + sw.Write("<Hello xmlns=\"http://schemas.servicestack.net/types\"><Name>World!</Name></Hello>"); + } - using (var response = httpReq.GetResponse()) - using (var stream = response.GetResponseStream()) - using (var reader = new StreamReader(stream)) - { - Assert.That(reader.ReadToEnd(), Is.EqualTo("<?xml version=\"1.0\" encoding=\"utf-8\"?><HelloResponse xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.servicestack.net/types\"><Result>Hello, World!</Result></HelloResponse>")); - } - } - } + using (var response = httpReq.GetResponse()) + using (var stream = response.GetResponseStream()) + { + Assert.That(stream.ReadToEnd(), Is.EqualTo("<?xml version=\"1.0\" encoding=\"utf-8\"?><HelloResponse xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.servicestack.net/types\"><Result>Hello, World!</Result></HelloResponse>")); + } + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/HelloWorldServiceClientTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/HelloWorldServiceClientTests.cs index a212e847c92..b2f5eb0bfcd 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/HelloWorldServiceClientTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/HelloWorldServiceClientTests.cs @@ -13,12 +13,12 @@ public static IEnumerable ServiceClients get { return new IServiceClient[] { - new JsonServiceClient(Config.ServiceStackBaseUri), - new JsvServiceClient(Config.ServiceStackBaseUri), - new XmlServiceClient(Config.ServiceStackBaseUri), - new Soap11ServiceClient(Config.ServiceStackBaseUri), - new Soap12ServiceClient(Config.ServiceStackBaseUri) - }; + new JsonServiceClient(Config.ServiceStackBaseUri), + new JsvServiceClient(Config.ServiceStackBaseUri), + new XmlServiceClient(Config.ServiceStackBaseUri), + new Soap11ServiceClient(Config.ServiceStackBaseUri), + new Soap12ServiceClient(Config.ServiceStackBaseUri) + }; } } @@ -27,10 +27,10 @@ public static IEnumerable RestClients get { return new IRestClient[] { - new JsonServiceClient(Config.ServiceStackBaseUri), - new JsvServiceClient(Config.ServiceStackBaseUri), - new XmlServiceClient(Config.ServiceStackBaseUri), - }; + new JsonServiceClient(Config.ServiceStackBaseUri), + new JsvServiceClient(Config.ServiceStackBaseUri), + new XmlServiceClient(Config.ServiceStackBaseUri), + }; } } diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/LoadTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/LoadTests.cs index 7496e30026c..e6e1a5b28a9 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/LoadTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/LoadTests.cs @@ -6,7 +6,7 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [Explicit, TestFixture] + [Ignore("Load Test"), TestFixture] public class LoadTests { string BaseUrl = "http://localhost:50000/api/"; diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/MovieServiceTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/MovieServiceTests.cs index a3da852224a..6e3288d8fe6 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/MovieServiceTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/MovieServiceTests.cs @@ -63,7 +63,6 @@ public void Can_create_new_Movie_from_FormData() var formData = NewMovie.ToStringDictionary(); var response = ExecutePath(HttpMethods.Post, "/movies", null, formData, null); - response.PrintDump(); using (var db = DbFactory.Open()) { var lastInsertId = db.LastInsertId(); @@ -77,7 +76,6 @@ public void Can_create_new_Movie_from_FormData() public void Can_create_new_Movie_from_dto() { var response = ExecutePath(HttpMethods.Post, "/movies", null, null, NewMovie); - response.PrintDump(); using (var db = DbFactory.Open()) { var lastInsertId = db.LastInsertId(); @@ -91,7 +89,6 @@ public void Can_create_new_Movie_from_dto() public void Can_POST_to_resetmovies() { var response = ExecutePath(HttpMethods.Post, "/reset-movies"); - response.PrintDump(); using (var db = DbFactory.Open()) { var movies = db.Select<Movie>(); @@ -105,7 +102,6 @@ public void Error_calling_GET_on_resetmovies() try { var response = (ResetMoviesResponse)ExecutePath(HttpMethods.Get, "/reset-movies"); - response.PrintDump(); Assert.Fail("Should throw HTTP errors"); } catch (WebServiceException webEx) diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/ProtoBufServiceTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/ProtoBufServiceTests.cs index d5d89b3f131..853a6f91636 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/ProtoBufServiceTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/ProtoBufServiceTests.cs @@ -1,105 +1,139 @@ using System; using System.Runtime.Serialization; using System.Text; +using System.Threading.Tasks; using NUnit.Framework; using ServiceStack.ProtoBuf; using ServiceStack.Text; namespace ServiceStack.WebHost.IntegrationTests.Tests { - [DataContract] - public class ProtoBufEmail - { - [DataMember(Order = 1)] - public string ToAddress { get; set; } - [DataMember(Order = 2)] - public string FromAddress { get; set; } - [DataMember(Order = 3)] - public string Subject { get; set; } - [DataMember(Order = 4)] - public string Body { get; set; } - [DataMember(Order = 5)] - public byte[] AttachmentData { get; set; } - - public bool Equals(ProtoBufEmail other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return Equals(other.ToAddress, ToAddress) - && Equals(other.FromAddress, FromAddress) - && Equals(other.Subject, Subject) - && Equals(other.Body, Body) - && other.AttachmentData.EquivalentTo(AttachmentData); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (ProtoBufEmail)) return false; - return Equals((ProtoBufEmail) obj); - } - - public override int GetHashCode() - { - unchecked - { - int result = (ToAddress != null ? ToAddress.GetHashCode() : 0); - result = (result*397) ^ (FromAddress != null ? FromAddress.GetHashCode() : 0); - result = (result*397) ^ (Subject != null ? Subject.GetHashCode() : 0); - result = (result*397) ^ (Body != null ? Body.GetHashCode() : 0); - result = (result*397) ^ (AttachmentData != null ? AttachmentData.GetHashCode() : 0); - return result; - } - } - } - - [DataContract] - public class ProtoBufEmailResponse - { - [DataMember(Order = 1)] - public ResponseStatus ResponseStatus { get; set; } - } - - public class ProtoBufEmailService : Service - { + [DataContract] + public class ProtoBufEmail + { + [DataMember(Order = 1)] + public string ToAddress { get; set; } + [DataMember(Order = 2)] + public string FromAddress { get; set; } + [DataMember(Order = 3)] + public string Subject { get; set; } + [DataMember(Order = 4)] + public string Body { get; set; } + [DataMember(Order = 5)] + public byte[] AttachmentData { get; set; } + + public bool Equals(ProtoBufEmail other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Equals(other.ToAddress, ToAddress) + && Equals(other.FromAddress, FromAddress) + && Equals(other.Subject, Subject) + && Equals(other.Body, Body) + && other.AttachmentData.EquivalentTo(AttachmentData); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof(ProtoBufEmail)) return false; + return Equals((ProtoBufEmail)obj); + } + + public override int GetHashCode() + { + unchecked + { + int result = (ToAddress != null ? ToAddress.GetHashCode() : 0); + result = (result * 397) ^ (FromAddress != null ? FromAddress.GetHashCode() : 0); + result = (result * 397) ^ (Subject != null ? Subject.GetHashCode() : 0); + result = (result * 397) ^ (Body != null ? Body.GetHashCode() : 0); + result = (result * 397) ^ (AttachmentData != null ? AttachmentData.GetHashCode() : 0); + return result; + } + } + } + + [DataContract] + public class ProtoBufEmailResponse + { + [DataMember(Order = 1)] + public ResponseStatus ResponseStatus { get; set; } + } + + public class ProtoBufEmailService : Service + { public object Any(ProtoBufEmail request) - { - return request; - } - } - - - [TestFixture] - public class ProtoBufServiceTests - { - [Test] - public void Can_Send_ProtoBuf_request() - { - var client = new ProtoBufServiceClient(Config.ServiceStackBaseUri); - - var request = new ProtoBufEmail { - ToAddress = "to@email.com", - FromAddress = "from@email.com", - Subject = "Subject", - Body = "Body", - AttachmentData = Encoding.UTF8.GetBytes("AttachmentData"), - }; - - try - { - var response = client.Send<ProtoBufEmail>(request); - - Console.WriteLine(response.Dump()); - - Assert.That(response.Equals(request)); - } - catch (WebServiceException webEx) - { - Console.WriteLine(webEx.ResponseDto.Dump()); - Assert.Fail(webEx.Message); - } - } - - } + { + return request; + } + } + + + [TestFixture] + public class ProtoBufServiceTests + { + private const string ListeningOn = Config.ServiceStackBaseUri; + + private static ProtoBufEmail CreateProtoBufEmail() + { + var request = new ProtoBufEmail + { + ToAddress = "to@email.com", + FromAddress = "from@email.com", + Subject = "Subject", + Body = "Body", + AttachmentData = Encoding.UTF8.GetBytes("AttachmentData"), + }; + return request; + } + + [Test] + public void Can_Send_ProtoBuf_request() + { + var client = new ProtoBufServiceClient(ListeningOn) + { + RequestFilter = req => + Assert.That(req.Accept, Is.EqualTo(MimeTypes.ProtoBuf)) + }; + + var request = CreateProtoBufEmail(); + var response = client.Send<ProtoBufEmail>(request); + + response.PrintDump(); + Assert.That(response.Equals(request)); + } + + [Test] + public async Task Can_Send_ProtoBuf_request_Async() + { + var client = new ProtoBufServiceClient(ListeningOn) + { + RequestFilter = req => + Assert.That(req.Accept, Is.EqualTo(MimeTypes.ProtoBuf)) + }; + + var request = CreateProtoBufEmail(); + var response = await client.SendAsync<ProtoBufEmail>(request); + + response.PrintDump(); + Assert.That(response.Equals(request)); + } + + [Test] + public void Does_return_ProtoBuf_when_using_ProtoBuf_Content_Type_and_Wildcard() + { + var bytes = ListeningOn.CombineWith("x-protobuf/reply/ProtoBufEmail") + .PostBytesToUrl(accept: "{0}, */*".Fmt(MimeTypes.ProtoBuf), + requestBody: CreateProtoBufEmail().ToProtoBuf(), + responseFilter: res => Assert.That(res.ContentType, Is.EqualTo(MimeTypes.ProtoBuf))); + + Assert.That(bytes.Length, Is.GreaterThan(0)); + + bytes = ListeningOn.CombineWith("x-protobuf/reply/ProtoBufEmail") + .GetBytesFromUrl(accept: "{0}, */*".Fmt(MimeTypes.ProtoBuf), + responseFilter: res => Assert.That(res.ContentType, Is.EqualTo(MimeTypes.ProtoBuf))); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RawRequestTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RawRequestTests.cs index 3c051621a01..d1d20d610ab 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RawRequestTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RawRequestTests.cs @@ -24,6 +24,13 @@ public class RawRequestResponse public string Result { get; set; } } + [Restrict(RequestAttributes.Xml)] + [Route("/Leads/LeadData/", "POST", Notes = "LMS - DirectApi")] + public class CustomXml : IRequiresRequestStream + { + public Stream RequestStream { get; set; } + } + public class RawRequestService : IService { public object Any(RawRequest request) @@ -37,6 +44,12 @@ public object Any(RawRequestWithParam request) var rawRequest = request.RequestStream.ToUtf8String(); return new RawRequestResponse { Result = request.Path + ":" + request.Param + ":" + rawRequest }; } + + public object Any(CustomXml request) + { + var xml = request.RequestStream.ReadToEnd(); + return xml; + } } [TestFixture] @@ -52,6 +65,16 @@ public void Can_POST_raw_request() Assert.That(response.Result, Is.EqualTo(rawData)); } + [Test] + public void Can_POST_raw_request_to_predefined_route() + { + var rawData = "{\"raw\":\"json\"}"; + var requestUrl = Config.ServiceStackBaseUri + "/json/reply/RawRequest"; + var json = requestUrl.PostJsonToUrl(rawData); + var response = json.FromJson<RawRequestResponse>(); + Assert.That(response.Result, Is.EqualTo(rawData)); + } + [Test] public void Can_POST_raw_request_with_params() { @@ -73,6 +96,28 @@ public void Can_PUT_raw_request() Assert.That(response.Result, Is.EqualTo(rawData)); } + [Test] + public void Can_POST_Custom_XML() + { + var xml = @"<LeadApplications> + <LeadApplication> + <Email>daffy.duck@example.com</Email> + <FirstName>Joey</FirstName> + <MiddleName>Disney</MiddleName> + <LastName>Duck</LastName> + <Street1>1 Disneyland Street</Street1> + <Street2>2 Disneyland Street</Street2> + <City>PAUMA VALLEY</City> + <State>CA</State> + <Zip>92503</Zip> + </LeadApplication> + </LeadApplications>"; + + var requestUrl = Config.ServiceStackBaseUri + "/Leads/LeadData/"; + var responseXml = requestUrl.PostXmlToUrl(xml); + + Assert.That(responseXml, Is.EqualTo(xml)); + } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/ReqtestsTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/ReqtestsTests.cs index 342de3a3991..ba49bb9a124 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/ReqtestsTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/ReqtestsTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestAndPathResolutionTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestAndPathResolutionTests.cs index 42eb22b4bcf..a41207220f1 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestAndPathResolutionTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestAndPathResolutionTests.cs @@ -4,51 +4,44 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class RequestAndPathResolutionTests + [TestFixture] + public class RequestAndPathResolutionTests : TestBase - { - public RequestAndPathResolutionTests() - : base(Config.ServiceStackBaseUri, typeof(ReverseService).Assembly) - { - } - - protected override void Configure(Funq.Container container) { } + { + public RequestAndPathResolutionTests() + : base(Config.ServiceStackBaseUri, typeof(ReverseService).Assembly) + { + } - [SetUp] - public void OnBeforeTest() - { - base.OnBeforeEachTest(); - RegisterConfig(); - } + protected override void Configure(Funq.Container container) { } - private void RegisterConfig() + [SetUp] + public void OnBeforeTest() { - HostContext.CatchAllHandlers.Add(new PredefinedRoutesFeature().ProcessRequest); - HostContext.CatchAllHandlers.Add(new MetadataFeature().ProcessRequest); + base.OnBeforeEachTest(); } - [Test] - public void Can_process_default_request() - { - var request = (EchoRequest)ExecutePath("/Xml/reply/EchoRequest"); - Assert.That(request, Is.Not.Null); - } + [Test] + public void Can_process_default_request() + { + var request = (EchoRequest)ExecutePath("/Xml/reply/EchoRequest"); + Assert.That(request, Is.Not.Null); + } - [Test] - public void Can_process_default_case_insensitive_request() - { - var request = (EchoRequest)ExecutePath("/xml/reply/echorequest"); - Assert.That(request, Is.Not.Null); - } + [Test] + public void Can_process_default_case_insensitive_request() + { + var request = (EchoRequest)ExecutePath("/xml/reply/echorequest"); + Assert.That(request, Is.Not.Null); + } - [Test] - public void Can_process_default_request_with_queryString() - { - var request = (EchoRequest)ExecutePath("/Xml/reply/EchoRequest?Id=1&String=Value"); - Assert.That(request, Is.Not.Null); - Assert.That(request.Id, Is.EqualTo(1)); - Assert.That(request.String, Is.EqualTo("Value")); - } - } + [Test] + public void Can_process_default_request_with_queryString() + { + var request = (EchoRequest)ExecutePath("/Xml/reply/EchoRequest?Id=1&String=Value"); + Assert.That(request, Is.Not.Null); + Assert.That(request.Id, Is.EqualTo(1)); + Assert.That(request.String, Is.EqualTo("Value")); + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestFilterTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestFilterTests.cs index 54bb6812c59..f186e570d63 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestFilterTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestFilterTests.cs @@ -5,72 +5,72 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class RequestFilterTests - { - private const string ServiceClientBaseUri = Config.ServiceStackBaseUri; + [TestFixture] + public class RequestFilterTests + { + private const string ServiceClientBaseUri = Config.ServiceStackBaseUri; - [Test] - public void Does_return_bare_401_StatusCode() - { - try - { - var webRequest = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri - + "/json/reply/RequestFilter?StatusCode=401"); + [Test] + public void Does_return_bare_401_StatusCode() + { + try + { + var webRequest = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + + "/json/reply/RequestFilter?StatusCode=401"); - var webResponse = (HttpWebResponse)webRequest.GetResponse(); - webResponse.Method.Print(); - Assert.Fail("Should throw 401 WebException"); - } - catch (WebException ex) - { + var webResponse = (HttpWebResponse)webRequest.GetResponse(); + webResponse.Method.Print(); + Assert.Fail("Should throw 401 WebException"); + } + catch (WebException ex) + { var httpResponse = (HttpWebResponse)ex.Response; Assert.That(httpResponse.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized)); - } - } + } + } - [Test] - public void Does_return_bare_401_with_AuthRequired_header() - { - try - { - var webRequest = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri - + "/json/reply/RequestFilter?StatusCode=401" - + "&HeaderName=" + HttpHeaders.WwwAuthenticate - + "&HeaderValue=" + "Basic realm=\"Auth Required\"".UrlEncode()); + [Test] + public void Does_return_bare_401_with_AuthRequired_header() + { + try + { + var webRequest = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + + "/json/reply/RequestFilter?StatusCode=401" + + "&HeaderName=" + HttpHeaders.WwwAuthenticate + + "&HeaderValue=" + "Basic realm=\"Auth Required\"".UrlEncode()); - var webResponse = (HttpWebResponse)webRequest.GetResponse(); - webResponse.Method.Print(); - Assert.Fail("Should throw 401 WebException"); - } - catch (WebException ex) - { + var webResponse = (HttpWebResponse)webRequest.GetResponse(); + webResponse.Method.Print(); + Assert.Fail("Should throw 401 WebException"); + } + catch (WebException ex) + { var httpResponse = (HttpWebResponse)ex.Response; Assert.That(httpResponse.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized)); - Assert.That(ex.Response.Headers[HttpHeaders.WwwAuthenticate], - Is.EqualTo("Basic realm=\"Auth Required\"")); - } - } + Assert.That(ex.Response.Headers[HttpHeaders.WwwAuthenticate], + Is.EqualTo("Basic realm=\"Auth Required\"")); + } + } - [Test] - public void Does_return_send_401_for_access_to_ISecure_requests() - { - try - { - var webRequest = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri - + "/json/reply/Secure?SessionId=175BEA29-DC79-4555-BD42-C4DD5D57A004"); + [Test] + public void Does_return_send_401_for_access_to_ISecure_requests() + { + try + { + var webRequest = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + + "/json/reply/Secure?SessionId=175BEA29-DC79-4555-BD42-C4DD5D57A004"); - var webResponse = (HttpWebResponse)webRequest.GetResponse(); - webResponse.Method.Print(); - Assert.Fail("Should throw 401 WebException"); - } - catch (WebException ex) - { + var webResponse = (HttpWebResponse)webRequest.GetResponse(); + webResponse.Method.Print(); + Assert.Fail("Should throw 401 WebException"); + } + catch (WebException ex) + { var httpResponse = (HttpWebResponse)ex.Response; Assert.That(httpResponse.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized)); - } - } - } + } + } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestInfoTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestInfoTests.cs new file mode 100644 index 00000000000..32efd0b0d22 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RequestInfoTests.cs @@ -0,0 +1,95 @@ +#define NET45 +using System.Net; +using NUnit.Framework; +using ServiceStack.Host.Handlers; +using ServiceStack.Text; + +namespace ServiceStack.WebHost.IntegrationTests.Tests +{ + public class RequestInfoServices : Service {} + + public partial class RequestInfoTests + { + public string BaseUrl = Config.ServiceStackBaseUri; + + private RequestInfoResponse GetRequestInfoForPath(string path) + { + var url = BaseUrl.CombineWith(path).AddQueryParam("debug", "requestinfo"); + var json = url.GetJsonFromUrl(); + var info = json.FromJson<RequestInfoResponse>(); + return info; + } + + private void AssertHasContent(string pathInfo, string accept, string containsContent) + { + var url = BaseUrl.CombineWith(pathInfo); + var content = url.GetStringFromUrl(accept: accept); + Assert.That(content, Does.Contain(containsContent)); + } + + [Test] + public void Does_return_expected_content() + { + AssertHasContent("metadata", MimeTypes.Html, "The following operations are supported"); + AssertHasContent("metadata/", MimeTypes.Html, "The following operations are supported"); + AssertHasContent("dir", MimeTypes.Html, "<h1>dir/index.html</h1>"); + AssertHasContent("dir/", MimeTypes.Html, "<h1>dir/index.html</h1>"); + AssertHasContent("dir/sub", MimeTypes.Html, "<h1>dir/sub/index.html</h1>"); + AssertHasContent("dir/sub/", MimeTypes.Html, "<h1>dir/sub/index.html</h1>"); + AssertHasContent("swagger-ui", MimeTypes.Html, "<title>Swagger UI</title>"); + AssertHasContent("swagger-ui/", MimeTypes.Html, "<title>Swagger UI</title>"); + } + + [Test] + public void Does_have_correct_path_info() + { + Assert.That(GetRequestInfoForPath("dir/").PathInfo, Is.EqualTo("/dir/")); + Assert.That(GetRequestInfoForPath("dir/sub/").PathInfo, Is.EqualTo("/dir/sub/")); + Assert.That(GetRequestInfoForPath("dir/sub/").PathInfo, Is.EqualTo("/dir/sub/")); + Assert.That(GetRequestInfoForPath("swagger-ui/").PathInfo, Is.EqualTo("/swagger-ui/")); + } + } + + public partial class RequestInfoTests + { + private void DoesRedirectToRemoveTrailingSlash(string dirWIthoutSlash) + { + BaseUrl.CombineWith(dirWIthoutSlash) + .GetStringFromUrl(accept: MimeTypes.Html, + requestFilter: req => req.AllowAutoRedirect = false, + responseFilter: res => + { + Assert.That(res.StatusCode, Is.EqualTo(HttpStatusCode.Redirect)); + Assert.That(res.Headers[HttpHeaders.Location], + Is.EqualTo(BaseUrl.CombineWith(dirWIthoutSlash + "/"))); + }); + } + + private void DoesRedirectToAddTrailingSlash(string dirWithoutSlash) + { + BaseUrl.CombineWith(dirWithoutSlash) + .GetStringFromUrl(accept: MimeTypes.Html, + requestFilter: req => req.AllowAutoRedirect = false, + responseFilter: res => + { + Assert.That(res.StatusCode, Is.EqualTo(HttpStatusCode.Redirect)); + Assert.That(res.Headers[HttpHeaders.Location], + Is.EqualTo(BaseUrl.CombineWith(dirWithoutSlash.TrimEnd('/')))); + }); + } + + [Test] + public void Does_redirect_dirs_without_trailing_slash() + { + DoesRedirectToRemoveTrailingSlash("dir"); + DoesRedirectToRemoveTrailingSlash("dir/sub"); + DoesRedirectToRemoveTrailingSlash("swagger-ui"); + } + + [Test] + public void Does_redirect_metadata_page_to_without_slash() + { + DoesRedirectToAddTrailingSlash("metadata/"); + } + } + } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestPathResolutionUnitTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestPathResolutionUnitTests.cs index 65136235ad9..2273837ec0a 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestPathResolutionUnitTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestPathResolutionUnitTests.cs @@ -5,45 +5,45 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class RestPathResolutionUnitTests - : TestBase - { - public RestPathResolutionUnitTests() - : base(Config.ServiceStackBaseUri, typeof(ReverseService).Assembly) - { - } - - protected override void Configure(Funq.Container container) - { - - } - - [SetUp] - public void OnBeforeTest() - { - base.OnBeforeEachTest(); - } - - [Test] - public void Can_execute_EchoRequest_rest_path() - { - var request = (EchoRequest)GetRequest("/echo/1/One"); - Assert.That(request, Is.Not.Null); - Assert.That(request.Id, Is.EqualTo(1)); - Assert.That(request.String, Is.EqualTo("One")); - } - - [Test] - public void Can_call_EchoRequest_with_QueryString() - { - var request = (EchoRequest)GetRequest("/echo/1/One?Long=2&Bool=True"); - - Assert.That(request.Id, Is.EqualTo(1)); - Assert.That(request.String, Is.EqualTo("One")); - Assert.That(request.Long, Is.EqualTo(2)); - Assert.That(request.Bool, Is.EqualTo(true)); - } + [TestFixture] + public class RestPathResolutionUnitTests + : TestBase + { + public RestPathResolutionUnitTests() + : base(Config.ServiceStackBaseUri, typeof(ReverseService).Assembly) + { + } + + protected override void Configure(Funq.Container container) + { + + } + + [SetUp] + public void OnBeforeTest() + { + base.OnBeforeEachTest(); + } + + [Test] + public void Can_execute_EchoRequest_rest_path() + { + var request = (EchoRequest)GetRequest("/echo/1/One"); + Assert.That(request, Is.Not.Null); + Assert.That(request.Id, Is.EqualTo(1)); + Assert.That(request.String, Is.EqualTo("One")); + } + + [Test] + public void Can_call_EchoRequest_with_QueryString() + { + var request = (EchoRequest)GetRequest("/echo/1/One?Long=2&Bool=True"); + + Assert.That(request.Id, Is.EqualTo(1)); + Assert.That(request.String, Is.EqualTo("One")); + Assert.That(request.Long, Is.EqualTo(2)); + Assert.That(request.Bool, Is.EqualTo(true)); + } [Test] public void Can_get_empty_BasicWildcard() @@ -68,75 +68,75 @@ public void Can_call_WildCardRequest_with_alternate_matching_WildCard_defined() Assert.That(request.RemainingPath, Is.Null); } - [Test] - public void Can_call_WildCardRequest_WildCard_mapping() - { - var request = (WildCardRequest)GetRequest("/wildcard/1/remaining/path/to/here"); - Assert.That(request.Id, Is.EqualTo(1)); - Assert.That(request.Path, Is.Null); - Assert.That(request.Action, Is.Null); - Assert.That(request.RemainingPath, Is.EqualTo("remaining/path/to/here")); - } - - [Test] - public void Can_call_WildCardRequest_WildCard_mapping_with_QueryString() - { - var request = (WildCardRequest)GetRequest("/wildcard/1/remaining/path/to/here?Action=edit"); - Assert.That(request.Id, Is.EqualTo(1)); - Assert.That(request.Path, Is.Null); - Assert.That(request.Action, Is.EqualTo("edit")); - Assert.That(request.RemainingPath, Is.EqualTo("remaining/path/to/here")); - } - - [Test] - public void Can_call_GET_on_VerbMatch_Services() - { - var request = (VerbMatch1)GetRequest(HttpMethods.Get, "/verbmatch"); - Assert.That(request.Name, Is.Null); - - var request2 = (VerbMatch1)GetRequest(HttpMethods.Get, "/verbmatch/arg"); - Assert.That(request2.Name, Is.EqualTo("arg")); - } - - [Test] - public void Can_call_POST_on_VerbMatch_Services() - { - var request = (VerbMatch2)GetRequest(HttpMethods.Post, "/verbmatch"); - Assert.That(request.Name, Is.Null); - - var request2 = (VerbMatch2)GetRequest(HttpMethods.Post, "/verbmatch/arg"); - Assert.That(request2.Name, Is.EqualTo("arg")); - } - - [Test] - public void Can_call_DELETE_on_VerbMatch_Services() - { - var request = (VerbMatch1)GetRequest(HttpMethods.Delete, "/verbmatch"); - Assert.That(request.Name, Is.Null); - - var request2 = (VerbMatch1)GetRequest(HttpMethods.Delete, "/verbmatch/arg"); - Assert.That(request2.Name, Is.EqualTo("arg")); - } - - [Test] - public void Can_call_PUT_on_VerbMatch_Services() - { - var request = (VerbMatch2)GetRequest(HttpMethods.Put, "/verbmatch"); - Assert.That(request.Name, Is.Null); - - var request2 = (VerbMatch2)GetRequest(HttpMethods.Put, "/verbmatch/arg"); - Assert.That(request2.Name, Is.EqualTo("arg")); - } - - [Test] - public void Can_call_PATCH_on_VerbMatch_Services() - { - var request = (VerbMatch2)GetRequest(HttpMethods.Patch, "/verbmatch"); - Assert.That(request.Name, Is.Null); - - var request2 = (VerbMatch2)GetRequest(HttpMethods.Patch, "/verbmatch/arg"); - Assert.That(request2.Name, Is.EqualTo("arg")); - } - - } + [Test] + public void Can_call_WildCardRequest_WildCard_mapping() + { + var request = (WildCardRequest)GetRequest("/wildcard/1/remaining/path/to/here"); + Assert.That(request.Id, Is.EqualTo(1)); + Assert.That(request.Path, Is.Null); + Assert.That(request.Action, Is.Null); + Assert.That(request.RemainingPath, Is.EqualTo("remaining/path/to/here")); + } + + [Test] + public void Can_call_WildCardRequest_WildCard_mapping_with_QueryString() + { + var request = (WildCardRequest)GetRequest("/wildcard/1/remaining/path/to/here?Action=edit"); + Assert.That(request.Id, Is.EqualTo(1)); + Assert.That(request.Path, Is.Null); + Assert.That(request.Action, Is.EqualTo("edit")); + Assert.That(request.RemainingPath, Is.EqualTo("remaining/path/to/here")); + } + + [Test] + public void Can_call_GET_on_VerbMatch_Services() + { + var request = (VerbMatch1)GetRequest(HttpMethods.Get, "/verbmatch"); + Assert.That(request.Name, Is.Null); + + var request2 = (VerbMatch1)GetRequest(HttpMethods.Get, "/verbmatch/arg"); + Assert.That(request2.Name, Is.EqualTo("arg")); + } + + [Test] + public void Can_call_POST_on_VerbMatch_Services() + { + var request = (VerbMatch2)GetRequest(HttpMethods.Post, "/verbmatch"); + Assert.That(request.Name, Is.Null); + + var request2 = (VerbMatch2)GetRequest(HttpMethods.Post, "/verbmatch/arg"); + Assert.That(request2.Name, Is.EqualTo("arg")); + } + + [Test] + public void Can_call_DELETE_on_VerbMatch_Services() + { + var request = (VerbMatch1)GetRequest(HttpMethods.Delete, "/verbmatch"); + Assert.That(request.Name, Is.Null); + + var request2 = (VerbMatch1)GetRequest(HttpMethods.Delete, "/verbmatch/arg"); + Assert.That(request2.Name, Is.EqualTo("arg")); + } + + [Test] + public void Can_call_PUT_on_VerbMatch_Services() + { + var request = (VerbMatch2)GetRequest(HttpMethods.Put, "/verbmatch"); + Assert.That(request.Name, Is.Null); + + var request2 = (VerbMatch2)GetRequest(HttpMethods.Put, "/verbmatch/arg"); + Assert.That(request2.Name, Is.EqualTo("arg")); + } + + [Test] + public void Can_call_PATCH_on_VerbMatch_Services() + { + var request = (VerbMatch2)GetRequest(HttpMethods.Patch, "/verbmatch"); + Assert.That(request.Name, Is.Null); + + var request2 = (VerbMatch2)GetRequest(HttpMethods.Patch, "/verbmatch/arg"); + Assert.That(request2.Name, Is.EqualTo("arg")); + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestWebServiceTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestWebServiceTests.cs index ff74395483c..b3e56ff3346 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestWebServiceTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestWebServiceTests.cs @@ -9,193 +9,193 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class RestWebServiceTests - : RestsTestBase - { - - [Test] - public void Can_call_EchoRequest_with_AcceptAll() - { - var response = GetWebResponse(ServiceClientBaseUri + "/echo/1/One", "*/*"); - var contents = GetContents(response); - - Assert.That(contents, Is.Not.Null); - Assert.That(contents.Contains("\"id\":1")); - Assert.That(contents.Contains("\"string\":\"One\"")); - } - - [Test] - public void Can_call_EchoRequest_with_AcceptJson() - { - var response = GetWebResponse(ServiceClientBaseUri + "/echo/1/One", MimeTypes.Json); + [TestFixture] + public class RestWebServiceTests + : RestsTestBase + { + + [Test] + public void Can_call_EchoRequest_with_AcceptAll() + { + var response = GetWebResponse(ServiceClientBaseUri + "/echo/1/One", "*/*"); + var contents = GetContents(response); + + Assert.That(contents, Is.Not.Null); + Assert.That(contents.Contains("\"id\":1")); + Assert.That(contents.Contains("\"string\":\"One\"")); + } + + [Test] + public void Can_call_EchoRequest_with_AcceptJson() + { + var response = GetWebResponse(ServiceClientBaseUri + "/echo/1/One", MimeTypes.Json); AssertResponse<EchoRequest>(response, MimeTypes.Json, x => - { - Assert.That(x.Id, Is.EqualTo(1)); - Assert.That(x.String, Is.EqualTo("One")); - }); - } - - [Test] - public void Can_call_EchoRequest_with_AcceptXml() - { + { + Assert.That(x.Id, Is.EqualTo(1)); + Assert.That(x.String, Is.EqualTo("One")); + }); + } + + [Test] + public void Can_call_EchoRequest_with_AcceptXml() + { var response = GetWebResponse(ServiceClientBaseUri + "/echo/1/One", MimeTypes.Xml); AssertResponse<EchoRequest>(response, MimeTypes.Xml, x => - { - Assert.That(x.Id, Is.EqualTo(1)); - Assert.That(x.String, Is.EqualTo("One")); - }); - } - - [Test] - public void Can_call_EchoRequest_with_AcceptJsv() - { + { + Assert.That(x.Id, Is.EqualTo(1)); + Assert.That(x.String, Is.EqualTo("One")); + }); + } + + [Test] + public void Can_call_EchoRequest_with_AcceptJsv() + { var response = GetWebResponse(ServiceClientBaseUri + "/echo/1/One", MimeTypes.Jsv); AssertResponse<EchoRequest>(response, MimeTypes.Jsv, x => - { - Assert.That(x.Id, Is.EqualTo(1)); - Assert.That(x.String, Is.EqualTo("One")); - }); - } - - [Test] - public void Can_call_EchoRequest_with_QueryString() - { + { + Assert.That(x.Id, Is.EqualTo(1)); + Assert.That(x.String, Is.EqualTo("One")); + }); + } + + [Test] + public void Can_call_EchoRequest_with_QueryString() + { var response = GetWebResponse(ServiceClientBaseUri + "/echo/1/One?Long=2&Bool=True", MimeTypes.Json); AssertResponse<EchoRequest>(response, MimeTypes.Json, x => - { - Assert.That(x.Id, Is.EqualTo(1)); - Assert.That(x.String, Is.EqualTo("One")); - Assert.That(x.Long, Is.EqualTo(2)); - Assert.That(x.Bool, Is.EqualTo(true)); - }); - } - - private HttpWebResponse EmulateHttpMethod(string emulateMethod, string useMethod) - { - var webRequest = (HttpWebRequest) WebRequest.Create(ServiceClientBaseUri + "/echomethod"); + { + Assert.That(x.Id, Is.EqualTo(1)); + Assert.That(x.String, Is.EqualTo("One")); + Assert.That(x.Long, Is.EqualTo(2)); + Assert.That(x.Bool, Is.EqualTo(true)); + }); + } + + private HttpWebResponse EmulateHttpMethod(string emulateMethod, string useMethod) + { + var webRequest = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "/echomethod"); webRequest.Accept = MimeTypes.Json; - webRequest.Method = useMethod; - webRequest.Headers[HttpHeaders.XHttpMethodOverride] = emulateMethod; - if (useMethod == HttpMethods.Post) - webRequest.ContentLength = 0; - var response = (HttpWebResponse) webRequest.GetResponse(); - return response; - } - - [Test] - public void Can_emulate_Put_HttpMethod_with_POST() - { - var response = EmulateHttpMethod(HttpMethods.Put, HttpMethods.Post); + webRequest.Method = useMethod; + webRequest.Headers[HttpHeaders.XHttpMethodOverride] = emulateMethod; + if (useMethod == HttpMethods.Post) + webRequest.ContentLength = 0; + var response = (HttpWebResponse)webRequest.GetResponse(); + return response; + } + + [Test] + public void Can_emulate_Put_HttpMethod_with_POST() + { + var response = EmulateHttpMethod(HttpMethods.Put, HttpMethods.Post); AssertResponse<EchoMethodResponse>(response, MimeTypes.Json, x => - Assert.That(x.Result, Is.EqualTo(HttpMethods.Put))); - } + Assert.That(x.Result, Is.EqualTo(HttpMethods.Put))); + } - [Test] - public void Can_emulate_Put_HttpMethod_with_GET() - { - var response = EmulateHttpMethod(HttpMethods.Put, HttpMethods.Get); + [Test] + public void Can_emulate_Put_HttpMethod_with_GET() + { + var response = EmulateHttpMethod(HttpMethods.Put, HttpMethods.Get); AssertResponse<EchoMethodResponse>(response, MimeTypes.Json, x => - Assert.That(x.Result, Is.EqualTo(HttpMethods.Put))); - } + Assert.That(x.Result, Is.EqualTo(HttpMethods.Put))); + } - [Test] - public void Can_emulate_Delete_HttpMethod_with_GET() - { - var response = EmulateHttpMethod(HttpMethods.Delete, HttpMethods.Get); + [Test] + public void Can_emulate_Delete_HttpMethod_with_GET() + { + var response = EmulateHttpMethod(HttpMethods.Delete, HttpMethods.Get); AssertResponse<EchoMethodResponse>(response, MimeTypes.Json, x => - Assert.That(x.Result, Is.EqualTo(HttpMethods.Delete))); - } + Assert.That(x.Result, Is.EqualTo(HttpMethods.Delete))); + } - [Test] - public void Can_call_WildCardRequest_with_alternate_WildCard_defined() - { + [Test] + public void Can_call_WildCardRequest_with_alternate_WildCard_defined() + { var response = GetWebResponse(ServiceClientBaseUri + "/wildcard/1/aPath/edit", MimeTypes.Json); AssertResponse<WildCardRequest>(response, MimeTypes.Json, x => - { - Assert.That(x.Id, Is.EqualTo(1)); - Assert.That(x.Path, Is.EqualTo("aPath")); - Assert.That(x.Action, Is.EqualTo("edit")); - Assert.That(x.RemainingPath, Is.Null); - }); - } - - [Test] - public void Can_call_WildCardRequest_WildCard_mapping() - { + { + Assert.That(x.Id, Is.EqualTo(1)); + Assert.That(x.Path, Is.EqualTo("aPath")); + Assert.That(x.Action, Is.EqualTo("edit")); + Assert.That(x.RemainingPath, Is.Null); + }); + } + + [Test] + public void Can_call_WildCardRequest_WildCard_mapping() + { var response = GetWebResponse(ServiceClientBaseUri + "/wildcard/1/remaining/path/to/here", MimeTypes.Json); AssertResponse<WildCardRequest>(response, MimeTypes.Json, x => - { - Assert.That(x.Id, Is.EqualTo(1)); - Assert.That(x.Path, Is.Null); - Assert.That(x.Action, Is.Null); - Assert.That(x.RemainingPath, Is.EqualTo("remaining/path/to/here")); - }); - } - - [Test] - public void Can_call_WildCardRequest_WildCard_mapping_with_QueryString() - { + { + Assert.That(x.Id, Is.EqualTo(1)); + Assert.That(x.Path, Is.Null); + Assert.That(x.Action, Is.Null); + Assert.That(x.RemainingPath, Is.EqualTo("remaining/path/to/here")); + }); + } + + [Test] + public void Can_call_WildCardRequest_WildCard_mapping_with_QueryString() + { var response = GetWebResponse(ServiceClientBaseUri + "/wildcard/1/remaining/path/to/here?Action=edit", MimeTypes.Json); AssertResponse<WildCardRequest>(response, MimeTypes.Json, x => - { - Assert.That(x.Id, Is.EqualTo(1)); - Assert.That(x.Path, Is.Null); - Assert.That(x.Action, Is.EqualTo("edit")); - Assert.That(x.RemainingPath, Is.EqualTo("remaining/path/to/here")); - }); - } - - [Test(Description = "Test for error processing empty XML request")] - public void Can_call_ResetMovies_mapping_with_empty_Xml_post() - { + { + Assert.That(x.Id, Is.EqualTo(1)); + Assert.That(x.Path, Is.Null); + Assert.That(x.Action, Is.EqualTo("edit")); + Assert.That(x.RemainingPath, Is.EqualTo("remaining/path/to/here")); + }); + } + + [Test(Description = "Test for error processing empty XML request")] + public void Can_call_ResetMovies_mapping_with_empty_Xml_post() + { var response = GetWebResponse(HttpMethods.Post, ServiceClientBaseUri + "/reset-movies", MimeTypes.Xml, 0); AssertResponse<ResetMoviesResponse>(response, MimeTypes.Xml, x => - { - }); - } - - [Test] - public void Can_POST_new_movie_with_FormData() - { - const string formData = "Id=0&ImdbId=tt0110912&Title=Pulp+Fiction&Rating=8.9&Director=Quentin+Tarantino&ReleaseDate=1994-11-24&TagLine=Girls+like+me+don't+make+invitations+like+this+to+just+anyone!&Genres=Crime%2CDrama%2CThriller"; - var formDataBytes = Encoding.UTF8.GetBytes(formData); - var webRequest = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "/movies"); + { + }); + } + + [Test] + public void Can_POST_new_movie_with_FormData() + { + const string formData = "Id=0&ImdbId=tt0110912&Title=Pulp+Fiction&Rating=8.9&Director=Quentin+Tarantino&ReleaseDate=1994-11-24&TagLine=Girls+like+me+don't+make+invitations+like+this+to+just+anyone!&Genres=Crime%2CDrama%2CThriller"; + var formDataBytes = Encoding.UTF8.GetBytes(formData); + var webRequest = (HttpWebRequest)WebRequest.Create(ServiceClientBaseUri + "/movies"); webRequest.Accept = MimeTypes.Json; webRequest.ContentType = MimeTypes.FormUrlEncoded; - webRequest.Method = HttpMethods.Post; - webRequest.ContentLength = formDataBytes.Length; - webRequest.GetRequestStream().Write(formDataBytes, 0, formDataBytes.Length); + webRequest.Method = HttpMethods.Post; + webRequest.ContentLength = formDataBytes.Length; + webRequest.GetRequestStream().Write(formDataBytes, 0, formDataBytes.Length); - try - { - var response = (HttpWebResponse)webRequest.GetResponse(); + try + { + var response = (HttpWebResponse)webRequest.GetResponse(); AssertResponse<MovieResponse>(response, MimeTypes.Json, x => - { - Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.Created)); - Assert.That(response.Headers["Location"], Is.EqualTo(ServiceClientBaseUri + "/movies/" + x.Movie.Id)); - }); - } - catch (WebException webEx) - { - if (webEx.Status == WebExceptionStatus.ProtocolError) - { - var errorResponse = ((HttpWebResponse)webEx.Response); - Console.WriteLine("Error: " + webEx); - Console.WriteLine("Status Code : {0}", errorResponse.StatusCode); - Console.WriteLine("Status Description : {0}", errorResponse.StatusDescription); - - Console.WriteLine("Body:" + new StreamReader(errorResponse.GetResponseStream()).ReadToEnd()); - } - - throw; - } - } - - } + { + Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.Created)); + Assert.That(response.Headers["Location"], Is.EqualTo(ServiceClientBaseUri + "/movies/" + x.Movie.Id)); + }); + } + catch (WebException webEx) + { + if (webEx.Status == WebExceptionStatus.ProtocolError) + { + var errorResponse = ((HttpWebResponse)webEx.Response); + Console.WriteLine("Error: " + webEx); + Console.WriteLine("Status Code : {0}", errorResponse.StatusCode); + Console.WriteLine("Status Description : {0}", errorResponse.StatusDescription); + + Console.WriteLine("Body:" + errorResponse.GetResponseStream().ReadToEnd()); + } + + throw; + } + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestsTestBase.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestsTestBase.cs index 3c5aa06417c..16dca0dc814 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestsTestBase.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RestsTestBase.cs @@ -11,171 +11,171 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - public class RestsTestBase - : TestBase - { - private static readonly ILog Log = LogManager.GetLogger(typeof (RestsTestBase)); - - readonly HostConfig defaultConfig = new HostConfig(); - - public RestsTestBase() - : base(Config.ServiceStackBaseUri, typeof(HelloService).Assembly) - //: base("http://localhost:4000", typeof(HelloService).Assembly) //Uncomment to test on dev web server - { - } - - protected override void Configure(Funq.Container container) { } - - public HttpWebResponse GetWebResponse(string uri, string acceptContentTypes) - { - var webRequest = (HttpWebRequest)WebRequest.Create(uri); - webRequest.Accept = acceptContentTypes; - return (HttpWebResponse)webRequest.GetResponse(); - } - - public static HttpWebResponse GetWebResponse(string httpMethod, string uri, string contentType, int contentLength) - { - var webRequest = (HttpWebRequest)WebRequest.Create(uri); - webRequest.Accept = contentType; - webRequest.ContentType = contentType; - webRequest.Method = HttpMethods.Post; - webRequest.ContentLength = contentLength; - return (HttpWebResponse)webRequest.GetResponse(); - } - - public static string GetContents(WebResponse webResponse) - { - using (var stream = webResponse.GetResponseStream()) - { - var contents = new StreamReader(stream).ReadToEnd(); - return contents; - } - } - - public T DeserializeContents<T>(WebResponse webResponse) - { - var contentType = webResponse.ContentType ?? defaultConfig.DefaultContentType; - return DeserializeContents<T>(webResponse, contentType); - } - - private static T DeserializeContents<T>(WebResponse webResponse, string contentType) - { - try - { - var contents = GetContents(webResponse); - var result = DeserializeResult<T>(webResponse, contents, contentType); - return result; - } - catch (WebException webEx) - { - if (webEx.Status == WebExceptionStatus.ProtocolError) - { - var errorResponse = ((HttpWebResponse)webEx.Response); - Log.Error(webEx); - Log.DebugFormat("Status Code : {0}", errorResponse.StatusCode); - Log.DebugFormat("Status Description : {0}", errorResponse.StatusDescription); - - try - { - using (var stream = errorResponse.GetResponseStream()) - { - var response = ContentTypes.Instance.DeserializeFromStream(contentType, typeof(T), stream); - return (T)response; - } - } - catch (WebException) - { - // Oh, well, we tried - throw; - } - } - - throw; - } - } - - public void AssertResponse(HttpWebResponse response, string contentType) - { - var statusCode = (int)response.StatusCode; - Assert.That(statusCode, Is.LessThan(400)); - Assert.That(response.ContentType.StartsWith(contentType)); - } - - public void AssertErrorResponse<T>(HttpWebResponse webResponse, HttpStatusCode statusCode, Func<T, ResponseStatus> responseStatusFn) - { - Assert.That(webResponse.StatusCode, Is.EqualTo(statusCode)); - var response = DeserializeContents<T>(webResponse); - Assert.That(responseStatusFn(response).ErrorCode, Is.Not.Null); - } - - public void AssertErrorResponse<T>(HttpWebResponse webResponse, HttpStatusCode statusCode, Func<T, ResponseStatus> responseStatusFn, string errorCode) - { - Assert.That(webResponse.StatusCode, Is.EqualTo(statusCode)); - var response = DeserializeContents<T>(webResponse); - Assert.That(responseStatusFn(response).ErrorCode, Is.EqualTo(errorCode)); - } - - public void AssertErrorResponse<T>(HttpWebResponse webResponse, HttpStatusCode statusCode) - where T : IHasResponseStatus - { - Assert.That(webResponse.StatusCode, Is.EqualTo(statusCode)); - var response = DeserializeContents<T>(webResponse); - Assert.That(response.ResponseStatus.ErrorCode, Is.Not.Null); - } - - public void AssertErrorResponse<T>(HttpWebResponse webResponse, HttpStatusCode statusCode, string errorCode) - where T : IHasResponseStatus - { - Assert.That(webResponse.StatusCode, Is.EqualTo(statusCode)); - var response = DeserializeContents<T>(webResponse); - Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(errorCode)); - } - - public void AssertResponse<T>(HttpWebResponse response, Action<T> customAssert) - { - var contentType = response.ContentType ?? defaultConfig.DefaultContentType; - - AssertResponse(response, contentType); - - var result = DeserializeContents<T>(response, contentType); - - customAssert(result); - } - - public void AssertResponse<T>(HttpWebResponse response, string contentType, Action<T> customAssert) - { - contentType = contentType ?? defaultConfig.DefaultContentType; - - AssertResponse(response, contentType); - - var result = DeserializeContents<T>(response, contentType); - - customAssert(result); - } - - private static T DeserializeResult<T>(WebResponse response, string contents, string contentType) - { - T result; - switch (contentType) - { + public class RestsTestBase + : TestBase + { + private static readonly ILog Log = LogManager.GetLogger(typeof(RestsTestBase)); + + readonly HostConfig defaultConfig = new HostConfig(); + + public RestsTestBase() + : base(Config.ServiceStackBaseUri, typeof(HelloService).Assembly) + //: base("http://localhost:4000", typeof(HelloService).Assembly) //Uncomment to test on dev web server + { + } + + protected override void Configure(Funq.Container container) { } + + public HttpWebResponse GetWebResponse(string uri, string acceptContentTypes) + { + var webRequest = (HttpWebRequest)WebRequest.Create(uri); + webRequest.Accept = acceptContentTypes; + return (HttpWebResponse)webRequest.GetResponse(); + } + + public static HttpWebResponse GetWebResponse(string httpMethod, string uri, string contentType, int contentLength) + { + var webRequest = (HttpWebRequest)WebRequest.Create(uri); + webRequest.Accept = contentType; + webRequest.ContentType = contentType; + webRequest.Method = HttpMethods.Post; + webRequest.ContentLength = contentLength; + return (HttpWebResponse)webRequest.GetResponse(); + } + + public static string GetContents(WebResponse webResponse) + { + using (var stream = webResponse.GetResponseStream()) + { + var contents = stream.ReadToEnd(); + return contents; + } + } + + public T DeserializeContents<T>(WebResponse webResponse) + { + var contentType = webResponse.ContentType ?? defaultConfig.DefaultContentType; + return DeserializeContents<T>(webResponse, contentType); + } + + private static T DeserializeContents<T>(WebResponse webResponse, string contentType) + { + try + { + var contents = GetContents(webResponse); + var result = DeserializeResult<T>(webResponse, contents, contentType); + return result; + } + catch (WebException webEx) + { + if (webEx.Status == WebExceptionStatus.ProtocolError) + { + var errorResponse = ((HttpWebResponse)webEx.Response); + Log.Error(webEx); + Log.DebugFormat("Status Code : {0}", errorResponse.StatusCode); + Log.DebugFormat("Status Description : {0}", errorResponse.StatusDescription); + + try + { + using (var stream = errorResponse.GetResponseStream()) + { + var response = ContentTypes.Instance.DeserializeFromStream(contentType, typeof(T), stream); + return (T)response; + } + } + catch (WebException) + { + // Oh, well, we tried + throw; + } + } + + throw; + } + } + + public void AssertResponse(HttpWebResponse response, string contentType) + { + var statusCode = (int)response.StatusCode; + Assert.That(statusCode, Is.LessThan(400)); + Assert.That(response.ContentType.StartsWith(contentType)); + } + + public void AssertErrorResponse<T>(HttpWebResponse webResponse, HttpStatusCode statusCode, Func<T, ResponseStatus> responseStatusFn) + { + Assert.That(webResponse.StatusCode, Is.EqualTo(statusCode)); + var response = DeserializeContents<T>(webResponse); + Assert.That(responseStatusFn(response).ErrorCode, Is.Not.Null); + } + + public void AssertErrorResponse<T>(HttpWebResponse webResponse, HttpStatusCode statusCode, Func<T, ResponseStatus> responseStatusFn, string errorCode) + { + Assert.That(webResponse.StatusCode, Is.EqualTo(statusCode)); + var response = DeserializeContents<T>(webResponse); + Assert.That(responseStatusFn(response).ErrorCode, Is.EqualTo(errorCode)); + } + + public void AssertErrorResponse<T>(HttpWebResponse webResponse, HttpStatusCode statusCode) + where T : IHasResponseStatus + { + Assert.That(webResponse.StatusCode, Is.EqualTo(statusCode)); + var response = DeserializeContents<T>(webResponse); + Assert.That(response.ResponseStatus.ErrorCode, Is.Not.Null); + } + + public void AssertErrorResponse<T>(HttpWebResponse webResponse, HttpStatusCode statusCode, string errorCode) + where T : IHasResponseStatus + { + Assert.That(webResponse.StatusCode, Is.EqualTo(statusCode)); + var response = DeserializeContents<T>(webResponse); + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(errorCode)); + } + + public void AssertResponse<T>(HttpWebResponse response, Action<T> customAssert) + { + var contentType = response.ContentType ?? defaultConfig.DefaultContentType; + + AssertResponse(response, contentType); + + var result = DeserializeContents<T>(response, contentType); + + customAssert(result); + } + + public void AssertResponse<T>(HttpWebResponse response, string contentType, Action<T> customAssert) + { + contentType = contentType ?? defaultConfig.DefaultContentType; + + AssertResponse(response, contentType); + + var result = DeserializeContents<T>(response, contentType); + + customAssert(result); + } + + private static T DeserializeResult<T>(WebResponse response, string contents, string contentType) + { + T result; + switch (contentType) + { case MimeTypes.Xml: - result = XmlSerializer.DeserializeFromString<T>(contents); - break; + result = XmlSerializer.DeserializeFromString<T>(contents); + break; case MimeTypes.Json: case MimeTypes.Json + ContentFormat.Utf8Suffix: - result = JsonSerializer.DeserializeFromString<T>(contents); - break; + result = JsonSerializer.DeserializeFromString<T>(contents); + break; case MimeTypes.Jsv: - result = TypeSerializer.DeserializeFromString<T>(contents); - break; + result = TypeSerializer.DeserializeFromString<T>(contents); + break; - default: - throw new NotSupportedException(response.ContentType); - } - return result; - } + default: + throw new NotSupportedException(response.ContentType); + } + return result; + } - } + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/RouteTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RouteTests.cs new file mode 100644 index 00000000000..9e6a679b891 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/RouteTests.cs @@ -0,0 +1,55 @@ +using NUnit.Framework; +using ServiceStack.Host.Handlers; + +namespace ServiceStack.WebHost.IntegrationTests.Tests +{ + [Route("/routeinfo/{Path*}")] + public class GetRouteInfo + { + public string Path { get; set; } + } + + public class GetRouteInfoResponse + { + public string BaseUrl { get; set; } + public string ResolvedUrl { get; set; } + } + + public class RouteInfoService : Service + { + public object Any(GetRouteInfo request) + { + return new GetRouteInfoResponse + { + BaseUrl = base.Request.GetBaseUrl(), + ResolvedUrl = base.Request.ResolveAbsoluteUrl("~/resolved") + }; + } + } + + public class RouteInfoPathTests + { + [Test] + public void ApiPath_returns_BaseUrl() + { + var url = Config.AbsoluteBaseUri.AppendPath("api"); + + var reqInfoResponse = url.AddQueryParam("debug", "requestinfo") + .GetJsonFromUrl().FromJson<RequestInfoResponse>(); + Assert.That(reqInfoResponse.ApplicationBaseUrl, Is.EqualTo(url)); + Assert.That(reqInfoResponse.ResolveAbsoluteUrl, Is.EqualTo(url + "/resolve")); + + var response = url.CombineWith("/routeinfo").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/routeinfo/dir").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + + response = url.CombineWith("/routeinfo/dir/sub").GetJsonFromUrl().FromJson<GetRouteInfoResponse>(); + Assert.That(response.BaseUrl, Is.EqualTo(url)); + Assert.That(response.ResolvedUrl, Is.EqualTo(url.AppendPath("resolved"))); + } + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/SessionTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/SessionTests.cs index 2ee2a1ddb0a..1805f541a4e 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/SessionTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/SessionTests.cs @@ -1,18 +1,45 @@ using System; +using System.IO; +using System.Web; using NUnit.Framework; +using ServiceStack.Testing; namespace ServiceStack.WebHost.IntegrationTests.Tests { - [TestFixture] - public class SessionTests - { - [Test] + [TestFixture] + public class SessionTests + { + [Test] public void Adhoc() { - var appliesTo = ApplyTo.Post | ApplyTo.Put; - Console.WriteLine(appliesTo.ToString()); - Console.WriteLine(appliesTo.ToDescription()); - Console.WriteLine(string.Join(", ", appliesTo.ToList().ToArray())); + var appliesTo = ApplyTo.Post | ApplyTo.Put; + Console.WriteLine(appliesTo.ToString()); + Console.WriteLine(appliesTo.ToDescription()); + Console.WriteLine(string.Join(", ", appliesTo.ToList().ToArray())); } - } + + [Test] + public void Can_mock_Session_when_accessed_via_HttpRequest_Context() + { + using (new BasicAppHost().Init()) + { + HttpContext.Current = new HttpContext( + new HttpRequest(null, "http://example.com", null), + new HttpResponse(new StringWriter())); + + HttpContext.Current.Items[Keywords.Session] = + new AuthUserSession + { + Id = "mock-session-id", + }; + + var httpReq = HttpContext.Current.ToRequest(); + var session = httpReq.GetSession(); + + Assert.That(session, Is.Not.Null); + Assert.That(session.Id, Is.EqualTo("mock-session-id")); + } + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/SoapTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/SoapTests.cs new file mode 100644 index 00000000000..2e2d6c6c007 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/SoapTests.cs @@ -0,0 +1,136 @@ +using System; +using System.Runtime.Remoting; +using System.Runtime.Serialization; +using NUnit.Framework; +using ServiceStack.Text; +using ServiceStack.WebHost.IntegrationTests.Services; + +namespace ServiceStack.WebHost.IntegrationTests.Tests +{ + [TestFixture] + public class SoapTests + { + [Test] + public void Does_call_Hello_Service() + { + var client = new Soap12ServiceClient(Config.ServiceStackBaseUri); + + var response = client.Send<HelloResponse>(new Hello { Name = "World" }); + + Assert.That(response.Result, Is.EqualTo("Hello, World")); + } + + [Test] + public void Soap12_Service_does_not_return_BOM() + { + var soapBody = @" +<s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" +xmlns:a=""http://www.w3.org/2005/08/addressing""> +<s:Header> + <a:Action s:mustUnderstand=""1"">Hello</a:Action> + <a:MessageID>urn:uuid:be5fddae-9fa3-4d5f-bc31-6ee4980d74f1</a:MessageID> + <a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo> + <a:To s:mustUnderstand=""1"">http://macbook/api/Soap12</a:To> +</s:Header> +<s:Body> + <Hello xmlns=""http://schemas.servicestack.net/types"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""> + <Name>World</Name> + </Hello> +</s:Body> +</s:Envelope>"; + + var url = Config.ServiceStackBaseUri.AppendPath("Soap12"); + var soapBytes = url.PostBytesToUrl(requestBody: soapBody.ToUtf8Bytes(), + contentType: "application/soap+xml; charset=utf-8"); + + //http://en.wikipedia.org/wiki/Byte_order_mark + //BitConverter.ToString(soapBytes).Print(); //print hex + + byte firstByte = soapBytes[0]; + Assert.That(firstByte, Is.Not.EqualTo(239)); //UTF-8 BOM + Assert.That(firstByte, Is.EqualTo((int)'<')); + + var soapXml = soapBytes.FromUtf8Bytes(); + + Assert.That(soapXml, Does.StartWith(@"<?xml version=""1.0"" encoding=""utf-8""?><s:Envelope")); + } + + [Test] + public void Can_send_SoapRequest() + { + var client = new Soap12ServiceClient(Config.ServiceStackBaseUri); +// var client = new Soap12ServiceClient("http://test.servicestack.net"); + + var request = new GetStuff { + SummaryDate = DateTime.Parse("2018-04-26"), + SummaryEndDate = DateTime.Parse("2018-04-26"), + Symbol = "TOU", + Email = "Guy.Smiley@myCompany.net", + IsEnabled = true, + }; + + var response = client.Send(request); + + Assert.That(response.SummaryDate, Is.EqualTo(request.SummaryDate)); + Assert.That(response.SummaryEndDate, Is.EqualTo(request.SummaryEndDate)); + Assert.That(response.Symbol, Is.EqualTo(request.Symbol)); + Assert.That(response.Email, Is.EqualTo(request.Email)); + Assert.That(response.IsEnabled, Is.EqualTo(request.IsEnabled)); + } + } + + [DataContract(Namespace = "http://schemas.servicestack.net/types")] + [Route("/Stuff")] + public class GetStuff : IReturn<GetStuffResponse> + { + [DataMember] + [ApiMember(Name = "Summary Date", + DataType = "DateTime", + IsRequired = false)] + public DateTime? SummaryDate { get; set; } + + [DataMember] + [ApiMember(Name = "Summary End Date", + DataType = "DateTime", + IsRequired = false)] + public DateTime? SummaryEndDate { get; set; } + + [DataMember] + [ApiMember(Name = "Symbol", + DataType = "string", + IsRequired = false)] + public string Symbol { get; set; } + + [DataMember] + [ApiMember(Name = "Email", + DataType = "string", + IsRequired = false)] + public string Email { get; set; } + + [DataMember] + [ApiMember(Name = "Is Enabled", + DataType = "bool", + IsRequired = false)] + public bool? IsEnabled { get; set; } + } + + [DataContract(Namespace = "http://schemas.servicestack.net/types")] + public class GetStuffResponse + { + [DataMember] + public DateTime? SummaryDate { get; set; } + [DataMember] + public DateTime? SummaryEndDate { get; set; } + [DataMember] + public string Symbol { get; set; } + [DataMember] + public string Email { get; set; } + [DataMember] + public bool? IsEnabled { get; set; } + } + + public class SoapTestServices : Service + { + public object Any(GetStuff request) => request.ConvertTo<GetStuffResponse>(); + } +} \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/UniqueRequestTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/UniqueRequestTests.cs index 4668beb36e8..d1853119d1e 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/UniqueRequestTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/UniqueRequestTests.cs @@ -36,7 +36,7 @@ public class UniqueRequestTests private const string BaseUri = Config.ServiceStackBaseUri; [Test] - [Explicit("ASP.NET does not allow invalid chars see http://stackoverflow.com/questions/13691829/path-parameters-w-url-unfriendly-characters")] + [Ignore("ASP.NET does not allow invalid chars see http://stackoverflow.com/questions/13691829/path-parameters-w-url-unfriendly-characters")] public void Can_handle_encoded_chars() { var response = BaseUri.CombineWith("request/123%20456").GetStringFromUrl(); diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/VirtualPathTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/VirtualPathTests.cs index 18d43ec921a..5d50be4a198 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/VirtualPathTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/VirtualPathTests.cs @@ -1,8 +1,10 @@ -// Copyright (c) Service Stack LLC. All Rights Reserved. +// Copyright (c) ServiceStack, Inc. All Rights Reserved. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt using NUnit.Framework; +using ServiceStack.Text; +using ServiceStack.WebHost.IntegrationTests.Services; namespace ServiceStack.WebHost.IntegrationTests.Tests { @@ -57,43 +59,53 @@ public void Can_download_default_document_at_root_directory() public void Can_download_ServiceStack_Template_IndexOperations() { var contents = "{0}/metadata".Fmt(ServiceStackBaseUri).GetStringFromUrl(); - Assert.That(contents, Is.StringContaining("The following operations are supported.")); + Assert.That(contents, Does.Contain("The following operations are supported.")); } [Test] public void Can_download_File_Template_OperationControl() { var contents = "{0}/json/metadata?op=Hello".Fmt(ServiceStackBaseUri).GetStringFromUrl(); - Assert.That(contents, Is.StringContaining("(File Resource)")); + Assert.That(contents, Does.Contain("(File Resource)")); } [Test] public void Can_download_EmbeddedResource_Template_HtmlFormat() { var contents = "{0}/hello".Fmt(ServiceStackBaseUri).GetStringFromUrl(); - Assert.That(contents, Is.StringContaining("(Embedded Resource)")); + Assert.That(contents, Does.Contain("(Embedded Resource)")); } [Test] public void Can_get_service_matching_api_prefix() { var contents = "{0}/gettestapi".Fmt(ServiceStackBaseUri).GetStringFromUrl(); - Assert.That(contents, Is.StringContaining("GetTestapi")); + Assert.That(contents, Does.Contain("GetTestapi")); } [Test] public void Can_get_swagger_urls() { var contents = "{0}/swagger-ui/".Fmt(ServiceStackBaseUri).GetStringFromUrl(); - Assert.That(contents, Is.StringContaining(ServiceStackBaseUri)); + Assert.That(contents, Does.Contain(ServiceStackBaseUri)); - contents = "{0}/swagger-ui-bootstrap/".Fmt(ServiceStackBaseUri).GetStringFromUrl(); - Assert.That(contents, Is.StringContaining(ServiceStackBaseUri)); + contents = "{0}/api/openapi".Fmt(ServiceStackBaseUri).GetJsonFromUrl(); + Assert.That(contents, Does.Contain("ServiceStack WebHost IntegrationTests")); + } + + [Test] + public void Can_call_template_Service() + { + var client = new JsonServiceClient(ServiceStackBaseUri); + + var postResponse = client.Post(new PostTemplateRequest { Template = "foo" }); + Assert.That(postResponse.PostResult, Is.EqualTo("foo")); + + var getResponse = client.Get(new GetTemplatesRequest { Name = "bar" }); + Assert.That(getResponse.GetResult, Is.EqualTo("bar")); - contents = "{0}/resources".Fmt(ServiceStackBaseUri).GetStringFromUrl(); - Assert.That(contents, Is.StringContaining("/resource/swagger")); - contents = "{0}/resource/swagger".Fmt(ServiceStackBaseUri).GetStringFromUrl(); - Assert.That(contents, Is.StringContaining("SwaggerNestedModel")); + var getSingleResponse = client.Get(new GetTemplateRequest { Name = "baz" }); + Assert.That(getSingleResponse.GetSingleResult, Is.EqualTo("baz")); } } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Tests/WebServicesTests.cs b/tests/ServiceStack.WebHost.IntegrationTests/Tests/WebServicesTests.cs index 2ef67934691..51fa69b2939 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Tests/WebServicesTests.cs +++ b/tests/ServiceStack.WebHost.IntegrationTests/Tests/WebServicesTests.cs @@ -1,5 +1,9 @@ using System; using System.Collections.Generic; +using System.Net; +using System.Runtime.Serialization; +using System.ServiceModel.Channels; +using System.Xml; using NUnit.Framework; using ServiceStack.Common.Tests; using ServiceStack.Text; @@ -8,66 +12,74 @@ namespace ServiceStack.WebHost.IntegrationTests.Tests { - /// <summary> - /// This base class executes all Web Services ignorant of the endpoints its hosted on. - /// The same tests below are re-used by the Unit and Integration TestFixture's declared below - /// </summary> - [TestFixture] - public abstract class WebServicesTests - : TestBase - { - private const string TestString = "ServiceStack"; - - protected WebServicesTests() - : base(Config.ServiceStackBaseUri, typeof(ReverseService).Assembly) - { - } - - protected override void Configure(Funq.Container container) { } - - [Test] - public void Does_Execute_ReverseService() - { - var client = CreateNewServiceClient(); - var response = client.Send<ReverseResponse>( - new Reverse { Value = TestString }); - - var expectedValue = ReverseService.Execute(TestString); - Assert.That(response.Result, Is.EqualTo(expectedValue)); - } - - [Test] - public void Does_Execute_Rot13Service() - { - var client = CreateNewServiceClient(); - var response = client.Send<Rot13Response>(new Rot13 { Value = TestString }); - - var expectedValue = TestString.ToRot13(); - Assert.That(response.Result, Is.EqualTo(expectedValue)); - } - - [Test] - public void Can_Handle_Exception_from_AlwaysThrowService() - { - var client = CreateNewServiceClient(); - try - { - var response = client.Send<AlwaysThrowsResponse>( - new AlwaysThrows { Value = TestString }); - - response.PrintDump(); - Assert.Fail("Should throw HTTP errors"); - } - catch (WebServiceException webEx) - { - var response = (AlwaysThrowsResponse) webEx.ResponseDto; - var expectedError = AlwaysThrowsService.GetErrorMessage(TestString); - Assert.That(response.ResponseStatus.ErrorCode, - Is.EqualTo(typeof(NotImplementedException).Name)); - Assert.That(response.ResponseStatus.Message, - Is.EqualTo(expectedError)); - } - } + /// <summary> + /// This base class executes all Web Services ignorant of the endpoints its hosted on. + /// The same tests below are re-used by the Unit and Integration TestFixture's declared below + /// </summary> + [TestFixture] + public abstract class WebServicesTests + : TestBase + { + private const string TestString = "ServiceStack"; + + protected WebServicesTests() + : base(Config.ServiceStackBaseUri, typeof(ReverseService).Assembly) + { + } + + protected override void Configure(Funq.Container container) { } + + [Test] + public void Does_Execute_ReverseService() + { + var client = CreateNewServiceClient(); + var response = client.Send<ReverseResponse>( + new Reverse { Value = TestString }); + + var expectedValue = ReverseService.Execute(TestString); + Assert.That(response.Result, Is.EqualTo(expectedValue)); + } + + [Test] + public void Does_Execute_Rot13Service() + { + var client = CreateNewServiceClient(); + var response = client.Send<Rot13Response>(new Rot13 { Value = TestString }); + + var expectedValue = TestString.ToRot13(); + Assert.That(response.Result, Is.EqualTo(expectedValue)); + } + + [Test] + public void Does_Execute_AddInts() + { + var client = CreateNewServiceClient(); + var response = client.Send<AddIntsResponse>(new AddInts { A = 1, B = 2 }); + + Assert.That(response.Result, Is.EqualTo(3)); + } + + [Test] + public void Can_Handle_Exception_from_AlwaysThrowService() + { + var client = CreateNewServiceClient(); + try + { + var response = client.Send<AlwaysThrowsResponse>( + new AlwaysThrows { Value = TestString }); + + Assert.Fail("Should throw HTTP errors"); + } + catch (WebServiceException webEx) + { + var response = (AlwaysThrowsResponse)webEx.ResponseDto; + var expectedError = AlwaysThrowsService.GetErrorMessage(TestString); + Assert.That(response.ResponseStatus.ErrorCode, + Is.EqualTo(typeof(NotImplementedException).Name)); + Assert.That(response.ResponseStatus.Message, + Is.EqualTo(expectedError)); + } + } [Test] public void Can_Handle_Exception_from_AlwaysThrowsList_with_GET_route() @@ -78,7 +90,6 @@ public void Can_Handle_Exception_from_AlwaysThrowsList_with_GET_route() { var response = client.Get<List<AlwaysThrows>>("/throwslist/404/{0}".Fmt(TestString)); - response.PrintDump(); Assert.Fail("Should throw HTTP errors"); } catch (WebServiceException webEx) @@ -103,7 +114,6 @@ public void Can_Handle_Exception_from_AlwaysThrowsValidation() var response = client.Send<List<AlwaysThrows>>( new AlwaysThrowsValidation()); - response.PrintDump(); Assert.Fail("Should throw HTTP errors"); } catch (WebServiceException webEx) @@ -111,10 +121,10 @@ public void Can_Handle_Exception_from_AlwaysThrowsValidation() var response = (ErrorResponse)webEx.ResponseDto; var status = response.ResponseStatus; Assert.That(status.ErrorCode, Is.EqualTo("NotEmpty")); - Assert.That(status.Message, Is.EqualTo("'Value' should not be empty.")); + Assert.That(status.Message, Is.EqualTo("'Value' must not be empty.")); Assert.That(status.Errors[0].ErrorCode, Is.EqualTo("NotEmpty")); Assert.That(status.Errors[0].FieldName, Is.EqualTo("Value")); - Assert.That(status.Errors[0].Message, Is.EqualTo("'Value' should not be empty.")); + Assert.That(status.Errors[0].Message, Is.EqualTo("'Value' must not be empty.")); } } @@ -129,62 +139,132 @@ public void Request_items_are_preserved_between_filters() } - /// <summary> - /// Unit tests simulates an in-process ServiceStack host where all services - /// are executed all in-memory so DTO's are not even serialized. - /// </summary> - public class UnitTests : WebServicesTests - { - public UnitTests() - { - AppHost.Container.RegisterValidators(typeof(AlwaysThrowsValidator).Assembly); + /// <summary> + /// Unit tests simulates an in-process ServiceStack host where all services + /// are executed all in-memory so DTO's are not even serialized. + /// </summary> + public class UnitTests : WebServicesTests + { + public UnitTests() + { + AppHost.Container.RegisterValidators(typeof(AlwaysThrowsValidator).Assembly); AppHost.LoadPlugin(new ValidationFeature()); - } + } - protected override IServiceClient CreateNewServiceClient() - { + protected override IServiceClient CreateNewServiceClient() + { return new DirectServiceClient(this, AppHost.ServiceController); } - } - - public class XmlIntegrationTests : WebServicesTests - { - protected override IServiceClient CreateNewServiceClient() - { - return new XmlServiceClient(ServiceClientBaseUri); - } - } - - public class JsonIntegrationTests : WebServicesTests - { - protected override IServiceClient CreateNewServiceClient() - { - return new JsonServiceClient(ServiceClientBaseUri); - } - } - - public class JsvIntegrationTests : WebServicesTests - { - protected override IServiceClient CreateNewServiceClient() - { - return new JsvServiceClient(ServiceClientBaseUri); - } - } - - public class Soap11IntegrationTests : WebServicesTests - { - protected override IServiceClient CreateNewServiceClient() - { - return new Soap11ServiceClient(ServiceClientBaseUri); - } - } - - public class Soap12IntegrationTests : WebServicesTests - { - protected override IServiceClient CreateNewServiceClient() - { - return new Soap12ServiceClient(ServiceClientBaseUri); - } - } + } + + public class XmlIntegrationTests : WebServicesTests + { + protected override IServiceClient CreateNewServiceClient() + { + return new XmlServiceClient(ServiceClientBaseUri); + } + } + + public class JsonIntegrationTests : WebServicesTests + { + protected override IServiceClient CreateNewServiceClient() + { + return new JsonServiceClient(ServiceClientBaseUri); + } + } + + public class JsvIntegrationTests : WebServicesTests + { + protected override IServiceClient CreateNewServiceClient() + { + return new JsvServiceClient(ServiceClientBaseUri); + } + } + public class Soap11IntegrationTests : WebServicesTests + { + protected override IServiceClient CreateNewServiceClient() + { + return new Soap11ServiceClient(ServiceClientBaseUri); + } + } + + public class Soap12IntegrationTests : WebServicesTests + { + protected override IServiceClient CreateNewServiceClient() + { + return new Soap12ServiceClient(ServiceClientBaseUri); +// return new Soap12ServiceClient("http://test.servicestack.net"); + } + + [Test] + public void Call_AddInts() + { + var soap = @"<?xml version=""1.0"" encoding=""UTF-8""?> +<s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" xmlns:a=""http://www.w3.org/2005/08/addressing""> + <s:Header> + <a:Action s:mustUnderstand=""1"">AddInts</a:Action> + <a:MessageID>urn:uuid:e6be43e0-c120-4ba8-920e-7ecaa1823fd2</a:MessageID> + <a:ReplyTo> + <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address> + </a:ReplyTo> + <a:To s:mustUnderstand=""1"">http://localhost:50000/api/Soap12</a:To> + </s:Header> + <s:Body> + <AddInts xmlns=""http://schemas.servicestack.net/types"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""> + <A>1</A> + <B>2</B> + </AddInts> + </s:Body> +</s:Envelope>"; + + var responseXml = ServiceClientBaseUri.CombineWith("/soap12") + .PostToUrl(soap, requestFilter:req => req.ContentType = "application/soap+xml; charset=utf-8"); + + responseXml.Print(); + Assert.That(responseXml, Does.Contain("<Result>3</Result>")); + } + + [Test] + public void Sending_invalid_request_returns_invalid_response() + { + var soap = @"<?xml version=""1.0"" encoding=""UTF-8""?> +<s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" xmlns:a=""http://www.w3.org/2005/08/addressing""> + <s:Header> + <a:Action s:mustUnderstand=""1"">AddInts</a:Action> + <a:MessageID>urn:uuid:e6be43e0-c120-4ba8-920e-7ecaa1823fd2</a:MessageID> + <a:ReplyTo> + <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address> + </a:ReplyTo> + <a:To s:mustUnderstand=""1"">http://localhost:50000/api/Soap12</a:To> + </s:Header> + <s:Body> + <AddInts xmlns=""http://schemas.servicestack.net/types"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""> + <A>not a</A> + <B>number</B> + </AddInts> + </s:Body> +</s:Envelope>"; + + var responseXml = ServiceClientBaseUri.CombineWith("/soap12") + .PostToUrl(soap, requestFilter: req => req.ContentType = "application/soap+xml; charset=utf-8"); + + var doc = new XmlDocument(); + doc.LoadXml(responseXml); + + var responseMsg = Message.CreateMessage(new XmlNodeReader(doc), int.MaxValue, + MessageVersion.Soap12WSAddressingAugust2004); + + using (var reader = responseMsg.GetReaderAtBodyContents()) + { + var bodyXml = reader.ReadOuterXml(); + var responseType = typeof(AddIntsResponse); + var response = (AddIntsResponse)Serialization.DataContractSerializer.Instance.DeserializeFromString(bodyXml, responseType); + + Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(nameof(SerializationException))); + Assert.That(response.ResponseStatus.Message, Does.Contain("Error trying to deserialize requestType:")); + } + } + + } } \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/Web.config b/tests/ServiceStack.WebHost.IntegrationTests/Web.config index 419c97bb6cf..6bde7c35e64 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/Web.config +++ b/tests/ServiceStack.WebHost.IntegrationTests/Web.config @@ -1,27 +1,28 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> - <add key="servicestack:license" value="1001-e1JlZjoxMDAxLE5hbWU6VGVzdCBCdXNpbmVzcyxUeXBlOkJ1c2luZXNzLEhhc2g6UHVNTVRPclhvT2ZIbjQ5MG5LZE1mUTd5RUMzQnBucTFEbTE3TDczVEF4QUNMT1FhNXJMOWkzVjFGL2ZkVTE3Q2pDNENqTkQyUktRWmhvUVBhYTBiekJGUUZ3ZE5aZHFDYm9hL3lydGlwUHI5K1JsaTBYbzNsUC85cjVJNHE5QVhldDN6QkE4aTlvdldrdTgyTk1relY2eis2dFFqTThYN2lmc0JveHgycFdjPSxFeHBpcnk6MjAxMy0wMS0wMX0="/> - <add key="test" value="val" /> <add key="oauth.facebook.AppId" value="231464590266507" /> <add key="oauth.facebook.AppSecret" value="9dd6ce54b4405dd1325d271d2419bc34" /> <add key="oauth.facebook.Permissions" value="email,read_stream,offline_access" /> - <add key="RecreateTables" value="True" /> - </appSettings> + <add key="RecreateTables" value="True" /> + </appSettings> <connectionStrings /> <location path="api"> - <system.web> - <httpHandlers> - <add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack, Version=1.0.0.0, Culture=neutral" verb="*" /> - </httpHandlers> - </system.web> <system.webServer> <handlers> - <add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack, Version=1.0.0.0, Culture=neutral" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /> + <add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /> </handlers> </system.webServer> </location> + <!-- + For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367. + + The following attributes can be set on the <httpRuntime> tag. + <system.Web> + <httpRuntime targetFramework="4.5.1" /> + </system.Web> + --> <system.web> <!-- Set compilation debug="true" to insert debugging @@ -29,7 +30,12 @@ affects performance, set this value to true only during development. --> - <compilation debug="true" targetFramework="4.0" /> + <compilation debug="true" targetFramework="4.7.2"> + <assemblies> + <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" /> + </assemblies> + </compilation> <!-- The <authentication> section enables configuration of the security authentication mode used by @@ -62,12 +68,21 @@ <handlers> <!--<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true"/>--> </handlers> + <httpErrors existingResponse="PassThrough" /> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-2.0.0.666" newVersion="2.0.0.666" /> + <bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> </assemblyBinding> </runtime> diff --git a/tests/ServiceStack.WebHost.IntegrationTests/dir/index.html b/tests/ServiceStack.WebHost.IntegrationTests/dir/index.html new file mode 100644 index 00000000000..31063146576 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/dir/index.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Title</title> +</head> +<body> + + <h1>dir/index.html</h1> + +</body> +</html> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/dir/sub/index.html b/tests/ServiceStack.WebHost.IntegrationTests/dir/sub/index.html new file mode 100644 index 00000000000..e9fa3e179b7 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/dir/sub/index.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Title</title> +</head> +<body> + + <h1>dir/sub/index.html</h1> + +</body> +</html> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/dir/sub/webpage.forbidden b/tests/ServiceStack.WebHost.IntegrationTests/dir/sub/webpage.forbidden new file mode 100644 index 00000000000..ecf61b47162 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/dir/sub/webpage.forbidden @@ -0,0 +1 @@ +This page should not be displayed. \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/packages.config b/tests/ServiceStack.WebHost.IntegrationTests/packages.config index 93ae56876e9..81edb70fdaf 100644 --- a/tests/ServiceStack.WebHost.IntegrationTests/packages.config +++ b/tests/ServiceStack.WebHost.IntegrationTests/packages.config @@ -1,5 +1,27 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="NUnit" version="2.6.3" targetFramework="net40" /> - <package id="protobuf-net" version="2.0.0.668" targetFramework="net45" /> + <package id="Microsoft.CSharp" version="4.5.0" targetFramework="net472" /> + <package id="NUnit" version="3.12.0" targetFramework="net472" /> + <package id="protobuf-net" version="2.4.6" targetFramework="net472" /> + <package id="ServiceStack" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.Api.OpenApi" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.Client" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.Common" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.HttpClient" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.Interfaces" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.NetFramework" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.OrmLite" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.OrmLite.Sqlite" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.ProtoBuf" version="5.8.0" targetFramework="net472" /> + <package id="ServiceStack.Redis" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.Server" version="5.9.0" targetFramework="net472" /> + <package id="ServiceStack.Text" version="5.9.0" targetFramework="net472" /> + <package id="System.Buffers" version="4.5.1" targetFramework="net472" /> + <package id="System.ComponentModel.Annotations" version="4.7.0" targetFramework="net472" /> + <package id="System.Data.SQLite.Core" version="1.0.113.1" targetFramework="net472" /> + <package id="System.Memory" version="4.5.4" targetFramework="net472" /> + <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" /> + <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" /> + <package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="net472" /> + <package id="System.ValueTuple" version="4.5.0" targetFramework="net472" /> </packages> \ No newline at end of file diff --git a/tests/ServiceStack.WebHost.IntegrationTests/start.cmd b/tests/ServiceStack.WebHost.IntegrationTests/start.cmd new file mode 100644 index 00000000000..6bf5f973a30 --- /dev/null +++ b/tests/ServiceStack.WebHost.IntegrationTests/start.cmd @@ -0,0 +1 @@ +"C:/Program Files (x86)/IIS Express/iisexpress.exe" /config:C:/src/ServiceStack/src/.idea/config/applicationhost.config /site:ServiceStack.WebHost.IntegrationTests /apppool:Clr4IntegratedAppPool diff --git a/tests/ServiceStack.WebHostApp/ServiceStack.WebHostApp.csproj b/tests/ServiceStack.WebHostApp/ServiceStack.WebHostApp.csproj index 8eef60a51a0..804f6fc1ad6 100644 --- a/tests/ServiceStack.WebHostApp/ServiceStack.WebHostApp.csproj +++ b/tests/ServiceStack.WebHostApp/ServiceStack.WebHostApp.csproj @@ -52,10 +52,10 @@ <Reference Include="System.Xml" /> <Reference Include="System.Web.Services" /> <Reference Include="ServiceStack.Redis"> - <HintPath>..\..\lib\ServiceStack.Redis.dll</HintPath> + <HintPath>..\..\lib\net45\ServiceStack.Redis.dll</HintPath> </Reference> <Reference Include="ServiceStack.Text"> - <HintPath>..\..\lib\ServiceStack.Text.dll</HintPath> + <HintPath>..\..\lib\net45\ServiceStack.Text.dll</HintPath> </Reference> <Reference Include="System.Xml.Linq" /> </ItemGroup>